react-luminus-components 2.0.5-beta.r19-26 → 2.0.5

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.
@@ -29,18 +29,28 @@
29
29
  "file": "nivo-bar-C1VYGnTR.cjs",
30
30
  "name": "nivo-bar"
31
31
  },
32
- "_useIsFormDirty-BhBtGgzZ.cjs": {
33
- "file": "useIsFormDirty-BhBtGgzZ.cjs",
32
+ "_queryStorage-C8e71gxx.js": {
33
+ "file": "queryStorage-C8e71gxx.js",
34
+ "name": "queryStorage"
35
+ },
36
+ "_queryStorage-Dk70bkj7.cjs": {
37
+ "file": "queryStorage-Dk70bkj7.cjs",
38
+ "name": "queryStorage"
39
+ },
40
+ "_useIsFormDirty-BMSfF308.cjs": {
41
+ "file": "useIsFormDirty-BMSfF308.cjs",
34
42
  "name": "useIsFormDirty",
35
43
  "imports": [
36
- "_nivo-bar-C1VYGnTR.cjs"
44
+ "_nivo-bar-C1VYGnTR.cjs",
45
+ "_queryStorage-Dk70bkj7.cjs"
37
46
  ]
38
47
  },
39
- "_useIsFormDirty-GgEve4W-.js": {
40
- "file": "useIsFormDirty-GgEve4W-.js",
48
+ "_useIsFormDirty-BdF5E9qQ.js": {
49
+ "file": "useIsFormDirty-BdF5E9qQ.js",
41
50
  "name": "useIsFormDirty",
42
51
  "imports": [
43
- "_nivo-bar-BHzU38wt.js"
52
+ "_nivo-bar-BHzU38wt.js",
53
+ "_queryStorage-C8e71gxx.js"
44
54
  ]
45
55
  },
46
56
  "_useLocalStorageState-AB4BFfn5.cjs": {
@@ -76,7 +86,7 @@
76
86
  "imports": [
77
87
  "_nivo-bar-C1VYGnTR.cjs",
78
88
  "_useLocalStorageState-AB4BFfn5.cjs",
79
- "_useIsFormDirty-BhBtGgzZ.cjs"
89
+ "_useIsFormDirty-BMSfF308.cjs"
80
90
  ]
81
91
  },
82
92
  "src/layout/index.ts": {
@@ -97,7 +107,7 @@
97
107
  "_nivo-bar-C1VYGnTR.cjs",
98
108
  "_FormDisabledProvider-CiGUtSf7.cjs",
99
109
  "_localStorageUtils-CkZslzIU.cjs",
100
- "_useIsFormDirty-BhBtGgzZ.cjs",
110
+ "_useIsFormDirty-BMSfF308.cjs",
101
111
  "_useLocalStorageState-AB4BFfn5.cjs"
102
112
  ]
103
113
  },
@@ -108,7 +118,8 @@
108
118
  "isEntry": true,
109
119
  "imports": [
110
120
  "_nivo-bar-C1VYGnTR.cjs",
111
- "_localStorageUtils-CkZslzIU.cjs"
121
+ "_localStorageUtils-CkZslzIU.cjs",
122
+ "_queryStorage-Dk70bkj7.cjs"
112
123
  ]
113
124
  },
