react-luminus-components 1.1.23 → 1.1.25
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/.vite/manifest.json +55 -57
- package/dist/{DataKey-BWAmmcUw.js → DataKey-BM6Hi4Og.js} +1 -1
- package/dist/DataKey-DN_Gd8yX.cjs +1 -0
- package/dist/SimpleTooltip-Bg8N9Up2.cjs +1 -0
- package/dist/SimpleTooltip-DnZSi_qT.js +5 -0
- package/dist/Typography-C0E6aQv2.cjs +1 -0
- package/dist/Typography-CsdF39gW.js +36 -0
- package/dist/UserAvatarToggle-0_jNWWSB.cjs +250 -0
- package/dist/UserAvatarToggle-xT1i6nSz.js +6444 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -1
- package/dist/components/Tabs/comps/Tab/Tab.d.ts +1 -1
- package/dist/components/common/AppSearch/AppSearch.d.ts +6 -1
- package/dist/components/common/AppSearch/comps/AutocompleteWindow/AutocompleteWindow.d.ts +12 -0
- package/dist/components/common/AppSearch/comps/TypeSelector/TypeSelector.d.ts +9 -0
- package/dist/components/common/AppSearch/comps/index.d.ts +2 -0
- package/dist/components/common/AppSearch/hooks/useSearchItems.d.ts +6 -0
- package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +3 -2
- package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +4 -3
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +103 -101
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +4 -4
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +3 -3
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1229 -1183
- package/dist/models/index.d.ts +5 -0
- package/dist/models/texts/AppSearchTexts.d.ts +5 -0
- package/dist/models/types/SearchResultGroupKeyModel.d.ts +6 -0
- package/dist/models/types/SearchResultGroupModel.d.ts +7 -0
- package/dist/models/types/SearchResultModel.d.ts +8 -0
- package/dist/models/types/SearchType.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/{textUtils-DW4f3rLU.js → textUtils-BLtD0zaS.js} +3 -3
- package/dist/{useConfirm-BK-FMKuK.js → useConfirm-CQp43K_n.js} +1 -1
- package/dist/useConfirm-CdQJyKxQ.cjs +1 -0
- package/dist/utils.es.js +5 -5
- package/package.json +1 -1
- package/dist/DataKey--JBhGjOn.cjs +0 -1
- package/dist/SimpleTooltip-C-IHJfQ5.cjs +0 -1
- package/dist/SimpleTooltip-CfJs3h6Q.js +0 -1622
- package/dist/hasClass-D1jUrHAX.cjs +0 -20
- package/dist/hasClass-Sn_KqIXn.js +0 -1516
- package/dist/useAxios-BZn4k8_S.js +0 -3320
- package/dist/useAxios-QCWXMOfJ.cjs +0 -231
- package/dist/useConfirm-A379uhYQ.cjs +0 -1
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { TabsProps } from 'react-bootstrap';
|
|
3
3
|
type Props = TabsProps & {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
noContent?: boolean;
|
|
6
|
+
forTable?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare const Tabs: ({ children, className, ...props }: Props) => import("react").JSX.Element;
|
|
8
|
+
declare const Tabs: ({ children, className, noContent, forTable, ...props }: Props) => import("react").JSX.Element;
|
|
7
9
|
export default Tabs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TabProps } from 'react-bootstrap';
|
|
3
3
|
type Props = TabProps & {
|
|
4
|
-
children
|
|
4
|
+
children?: React.ReactNode;
|
|
5
5
|
};
|
|
6
6
|
declare const Tab: ({ children, ...props }: Props) => import("react").JSX.Element;
|
|
7
7
|
export default Tab;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import SearchType from '@models/types/SearchType';
|
|
3
|
+
type Props = {
|
|
4
|
+
searchTypes: SearchType[];
|
|
5
|
+
navigateFunction: (url: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const AppSearch: ({ searchTypes, navigateFunction }: Props) => import("react").JSX.Element;
|
|
3
8
|
export default AppSearch;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SearchResultGroupModel, SearchType } from '@models/index';
|
|
3
|
+
type Props = {
|
|
4
|
+
query: string;
|
|
5
|
+
show: boolean;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
groups: SearchResultGroupModel[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
searchTypes: SearchType[];
|
|
10
|
+
};
|
|
11
|
+
declare const AutocompleteWindow: ({ show, query, onCancel, groups, isLoading, searchTypes }: Props) => import("react").JSX.Element;
|
|
12
|
+
export default AutocompleteWindow;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import SearchType from '@models/types/SearchType';
|
|
3
|
+
type Props = {
|
|
4
|
+
searchTypes: SearchType[];
|
|
5
|
+
selectedType: SearchType | null;
|
|
6
|
+
setSelectedType: Dispatch<SetStateAction<SearchType | null>>;
|
|
7
|
+
};
|
|
8
|
+
declare const TypeSelector: ({ searchTypes, selectedType, setSelectedType }: Props) => React.JSX.Element;
|
|
9
|
+
export default TypeSelector;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
|
3
3
|
import { LinkProps } from 'react-router-dom';
|
|
4
|
-
import { AxiosTexts, ConfirmTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
4
|
+
import { AppSearchTexts, AxiosTexts, ConfirmTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
5
5
|
interface ILuminusComponentsContext {
|
|
6
|
-
axiosInstance: AxiosInstance;
|
|
7
6
|
cookieDomain: string;
|
|
7
|
+
axiosInstance: AxiosInstance;
|
|
8
8
|
LinkComponent: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
9
|
language: string;
|
|
10
10
|
axiosTexts: AxiosTexts;
|
|
@@ -12,6 +12,7 @@ interface ILuminusComponentsContext {
|
|
|
12
12
|
formValidationTexts: FormValidationTexts;
|
|
13
13
|
homeDashboardTexts: HomeDashboardTexts;
|
|
14
14
|
formSubmitTexts: FormSubmitTexts;
|
|
15
|
+
appSearchTexts: AppSearchTexts;
|
|
15
16
|
}
|
|
16
17
|
declare const LuminusComponentsContext: import("react").Context<ILuminusComponentsContext>;
|
|
17
18
|
export default LuminusComponentsContext;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LinkProps } from 'react-router-dom';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
|
-
import { AxiosTexts, ConfirmTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
4
|
+
import { AppSearchTexts, AxiosTexts, ConfirmTexts, FormSubmitTexts, FormValidationTexts, HomeDashboardTexts } from '@models/index';
|
|
5
5
|
type Props = {
|
|
6
|
-
axiosInstance: AxiosInstance;
|
|
7
6
|
cookieDomain: string;
|
|
7
|
+
axiosInstance: AxiosInstance;
|
|
8
8
|
LinkComponent: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
9
|
language: string;
|
|
10
10
|
axiosTexts: AxiosTexts;
|
|
@@ -12,7 +12,8 @@ type Props = {
|
|
|
12
12
|
formValidationTexts: FormValidationTexts;
|
|
13
13
|
homeDashboardTexts: HomeDashboardTexts;
|
|
14
14
|
formSubmitTexts: FormSubmitTexts;
|
|
15
|
+
appSearchTexts: AppSearchTexts;
|
|
15
16
|
children: React.ReactNode;
|
|
16
17
|
};
|
|
17
|
-
declare const LuminusComponentsProvider: ({
|
|
18
|
+
declare const LuminusComponentsProvider: ({ cookieDomain, axiosInstance, LinkComponent, language, axiosTexts, confirmTexts, formValidationTexts, homeDashboardTexts, formSubmitTexts, appSearchTexts, children, }: Props) => import("react").JSX.Element;
|
|
18
19
|
export default LuminusComponentsProvider;
|
package/dist/contexts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./useAxios-QCWXMOfJ.cjs"),i=require("react"),Ce=require("./useConfirm-A379uhYQ.cjs"),a=require("./hasClass-D1jUrHAX.cjs"),v=require("./DataKey--JBhGjOn.cjs"),Ie=require("react-dom");function Pe(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const g=Pe(i),We=t=>g.forwardRef((e,s)=>o.jsxRuntimeExports.jsx("div",{...e,ref:s,className:o.classNames(e.className,t)})),Ue={"aria-label":a.PropTypes.string,onClick:a.PropTypes.func,variant:a.PropTypes.oneOf(["white"])},fe=g.forwardRef(({className:t,variant:e,"aria-label":s="Close",...n},r)=>o.jsxRuntimeExports.jsx("button",{ref:r,type:"button",className:o.classNames("btn-close",e&&`btn-close-${e}`,t),"aria-label":s,...n}));fe.displayName="CloseButton";fe.propTypes=Ue;const $e=fe;var Q;function ge(t){if((!Q&&Q!==0||t)&&a.canUseDOM){var e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),Q=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return Q}function ue(t){t===void 0&&(t=a.ownerDocument());try{var e=t.activeElement;return!e||!e.nodeName?null:e}catch{return t.body}}function He(t=document){const e=t.defaultView;return Math.abs(e.innerWidth-t.documentElement.clientWidth)}const Ee=v.dataAttr("modal-open");class _e{constructor({ownerDocument:e,handleContainerOverflow:s=!0,isRTL:n=!1}={}){this.handleContainerOverflow=s,this.isRTL=n,this.modals=[],this.ownerDocument=e}getScrollbarWidth(){return He(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(e){}removeModalAttributes(e){}setContainerStyle(e){const s={overflow:"hidden"},n=this.isRTL?"paddingLeft":"paddingRight",r=this.getElement();e.style={overflow:r.style.overflow,[n]:r.style[n]},e.scrollBarWidth&&(s[n]=`${parseInt(a.style(r,n)||"0",10)+e.scrollBarWidth}px`),r.setAttribute(Ee,""),a.style(r,s)}reset(){[...this.modals].forEach(e=>this.remove(e))}removeContainerStyle(e){const s=this.getElement();s.removeAttribute(Ee),Object.assign(s.style,e.style)}add(e){let s=this.modals.indexOf(e);return s!==-1||(s=this.modals.length,this.modals.push(e),this.setModalAttributes(e),s!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),s}remove(e){const s=this.modals.indexOf(e);s!==-1&&(this.modals.splice(s,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(e))}isTopModal(e){return!!this.modals.length&&this.modals[this.modals.length-1]===e}}const xe=_e,qe=["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 Ke(t,e){if(t==null)return{};var s={},n=Object.keys(t),r,l;for(l=0;l<n.length;l++)r=n[l],!(e.indexOf(r)>=0)&&(s[r]=t[r]);return s}let de;function ze(t){return de||(de=new xe({ownerDocument:t==null?void 0:t.document})),de}function Ge(t){const e=a.useWindow(),s=t||ze(e),n=i.useRef({dialog:null,backdrop:null});return Object.assign(n.current,{add:()=>s.add(n.current),remove:()=>s.remove(n.current),isTopModal:()=>s.isTopModal(n.current),setDialogRef:i.useCallback(r=>{n.current.dialog=r},[]),setBackdropRef:i.useCallback(r=>{n.current.backdrop=r},[])})}const Re=i.forwardRef((t,e)=>{let{show:s=!1,role:n="dialog",className:r,style:l,children:d,backdrop:u=!0,keyboard:x=!0,onBackdropClick:h,onEscapeKeyDown:f,transition:j,runTransition:y,backdropTransition:M,runBackdropTransition:Z,autoFocus:$=!0,enforceFocus:ee=!0,restoreFocus:N=!0,restoreFocusOptions:te,renderDialog:H,renderBackdrop:se=m=>o.jsxRuntimeExports.jsx("div",Object.assign({},m)),manager:ne,container:oe,onShow:_,onHide:D=()=>{},onExit:re,onExited:F,onExiting:q,onEnter:K,onEntering:z,onEntered:G}=t,ae=Ke(t,qe);const C=a.useWindow(),T=a.useWaitForDOMRef(oe),p=Ge(ne),ie=a.useMounted(),V=v.usePrevious(s),[b,k]=i.useState(!s),E=i.useRef(null);i.useImperativeHandle(e,()=>p,[p]),a.canUseDOM&&!V&&s&&(E.current=ue(C==null?void 0:C.document)),s&&b&&k(!1);const R=a.useEventCallback(()=>{if(p.add(),S.current=a.listen(document,"keydown",ce),P.current=a.listen(document,"focus",()=>setTimeout(le),!0),_&&_(),$){var m,J;const U=ue((m=(J=p.dialog)==null?void 0:J.ownerDocument)!=null?m:C==null?void 0:C.document);p.dialog&&U&&!a.contains(p.dialog,U)&&(E.current=U,p.dialog.focus())}}),I=a.useEventCallback(()=>{if(p.remove(),S.current==null||S.current(),P.current==null||P.current(),N){var m;(m=E.current)==null||m.focus==null||m.focus(te),E.current=null}});i.useEffect(()=>{!s||!T||R()},[s,T,R]),i.useEffect(()=>{b&&I()},[b,I]),a.useWillUnmount(()=>{I()});const le=a.useEventCallback(()=>{if(!ee||!ie()||!p.isTopModal())return;const m=ue(C==null?void 0:C.document);p.dialog&&m&&!a.contains(p.dialog,m)&&p.dialog.focus()}),X=a.useEventCallback(m=>{m.target===m.currentTarget&&(h==null||h(m),u===!0&&D())}),ce=a.useEventCallback(m=>{x&&a.isEscKey(m)&&p.isTopModal()&&(f==null||f(m),m.defaultPrevented||D())}),P=i.useRef(),S=i.useRef(),Y=(...m)=>{k(!0),F==null||F(...m)};if(!T)return null;const O=Object.assign({role:n,ref:p.setDialogRef,"aria-modal":n==="dialog"?!0:void 0},ae,{style:l,className:r,tabIndex:-1});let W=H?H(O):o.jsxRuntimeExports.jsx("div",Object.assign({},O,{children:g.cloneElement(d,{role:"document"})}));W=a.renderTransition(j,y,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!s,onExit:re,onExiting:q,onExited:Y,onEnter:K,onEntering:z,onEntered:G,children:W});let B=null;return u&&(B=se({ref:p.setBackdropRef,onClick:X}),B=a.renderTransition(M,Z,{in:!!s,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:B})),o.jsxRuntimeExports.jsx(o.jsxRuntimeExports.Fragment,{children:Ie.createPortal(o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[B,W]}),T)})});Re.displayName="Modal";const Ve=Object.assign(Re,{Manager:xe});function Xe(t,e){t.classList?t.classList.add(e):a.hasClass(t,e)||(typeof t.className=="string"?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))}function ve(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Ye(t,e){t.classList?t.classList.remove(e):typeof t.className=="string"?t.className=ve(t.className,e):t.setAttribute("class",ve(t.className&&t.className.baseVal||"",e))}const A={FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"};class Je extends xe{adjustAndStore(e,s,n){const r=s.style[e];s.dataset[e]=r,a.style(s,{[e]:`${parseFloat(a.style(s,e))+n}px`})}restore(e,s){const n=s.dataset[e];n!==void 0&&(delete s.dataset[e],a.style(s,{[e]:n}))}setContainerStyle(e){super.setContainerStyle(e);const s=this.getElement();if(Xe(s,"modal-open"),!e.scrollBarWidth)return;const n=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";v.qsa(s,A.FIXED_CONTENT).forEach(l=>this.adjustAndStore(n,l,e.scrollBarWidth)),v.qsa(s,A.STICKY_CONTENT).forEach(l=>this.adjustAndStore(r,l,-e.scrollBarWidth)),v.qsa(s,A.NAVBAR_TOGGLER).forEach(l=>this.adjustAndStore(r,l,e.scrollBarWidth))}removeContainerStyle(e){super.removeContainerStyle(e);const s=this.getElement();Ye(s,"modal-open");const n=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";v.qsa(s,A.FIXED_CONTENT).forEach(l=>this.restore(n,l)),v.qsa(s,A.STICKY_CONTENT).forEach(l=>this.restore(r,l)),v.qsa(s,A.NAVBAR_TOGGLER).forEach(l=>this.restore(r,l))}}let me;function Qe(t){return me||(me=new Je(t)),me}const je=g.forwardRef(({className:t,bsPrefix:e,as:s="div",...n},r)=>(e=a.useBootstrapPrefix(e,"modal-body"),o.jsxRuntimeExports.jsx(s,{ref:r,className:o.classNames(t,e),...n})));je.displayName="ModalBody";const Ze=je,et=g.createContext({onHide(){}}),ye=et,be=g.forwardRef(({bsPrefix:t,className:e,contentClassName:s,centered:n,size:r,fullscreen:l,children:d,scrollable:u,...x},h)=>{t=a.useBootstrapPrefix(t,"modal");const f=`${t}-dialog`,j=typeof l=="string"?`${t}-fullscreen-${l}`:`${t}-fullscreen`;return o.jsxRuntimeExports.jsx("div",{...x,ref:h,className:o.classNames(f,e,r&&`${t}-${r}`,n&&`${f}-centered`,u&&`${f}-scrollable`,l&&j),children:o.jsxRuntimeExports.jsx("div",{className:o.classNames(`${t}-content`,s),children:d})})});be.displayName="ModalDialog";const we=be,Me=g.forwardRef(({className:t,bsPrefix:e,as:s="div",...n},r)=>(e=a.useBootstrapPrefix(e,"modal-footer"),o.jsxRuntimeExports.jsx(s,{ref:r,className:o.classNames(t,e),...n})));Me.displayName="ModalFooter";const tt=Me,st=g.forwardRef(({closeLabel:t="Close",closeVariant:e,closeButton:s=!1,onHide:n,children:r,...l},d)=>{const u=i.useContext(ye),x=a.useEventCallback(()=>{u==null||u.onHide(),n==null||n()});return o.jsxRuntimeExports.jsxs("div",{ref:d,...l,children:[r,s&&o.jsxRuntimeExports.jsx($e,{"aria-label":t,variant:e,onClick:x})]})}),nt=st,Ne=g.forwardRef(({bsPrefix:t,className:e,closeLabel:s="Close",closeButton:n=!1,...r},l)=>(t=a.useBootstrapPrefix(t,"modal-header"),o.jsxRuntimeExports.jsx(nt,{ref:l,...r,className:o.classNames(e,t),closeLabel:s,closeButton:n})));Ne.displayName="ModalHeader";const ot=Ne,rt=We("h4"),Te=g.forwardRef(({className:t,bsPrefix:e,as:s=rt,...n},r)=>(e=a.useBootstrapPrefix(e,"modal-title"),o.jsxRuntimeExports.jsx(s,{ref:r,className:o.classNames(t,e),...n})));Te.displayName="ModalTitle";const at=Te;function it(t){return o.jsxRuntimeExports.jsx(a.Fade,{...t,timeout:null})}function lt(t){return o.jsxRuntimeExports.jsx(a.Fade,{...t,timeout:null})}const ke=g.forwardRef(({bsPrefix:t,className:e,style:s,dialogClassName:n,contentClassName:r,children:l,dialogAs:d=we,"data-bs-theme":u,"aria-labelledby":x,"aria-describedby":h,"aria-label":f,show:j=!1,animation:y=!0,backdrop:M=!0,keyboard:Z=!0,onEscapeKeyDown:$,onShow:ee,onHide:N,container:te,autoFocus:H=!0,enforceFocus:se=!0,restoreFocus:ne=!0,restoreFocusOptions:oe,onEntered:_,onExit:D,onExiting:re,onEnter:F,onEntering:q,onExited:K,backdropClassName:z,manager:G,...ae},C)=>{const[T,p]=i.useState({}),[ie,V]=i.useState(!1),b=i.useRef(!1),k=i.useRef(!1),E=i.useRef(null),[R,I]=a.useCallbackRef(),le=a.useMergedRefs(C,I),X=a.useEventCallback(N),ce=a.useIsRTL();t=a.useBootstrapPrefix(t,"modal");const P=i.useMemo(()=>({onHide:X}),[X]);function S(){return G||Qe({isRTL:ce})}function Y(c){if(!a.canUseDOM)return;const L=S().getScrollbarWidth()>0,he=c.scrollHeight>a.ownerDocument(c).documentElement.clientHeight;p({paddingRight:L&&!he?ge():void 0,paddingLeft:!L&&he?ge():void 0})}const O=a.useEventCallback(()=>{R&&Y(R.dialog)});a.useWillUnmount(()=>{a.removeEventListener(window,"resize",O),E.current==null||E.current()});const W=()=>{b.current=!0},B=c=>{b.current&&R&&c.target===R.dialog&&(k.current=!0),b.current=!1},m=()=>{V(!0),E.current=a.transitionEnd(R.dialog,()=>{V(!1)})},J=c=>{c.target===c.currentTarget&&m()},U=c=>{if(M==="static"){J(c);return}if(k.current||c.target!==c.currentTarget){k.current=!1;return}N==null||N()},Se=c=>{Z?$==null||$(c):(c.preventDefault(),M==="static"&&m())},Oe=(c,L)=>{c&&Y(c),F==null||F(c,L)},Be=c=>{E.current==null||E.current(),D==null||D(c)},Le=(c,L)=>{q==null||q(c,L),a.addEventListener(window,"resize",O)},Ae=c=>{c&&(c.style.display=""),K==null||K(c),a.removeEventListener(window,"resize",O)},De=i.useCallback(c=>o.jsxRuntimeExports.jsx("div",{...c,className:o.classNames(`${t}-backdrop`,z,!y&&"show")}),[y,z,t]),pe={...s,...T};pe.display="block";const Fe=c=>o.jsxRuntimeExports.jsx("div",{role:"dialog",...c,style:pe,className:o.classNames(e,t,ie&&`${t}-static`,!y&&"show"),onClick:M?U:void 0,onMouseUp:B,"data-bs-theme":u,"aria-label":f,"aria-labelledby":x,"aria-describedby":h,children:o.jsxRuntimeExports.jsx(d,{...ae,onMouseDown:W,className:n,contentClassName:r,children:l})});return o.jsxRuntimeExports.jsx(ye.Provider,{value:P,children:o.jsxRuntimeExports.jsx(Ve,{show:j,ref:le,backdrop:M,container:te,keyboard:!0,autoFocus:H,enforceFocus:se,restoreFocus:ne,restoreFocusOptions:oe,onEscapeKeyDown:Se,onShow:ee,onHide:N,onEnter:Oe,onEntering:Le,onEntered:_,onExit:Be,onExiting:re,onExited:Ae,manager:S(),transition:y?it:void 0,backdropTransition:y?lt:void 0,renderBackdrop:De,renderDialog:Fe})})});ke.displayName="Modal";const w=Object.assign(ke,{Body:Ze,Header:ot,Title:at,Footer:tt,Dialog:we,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),ct=()=>{const{confirmTexts:t}=i.useContext(o.LuminusComponentsContext),{isShown:e,text:s,onFinish:n}=Ce.usePrompt(),[r,l]=i.useState(""),d=i.useCallback(()=>{n(null)},[n]),u=i.useCallback(()=>{n(r)},[n,r]);return i.useEffect(()=>{e===!0&&l("")},[e]),o.jsxRuntimeExports.jsxs(w,{show:e,size:"sm",centered:!0,onHide:d,children:[o.jsxRuntimeExports.jsx(w.Header,{children:o.jsxRuntimeExports.jsx(w.Title,{children:s})}),o.jsxRuntimeExports.jsx(w.Body,{children:o.jsxRuntimeExports.jsx("textarea",{autoFocus:!0,tabIndex:0,value:r,onChange:x=>l(x.currentTarget.value),className:"w-100",rows:5})}),o.jsxRuntimeExports.jsxs(w.Footer,{children:[o.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:d,children:t.cancel}),o.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:u,children:t.confirm})]})]})},ut=({children:t})=>{const[e,s]=i.useState(!1),[n,r]=i.useState(""),l=i.useRef(()=>{}),d=i.useCallback(h=>{r(h),s(!0),console.log("showprompt")},[]),u=i.useCallback(()=>{s(!1)},[]),x=i.useMemo(()=>({isShown:e,text:n,showPrompt:d,hidePrompt:u,resolveRef:l}),[u,e,d,n,l]);return o.jsxRuntimeExports.jsxs(o.PromptContext.Provider,{value:x,children:[t,o.jsxRuntimeExports.jsx(ct,{})]})},dt=({children:t})=>{const[e,s]=i.useState(!1),[n,r]=i.useState(""),l=i.useCallback(x=>{s(!0),r(x)},[]),d=i.useCallback(()=>{s(!1)},[]),u=i.useMemo(()=>({show:e,text:n,showConfirm:l,hideConfirm:d}),[e,n,l,d]);return o.jsxRuntimeExports.jsxs(o.ConfirmContext.Provider,{value:u,children:[o.jsxRuntimeExports.jsx(pt,{}),t]})},mt=({axiosInstance:t,cookieDomain:e,LinkComponent:s,language:n,axiosTexts:r,confirmTexts:l,formValidationTexts:d,homeDashboardTexts:u,formSubmitTexts:x,children:h})=>{const f=i.useMemo(()=>({axiosInstance:t,cookieDomain:e,LinkComponent:s,language:n,axiosTexts:r,confirmTexts:l,formValidationTexts:d,homeDashboardTexts:u,formSubmitTexts:x}),[t,e,s,n,r,l,d,u,x]);return o.jsxRuntimeExports.jsx(o.LuminusComponentsContext.Provider,{value:f,children:o.jsxRuntimeExports.jsx(dt,{children:o.jsxRuntimeExports.jsxs(ut,{children:[o.jsxRuntimeExports.jsx(o.Ie,{}),h]})})})},ft=({children:t})=>{const[e,s]=i.useState(!1),[n]=i.useState(new Set),r=i.useCallback(u=>{n.add(u),s(!0)},[n]),l=i.useCallback(u=>{n.delete(u),n.size===0&&s(!1)},[n]),d=i.useMemo(()=>({isLoading:e,startLoading:r,stopLoading:l}),[e,r,l]);return o.jsxRuntimeExports.jsxs(o.LoadingContext.Provider,{value:d,children:[e&&o.jsxRuntimeExports.jsx(v.Loading,{}),t]})},xt=({children:t})=>{const e=o.useAxios(),s=i.useCallback(()=>{const f=localStorage.getItem("user")??null;return f?JSON.parse(f):null},[]),[n,r]=i.useState(s()),l=i.useCallback(async()=>{let f=null;return await e.get("/user/detail").then(j=>{f=j.data}).catch(()=>{f=null}),localStorage.setItem("user",JSON.stringify(f)),f},[e]),d=i.useCallback(()=>{localStorage.removeItem("user")},[]),u=i.useCallback(async()=>{const f=await l();return f?(r(f),!0):!1},[l]),x=i.useCallback(()=>{d(),r(null)},[d]),h=i.useMemo(()=>({user:n,loginUser:u,logoutUser:x}),[n,u,x]);return i.useEffect(()=>{r(s())},[s]),o.jsxRuntimeExports.jsx(o.UserContext.Provider,{value:h,children:t})},pt=()=>{const{confirmTexts:t}=i.useContext(o.LuminusComponentsContext),{onConfirm:e,onCancel:s,text:n,show:r}=Ce.useConfirm();return o.jsxRuntimeExports.jsx(w,{show:r,size:"sm",centered:!0,onHide:s,children:o.jsxRuntimeExports.jsxs(w.Body,{children:[o.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:o.jsxRuntimeExports.jsx(a.Typography,{variant:"h6",children:n})}),o.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[o.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:s,children:t.no}),o.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:e,children:t.yes})]})]})})};exports.LoadingContext=o.LoadingContext;exports.LuminusComponentsContext=o.LuminusComponentsContext;exports.UserContext=o.UserContext;exports.LoadingProvider=ft;exports.LuminusComponentsProvider=mt;exports.UserProvider=xt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./UserAvatarToggle-0_jNWWSB.cjs"),a=require("react"),ve=require("./useConfirm-CdQJyKxQ.cjs"),Fe=require("./Typography-C0E6aQv2.cjs"),v=require("./DataKey-DN_Gd8yX.cjs"),Ie=require("react-dom");function Pe(s){const e=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(e,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}return e.default=s,Object.freeze(e)}const h=Pe(a),Ue=s=>h.forwardRef((e,n)=>t.jsxRuntimeExports.jsx("div",{...e,ref:n,className:t.classNames(e.className,s)})),We={"aria-label":t.PropTypes.string,onClick:t.PropTypes.func,variant:t.PropTypes.oneOf(["white"])},me=h.forwardRef(({className:s,variant:e,"aria-label":n="Close",...o},r)=>t.jsxRuntimeExports.jsx("button",{ref:r,type:"button",className:t.classNames("btn-close",e&&`btn-close-${e}`,s),"aria-label":n,...o}));me.displayName="CloseButton";me.propTypes=We;const $e=me;var J;function he(s){if((!J&&J!==0||s)&&t.canUseDOM){var e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),J=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return J}function ce(s){s===void 0&&(s=t.ownerDocument());try{var e=s.activeElement;return!e||!e.nodeName?null:e}catch{return s.body}}function He(s=document){const e=s.defaultView;return Math.abs(e.innerWidth-s.documentElement.clientWidth)}const ge=v.dataAttr("modal-open");class _e{constructor({ownerDocument:e,handleContainerOverflow:n=!0,isRTL:o=!1}={}){this.handleContainerOverflow=n,this.isRTL=o,this.modals=[],this.ownerDocument=e}getScrollbarWidth(){return He(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(e){}removeModalAttributes(e){}setContainerStyle(e){const n={overflow:"hidden"},o=this.isRTL?"paddingLeft":"paddingRight",r=this.getElement();e.style={overflow:r.style.overflow,[o]:r.style[o]},e.scrollBarWidth&&(n[o]=`${parseInt(t.style(r,o)||"0",10)+e.scrollBarWidth}px`),r.setAttribute(ge,""),t.style(r,n)}reset(){[...this.modals].forEach(e=>this.remove(e))}removeContainerStyle(e){const n=this.getElement();n.removeAttribute(ge),Object.assign(n.style,e.style)}add(e){let n=this.modals.indexOf(e);return n!==-1||(n=this.modals.length,this.modals.push(e),this.setModalAttributes(e),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(e){const n=this.modals.indexOf(e);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(e))}isTopModal(e){return!!this.modals.length&&this.modals[this.modals.length-1]===e}}const fe=_e,qe=["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 Ke(s,e){if(s==null)return{};var n={},o=Object.keys(s),r,i;for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&(n[r]=s[r]);return n}let ue;function ze(s){return ue||(ue=new fe({ownerDocument:s==null?void 0:s.document})),ue}function Ge(s){const e=t.useWindow(),n=s||ze(e),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,e)=>{let{show:n=!1,role:o="dialog",className:r,style:i,children:u,backdrop:c=!0,keyboard:f=!0,onBackdropClick:p,onEscapeKeyDown:m,transition:E,runTransition:C,backdropTransition:w,runBackdropTransition:Q,autoFocus:W=!0,enforceFocus:Z=!0,restoreFocus:M=!0,restoreFocusOptions:ee,renderDialog:$,renderBackdrop:te=d=>t.jsxRuntimeExports.jsx("div",Object.assign({},d)),manager:se,container:ne,onShow:H,onHide:A=()=>{},onExit:oe,onExited:D,onExiting:_,onEnter:q,onEntering:K,onEntered:z}=s,re=Ke(s,qe);const R=t.useWindow(),N=t.useWaitForDOMRef(ne),x=Ge(se),ae=t.useMounted(),G=v.usePrevious(n),[y,T]=a.useState(!n),g=a.useRef(null);a.useImperativeHandle(e,()=>x,[x]),t.canUseDOM&&!G&&n&&(g.current=ce(R==null?void 0:R.document)),n&&y&&T(!1);const j=t.useEventCallback(()=>{if(x.add(),k.current=t.listen(document,"keydown",le),I.current=t.listen(document,"focus",()=>setTimeout(ie),!0),H&&H(),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&&!t.contains(x.dialog,U)&&(g.current=U,x.dialog.focus())}}),F=t.useEventCallback(()=>{if(x.remove(),k.current==null||k.current(),I.current==null||I.current(),M){var d;(d=g.current)==null||d.focus==null||d.focus(ee),g.current=null}});a.useEffect(()=>{!n||!N||j()},[n,N,j]),a.useEffect(()=>{y&&F()},[y,F]),t.useWillUnmount(()=>{F()});const ie=t.useEventCallback(()=>{if(!Z||!ae()||!x.isTopModal())return;const d=ce(R==null?void 0:R.document);x.dialog&&d&&!t.contains(x.dialog,d)&&x.dialog.focus()}),V=t.useEventCallback(d=>{d.target===d.currentTarget&&(p==null||p(d),c===!0&&A())}),le=t.useEventCallback(d=>{f&&t.isEscKey(d)&&x.isTopModal()&&(m==null||m(d),d.defaultPrevented||A())}),I=a.useRef(),k=a.useRef(),X=(...d)=>{T(!0),D==null||D(...d)};if(!N)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=$?$(S):t.jsxRuntimeExports.jsx("div",Object.assign({},S,{children:h.cloneElement(u,{role:"document"})}));P=t.renderTransition(E,C,{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=t.renderTransition(w,Q,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:O})),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:Ie.createPortal(t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[O,P]}),N)})});Re.displayName="Modal";const Ve=Object.assign(Re,{Manager:fe});function Xe(s,e){s.classList?s.classList.add(e):t.hasClass(s,e)||(typeof s.className=="string"?s.className=s.className+" "+e:s.setAttribute("class",(s.className&&s.className.baseVal||"")+" "+e))}function Ee(s,e){return s.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Ye(s,e){s.classList?s.classList.remove(e):typeof s.className=="string"?s.className=Ee(s.className,e):s.setAttribute("class",Ee(s.className&&s.className.baseVal||"",e))}const L={FIXED_CONTENT:".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",STICKY_CONTENT:".sticky-top",NAVBAR_TOGGLER:".navbar-toggler"};class Je extends fe{adjustAndStore(e,n,o){const r=n.style[e];n.dataset[e]=r,t.style(n,{[e]:`${parseFloat(t.style(n,e))+o}px`})}restore(e,n){const o=n.dataset[e];o!==void 0&&(delete n.dataset[e],t.style(n,{[e]:o}))}setContainerStyle(e){super.setContainerStyle(e);const n=this.getElement();if(Xe(n,"modal-open"),!e.scrollBarWidth)return;const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";v.qsa(n,L.FIXED_CONTENT).forEach(i=>this.adjustAndStore(o,i,e.scrollBarWidth)),v.qsa(n,L.STICKY_CONTENT).forEach(i=>this.adjustAndStore(r,i,-e.scrollBarWidth)),v.qsa(n,L.NAVBAR_TOGGLER).forEach(i=>this.adjustAndStore(r,i,e.scrollBarWidth))}removeContainerStyle(e){super.removeContainerStyle(e);const n=this.getElement();Ye(n,"modal-open");const o=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";v.qsa(n,L.FIXED_CONTENT).forEach(i=>this.restore(o,i)),v.qsa(n,L.STICKY_CONTENT).forEach(i=>this.restore(r,i)),v.qsa(n,L.NAVBAR_TOGGLER).forEach(i=>this.restore(r,i))}}let de;function Qe(s){return de||(de=new Je(s)),de}const je=h.forwardRef(({className:s,bsPrefix:e,as:n="div",...o},r)=>(e=t.useBootstrapPrefix(e,"modal-body"),t.jsxRuntimeExports.jsx(n,{ref:r,className:t.classNames(s,e),...o})));je.displayName="ModalBody";const Ze=je,et=h.createContext({onHide(){}}),Ce=et,ye=h.forwardRef(({bsPrefix:s,className:e,contentClassName:n,centered:o,size:r,fullscreen:i,children:u,scrollable:c,...f},p)=>{s=t.useBootstrapPrefix(s,"modal");const m=`${s}-dialog`,E=typeof i=="string"?`${s}-fullscreen-${i}`:`${s}-fullscreen`;return t.jsxRuntimeExports.jsx("div",{...f,ref:p,className:t.classNames(m,e,r&&`${s}-${r}`,o&&`${m}-centered`,c&&`${m}-scrollable`,i&&E),children:t.jsxRuntimeExports.jsx("div",{className:t.classNames(`${s}-content`,n),children:u})})});ye.displayName="ModalDialog";const be=ye,we=h.forwardRef(({className:s,bsPrefix:e,as:n="div",...o},r)=>(e=t.useBootstrapPrefix(e,"modal-footer"),t.jsxRuntimeExports.jsx(n,{ref:r,className:t.classNames(s,e),...o})));we.displayName="ModalFooter";const tt=we,st=h.forwardRef(({closeLabel:s="Close",closeVariant:e,closeButton:n=!1,onHide:o,children:r,...i},u)=>{const c=a.useContext(Ce),f=t.useEventCallback(()=>{c==null||c.onHide(),o==null||o()});return t.jsxRuntimeExports.jsxs("div",{ref:u,...i,children:[r,n&&t.jsxRuntimeExports.jsx($e,{"aria-label":s,variant:e,onClick:f})]})}),nt=st,Me=h.forwardRef(({bsPrefix:s,className:e,closeLabel:n="Close",closeButton:o=!1,...r},i)=>(s=t.useBootstrapPrefix(s,"modal-header"),t.jsxRuntimeExports.jsx(nt,{ref:i,...r,className:t.classNames(e,s),closeLabel:n,closeButton:o})));Me.displayName="ModalHeader";const ot=Me,rt=Ue("h4"),Ne=h.forwardRef(({className:s,bsPrefix:e,as:n=rt,...o},r)=>(e=t.useBootstrapPrefix(e,"modal-title"),t.jsxRuntimeExports.jsx(n,{ref:r,className:t.classNames(s,e),...o})));Ne.displayName="ModalTitle";const at=Ne;function it(s){return t.jsxRuntimeExports.jsx(t.Fade,{...s,timeout:null})}function lt(s){return t.jsxRuntimeExports.jsx(t.Fade,{...s,timeout:null})}const Te=h.forwardRef(({bsPrefix:s,className:e,style:n,dialogClassName:o,contentClassName:r,children:i,dialogAs:u=be,"data-bs-theme":c,"aria-labelledby":f,"aria-describedby":p,"aria-label":m,show:E=!1,animation:C=!0,backdrop:w=!0,keyboard:Q=!0,onEscapeKeyDown:W,onShow:Z,onHide:M,container:ee,autoFocus:$=!0,enforceFocus:te=!0,restoreFocus:se=!0,restoreFocusOptions:ne,onEntered:H,onExit:A,onExiting:oe,onEnter:D,onEntering:_,onExited:q,backdropClassName:K,manager:z,...re},R)=>{const[N,x]=a.useState({}),[ae,G]=a.useState(!1),y=a.useRef(!1),T=a.useRef(!1),g=a.useRef(null),[j,F]=t.useCallbackRef(),ie=t.useMergedRefs(R,F),V=t.useEventCallback(M),le=t.useIsRTL();s=t.useBootstrapPrefix(s,"modal");const I=a.useMemo(()=>({onHide:V}),[V]);function k(){return z||Qe({isRTL:le})}function X(l){if(!t.canUseDOM)return;const B=k().getScrollbarWidth()>0,pe=l.scrollHeight>t.ownerDocument(l).documentElement.clientHeight;x({paddingRight:B&&!pe?he():void 0,paddingLeft:!B&&pe?he():void 0})}const S=t.useEventCallback(()=>{j&&X(j.dialog)});t.useWillUnmount(()=>{t.removeEventListener(window,"resize",S),g.current==null||g.current()});const P=()=>{y.current=!0},O=l=>{y.current&&j&&l.target===j.dialog&&(T.current=!0),y.current=!1},d=()=>{G(!0),g.current=t.transitionEnd(j.dialog,()=>{G(!1)})},Y=l=>{l.target===l.currentTarget&&d()},U=l=>{if(w==="static"){Y(l);return}if(T.current||l.target!==l.currentTarget){T.current=!1;return}M==null||M()},ke=l=>{Q?W==null||W(l):(l.preventDefault(),w==="static"&&d())},Se=(l,B)=>{l&&X(l),D==null||D(l,B)},Oe=l=>{g.current==null||g.current(),A==null||A(l)},Be=(l,B)=>{_==null||_(l,B),t.addEventListener(window,"resize",S)},Le=l=>{l&&(l.style.display=""),q==null||q(l),t.removeEventListener(window,"resize",S)},Ae=a.useCallback(l=>t.jsxRuntimeExports.jsx("div",{...l,className:t.classNames(`${s}-backdrop`,K,!C&&"show")}),[C,K,s]),xe={...n,...N};xe.display="block";const De=l=>t.jsxRuntimeExports.jsx("div",{role:"dialog",...l,style:xe,className:t.classNames(e,s,ae&&`${s}-static`,!C&&"show"),onClick:w?U:void 0,onMouseUp:O,"data-bs-theme":c,"aria-label":m,"aria-labelledby":f,"aria-describedby":p,children:t.jsxRuntimeExports.jsx(u,{...re,onMouseDown:P,className:o,contentClassName:r,children:i})});return t.jsxRuntimeExports.jsx(Ce.Provider,{value:I,children:t.jsxRuntimeExports.jsx(Ve,{show:E,ref:ie,backdrop:w,container:ee,keyboard:!0,autoFocus:$,enforceFocus:te,restoreFocus:se,restoreFocusOptions:ne,onEscapeKeyDown:ke,onShow:Z,onHide:M,onEnter:Se,onEntering:Be,onEntered:H,onExit:Oe,onExiting:oe,onExited:Le,manager:k(),transition:C?it:void 0,backdropTransition:C?lt:void 0,renderBackdrop:Ae,renderDialog:De})})});Te.displayName="Modal";const b=Object.assign(Te,{Body:Ze,Header:ot,Title:at,Footer:tt,Dialog:be,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),ct=()=>{const{confirmTexts:s}=a.useContext(t.LuminusComponentsContext),{isShown:e,text:n,onFinish:o}=ve.usePrompt(),[r,i]=a.useState(""),u=a.useCallback(()=>{o(null)},[o]),c=a.useCallback(()=>{o(r)},[o,r]);return a.useEffect(()=>{e===!0&&i("")},[e]),t.jsxRuntimeExports.jsxs(b,{show:e,size:"sm",centered:!0,onHide:u,children:[t.jsxRuntimeExports.jsx(b.Header,{children:t.jsxRuntimeExports.jsx(b.Title,{children:n})}),t.jsxRuntimeExports.jsx(b.Body,{children:t.jsxRuntimeExports.jsx("textarea",{autoFocus:!0,tabIndex:0,value:r,onChange:f=>i(f.currentTarget.value),className:"w-100",rows:5})}),t.jsxRuntimeExports.jsxs(b.Footer,{children:[t.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary",onClick:u,children:s.cancel}),t.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary ml",onClick:c,children:s.confirm})]})]})},ut=({children:s})=>{const[e,n]=a.useState(!1),[o,r]=a.useState(""),i=a.useRef(()=>{}),u=a.useCallback(p=>{r(p),n(!0),console.log("showprompt")},[]),c=a.useCallback(()=>{n(!1)},[]),f=a.useMemo(()=>({isShown:e,text:o,showPrompt:u,hidePrompt:c,resolveRef:i}),[c,e,u,o,i]);return t.jsxRuntimeExports.jsxs(t.PromptContext.Provider,{value:f,children:[s,t.jsxRuntimeExports.jsx(ct,{})]})},dt=({children:s})=>{const[e,n]=a.useState(!1),[o,r]=a.useState(""),i=a.useCallback(f=>{n(!0),r(f)},[]),u=a.useCallback(()=>{n(!1)},[]),c=a.useMemo(()=>({show:e,text:o,showConfirm:i,hideConfirm:u}),[e,o,i,u]);return t.jsxRuntimeExports.jsxs(t.ConfirmContext.Provider,{value:c,children:[t.jsxRuntimeExports.jsx(pt,{}),s]})},mt=({cookieDomain:s,axiosInstance:e,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p,children:m})=>{const E=a.useMemo(()=>({axiosInstance:e,cookieDomain:s,LinkComponent:n,language:o,axiosTexts:r,confirmTexts:i,formValidationTexts:u,homeDashboardTexts:c,formSubmitTexts:f,appSearchTexts:p}),[e,s,n,o,r,i,u,c,f,p]);return t.jsxRuntimeExports.jsx(t.LuminusComponentsContext.Provider,{value:E,children:t.jsxRuntimeExports.jsx(dt,{children:t.jsxRuntimeExports.jsxs(ut,{children:[t.jsxRuntimeExports.jsx(t.Ie,{}),m]})})})},ft=({children:s})=>{const[e,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]),u=a.useMemo(()=>({isLoading:e,startLoading:r,stopLoading:i}),[e,r,i]);return t.jsxRuntimeExports.jsxs(t.LoadingContext.Provider,{value:u,children:[e&&t.jsxRuntimeExports.jsx(v.Loading,{}),s]})},xt=({children:s})=>{const e=t.useAxios(),n=a.useCallback(()=>{const m=localStorage.getItem("user")??null;return m?JSON.parse(m):null},[]),[o,r]=a.useState(n()),i=a.useCallback(async()=>{let m=null;return await e.get("/user/detail").then(E=>{m=E.data}).catch(()=>{m=null}),localStorage.setItem("user",JSON.stringify(m)),m},[e]),u=a.useCallback(()=>{localStorage.removeItem("user")},[]),c=a.useCallback(async()=>{const m=await i();return m?(r(m),!0):!1},[i]),f=a.useCallback(()=>{u(),r(null)},[u]),p=a.useMemo(()=>({user:o,loginUser:c,logoutUser:f}),[o,c,f]);return a.useEffect(()=>{r(n())},[n]),t.jsxRuntimeExports.jsx(t.UserContext.Provider,{value:p,children:s})},pt=()=>{const{confirmTexts:s}=a.useContext(t.LuminusComponentsContext),{onConfirm:e,onCancel:n,text:o,show:r}=ve.useConfirm();return t.jsxRuntimeExports.jsx(b,{show:r,size:"sm",centered:!0,onHide:n,children:t.jsxRuntimeExports.jsxs(b.Body,{children:[t.jsxRuntimeExports.jsx("div",{className:"mb-5 text-center",children:t.jsxRuntimeExports.jsx(Fe.Typography,{variant:"h6",children:o})}),t.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex gap-5",children:[t.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-secondary w-100",onClick:n,children:s.no}),t.jsxRuntimeExports.jsx("button",{type:"button",className:"btn btn-primary w-100 ml",onClick:e,children:s.yes})]})]})})};exports.LoadingContext=t.LoadingContext;exports.LuminusComponentsContext=t.LuminusComponentsContext;exports.UserContext=t.UserContext;exports.LoadingProvider=ft;exports.LuminusComponentsProvider=mt;exports.UserProvider=xt;
|