react-luminus-components 1.3.60 → 1.3.63
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 +8 -8
- package/dist/components/Form/NumericTextInput/NumericTextInput.d.ts +4 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/HookForm/NumericTextInput/HookFormNumericTextInput.d.ts +4 -0
- package/dist/components/HookForm/index.d.ts +1 -0
- package/dist/components/common/NumericFormat/NumericFormat.d.ts +9 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +1 -1
- package/dist/hooks/useGetApiData/useGetApiData.d.ts +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +1 -1
- package/dist/main.cjs.js +9 -1
- package/dist/main.d.ts +3 -2
- package/dist/main.es.js +3636 -3012
- package/dist/models/index.d.ts +2 -0
- package/dist/models/prop-types/FormInputProps/FormNumericTextInputProps.d.ts +8 -0
- package/dist/models/prop-types/HookFormInputProps/HookFormNumericTextInputProps.d.ts +5 -0
- package/dist/models/prop-types/InputProps/NumericInputProps.d.ts +5 -0
- package/dist/models/types/UseGetApiDataOptions.d.ts +2 -1
- package/dist/useLocalStorageState-CmWLfi7Q.cjs +1 -0
- package/dist/useLocalStorageState-DSpsMAVt.js +72 -0
- package/package.json +2 -1
- package/dist/useLocalStorageState-BIQ16AGb.js +0 -71
- package/dist/useLocalStorageState-COBxBKe_.cjs +0 -1
package/dist/models/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type { default as HookFormFileInputProps } from './prop-types/HookFormInp
|
|
|
24
24
|
export type { default as NumericInputProps } from './prop-types/InputProps/NumericInputProps';
|
|
25
25
|
export type { default as FormNumericStepperInputProps } from './prop-types/FormInputProps/FormNumericStepperInputProps';
|
|
26
26
|
export type { default as HookFormNumericStepperInputProps } from './prop-types/HookFormInputProps/HookFormNumericStepperInputProps';
|
|
27
|
+
export type { default as FormNumericTextInputProps } from './prop-types/FormInputProps/FormNumericTextInputProps';
|
|
28
|
+
export type { default as HookFormNumericTextInputProps } from './prop-types/HookFormInputProps/HookFormNumericTextInputProps';
|
|
27
29
|
export type { default as HookFormInputProps } from './prop-types/HookFormInputProps/HookFormInputProps';
|
|
28
30
|
export type { default as ContainerProps } from './prop-types/ContainerProps';
|
|
29
31
|
export type { default as ImgProps } from './prop-types/ImgProps';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as NumericInputProps } from '../InputProps/NumericInputProps';
|
|
2
|
+
|
|
3
|
+
type FormNumericTextInputProps = NumericInputProps & {
|
|
4
|
+
value: number | null;
|
|
5
|
+
onChange?: (value: number | null) => void;
|
|
6
|
+
debounceMs?: number;
|
|
7
|
+
};
|
|
8
|
+
export default FormNumericTextInputProps;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as HookFormInputBaseProps } from './HookFormInputBaseProps';
|
|
2
|
+
import { default as NumericInputProps } from '../InputProps/NumericInputProps';
|
|
3
|
+
|
|
4
|
+
type HookFormNumericStepperInputProps = HookFormInputBaseProps & NumericInputProps;
|
|
5
|
+
export default HookFormNumericStepperInputProps;
|
|
@@ -3,5 +3,10 @@ import { default as InputBaseProps } from './InputBaseProps';
|
|
|
3
3
|
type TextInputProps = InputBaseProps & {
|
|
4
4
|
stepperStep?: number;
|
|
5
5
|
step?: number | string;
|
|
6
|
+
numberPrefix?: string;
|
|
7
|
+
numberSuffix?: string;
|
|
8
|
+
decimalScale?: number;
|
|
9
|
+
CustomOnChangeComponent?: React.ReactElement;
|
|
10
|
+
noSelectOnFocus?: boolean;
|
|
6
11
|
};
|
|
7
12
|
export default TextInputProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type UseGetApiDataOptions = {
|
|
1
|
+
type UseGetApiDataOptions<StateType = any> = {
|
|
2
2
|
silent?: boolean;
|
|
3
3
|
loadOnInit?: boolean;
|
|
4
4
|
enabled?: boolean;
|
|
@@ -6,5 +6,6 @@ type UseGetApiDataOptions = {
|
|
|
6
6
|
nullStateOnFail?: boolean;
|
|
7
7
|
customApiUrl?: string;
|
|
8
8
|
customBearerToken?: string;
|
|
9
|
+
dataTransformer?: (queryResult: any) => StateType;
|
|
9
10
|
};
|
|
10
11
|
export default UseGetApiDataOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react"),g=require("./nivo-pie.es-DP0bHyrp.cjs");require("react-router-dom");require("react-hook-form");require("@azure/msal-browser");require("@azure/msal-react");const w=()=>{const{isShown:e,text:n,showPrompt:s,hidePrompt:a,resolveRef:o,setOptions:r}=t.useContext(g.PromptContext),l=t.useCallback(u=>{a(),o.current(u)},[a,o]),C=t.useCallback(async(u,S)=>(r(c=>({...c,...S})),s(u),new Promise(c=>{o.current=c})),[o,r,s]);return{isShown:e,text:n,prompt:C,onFinish:l}},i={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},A=(e,{loadOnInit:n=i.loadOnInit,enabled:s=i.enabled,silent:a=i.silent,nullStateBeforeLoad:o=i.nullStateBeforeLoad,nullStateOnFail:r=i.nullStateOnFail,customApiUrl:l,customBearerToken:C,dataTransformer:u}=i)=>{const S=g.useAxios({silent:a,customToken:C,differentBaseUrl:l}),{startLoading:c,stopLoading:m}=t.useContext(g.LoadingContext),x=t.useRef(0),{isAuthenticated:h}=g.useAuth(),[P,f]=t.useState(null),b=t.useCallback(async(p,D)=>{if(h()&&s!==!1){!a&&c(`loadData-${e}-${D}`),o&&f(null);try{const d=await S.get(e,{signal:p}),q=u?u(d.data):d.data;f(q),f(d.data)}catch(d){throw r&&f(null),d}finally{!a&&m(`loadData-${e}-${D}`)}}},[h,s,a,c,e,o,S,u,r,m]);return t.useEffect(()=>{if(n===!1)return;const p=new AbortController;return b(p.signal,++x.current),()=>{p.abort()}},[b,n]),{data:P,setData:f,reloadData:b}},L=(e,n)=>{const s=t.useCallback(()=>{const l=localStorage.getItem(e);return l?JSON.parse(l):n},[n,e]),[a,o]=t.useState(s);t.useEffect(()=>{localStorage.setItem(e,JSON.stringify(a))},[e,a]);const r=t.useCallback(()=>{o(s)},[s]);return[a,o,r]};exports.useGetApiData=A;exports.useLocalStorageState=L;exports.usePrompt=w;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useContext as b, useCallback as d, useRef as L, useState as w, useEffect as C } from "react";
|
|
2
|
+
import { as as P, a5 as $, ak as R, aa as v } from "./nivo-pie.es-B6Ojc01x.js";
|
|
3
|
+
import "react-router-dom";
|
|
4
|
+
import "react-hook-form";
|
|
5
|
+
import "@azure/msal-browser";
|
|
6
|
+
import "@azure/msal-react";
|
|
7
|
+
const G = () => {
|
|
8
|
+
const { isShown: t, text: s, showPrompt: o, hidePrompt: e, resolveRef: a, setOptions: n } = b(P), l = d((r) => {
|
|
9
|
+
e(), a.current(r);
|
|
10
|
+
}, [e, a]), S = d(async (r, p) => (n((c) => ({ ...c, ...p })), o(r), new Promise((c) => {
|
|
11
|
+
a.current = c;
|
|
12
|
+
})), [a, n, o]);
|
|
13
|
+
return { isShown: t, text: s, prompt: S, onFinish: l };
|
|
14
|
+
}, u = {
|
|
15
|
+
loadOnInit: !0,
|
|
16
|
+
silent: !1,
|
|
17
|
+
enabled: !0,
|
|
18
|
+
nullStateBeforeLoad: !0,
|
|
19
|
+
nullStateOnFail: !1
|
|
20
|
+
}, U = (t, { loadOnInit: s = u.loadOnInit, enabled: o = u.enabled, silent: e = u.silent, nullStateBeforeLoad: a = u.nullStateBeforeLoad, nullStateOnFail: n = u.nullStateOnFail, customApiUrl: l, customBearerToken: S, dataTransformer: r } = u) => {
|
|
21
|
+
const p = $({ silent: e, customToken: S, differentBaseUrl: l }), { startLoading: c, stopLoading: h } = b(R), O = L(0), { isAuthenticated: x } = v(), [A, i] = w(null), g = d(async (m, D) => {
|
|
22
|
+
if (x() && o !== !1) {
|
|
23
|
+
!e && c(`loadData-${t}-${D}`), a && i(null);
|
|
24
|
+
try {
|
|
25
|
+
const f = await p.get(t, {
|
|
26
|
+
signal: m
|
|
27
|
+
}), I = r ? r(f.data) : f.data;
|
|
28
|
+
i(I), i(f.data);
|
|
29
|
+
} catch (f) {
|
|
30
|
+
throw n && i(null), f;
|
|
31
|
+
} finally {
|
|
32
|
+
!e && h(`loadData-${t}-${D}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
x,
|
|
37
|
+
o,
|
|
38
|
+
e,
|
|
39
|
+
c,
|
|
40
|
+
t,
|
|
41
|
+
a,
|
|
42
|
+
p,
|
|
43
|
+
r,
|
|
44
|
+
n,
|
|
45
|
+
h
|
|
46
|
+
]);
|
|
47
|
+
return C(() => {
|
|
48
|
+
if (s === !1)
|
|
49
|
+
return;
|
|
50
|
+
const m = new AbortController();
|
|
51
|
+
return g(m.signal, ++O.current), () => {
|
|
52
|
+
m.abort();
|
|
53
|
+
};
|
|
54
|
+
}, [g, s]), { data: A, setData: i, reloadData: g };
|
|
55
|
+
}, j = (t, s) => {
|
|
56
|
+
const o = d(() => {
|
|
57
|
+
const l = localStorage.getItem(t);
|
|
58
|
+
return l ? JSON.parse(l) : s;
|
|
59
|
+
}, [s, t]), [e, a] = w(o);
|
|
60
|
+
C(() => {
|
|
61
|
+
localStorage.setItem(t, JSON.stringify(e));
|
|
62
|
+
}, [t, e]);
|
|
63
|
+
const n = d(() => {
|
|
64
|
+
a(o);
|
|
65
|
+
}, [o]);
|
|
66
|
+
return [e, a, n];
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
j as a,
|
|
70
|
+
U as b,
|
|
71
|
+
G as u
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-luminus-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.63",
|
|
4
4
|
"description": "Library of React Components reusable in Luminus projects (Fleetman, CAFM)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"latinize": "^2.0.0",
|
|
72
72
|
"react-cookie": "^7.1.4",
|
|
73
73
|
"react-hot-toast": "^2.4.1",
|
|
74
|
+
"react-number-format": "^5.4.0",
|
|
74
75
|
"react-portal": "^4.2.2",
|
|
75
76
|
"use-debounce": "^10.0.0",
|
|
76
77
|
"uuid": "^9.0.1"
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useContext as b, useCallback as i, useRef as A, useState as w, useEffect as C } from "react";
|
|
2
|
-
import { as as I, a5 as L, ak as P, aa as $ } from "./nivo-pie.es-B6Ojc01x.js";
|
|
3
|
-
import "react-router-dom";
|
|
4
|
-
import "react-hook-form";
|
|
5
|
-
import "@azure/msal-browser";
|
|
6
|
-
import "@azure/msal-react";
|
|
7
|
-
const N = () => {
|
|
8
|
-
const { isShown: t, text: s, showPrompt: o, hidePrompt: e, resolveRef: a, setOptions: n } = b(I), r = i((l) => {
|
|
9
|
-
e(), a.current(l);
|
|
10
|
-
}, [e, a]), m = i(async (l, f) => (n((c) => ({ ...c, ...f })), o(l), new Promise((c) => {
|
|
11
|
-
a.current = c;
|
|
12
|
-
})), [a, n, o]);
|
|
13
|
-
return { isShown: t, text: s, prompt: m, onFinish: r };
|
|
14
|
-
}, u = {
|
|
15
|
-
loadOnInit: !0,
|
|
16
|
-
silent: !1,
|
|
17
|
-
enabled: !0,
|
|
18
|
-
nullStateBeforeLoad: !0,
|
|
19
|
-
nullStateOnFail: !1
|
|
20
|
-
}, E = (t, { loadOnInit: s = u.loadOnInit, enabled: o = u.enabled, silent: e = u.silent, nullStateBeforeLoad: a = u.nullStateBeforeLoad, nullStateOnFail: n = u.nullStateOnFail, customApiUrl: r, customBearerToken: m } = u) => {
|
|
21
|
-
const l = L({ silent: e, customToken: m, differentBaseUrl: r }), { startLoading: f, stopLoading: c } = b(P), D = A(0), { isAuthenticated: h } = $(), [O, d] = w(null), S = i(async (p, x) => {
|
|
22
|
-
if (h() && o !== !1) {
|
|
23
|
-
!e && f(`loadData-${t}-${x}`), a && d(null);
|
|
24
|
-
try {
|
|
25
|
-
const g = await l.get(t, {
|
|
26
|
-
signal: p
|
|
27
|
-
});
|
|
28
|
-
d(g.data);
|
|
29
|
-
} catch (g) {
|
|
30
|
-
throw n && d(null), g;
|
|
31
|
-
} finally {
|
|
32
|
-
!e && c(`loadData-${t}-${x}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, [
|
|
36
|
-
o,
|
|
37
|
-
e,
|
|
38
|
-
f,
|
|
39
|
-
t,
|
|
40
|
-
a,
|
|
41
|
-
l,
|
|
42
|
-
n,
|
|
43
|
-
c,
|
|
44
|
-
h
|
|
45
|
-
]);
|
|
46
|
-
return C(() => {
|
|
47
|
-
if (s === !1)
|
|
48
|
-
return;
|
|
49
|
-
const p = new AbortController();
|
|
50
|
-
return S(p.signal, ++D.current), () => {
|
|
51
|
-
p.abort();
|
|
52
|
-
};
|
|
53
|
-
}, [S, s]), { data: O, setData: d, reloadData: S };
|
|
54
|
-
}, G = (t, s) => {
|
|
55
|
-
const o = i(() => {
|
|
56
|
-
const r = localStorage.getItem(t);
|
|
57
|
-
return r ? JSON.parse(r) : s;
|
|
58
|
-
}, [s, t]), [e, a] = w(o);
|
|
59
|
-
C(() => {
|
|
60
|
-
localStorage.setItem(t, JSON.stringify(e));
|
|
61
|
-
}, [t, e]);
|
|
62
|
-
const n = i(() => {
|
|
63
|
-
a(o);
|
|
64
|
-
}, [o]);
|
|
65
|
-
return [e, a, n];
|
|
66
|
-
};
|
|
67
|
-
export {
|
|
68
|
-
G as a,
|
|
69
|
-
E as b,
|
|
70
|
-
N as u
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("react"),p=require("./nivo-pie.es-DP0bHyrp.cjs");require("react-router-dom");require("react-hook-form");require("@azure/msal-browser");require("@azure/msal-react");const P=()=>{const{isShown:e,text:r,showPrompt:s,hidePrompt:a,resolveRef:o,setOptions:n}=t.useContext(p.PromptContext),u=t.useCallback(l=>{a(),o.current(l)},[a,o]),g=t.useCallback(async(l,f)=>(n(c=>({...c,...f})),s(l),new Promise(c=>{o.current=c})),[o,n,s]);return{isShown:e,text:r,prompt:g,onFinish:u}},i={loadOnInit:!0,silent:!1,enabled:!0,nullStateBeforeLoad:!0,nullStateOnFail:!1},q=(e,{loadOnInit:r=i.loadOnInit,enabled:s=i.enabled,silent:a=i.silent,nullStateBeforeLoad:o=i.nullStateBeforeLoad,nullStateOnFail:n=i.nullStateOnFail,customApiUrl:u,customBearerToken:g}=i)=>{const l=p.useAxios({silent:a,customToken:g,differentBaseUrl:u}),{startLoading:f,stopLoading:c}=t.useContext(p.LoadingContext),x=t.useRef(0),{isAuthenticated:b}=p.useAuth(),[D,d]=t.useState(null),C=t.useCallback(async(S,h)=>{if(b()&&s!==!1){!a&&f(`loadData-${e}-${h}`),o&&d(null);try{const m=await l.get(e,{signal:S});d(m.data)}catch(m){throw n&&d(null),m}finally{!a&&c(`loadData-${e}-${h}`)}}},[s,a,f,e,o,l,n,c,b]);return t.useEffect(()=>{if(r===!1)return;const S=new AbortController;return C(S.signal,++x.current),()=>{S.abort()}},[C,r]),{data:D,setData:d,reloadData:C}},w=(e,r)=>{const s=t.useCallback(()=>{const u=localStorage.getItem(e);return u?JSON.parse(u):r},[r,e]),[a,o]=t.useState(s);t.useEffect(()=>{localStorage.setItem(e,JSON.stringify(a))},[e,a]);const n=t.useCallback(()=>{o(s)},[s]);return[a,o,n]};exports.useGetApiData=q;exports.useLocalStorageState=w;exports.usePrompt=P;
|