react-luminus-components 2.0.3-beta.r19-15 → 2.0.3-beta.r19-17

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.
@@ -1,65 +0,0 @@
1
- import { useCallback as m, useMemo as h } from "react";
2
- import { useSearchParams as S } from "react-router";
3
- const l = () => {
4
- const [n, r] = S(), o = m((c, e) => {
5
- n.get(c) !== e && r((s) => (e === null && s.delete(c), s.get(c) === e || s.set(c, e ?? ""), s), { replace: !0 });
6
- }, [r, n]);
7
- return {
8
- searchParams: n,
9
- setSearch: o
10
- };
11
- }, g = "\0", p = (n, r, o) => {
12
- const { searchParams: c, setSearch: e } = l(), s = m((t) => {
13
- if (typeof t == "object") {
14
- if (o && o === "date" || !o && t instanceof Date) {
15
- if (!(t instanceof Date))
16
- throw new Error("Tried to setQueryState of type Date to non-date.");
17
- return t.toISOString();
18
- }
19
- return JSON.stringify(t);
20
- }
21
- return t.toString();
22
- }, [o]), a = h(() => s(r), [r, s]), b = h(() => c.get(n), [n, c]), f = h(() => {
23
- const t = b;
24
- if (t === g)
25
- return null;
26
- const u = t ? Number(t) : r;
27
- let i = Number.isNaN(u) ? typeof r : "number";
28
- switch (i === "object" && r instanceof Date && (i = "date"), o ?? i) {
29
- case "number":
30
- return u;
31
- case "string":
32
- return t ?? r;
33
- case "boolean":
34
- return t === "true";
35
- case "object":
36
- return t ? JSON.parse(t) : r;
37
- case "date":
38
- return t ? new Date(t) : r;
39
- default:
40
- throw console.error(o, i), new Error(`useSearchQueryState is not implemented for type ${typeof (o ?? i)}.`);
41
- }
42
- }, [r, b, o]), P = m((t) => {
43
- let u;
44
- typeof t == "function" ? u = t(f) : u = t;
45
- const i = s(u);
46
- if (r === u || i === a) {
47
- e(n, null);
48
- return;
49
- }
50
- if (u === null) {
51
- e(n, g);
52
- return;
53
- }
54
- e(n, i);
55
- }, [r, a, s, n, e, f]);
56
- return [f, P];
57
- }, Q = (n) => {
58
- const r = h(() => Math.floor(Math.random() * 900) + 100, []), o = h(() => btoa(n.toString() ?? ""), [n]), c = h(() => `employeePhotos?personalNumber=${r}${o}&small=false`, [r, o]), e = h(() => `employeePhotos?personalNumber=${r}${o}&small=true`, [r, o]);
59
- return { photoPath: c, photoPathSm: e };
60
- };
61
- export {
62
- p as a,
63
- Q as b,
64
- l as u
65
- };
@@ -1 +0,0 @@
1
- "use strict";const u=require("react"),P=require("react-router"),S=()=>{const[o,e]=P.useSearchParams(),r=u.useCallback((c,s)=>{o.get(c)!==s&&e(n=>(s===null&&n.delete(c),n.get(c)===s||n.set(c,s??""),n),{replace:!0})},[e,o]);return{searchParams:o,setSearch:r}},l="\0",g=(o,e,r)=>{const{searchParams:c,setSearch:s}=S(),n=u.useCallback(t=>{if(typeof t=="object"){if(r&&r==="date"||!r&&t instanceof Date){if(!(t instanceof Date))throw new Error("Tried to setQueryState of type Date to non-date.");return t.toISOString()}return JSON.stringify(t)}return t.toString()},[r]),i=u.useMemo(()=>n(e),[e,n]),f=u.useMemo(()=>c.get(o),[o,c]),m=u.useMemo(()=>{const t=f;if(t===l)return null;const a=t?Number(t):e;let h=Number.isNaN(a)?typeof e:"number";switch(h==="object"&&e instanceof Date&&(h="date"),r??h){case"number":return a;case"string":return t??e;case"boolean":return t==="true";case"object":return t?JSON.parse(t):e;case"date":return t?new Date(t):e;default:throw console.error(r,h),new Error(`useSearchQueryState is not implemented for type ${typeof(r??h)}.`)}},[e,f,r]),b=u.useCallback(t=>{let a;typeof t=="function"?a=t(m):a=t;const h=n(a);if(e===a||h===i){s(o,null);return}if(a===null){s(o,l);return}s(o,h)},[e,i,n,o,s,m]);return[m,b]},M=o=>{const e=u.useMemo(()=>Math.floor(Math.random()*900)+100,[]),r=u.useMemo(()=>btoa(o.toString()??""),[o]),c=u.useMemo(()=>`employeePhotos?personalNumber=${e}${r}&small=false`,[e,r]),s=u.useMemo(()=>`employeePhotos?personalNumber=${e}${r}&small=true`,[e,r]);return{photoPath:c,photoPathSm:s}};exports.useEmployeePhotoPath=M;exports.useSearchQuery=S;exports.useSearchQueryState=g;
@@ -1,80 +0,0 @@
1
- import { an as J, ap as N, bc as E } from "./nivo-bar-FuUHRilH.js";
2
- import "react/jsx-runtime";
3
- import { useState as g, useContext as F, useRef as G, useCallback as e, useEffect as O } from "react";
4
- import "react-router";
5
- import "@tanstack/react-query";
6
- import "react-dom";
7
- import "react-hook-form";
8
- import "react-flexmonster";
9
- import "@azure/msal-browser";
10
- import "@azure/msal-react";
11
- const l = {
12
- loadOnInit: !0,
13
- silent: !1,
14
- enabled: !0,
15
- nullStateBeforeLoad: !0,
16
- nullStateOnFail: !1
17
- }, V = (t, { loadOnInit: i = l.loadOnInit, enabled: n = l.enabled, silent: a = l.silent, nullStateBeforeLoad: c = l.nullStateBeforeLoad, nullStateOnFail: u = l.nullStateOnFail, customApiUrl: s, customBearerToken: $, dataTransformer: p } = l) => {
18
- const m = J({
19
- silent: a,
20
- customToken: $,
21
- differentBaseUrl: s
22
- }), [w, S] = g(!1), { startLoading: L, stopLoading: D } = F(N), y = G(0), { isAuthenticated: x } = E(), C = e((o) => {
23
- L(o), S(() => !0);
24
- }, [L]), b = e((o) => {
25
- D(o), S(() => !1);
26
- }, [D]), [R, d] = g(null), r = e(async (o, I) => {
27
- if (!x() || n === !1)
28
- return null;
29
- !a && C(`loadData-${t}-${I}`), c && d(null);
30
- let h;
31
- try {
32
- const f = await m.get(t, {
33
- signal: o
34
- }), A = p ? p(f.data) : f.data;
35
- d(A), h = A;
36
- } catch (f) {
37
- throw u && d(null), f;
38
- } finally {
39
- !a && b(`loadData-${t}-${I}`);
40
- }
41
- return h;
42
- }, [
43
- x,
44
- n,
45
- a,
46
- C,
47
- t,
48
- c,
49
- m,
50
- p,
51
- u,
52
- b
53
- ]), v = e(async () => {
54
- r();
55
- }, [r]), B = e(async () => r(), [r]);
56
- return O(() => {
57
- if (i === !1)
58
- return;
59
- const o = new AbortController();
60
- return r(o.signal, ++y.current), () => {
61
- o.abort();
62
- };
63
- }, [r, i]), { data: R, setData: d, reloadData: v, isLoading: w, reloadDataWithReturn: B };
64
- }, X = (t, i) => {
65
- const n = e(() => {
66
- const s = localStorage.getItem(t);
67
- return s != null && s !== "undefined" ? JSON.parse(s) : i;
68
- }, [i, t]), [a, c] = g(n);
69
- O(() => {
70
- localStorage.setItem(t, JSON.stringify(a));
71
- }, [t, a]);
72
- const u = e(() => {
73
- c(n);
74
- }, [n]);
75
- return [a, c, u];
76
- };
77
- export {
78
- X as a,
79
- V as u
80
- };
@@ -1 +0,0 @@
1
- "use strict";const S=require("./nivo-bar-C5h-CRYO.cjs");require("react/jsx-runtime");const t=require("react");require("react-router");require("@tanstack/react-query");require("react-dom");require("react-hook-form");require("react-flexmonster");require("@azure/msal-browser");require("@azure/msal-react");const l={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},y=(e,{loadOnInit:u=l.loadOnInit,enabled:n=l.enabled,silent:a=l.silent,nullStateBeforeLoad:c=l.nullStateBeforeLoad,nullStateOnFail:i=l.nullStateOnFail,customApiUrl:o,customBearerToken:k,dataTransformer:g}=l)=>{const C=S.useAxios({silent:a,customToken:k,differentBaseUrl:o}),[O,L]=t.useState(!1),{startLoading:b,stopLoading:q}=t.useContext(S.LoadingContext),R=t.useRef(0),{isAuthenticated:D}=S.useAuth(),p=t.useCallback(s=>{b(s),L(()=>!0)},[b]),x=t.useCallback(s=>{q(s),L(()=>!1)},[q]),[$,d]=t.useState(null),r=t.useCallback(async(s,A)=>{if(!D()||n===!1)return null;!a&&p(`loadData-${e}-${A}`),c&&d(null);let I;try{const f=await C.get(e,{signal:s}),h=g?g(f.data):f.data;d(h),I=h}catch(f){throw i&&d(null),f}finally{!a&&x(`loadData-${e}-${A}`)}return I},[D,n,a,p,e,c,C,g,i,x]),v=t.useCallback(async()=>{r()},[r]),w=t.useCallback(async()=>r(),[r]);return t.useEffect(()=>{if(u===!1)return;const s=new AbortController;return r(s.signal,++R.current),()=>{s.abort()}},[r,u]),{data:$,setData:d,reloadData:v,isLoading:O,reloadDataWithReturn:w}},B=(e,u)=>{const n=t.useCallback(()=>{const o=localStorage.getItem(e);return o!=null&&o!=="undefined"?JSON.parse(o):u},[u,e]),[a,c]=t.useState(n);t.useEffect(()=>{localStorage.setItem(e,JSON.stringify(a))},[e,a]);const i=t.useCallback(()=>{c(n)},[n]);return[a,c,i]};exports.useGetApiData=y;exports.useLocalStorageState=B;