aio-popup 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.css CHANGED
@@ -372,6 +372,7 @@
372
372
  align-items: center;
373
373
  box-sizing: border-box;
374
374
  padding: 0 12px;
375
+ gap:6px;
375
376
  }
376
377
 
377
378
  .aio-popup-time {
package/index.d.ts CHANGED
@@ -43,6 +43,12 @@ export type AP_alert = {
43
43
  closeText?: string;
44
44
  animate?: boolean;
45
45
  onClose?: boolean | (() => void);
46
+ actions?: {
47
+ text: string;
48
+ callback: any;
49
+ className?: string;
50
+ id: string;
51
+ }[];
46
52
  };
47
53
  export type AP_snackebar = {
48
54
  id?: string;
package/index.js CHANGED
@@ -529,7 +529,7 @@ const SnackebarBar = () => {
529
529
  return _jsx("div", { className: 'aio-popup-snackebar-bar', style: { transition: `${item.time || 8}s linear` } });
530
530
  };
531
531
  export function Alert(props) {
532
- let { icon, type = '', title = '', text = '', time = 10, className, closeText = 'Close', onClose, rtl } = props;
532
+ let { icon, type = '', title = '', text = '', time = 10, className, closeText = 'Close', onClose, rtl, actions = [] } = props;
533
533
  let $$ = {
534
534
  id: '',
535
535
  time: 0,
@@ -553,6 +553,10 @@ export function Alert(props) {
553
553
  </div>
554
554
  <div class='aio-popup-alert-footer'>
555
555
  <button class='aio-popup-alert-close ${$$.id}'>${closeText}</button>
556
+ ${actions.map((o) => {
557
+ const { className, id, text } = o;
558
+ return `<button data-action='${id}' class='aio-popup-alert-action${className ? ' ' + className : ''}'>${text}</button>`;
559
+ }).join(' ')}
556
560
  </div>
557
561
  <div class='aio-popup-time'></div>
558
562
  </div>
@@ -603,10 +607,21 @@ export function Alert(props) {
603
607
  dom.addClass('not-mounted');
604
608
  }
605
609
  },
610
+ callAction(e) {
611
+ const target = $(e.target);
612
+ const actionId = target.attr('data-action');
613
+ const action = actions.find((o) => o.id === actionId);
614
+ if (!action) {
615
+ return;
616
+ }
617
+ action.callback();
618
+ },
606
619
  render() {
607
620
  $('body').append($$.getRender());
608
621
  $('button.' + $$.id).off('click', $$.close);
609
622
  $('button.' + $$.id).on('click', $$.close);
623
+ $('button.aio-popup-alert-action').off('click', $$.callAction);
624
+ $('button.aio-popup-alert-action').on('click', $$.callAction);
610
625
  $$.toggleClass(true);
611
626
  }
612
627
  };
@@ -731,16 +746,16 @@ function getEasing(highlight) {
731
746
  const { easing } = highlight;
732
747
  var easingNames = [
733
748
  'linear',
734
- 'easeInQuad',
735
- 'easeInSine',
736
- 'easeInCirc',
737
- 'easeInBack',
738
- 'easeOutQuad',
739
- 'easeOutSine',
740
- 'easeOutCirc',
741
- 'easeInOutQuad',
742
- 'easeInOutSine',
743
- 'easeInOutBack',
749
+ 'easeInQuad', //1
750
+ 'easeInSine', //5
751
+ 'easeInCirc', //7
752
+ 'easeInBack', //8
753
+ 'easeOutQuad', //9
754
+ 'easeOutSine', //13
755
+ 'easeOutCirc', //15
756
+ 'easeInOutQuad', //18
757
+ 'easeInOutSine', //22
758
+ 'easeInOutBack', //25
744
759
  'easeOutBounce', //27
745
760
  ];
746
761
  if (typeof easing === 'number') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-popup",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "handle all types of popup and modals in react",
5
5
  "main": "index.js",
6
6
  "scripts": {