@kne/react-modal 0.1.1 → 0.1.4

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/dist/index.js CHANGED
@@ -36,7 +36,7 @@ const withLocale = reactIntl.createWithIntlProvider({
36
36
  namespace: 'react-modal'
37
37
  });
38
38
 
39
- var style = {"kne-responsive-boundary":"kne-react-modal_gh14z","kne-responsive-scroll":"kne-react-modal_Kfn6L","modal":"kne-react-modal_Bk7-B","small":"kne-react-modal_DZGD6","large":"kne-react-modal_9sz-n","modal-body-inner":"kne-react-modal_fFnva","is-mobile":"kne-react-modal_LtgJz","modal-container":"kne-react-modal_aEoZq","modal-antd-header":"kne-react-modal_54n8W","modal-antd-footer":"kne-react-modal_AJ9pV","modal-antd-body":"kne-react-modal_u2IjN","modal-outer":"kne-react-modal_kkILR","no-title":"kne-react-modal_8Iysr","no-footer":"kne-react-modal_VMxik","no-padding":"kne-react-modal_Fof-N","modal-title":"kne-react-modal_tG9MF","modal-body":"kne-react-modal_W-QFz","modal-footer":"kne-react-modal_meVfy","body-scroll-off":"kne-react-modal_l627I","is-embedded-footer":"kne-react-modal_17Eih","modal-footer-extra":"kne-react-modal_Fx8Z-","modal-footer-actions":"kne-react-modal_V3ZrX","modal-close":"kne-react-modal_-EK8N","modal-host":"kne-react-modal_eNb-h","modal-wrap":"kne-react-modal_3Sju5","modal-wrap-centered":"kne-react-modal_-qCIk","modal-wrap-fullscreen":"kne-react-modal_8lS2G","modal-mask-fullscreen":"kne-react-modal_XfLOC"};
39
+ var modalStyle = {"kne-responsive-boundary":"kne-react-modal_gh14z","kne-responsive-scroll":"kne-react-modal_Kfn6L","modal":"kne-react-modal_Bk7-B","small":"kne-react-modal_DZGD6","large":"kne-react-modal_9sz-n","modal-body-inner":"kne-react-modal_fFnva","is-mobile":"kne-react-modal_LtgJz","modal-container":"kne-react-modal_aEoZq","modal-antd-header":"kne-react-modal_54n8W","modal-antd-footer":"kne-react-modal_AJ9pV","modal-antd-body":"kne-react-modal_u2IjN","modal-outer":"kne-react-modal_kkILR","no-title":"kne-react-modal_8Iysr","no-footer":"kne-react-modal_VMxik","no-padding":"kne-react-modal_Fof-N","modal-title":"kne-react-modal_tG9MF","modal-body":"kne-react-modal_W-QFz","modal-footer":"kne-react-modal_meVfy","body-scroll-off":"kne-react-modal_l627I","is-embedded-footer":"kne-react-modal_17Eih","modal-footer-extra":"kne-react-modal_Fx8Z-","modal-footer-actions":"kne-react-modal_V3ZrX","modal-close":"kne-react-modal_-EK8N","modal-host":"kne-react-modal_eNb-h","modal-wrap":"kne-react-modal_3Sju5","modal-wrap-centered":"kne-react-modal_-qCIk","modal-wrap-fullscreen":"kne-react-modal_8lS2G","modal-mask-fullscreen":"kne-react-modal_XfLOC"};
40
40
 
