Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
clinton9ice committed Nov 6, 2021
1 parent 5d60b94 commit 9b2da1c
Show file tree
Hide file tree
Showing 80 changed files with 1,346 additions and 1,890 deletions.
22 changes: 22 additions & 0 deletions assets/sweetalert/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014-present Tristan Edwards

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

220 changes: 220 additions & 0 deletions assets/sweetalert/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
<p align="center">
<a href="http://sweetalert.js.org">
<img alt="SweetAlert" src="https://raw.githubusercontent.com/t4t5/sweetalert/e3c2085473a0eb5a6b022e43eb22e746380bb955/assets/logotype.png" width="300">
</a>
</p>

<p align="center">
A beautiful replacement for JavaScript's "alert"
</p>

<p align="center">
<a href="https://badge.fury.io/js/sweetalert"><img src="https://badge.fury.io/js/sweetalert.svg" alt="npm version" height="18"></a>
<a href="https://travis-ci.org/t4t5/sweetalert"><img src="https://travis-ci.org/t4t5/sweetalert.svg" alt="Build status" /></a>
<a href="https://www.npmjs.com/package/sweetalert">
<img src="https://img.shields.io/npm/dm/sweetalert.svg" />
</a>
<a href="https://github.com/t4t5/sweetalert/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/t4t5/sweetalert.svg" />
</a>
<a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/SweetAlert/backers/badge.svg" /></a> <a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/SweetAlert/sponsors/badge.svg" /></a>
</p>

<p align="center">
<img alt="A success modal" src="https://raw.githubusercontent.com/t4t5/sweetalert/e3c2085473a0eb5a6b022e43eb22e746380bb955/assets/swal.gif">
</p>


## Installation

```bash
$ npm install --save sweetalert
```

## Usage

```javascript
import swal from 'sweetalert';

swal("Hello world!");
```

## Upgrading from 1.X