114
125
  "style.css": {
@@ -1,2 +1,5 @@
1
+ /**
2
+ * @deprecated use usePersistentState(key, initState, localStorage) instead
3
+ */
1
4
  declare const useLocalStorageState: <T>(key: string, initialValue: T) => readonly [T, import('react').Dispatch<import('react').SetStateAction<T>>, () => void];
2
5
  export default useLocalStorageState;
@@ -1,2 +1,16 @@
1
- declare const usePersistentState: <T>(key: string, initialValue: T, storage?: Storage) => readonly [T, (newValue: T) => void];
1
+ /**
2
+ * usePersistentState is a custom React hook for synchronizing state with a persistent storage (e.g., localStorage).
3
+ * It provides a stateful value and a setter function, similar to useState, but persists the value under a given key.
4
+ * Changes to the value from other tabs or windows are synchronized using a custom event system.
5
+ *
6
+ * @template T The type of the stored value.
7
+ * @param {string} key - The key under which the value is stored in the provided storage.
8
+ * @param {T} initialValue - The initial value to use if storage does not have a value.
9
+ * @param {Storage} [storage=localStorage] - The Storage object to use (defaults to localStorage).
10
+ * @returns {[T, (newValue: React.SetStateAction<T>) => void]} - Returns a tuple with the current value and a setter.
11
+ *
12
+ * @example
13
+ * const [count, setCount] = usePersistentState<number>('counter', 0, queryStorage);
14
+ */
15
+ declare const usePersistentState: <T>(key: string, initialValue: T, storage?: Storage) => readonly [T, (newValue: React.SetStateAction<T>) => void];
2
16
  export default usePersistentState;
@@ -4,14 +4,15 @@ import { SetStateAction } from 'react';
4
4
  type SupportedTypes = number | string | boolean | null | object | Date;
5
5
  type SupportedTypesLiterals = ToLiteral<SupportedTypes> | 'date';
6
6
  /**
7
- * Setting two states at once results in unexpected behaviour. For that case use react-router-dom setSearchParams of useSearchParams.
8
- * It might not always return correct state for Union of different types or numbers in string (for example '50' returns as 50) can be overwritten by setting typeOverride which is also required for Date.
7
+ * @deprecated use usePersistentState(key, initState, queryStorage) instead
8
+ * @ It might not always return correct state for Union of different types or numbers in string (for example '50' returns as 50) can be overwritten by setting typeOverride which is also required for Date.
9
+ * @bug Setting two states at once results in unexpected behaviour. For that case use react-router-dom setSearchParams of useSearchParams.
9
10
  * @template T type to apply to returned state and parameter of setState
10
11
  * @param paramKey key by which the value gets saved in query param
11
- * @param defaultState value of state if query param is absent or invalid
12
+ * @param initState value of state if query param is absent or invalid
12
13
  * @param typeOverride Brute forces state to always be this type.
13
14
  * @returns [T extends SupportedTypes, (newState: T) => void]
14
15
  * @todo fix a bug when you call setState on 2 different queryStates at once - it doesn't set up values properly; seems to be problem with setSearch - it doesn't get updated and second setState is called stale; #USQSdup
15
16
  */
16
- declare const useSearchQueryState: <T extends SupportedTypes>(paramKey: string, defaultState: T, typeOverride?: SupportedTypesLiterals) => readonly [T, (newValue: SetStateAction<T> | T) => void];
17
+ declare const useSearchQueryState: <T extends SupportedTypes>(paramKey: string, initState: T, typeOverride?: SupportedTypesLiterals) => readonly [T, (newValue: SetStateAction<T> | T) => void];
17
18
  export default useSearchQueryState;
package/dist/hooks.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./nivo-bar-C1VYGnTR.cjs"),K=require("./useLocalStorageState-AB4BFfn5.cjs"),d=require("react"),F=require("./useIsFormDirty-BhBtGgzZ.cjs");require("react/jsx-runtime");require("react-router");const H=require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-react");require("@azure/msal-browser");const T=new Map;function Q(t,r){const e=a.useAxios({silent:!0,differentBaseUrl:r==null?void 0:r.customBaseUrl,customToken:r==null?void 0:r.customToken}),s=d.useRef(null);if(!T.has(t)){if(!e.interceptorsUsed)return null;const f=e.get(t).then(n=>(T.set(t,{status:"success",data:n.data}),s.current=setTimeout(()=>{T.delete(t),s.current=null},1e3*10),n.data)).catch(n=>{throw T.set(t,{status:"error",error:n}),s.current=setTimeout(()=>{T.delete(t),s.current=null},1e3*1),n});throw T.set(t,{status:"pending",promise:f}),f}const o=T.get(t);if(o.status==="pending")throw o.promise;if(o.status==="error")throw o.error;return o.data}const _=t=>r=>(window.addEventListener(`storage_${t}`,r),()=>window.removeEventListener(`storage_${t}`,r)),J=(t,r,e)=>{const s=a.compilerRuntimeExports.c(14),o=e===void 0?localStorage:e,[f]=d.useState(r);let n;s[0]!==r?(n=JSON.stringify(r),s[0]=r,s[1]=n):n=s[1];const l=d.useRef(n),w=d.useRef(r);let h;s[2]!==t||s[3]!==f||s[4]!==o?(h=()=>{const g=o.getItem(t);return g!==l.current&&(l.current=g,w.current=l.current?JSON.parse(l.current):f),w.current},s[2]=t,s[3]=f,s[4]=o,s[5]=h):h=s[5];const D=h;let m;s[6]!==t?(m=_(t),s[6]=t,s[7]=m):m=s[7];const y=m,i=d.useSyncExternalStore(y,D);let u;s[8]!==t||s[9]!==o?(u=g=>{o.setItem(t,JSON.stringify(g)),window.dispatchEvent(new Event(`storage_${t}`))},s[8]=t,s[9]=o,s[10]=u):u=s[10];const c=u;let v;return s[11]!==c||s[12]!==i?(v=[i,c],s[11]=c,s[12]=i,s[13]=v):v=s[13],v},M=(t,r,e)=>{let s="pending",o;const f=t.then(n=>{s="success",o=n},n=>{const l=n==null?void 0:n.response;(l==null?void 0:l.status)===404&&e?(s="error-404",o=n):(s="error",o=n)});return()=>{switch(s){case"pending":throw f;case"success":return o;case"error":if(o.code==="ERR_CANCELED")return null;throw o;case"error-404":throw new Error("404");default:throw new Error("Unknown status")}}},b={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},W=(t,r)=>{const e=a.compilerRuntimeExports.c(26),{loadOnInit:s,enabled:o,silent:f,nullStateBeforeLoad:n,nullStateOnFail:l,customApiUrl:w,customBearerToken:h,dataTransformer:D,errorBoundaryOn404:m}=r===void 0?b:r,y=s===void 0?b.loadOnInit:s,i=o===void 0?b.enabled:o,u=f===void 0?b.silent:f,c=n===void 0?b.nullStateBeforeLoad:n,v=l===void 0?b.nullStateOnFail:l;let p;e[0]!==m?(p=m?[404]:void 0,e[0]=m,e[1]=p):p=e[1];let g;e[2]!==w||e[3]!==h||e[4]!==u||e[5]!==p?(g={silent:u,customToken:h,differentBaseUrl:w,noToastOnStatus:p},e[2]=w,e[3]=h,e[4]=u,e[5]=p,e[6]=g):g=e[6];const E=a.useAxios(g),{startLoading:I,stopLoading:S}=d.useContext(a.LoadingContext),O=d.useRef(0),{isAuthenticated:P}=a.useAuth(),[R,N]=d.useState(null);let A;e[7]!==E||e[8]!==D||e[9]!==i||e[10]!==m||e[11]!==P||e[12]!==c||e[13]!==v||e[14]!==u||e[15]!==I||e[16]!==S||e[17]!==t?(A=async(x,V)=>{if(!P()||i===!1)return;!u&&I(`loadData-${t}-${V}`),c&&N(null);const U=E.get(t,{signal:x}).then(G=>D?D(G.data):G.data).finally(()=>!u&&S(`loadData-${t}-${V}`));N(M(U,v??!1,m??!1))},e[7]=E,e[8]=D,e[9]=i,e[10]=m,e[11]=P,e[12]=c,e[13]=v,e[14]=u,e[15]=I,e[16]=S,e[17]=t,e[18]=A):A=e[18];const C=A;let q,B;e[19]!==C||e[20]!==y?(B=()=>{if(y===!1)return;const x=new AbortController;return C(x.signal,O.current=O.current+1),()=>{x.abort()}},q=[C,y],e[19]=C,e[20]=y,e[21]=q,e[22]=B):(q=e[21],B=e[22]),d.useEffect(B,q);let L;return e[23]!==R||e[24]!==C?(L={data:R,setData:N,reloadData:C},e[23]=R,e[24]=C,e[25]=L):L=e[25],L},z=()=>{const t=d.useRef({}).current;return d.useEffect(()=>{const r=document.createElement("div");return r.style.position="absolute",r.style.pointerEvents="none",r.style.top="0",r.style.width="100%",r.style.height="100%",t.elt=r,document.body.appendChild(r),()=>{document.body.removeChild(r)}},[t]),r=>(e,...s)=>{const o=r(e,...s);return e.draggableProps.style.position==="fixed"?H.createPortal(o,t.elt):o}},$={storageKey:"--tmp-scroll-save--",requiredHeight:100,retryInterval:50},Z=(t,r)=>{const e=a.compilerRuntimeExports.c(18),{storageKey:s,requiredHeight:o,retryInterval:f}=r===void 0?$:r,n=s===void 0?$.storageKey:s,l=o===void 0?$.requiredHeight:o,w=f===void 0?$.retryInterval:f,[h,D]=d.useState(!1),m=d.useRef(null);let y;e[0]!==n?(y=()=>{const S=localStorage.getItem(n);return localStorage.removeItem(n),S===null?null:Number(S)},e[0]=n,e[1]=y):y=e[1];const i=y;let u;e[2]!==n?(u=S=>{localStorage.setItem(n,S)},e[2]=n,e[3]=u):u=e[3];const c=u;let v,p;e[4]!==h||e[5]!==l||e[6]!==i||e[7]!==w||e[8]!==t?(v=()=>{const S=window.setInterval(()=>{if(!h&&t.current!==null&&t.current.getBoundingClientRect().height>l){D(!0);const O=i();O!==null&&t.current.scrollTo({top:O}),window.clearInterval(S)}},w);return()=>{window.clearTimeout(S)}},p=[h,l,i,w,t],e[4]=h,e[5]=l,e[6]=i,e[7]=w,e[8]=t,e[9]=v,e[10]=p):(v=e[9],p=e[10]),d.useEffect(v,p);let g,E;e[11]!==c||e[12]!==t?(g=()=>{var O;const S=new AbortController;return(O=t.current)==null||O.addEventListener("scrollend",()=>{var P;m.current=((P=t.current)==null?void 0:P.scrollTop)??0,c((m.current??0).toString())},{signal:S.signal}),()=>S.abort()},E=[c,t],e[11]=c,e[12]=t,e[13]=g,e[14]=E):(g=e[13],E=e[14]),d.useEffect(g,E);let I;return e[15]!==i||e[16]!==c?(I={saveValue:c,retrieveValue:i},e[15]=i,e[16]=c,e[17]=I):I=e[17],I};exports.cancelToken=a.cancelToken;exports.useAuth=a.useAuth;exports.useAxios=a.useAxios;exports.useClickOutside=a.useClickOutside;exports.useClipboard=a.useClipboard;exports.useConfirm=a.useConfirm;exports.useFormControlType=a.useFormControlType;exports.useKeyPress=a.useKeyPress;exports.useNotifications=a.useNotifications;exports.usePermissions=a.usePermissions;exports.usePrompt=a.usePrompt;exports.useWindowSize=a.useWindowSize;exports.useZodSchemaTypes=a.useZodSchemaTypes;exports.useGetApiData=K.useGetApiData;exports.useLocalStorageState=K.useLocalStorageState;exports.useEmployeePhotoPath=F.useEmployeePhotoPath;exports.useIsFormDirty=F.useIsFormDirty;exports.useSearchQuery=F.useSearchQuery;exports.useSearchQueryState=F.useSearchQueryState;exports.useGetApiDataBound=W;exports.useGetDataBound=Q;exports.usePersistentState=J;exports.useRenderDraggableInPortal=z;exports.useScrollSave=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./nivo-bar-C1VYGnTR.cjs"),U=require("./useLocalStorageState-AB4BFfn5.cjs"),f=require("react"),F=require("./useIsFormDirty-BMSfF308.cjs");require("react/jsx-runtime");require("react-router");const H=require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-react");require("@azure/msal-browser");const C=new Map;function Q(s,r){const e=a.useAxios({silent:!0,differentBaseUrl:r==null?void 0:r.customBaseUrl,customToken:r==null?void 0:r.customToken}),t=f.useRef(null);if(!C.has(s)){if(!e.interceptorsUsed)return null;const m=e.get(s).then(n=>(C.set(s,{status:"success",data:n.data}),t.current=setTimeout(()=>{C.delete(s),t.current=null},1e3*10),n.data)).catch(n=>{throw C.set(s,{status:"error",error:n}),t.current=setTimeout(()=>{C.delete(s),t.current=null},1e3*1),n});throw C.set(s,{status:"pending",promise:m}),m}const o=C.get(s);if(o.status==="pending")throw o.promise;if(o.status==="error")throw o.error;return o.data}const _=s=>r=>(window.addEventListener(`storage_${s}`,r),()=>window.removeEventListener(`storage_${s}`,r)),J=(s,r,e)=>{const t=a.compilerRuntimeExports.c(15),o=e===void 0?localStorage:e,[m]=f.useState(r);let n;t[0]!==r?(n=JSON.stringify(r),t[0]=r,t[1]=n):n=t[1];const l=f.useRef(n),w=f.useRef(r);let h;t[2]!==s||t[3]!==m||t[4]!==o?(h=()=>{const i=o.getItem(s);return i!==l.current&&(l.current=i,w.current=l.current?JSON.parse(l.current):m),w.current},t[2]=s,t[3]=m,t[4]=o,t[5]=h):h=t[5];const y=h;let g;t[6]!==s?(g=_(s),t[6]=s,t[7]=g):g=t[7];const D=g,c=f.useSyncExternalStore(D,y);let u;t[8]!==y||t[9]!==s||t[10]!==o?(u=i=>{const E=typeof i=="function"?i(y()):i;o.setItem(s,JSON.stringify(E)),window.dispatchEvent(new Event(`storage_${s}`))},t[8]=y,t[9]=s,t[10]=o,t[11]=u):u=t[11];const d=u;let v;return t[12]!==d||t[13]!==c?(v=[c,d],t[12]=d,t[13]=c,t[14]=v):v=t[14],v},M=(s,r,e)=>{let t="pending",o;const m=s.then(n=>{t="success",o=n},n=>{const l=n==null?void 0:n.response;(l==null?void 0:l.status)===404&&e?(t="error-404",o=n):(t="error",o=n)});return()=>{switch(t){case"pending":throw m;case"success":return o;case"error":if(o.code==="ERR_CANCELED")return null;throw o;case"error-404":throw new Error("404");default:throw new Error("Unknown status")}}},b={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},W=(s,r)=>{const e=a.compilerRuntimeExports.c(26),{loadOnInit:t,enabled:o,silent:m,nullStateBeforeLoad:n,nullStateOnFail:l,customApiUrl:w,customBearerToken:h,dataTransformer:y,errorBoundaryOn404:g}=r===void 0?b:r,D=t===void 0?b.loadOnInit:t,c=o===void 0?b.enabled:o,u=m===void 0?b.silent:m,d=n===void 0?b.nullStateBeforeLoad:n,v=l===void 0?b.nullStateOnFail:l;let p;e[0]!==g?(p=g?[404]:void 0,e[0]=g,e[1]=p):p=e[1];let i;e[2]!==w||e[3]!==h||e[4]!==u||e[5]!==p?(i={silent:u,customToken:h,differentBaseUrl:w,noToastOnStatus:p},e[2]=w,e[3]=h,e[4]=u,e[5]=p,e[6]=i):i=e[6];const E=a.useAxios(i),{startLoading:I,stopLoading:S}=f.useContext(a.LoadingContext),O=f.useRef(0),{isAuthenticated:P}=a.useAuth(),[R,N]=f.useState(null);let A;e[7]!==E||e[8]!==y||e[9]!==c||e[10]!==g||e[11]!==P||e[12]!==d||e[13]!==v||e[14]!==u||e[15]!==I||e[16]!==S||e[17]!==s?(A=async(x,G)=>{if(!P()||c===!1)return;!u&&I(`loadData-${s}-${G}`),d&&N(null);const V=E.get(s,{signal:x}).then(K=>y?y(K.data):K.data).finally(()=>!u&&S(`loadData-${s}-${G}`));N(M(V,v??!1,g??!1))},e[7]=E,e[8]=y,e[9]=c,e[10]=g,e[11]=P,e[12]=d,e[13]=v,e[14]=u,e[15]=I,e[16]=S,e[17]=s,e[18]=A):A=e[18];const T=A;let q,B;e[19]!==T||e[20]!==D?(B=()=>{if(D===!1)return;const x=new AbortController;return T(x.signal,O.current=O.current+1),()=>{x.abort()}},q=[T,D],e[19]=T,e[20]=D,e[21]=q,e[22]=B):(q=e[21],B=e[22]),f.useEffect(B,q);let L;return e[23]!==R||e[24]!==T?(L={data:R,setData:N,reloadData:T},e[23]=R,e[24]=T,e[25]=L):L=e[25],L},z=()=>{const s=f.useRef({}).current;return f.useEffect(()=>{const r=document.createElement("div");return r.style.position="absolute",r.style.pointerEvents="none",r.style.top="0",r.style.width="100%",r.style.height="100%",s.elt=r,document.body.appendChild(r),()=>{document.body.removeChild(r)}},[s]),r=>(e,...t)=>{const o=r(e,...t);return e.draggableProps.style.position==="fixed"?H.createPortal(o,s.elt):o}},$={storageKey:"--tmp-scroll-save--",requiredHeight:100,retryInterval:50},Z=(s,r)=>{const e=a.compilerRuntimeExports.c(18),{storageKey:t,requiredHeight:o,retryInterval:m}=r===void 0?$:r,n=t===void 0?$.storageKey:t,l=o===void 0?$.requiredHeight:o,w=m===void 0?$.retryInterval:m,[h,y]=f.useState(!1),g=f.useRef(null);let D;e[0]!==n?(D=()=>{const S=localStorage.getItem(n);return localStorage.removeItem(n),S===null?null:Number(S)},e[0]=n,e[1]=D):D=e[1];const c=D;let u;e[2]!==n?(u=S=>{localStorage.setItem(n,S)},e[2]=n,e[3]=u):u=e[3];const d=u;let v,p;e[4]!==h||e[5]!==l||e[6]!==c||e[7]!==w||e[8]!==s?(v=()=>{const S=window.setInterval(()=>{if(!h&&s.current!==null&&s.current.getBoundingClientRect().height>l){y(!0);const O=c();O!==null&&s.current.scrollTo({top:O}),window.clearInterval(S)}},w);return()=>{window.clearTimeout(S)}},p=[h,l,c,w,s],e[4]=h,e[5]=l,e[6]=c,e[7]=w,e[8]=s,e[9]=v,e[10]=p):(v=e[9],p=e[10]),f.useEffect(v,p);let i,E;e[11]!==d||e[12]!==s?(i=()=>{var O;const S=new AbortController;return(O=s.current)==null||O.addEventListener("scrollend",()=>{var P;g.current=((P=s.current)==null?void 0:P.scrollTop)??0,d((g.current??0).toString())},{signal:S.signal}),()=>S.abort()},E=[d,s],e[11]=d,e[12]=s,e[13]=i,e[14]=E):(i=e[13],E=e[14]),f.useEffect(i,E);let I;return e[15]!==c||e[16]!==d?(I={saveValue:d,retrieveValue:c},e[15]=c,e[16]=d,e[17]=I):I=e[17],I};exports.cancelToken=a.cancelToken;exports.useAuth=a.useAuth;exports.useAxios=a.useAxios;exports.useClickOutside=a.useClickOutside;exports.useClipboard=a.useClipboard;exports.useConfirm=a.useConfirm;exports.useFormControlType=a.useFormControlType;exports.useKeyPress=a.useKeyPress;exports.useNotifications=a.useNotifications;exports.usePermissions=a.usePermissions;exports.usePrompt=a.usePrompt;exports.useWindowSize=a.useWindowSize;exports.useZodSchemaTypes=a.useZodSchemaTypes;exports.useGetApiData=U.useGetApiData;exports.useLocalStorageState=U.useLocalStorageState;exports.useEmployeePhotoPath=F.useEmployeePhotoPath;exports.useIsFormDirty=F.useIsFormDirty;exports.useSearchQuery=F.useSearchQuery;exports.useSearchQueryState=F.useSearchQueryState;exports.useGetApiDataBound=W;exports.useGetDataBound=Q;exports.usePersistentState=J;exports.useRenderDraggableInPortal=z;exports.useScrollSave=Z;
package/dist/hooks.es.js CHANGED
@@ -1,8 +1,8 @@
1
- import { ao as H, c as V, aq as J, bd as Q } from "./nivo-bar-BHzU38wt.js";
1
+ import { ao as H, c as q, aq as J, bd as Q } from "./nivo-bar-BHzU38wt.js";
2
2
  import { bS as mt, aR as gt, bU as pt, an as vt, bT as St, b7 as ht, ar as wt, bv as bt, am as yt, aG as It, aU as Ot } from "./nivo-bar-BHzU38wt.js";