41
41
  const Footer = ({
42
42
  footer,
@@ -98,15 +98,15 @@ const Footer = ({
98
98
  return null;
99
99
  }
100
100
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
101
- className: classnames__default["default"](style['modal-footer'], 'modal-footer', {
102
- [style['is-mobile']]: isMobile,
103
- [style['is-embedded-footer']]: embeddedFooterOnly
101
+ className: classnames__default["default"](modalStyle['modal-footer'], 'modal-footer', {
102
+ [modalStyle['is-mobile']]: isMobile,
103
+ [modalStyle['is-embedded-footer']]: embeddedFooterOnly
104
104
  }),
105
105
  children: [showFooterSlot ? /*#__PURE__*/jsxRuntime.jsx("div", {
106
- className: style['modal-footer-extra'],
106
+ className: modalStyle['modal-footer-extra'],
107
107
  children: footer
108
108
  }) : null, showButtons ? /*#__PURE__*/jsxRuntime.jsx("div", {
109
- className: style['modal-footer-actions'],
109
+ className: modalStyle['modal-footer-actions'],
110
110
  children: /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], {
111
111
  list: list,
112
112
  showLength: list.length,
@@ -119,13 +119,13 @@ const Footer = ({
119
119
  const ModalLocaleRoot = withLocale(({
120
120
  children
121
121
  }) => children);
122
- const renderWithOptions = (value, options) => {
122
+ const renderWithOptions$1 = (value, options) => {
123
123
  if (typeof value === 'function') {
124
124
  return value(options);
125
125
  }
126
126
  return value;
127
127
  };
128
- const wrapCustomGetContainer = customGetContainer => {
128
+ const wrapCustomGetContainer$2 = customGetContainer => {
129
129
  if (!customGetContainer) {
130
130
  return undefined;
131
131
  }
@@ -134,10 +134,10 @@ const wrapCustomGetContainer = customGetContainer => {
134
134
  }
135
135
  return () => customGetContainer;
136
136
  };
137
- const VIEWPORT_EXAMPLE_SELECTORS = ['.example-driver-device-scroll'];
138
- const viewportPopupMountOptions = {
137
+ const VIEWPORT_EXAMPLE_SELECTORS$3 = ['.example-driver-device-scroll'];
138
+ const viewportPopupMountOptions$1 = {
139
139
  cover: 'viewport',
140
- exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS
140
+ exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS$3
141
141
  };
142
142
  const findParentModalMountHost = node => {
143
143
  if (!node || typeof node.closest !== 'function') {
@@ -154,7 +154,7 @@ const resolveModalGetContainer = ({
154
154
  getPopupContainer,
155
155
  getHostNode
156
156
  }) => {
157
- const wrappedCustom = wrapCustomGetContainer(customGetContainer);
157
+ const wrappedCustom = wrapCustomGetContainer$2(customGetContainer);
158
158
  return triggerNode => {
159
159
  if (wrappedCustom) {
160
160
  const custom = wrappedCustom(triggerNode);
@@ -170,17 +170,17 @@ const resolveModalGetContainer = ({
170
170
  return getPopupContainer(triggerNode);
171
171
  };
172
172
  };
173
- let parentScrollLockCount = 0;
174
- let parentScrollLocked = [];
175
- const lockParentScroll = getScrollElement => {
176
- parentScrollLockCount += 1;
177
- if (parentScrollLockCount === 1) {
173
+ let parentScrollLockCount$1 = 0;
174
+ let parentScrollLocked$1 = [];
175
+ const lockParentScroll$1 = getScrollElement => {
176
+ parentScrollLockCount$1 += 1;
177
+ if (parentScrollLockCount$1 === 1) {
178
178
  const targets = [document.body];
179
179
  const scrollEl = typeof getScrollElement === 'function' ? getScrollElement() : null;
180
180
  if (scrollEl && scrollEl !== document.body && !targets.includes(scrollEl)) {
181
181
  targets.push(scrollEl);
182
182
  }
183
- parentScrollLocked = targets.map(el => {
183
+ parentScrollLocked$1 = targets.map(el => {
184
184
  const prev = {
185
185
  overflow: el.style.overflow,
186
186
  overscrollBehavior: el.style.overscrollBehavior
@@ -194,28 +194,28 @@ const lockParentScroll = getScrollElement => {
194
194
  });
195
195
  }
196
196
  return () => {
197
- parentScrollLockCount = Math.max(0, parentScrollLockCount - 1);
198
- if (parentScrollLockCount === 0) {
199
- parentScrollLocked.forEach(({
197
+ parentScrollLockCount$1 = Math.max(0, parentScrollLockCount$1 - 1);
198
+ if (parentScrollLockCount$1 === 0) {
199
+ parentScrollLocked$1.forEach(({
200
200
  el,
201
201
  prev
202
202
  }) => {
203
203
  el.style.overflow = prev.overflow;
204
204
  el.style.overscrollBehavior = prev.overscrollBehavior;
205
205
  });
206
- parentScrollLocked = [];
206
+ parentScrollLocked$1 = [];
207
207
  }
208
208
  };
209
209
  };
210
- const useLockParentScroll = (enabled, getScrollElement) => {
210
+ const useLockParentScroll$1 = (enabled, getScrollElement) => {
211
211
  react.useEffect(() => {
212
212
  if (!enabled) {
213
213
  return undefined;
214
214
  }
215
- return lockParentScroll(getScrollElement);
215
+ return lockParentScroll$1(getScrollElement);
216
216
  }, [enabled, getScrollElement]);
217
217
  };
218
- const sizeStyleVars = (size, hasFooter) => {
218
+ const sizeStyleVars$1 = (size, hasFooter) => {
219
219
  const minBase = size === 'small' ? 300 : 500;
220
220
  const chrome = 48 + (hasFooter ? 58 : 0);
221
221
  const minHeight = `${Math.max(0, minBase - chrome)}px`;
@@ -254,23 +254,23 @@ const ModalOuter = ({
254
254
  }) => {
255
255
  const effectiveNoPadding = noPadding ?? bodyScroll === false;
256
256
  const bodyInner = /*#__PURE__*/jsxRuntime.jsx("div", {
257
- className: classnames__default["default"](style['modal-body-inner'], 'modal-body-inner', {
258
- [style['no-padding']]: effectiveNoPadding
257
+ className: classnames__default["default"](modalStyle['modal-body-inner'], 'modal-body-inner', {
258
+ [modalStyle['no-padding']]: effectiveNoPadding
259
259
  }),
260
260
  children: children
261
261
  });
262
- const bodyClassName = classnames__default["default"](style['modal-body'], 'modal-body');
262
+ const bodyClassName = classnames__default["default"](modalStyle['modal-body'], 'modal-body');
263
263
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
264
- className: classnames__default["default"](style['modal-outer'], 'modal-container', {
265
- [style['is-mobile']]: isMobile,
266
- [style['no-title']]: !title,
267
- [style['no-footer']]: footer === null && footerButtons === undefined,
268
- [style['no-padding']]: effectiveNoPadding
264
+ className: classnames__default["default"](modalStyle['modal-outer'], 'modal-container', {
265
+ [modalStyle['is-mobile']]: isMobile,
266
+ [modalStyle['no-title']]: !title,
267
+ [modalStyle['no-footer']]: footer === null && footerButtons === undefined,
268
+ [modalStyle['no-padding']]: effectiveNoPadding
269
269
  }),
270
270
  "data-testid": "react-modal",
271
271
  children: [closable === false ? null : /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
272
272
  "data-testid": "react-modal-close-btn",
273
- className: classnames__default["default"](style['modal-close'], 'modal-close'),
273
+ className: classnames__default["default"](modalStyle['modal-close'], 'modal-close'),
274
274
  type: "text",
275
275
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.CloseOutlined, {}),
276
276
  onClick: e => {
@@ -278,7 +278,7 @@ const ModalOuter = ({
278
278
  onClose && onClose();
279
279
  }
280
280
  }), title ? /*#__PURE__*/jsxRuntime.jsx("div", {
281
- className: classnames__default["default"](style['modal-title'], 'modal-title'),
281
+ className: classnames__default["default"](modalStyle['modal-title'], 'modal-title'),
282
282
  children: title
283
283
  }) : null, bodyScroll !== false ? /*#__PURE__*/jsxRuntime.jsx(SimpleBar__default["default"], {
284
284
  className: bodyClassName,
@@ -287,7 +287,7 @@ const ModalOuter = ({
287
287
  },
288
288
  children: bodyInner
289
289
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
290
- className: classnames__default["default"](bodyClassName, style['body-scroll-off']),
290
+ className: classnames__default["default"](bodyClassName, modalStyle['body-scroll-off']),
291
291
  children: bodyInner
292
292
  }), footer === null && footerButtons === undefined ? null : /*#__PURE__*/jsxRuntime.jsx(Footer, {
293
293
  footer: footer,
@@ -328,7 +328,7 @@ const computedCommonProps = ({
328
328
  }) => {
329
329
  const useMobileLayout = isMobile && mobileFullscreen !== false;
330
330
  const hasFooter = !(footer === null && footerButtons === undefined);
331
- const sizeVars = sizeStyleVars(size, hasFooter);
331
+ const sizeVars = sizeStyleVars$1(size, hasFooter);
332
332
  const {
333
333
  width,
334
334
  ...cssVars
@@ -338,20 +338,20 @@ const computedCommonProps = ({
338
338
  close: onClose
339
339
  });
340
340
  return /*#__PURE__*/jsxRuntime.jsx(ModalOuter, {
341
- title: renderWithOptions(title, opts),
341
+ title: renderWithOptions$1(title, opts),
342
342
  closable: closable,
343
343
  onClose: onClose,
344
344
  onConfirm: onConfirm,
345
345
  confirmText: confirmText,
346
346
  onCancel: onCancel,
347
347
  cancelText: cancelText,
348
- footerButtons: renderWithOptions(footerButtons, opts),
348
+ footerButtons: renderWithOptions$1(footerButtons, opts),
349
349
  noPadding: noPadding,
350
- footer: renderWithOptions(footer, opts),
350
+ footer: renderWithOptions$1(footer, opts),
351
351
  targetProps: opts,
352
352
  isMobile: useMobileLayout,
353
353
  bodyScroll: bodyScroll,
354
- children: renderWithOptions(children, opts)
354
+ children: renderWithOptions$1(children, opts)
355
355
  });
356
356
  };
357
357
  return {
@@ -359,14 +359,14 @@ const computedCommonProps = ({
359
359
  icon: null,
360
360
  centered: !useMobileLayout,
361
361
  width: props.width ?? (useMobileLayout ? 'var(--kne-modal-viewport-width, 100vw)' : width),
362
- wrapClassName: classnames__default["default"](wrapClassName, style['modal-wrap'], useMobileLayout ? style['modal-wrap-fullscreen'] : style['modal-wrap-centered'], useMobileLayout && fixedModeClass),
362
+ wrapClassName: classnames__default["default"](wrapClassName, modalStyle['modal-wrap'], useMobileLayout ? modalStyle['modal-wrap-fullscreen'] : modalStyle['modal-wrap-centered'], useMobileLayout && fixedModeClass),
363
363
  classNames: Object.assign({}, propsClassNames, {
364
- mask: classnames__default["default"](propsClassNames?.mask, useMobileLayout && style['modal-mask-fullscreen'], useMobileLayout && fixedModeClass),
365
- container: classnames__default["default"](style['modal-container'], useMobileLayout && style['is-mobile'], propsClassNames?.container),
366
- body: classnames__default["default"](style['modal-antd-body'], useMobileLayout && style['is-mobile'], propsClassNames?.body),
367
- footer: classnames__default["default"](style['modal-antd-footer'], propsClassNames?.footer),
368
- header: classnames__default["default"](style['modal-antd-header'], propsClassNames?.header),
369
- content: classnames__default["default"](style['modal-container'], useMobileLayout && style['is-mobile'], propsClassNames?.content)
364
+ mask: classnames__default["default"](propsClassNames?.mask, useMobileLayout && modalStyle['modal-mask-fullscreen'], useMobileLayout && fixedModeClass),
365
+ container: classnames__default["default"](modalStyle['modal-container'], useMobileLayout && modalStyle['is-mobile'], propsClassNames?.container),
366
+ body: classnames__default["default"](modalStyle['modal-antd-body'], useMobileLayout && modalStyle['is-mobile'], propsClassNames?.body),
367
+ footer: classnames__default["default"](modalStyle['modal-antd-footer'], propsClassNames?.footer),
368
+ header: classnames__default["default"](modalStyle['modal-antd-header'], propsClassNames?.header),
369
+ content: classnames__default["default"](modalStyle['modal-container'], useMobileLayout && modalStyle['is-mobile'], propsClassNames?.content)
370
370
  }),
371
371
  title: null,
372
372
  maskClosable: Object.prototype.hasOwnProperty.call(props, 'maskClosable') ? props.maskClosable : false,
@@ -374,8 +374,8 @@ const computedCommonProps = ({
374
374
  footer: null,
375
375
  closable: false,
376
376
  onCancel: onClose,
377
- className: classnames__default["default"](className, style['modal'], style[size], {
378
- [style['is-mobile']]: useMobileLayout
377
+ className: classnames__default["default"](className, modalStyle['modal'], modalStyle[size], {
378
+ [modalStyle['is-mobile']]: useMobileLayout
379
379
  }),
380
380
  style: Object.assign({}, cssVars, propsStyle, useMobileLayout ? {
381
381
  '--kne-modal-viewport-gutter': '0px',
@@ -433,11 +433,11 @@ const Modal = withLocale(({
433
433
  getPopupContainer,
434
434
  anchorRef
435
435
  } = responsiveUtils.useMobilePopupMount({
436
- ...viewportPopupMountOptions,
437
- getPopupContainer: wrapCustomGetContainer(getContainer)
436
+ ...viewportPopupMountOptions$1,
437
+ getPopupContainer: wrapCustomGetContainer$2(getContainer)
438
438
  });
439
439
  const getScrollElement = responsiveUtils.useScrollElement();
440
- useLockParentScroll(!!open, getScrollElement);
440
+ useLockParentScroll$1(!!open, getScrollElement);
441
441
  const setAnchorRef = node => {
442
442
  hostRef.current = node;
443
443
  anchorRef(node);
@@ -450,7 +450,7 @@ const Modal = withLocale(({
450
450
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
451
451
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
452
452
  ref: setAnchorRef,
453
- className: style['modal-host'],
453
+ className: modalStyle['modal-host'],
454
454
  "aria-hidden": "true"
455
455
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
456
456
  ...computedCommonProps(Object.assign({}, props, {
@@ -473,7 +473,7 @@ const useModal = () => {
473
473
  const {
474
474
  resolveMount,
475
475
  getPopupContainer
476
- } = responsiveUtils.useMobilePopupMount(viewportPopupMountOptions);
476
+ } = responsiveUtils.useMobilePopupMount(viewportPopupMountOptions$1);
477
477
  const getScrollElement = responsiveUtils.useScrollElement();
478
478
  return props => {
479
479
  const anchor = typeof document !== 'undefined' ? document.activeElement : null;
@@ -481,7 +481,7 @@ const useModal = () => {
481
481
  isMobile,
482
482
  fixedModeClass
483
483
  } = resolveMount(anchor);
484
- const unlock = lockParentScroll(getScrollElement);
484
+ const unlock = lockParentScroll$1(getScrollElement);
485
485
  const api = {};
486
486
  const {
487
487
  afterClose: userAfterClose,
@@ -520,7 +520,799 @@ const useModal = () => {
520
520
  };
521
521
  };
522
522
 
523
- const ModalScrollRegion = ({
523
+ var style = {"kne-responsive-boundary":"kne-react-modal_qwqLr","kne-responsive-scroll":"kne-react-modal_vmry7","drawer":"kne-react-modal_cDsbq","small":"kne-react-modal_3QgK-","is-mobile":"kne-react-modal_FFf73","large":"kne-react-modal_8lell","drawer-body-inner":"kne-react-modal_xgX4D","drawer-antd-header":"kne-react-modal_3EUxr","drawer-antd-footer":"kne-react-modal_2G81L","drawer-antd-body":"kne-react-modal_eKVMu","drawer-outer":"kne-react-modal_P3Cw8","no-title":"kne-react-modal_upRot","no-footer":"kne-react-modal_j4sGu","no-padding":"kne-react-modal_pg37M","drawer-title":"kne-react-modal_-hw5V","drawer-body":"kne-react-modal_nJj7Y","body-scroll-off":"kne-react-modal_2Wh1H","modal-footer-extra":"kne-react-modal_M4hy9","drawer-close":"kne-react-modal_dVh38","drawer-host":"kne-react-modal_Nsxi9","drawer-host-render":"kne-react-modal_iGDWP","drawer-panel-host":"kne-react-modal_A0h-2","drawer-panel-body":"kne-react-modal_E4tcc","drawer-form-host":"kne-react-modal_vKkQW","drawer-wrapper-mobile":"kne-react-modal_vsxOs","drawer-wrapper-mobile-vertical":"kne-react-modal_HG8Vz","drawer-root-mobile":"kne-react-modal_G-qXe"};
524
+
525
+ const DrawerLocaleRoot = withLocale(({
526
+ children
527
+ }) => children);
528
+ const VIEWPORT_EXAMPLE_SELECTORS$2 = ['.example-driver-device-scroll'];
529
+ const boundaryPopupMountOptions$1 = {
530
+ cover: 'boundary',
531
+ exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS$2
532
+ };
533
+ const renderWithOptions = (value, options) => {
534
+ if (typeof value === 'function') {
535
+ return value(options);
536
+ }
537
+ return value;
538
+ };
539
+ const wrapCustomGetContainer$1 = customGetContainer => {
540
+ if (!customGetContainer) {
541
+ return undefined;
542
+ }
543
+ if (typeof customGetContainer === 'function') {
544
+ return triggerNode => customGetContainer(triggerNode) || null;
545
+ }
546
+ return () => customGetContainer;
547
+ };
548
+ const isVerticalPlacement = placement => placement === 'top' || placement === 'bottom';
549
+ const findParentDrawerMountHost = node => {
550
+ if (!node || typeof node.closest !== 'function') {
551
+ return null;
552
+ }
553
+ const parentRoot = node.closest('.ant-drawer-root');
554
+ if (!parentRoot) {
555
+ return null;
556
+ }
557
+ return parentRoot.parentElement || (typeof document !== 'undefined' ? document.body : null);
558
+ };
559
+ const resolveDrawerGetContainer = ({
560
+ customGetContainer,
561
+ getPopupContainer,
562
+ getHostNode
563
+ }) => {
564
+ const wrappedCustom = wrapCustomGetContainer$1(customGetContainer);
565
+ return triggerNode => {
566
+ if (wrappedCustom) {
567
+ const custom = wrappedCustom(triggerNode);
568
+ if (custom) {
569
+ return custom;
570
+ }
571
+ }
572
+ const from = triggerNode || (typeof getHostNode === 'function' ? getHostNode() : null);
573
+ const nestedHost = findParentDrawerMountHost(from);
574
+ if (nestedHost) {
575
+ return nestedHost;
576
+ }
577
+ return getPopupContainer(triggerNode);
578
+ };
579
+ };
580
+ let parentScrollLockCount = 0;
581
+ let parentScrollLocked = [];
582
+ const lockParentScroll = getScrollElement => {
583
+ parentScrollLockCount += 1;
584
+ if (parentScrollLockCount === 1) {
585
+ const targets = [document.body];
586
+ const scrollEl = typeof getScrollElement === 'function' ? getScrollElement() : null;
587
+ if (scrollEl && scrollEl !== document.body && !targets.includes(scrollEl)) {
588
+ targets.push(scrollEl);
589
+ }
590
+ parentScrollLocked = targets.map(el => {
591
+ const prev = {
592
+ overflow: el.style.overflow,
593
+ overscrollBehavior: el.style.overscrollBehavior
594
+ };
595
+ el.style.overflow = 'hidden';
596
+ el.style.overscrollBehavior = 'none';
597
+ return {
598
+ el,
599
+ prev
600
+ };
601
+ });
602
+ }
603
+ return () => {
604
+ parentScrollLockCount = Math.max(0, parentScrollLockCount - 1);
605
+ if (parentScrollLockCount === 0) {
606
+ parentScrollLocked.forEach(({
607
+ el,
608
+ prev
609
+ }) => {
610
+ el.style.overflow = prev.overflow;
611
+ el.style.overscrollBehavior = prev.overscrollBehavior;
612
+ });
613
+ parentScrollLocked = [];
614
+ }
615
+ };
616
+ };
617
+ const useLockParentScroll = (enabled, getScrollElement) => {
618
+ react.useEffect(() => {
619
+ if (!enabled) {
620
+ return undefined;
621
+ }
622
+ return lockParentScroll(getScrollElement);
623
+ }, [enabled, getScrollElement]);
624
+ };
625
+ const sizeStyleVars = (size, hasFooter) => {
626
+ const minBase = size === 'small' ? 300 : 500;
627
+ const chrome = 48 + (hasFooter ? 69 : 0);
628
+ const minHeight = `${Math.max(0, minBase - chrome)}px`;
629
+ const largeDim = typeof window !== 'undefined' ? `${Math.min(window.innerWidth - 64, 1500)}px` : '1500px';
630
+ if (size === 'large') {
631
+ return {
632
+ dimension: largeDim,
633
+ '--kne-drawer-body-min-height': minHeight
634
+ };
635
+ }
636
+ if (size === 'small') {
637
+ return {
638
+ dimension: '600px',
639
+ '--kne-drawer-body-min-height': minHeight
640
+ };
641
+ }
642
+ return {
643
+ dimension: '1000px',
644
+ '--kne-drawer-body-min-height': minHeight
645
+ };
646
+ };
647
+ const DrawerOuter = ({
648
+ title,
649
+ footer,
650
+ footerButtons,
651
+ noPadding,
652
+ onClose,
653
+ closable,
654
+ onConfirm,
655
+ onCancel,
656
+ children,
657
+ targetProps,
658
+ cancelText,
659
+ confirmText,
660
+ isMobile,
661
+ bodyScroll
662
+ }) => {
663
+ const effectiveNoPadding = noPadding ?? bodyScroll === false;
664
+ const bodyInner = /*#__PURE__*/jsxRuntime.jsx("div", {
665
+ className: classnames__default["default"](style['drawer-body-inner'], 'drawer-body-inner', 'modal-body-inner', {
666
+ [style['no-padding']]: effectiveNoPadding
667
+ }),
668
+ children: children
669
+ });
670
+ const bodyClassName = classnames__default["default"](style['drawer-body'], 'drawer-body', 'modal-body');
671
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
672
+ className: classnames__default["default"](style['drawer-outer'], 'drawer-container', {
673
+ [style['is-mobile']]: isMobile,
674
+ [style['no-title']]: !title,
675
+ [style['no-footer']]: footer === null && footerButtons === undefined,
676
+ [style['no-padding']]: effectiveNoPadding
677
+ }),
678
+ "data-testid": "react-drawer",
679
+ children: [closable === false ? null : /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
680
+ "data-testid": "react-drawer-close-btn",
681
+ className: classnames__default["default"](style['drawer-close'], 'drawer-close'),
682
+ type: "text",
683
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.CloseOutlined, {}),
684
+ onClick: e => {
685
+ e.stopPropagation();
686
+ onClose && onClose();
687
+ }
688
+ }), title ? /*#__PURE__*/jsxRuntime.jsx("div", {
689
+ className: classnames__default["default"](style['drawer-title'], 'drawer-title', 'modal-title'),
690
+ children: title
691
+ }) : null, bodyScroll !== false ? /*#__PURE__*/jsxRuntime.jsx(SimpleBar__default["default"], {
692
+ className: bodyClassName,
693
+ style: {
694
+ height: 'var(--kne-drawer-body-height)'
695
+ },
696
+ children: bodyInner
697
+ }) : /*#__PURE__*/jsxRuntime.jsx("div", {
698
+ className: classnames__default["default"](bodyClassName, style['body-scroll-off']),
699
+ children: bodyInner
700
+ }), footer === null && footerButtons === undefined ? null : /*#__PURE__*/jsxRuntime.jsx(Footer, {
701
+ footer: footer,
702
+ footerButtons: footerButtons,
703
+ onConfirm: onConfirm,
704
+ confirmText: confirmText,
705
+ onCancel: onCancel,
706
+ cancelText: cancelText,
707
+ onClose: onClose,
708
+ targetProps: targetProps,
709
+ isMobile: isMobile
710
+ })]
711
+ });
712
+ };
713
+ const computedDrawerProps = ({
714
+ children,
715
+ footer,
716
+ footerButtons,
717
+ className,
718
+ size = 'default',
719
+ placement = 'right',
720
+ title,
721
+ onClose,
722
+ onConfirm,
723
+ confirmText,
724
+ onCancel,
725
+ cancelText,
726
+ closable,
727
+ noPadding,
728
+ bodyScroll = true,
729
+ isMobile,
730
+ fixedModeClass,
731
+ rootClassName,
732
+ classNames: propsClassNames,
733
+ styles: propsStyles,
734
+ style: propsStyle,
735
+ width: propsWidth,
736
+ height: propsHeight,
737
+ modalRender,
738
+ drawerRender,
739
+ ...props
740
+ }) => {
741
+ const vertical = isVerticalPlacement(placement);
742
+ const hasFooter = !(footer === null && footerButtons === undefined);
743
+ const {
744
+ dimension,
745
+ ...cssVars
746
+ } = sizeStyleVars(size, hasFooter);
747
+ const sizeProp = vertical ? {
748
+ height: propsHeight ?? dimension
749
+ } : {
750
+ width: propsWidth ?? dimension
751
+ };
752
+ const runChildren = options => {
753
+ const opts = Object.assign({}, options, {
754
+ close: onClose
755
+ });
756
+ const drawerPanel = /*#__PURE__*/jsxRuntime.jsx("div", {
757
+ className: classnames__default["default"](style['drawer-panel-host'], 'drawer-panel-host'),
758
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
759
+ className: classnames__default["default"](style['drawer-panel-body'], 'drawer-panel-body'),
760
+ children: /*#__PURE__*/jsxRuntime.jsx(DrawerOuter, {
761
+ title: renderWithOptions(title, opts),
762
+ closable: closable,
763
+ onClose: onClose,
764
+ onConfirm: onConfirm,
765
+ confirmText: confirmText,
766
+ onCancel: onCancel,
767
+ cancelText: cancelText,
768
+ footerButtons: renderWithOptions(footerButtons, opts),
769
+ noPadding: noPadding,
770
+ footer: renderWithOptions(footer, opts),
771
+ targetProps: opts,
772
+ isMobile: isMobile,
773
+ bodyScroll: bodyScroll,
774
+ children: renderWithOptions(children, opts)
775
+ })
776
+ })
777
+ });
778
+ return typeof modalRender === 'function' ? modalRender(drawerPanel) : drawerPanel;
779
+ };
780
+ const mobileWrapperClass = isMobile ? vertical ? style['drawer-wrapper-mobile-vertical'] : style['drawer-wrapper-mobile'] : null;
781
+ const panelLayoutStyles = {
782
+ height: '100%',
783
+ display: 'flex',
784
+ flexDirection: 'column',
785
+ padding: 0
786
+ };
787
+ return {
788
+ ...props,
789
+ ...(drawerRender ? {
790
+ drawerRender
791
+ } : null),
792
+ placement,
793
+ ...sizeProp,
794
+ title: null,
795
+ maskClosable: Object.prototype.hasOwnProperty.call(props, 'maskClosable') ? props.maskClosable : false,
796
+ destroyOnHidden: true,
797
+ footer: null,
798
+ closable: false,
799
+ onClose,
800
+ rootClassName: classnames__default["default"](rootClassName, isMobile && style['drawer-root-mobile'], isMobile && fixedModeClass, modalRender && style['drawer-form-host'], drawerRender && style['drawer-host-render']),
801
+ classNames: Object.assign({}, propsClassNames, {
802
+ header: classnames__default["default"](style['drawer-antd-header'], propsClassNames?.header),
803
+ footer: classnames__default["default"](style['drawer-antd-footer'], propsClassNames?.footer),
804
+ body: classnames__default["default"](style['drawer-antd-body'], isMobile && style['is-mobile'], propsClassNames?.body),
805
+ wrapper: classnames__default["default"](propsClassNames?.wrapper, mobileWrapperClass),
806
+ mask: classnames__default["default"](propsClassNames?.mask, isMobile && fixedModeClass)
807
+ }),
808
+ className: classnames__default["default"](className, style['drawer'], style[size], {
809
+ [style['is-mobile']]: isMobile
810
+ }),
811
+ style: Object.assign({}, cssVars, propsStyle, vertical ? {
812
+ '--kne-drawer-viewport-height': dimension
813
+ } : null),
814
+ styles: {
815
+ ...propsStyles,
816
+ body: {
817
+ padding: 0,
818
+ ...propsStyles?.body,
819
+ flex: '1 1 auto',
820
+ minHeight: 0,
821
+ display: 'flex',
822
+ flexDirection: 'column',
823
+ overflow: 'hidden',
824
+ ...(isMobile ? {
825
+ height: '100%',
826
+ maxHeight: '100%'
827
+ } : null)
828
+ },
829
+ section: {
830
+ ...panelLayoutStyles,
831
+ ...propsStyles?.section,
832
+ ...propsStyles?.content
833
+ },
834
+ wrapper: {
835
+ ...propsStyles?.wrapper,
836
+ ...(vertical ? {
837
+ height: 'var(--kne-drawer-viewport-height, 100vh)',
838
+ maxHeight: '100%'
839
+ } : {
840
+ height: '100%'
841
+ }),
842
+ ...(isMobile && !vertical ? {
843
+ width: 'var(--kne-viewport-width, 100vw)',
844
+ maxWidth: '100%'
845
+ } : null),
846
+ ...(isMobile && vertical ? {
847
+ height: 'var(--kne-viewport-height, 100vh)',
848
+ maxHeight: '100%'
849
+ } : null)
850
+ }
851
+ },
852
+ children: /*#__PURE__*/jsxRuntime.jsx(DrawerLocaleRoot, {
853
+ children: runChildren({})
854
+ })
855
+ };
856
+ };
857
+ const Drawer = withLocale(({
858
+ size = 'default',
859
+ placement = 'right',
860
+ getContainer,
861
+ open,
862
+ bodyScroll = true,
863
+ ...props
864
+ }) => {
865
+ const hostRef = react.useRef(null);
866
+ const {
867
+ isMobile,
868
+ fixedModeClass,
869
+ getPopupContainer,
870
+ anchorRef
871
+ } = responsiveUtils.useMobilePopupMount({
872
+ ...boundaryPopupMountOptions$1,
873
+ getPopupContainer: wrapCustomGetContainer$1(getContainer)
874
+ });
875
+ const getScrollElement = responsiveUtils.useScrollElement();
876
+ useLockParentScroll(!!open, getScrollElement);
877
+ const setAnchorRef = node => {
878
+ hostRef.current = node;
879
+ anchorRef(node);
880
+ };
881
+ const getDrawerContainer = resolveDrawerGetContainer({
882
+ customGetContainer: getContainer,
883
+ getPopupContainer,
884
+ getHostNode: () => hostRef.current
885
+ });
886
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
887
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
888
+ ref: setAnchorRef,
889
+ className: style['drawer-host'],
890
+ "aria-hidden": "true"
891
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Drawer, {
892
+ ...computedDrawerProps(Object.assign({}, props, {
893
+ size,
894
+ placement,
895
+ isMobile,
896
+ open,
897
+ fixedModeClass,
898
+ bodyScroll
899
+ })),
900
+ open: open,
901
+ getContainer: getDrawerContainer
902
+ })]
903
+ });
904
+ });
905
+
906
+ const usePatchElement = () => {
907
+ const [elements, setElements] = react.useState([]);
908
+ const patchElement = react.useCallback(element => {
909
+ setElements(originElements => [...originElements, element]);
910
+ return () => {
911
+ setElements(originElements => originElements.filter(ele => ele !== element));
912
+ };
913
+ }, []);
914
+ return [elements, patchElement];
915
+ };
916
+
917
+ const VIEWPORT_EXAMPLE_SELECTORS$1 = ['.example-driver-device-scroll'];
918
+ const boundaryPopupMountOptions = {
919
+ cover: 'boundary',
920
+ exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS$1
921
+ };
922
+ const wrapCustomGetContainer = customGetContainer => {
923
+ if (!customGetContainer) {
924
+ return undefined;
925
+ }
926
+ if (typeof customGetContainer === 'function') {
927
+ return triggerNode => customGetContainer(triggerNode) || null;
928
+ }
929
+ return () => customGetContainer;
930
+ };
931
+ const drawerApiRef = {
932
+ current: null
933
+ };
934
+ let hookDrawerUuid = 0;
935
+ const HookDrawer = /*#__PURE__*/react.forwardRef(({
936
+ config,
937
+ afterClose: hookAfterClose
938
+ }, ref) => {
939
+ const [open, setOpen] = react.useState(true);
940
+ const [innerConfig, setInnerConfig] = react.useState(config);
941
+ const hostRef = react.useRef(null);
942
+ const {
943
+ getPopupContainer,
944
+ anchorRef
945
+ } = responsiveUtils.useMobilePopupMount({
946
+ ...boundaryPopupMountOptions,
947
+ getPopupContainer: wrapCustomGetContainer(innerConfig.getContainer)
948
+ });
949
+ const close = () => {
950
+ setOpen(false);
951
+ };
952
+ react.useImperativeHandle(ref, () => ({
953
+ destroy: close,
954
+ update: newConfig => {
955
+ setInnerConfig(origin => Object.assign({}, origin, typeof newConfig === 'function' ? newConfig(origin) : newConfig));
956
+ }
957
+ }));
958
+ const {
959
+ getContainer,
960
+ afterClose: userAfterClose,
961
+ ...restConfig
962
+ } = innerConfig;
963
+ const mergedAfterClose = function () {
964
+ var args = [].slice.call(arguments);
965
+ hookAfterClose && hookAfterClose(...args);
966
+ userAfterClose && userAfterClose(...args);
967
+ };
968
+ const drawerProps = computedDrawerProps({
969
+ ...restConfig,
970
+ onClose: close,
971
+ afterClose: mergedAfterClose
972
+ });
973
+ const getDrawerContainer = resolveDrawerGetContainer({
974
+ customGetContainer: getContainer,
975
+ getPopupContainer,
976
+ getHostNode: () => hostRef.current
977
+ });
978
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
979
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
980
+ ref: node => {
981
+ hostRef.current = node;
982
+ anchorRef(node);
983
+ },
984
+ "aria-hidden": "true",
985
+ style: {
986
+ position: 'absolute',
987
+ width: 0,
988
+ height: 0,
989
+ overflow: 'hidden'
990
+ }
991
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Drawer, {
992
+ ...drawerProps,
993
+ open: open,
994
+ getContainer: getDrawerContainer
995
+ })]
996
+ });
997
+ });
998
+ const ElementsHolder = /*#__PURE__*/react.memo(/*#__PURE__*/react.forwardRef((_props, ref) => {
999
+ const [elements, patchElement] = usePatchElement();
1000
+ react.useImperativeHandle(ref, () => ({
1001
+ patchElement
1002
+ }), [patchElement]);
1003
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
1004
+ children: elements
1005
+ });
1006
+ }));
1007
+ const useDrawerHolder = () => {
1008
+ const holderRef = react.useRef(null);
1009
+ const [actionQueue, setActionQueue] = react.useState([]);
1010
+ const {
1011
+ resolveMount,
1012
+ getPopupContainer
1013
+ } = responsiveUtils.useMobilePopupMount(boundaryPopupMountOptions);
1014
+ const getScrollElement = responsiveUtils.useScrollElement();
1015
+ react.useEffect(() => {
1016
+ if (actionQueue.length) {
1017
+ const cloneQueue = [...actionQueue];
1018
+ cloneQueue.forEach(action => action());
1019
+ setActionQueue([]);
1020
+ }
1021
+ }, [actionQueue]);
1022
+ const drawer = react.useCallback(props => {
1023
+ hookDrawerUuid += 1;
1024
+ const drawerRef = /*#__PURE__*/react.createRef();
1025
+ const api = {};
1026
+ let closeFunc;
1027
+ let unlock = () => {};
1028
+ const runOpen = () => {
1029
+ const anchor = typeof document !== 'undefined' ? document.activeElement : null;
1030
+ const {
1031
+ isMobile,
1032
+ fixedModeClass
1033
+ } = resolveMount(anchor);
1034
+ unlock = lockParentScroll(getScrollElement);
1035
+ const {
1036
+ afterClose: userAfterClose,
1037
+ getContainer: customGetContainer,
1038
+ ...restProps
1039
+ } = props;
1040
+ const drawerEl = /*#__PURE__*/jsxRuntime.jsx(HookDrawer, {
1041
+ ref: drawerRef,
1042
+ config: {
1043
+ ...restProps,
1044
+ isMobile,
1045
+ fixedModeClass,
1046
+ getContainer: customGetContainer,
1047
+ onClose: () => api.close(),
1048
+ afterClose: function () {
1049
+ unlock();
1050
+ userAfterClose && userAfterClose(...[].slice.call(arguments));
1051
+ }
1052
+ },
1053
+ afterClose: () => {
1054
+ closeFunc && closeFunc();
1055
+ }
1056
+ }, `react-drawer-${hookDrawerUuid}`);
1057
+ closeFunc = holderRef.current?.patchElement(drawerEl);
1058
+ };
1059
+ if (holderRef.current?.patchElement) {
1060
+ runOpen();
1061
+ } else {
1062
+ setActionQueue(prev => [...prev, runOpen]);
1063
+ }
1064
+ api.close = () => {
1065
+ if (drawerRef.current) {
1066
+ drawerRef.current.destroy();
1067
+ } else {
1068
+ setActionQueue(prev => [...prev, () => drawerRef.current?.destroy()]);
1069
+ }
1070
+ };
1071
+ return api;
1072
+ }, [getScrollElement, resolveMount]);
1073
+ return [drawer, /*#__PURE__*/jsxRuntime.jsx(ElementsHolder, {
1074
+ ref: holderRef
1075
+ }, "drawer-elements-holder")];
1076
+ };
1077
+ const DrawerContextHolder = () => {
1078
+ const [drawer, contextHolder] = useDrawerHolder();
1079
+ drawerApiRef.current = drawer;
1080
+ return contextHolder;
1081
+ };
1082
+ const useDrawer = () => {
1083
+ if (!drawerApiRef.current) {
1084
+ throw new Error('useDrawer requires <DrawerContextHolder /> mounted inside <App> before calling useDrawer()');
1085
+ }
1086
+ return drawerApiRef.current;
1087
+ };
1088
+
1089
+ var confirmStyle = {"kne-responsive-boundary":"kne-react-modal_6tGX5","kne-responsive-scroll":"kne-react-modal_DOfki","confirm-modal-wrap":"kne-react-modal_NZArM","is-mobile":"kne-react-modal_PJp65","is-danger":"kne-react-modal_LUqb9","title-icon":"kne-react-modal_WAuWk","titleRow":"kne-react-modal_oEIMf","contentRow":"kne-react-modal_VFlnj","titleIcon":"kne-react-modal_UDO1-","title-icon-confirm":"kne-react-modal_w4spp","title-icon-info":"kne-react-modal_9DX59","title-icon-success":"kne-react-modal_pFvwL","title-icon-warning":"kne-react-modal_Wv7-o","title-icon-error":"kne-react-modal_0cNi0","titleText":"kne-react-modal_vDt06","contentText":"kne-react-modal_i15SX","has-title":"kne-react-modal_reDXC","has-icon":"kne-react-modal_Mpjjc","is-mobile-block":"kne-react-modal_C7-hV"};
1090
+
1091
+ const ConfirmLocaleRoot = withLocale(({
1092
+ children
1093
+ }) => children);
1094
+ const VIEWPORT_EXAMPLE_SELECTORS = ['.example-driver-device-scroll'];
1095
+ const viewportPopupMountOptions = {
1096
+ cover: 'viewport',
1097
+ exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS
1098
+ };
1099
+ const ICON_BY_TYPE = {
1100
+ info: icons.InfoCircleFilled,
1101
+ confirm: icons.ExclamationCircleFilled,
1102
+ warning: icons.ExclamationCircleFilled,
1103
+ error: icons.CloseCircleFilled,
1104
+ success: icons.CheckCircleFilled
1105
+ };
1106
+ const getIconKind = (type, confirmType) => type === 'confirm' ? confirmType : type;
1107
+ const shouldShowDefaultIcon = ({
1108
+ type,
1109
+ danger,
1110
+ icon
1111
+ }) => {
1112
+ if (icon === false || icon === null) {
1113
+ return false;
1114
+ }
1115
+ if (type === 'confirm') {
1116
+ return !!danger;
1117
+ }
1118
+ return ['info', 'success', 'warning', 'error'].includes(type);
1119
+ };
1120
+ const getConfirmIconNode = ({
1121
+ type,
1122
+ confirmType = 'info',
1123
+ danger,
1124
+ icon
1125
+ }) => {
1126
+ if (icon) {
1127
+ return icon;
1128
+ }
1129
+ if (!shouldShowDefaultIcon({
1130
+ type,
1131
+ danger,
1132
+ icon
1133
+ })) {
1134
+ return null;
1135
+ }
1136
+ const kind = getIconKind(type, confirmType);
1137
+ const IconComponent = ICON_BY_TYPE[kind] || ICON_BY_TYPE.info;
1138
+ return /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
1139
+ className: classnames__default["default"](confirmStyle['title-icon'], confirmStyle[`title-icon-${kind}`])
1140
+ });
1141
+ };
1142
+ const buildConfirmContent = ({
1143
+ type,
1144
+ confirmType,
1145
+ title,
1146
+ message,
1147
+ danger,
1148
+ icon,
1149
+ isMobile
1150
+ }) => {
1151
+ const iconNode = getConfirmIconNode({
1152
+ type,
1153
+ confirmType,
1154
+ danger,
1155
+ icon
1156
+ });
1157
+ const mobileClass = isMobile ? confirmStyle['is-mobile-block'] : null;
1158
+ return {
1159
+ title: title ? /*#__PURE__*/jsxRuntime.jsxs("div", {
1160
+ className: classnames__default["default"](confirmStyle.titleRow, mobileClass),
1161
+ onClick: e => {
1162
+ e.stopPropagation();
1163
+ },
1164
+ children: [iconNode ? /*#__PURE__*/jsxRuntime.jsx("span", {
1165
+ className: confirmStyle.titleIcon,
1166
+ children: iconNode
1167
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
1168
+ className: confirmStyle.titleText,
1169
+ children: title
1170
+ })]
1171
+ }) : null,
1172
+ content: /*#__PURE__*/jsxRuntime.jsxs("div", {
1173
+ className: classnames__default["default"](confirmStyle.contentRow, mobileClass, {
1174
+ [confirmStyle['has-title']]: title,
1175
+ [confirmStyle['has-icon']]: !!iconNode && title
1176
+ }),
1177
+ children: [!title && iconNode ? /*#__PURE__*/jsxRuntime.jsx("span", {
1178
+ className: confirmStyle.titleIcon,
1179
+ children: iconNode
1180
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
1181
+ className: confirmStyle.contentText,
1182
+ children: message
1183
+ })]
1184
+ })
1185
+ };
1186
+ };
1187
+ const mapConfirmProps = (props, {
1188
+ isMobile,
1189
+ fixedModeClass,
1190
+ getPopupContainer,
1191
+ anchor,
1192
+ unlock,
1193
+ userAfterClose
1194
+ }) => {
1195
+ const {
1196
+ type = 'confirm',
1197
+ icon,
1198
+ title,
1199
+ danger,
1200
+ wrapClassName,
1201
+ message,
1202
+ confirmType = 'info',
1203
+ getContainer: customGetContainer,
1204
+ onConfirm,
1205
+ onCancel,
1206
+ confirmText,
1207
+ cancelText,
1208
+ afterClose,
1209
+ zIndex,
1210
+ ...otherProps
1211
+ } = {
1212
+ maskClosable: false,
1213
+ ...props
1214
+ };
1215
+ const {
1216
+ title: confirmTitle,
1217
+ content
1218
+ } = buildConfirmContent({
1219
+ type,
1220
+ confirmType,
1221
+ title,
1222
+ message,
1223
+ danger,
1224
+ icon,
1225
+ isMobile
1226
+ });
1227
+ return {
1228
+ modalMethod: type,
1229
+ config: {
1230
+ ...otherProps,
1231
+ zIndex: zIndex ?? 1100,
1232
+ okText: confirmText ?? otherProps.okText,
1233
+ cancelText: cancelText ?? otherProps.cancelText,
1234
+ onOk: onConfirm ?? otherProps.onOk,
1235
+ onCancel: onCancel ?? otherProps.onCancel,
1236
+ getContainer: resolveModalGetContainer({
1237
+ customGetContainer,
1238
+ getPopupContainer,
1239
+ getHostNode: () => anchor
1240
+ }),
1241
+ centered: true,
1242
+ afterClose: function () {
1243
+ var args = [].slice.call(arguments);
1244
+ unlock();
1245
+ userAfterClose && userAfterClose(...args);
1246
+ afterClose && afterClose(...args);
1247
+ },
1248
+ icon: null,
1249
+ classNames: {
1250
+ mask: classnames__default["default"](isMobile && modalStyle['modal-mask-fullscreen'], isMobile && fixedModeClass, otherProps.classNames?.mask)
1251
+ },
1252
+ wrapClassName: classnames__default["default"](modalStyle['modal-wrap'], confirmStyle['confirm-modal-wrap'], wrapClassName, {
1253
+ [confirmStyle['is-danger']]: danger,
1254
+ [confirmStyle['is-mobile']]: isMobile,
1255
+ [modalStyle['modal-wrap-centered']]: isMobile,
1256
+ [fixedModeClass]: isMobile
1257
+ }),
1258
+ title: confirmTitle ? /*#__PURE__*/jsxRuntime.jsx(ConfirmLocaleRoot, {
1259
+ children: confirmTitle
1260
+ }) : null,
1261
+ content: /*#__PURE__*/jsxRuntime.jsx(ConfirmLocaleRoot, {
1262
+ children: content
1263
+ })
1264
+ }
1265
+ };
1266
+ };
1267
+ const useConfirmModal = () => {
1268
+ const {
1269
+ modal
1270
+ } = antd.App.useApp();
1271
+ const {
1272
+ resolveMount,
1273
+ getPopupContainer
1274
+ } = responsiveUtils.useMobilePopupMount(viewportPopupMountOptions);
1275
+ const getScrollElement = responsiveUtils.useScrollElement();
1276
+ return props => {
1277
+ const anchor = typeof document !== 'undefined' ? document.activeElement : null;
1278
+ const {
1279
+ isMobile,
1280
+ fixedModeClass
1281
+ } = resolveMount(anchor);
1282
+ const unlock = lockParentScroll$1(getScrollElement);
1283
+ const api = {};
1284
+ const {
1285
+ afterClose: userAfterClose,
1286
+ ...restProps
1287
+ } = props;
1288
+ const {
1289
+ modalMethod,
1290
+ config
1291
+ } = mapConfirmProps({
1292
+ ...restProps,
1293
+ onClose: () => api.close()
1294
+ }, {
1295
+ isMobile,
1296
+ fixedModeClass,
1297
+ getPopupContainer,
1298
+ anchor,
1299
+ unlock,
1300
+ userAfterClose
1301
+ });
1302
+ if (typeof modal[modalMethod] === 'function') {
1303
+ const {
1304
+ destroy
1305
+ } = modal[modalMethod](config);
1306
+ api.close = destroy;
1307
+ } else {
1308
+ unlock();
1309
+ api.close = () => {};
1310
+ }
1311
+ return api;
1312
+ };
1313
+ };
1314
+
1315
+ const ScrollRegion = ({
524
1316
  className,
525
1317
  inset = false,
526
1318
  children,
@@ -534,7 +1326,7 @@ const ModalScrollRegion = ({
534
1326
  })
535
1327
  });
536
1328
 
537
- const ModalTabsLayout = ({
1329
+ const TabsLayout = ({
538
1330
  className,
539
1331
  destroyOnHidden = true,
540
1332
  ...props
@@ -557,7 +1349,7 @@ const resolveColStyle = width => {
557
1349
  minWidth: 0
558
1350
  };
559
1351
  };
560
- const ModalColumnsLayout = ({
1352
+ const ColumnsLayout = ({
561
1353
  widths,
562
1354
  className,
563
1355
  children,
@@ -580,16 +1372,26 @@ const createModalRender = modalDefaults => hostProps => /*#__PURE__*/jsxRuntime.
580
1372
  ...hostProps
581
1373
  });
582
1374
 
1375
+ const createDrawerRender = drawerDefaults => hostProps => /*#__PURE__*/jsxRuntime.jsx(Drawer, {
1376
+ ...drawerDefaults,
1377
+ ...hostProps
1378
+ });
1379
+
583
1380
  const modalClassNames = {
584
1381
  stepsForm: 'react-modal-steps-form',
585
1382
  splitter: 'react-modal-splitter'
586
1383
  };
587
1384
 
588
- exports.ModalColumnsLayout = ModalColumnsLayout;
589
- exports.ModalScrollRegion = ModalScrollRegion;
590
- exports.ModalTabsLayout = ModalTabsLayout;
1385
+ exports.ColumnsLayout = ColumnsLayout;
1386
+ exports.Drawer = Drawer;
1387
+ exports.DrawerContextHolder = DrawerContextHolder;
1388
+ exports.ScrollRegion = ScrollRegion;
1389
+ exports.TabsLayout = TabsLayout;
1390
+ exports.createDrawerRender = createDrawerRender;
591
1391
  exports.createModalRender = createModalRender;
592
1392
  exports["default"] = Modal;
593
1393
  exports.modalClassNames = modalClassNames;
1394
+ exports.useConfirmModal = useConfirmModal;
1395
+ exports.useDrawer = useDrawer;
594
1396
  exports.useModal = useModal;
595
1397
  //# sourceMappingURL=index.js.map