Skip to content

Commit

Permalink
📦 v3.0
Browse files Browse the repository at this point in the history
🎉 v3.0 is here
  • Loading branch information
realrashid committed Nov 21, 2019
1 parent 5b002da commit 45a9989
Show file tree
Hide file tree
Showing 14 changed files with 277 additions and 154 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to `sweet-alert` will be documented in this file.

## v3.0 - 2019-11-20
- Upgraded SweetAlert2 to latest version
- Added option to pass SweetAlert2 CDN link from included view
- Updated `animation($showClass = [], $hideClass = [])`
- Added `buttonsStyling()` method
- Added `iconHtml()` method
- Docs Updated
- Fix some bugs

## v2.0.3 - 2019-10-13
- Added symfony/thanks
- Docs Updated
- Fix some bugs

## v2.0.2 - 2019-09-10
- Added Missing ^ indicator prevents Laravel from updating to 6.0.1 and up
- Docs Updated
Expand Down
17 changes: 10 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<p align="center">
<a href="https://realrashid.github.io/sweet-alert/">
<a href="https://realrashid.github.io/sweet-alert/"
onClick="ga('send', 'event', 'Button', 'Click', 'Logo');">
<img src="imgs/logo/logo.png" alt="SweetAlert2">
</a>
</p>
Expand All @@ -11,12 +12,14 @@ A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAV
</p>

<p align="center">
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://opencollective.com/sweet-alert#backers" target="_blank"><img alt="Backers on Open Collective" src="https://opencollective.com/sweet-alert/backers/badge.svg"></a>
<a href="https://opencollective.com/sweet-alert#sponsors" target="_blank"><img alt="Backers on Open Collective" src="https://opencollective.com/sweet-alert/sponsors/badge.svg"></a>
<a href="https://www.patreon.com/realrashid" target="_blank"><img alt="Support me on Patreon" src="http://ionicabizau.github.io/badges/patreon.svg"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/license.svg" alt="License"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"
onClick="ga('send', 'event', 'Button', 'Click', 'Total Downloads');"><img src="https://poser.pugx.org/realrashid/sweet-alert/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"
onClick="ga('send', 'event', 'Button', 'Click', 'Latest Stable Version');"><img src="https://poser.pugx.org/realrashid/sweet-alert/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://www.patreon.com/realrashid" target="_blank"
onClick="ga('send', 'event', 'Button', 'Click', 'Support me on Patreon');"><img alt="Support me on Patreon" src="http://ionicabizau.github.io/badges/patreon.svg"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"
onClick="ga('send', 'event', 'Button', 'Click', 'License');"><img src="https://poser.pugx.org/realrashid/sweet-alert/license.svg" alt="License"></a>
</p>

