@stenajs-webui/modal 22.0.1 → 22.0.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1 -0
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./dialog/alert/UseAlertDialog";
|
|
|
17
17
|
export * from "./dialog/drawer/UseDrawerDialog";
|
|
18
18
|
export * from "./dialog/modal/UseModalDialog";
|
|
19
19
|
export * from "./ready-made-modals/InfoAlert";
|
|
20
|
+
export * from "./building-blocks/ModalCloseButton";
|
|
20
21
|
export * from "./building-blocks/ModalContainer";
|
|
21
22
|
export * from "./building-blocks/ModalHeader";
|
|
22
23
|
export * from "./building-blocks/ModalActionButtons";
|
package/dist/index.es.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode("._overlay_quvmp_1{--swui-modal-animation-time: var(--swui-animation-time-fast);--swui-modal-overlay-bg-color: var(--swui-overlay-bg-color);--swui-modal-content-bg-color: var(--swui-white);--swui-modal-width: 960px;--swui-modal-max-width: 100%;--swui-modal-header-border-color: var(--lhds-color-ui-300);--swui-modal-shadow: var(--swui-shadow-modal);--swui-modal-footer-shadow: var(--swui-shadow-modal);position:fixed;z-index:10;top:0;left:0;right:0;bottom:0;background-color:var(--swui-modal-overlay-bg-color);overflow:auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;animation:_fadeIn_quvmp_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_quvmp_1{background-color:#fff}}._overlay_quvmp_1 ._modal_quvmp_31{max-width:100%;outline:none;pointer-events:none}@media (max-width: 768px){._overlay_quvmp_1 ._modal_quvmp_31{width:100%}}._overlay_quvmp_1 ._content_quvmp_41{position:relative;display:block;background:var(--swui-modal-content-bg-color);box-shadow:var(--swui-modal-shadow);pointer-events:all;top:calc(var(--swui-metrics-space) * 2);width:var(--swui-modal-width);max-width:var(--swui-modal-max-width)}@media (max-width: 768px){._overlay_quvmp_1 ._content_quvmp_41{top:0;width:100%;max-width:100%}}._overlay_quvmp_1 ._content_quvmp_41{animation:_appear_quvmp_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_quvmp_1 ._content_quvmp_41{box-shadow:none;top:0}}._overlay_quvmp_1 ._content_quvmp_41:focus{outline:0}._overlay_quvmp_1 ._content_quvmp_41._isDraggable_quvmp_70 .draggable-modal-handle{cursor:move}._overlay_quvmp_1 ._content_quvmp_41._isDraggable_quvmp_70 .draggable-modal-handle .draggable-modal-cancel,._overlay_quvmp_1 ._content_quvmp_41._isDraggable_quvmp_70 .draggable-modal-handle [role=tooltip]{cursor:initial}@keyframes _fadeIn_quvmp_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@keyframes _appear_quvmp_1{0%{opacity:0}to{opacity:1}}._footer_quvmp_101{background-color:var(--swui-modal-content-bg-color)}._stickyFooter_quvmp_105{position:-webkit-sticky;position:sticky;bottom:0;box-shadow:var(--swui-modal-footer-shadow)}@media print{._stickyFooter_quvmp_105{position:static;box-shadow:none}}._portal_17ze5_1{--drawer-width: 370px}._portal_17ze5_1 ._overlay_17ze5_4{position:fixed;top:0;right:0;bottom:0;left:0}._portal_17ze5_1 ._content_17ze5_9{box-shadow:var(--swui-shadow-modal);background:#fff;position:absolute;transition:transform var(--swui-animation-time-medium) ease-in-out}._portal_17ze5_1 ._content_17ze5_9._floating_17ze5_15{margin:var(--swui-metrics-space);border-radius:var(--swui-border-radius)}@media (max-width: 768px){._portal_17ze5_1 ._content_17ze5_9._floating_17ze5_15{margin:0;border-radius:0}}._portal_17ze5_1 ._content_17ze5_9:focus-visible{outline:unset}._portal_17ze5_1 ._content_17ze5_9._slideFromLeft_17ze5_29,._portal_17ze5_1 ._content_17ze5_9._slideFromRight_17ze5_30{transform:translate(var(--translate-x-outside-screen, 0));overflow-y:auto;top:0;bottom:0}._portal_17ze5_1 ._content_17ze5_9._slideFromLeft_17ze5_29._afterOpen_17ze5_36,._portal_17ze5_1 ._content_17ze5_9._slideFromRight_17ze5_30._afterOpen_17ze5_36{transform:translate(0)}._portal_17ze5_1 ._content_17ze5_9._slideFromLeft_17ze5_29._beforeClose_17ze5_40,._portal_17ze5_1 ._content_17ze5_9._slideFromRight_17ze5_30._beforeClose_17ze5_40{transform:translate(var(--translate-x-outside-screen))}._portal_17ze5_1 ._content_17ze5_9._slideFromTop_17ze5_45,._portal_17ze5_1 ._content_17ze5_9._slideFromBottom_17ze5_46{transform:translateY(var(--translate-y-outside-screen, 0));overflow-x:auto;left:0;right:0}._portal_17ze5_1 ._content_17ze5_9._slideFromTop_17ze5_45._afterOpen_17ze5_36,._portal_17ze5_1 ._content_17ze5_9._slideFromBottom_17ze5_46._afterOpen_17ze5_36{transform:translateY(0)}._portal_17ze5_1 ._content_17ze5_9._slideFromTop_17ze5_45._beforeClose_17ze5_40,._portal_17ze5_1 ._content_17ze5_9._slideFromBottom_17ze5_46._beforeClose_17ze5_40{transform:translateY(var(--translate-y-outside-screen))}._portal_17ze5_1 ._content_17ze5_9._slideFromLeft_17ze5_29{--translate-x-outside-screen: -100%;width:var(--drawer-width);left:0}._portal_17ze5_1 ._content_17ze5_9._slideFromRight_17ze5_30{--translate-x-outside-screen: 100%;width:var(--drawer-width);right:0}._portal_17ze5_1 ._content_17ze5_9._slideFromTop_17ze5_45{--translate-y-outside-screen: -100%;height:var(--drawer-width);top:0}._portal_17ze5_1 ._content_17ze5_9._slideFromBottom_17ze5_46{--translate-y-outside-screen: 100%;height:var(--drawer-width);bottom:0}._overlay_1gix5_1{--swui-modal-animation-time: var(--swui-animation-time-fast);--swui-modal-overlay-bg-color: var(--swui-overlay-bg-color);--swui-modal-content-bg-color: var(--swui-white);--swui-modal-width: 960px;--swui-modal-max-width: 100%;--swui-modal-header-border-color: var(--lhds-color-ui-300);--swui-modal-shadow: var(--swui-shadow-modal);--swui-modal-footer-shadow: var(--swui-shadow-modal);position:fixed;z-index:10;top:0;left:0;right:0;bottom:0;background-color:var(--swui-modal-overlay-bg-color);overflow:auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;animation:_fadeIn_1gix5_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_1gix5_1{background-color:#fff}}._overlay_1gix5_1 ._modal_1gix5_31{max-width:100%;outline:none;pointer-events:none;padding:var(--swui-metrics-space)}._overlay_1gix5_1 ._content_1gix5_38{position:relative;display:block;background:var(--swui-modal-content-bg-color);box-shadow:var(--swui-modal-shadow);border-radius:var(--swui-border-radius-large);pointer-events:all;width:var(--swui-modal-width);max-width:var(--swui-modal-max-width);animation:_appear_1gix5_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_1gix5_1 ._content_1gix5_38{box-shadow:none;top:0}}._overlay_1gix5_1 ._content_1gix5_38:focus{outline:0}._overlay_1gix5_1 ._content_1gix5_38._isDraggable_1gix5_61 .draggable-modal-handle{cursor:move}._overlay_1gix5_1 ._content_1gix5_38._isDraggable_1gix5_61 .draggable-modal-handle .draggable-modal-cancel,._overlay_1gix5_1 ._content_1gix5_38._isDraggable_1gix5_61 .draggable-modal-handle [role=tooltip]{cursor:initial}@keyframes _fadeIn_1gix5_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@keyframes _appear_1gix5_1{0%{opacity:0}to{opacity:1}}._footer_1gix5_92{background-color:var(--swui-modal-content-bg-color)}._stickyFooter_1gix5_96{position:-webkit-sticky;position:sticky;bottom:0;box-shadow:var(--swui-modal-footer-shadow)}@media print{._stickyFooter_1gix5_96{position:static;box-shadow:none}}._overlay_nbrrn_1{--swui-modal-animation-time: var(--swui-animation-time-medium);--swui-modal-overlay-bg-color: var(--swui-overlay-bg-color);--swui-modal-content-bg-color: var(--swui-white);--swui-modal-width: 960px;--swui-modal-max-width: 100%;--swui-modal-header-border-color: var(--lhds-color-ui-300);--swui-modal-shadow: var(--swui-shadow-modal);--swui-modal-footer-shadow: var(--swui-shadow-modal);position:fixed;z-index:10;top:0;left:0;right:0;bottom:0;background-color:var(--swui-modal-overlay-bg-color);display:flex;flex-direction:column;justify-content:flex-start;align-items:center;opacity:0}._overlay_nbrrn_1._afterOpen_nbrrn_24:not(._beforeClose_nbrrn_24){animation:_fadeIn_nbrrn_1 var(--swui-modal-animation-time) forwards}._overlay_nbrrn_1._beforeClose_nbrrn_24{animation:_fadeOut_nbrrn_1 var(--swui-modal-animation-time) forwards}@media print{._overlay_nbrrn_1{background-color:#fff}}._overlay_nbrrn_1 ._modal_nbrrn_36{max-width:100%;outline:none;pointer-events:none;padding:calc(var(--swui-metrics-space) * 2);box-sizing:border-box;max-height:100%;transform:translateY(-100%)}@media (max-width: 768px){._overlay_nbrrn_1 ._modal_nbrrn_36{padding:0;width:100%}}._overlay_nbrrn_1 ._modal_nbrrn_36._afterOpen_nbrrn_24:not(._beforeClose_nbrrn_24){animation:_slideIn_nbrrn_1 var(--swui-modal-animation-time) forwards}._overlay_nbrrn_1 ._modal_nbrrn_36._beforeClose_nbrrn_24{animation:_slideOut_nbrrn_1 var(--swui-modal-animation-time) forwards}._overlay_nbrrn_1 ._content_nbrrn_59{position:relative;display:block;background:var(--swui-modal-content-bg-color);box-shadow:var(--swui-modal-shadow);border-radius:var(--swui-border-radius-large);pointer-events:all;width:var(--swui-modal-width);max-width:var(--swui-modal-max-width);height:100%;overflow:hidden;overflow-y:auto}@media (max-width: 768px){._overlay_nbrrn_1 ._content_nbrrn_59{border-radius:0;width:100%;max-width:100%;min-height:100dvh}}@media (min-width: 769px){._overlay_nbrrn_1 ._content_nbrrn_59{border-radius:var(--swui-border-radius-large)}._overlay_nbrrn_1 ._content_nbrrn_59::-webkit-scrollbar-thumb{background-color:var(--lhds-color-ui-400);border:4px solid transparent;border-radius:8px;background-clip:padding-box;min-height:40px}._overlay_nbrrn_1 ._content_nbrrn_59::-webkit-scrollbar{width:16px}}@media print{._overlay_nbrrn_1 ._content_nbrrn_59{box-shadow:none;top:0}}._overlay_nbrrn_1 ._content_nbrrn_59:focus{outline:0}@keyframes _fadeIn_nbrrn_1{0%{opacity:0}to{opacity:1}}@keyframes _fadeOut_nbrrn_1{0%{opacity:1}to{opacity:0}}@keyframes _slideIn_nbrrn_1{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes _slideOut_nbrrn_1{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}._footer_nbrrn_149{background-color:var(--swui-modal-content-bg-color)}._stickyFooter_nbrrn_153{position:-webkit-sticky;position:sticky;bottom:0;box-shadow:var(--swui-modal-footer-shadow)}@media print{._stickyFooter_nbrrn_153{position:static;box-shadow:none}}._modal_4fwgb_1{display:flex;justify-content:center;align-items:center;position:fixed;top:0;left:0;right:0;bottom:0;background-color:transparent}._overlay_4fwgb_13{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--swui-overlay-bg-color)}._alertDialog_14t8t_1{border:0;outline:0;border-radius:var(--swui-border-radius-large);margin:auto;padding:0;overscroll-behavior:contain;opacity:0;pointer-events:none;box-shadow:#0003 0 0 10px 4px}._alertDialog_14t8t_1:not([open]){display:none}._alertDialog_14t8t_1[open]{opacity:1;pointer-events:auto;animation:_slideIn_14t8t_1 .25s forwards}._alertDialog_14t8t_1._closing_14t8t_22[open]{animation:_slideOut_14t8t_1 .25s forwards}._alertDialog_14t8t_1::backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#0d0e1080;animation:_fadeIn_14t8t_1 .25s forwards}._alertDialog_14t8t_1._closing_14t8t_22::backdrop{animation:_fadeOut_14t8t_1 .25s forwards}@keyframes _fadeIn_14t8t_1{0%{opacity:0}to{opacity:1}}@keyframes _fadeOut_14t8t_1{0%{opacity:1}to{opacity:0}}@keyframes _slideIn_14t8t_1{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes _slideOut_14t8t_1{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}._drawerDialog_11g6r_1{max-height:100%;max-width:100%;border:0;outline:0;margin:0;padding:0;overflow-y:auto;overscroll-behavior:contain;box-shadow:#0003 0 0 10px 4px;position:fixed}._drawerDialog_11g6r_1._left_11g6r_13,._drawerDialog_11g6r_1._right_11g6r_14{height:100%;top:0;bottom:0}._drawerDialog_11g6r_1._left_11g6r_13 ._contentWrapper_11g6r_19,._drawerDialog_11g6r_1._right_11g6r_14 ._contentWrapper_11g6r_19{height:100%}@media (max-width: 768px){._drawerDialog_11g6r_1._left_11g6r_13,._drawerDialog_11g6r_1._right_11g6r_14{width:-webkit-fit-content;width:fit-content}}._drawerDialog_11g6r_1._left_11g6r_13{left:0;right:unset}._drawerDialog_11g6r_1._left_11g6r_13[open]{animation:_slideInLeft_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._left_11g6r_13._closing_11g6r_36[open]{animation:_slideOutLeft_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._right_11g6r_14{left:unset;right:0}._drawerDialog_11g6r_1._right_11g6r_14[open]{animation:_slideInRight_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._right_11g6r_14._closing_11g6r_36[open]{animation:_slideOutRight_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._top_11g6r_54,._drawerDialog_11g6r_1._bottom_11g6r_55{width:100%;left:0;right:0}@media (max-width: 768px){._drawerDialog_11g6r_1._top_11g6r_54,._drawerDialog_11g6r_1._bottom_11g6r_55{height:-webkit-fit-content;height:fit-content}}._drawerDialog_11g6r_1._top_11g6r_54{top:0;bottom:unset}._drawerDialog_11g6r_1._top_11g6r_54[open]{animation:_slideInTop_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._top_11g6r_54._closing_11g6r_36[open]{animation:_slideOutTop_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._bottom_11g6r_55{top:unset;bottom:0}._drawerDialog_11g6r_1._bottom_11g6r_55[open]{animation:_slideInBottom_11g6r_1 .25s forwards}._drawerDialog_11g6r_1._bottom_11g6r_55._closing_11g6r_36[open]{animation:_slideOutBottom_11g6r_1 .25s forwards}._drawerDialog_11g6r_1[open]{opacity:1;pointer-events:auto}@keyframes _slideInLeft_11g6r_1{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes _slideOutLeft_11g6r_1{0%{transform:translate(0);opacity:0}to{transform:translate(-100%);opacity:1}}@keyframes _slideInTop_11g6r_1{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes _slideOutTop_11g6r_1{0%{transform:translateY(0);opacity:0}to{transform:translateY(-100%);opacity:1}}@keyframes _slideInRight_11g6r_1{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes _slideOutRight_11g6r_1{0%{transform:translate(0);opacity:0}to{transform:translate(100%);opacity:1}}@keyframes _slideInBottom_11g6r_1{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes _slideOutBottom_11g6r_1{0%{transform:translateY(0);opacity:0}to{transform:translateY(100%);opacity:1}}._modalDialog_iw29e_1{border:0;outline:0;margin:auto;padding:0;overscroll-behavior:contain;opacity:0;pointer-events:none;box-shadow:#0003 0 0 10px 4px}@media (min-width: 769px){._modalDialog_iw29e_1{border-radius:var(--swui-border-radius-large)}._modalDialog_iw29e_1::-webkit-scrollbar-thumb{background-color:var(--lhds-color-ui-400);border:4px solid transparent;border-radius:8px;background-clip:padding-box;min-height:40px}._modalDialog_iw29e_1::-webkit-scrollbar{width:16px}}._modalDialog_iw29e_1:not([open]){display:none}._modalDialog_iw29e_1[open]{opacity:1;pointer-events:auto;animation:_slideIn_iw29e_1 .25s forwards}._modalDialog_iw29e_1._closing_iw29e_37[open]{animation:_slideOut_iw29e_1 .25s forwards}@media (max-width: 768px){._modalDialog_iw29e_1{margin:0;width:100%;max-width:100%;height:100%;max-height:100%}}._modalDialog_iw29e_1::backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#0d0e1080;animation:_fadeIn_iw29e_1 .25s forwards}._modalDialog_iw29e_1._closing_iw29e_37::backdrop{animation:_fadeOut_iw29e_1 .25s forwards}@keyframes _fadeIn_iw29e_1{0%{opacity:0}to{opacity:1}}@keyframes _fadeOut_iw29e_1{0%{opacity:1}to{opacity:0}}@keyframes _slideIn_iw29e_1{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes _slideOut_iw29e_1{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}@media (max-width: 768px){._contentWrapper_iw29e_101{width:100%;height:100%}}._modalActionButtons_s27nj_1{display:flex;flex-direction:row;gap:16px;justify-content:center}@media (max-width: 768px){._modalActionButtons_s27nj_1{flex-direction:column;justify-content:stretch}}@media (max-width: 768px){._modalBody_ozynq_1._modalBody_ozynq_1{padding:calc(var(--swui-metrics-space) * 2)}}._modalFooter_1vp0i_1._modalFooter_1vp0i_1{align-items:center;overflow:hidden;background:var(--silver-lighter);border-radius:24px 24px 0 0;padding:0 calc((var(--swui-metrics-indent) * 5));flex-shrink:0}._modalFooter_1vp0i_1._modalFooter_1vp0i_1._sticky_1vp0i_9{position:-webkit-sticky;position:sticky;bottom:0}")),document.head.appendChild(o)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react-modal"),e=require("react/jsx-runtime"),a=require("react"),pe=require("react-draggable"),d=require("classnames"),o=require("@stenajs-webui/core"),b=require("@stenajs-webui/elements"),ye=require("@stenajs-webui/theme"),Ce=n=>{A.setAppElement(n)},we="_overlay_quvmp_1",be="_fadeIn_quvmp_1",je="_modal_quvmp_31",ve="_content_quvmp_41",Ie="_appear_quvmp_1",De="_isDraggable_quvmp_70",Ne="_footer_quvmp_101",Oe="_stickyFooter_quvmp_105",F={overlay:we,fadeIn:be,modal:je,content:ve,appear:Ie,isDraggable:De,footer:Ne,stickyFooter:Oe},K="draggable-modal-handle",Q="draggable-modal-cancel",ie=({width:n,maxWidth:t,draggable:s=!1,children:r,...l})=>{const u=a.useRef(null);return e.jsx(A,{overlayClassName:F.overlay,className:F.modal,...l,children:e.jsx(pe,{handle:`.${K}`,cancel:`.${Q}, button, [role="tooltip"]`,bounds:".ReactModal__Overlay",disabled:!s,nodeRef:u,children:e.jsx("div",{style:{"--swui-modal-width":n,"--swui-modal-max-width":t},className:d(F.content,{[F.isDraggable]:s}),ref:u,children:r})})})},$e="_portal_17ze5_1",Be="_overlay_17ze5_4",Fe="_content_17ze5_9",Ae="_floating_17ze5_15",Me="_slideFromLeft_17ze5_29",Le="_slideFromRight_17ze5_30",ke="_afterOpen_17ze5_36",Se="_beforeClose_17ze5_40",Ee="_slideFromTop_17ze5_45",ze="_slideFromBottom_17ze5_46",x={portal:$e,overlay:Be,content:Fe,floating:Ae,slideFromLeft:Me,slideFromRight:Le,afterOpen:ke,beforeClose:Se,slideFromTop:Ee,slideFromBottom:ze},We=({background:n,zIndex:t,children:s,slideFrom:r="left",portalTarget:l,floating:u,...h})=>{const{height:p,width:w}=h;return e.jsx(A,{closeTimeoutMS:250,portalClassName:x.portal,overlayClassName:{base:x.overlay,afterOpen:x.afterOpen,beforeClose:x.beforeClose},className:{base:d(x.content,qe(r),u&&x.floating),afterOpen:x.afterOpen,beforeClose:x.beforeClose},style:{content:{width:w,height:p,background:n},overlay:{zIndex:t}},parentSelector:l?()=>l:void 0,...h,children:s})},qe=n=>{switch(n){case"left":return x.slideFromLeft;case"right":return x.slideFromRight;case"top":return x.slideFromTop;case"bottom":return x.slideFromBottom;default:return o.exhaustSwitchCase(n,x.slideFromLeft)}},Te=({header:n,contentRight:t,onRequestClose:s,icon:r})=>e.jsx(o.Spacing,{position:"sticky",top:0,zIndex:100,background:ye.cssColor("--lhds-color-ui-50"),children:e.jsxs(o.Row,{justifyContent:"space-between",alignItems:"center",height:"48px",children:[e.jsxs(o.Row,{alignItems:"center",gap:2,children:[e.jsx(o.Space,{num:1}),r&&e.jsx(b.Icon,{icon:r,size:24}),e.jsx(o.Heading,{variant:"h4",children:n})]}),e.jsxs(o.Row,{gap:1,children:[t,e.jsx(b.FlatButton,{leftIcon:b.stenaTimes,onClick:s,variant:"danger"}),e.jsx(o.Space,{num:.5})]})]})}),He="_overlay_1gix5_1",Ge="_fadeIn_1gix5_1",Pe="_modal_1gix5_31",Re="_content_1gix5_38",Ve="_appear_1gix5_1",Xe="_isDraggable_1gix5_61",Ye="_footer_1gix5_92",Je="_stickyFooter_1gix5_96",X={overlay:He,fadeIn:Ge,modal:Pe,content:Re,appear:Ve,isDraggable:Xe,footer:Ye,stickyFooter:Je},Ke={overlay:{justifyContent:"center"}},Qe=({children:n,...t})=>e.jsx(A,{overlayClassName:X.overlay,className:X.modal,style:Ke,...t,children:e.jsx("div",{className:X.content,style:{"--swui-modal-width":"fit-content"},children:n})}),Ue="_overlay_nbrrn_1",Ze="_afterOpen_nbrrn_24",et="_beforeClose_nbrrn_24",tt="_fadeIn_nbrrn_1",nt="_fadeOut_nbrrn_1",st="_modal_nbrrn_36",ot="_slideIn_nbrrn_1",rt="_slideOut_nbrrn_1",at="_content_nbrrn_59",lt="_footer_nbrrn_149",ct="_stickyFooter_nbrrn_153",$={overlay:Ue,afterOpen:Ze,beforeClose:et,fadeIn:tt,fadeOut:nt,modal:st,slideIn:ot,slideOut:rt,content:at,footer:lt,stickyFooter:ct},re=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),de=({children:n,background:t,className:s,overlayClassName:r,...l})=>{const u=a.useRef(null),[h,p]=a.useState(re?"auto":void 0),w={overlay:{justifyContent:"center"},content:{"--swui-modal-content-bg-color":t}},y=o.useEventCallback(()=>{if(!re)return;const m=u.current;m&&p(m.scrollHeight>m.clientHeight?"stable":"auto")});return a.useEffect(()=>(window.addEventListener("resize",y),document.addEventListener("DOMContentLoaded",y),()=>{window.removeEventListener("resize",y),document.removeEventListener("DOMContentLoaded",y)}),[y]),e.jsx(A,{overlayClassName:{base:d(r,$.overlay),beforeClose:$.beforeClose,afterOpen:$.afterOpen},className:{base:d(s,$.modal),beforeClose:$.beforeClose,afterOpen:$.afterOpen},style:w,closeTimeoutMS:250,onAfterOpen:y,...l,children:e.jsx("div",{className:$.content,style:{"--swui-modal-width":"fit-content",scrollbarGutter:h},ref:u,children:n})})},it="_modal_4fwgb_1",dt="_overlay_4fwgb_13",ae={modal:it,overlay:dt},ut=({headerIconLeft:n,headerText:t,shouldCloseOnOverlayClick:s=!1,shouldCloseOnEsc:r=!1,...l})=>e.jsx(A,{...l,isOpen:!0,shouldCloseOnOverlayClick:s,shouldCloseOnEsc:r,className:ae.modal,overlayClassName:ae.overlay,children:e.jsxs(o.Column,{spacing:2,alignItems:"center",children:[e.jsx(o.Box,{alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"50%",background:"white",shadow:"modal",children:e.jsx(b.Spinner,{size:"small"})}),(n||t)&&e.jsxs(e.Fragment,{children:[e.jsx(o.Spacing,{}),e.jsxs(o.Row,{indent:2,children:[n&&e.jsxs(e.Fragment,{children:[e.jsx(b.Icon,{size:14,icon:n,color:"white"}),e.jsx(o.Indent,{})]}),t&&e.jsx(o.Heading,{variant:"h4",color:"white",children:t})]})]})]})}),ue=({onRequestClose:n,header:t,headerText:s,closeButtonClassName:r})=>e.jsxs(o.Row,{spacing:2,indent:2,borderBottom:"1px solid var(--lhds-color-ui-300)",className:K,children:[e.jsxs(o.Row,{flex:1,indent:!0,alignItems:"center",children:[s&&e.jsx(o.Txt,{className:Q,size:"large",children:s}),t]}),e.jsx(o.Box,{alignSelf:"flex-start",children:e.jsx(b.CloseButton,{className:r,onClick:n})})]}),_t=({header:n,headerText:t,children:s,spacing:r,indent:l,draggable:u=!1,onRequestClose:h,closeButtonClassName:p,footer:w,disableStickyFooter:y=!1,...m})=>{const f=typeof r=="number"?r:1,M=typeof l=="number"?l:1;return e.jsxs(ie,{...m,onRequestClose:h,draggable:u,children:[e.jsx(ue,{onRequestClose:h,header:n,headerText:t,closeButtonClassName:p}),e.jsx(o.Box,{spacing:f,indent:M,children:s}),w&&e.jsx(o.Box,{className:d(F.footer,{[F.stickyFooter]:!y}),children:w})]})},mt=({children:n})=>e.jsx(o.Column,{indent:2,spacing:2,children:n}),E=a.createContext(void 0);function z(n,{ref:t,modal:s,contentWrapperClassName:r,closingClassName:l,contentWrapperStyle:u,dialogStyle:h,divInsteadOfDialog:p,disableCloseOnClickOutside:w,elementId:y,onResolve:m,onReject:f,className:M,background:W,label:q,labelledby:T,describedby:H}){const ge=a.useRef(null),_=t??ge,[G,xe]=a.useReducer(i=>i+1,0),Z=a.useRef(null),I=a.useRef(null),j=a.useRef(void 0),L=a.useRef(!1),C=a.useRef(null),[ee,k]=a.useState(!1),[P,B]=a.useState(!1),[te,v]=a.useState(!1),R=n,he=a.useCallback(i=>{var c,g;return Z.current=new Promise((N,O)=>{I.current=N,C.current=O}),v(!1),k(!0),B(!0),xe(),L.current=!1,j.current=i,s?(c=_.current)==null||c.showModal():(g=_.current)==null||g.show(),Z.current},[_,s]),ne=a.useCallback(i=>{var c;L.current=!0,v(!0),k(!1),p?setTimeout(()=>{var g;v(!1),B(!1),(g=I.current)==null||g.call(I,i),j.current=void 0,m==null||m()},300):(c=_.current)==null||c.addEventListener("animationend",g=>{var N,O;g.stopPropagation(),v(!1),B(!1),(N=_.current)==null||N.close(),(O=I.current)==null||O.call(I,i),j.current=void 0,m==null||m()},{once:!0})},[_,m,p]),D=a.useCallback(i=>{var c;L.current=!0,v(!0),k(!1),p?setTimeout(()=>{var g;v(!1),B(!1),(g=C.current)==null||g.call(C,i),f==null||f(),j.current=void 0},300):(c=_.current)==null||c.addEventListener("animationend",g=>{var N,O;g.stopPropagation(),v(!1),B(!1),(N=_.current)==null||N.close(),(O=C.current)==null||O.call(C,i),f==null||f(),j.current=void 0},{once:!0})},[_,p,f]),se=a.useCallback(i=>{var c;i.stopPropagation(),L.current||(v(!1),k(!1),B(!1),(c=C.current)==null||c.call(C),f==null||f(),j.current=void 0)},[f]),oe=a.useCallback(i=>{if(i.target!==_.current)return;const c=_.current.getBoundingClientRect();c.top<=i.clientY&&i.clientY<=c.top+c.height&&c.left<=i.clientX&&i.clientX<=c.left+c.width||D()},[_,D]),V=a.useMemo(()=>({resolve:ne,reject:D}),[D,ne]);return[a.useMemo(()=>p?e.jsx(de,{isOpen:ee,onRequestClose:D,background:W,contentLabel:q,id:y,aria:{modal:!0,labelledby:T,describedby:H},children:e.jsx(E.Provider,{value:V,children:P&&a.createElement(R,{...j.current,key:G})})}):e.jsx("dialog",{onClick:w?void 0:oe,onClose:se,ref:_,id:y,className:d(M,te&&l),"aria-label":q,"aria-labelledby":T,"aria-describedby":H,style:{background:W,...h},children:e.jsx("div",{style:u,className:r,children:P&&e.jsx(E.Provider,{value:V,children:a.createElement(R,{...j.current,key:G})})})}),[p,ee,D,W,q,y,T,H,V,P,R,G,w,oe,se,_,M,te,l,h,u,r]),{show:he,reject:D}]}const ft=()=>{const n=a.useContext(E);if(n==null)throw new Error("useDialogPromise is being used outside of dialog.");return n},gt="_alertDialog_14t8t_1",xt="_slideIn_14t8t_1",ht="_closing_14t8t_22",pt="_slideOut_14t8t_1",yt="_fadeIn_14t8t_1",Ct="_fadeOut_14t8t_1",Y={alertDialog:gt,slideIn:xt,closing:ht,slideOut:pt,fadeIn:yt,fadeOut:Ct};function wt(n,t){return z(n,{...t,modal:!0,closingClassName:d(t==null?void 0:t.closingClassName,Y.closing),contentWrapperClassName:d(t==null?void 0:t.contentWrapperClassName,Y.contentWrapper),className:d(t==null?void 0:t.className,Y.alertDialog)})}const bt="_drawerDialog_11g6r_1",jt="_left_11g6r_13",vt="_right_11g6r_14",It="_contentWrapper_11g6r_19",Dt="_slideInLeft_11g6r_1",Nt="_closing_11g6r_36",Ot="_slideOutLeft_11g6r_1",$t="_slideInRight_11g6r_1",Bt="_slideOutRight_11g6r_1",Ft="_top_11g6r_54",At="_bottom_11g6r_55",Mt="_slideInTop_11g6r_1",Lt="_slideOutTop_11g6r_1",kt="_slideInBottom_11g6r_1",St="_slideOutBottom_11g6r_1",S={drawerDialog:bt,left:jt,right:vt,contentWrapper:It,slideInLeft:Dt,closing:Nt,slideOutLeft:Ot,slideInRight:$t,slideOutRight:Bt,top:Ft,bottom:At,slideInTop:Mt,slideOutTop:Lt,slideInBottom:kt,slideOutBottom:St};function Et(n,t="left",s){return z(n,{...s,disableCloseOnClickOutside:!0,modal:!1,closingClassName:d(s==null?void 0:s.closingClassName,S.closing),contentWrapperClassName:d(s==null?void 0:s.contentWrapperClassName,S.contentWrapper),className:d(s==null?void 0:s.className,S.drawerDialog,S[t])})}const zt="_modalDialog_iw29e_1",Wt="_slideIn_iw29e_1",qt="_closing_iw29e_37",Tt="_slideOut_iw29e_1",Ht="_fadeIn_iw29e_1",Gt="_fadeOut_iw29e_1",Pt="_contentWrapper_iw29e_101",J={modalDialog:zt,slideIn:Wt,closing:qt,slideOut:Tt,fadeIn:Ht,fadeOut:Gt,contentWrapper:Pt};function Rt(n,t){return z(n,{...t,modal:!0,closingClassName:d(t==null?void 0:t.closingClassName,J.closing),contentWrapperClassName:d(t==null?void 0:t.contentWrapperClassName,J.contentWrapper),className:d(t==null?void 0:t.className,J.modalDialog)})}const U=({headingLevel:n="h2",size:t="medium",children:s})=>e.jsx(o.Heading,{variant:t==="medium"?"h3":"h1",as:n,children:s}),Vt="_modalActionButtons_s27nj_1",Xt={modalActionButtons:Vt},_e=({children:n})=>e.jsxs(o.Box,{width:"100%",children:[e.jsx(o.Spacing,{}),e.jsx("div",{className:Xt.modalActionButtons,children:n})]}),Yt="_modalBody_ozynq_1",le={modalBody:Yt},me=({gap:n=3,variant:t="normal",className:s,...r})=>e.jsx(o.Column,{className:d(le.modalBody,le[t],s),indent:t==="relaxed"?5:3,spacing:t==="relaxed"?5:3,gap:n,...r}),fe=({children:n,maxWidth:t})=>e.jsx(o.Column,{flex:1,height:"100%",justifyContent:"space-between",maxWidth:t,children:n}),Jt=({icon:n,buttons:t,heading:s,text:r,children:l,maxWidth:u,minWidth:h})=>e.jsx(fe,{children:e.jsxs(me,{flexDirection:"column",alignItems:"center",maxWidth:u,minWidth:h,children:[n&&e.jsx(b.CircledIcon,{icon:n,size:"large"}),e.jsx(U,{children:s}),r&&e.jsx(o.Text,{textAlign:"center",children:r}),l,t&&e.jsx(_e,{children:t})]})}),Kt=n=>e.jsx(b.FlatButton,{size:"large",variant:"danger",leftIcon:b.stenaTimesThick,...n}),Qt=({heading:n,headingLevel:t,headingSize:s,onClickClose:r,closeButtonAriaLabel:l})=>e.jsx(o.Column,{children:e.jsxs(o.Row,{justifyContent:"space-between",alignItems:"center",gap:2,children:[n?e.jsx(U,{headingLevel:t,size:s,children:n}):e.jsx("div",{}),r?e.jsx(Kt,{onClick:r,size:s,"aria-label":l}):null]})}),Ut="_modalFooter_1vp0i_1",Zt="_sticky_1vp0i_9",ce={modalFooter:Ut,sticky:Zt},en=({children:n,sticky:t,zIndex:s=4,gap:r=2,className:l,...u})=>e.jsx(o.Row,{className:d(ce.modalFooter,t&&ce.sticky,l),shadow:"var(--swui-sticky-footer-shadow)",zIndex:s,...u,children:e.jsx(o.Row,{gap:r,spacing:2,alignItems:"center",children:n})});exports.Alert=Qe;exports.BaseWindow=ie;exports.DRAGGABLE_CANCEL_CLASSNAME=Q;exports.DRAGGABLE_HANDLE_CLASSNAME=K;exports.DialogContext=E;exports.Drawer=We;exports.DrawerHeader=Te;exports.InfoAlert=Jt;exports.LoadingModal=ut;exports.Modal=de;exports.ModalActionButtons=_e;exports.ModalBody=me;exports.ModalContainer=fe;exports.ModalFooter=en;exports.ModalHeader=Qt;exports.ModalHeading=U;exports.Window=_t;exports.WindowFooter=mt;exports.WindowHeader=ue;exports.setupDeclarativeModals=Ce;exports.useAlertDialog=wt;exports.useDialog=z;exports.useDialogPromise=ft;exports.useDrawerDialog=Et;exports.useModalDialog=Rt;
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react-modal"),e=require("react/jsx-runtime"),a=require("react"),ye=require("react-draggable"),d=require("classnames"),o=require("@stenajs-webui/core"),b=require("@stenajs-webui/elements"),Ce=require("@stenajs-webui/theme"),we=n=>{A.setAppElement(n)},be="_overlay_quvmp_1",je="_fadeIn_quvmp_1",ve="_modal_quvmp_31",Ie="_content_quvmp_41",De="_appear_quvmp_1",Ne="_isDraggable_quvmp_70",Oe="_footer_quvmp_101",$e="_stickyFooter_quvmp_105",F={overlay:be,fadeIn:je,modal:ve,content:Ie,appear:De,isDraggable:Ne,footer:Oe,stickyFooter:$e},K="draggable-modal-handle",Q="draggable-modal-cancel",ie=({width:n,maxWidth:t,draggable:s=!1,children:r,...l})=>{const u=a.useRef(null);return e.jsx(A,{overlayClassName:F.overlay,className:F.modal,...l,children:e.jsx(ye,{handle:`.${K}`,cancel:`.${Q}, button, [role="tooltip"]`,bounds:".ReactModal__Overlay",disabled:!s,nodeRef:u,children:e.jsx("div",{style:{"--swui-modal-width":n,"--swui-modal-max-width":t},className:d(F.content,{[F.isDraggable]:s}),ref:u,children:r})})})},Be="_portal_17ze5_1",Fe="_overlay_17ze5_4",Ae="_content_17ze5_9",Me="_floating_17ze5_15",Le="_slideFromLeft_17ze5_29",ke="_slideFromRight_17ze5_30",Se="_afterOpen_17ze5_36",Ee="_beforeClose_17ze5_40",ze="_slideFromTop_17ze5_45",We="_slideFromBottom_17ze5_46",x={portal:Be,overlay:Fe,content:Ae,floating:Me,slideFromLeft:Le,slideFromRight:ke,afterOpen:Se,beforeClose:Ee,slideFromTop:ze,slideFromBottom:We},qe=({background:n,zIndex:t,children:s,slideFrom:r="left",portalTarget:l,floating:u,...h})=>{const{height:p,width:w}=h;return e.jsx(A,{closeTimeoutMS:250,portalClassName:x.portal,overlayClassName:{base:x.overlay,afterOpen:x.afterOpen,beforeClose:x.beforeClose},className:{base:d(x.content,Te(r),u&&x.floating),afterOpen:x.afterOpen,beforeClose:x.beforeClose},style:{content:{width:w,height:p,background:n},overlay:{zIndex:t}},parentSelector:l?()=>l:void 0,...h,children:s})},Te=n=>{switch(n){case"left":return x.slideFromLeft;case"right":return x.slideFromRight;case"top":return x.slideFromTop;case"bottom":return x.slideFromBottom;default:return o.exhaustSwitchCase(n,x.slideFromLeft)}},He=({header:n,contentRight:t,onRequestClose:s,icon:r})=>e.jsx(o.Spacing,{position:"sticky",top:0,zIndex:100,background:Ce.cssColor("--lhds-color-ui-50"),children:e.jsxs(o.Row,{justifyContent:"space-between",alignItems:"center",height:"48px",children:[e.jsxs(o.Row,{alignItems:"center",gap:2,children:[e.jsx(o.Space,{num:1}),r&&e.jsx(b.Icon,{icon:r,size:24}),e.jsx(o.Heading,{variant:"h4",children:n})]}),e.jsxs(o.Row,{gap:1,children:[t,e.jsx(b.FlatButton,{leftIcon:b.stenaTimes,onClick:s,variant:"danger"}),e.jsx(o.Space,{num:.5})]})]})}),Ge="_overlay_1gix5_1",Pe="_fadeIn_1gix5_1",Re="_modal_1gix5_31",Ve="_content_1gix5_38",Xe="_appear_1gix5_1",Ye="_isDraggable_1gix5_61",Je="_footer_1gix5_92",Ke="_stickyFooter_1gix5_96",X={overlay:Ge,fadeIn:Pe,modal:Re,content:Ve,appear:Xe,isDraggable:Ye,footer:Je,stickyFooter:Ke},Qe={overlay:{justifyContent:"center"}},Ue=({children:n,...t})=>e.jsx(A,{overlayClassName:X.overlay,className:X.modal,style:Qe,...t,children:e.jsx("div",{className:X.content,style:{"--swui-modal-width":"fit-content"},children:n})}),Ze="_overlay_nbrrn_1",et="_afterOpen_nbrrn_24",tt="_beforeClose_nbrrn_24",nt="_fadeIn_nbrrn_1",st="_fadeOut_nbrrn_1",ot="_modal_nbrrn_36",rt="_slideIn_nbrrn_1",at="_slideOut_nbrrn_1",lt="_content_nbrrn_59",ct="_footer_nbrrn_149",it="_stickyFooter_nbrrn_153",$={overlay:Ze,afterOpen:et,beforeClose:tt,fadeIn:nt,fadeOut:st,modal:ot,slideIn:rt,slideOut:at,content:lt,footer:ct,stickyFooter:it},re=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),de=({children:n,background:t,className:s,overlayClassName:r,...l})=>{const u=a.useRef(null),[h,p]=a.useState(re?"auto":void 0),w={overlay:{justifyContent:"center"},content:{"--swui-modal-content-bg-color":t}},y=o.useEventCallback(()=>{if(!re)return;const m=u.current;m&&p(m.scrollHeight>m.clientHeight?"stable":"auto")});return a.useEffect(()=>(window.addEventListener("resize",y),document.addEventListener("DOMContentLoaded",y),()=>{window.removeEventListener("resize",y),document.removeEventListener("DOMContentLoaded",y)}),[y]),e.jsx(A,{overlayClassName:{base:d(r,$.overlay),beforeClose:$.beforeClose,afterOpen:$.afterOpen},className:{base:d(s,$.modal),beforeClose:$.beforeClose,afterOpen:$.afterOpen},style:w,closeTimeoutMS:250,onAfterOpen:y,...l,children:e.jsx("div",{className:$.content,style:{"--swui-modal-width":"fit-content",scrollbarGutter:h},ref:u,children:n})})},dt="_modal_4fwgb_1",ut="_overlay_4fwgb_13",ae={modal:dt,overlay:ut},_t=({headerIconLeft:n,headerText:t,shouldCloseOnOverlayClick:s=!1,shouldCloseOnEsc:r=!1,...l})=>e.jsx(A,{...l,isOpen:!0,shouldCloseOnOverlayClick:s,shouldCloseOnEsc:r,className:ae.modal,overlayClassName:ae.overlay,children:e.jsxs(o.Column,{spacing:2,alignItems:"center",children:[e.jsx(o.Box,{alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"50%",background:"white",shadow:"modal",children:e.jsx(b.Spinner,{size:"small"})}),(n||t)&&e.jsxs(e.Fragment,{children:[e.jsx(o.Spacing,{}),e.jsxs(o.Row,{indent:2,children:[n&&e.jsxs(e.Fragment,{children:[e.jsx(b.Icon,{size:14,icon:n,color:"white"}),e.jsx(o.Indent,{})]}),t&&e.jsx(o.Heading,{variant:"h4",color:"white",children:t})]})]})]})}),ue=({onRequestClose:n,header:t,headerText:s,closeButtonClassName:r})=>e.jsxs(o.Row,{spacing:2,indent:2,borderBottom:"1px solid var(--lhds-color-ui-300)",className:K,children:[e.jsxs(o.Row,{flex:1,indent:!0,alignItems:"center",children:[s&&e.jsx(o.Txt,{className:Q,size:"large",children:s}),t]}),e.jsx(o.Box,{alignSelf:"flex-start",children:e.jsx(b.CloseButton,{className:r,onClick:n})})]}),mt=({header:n,headerText:t,children:s,spacing:r,indent:l,draggable:u=!1,onRequestClose:h,closeButtonClassName:p,footer:w,disableStickyFooter:y=!1,...m})=>{const f=typeof r=="number"?r:1,M=typeof l=="number"?l:1;return e.jsxs(ie,{...m,onRequestClose:h,draggable:u,children:[e.jsx(ue,{onRequestClose:h,header:n,headerText:t,closeButtonClassName:p}),e.jsx(o.Box,{spacing:f,indent:M,children:s}),w&&e.jsx(o.Box,{className:d(F.footer,{[F.stickyFooter]:!y}),children:w})]})},ft=({children:n})=>e.jsx(o.Column,{indent:2,spacing:2,children:n}),E=a.createContext(void 0);function z(n,{ref:t,modal:s,contentWrapperClassName:r,closingClassName:l,contentWrapperStyle:u,dialogStyle:h,divInsteadOfDialog:p,disableCloseOnClickOutside:w,elementId:y,onResolve:m,onReject:f,className:M,background:W,label:q,labelledby:T,describedby:H}){const xe=a.useRef(null),_=t??xe,[G,he]=a.useReducer(i=>i+1,0),Z=a.useRef(null),I=a.useRef(null),j=a.useRef(void 0),L=a.useRef(!1),C=a.useRef(null),[ee,k]=a.useState(!1),[P,B]=a.useState(!1),[te,v]=a.useState(!1),R=n,pe=a.useCallback(i=>{var c,g;return Z.current=new Promise((N,O)=>{I.current=N,C.current=O}),v(!1),k(!0),B(!0),he(),L.current=!1,j.current=i,s?(c=_.current)==null||c.showModal():(g=_.current)==null||g.show(),Z.current},[_,s]),ne=a.useCallback(i=>{var c;L.current=!0,v(!0),k(!1),p?setTimeout(()=>{var g;v(!1),B(!1),(g=I.current)==null||g.call(I,i),j.current=void 0,m==null||m()},300):(c=_.current)==null||c.addEventListener("animationend",g=>{var N,O;g.stopPropagation(),v(!1),B(!1),(N=_.current)==null||N.close(),(O=I.current)==null||O.call(I,i),j.current=void 0,m==null||m()},{once:!0})},[_,m,p]),D=a.useCallback(i=>{var c;L.current=!0,v(!0),k(!1),p?setTimeout(()=>{var g;v(!1),B(!1),(g=C.current)==null||g.call(C,i),f==null||f(),j.current=void 0},300):(c=_.current)==null||c.addEventListener("animationend",g=>{var N,O;g.stopPropagation(),v(!1),B(!1),(N=_.current)==null||N.close(),(O=C.current)==null||O.call(C,i),f==null||f(),j.current=void 0},{once:!0})},[_,p,f]),se=a.useCallback(i=>{var c;i.stopPropagation(),L.current||(v(!1),k(!1),B(!1),(c=C.current)==null||c.call(C),f==null||f(),j.current=void 0)},[f]),oe=a.useCallback(i=>{if(i.target!==_.current)return;const c=_.current.getBoundingClientRect();c.top<=i.clientY&&i.clientY<=c.top+c.height&&c.left<=i.clientX&&i.clientX<=c.left+c.width||D()},[_,D]),V=a.useMemo(()=>({resolve:ne,reject:D}),[D,ne]);return[a.useMemo(()=>p?e.jsx(de,{isOpen:ee,onRequestClose:D,background:W,contentLabel:q,id:y,aria:{modal:!0,labelledby:T,describedby:H},children:e.jsx(E.Provider,{value:V,children:P&&a.createElement(R,{...j.current,key:G})})}):e.jsx("dialog",{onClick:w?void 0:oe,onClose:se,ref:_,id:y,className:d(M,te&&l),"aria-label":q,"aria-labelledby":T,"aria-describedby":H,style:{background:W,...h},children:e.jsx("div",{style:u,className:r,children:P&&e.jsx(E.Provider,{value:V,children:a.createElement(R,{...j.current,key:G})})})}),[p,ee,D,W,q,y,T,H,V,P,R,G,w,oe,se,_,M,te,l,h,u,r]),{show:pe,reject:D}]}const gt=()=>{const n=a.useContext(E);if(n==null)throw new Error("useDialogPromise is being used outside of dialog.");return n},xt="_alertDialog_14t8t_1",ht="_slideIn_14t8t_1",pt="_closing_14t8t_22",yt="_slideOut_14t8t_1",Ct="_fadeIn_14t8t_1",wt="_fadeOut_14t8t_1",Y={alertDialog:xt,slideIn:ht,closing:pt,slideOut:yt,fadeIn:Ct,fadeOut:wt};function bt(n,t){return z(n,{...t,modal:!0,closingClassName:d(t==null?void 0:t.closingClassName,Y.closing),contentWrapperClassName:d(t==null?void 0:t.contentWrapperClassName,Y.contentWrapper),className:d(t==null?void 0:t.className,Y.alertDialog)})}const jt="_drawerDialog_11g6r_1",vt="_left_11g6r_13",It="_right_11g6r_14",Dt="_contentWrapper_11g6r_19",Nt="_slideInLeft_11g6r_1",Ot="_closing_11g6r_36",$t="_slideOutLeft_11g6r_1",Bt="_slideInRight_11g6r_1",Ft="_slideOutRight_11g6r_1",At="_top_11g6r_54",Mt="_bottom_11g6r_55",Lt="_slideInTop_11g6r_1",kt="_slideOutTop_11g6r_1",St="_slideInBottom_11g6r_1",Et="_slideOutBottom_11g6r_1",S={drawerDialog:jt,left:vt,right:It,contentWrapper:Dt,slideInLeft:Nt,closing:Ot,slideOutLeft:$t,slideInRight:Bt,slideOutRight:Ft,top:At,bottom:Mt,slideInTop:Lt,slideOutTop:kt,slideInBottom:St,slideOutBottom:Et};function zt(n,t="left",s){return z(n,{...s,disableCloseOnClickOutside:!0,modal:!1,closingClassName:d(s==null?void 0:s.closingClassName,S.closing),contentWrapperClassName:d(s==null?void 0:s.contentWrapperClassName,S.contentWrapper),className:d(s==null?void 0:s.className,S.drawerDialog,S[t])})}const Wt="_modalDialog_iw29e_1",qt="_slideIn_iw29e_1",Tt="_closing_iw29e_37",Ht="_slideOut_iw29e_1",Gt="_fadeIn_iw29e_1",Pt="_fadeOut_iw29e_1",Rt="_contentWrapper_iw29e_101",J={modalDialog:Wt,slideIn:qt,closing:Tt,slideOut:Ht,fadeIn:Gt,fadeOut:Pt,contentWrapper:Rt};function Vt(n,t){return z(n,{...t,modal:!0,closingClassName:d(t==null?void 0:t.closingClassName,J.closing),contentWrapperClassName:d(t==null?void 0:t.contentWrapperClassName,J.contentWrapper),className:d(t==null?void 0:t.className,J.modalDialog)})}const U=({headingLevel:n="h2",size:t="medium",children:s})=>e.jsx(o.Heading,{variant:t==="medium"?"h3":"h1",as:n,children:s}),Xt="_modalActionButtons_s27nj_1",Yt={modalActionButtons:Xt},_e=({children:n})=>e.jsxs(o.Box,{width:"100%",children:[e.jsx(o.Spacing,{}),e.jsx("div",{className:Yt.modalActionButtons,children:n})]}),Jt="_modalBody_ozynq_1",le={modalBody:Jt},me=({gap:n=3,variant:t="normal",className:s,...r})=>e.jsx(o.Column,{className:d(le.modalBody,le[t],s),indent:t==="relaxed"?5:3,spacing:t==="relaxed"?5:3,gap:n,...r}),fe=({children:n,maxWidth:t})=>e.jsx(o.Column,{flex:1,height:"100%",justifyContent:"space-between",maxWidth:t,children:n}),Kt=({icon:n,buttons:t,heading:s,text:r,children:l,maxWidth:u,minWidth:h})=>e.jsx(fe,{children:e.jsxs(me,{flexDirection:"column",alignItems:"center",maxWidth:u,minWidth:h,children:[n&&e.jsx(b.CircledIcon,{icon:n,size:"large"}),e.jsx(U,{children:s}),r&&e.jsx(o.Text,{textAlign:"center",children:r}),l,t&&e.jsx(_e,{children:t})]})}),ge=n=>e.jsx(b.FlatButton,{size:"large",variant:"danger",leftIcon:b.stenaTimesThick,...n}),Qt=({heading:n,headingLevel:t,headingSize:s,onClickClose:r,closeButtonAriaLabel:l})=>e.jsx(o.Column,{children:e.jsxs(o.Row,{justifyContent:"space-between",alignItems:"center",gap:2,children:[n?e.jsx(U,{headingLevel:t,size:s,children:n}):e.jsx("div",{}),r?e.jsx(ge,{onClick:r,size:s,"aria-label":l}):null]})}),Ut="_modalFooter_1vp0i_1",Zt="_sticky_1vp0i_9",ce={modalFooter:Ut,sticky:Zt},en=({children:n,sticky:t,zIndex:s=4,gap:r=2,className:l,...u})=>e.jsx(o.Row,{className:d(ce.modalFooter,t&&ce.sticky,l),shadow:"var(--swui-sticky-footer-shadow)",zIndex:s,...u,children:e.jsx(o.Row,{gap:r,spacing:2,alignItems:"center",children:n})});exports.Alert=Ue;exports.BaseWindow=ie;exports.DRAGGABLE_CANCEL_CLASSNAME=Q;exports.DRAGGABLE_HANDLE_CLASSNAME=K;exports.DialogContext=E;exports.Drawer=qe;exports.DrawerHeader=He;exports.InfoAlert=Kt;exports.LoadingModal=_t;exports.Modal=de;exports.ModalActionButtons=_e;exports.ModalBody=me;exports.ModalCloseButton=ge;exports.ModalContainer=fe;exports.ModalFooter=en;exports.ModalHeader=Qt;exports.ModalHeading=U;exports.Window=mt;exports.WindowFooter=ft;exports.WindowHeader=ue;exports.setupDeclarativeModals=we;exports.useAlertDialog=bt;exports.useDialog=z;exports.useDialogPromise=gt;exports.useDrawerDialog=zt;exports.useModalDialog=Vt;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stenajs-webui/modal",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "mattias800",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"deploy": "gh-pages -d example/build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@stenajs-webui/core": "22.0.
|
|
39
|
-
"@stenajs-webui/elements": "22.0.
|
|
40
|
-
"@stenajs-webui/theme": "22.0.
|
|
38
|
+
"@stenajs-webui/core": "22.0.2",
|
|
39
|
+
"@stenajs-webui/elements": "22.0.2",
|
|
40
|
+
"@stenajs-webui/theme": "22.0.2",
|
|
41
41
|
"@types/react-modal": "^3.16.3",
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
43
|
"react-draggable": "4.4.6",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"files": [
|
|
65
65
|
"dist"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ea34d20b547878a20b7ab286596098a4a707e3c0"
|
|
68
68
|
}
|