3
3
  import { u as Ct, a as Et } from "./useLocalStorageState-B2v6hClT.js";
4
- import { useRef as D, useState as q, useSyncExternalStore as W, useContext as z, useEffect as U } from "react";
5
- import { c as xt, u as Bt, a as Lt, b as $t } from "./useIsFormDirty-GgEve4W-.js";
4
+ import { useRef as D, useState as K, useSyncExternalStore as W, useContext as z, useEffect as U } from "react";
5
+ import { c as xt, u as Bt, a as Lt, b as $t } from "./useIsFormDirty-BdF5E9qQ.js";
6
6
  import "react/jsx-runtime";
7
7
  import "react-router";
8
8
  import { createPortal as M } from "react-dom";
@@ -11,73 +11,74 @@ import "react-flexmonster";
11
11
  import "@azure/msal-react";
12
12
  import "@azure/msal-browser";
13
13
  const T = /* @__PURE__ */ new Map();
14
- function at(e, n) {
14
+ function at(s, n) {
15
15
  const t = H({
16
16
  silent: !0,
17
17
  differentBaseUrl: n == null ? void 0 : n.customBaseUrl,
18
18
  customToken: n == null ? void 0 : n.customToken
19
- }), s = D(null);
20
- if (!T.has(e)) {
19
+ }), e = D(null);
20
+ if (!T.has(s)) {
21
21
  if (!t.interceptorsUsed)
22
22
  return null;
23
- const c = t.get(e).then((r) => (T.set(e, {
23
+ const d = t.get(s).then((r) => (T.set(s, {
24
24
  status: "success",
25
25
  data: r.data
26
- }), s.current = setTimeout(() => {
27
- T.delete(e), s.current = null;
26
+ }), e.current = setTimeout(() => {
27
+ T.delete(s), e.current = null;
28
28
  }, 1e3 * 10), r.data)).catch((r) => {
29
- throw T.set(e, {
29
+ throw T.set(s, {
30
30
  status: "error",
31
31
  error: r
32
- }), s.current = setTimeout(() => {
33
- T.delete(e), s.current = null;
32
+ }), e.current = setTimeout(() => {
33
+ T.delete(s), e.current = null;
34
34
  }, 1e3 * 1), r;
35
35
  });
36
- throw T.set(e, {
36
+ throw T.set(s, {
37
37
  status: "pending",
38
- promise: c
39
- }), c;
38
+ promise: d
39
+ }), d;
40
40
  }
41
- const o = T.get(e);
41
+ const o = T.get(s);
42
42
  if (o.status === "pending")
43
43
  throw o.promise;
44
44
  if (o.status === "error")
45
45
  throw o.error;
46
46
  return o.data;
47
47
  }
48
- const R = (e) => (n) => (window.addEventListener(`storage_${e}`, n), () => window.removeEventListener(`storage_${e}`, n)), lt = (e, n, t) => {
49
- const s = V.c(14), o = t === void 0 ? localStorage : t, [c] = q(n);
48
+ const R = (s) => (n) => (window.addEventListener(`storage_${s}`, n), () => window.removeEventListener(`storage_${s}`, n)), lt = (s, n, t) => {
49
+ const e = q.c(15), o = t === void 0 ? localStorage : t, [d] = K(n);
50
50
  let r;
51
- s[0] !== n ? (r = JSON.stringify(n), s[0] = n, s[1] = r) : r = s[1];
51
+ e[0] !== n ? (r = JSON.stringify(n), e[0] = n, e[1] = r) : r = e[1];
52
52
  const l = D(r), S = D(n);
53
53
  let g;
54
- s[2] !== e || s[3] !== c || s[4] !== o ? (g = () => {
55
- const f = o.getItem(e);
56
- return f !== l.current && (l.current = f, S.current = l.current ? JSON.parse(l.current) : c), S.current;
57
- }, s[2] = e, s[3] = c, s[4] = o, s[5] = g) : g = s[5];
58
- const w = g;
59
- let d;
60
- s[6] !== e ? (d = R(e), s[6] = e, s[7] = d) : d = s[7];
61
- const u = W(d, w);
54
+ e[2] !== s || e[3] !== d || e[4] !== o ? (g = () => {
55
+ const u = o.getItem(s);
56
+ return u !== l.current && (l.current = u, S.current = l.current ? JSON.parse(l.current) : d), S.current;
57
+ }, e[2] = s, e[3] = d, e[4] = o, e[5] = g) : g = e[5];
58
+ const h = g;
59
+ let f;
60
+ e[6] !== s ? (f = R(s), e[6] = s, e[7] = f) : f = e[7];
61
+ const i = W(f, h);
62
62
  let a;
63
- s[8] !== e || s[9] !== o ? (a = (f) => {
64
- o.setItem(e, JSON.stringify(f)), window.dispatchEvent(new Event(`storage_${e}`));
65
- }, s[8] = e, s[9] = o, s[10] = a) : a = s[10];
66
- const i = a;
63
+ e[8] !== h || e[9] !== s || e[10] !== o ? (a = (u) => {
64
+ const b = typeof u == "function" ? u(h()) : u;
65
+ o.setItem(s, JSON.stringify(b)), window.dispatchEvent(new Event(`storage_${s}`));
66
+ }, e[8] = h, e[9] = s, e[10] = o, e[11] = a) : a = e[11];
67
+ const c = a;
67
68
  let p;
68
- return s[11] !== i || s[12] !== u ? (p = [u, i], s[11] = i, s[12] = u, s[13] = p) : p = s[13], p;
69
- }, Z = (e, n, t) => {
70
- let s = "pending", o;
71
- const c = e.then((r) => {
72
- s = "success", o = r;
69
+ return e[12] !== c || e[13] !== i ? (p = [i, c], e[12] = c, e[13] = i, e[14] = p) : p = e[14], p;
70
+ }, Z = (s, n, t) => {
71
+ let e = "pending", o;
72
+ const d = s.then((r) => {
73
+ e = "success", o = r;
73
74
  }, (r) => {
74
75
  const l = r == null ? void 0 : r.response;
75
- (l == null ? void 0 : l.status) === 404 && t ? (s = "error-404", o = r) : (s = "error", o = r);
76
+ (l == null ? void 0 : l.status) === 404 && t ? (e = "error-404", o = r) : (e = "error", o = r);
76
77
  });
77
78
  return () => {
78
- switch (s) {
79
+ switch (e) {
79
80
  case "pending":
80
- throw c;
81
+ throw d;
81
82
  case "success":
82
83
  return o;
83
84
  case "error":
@@ -95,53 +96,53 @@ const R = (e) => (n) => (window.addEventListener(`storage_${e}`, n), () => windo
95
96
  enabled: !0,
96
97
  nullStateBeforeLoad: !0,
97
98
  nullStateOnFail: !1
98
- }, ut = (e, n) => {
99
- const t = V.c(26), {
100
- loadOnInit: s,
99
+ }, ut = (s, n) => {
100
+ const t = q.c(26), {
101
+ loadOnInit: e,
101
102
  enabled: o,
102
- silent: c,
103
+ silent: d,
103
104
  nullStateBeforeLoad: r,
104
105
  nullStateOnFail: l,
105
106
  customApiUrl: S,
106
107
  customBearerToken: g,
107
- dataTransformer: w,
108
- errorBoundaryOn404: d
109
- } = n === void 0 ? E : n, h = s === void 0 ? E.loadOnInit : s, u = o === void 0 ? E.enabled : o, a = c === void 0 ? E.silent : c, i = r === void 0 ? E.nullStateBeforeLoad : r, p = l === void 0 ? E.nullStateOnFail : l;
108
+ dataTransformer: h,
109
+ errorBoundaryOn404: f
110
+ } = n === void 0 ? E : n, w = e === void 0 ? E.loadOnInit : e, i = o === void 0 ? E.enabled : o, a = d === void 0 ? E.silent : d, c = r === void 0 ? E.nullStateBeforeLoad : r, p = l === void 0 ? E.nullStateOnFail : l;
110
111
  let v;
111
- t[0] !== d ? (v = d ? [404] : void 0, t[0] = d, t[1] = v) : v = t[1];
112
- let f;
113
- t[2] !== S || t[3] !== g || t[4] !== a || t[5] !== v ? (f = {
112
+ t[0] !== f ? (v = f ? [404] : void 0, t[0] = f, t[1] = v) : v = t[1];
113
+ let u;
114
+ t[2] !== S || t[3] !== g || t[4] !== a || t[5] !== v ? (u = {
114
115
  silent: a,
115
116
  customToken: g,
116
117
  differentBaseUrl: S,
117
118
  noToastOnStatus: v
118
- }, t[2] = S, t[3] = g, t[4] = a, t[5] = v, t[6] = f) : f = t[6];
119
- const b = H(f), {
119
+ }, t[2] = S, t[3] = g, t[4] = a, t[5] = v, t[6] = u) : u = t[6];
120
+ const b = H(u), {
120
121
  startLoading: y,
121
122
  stopLoading: m
122
123
  } = z(J), I = D(0), {
123
124
  isAuthenticated: C
124
- } = Q(), [F, N] = q(null);
125
+ } = Q(), [F, N] = K(null);
125
126
  let x;
126
- t[7] !== b || t[8] !== w || t[9] !== u || t[10] !== d || t[11] !== C || t[12] !== i || t[13] !== p || t[14] !== a || t[15] !== y || t[16] !== m || t[17] !== e ? (x = async (P, K) => {
127
- if (!C() || u === !1)
127
+ t[7] !== b || t[8] !== h || t[9] !== i || t[10] !== f || t[11] !== C || t[12] !== c || t[13] !== p || t[14] !== a || t[15] !== y || t[16] !== m || t[17] !== s ? (x = async (P, V) => {
128
+ if (!C() || i === !1)
128
129
  return;
129
- !a && y(`loadData-${e}-${K}`), i && N(null);
130
- const _ = b.get(e, {
130
+ !a && y(`loadData-${s}-${V}`), c && N(null);
131
+ const _ = b.get(s, {
131
132
  signal: P
132
- }).then((G) => w ? w(G.data) : G.data).finally(() => !a && m(`loadData-${e}-${K}`));
133
- N(Z(_, p ?? !1, d ?? !1));
134
- }, t[7] = b, t[8] = w, t[9] = u, t[10] = d, t[11] = C, t[12] = i, t[13] = p, t[14] = a, t[15] = y, t[16] = m, t[17] = e, t[18] = x) : x = t[18];
133
+ }).then((G) => h ? h(G.data) : G.data).finally(() => !a && m(`loadData-${s}-${V}`));
134
+ N(Z(_, p ?? !1, f ?? !1));
135
+ }, t[7] = b, t[8] = h, t[9] = i, t[10] = f, t[11] = C, t[12] = c, t[13] = p, t[14] = a, t[15] = y, t[16] = m, t[17] = s, t[18] = x) : x = t[18];
135
136
  const O = x;
136
137
  let B, L;
137
- t[19] !== O || t[20] !== h ? (L = () => {
138
- if (h === !1)
138
+ t[19] !== O || t[20] !== w ? (L = () => {
139
+ if (w === !1)
139
140
  return;
140
141
  const P = new AbortController();
141
142
  return O(P.signal, I.current = I.current + 1), () => {
142
143
  P.abort();
143
144
  };
144
- }, B = [O, h], t[19] = O, t[20] = h, t[21] = B, t[22] = L) : (B = t[21], L = t[22]), U(L, B);
145
+ }, B = [O, w], t[19] = O, t[20] = w, t[21] = B, t[22] = L) : (B = t[21], L = t[22]), U(L, B);
145
146
  let $;
146
147
  return t[23] !== F || t[24] !== O ? ($ = {
147
148
  data: F,
@@ -149,44 +150,44 @@ const R = (e) => (n) => (window.addEventListener(`storage_${e}`, n), () => windo
149
150
  reloadData: O
150
151
  }, t[23] = F, t[24] = O, t[25] = $) : $ = t[25], $;
151
152
  }, it = () => {
152
- const e = D({}).current;
153
+ const s = D({}).current;
153
154
  return U(() => {
154
155
  const n = document.createElement("div");
155
- return n.style.position = "absolute", n.style.pointerEvents = "none", n.style.top = "0", n.style.width = "100%", n.style.height = "100%", e.elt = n, document.body.appendChild(n), () => {
156
+ return n.style.position = "absolute", n.style.pointerEvents = "none", n.style.top = "0", n.style.width = "100%", n.style.height = "100%", s.elt = n, document.body.appendChild(n), () => {
156
157
  document.body.removeChild(n);
157
158
  };
158
- }, [e]), (n) => (t, ...s) => {
159
- const o = n(t, ...s);
160
- return t.draggableProps.style.position === "fixed" ? M(o, e.elt) : o;
159
+ }, [s]), (n) => (t, ...e) => {
160
+ const o = n(t, ...e);
161
+ return t.draggableProps.style.position === "fixed" ? M(o, s.elt) : o;
161
162
  };
162
163
  }, A = {
163
164
  storageKey: "--tmp-scroll-save--",
164
165
  requiredHeight: 100,
165
166
  retryInterval: 50
166
- }, ct = (e, n) => {
167
- const t = V.c(18), {
168
- storageKey: s,
167
+ }, ct = (s, n) => {
168
+ const t = q.c(18), {
169
+ storageKey: e,
169
170
  requiredHeight: o,
170
- retryInterval: c
171
- } = n === void 0 ? A : n, r = s === void 0 ? A.storageKey : s, l = o === void 0 ? A.requiredHeight : o, S = c === void 0 ? A.retryInterval : c, [g, w] = q(!1), d = D(null);
172
- let h;
173
- t[0] !== r ? (h = () => {
171
+ retryInterval: d
172
+ } = n === void 0 ? A : n, r = e === void 0 ? A.storageKey : e, l = o === void 0 ? A.requiredHeight : o, S = d === void 0 ? A.retryInterval : d, [g, h] = K(!1), f = D(null);
173
+ let w;
174
+ t[0] !== r ? (w = () => {
174
175
  const m = localStorage.getItem(r);
175
176
  return localStorage.removeItem(r), m === null ? null : Number(m);
176
- }, t[0] = r, t[1] = h) : h = t[1];
177
- const u = h;
177
+ }, t[0] = r, t[1] = w) : w = t[1];
178
+ const i = w;
178
179
  let a;
179
180
  t[2] !== r ? (a = (m) => {
180
181
  localStorage.setItem(r, m);
181
182
  }, t[2] = r, t[3] = a) : a = t[3];
182
- const i = a;
183
+ const c = a;
183
184
  let p, v;
184
- t[4] !== g || t[5] !== l || t[6] !== u || t[7] !== S || t[8] !== e ? (p = () => {
185
+ t[4] !== g || t[5] !== l || t[6] !== i || t[7] !== S || t[8] !== s ? (p = () => {
185
186
  const m = window.setInterval(() => {
186
- if (!g && e.current !== null && e.current.getBoundingClientRect().height > l) {
187
- w(!0);
188
- const I = u();
189
- I !== null && e.current.scrollTo({
187
+ if (!g && s.current !== null && s.current.getBoundingClientRect().height > l) {
188
+ h(!0);
189
+ const I = i();
190
+ I !== null && s.current.scrollTo({
190
191
  top: I
191
192
  }), window.clearInterval(m);
192
193
  }
@@ -194,23 +195,23 @@ const R = (e) => (n) => (window.addEventListener(`storage_${e}`, n), () => windo
194
195
  return () => {
195
196
  window.clearTimeout(m);
196
197
  };
197
- }, v = [g, l, u, S, e], t[4] = g, t[5] = l, t[6] = u, t[7] = S, t[8] = e, t[9] = p, t[10] = v) : (p = t[9], v = t[10]), U(p, v);
198
- let f, b;
199
- t[11] !== i || t[12] !== e ? (f = () => {
198
+ }, v = [g, l, i, S, s], t[4] = g, t[5] = l, t[6] = i, t[7] = S, t[8] = s, t[9] = p, t[10] = v) : (p = t[9], v = t[10]), U(p, v);
199
+ let u, b;
200
+ t[11] !== c || t[12] !== s ? (u = () => {
200
201
  var I;
201
202
  const m = new AbortController();
202
- return (I = e.current) == null || I.addEventListener("scrollend", () => {
203
+ return (I = s.current) == null || I.addEventListener("scrollend", () => {
203
204
  var C;
204
- d.current = ((C = e.current) == null ? void 0 : C.scrollTop) ?? 0, i((d.current ?? 0).toString());
205
+ f.current = ((C = s.current) == null ? void 0 : C.scrollTop) ?? 0, c((f.current ?? 0).toString());
205
206
  }, {
206
207
  signal: m.signal
207
208
  }), () => m.abort();
208
- }, b = [i, e], t[11] = i, t[12] = e, t[13] = f, t[14] = b) : (f = t[13], b = t[14]), U(f, b);
209
+ }, b = [c, s], t[11] = c, t[12] = s, t[13] = u, t[14] = b) : (u = t[13], b = t[14]), U(u, b);
209
210
  let y;
210
- return t[15] !== u || t[16] !== i ? (y = {
211
- saveValue: i,
212
- retrieveValue: u
213
- }, t[15] = u, t[16] = i, t[17] = y) : y = t[17], y;
211
+ return t[15] !== i || t[16] !== c ? (y = {
212
+ saveValue: c,
213
+ retrieveValue: i
214
+ }, t[15] = i, t[16] = c, t[17] = y) : y = t[17], y;
214
215
  };
215
216
  export {
216
217
  mt as cancelToken,