!> note: if you are using sweet-alert v1.0 you can get README for v1.0 from [here](https://github.com/realrashid/sweet-alert/blob/1.0/readme.md)
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![logo](https://github.com/sweetalert2/sweetalert2/raw/master/assets/swal2-logo.png)
<h1>sweet-alert <small>2.0.2</small></h1>
<h1>sweet-alert <small>3.0</small></h1>

<h4>By <strong>Rashid Ali</strong></h4>

Expand Down
14 changes: 14 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to `sweet-alert` will be documented in this file.

## v3.0 - 2019-11-21
- Upgraded SweetAlert2 to latest version
- Added option to pass SweetAlert2 CDN link from included view
- Updated `animation($showClass = [], $hideClass = [])` method
- Added `buttonsStyling()` method
- Added `iconHtml()` method
- Docs Updated
- Fix some bugs

## v2.0.3 - 2019-10-13
- Added symfony/thanks
- Docs Updated
- Fix some bugs

## v2.0.2 - 2019-09-10
- Added Missing ^ indicator prevents Laravel from updating to 6.0.1 and up
- Docs Updated
Expand Down
54 changes: 0 additions & 54 deletions docs/codefund.js

This file was deleted.

17 changes: 3 additions & 14 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Include SweetAlert 2 View

in your master layout
Include `'sweetalert::alert'` in master layout

```php
@include('sweetalert::alert')
Expand All @@ -17,19 +17,8 @@ php artisan vendor:publish --provider="RealRashid\SweetAlert\SweetAlertServicePr
> note: The javascript library of sweetalert2 is already loaded and included in the view with the help of above command!
!> If you don't want to use pre-loaded **sweetalert.all.js** so you can use cdn.
Just chnage the below .env key.
Just pass the `cdn` variable to above included view like below example.

```php
// By Default its true
// Turn it to false
SWEET_ALERT_LOCAL=false
// Add sweetalert2 cdn link
SWEET_ALERT_CDN=''
```
!> You can not use local **sweetalert.all.js** or cdn together!

ex:
```php
SWEET_ALERT_LOCAL=true
SWEET_ALERT_CDN='link'
@include('sweetalert::alert', ['cdn' => "https://cdn.jsdelivr.net/npm/sweetalert2@9"])
```
71 changes: 52 additions & 19 deletions docs/environment.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
# Environment Variables

```php
/*
|--------------------------------------------------------------------------
| SweetAlert2 Local .JS File
|--------------------------------------------------------------------------
| By default SweetAlert2 use its local sweetalert.all.js
| file.
*/
SWEET_ALERT_LOCAL=true

/*
|--------------------------------------------------------------------------
| CDN LINK
|--------------------------------------------------------------------------
| By default SweetAlert2 use its local sweetalert.all.js
| file.
| However, you can use its cdn if you want.
|
*/
SWEET_ALERT_CDN=''

'cdn' => env('SWEET_ALERT_CDN'),

/*
|--------------------------------------------------------------------------
| AutoClose Timer
|--------------------------------------------------------------------------
|
| This is for the all Modal windows.
| For specific modal just use the autoClose() helper method.
|
*/
SWEET_ALERT_TIMER=5000

'timer' => env('SWEET_ALERT_TIMER', 5000),

/*
|--------------------------------------------------------------------------
| Width
|--------------------------------------------------------------------------
|
| Modal window width, including paddings (box-sizing: border-box).
| Can be in px or %.
| The default width is 32rem.
| This is for the all Modal windows.
| for particular modal just use the width() helper method.
*/
SWEET_ALERT_WIDTH=32rem

'width' => env('SWEET_ALERT_WIDTH', '32rem'),

/*
|--------------------------------------------------------------------------
Expand All @@ -48,29 +46,41 @@ SWEET_ALERT_WIDTH=32rem
| By default, SweetAlert2 sets html's and body's CSS height to auto !important.
| If this behavior isn't compatible with your project's layout,
| set heightAuto to false.
|
*/
SWEET_ALERT_HEIGHT_AUTO=true

'height_auto' => env('SWEET_ALERT_HEIGHT_AUTO', true),

/*
|--------------------------------------------------------------------------
| Padding
|--------------------------------------------------------------------------
|
| Modal window padding.
| Can be in px or %.
| The default padding is 1.25rem.
| This is for the all Modal windows.
| for particular modal just use the padding() helper method.
*/
SWEET_ALERT_PADDING=1.25rem

'padding' => env('SWEET_ALERT_PADDING', '1.25rem'),

/*
|--------------------------------------------------------------------------
| Animation
|--------------------------------------------------------------------------
| If set to false, modal CSS animation will be disabled.
| For specific modal just use the animation() helper method.
|
*/
SWEET_ALERT_ANIMATION=true

'animation' => [
'enable' => env('SWEET_ALERT_ANIMATION_ENABLE', true),
'showClass' => env('SWEET_ALERT_ANIMATION_SHOW_CLASS', 'animated fadeInDown faster'),
'hideClass' => env('SWEET_ALERT_ANIMATION_HIDE_CLASS', 'animated fadeOutUp faster'),
],

'animatecss' => env('SWEET_ALERT_ANIMATECSS', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css'),

/*
|--------------------------------------------------------------------------
Expand All @@ -80,8 +90,10 @@ SWEET_ALERT_ANIMATION=true
| It can be useful when you're using custom HTML description.
| This is for the all Modal windows.
| For specific modal just use the showConfirmButton() helper method.
|
*/
SWEET_ALERT_CONFIRM_BUTTON=true

'show_confirm_button' => env('SWEET_ALERT_CONFIRM_BUTTON', true),

/*
|--------------------------------------------------------------------------
Expand All @@ -91,8 +103,10 @@ SWEET_ALERT_CONFIRM_BUTTON=true
| which the user can click on to dismiss the modal.
| This is for the all Modal windows.
| For specific modal just use the showCloseButton() helper method.
|
*/
SWEET_ALERT_CLOSE_BUTTON=false

'show_close_button' => env('SWEET_ALERT_CLOSE_BUTTON', false),

/*
|--------------------------------------------------------------------------
Expand All @@ -102,7 +116,26 @@ SWEET_ALERT_CLOSE_BUTTON=false
| 'top-start', 'top-end', 'center', 'center-start',
| 'center-end', 'bottom', 'bottom-start', or 'bottom-end'.
| For specific modal just use the position() helper method.
|
*/
SWEET_ALERT_TOAST_POSITION=top-end

```
'toast_position' => env('SWEET_ALERT_TOAST_POSITION', 'top-end'),

/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
| Modal window or toast, config for the Middleware
|
*/

'middleware' => [

'toast_position' => env('SWEET_ALERT_MIDDLEWARE_TOAST_POSITION', 'top-end'),

'toast_close_button' => env('SWEET_ALERT_MIDDLEWARE_TOAST_CLOSE_BUTTON', true),

'alert_auto_close' => env('SWEET_ALERT_MIDDLEWARE_ALERT_AUTO_CLOSE', 5000),
]

```
38 changes: 36 additions & 2 deletions docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,47 @@ alert('Title','Lorem Lorem Lorem', 'success')->background('#fff');
##### Animation

`
animation(true)
animation($showClass = [], $hideClass = [])
`
> If set to false, modal CSS animation will be disabled.
Custom animation with [Animate.css](https://daneden.github.io/animate.css/)

``` php
// example:
alert()->info('InfoAlert','Lorem ipsum dolor sit amet.')
->animation(
[ 'popup' => 'animated tada faster'],
[ 'popup' => 'animated fadeInUp faster']
);
```

> Note: Animate.css CDN link is imported in package config file,
##### Button Styling

`
buttonsStyling($buttonsStyling)
`
> Apply default styling to buttons.
If you want to use your own classes (e.g. Bootstrap classes)
set this parameter to false.

``` php
// example:
alert()->success('Post Created', 'Successfully')->buttonsStyling(false);
```

##### Icon Html

`
iconHtml($iconHtml)
`
> Use any HTML inside icons (e.g. Font Awesome)
``` php
// example:
alert('Title','Lorem Lorem Lorem', 'success')->animation(false);
alert()->success('Post Created', 'Successfully')->iconHtml('<i class="far fa-thumbs-up"></i>);
```

##### Focus Confirm
Expand Down
Loading

0 comments on commit 45a9989

Please sign in to comment.