react-luminus-components 1.2.17 → 1.2.21
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/components/common/SimplePicker/SimplePicker.d.ts +6 -6
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +20 -26
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1299 -1298
- package/dist/models/prop-types/InputProps/DropdownPickerProps.d.ts +4 -3
- package/dist/models/types/PromptOptions.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { DropdownPickerOption, DropdownPickerTexts } from '@models/index';
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { DropdownPickerOption, DropdownPickerTexts, FormSelectOption } from '@models/index';
|
|
3
3
|
type Props = {
|
|
4
4
|
show: boolean;
|
|
5
5
|
onCancel: () => void;
|
|
6
6
|
items: DropdownPickerOption[];
|
|
7
|
-
currentSelection:
|
|
8
|
-
onSelectionChange: (item:
|
|
9
|
-
onClickSelectedItem?: (item:
|
|
7
|
+
currentSelection: FormSelectOption | null;
|
|
8
|
+
onSelectionChange: (item: FormSelectOption | null) => void;
|
|
9
|
+
onClickSelectedItem?: (item: FormSelectOption) => void;
|
|
10
10
|
onSearchQueryChange: (query: string) => void;
|
|
11
11
|
texts: DropdownPickerTexts;
|
|
12
|
-
inputRef: HTMLSelectElement
|
|
12
|
+
inputRef: RefObject<HTMLSelectElement> | RefObject<HTMLInputElement>;
|
|
13
13
|
additionalColumns?: {
|
|
14
14
|
key: string;
|
|
15
15
|
name: string;
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-BKpAJdnv.cjs"),a=require("react"),je=require("./useConfirm-D1nPczaK.cjs"),De=require("./Typography-tgs5dV12.cjs"),j=require("./DataKey-CD61sktc.cjs"),Fe=require("react-dom");function Ie(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}return t.default=s,Object.freeze(t)}const g=Ie(a),Pe=s=>g.forwardRef((t,n)=>e.jsxRuntimeExports.jsx("div",{...t,ref:n,className:e.classNames(t.className,s)})),Ue={"aria-label":e.PropTypes.string,onClick:e.PropTypes.func,variant:e.PropTypes.oneOf(["white"])},me=g.forwardRef(({className:s,variant:t,"aria-label":n="Close",...o},r)=>e.jsxRuntimeExports.jsx("button",{ref:r,type:"button",className:e.classNames("btn-close",t&&`btn-close-${t}`,s),"aria-label":n,...o}));me.displayName="CloseButton";me.propTypes=Ue;var J;function ge(s){if((!J&&J!==0||s)&&e.canUseDOM){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),J=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return J}function ce(s){s===void 0&&(s=e.ownerDocument());try{var t=s.activeElement;return!t||!t.nodeName?null:t}catch{return s.body}}function We(s=document){const t=s.defaultView;return Math.abs(t.innerWidth-s.documentElement.clientWidth)}const Ee=j.dataAttr("modal-open");class fe{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:o=!1}={}){this.handleContainerOverflow=n,this.isRTL=o,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return We(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},o=this.isRTL?"paddingLeft":"paddingRight",r=this.getElement();t.style={overflow:r.style.overflow,[o]:r.style[o]},t.scrollBarWidth&&(n[o]=`${parseInt(e.style(r,o)||"0",10)+t.scrollBarWidth}px`),r.setAttribute(Ee,""),e.style(r,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Ee),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const He=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function _e(s,t){if(s==null)return{};var n={},o=Object.keys(s),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=s[r]);return n}let ue;function $e(s){return ue||(ue=new fe({ownerDocument:s==null?void 0:s.document})),ue}function qe(s){const t=e.useWindow(),n=s||$e(t),o=a.useRef({dialog:null,backdrop:null});return Object.assign(o.current,{add:()=>n.add(o.current),remove:()=>n.remove(o.current),isTopModal:()=>n.isTopModal(o.current),setDialogRef:a.useCallback(r=>{o.current.dialog=r},[]),setBackdropRef:a.useCallback(r=>{o.current.backdrop=r},[])})}const Re=a.forwardRef((s,t)=>{let{show:n=!1,role:o="dialog",className:r,style:i,children:m,backdrop:c=!0,keyboard:f=!0,onBackdropClick:p,onEscapeKeyDown:u,transition:h,runTransition:v,backdropTransition:w,runBackdropTransition:Q,autoFocus:W=!0,enforceFocus:Z=!0,restoreFocus:N=!0,restoreFocusOptions:ee,renderDialog:H,renderBackdrop:te=d=>e.jsxRuntimeExports.jsx("div",Object.assign({},d)),manager:se,container:ne,onShow:_,onHide:A=()=>{},onExit:oe,onExited:D,onExiting:$,onEnter:q,onEntering:K,onEntered:z}=s,re=_e(s,He);const R=e.useWindow(),M=e.useWaitForDOMRef(ne),x=qe(se),ae=e.useMounted(),G=j.usePrevious(n),[y,k]=a.useState(!n),E=a.useRef(null);a.useImperativeHandle(t,()=>x,[x]),e.canUseDOM&&!G&&n&&(E.current=ce(R==null?void 0:R.document)),n&&y&&k(!1);const C=e.useEventCallback(()=>{if(x.add(),T.current=e.listen(document,"keydown",le),I.current=e.listen(document,"focus",()=>setTimeout(ie),!0),_&&_(),W){var d,Y;const U=ce((d=(Y=x.dialog)==null?void 0:Y.ownerDocument)!=null?d:R==null?void 0:R.document);x.dialog&&U&&!e.contains(x.dialog,U)&&(E.current=U,x.dialog.focus())}}),F=e.useEventCallback(()=>{if(x.remove(),T.current==null||T.current(),I.current==null||I.current(),N){var d;(d=E.current)==null||d.focus==null||d.focus(ee),E.current=null}});a.useEffect(()=>{!n||!M||C()},[n,M,C]),a.useEffect(()=>{y&&F()},[y,F]),e.useWillUnmount(()=>{F()});const ie=e.useEventCallback(()=>{if(!Z||!ae()||!x.isTopModal())return;const d=ce(R==null?void 0:R.document);x.dialog&&d&&!e.contains(x.dialog,d)&&x.dialog.focus()}),V=e.useEventCallback(d=>{d.target===d.currentTarget&&(p==null||p(d),c===!0&&A())}),le=e.useEventCallback(d=>{f&&e.isEscKey(d)&&x.isTopModal()&&(u==null||u(d),d.defaultPrevented||A())}),I=a.useRef(),T=a.useRef(),X=(...d)=>{k(!0),D==null||D(...d)};if(!M)return null;const S=Object.assign({role:o,ref:x.setDialogRef,"aria-modal":o==="dialog"?!0:void 0},re,{style:i,className:r,tabIndex:-1});let P=H?H(S):e.jsxRuntimeExports.jsx("div",Object.assign({},S,{children:g.cloneElement(m,{role:"document"})}));P=e.renderTransition(h,v,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:oe,onExiting:$,onExited:X,onEnter:q,onEntering:K,onEntered:z,children:P});let O=null;return c&&(O=te({ref:x.setBackdropRef,onClick:V}),O=e.renderTransition(w,Q,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:O})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Fe.createPortal(e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[O,P]}),M)})});Re.displayName="Modal";const Ke=Object.assign(Re,{Manager:fe});function ze(s,t){s.classList?s.classList.add(t):e.hasClass(s,t)||(typeof s.className=="string"?s.className=s.className+" "+t:s.setAttribute("class",(s.className&&s.className.baseVal||"")+" "+t))}function ve(s,t){return s.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Ge(s,t){s.classList?s.classList.remove(t):typeof s.className=="string"?s.className=ve(s.className,t):s.setAttribute("class",ve(s.className&&s.className.baseVal||"",t))}const B={FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"};class Ve extends fe{adjustAndStore(t,n,o){const r=n.style[t];n.dataset[t]=r,e.style(n,{[t]:`${parseFloat(e.style(n,t))+o}px`})}restore(t,n){const o=n.dataset[t];o!==void 0&&(delete n.dataset[t],e.style(n,{[t]:o}))}setContainerStyle(t){super.setContainerStyle(t);const n=this.getElement();if(ze(n,"modal-open"),!t.scrollBarWidth)return;const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";j.qsa(n,B.FIXED_CONTENT).forEach(i=>this.adjustAndStore(o,i,t.scrollBarWidth)),j.qsa(n,B.STICKY_CONTENT).forEach(i=>this.adjustAndStore(r,i,-t.scrollBarWidth)),j.qsa(n,B.NAVBAR_TOGGLER).forEach(i=>this.adjustAndStore(r,i,t.scrollBarWidth))}removeContainerStyle(t){super.removeContainerStyle(t);const n=this.getElement();Ge(n,"modal-open");const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";j.qsa(n,B.FIXED_CONTENT).forEach(i=>this.restore(o,i)),j.qsa(n,B.STICKY_CONTENT).forEach(i=>this.restore(r,i)),j.qsa(n,B.NAVBAR_TOGGLER).forEach(i=>this.restore(r,i))}}let de;function Xe(s){return de||(de=new Ve(s)),de}const Ce=g.forwardRef(({className:s,bsPrefix:t,as:n="div",...o},r)=>(t=e.useBootstrapPrefix(t,"modal-body"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));Ce.displayName="ModalBody";const ye=g.createContext({onHide(){}}),pe=g.forwardRef(({bsPrefix:s,className:t,contentClassName:n,centered:o,size:r,fullscreen:i,children:m,scrollable:c,...f},p)=>{s=e.useBootstrapPrefix(s,"modal");const u=`${s}-dialog`,h=typeof i=="string"?`${s}-fullscreen-${i}`:`${s}-fullscreen`;return e.jsxRuntimeExports.jsx("div",{...f,ref:p,className:e.classNames(u,t,r&&`${s}-${r}`,o&&`${u}-centered`,c&&`${u}-scrollable`,i&&h),children:e.jsxRuntimeExports.jsx("div",{className:e.classNames(`${s}-content`,n),children:m})})});pe.displayName="ModalDialog";const be=g.forwardRef(({className:s,bsPrefix:t,as:n="div",...o},r)=>(t=e.useBootstrapPrefix(t,"modal-footer"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));be.displayName="ModalFooter";const Ye=g.forwardRef(({closeLabel:s="Close",closeVariant:t,closeButton:n=!1,onHide:o,children:r,...i},m)=>{const c=a.useContext(ye),f=e.useEventCallback(()=>{c==null||c.onHide(),o==null||o()});return e.jsxRuntimeExports.jsxs("div",{ref:m,...i,children:[r,n&&e.jsxRuntimeExports.jsx(me,{"aria-label":s,variant:t,onClick:f})]})}),we=g.forwardRef(({bsPrefix:s,className:t,closeLabel:n="Close",closeButton:o=!1,...r},i)=>(s=e.useBootstrapPrefix(s,"modal-header"),e.jsxRuntimeExports.jsx(Ye,{ref:i,...r,className:e.classNames(t,s),closeLabel:n,closeButton:o})));we.displayName="ModalHeader";const Je=Pe("h4"),Ne=g.forwardRef(({className:s,bsPrefix:t,as:n=Je,...o},r)=>(t=e.useBootstrapPrefix(t,"modal-title"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));Ne.displayName="ModalTitle";function Qe(s){return e.jsxRuntimeExports.jsx(e.Fade,{...s,timeout:null})}function Ze(s){return e.jsxRuntimeExports.jsx(e.Fade,{...s,timeout:null})}const Me=g.forwardRef(({bsPrefix:s,className:t,style:n,dialogClassName:o,contentClassName:r,children:i,dialogAs:m=pe,"data-bs-theme":c,"aria-labelledby":f,"aria-describedby":p,"aria-label":u,show:h=!1,animation:v=!0,backdrop:w=!0,keyboard:Q=!0,onEscapeKeyDown:W,onShow:Z,onHide:N,container:ee,autoFocus:H=!0,enforceFocus:te=!0,restoreFocus:se=!0,restoreFocusOptions:ne,onEntered:_,onExit:A,onExiting:oe,onEnter:D,onEntering:$,onExited:q,backdropClassName:K,manager:z,...re},R)=>{const[M,x]=a.useState({}),[ae,G]=a.useState(!1),y=a.useRef(!1),k=a.useRef(!1),E=a.useRef(null),[C,F]=e.useCallbackRef(),ie=e.useMergedRefs(R,F),V=e.useEventCallback(N),le=e.useIsRTL();s=e.useBootstrapPrefix(s,"modal");const I=a.useMemo(()=>({onHide:V}),[V]);function T(){return z||Xe({isRTL:le})}function X(l){if(!e.canUseDOM)return;const L=T().getScrollbarWidth()>0,he=l.scrollHeight>e.ownerDocument(l).documentElement.clientHeight;x({paddingRight:L&&!he?ge():void 0,paddingLeft:!L&&he?ge():void 0})}const S=e.useEventCallback(()=>{C&&X(C.dialog)});e.useWillUnmount(()=>{e.removeEventListener(window,"resize",S),E.current==null||E.current()});const P=()=>{y.current=!0},O=l=>{y.current&&C&&l.target===C.dialog&&(k.current=!0),y.current=!1},d=()=>{G(!0),E.current=e.transitionEnd(C.dialog,()=>{G(!1)})},Y=l=>{l.target===l.currentTarget&&d()},U=l=>{if(w==="static"){Y(l);return}if(k.current||l.target!==l.currentTarget){k.current=!1;return}N==null||N()},ke=l=>{Q?W==null||W(l):(l.preventDefault(),w==="static"&&d())},Te=(l,L)=>{l&&X(l),D==null||D(l,L)},Se=l=>{E.current==null||E.current(),A==null||A(l)},Oe=(l,L)=>{$==null||$(l,L),e.addEventListener(window,"resize",S)},Le=l=>{l&&(l.style.display=""),q==null||q(l),e.removeEventListener(window,"resize",S)},Be=a.useCallback(l=>e.jsxRuntimeExports.jsx("div",{...l,className:e.classNames(`${s}-backdrop`,K,!v&&"show")}),[v,K,s]),xe={...n,...M};xe.display="block";const Ae=l=>e.jsxRuntimeExports.jsx("div",{role:"dialog",...l,style:xe,className:e.classNames(t,s,ae&&`${s}-static`,!v&&"show"),onClick:w?U:void 0,onMouseUp:O,"data-bs-theme":c,"aria-label":u,"aria-labelledby":f,"aria-describedby":p,children:e.jsxRuntimeExports.jsx(m,{...re,onMouseDown:P,className:o,contentClassName:r,children:i})});return e.jsxRuntimeExports.jsx(ye.Provider,{value:I,children:e.jsxRuntimeExports.jsx(Ke,{show:h,ref:ie,backdrop:w,container:ee,keyboard:!0,autoFocus:H,enforceFocus:te,restoreFocus:se,restoreFocusOptions:ne,onEscapeKeyDown:ke,onShow:Z,onHide:N,onEnter:Te,onEntering:Oe,onEntered:_,onExit:Se,onExiting:oe,onExited:Le,manager:T(),transition:v?Qe:void 0,backdropTransition:v?Ze:void 0,renderBackdrop:Be,renderDialog:Ae})})});Me.displayName="Modal";const b=Object.assign(Me,{Body:Ce,Header:we,Title:Ne,Footer:be,Dialog:pe,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),et=()=>{const{confirmTexts:s}=a.useContext(e.LuminusComponentsContext),{isShown:t,text:n,onFinish:o}=je.usePrompt(),{options:r}=a.useContext(e.PromptContext),[i,m]=a.useState(""),c=a.useCallback(()=>{o(null)},[o]),f=a.useCallback(()=>{o(i)},[o,i]);a.useEffect(()=>{t===!0&&m("")},[t]);const p=a.useMemo(()=>({value:i,onChange:u=>m(u.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[i]);return e.jsxRuntimeExports.jsxs(b,{show:t,size:"sm",centered:!0,onHide:c,children:[e.jsxRuntimeExports.jsx(b.Header,{children:e.jsxRuntimeExports.jsx(b.Title,{children:n})}),e.jsxRuntimeExports.jsxs(b.Body,{children:[r.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...p,rows:5}):void 0,r.input==="input"?e.jsxRuntimeExports.jsx("input",{...p,type:r.type}):void 0]}),e.jsxRuntimeExports.jsxs(b.Footer,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:c,children:s.cancel}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:f,disabled:r.required&&!i,children:s.confirm})]})]})},tt=({children:s})=>{const[t,n]=a.useState(!1),[o,r]=a.useState(""),[i,m]=a.useState({input:"textarea",type:"text"}),c=a.useRef(()=>{}),f=a.useCallback(h=>{r(h),n(!0),console.log("showprompt")},[]),p=a.useCallback(()=>{n(!1)},[]),u=a.useMemo(()=>({isShown:t,text:o,showPrompt:f,hidePrompt:p,resolveRef:c,options:i,setOptions:m}),[t,o,f,p,i]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:u,children:[s,e.jsxRuntimeExports.jsx(et,{})]})},st=({children:s})=>{const[t,n]=a.useState(!1),[o,r]=a.useState(""),i=a.useCallback(f=>{n(!0),r(f)},[]),m=a.useCallback(()=>{n(!1)},[]),c=a.useMemo(()=>({show:t,text:o,showConfirm:i,hideConfirm:m}),[t,o,i,m]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:c,children:[e.jsxRuntimeExports.jsx(at,{}),s]})},nt=({cookieDomain:s,axiosInstance:t,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:m,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p,customSelectTexts:u,children:h})=>{const v=a.useMemo(()=>({axiosInstance:t,cookieDomain:s,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:m,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p,customSelectTexts:u}),[t,s,n,o,r,i,m,c,f,p,u]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:v,children:e.jsxRuntimeExports.jsx(st,{children:e.jsxRuntimeExports.jsxs(tt,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),h]})})})},ot=({children:s})=>{const[t,n]=a.useState(!1),[o]=a.useState(new Set),r=a.useCallback(c=>{o.add(c),n(!0)},[o]),i=a.useCallback(c=>{o.delete(c),o.size===0&&n(!1)},[o]),m=a.useMemo(()=>({isLoading:t,startLoading:r,stopLoading:i}),[t,r,i]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:m,children:[t&&e.jsxRuntimeExports.jsx(j.Loading,{}),s]})},rt=({children:s})=>{const t=e.useAxios(),n=a.useCallback(()=>{const u=localStorage.getItem("user")??null;return u?JSON.parse(u):null},[]),[o,r]=a.useState(n()),i=a.useCallback(async()=>{let u=null;return await t.get("/user/detail").then(h=>{u=h.data}).catch(()=>{u=null}),localStorage.setItem("user",JSON.stringify(u)),u},[t]),m=a.useCallback(()=>{localStorage.removeItem("user")},[]),c=a.useCallback(async()=>{const u=await i();return u?(r(u),!0):!1},[i]),f=a.useCallback(()=>{m(),r(null)},[m]),p=a.useMemo(()=>({user:o,loginUser:c,logoutUser:f}),[o,c,f]);return a.useEffect(()=>{r(n())},[n]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:p,children:s})},at=()=>{const{confirmTexts:s}=a.useContext(e.LuminusComponentsContext),{onConfirm:t,onCancel:n,text:o,show:r}=je.useConfirm();return e.jsxRuntimeExports.jsx(b,{show:r,size:"sm",centered:!0,onHide:n,children:e.jsxRuntimeExports.jsxs(b.Body,{children:[e.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:e.jsxRuntimeExports.jsx(De.Typography,{variant:"h6",children:o})}),e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:n,children:s.no}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:t,children:s.yes})]})]})})};exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.LoadingProvider=ot;exports.LuminusComponentsProvider=nt;exports.UserProvider=rt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./UserAvatarToggle-BKpAJdnv.cjs"),a=require("react"),je=require("./useConfirm-D1nPczaK.cjs"),De=require("./Typography-tgs5dV12.cjs"),j=require("./DataKey-CD61sktc.cjs"),Fe=require("react-dom");function Ie(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}return t.default=s,Object.freeze(t)}const g=Ie(a),Pe=s=>g.forwardRef((t,n)=>e.jsxRuntimeExports.jsx("div",{...t,ref:n,className:e.classNames(t.className,s)})),Ue={"aria-label":e.PropTypes.string,onClick:e.PropTypes.func,variant:e.PropTypes.oneOf(["white"])},me=g.forwardRef(({className:s,variant:t,"aria-label":n="Close",...o},r)=>e.jsxRuntimeExports.jsx("button",{ref:r,type:"button",className:e.classNames("btn-close",t&&`btn-close-${t}`,s),"aria-label":n,...o}));me.displayName="CloseButton";me.propTypes=Ue;var J;function ge(s){if((!J&&J!==0||s)&&e.canUseDOM){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),J=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return J}function ce(s){s===void 0&&(s=e.ownerDocument());try{var t=s.activeElement;return!t||!t.nodeName?null:t}catch{return s.body}}function We(s=document){const t=s.defaultView;return Math.abs(t.innerWidth-s.documentElement.clientWidth)}const Ee=j.dataAttr("modal-open");class fe{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:o=!1}={}){this.handleContainerOverflow=n,this.isRTL=o,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return We(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},o=this.isRTL?"paddingLeft":"paddingRight",r=this.getElement();t.style={overflow:r.style.overflow,[o]:r.style[o]},t.scrollBarWidth&&(n[o]=`${parseInt(e.style(r,o)||"0",10)+t.scrollBarWidth}px`),r.setAttribute(Ee,""),e.style(r,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(Ee),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const He=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function _e(s,t){if(s==null)return{};var n={},o=Object.keys(s),r,i;for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&(n[r]=s[r]);return n}let ue;function $e(s){return ue||(ue=new fe({ownerDocument:s==null?void 0:s.document})),ue}function qe(s){const t=e.useWindow(),n=s||$e(t),o=a.useRef({dialog:null,backdrop:null});return Object.assign(o.current,{add:()=>n.add(o.current),remove:()=>n.remove(o.current),isTopModal:()=>n.isTopModal(o.current),setDialogRef:a.useCallback(r=>{o.current.dialog=r},[]),setBackdropRef:a.useCallback(r=>{o.current.backdrop=r},[])})}const Re=a.forwardRef((s,t)=>{let{show:n=!1,role:o="dialog",className:r,style:i,children:m,backdrop:c=!0,keyboard:f=!0,onBackdropClick:p,onEscapeKeyDown:u,transition:h,runTransition:v,backdropTransition:w,runBackdropTransition:Q,autoFocus:W=!0,enforceFocus:Z=!0,restoreFocus:N=!0,restoreFocusOptions:ee,renderDialog:H,renderBackdrop:te=d=>e.jsxRuntimeExports.jsx("div",Object.assign({},d)),manager:se,container:ne,onShow:_,onHide:A=()=>{},onExit:oe,onExited:D,onExiting:$,onEnter:q,onEntering:K,onEntered:z}=s,re=_e(s,He);const R=e.useWindow(),M=e.useWaitForDOMRef(ne),x=qe(se),ae=e.useMounted(),V=j.usePrevious(n),[y,k]=a.useState(!n),E=a.useRef(null);a.useImperativeHandle(t,()=>x,[x]),e.canUseDOM&&!V&&n&&(E.current=ce(R==null?void 0:R.document)),n&&y&&k(!1);const C=e.useEventCallback(()=>{if(x.add(),T.current=e.listen(document,"keydown",le),I.current=e.listen(document,"focus",()=>setTimeout(ie),!0),_&&_(),W){var d,Y;const U=ce((d=(Y=x.dialog)==null?void 0:Y.ownerDocument)!=null?d:R==null?void 0:R.document);x.dialog&&U&&!e.contains(x.dialog,U)&&(E.current=U,x.dialog.focus())}}),F=e.useEventCallback(()=>{if(x.remove(),T.current==null||T.current(),I.current==null||I.current(),N){var d;(d=E.current)==null||d.focus==null||d.focus(ee),E.current=null}});a.useEffect(()=>{!n||!M||C()},[n,M,C]),a.useEffect(()=>{y&&F()},[y,F]),e.useWillUnmount(()=>{F()});const ie=e.useEventCallback(()=>{if(!Z||!ae()||!x.isTopModal())return;const d=ce(R==null?void 0:R.document);x.dialog&&d&&!e.contains(x.dialog,d)&&x.dialog.focus()}),G=e.useEventCallback(d=>{d.target===d.currentTarget&&(p==null||p(d),c===!0&&A())}),le=e.useEventCallback(d=>{f&&e.isEscKey(d)&&x.isTopModal()&&(u==null||u(d),d.defaultPrevented||A())}),I=a.useRef(),T=a.useRef(),X=(...d)=>{k(!0),D==null||D(...d)};if(!M)return null;const S=Object.assign({role:o,ref:x.setDialogRef,"aria-modal":o==="dialog"?!0:void 0},re,{style:i,className:r,tabIndex:-1});let P=H?H(S):e.jsxRuntimeExports.jsx("div",Object.assign({},S,{children:g.cloneElement(m,{role:"document"})}));P=e.renderTransition(h,v,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:oe,onExiting:$,onExited:X,onEnter:q,onEntering:K,onEntered:z,children:P});let O=null;return c&&(O=te({ref:x.setBackdropRef,onClick:G}),O=e.renderTransition(w,Q,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:O})),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Fe.createPortal(e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[O,P]}),M)})});Re.displayName="Modal";const Ke=Object.assign(Re,{Manager:fe});function ze(s,t){s.classList?s.classList.add(t):e.hasClass(s,t)||(typeof s.className=="string"?s.className=s.className+" "+t:s.setAttribute("class",(s.className&&s.className.baseVal||"")+" "+t))}function ve(s,t){return s.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Ve(s,t){s.classList?s.classList.remove(t):typeof s.className=="string"?s.className=ve(s.className,t):s.setAttribute("class",ve(s.className&&s.className.baseVal||"",t))}const B={FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"};class Ge extends fe{adjustAndStore(t,n,o){const r=n.style[t];n.dataset[t]=r,e.style(n,{[t]:`${parseFloat(e.style(n,t))+o}px`})}restore(t,n){const o=n.dataset[t];o!==void 0&&(delete n.dataset[t],e.style(n,{[t]:o}))}setContainerStyle(t){super.setContainerStyle(t);const n=this.getElement();if(ze(n,"modal-open"),!t.scrollBarWidth)return;const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";j.qsa(n,B.FIXED_CONTENT).forEach(i=>this.adjustAndStore(o,i,t.scrollBarWidth)),j.qsa(n,B.STICKY_CONTENT).forEach(i=>this.adjustAndStore(r,i,-t.scrollBarWidth)),j.qsa(n,B.NAVBAR_TOGGLER).forEach(i=>this.adjustAndStore(r,i,t.scrollBarWidth))}removeContainerStyle(t){super.removeContainerStyle(t);const n=this.getElement();Ve(n,"modal-open");const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";j.qsa(n,B.FIXED_CONTENT).forEach(i=>this.restore(o,i)),j.qsa(n,B.STICKY_CONTENT).forEach(i=>this.restore(r,i)),j.qsa(n,B.NAVBAR_TOGGLER).forEach(i=>this.restore(r,i))}}let de;function Xe(s){return de||(de=new Ge(s)),de}const Ce=g.forwardRef(({className:s,bsPrefix:t,as:n="div",...o},r)=>(t=e.useBootstrapPrefix(t,"modal-body"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));Ce.displayName="ModalBody";const ye=g.createContext({onHide(){}}),pe=g.forwardRef(({bsPrefix:s,className:t,contentClassName:n,centered:o,size:r,fullscreen:i,children:m,scrollable:c,...f},p)=>{s=e.useBootstrapPrefix(s,"modal");const u=`${s}-dialog`,h=typeof i=="string"?`${s}-fullscreen-${i}`:`${s}-fullscreen`;return e.jsxRuntimeExports.jsx("div",{...f,ref:p,className:e.classNames(u,t,r&&`${s}-${r}`,o&&`${u}-centered`,c&&`${u}-scrollable`,i&&h),children:e.jsxRuntimeExports.jsx("div",{className:e.classNames(`${s}-content`,n),children:m})})});pe.displayName="ModalDialog";const be=g.forwardRef(({className:s,bsPrefix:t,as:n="div",...o},r)=>(t=e.useBootstrapPrefix(t,"modal-footer"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));be.displayName="ModalFooter";const Ye=g.forwardRef(({closeLabel:s="Close",closeVariant:t,closeButton:n=!1,onHide:o,children:r,...i},m)=>{const c=a.useContext(ye),f=e.useEventCallback(()=>{c==null||c.onHide(),o==null||o()});return e.jsxRuntimeExports.jsxs("div",{ref:m,...i,children:[r,n&&e.jsxRuntimeExports.jsx(me,{"aria-label":s,variant:t,onClick:f})]})}),we=g.forwardRef(({bsPrefix:s,className:t,closeLabel:n="Close",closeButton:o=!1,...r},i)=>(s=e.useBootstrapPrefix(s,"modal-header"),e.jsxRuntimeExports.jsx(Ye,{ref:i,...r,className:e.classNames(t,s),closeLabel:n,closeButton:o})));we.displayName="ModalHeader";const Je=Pe("h4"),Ne=g.forwardRef(({className:s,bsPrefix:t,as:n=Je,...o},r)=>(t=e.useBootstrapPrefix(t,"modal-title"),e.jsxRuntimeExports.jsx(n,{ref:r,className:e.classNames(s,t),...o})));Ne.displayName="ModalTitle";function Qe(s){return e.jsxRuntimeExports.jsx(e.Fade,{...s,timeout:null})}function Ze(s){return e.jsxRuntimeExports.jsx(e.Fade,{...s,timeout:null})}const Me=g.forwardRef(({bsPrefix:s,className:t,style:n,dialogClassName:o,contentClassName:r,children:i,dialogAs:m=pe,"data-bs-theme":c,"aria-labelledby":f,"aria-describedby":p,"aria-label":u,show:h=!1,animation:v=!0,backdrop:w=!0,keyboard:Q=!0,onEscapeKeyDown:W,onShow:Z,onHide:N,container:ee,autoFocus:H=!0,enforceFocus:te=!0,restoreFocus:se=!0,restoreFocusOptions:ne,onEntered:_,onExit:A,onExiting:oe,onEnter:D,onEntering:$,onExited:q,backdropClassName:K,manager:z,...re},R)=>{const[M,x]=a.useState({}),[ae,V]=a.useState(!1),y=a.useRef(!1),k=a.useRef(!1),E=a.useRef(null),[C,F]=e.useCallbackRef(),ie=e.useMergedRefs(R,F),G=e.useEventCallback(N),le=e.useIsRTL();s=e.useBootstrapPrefix(s,"modal");const I=a.useMemo(()=>({onHide:G}),[G]);function T(){return z||Xe({isRTL:le})}function X(l){if(!e.canUseDOM)return;const L=T().getScrollbarWidth()>0,he=l.scrollHeight>e.ownerDocument(l).documentElement.clientHeight;x({paddingRight:L&&!he?ge():void 0,paddingLeft:!L&&he?ge():void 0})}const S=e.useEventCallback(()=>{C&&X(C.dialog)});e.useWillUnmount(()=>{e.removeEventListener(window,"resize",S),E.current==null||E.current()});const P=()=>{y.current=!0},O=l=>{y.current&&C&&l.target===C.dialog&&(k.current=!0),y.current=!1},d=()=>{V(!0),E.current=e.transitionEnd(C.dialog,()=>{V(!1)})},Y=l=>{l.target===l.currentTarget&&d()},U=l=>{if(w==="static"){Y(l);return}if(k.current||l.target!==l.currentTarget){k.current=!1;return}N==null||N()},ke=l=>{Q?W==null||W(l):(l.preventDefault(),w==="static"&&d())},Te=(l,L)=>{l&&X(l),D==null||D(l,L)},Se=l=>{E.current==null||E.current(),A==null||A(l)},Oe=(l,L)=>{$==null||$(l,L),e.addEventListener(window,"resize",S)},Le=l=>{l&&(l.style.display=""),q==null||q(l),e.removeEventListener(window,"resize",S)},Be=a.useCallback(l=>e.jsxRuntimeExports.jsx("div",{...l,className:e.classNames(`${s}-backdrop`,K,!v&&"show")}),[v,K,s]),xe={...n,...M};xe.display="block";const Ae=l=>e.jsxRuntimeExports.jsx("div",{role:"dialog",...l,style:xe,className:e.classNames(t,s,ae&&`${s}-static`,!v&&"show"),onClick:w?U:void 0,onMouseUp:O,"data-bs-theme":c,"aria-label":u,"aria-labelledby":f,"aria-describedby":p,children:e.jsxRuntimeExports.jsx(m,{...re,onMouseDown:P,className:o,contentClassName:r,children:i})});return e.jsxRuntimeExports.jsx(ye.Provider,{value:I,children:e.jsxRuntimeExports.jsx(Ke,{show:h,ref:ie,backdrop:w,container:ee,keyboard:!0,autoFocus:H,enforceFocus:te,restoreFocus:se,restoreFocusOptions:ne,onEscapeKeyDown:ke,onShow:Z,onHide:N,onEnter:Te,onEntering:Oe,onEntered:_,onExit:Se,onExiting:oe,onExited:Le,manager:T(),transition:v?Qe:void 0,backdropTransition:v?Ze:void 0,renderBackdrop:Be,renderDialog:Ae})})});Me.displayName="Modal";const b=Object.assign(Me,{Body:Ce,Header:we,Title:Ne,Footer:be,Dialog:pe,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),et=()=>{const{confirmTexts:s}=a.useContext(e.LuminusComponentsContext),{isShown:t,text:n,onFinish:o}=je.usePrompt(),{options:r}=a.useContext(e.PromptContext),[i,m]=a.useState(r.defaultValue??""),c=a.useCallback(()=>{o(null)},[o]),f=a.useCallback(()=>{o(i)},[o,i]);a.useEffect(()=>{t===!0&&m(r.defaultValue??"")},[t,r.defaultValue]);const p=a.useMemo(()=>({value:i,onChange:u=>m(u.currentTarget.value),className:"w-100",autoFocus:!0,tabIndex:0}),[i]);return e.jsxRuntimeExports.jsxs(b,{show:t,size:"sm",centered:!0,onHide:c,children:[e.jsxRuntimeExports.jsx(b.Header,{children:e.jsxRuntimeExports.jsx(b.Title,{children:n})}),e.jsxRuntimeExports.jsxs(b.Body,{children:[r.input==="textarea"?e.jsxRuntimeExports.jsx("textarea",{...p,rows:5}):void 0,r.input==="input"?e.jsxRuntimeExports.jsx("input",{...p,type:r.type}):void 0]}),e.jsxRuntimeExports.jsxs(b.Footer,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:c,children:s.cancel}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:f,disabled:r.required&&!i,children:s.confirm})]})]})},tt=({children:s})=>{const[t,n]=a.useState(!1),[o,r]=a.useState(""),[i,m]=a.useState({input:"textarea",type:"text"}),c=a.useRef(()=>{}),f=a.useCallback(h=>{r(h),n(!0)},[]),p=a.useCallback(()=>{n(!1)},[]),u=a.useMemo(()=>({isShown:t,text:o,showPrompt:f,hidePrompt:p,resolveRef:c,options:i,setOptions:m}),[t,o,f,p,i]);return e.jsxRuntimeExports.jsxs(e.PromptContext.Provider,{value:u,children:[s,e.jsxRuntimeExports.jsx(et,{})]})},st=({children:s})=>{const[t,n]=a.useState(!1),[o,r]=a.useState(""),i=a.useCallback(f=>{n(!0),r(f)},[]),m=a.useCallback(()=>{n(!1)},[]),c=a.useMemo(()=>({show:t,text:o,showConfirm:i,hideConfirm:m}),[t,o,i,m]);return e.jsxRuntimeExports.jsxs(e.ConfirmContext.Provider,{value:c,children:[e.jsxRuntimeExports.jsx(at,{}),s]})},nt=({cookieDomain:s,axiosInstance:t,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:m,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p,customSelectTexts:u,children:h})=>{const v=a.useMemo(()=>({axiosInstance:t,cookieDomain:s,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:m,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p,customSelectTexts:u}),[t,s,n,o,r,i,m,c,f,p,u]);return e.jsxRuntimeExports.jsx(e.LuminusComponentsContext.Provider,{value:v,children:e.jsxRuntimeExports.jsx(st,{children:e.jsxRuntimeExports.jsxs(tt,{children:[e.jsxRuntimeExports.jsx(e.Ie,{}),h]})})})},ot=({children:s})=>{const[t,n]=a.useState(!1),[o]=a.useState(new Set),r=a.useCallback(c=>{o.add(c),n(!0)},[o]),i=a.useCallback(c=>{o.delete(c),o.size===0&&n(!1)},[o]),m=a.useMemo(()=>({isLoading:t,startLoading:r,stopLoading:i}),[t,r,i]);return e.jsxRuntimeExports.jsxs(e.LoadingContext.Provider,{value:m,children:[t&&e.jsxRuntimeExports.jsx(j.Loading,{}),s]})},rt=({children:s})=>{const t=e.useAxios(),n=a.useCallback(()=>{const u=localStorage.getItem("user")??null;return u?JSON.parse(u):null},[]),[o,r]=a.useState(n()),i=a.useCallback(async()=>{let u=null;return await t.get("/user/detail").then(h=>{u=h.data}).catch(()=>{u=null}),localStorage.setItem("user",JSON.stringify(u)),u},[t]),m=a.useCallback(()=>{localStorage.removeItem("user")},[]),c=a.useCallback(async()=>{const u=await i();return u?(r(u),!0):!1},[i]),f=a.useCallback(()=>{m(),r(null)},[m]),p=a.useMemo(()=>({user:o,loginUser:c,logoutUser:f}),[o,c,f]);return a.useEffect(()=>{r(n())},[n]),e.jsxRuntimeExports.jsx(e.UserContext.Provider,{value:p,children:s})},at=()=>{const{confirmTexts:s}=a.useContext(e.LuminusComponentsContext),{onConfirm:t,onCancel:n,text:o,show:r}=je.useConfirm();return e.jsxRuntimeExports.jsx(b,{show:r,size:"sm",centered:!0,onHide:n,children:e.jsxRuntimeExports.jsxs(b.Body,{children:[e.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:e.jsxRuntimeExports.jsx(De.Typography,{variant:"h6",children:o})}),e.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:n,children:s.no}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:t,children:s.yes})]})]})})};exports.LoadingContext=e.LoadingContext;exports.LuminusComponentsContext=e.LuminusComponentsContext;exports.UserContext=e.UserContext;exports.LoadingProvider=ot;exports.LuminusComponentsProvider=nt;exports.UserProvider=rt;
|
package/dist/contexts.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as r, c as w, e as ye, f as Ee, o as Fe, s as
|
|
1
|
+
import { j as r, c as w, e as ye, f as Ee, o as Fe, s as V, g as De, h as tt, i as nt, k as j, l as ke, m as Oe, n as We, p as ot, r as Se, q as st, t as U, v as rt, w as at, x as it, y as Be, F as Ue, z as lt, A as dt, L as be, P as He, C as ct, I as ut, B as ft, b as ht, U as mt } from "./UserAvatarToggle-C3Sj7vJ2.js";
|
|
2
2
|
import * as y from "react";
|
|
3
3
|
import { forwardRef as gt, useState as p, useRef as N, useImperativeHandle as pt, useEffect as re, useCallback as g, useContext as ae, useMemo as R } from "react";
|
|
4
4
|
import { a as vt, u as yt } from "./useConfirm-BSs-RcsS.js";
|
|
@@ -81,7 +81,7 @@ class Ne {
|
|
|
81
81
|
e.style = {
|
|
82
82
|
overflow: s.style.overflow,
|
|
83
83
|
[o]: s.style[o]
|
|
84
|
-
}, e.scrollBarWidth && (n[o] = `${parseInt(
|
|
84
|
+
}, e.scrollBarWidth && (n[o] = `${parseInt(V(s, o) || "0", 10) + e.scrollBarWidth}px`), s.setAttribute(Le, ""), V(s, n);
|
|
85
85
|
}
|
|
86
86
|
reset() {
|
|
87
87
|
[...this.modals].forEach((e) => this.remove(e));
|
|
@@ -152,7 +152,7 @@ const $e = /* @__PURE__ */ gt((t, e) => {
|
|
|
152
152
|
runTransition: C,
|
|
153
153
|
backdropTransition: k,
|
|
154
154
|
runBackdropTransition: ie,
|
|
155
|
-
autoFocus:
|
|
155
|
+
autoFocus: G = !0,
|
|
156
156
|
enforceFocus: le = !0,
|
|
157
157
|
restoreFocus: O = !0,
|
|
158
158
|
restoreFocusOptions: de,
|
|
@@ -180,7 +180,7 @@ const $e = /* @__PURE__ */ gt((t, e) => {
|
|
|
180
180
|
// and so steals focus from it
|
|
181
181
|
() => setTimeout(pe),
|
|
182
182
|
!0
|
|
183
|
-
), X && X(),
|
|
183
|
+
), X && X(), G) {
|
|
184
184
|
var c, oe;
|
|
185
185
|
const z = xe((c = (oe = m.dialog) == null ? void 0 : oe.ownerDocument) != null ? c : E == null ? void 0 : E.document);
|
|
186
186
|
m.dialog && z && !Oe(m.dialog, z) && (x.current = z, m.dialog.focus());
|
|
@@ -282,13 +282,13 @@ const W = {
|
|
|
282
282
|
class Lt extends Ne {
|
|
283
283
|
adjustAndStore(e, n, o) {
|
|
284
284
|
const s = n.style[e];
|
|
285
|
-
n.dataset[e] = s,
|
|
286
|
-
[e]: `${parseFloat(
|
|
285
|
+
n.dataset[e] = s, V(n, {
|
|
286
|
+
[e]: `${parseFloat(V(n, e)) + o}px`
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
restore(e, n) {
|
|
290
290
|
const o = n.dataset[e];
|
|
291
|
-
o !== void 0 && (delete n.dataset[e],
|
|
291
|
+
o !== void 0 && (delete n.dataset[e], V(n, {
|
|
292
292
|
[e]: o
|
|
293
293
|
}));
|
|
294
294
|
}
|
|
@@ -396,7 +396,7 @@ const Ft = /* @__PURE__ */ y.forwardRef(({
|
|
|
396
396
|
closeButton: o
|
|
397
397
|
})));
|
|
398
398
|
ze.displayName = "ModalHeader";
|
|
399
|
-
const Dt = jt("h4"),
|
|
399
|
+
const Dt = jt("h4"), Ve = /* @__PURE__ */ y.forwardRef(({
|
|
400
400
|
className: t,
|
|
401
401
|
bsPrefix: e,
|
|
402
402
|
as: n = Dt,
|
|
@@ -406,7 +406,7 @@ const Dt = jt("h4"), Ge = /* @__PURE__ */ y.forwardRef(({
|
|
|
406
406
|
className: w(t, e),
|
|
407
407
|
...o
|
|
408
408
|
})));
|
|
409
|
-
|
|
409
|
+
Ve.displayName = "ModalTitle";
|
|
410
410
|
function Wt(t) {
|
|
411
411
|
return /* @__PURE__ */ r.jsx(Ue, {
|
|
412
412
|
...t,
|
|
@@ -419,7 +419,7 @@ function Ut(t) {
|
|
|
419
419
|
timeout: null
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
const
|
|
422
|
+
const Ge = /* @__PURE__ */ y.forwardRef(({
|
|
423
423
|
bsPrefix: t,
|
|
424
424
|
className: e,
|
|
425
425
|
style: n,
|
|
@@ -436,7 +436,7 @@ const Ve = /* @__PURE__ */ y.forwardRef(({
|
|
|
436
436
|
animation: C = !0,
|
|
437
437
|
backdrop: k = !0,
|
|
438
438
|
keyboard: ie = !0,
|
|
439
|
-
onEscapeKeyDown:
|
|
439
|
+
onEscapeKeyDown: G,
|
|
440
440
|
onShow: le,
|
|
441
441
|
onHide: O,
|
|
442
442
|
container: de,
|
|
@@ -500,7 +500,7 @@ const Ve = /* @__PURE__ */ y.forwardRef(({
|
|
|
500
500
|
}
|
|
501
501
|
O == null || O();
|
|
502
502
|
}, qe = (i) => {
|
|
503
|
-
ie ?
|
|
503
|
+
ie ? G == null || G(i) : (i.preventDefault(), k === "static" && c());
|
|
504
504
|
}, Xe = (i, F) => {
|
|
505
505
|
i && ne(i), $ == null || $(i, F);
|
|
506
506
|
}, Ye = (i) => {
|
|
@@ -565,24 +565,24 @@ const Ve = /* @__PURE__ */ y.forwardRef(({
|
|
|
565
565
|
})
|
|
566
566
|
});
|
|
567
567
|
});
|
|
568
|
-
|
|
569
|
-
const M = Object.assign(
|
|
568
|
+
Ge.displayName = "Modal";
|
|
569
|
+
const M = Object.assign(Ge, {
|
|
570
570
|
Body: Pe,
|
|
571
571
|
Header: ze,
|
|
572
|
-
Title:
|
|
572
|
+
Title: Ve,
|
|
573
573
|
Footer: Ke,
|
|
574
574
|
Dialog: Te,
|
|
575
575
|
TRANSITION_DURATION: 300,
|
|
576
576
|
BACKDROP_TRANSITION_DURATION: 150
|
|
577
577
|
}), Ht = () => {
|
|
578
|
-
const { confirmTexts: t } = ae(be), { isShown: e, text: n, onFinish: o } = vt(), { options: s } = ae(He), [a, u] = p(""), l = g(() => {
|
|
578
|
+
const { confirmTexts: t } = ae(be), { isShown: e, text: n, onFinish: o } = vt(), { options: s } = ae(He), [a, u] = p(s.defaultValue ?? ""), l = g(() => {
|
|
579
579
|
o(null);
|
|
580
580
|
}, [o]), f = g(() => {
|
|
581
581
|
o(a);
|
|
582
582
|
}, [o, a]);
|
|
583
583
|
re(() => {
|
|
584
|
-
e === !0 && u("");
|
|
585
|
-
}, [e]);
|
|
584
|
+
e === !0 && u(s.defaultValue ?? "");
|
|
585
|
+
}, [e, s.defaultValue]);
|
|
586
586
|
const h = R(() => ({
|
|
587
587
|
value: a,
|
|
588
588
|
onChange: (d) => u(d.currentTarget.value),
|
|
@@ -593,13 +593,7 @@ const M = Object.assign(Ve, {
|
|
|
593
593
|
return /* @__PURE__ */ r.jsxs(M, { show: e, size: "sm", centered: !0, onHide: l, children: [
|
|
594
594
|
/* @__PURE__ */ r.jsx(M.Header, { children: /* @__PURE__ */ r.jsx(M.Title, { children: n }) }),
|
|
595
595
|
/* @__PURE__ */ r.jsxs(M.Body, { children: [
|
|
596
|
-
s.input === "textarea" ? /* @__PURE__ */ r.jsx(
|
|
597
|
-
"textarea",
|
|
598
|
-
{
|
|
599
|
-
...h,
|
|
600
|
-
rows: 5
|
|
601
|
-
}
|
|
602
|
-
) : void 0,
|
|
596
|
+
s.input === "textarea" ? /* @__PURE__ */ r.jsx("textarea", { ...h, rows: 5 }) : void 0,
|
|
603
597
|
s.input === "input" ? /* @__PURE__ */ r.jsx("input", { ...h, type: s.type }) : void 0
|
|
604
598
|
] }),
|
|
605
599
|
/* @__PURE__ */ r.jsxs(M.Footer, { children: [
|
|
@@ -610,7 +604,7 @@ const M = Object.assign(Ve, {
|
|
|
610
604
|
}, $t = ({ children: t }) => {
|
|
611
605
|
const [e, n] = p(!1), [o, s] = p(""), [a, u] = p({ input: "textarea", type: "text" }), l = N(() => {
|
|
612
606
|
}), f = g((v) => {
|
|
613
|
-
s(v), n(!0)
|
|
607
|
+
s(v), n(!0);
|
|
614
608
|
}, []), h = g(() => {
|
|
615
609
|
n(!1);
|
|
616
610
|
}, []), d = R(() => ({
|