aio-popup 6.6.1 → 6.6.2

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.
Files changed (3) hide show
  1. package/index.d.ts +6 -5
  2. package/index.js +3 -3
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2,11 +2,12 @@ import { ReactNode } from 'react';
2
2
  import './index.css';
3
3
  export type AP_position = 'fullscreen' | 'center' | 'popover' | 'left' | 'right' | 'top' | 'bottom';
4
4
  export type AP_attrsKey = 'backdrop' | 'modal' | 'header' | 'body' | 'footer';
5
- export type AP_header = ((p: {
6
- removeModal: () => void;
7
- state: any;
8
- setState: any;
9
- }) => ReactNode) | {
5
+ export type AP_header = {
6
+ html?: ((p: {
7
+ removeModal: () => void;
8
+ state: any;
9
+ setState: any;
10
+ }) => ReactNode);
10
11
  title?: string;
11
12
  subtitle?: string;
12
13
  before?: ReactNode;
package/index.js CHANGED
@@ -388,8 +388,8 @@ const ModalHeader = () => {
388
388
  }
389
389
  let { setAttrs = () => { return {}; } } = modal;
390
390
  let attrs = setAttrs('header') || {};
391
- if (typeof modal.header === 'function') {
392
- return modal.header({ removeModal: removeModal, state, setState });
391
+ if (modal.header && modal.header.html) {
392
+ return modal.header.html({ removeModal: removeModal, state, setState });
393
393
  }
394
394
  if (typeof modal.header !== 'object') {
395
395
  return null;
@@ -418,7 +418,7 @@ const ModalClose = () => {
418
418
  return _jsx("div", { className: `aio-popup-header-close`, onClick: (e) => {
419
419
  e.stopPropagation();
420
420
  e.preventDefault();
421
- if (typeof header.onClose === 'function') {
421
+ if (header && typeof header.onClose === 'function') {
422
422
  header.onClose({ state, setState });
423
423
  }
424
424
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-popup",
3
- "version": "6.6.1",
3
+ "version": "6.6.2",
4
4
  "description": "handle all types of popup and modals in react",
5
5
  "main": "index.js",
6
6
  "scripts": {