Many improvements and breaking changes have been introduced in the 2.0 release. Make sure you read the [upgrade guide](https://sweetalert.js.org/guides/#upgrading-from-1x) to avoid nasty suprises!

## Guides

- [Installation](https://sweetalert.js.org/guides/#installation)
- [Getting started](https://sweetalert.js.org/guides/#getting-started)
- [Advanced examples](https://sweetalert.js.org/guides/#advanced-examples)
- [Using with libraries](https://sweetalert.js.org/guides/#using-with-libraries)
- [Upgrading from 1.X](https://sweetalert.js.org/guides/#upgrading-from-1x)

## Documentation

- [Configuration](https://sweetalert.js.org/docs/#configuration)
- [Methods](https://sweetalert.js.org/docs/#methods)
- [Theming](https://sweetalert.js.org/docs/#theming)

## Examples

### An error message:
```javascript
swal("Oops!", "Something went wrong!", "error");
```

### A warning message, with a function attached to the confirm message:
- Using promises:
```javascript
swal({
title: "Are you sure?",
text: "Are you sure that you want to leave this page?",
icon: "warning",
dangerMode: true,
})
.then(willDelete => {
if (willDelete) {
swal("Deleted!", "Your imaginary file has been deleted!", "success");
}
});
```
- Using async/await:
```javascript
const willDelete = await swal({
title: "Are you sure?",
text: "Are you sure that you want to delete this file?",
icon: "warning",
dangerMode: true,
});

if (willDelete) {
swal("Deleted!", "Your imaginary file has been deleted!", "success");
}
```

### A prompt modal, where the user's input is logged:
- Using promises:
```javascript
swal("Type something:", {
content: "input",
})
.then((value) => {
swal(`You typed: ${value}`);
});
```
- Using async/await:
```javascript
const value = await swal("Type something:", {
content: "input",
});

swal(`You typed: ${value}`);
```

### In combination with Fetch:
- Using promises:
```javascript
swal({
text: "Wanna log some information about Bulbasaur?",
button: {
text: "Search!",
closeModal: false,
},
})
.then(willSearch => {
if (willSearch) {
return fetch("http://pokeapi.co/api/v2/pokemon/1");
}
})
.then(result => result.json())
.then(json => console.log(json))
.catch(err => {
swal("Oops!", "Seems like we couldn't fetch the info", "error");
});
```
- Using async/await:
```javascript
const willSearch = await swal({
text: "Wanna log some information about Bulbasaur?",
button: {
text: "Search!",
closeModal: false,
},
});

if (willSearch) {
try {
const result = await fetch("http://pokeapi.co/api/v2/pokemon/1");
const json = await result.json();
console.log(json);
} catch (err) {
swal("Oops!", "Seems like we couldn't fetch the info", "error");
}
}
```

## Using with React

SweetAlert has tools for [integrating with your favourite rendering library](https://sweetalert.js.org/guides/#using-with-libraries).

If you're using React, you can install [SweetAlert with React](https://www.npmjs.com/package/@sweetalert/with-react) in addition to the main library, and easily add React components to your alerts like this:

```javascript
import React from 'react'
import swal from '@sweetalert/with-react'

swal(
<div>
<h1>Hello world!</h1>
<p>
This is now rendered with JSX!
</p>
</div>
)
```

[Read more about integrating with React](http://localhost:3000/guides#using-react)

## Contributing

### If you're changing the core library:
1. Make changes in the `src` folder.
2. Preview changes by running `npm run docs`
3. Submit pull request

### If you're changing the documentation:
1. Make changes in the `docs-src` folder.
2. Preview changes by running `npm run docs`
3. Run `npm run builddocs` to compile the changes to the `docs` folder
4. Submit pull request

## Contributors

This project exists thanks to all the people who contribute. [[Contribute](https://github.com/t4t5/sweetalert#contributing)].
<a href="https://github.com/t4t5/sweetalert/graphs/contributors"><img src="https://opencollective.com/SweetAlert/contributors.svg?width=890&button=false" /></a>


## Backers

Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/SweetAlert#backer)]

<a href="https://opencollective.com/SweetAlert#backers" target="_blank"><img src="https://opencollective.com/SweetAlert/backers.svg?width=890"></a>


## Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/SweetAlert#sponsor)]

<a href="https://opencollective.com/SweetAlert/sponsor/0/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/1/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/2/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/3/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/4/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/5/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/6/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/7/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/8/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/SweetAlert/sponsor/9/website" target="_blank"><img src="https://opencollective.com/SweetAlert/sponsor/9/avatar.svg"></a>


1 change: 1 addition & 0 deletions assets/sweetalert/dist/sweetalert.min.js

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions assets/sweetalert/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"name": "sweetalert",
"version": "2.1.2",
"description": "A beautiful replacement for JavaScript's \"alert\"",
"main": "dist/sweetalert.min.js",
"types": "typings/sweetalert.d.ts",
"scripts": {
"build": "node_modules/.bin/webpack -p",
"buildtest": "npm run build && jest",
"test": "node_modules/.bin/jest",
"builddocs": "node_modules/jus/cli.js build docs-src docs",
"docs": "npm run build && node_modules/jus/cli.js serve docs-src",
"prepare": "npm run build && npm run builddocs",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "https://github.com/t4t5/sweetalert"
},
"keywords": [
"sweetalert",
"alert",
"modal",
"popup"
],
"author": "Tristan Edwards <[email protected]> (https://tristanedwards.me)",
"license": "MIT",
"bugs": {
"url": "https://github.com/t4t5/sweetalert/issues"
},
"homepage": "https://sweetalert.js.org/",
"devDependencies": {
"@types/jest": "19.2.3",
"autoprefixer": "6.7.7",
"babel-core": "6.24.1",
"babel-loader": "6.4.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.24.1",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.4.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",
"babel-standalone": "^6.26.0",
"babelify": "^6.0.2",
"browserify": "^9.0.8",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "0.28.7",
"dts-bundle": "0.7.3",
"exports-loader": "0.6.4",
"expose-loader": "0.7.3",
"glob": "^5.0.3",
"jest": "19.0.2",
"jquery": "3.2.1",
"jus": "0.24.1",
"nodelist-foreach-polyfill": "^1.2.0",
"opencollective": "^1.0.3",
"path": "^0.11.14",
"postcss-color-function": "3.0.0",
"postcss-custom-properties": "5.0.2",
"postcss-easy-import": "2.0.0",
"postcss-loader": "1.3.3",
"postcss-nesting": "2.3.1",
"react": "15.5.4",
"react-dom": "15.5.4",
"source-map-loader": "0.2.1",
"sweetalert": "file:./",
"@sweetalert/with-react": "^0.1.1",
"style-loader": "0.18.2",
"ts-jest": "19.0.14",
"ts-loader": "2.0.3",
"tslint": "5.1.0",
"tslint-loader": "3.5.2",
"typescript": "2.2.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"webpack": "3.5.5",
"webpack-bundle-analyzer": "2.9.0",
"webpack-dev-server": "2.4.2",
"webpack-merge": "4.1.0",
"whatwg-fetch": "^2.0.3"
},
"jest": {
"verbose": true,
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
]
},
"files": [
"dist",
"LICENSE.md",
"README.md",
"typings"
],
"dependencies": {
"es6-object-assign": "^1.1.0",
"promise-polyfill": "^6.0.2"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/SweetAlert"
}
}
13 changes: 13 additions & 0 deletions assets/sweetalert/typings/core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ActionOptions, SwalState } from './modules/state';
import { SwalOptions } from './modules/options';
export declare type SwalParams = (string | Partial<SwalOptions>)[];
export interface SweetAlert {
(...params: SwalParams): Promise<any>;
close?(namespace?: string): void;
getState?(): SwalState;
setActionValue?(opts: string | ActionOptions): void;
stopLoading?(): void;
setDefaults?(opts: object): void;
}
declare const swal: SweetAlert;
export default swal;
5 changes: 5 additions & 0 deletions assets/sweetalert/typings/modules/actions.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { SwalState } from './state';
export declare const openModal: () => void;
export declare const onAction: (namespace?: string) => void;
export declare const getState: () => SwalState;
export declare const stopLoading: () => void;
5 changes: 5 additions & 0 deletions assets/sweetalert/typings/modules/class-list/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface ClassNameList {
[key: string]: string;
}
export declare const CLASS_NAMES: ClassNameList;
export default CLASS_NAMES;
3 changes: 3 additions & 0 deletions assets/sweetalert/typings/modules/event-listeners.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { SwalOptions } from './options';
declare const addEventListeners: (opts: SwalOptions) => void;
export default addEventListeners;
3 changes: 3 additions & 0 deletions assets/sweetalert/typings/modules/init/buttons.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ButtonList } from '../options/buttons';
declare const initButtons: (buttons: ButtonList, dangerMode: boolean) => void;
export default initButtons;
3 changes: 3 additions & 0 deletions assets/sweetalert/typings/modules/init/content.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ContentOptions } from '../options/content';
declare const initContent: (opts: ContentOptions) => void;
export default initContent;
2 changes: 2 additions & 0 deletions assets/sweetalert/typings/modules/init/icon.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const initIcon: (str: string) => void;
export default initIcon;
3 changes: 3 additions & 0 deletions assets/sweetalert/typings/modules/init/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { SwalOptions } from '../options';
export declare const init: (opts: SwalOptions) => void;
export default init;
Loading

0 comments on commit 9b2da1c

Please sign in to comment.