@krosoft/react 0.0.20 → 0.0.22
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/KpiCards-DhstZUeY.js +336 -0
- package/dist/{LoadingState-C91zWRVu.js → LoadingState-Br3lWjL2.js} +4 -5
- package/dist/badge-CS99D5mG.js +26 -0
- package/dist/components/core/cards/KpiCard.d.ts +13 -0
- package/dist/components/core/cards/KpiCard.d.ts.map +1 -0
- package/dist/components/core/cards/KpiCards.d.ts +7 -0
- package/dist/components/core/cards/KpiCards.d.ts.map +1 -0
- package/dist/components/core/cards/index.d.ts +4 -0
- package/dist/components/core/cards/index.d.ts.map +1 -0
- package/dist/components/core/cards/index.js +5 -0
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.d.ts.map +1 -1
- package/dist/components/core/index.js +6 -3
- package/dist/components/core/states/index.js +1 -1
- package/dist/components/index.js +27 -15
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/index.d.ts +3 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +20 -11
- package/dist/helpers/index.js +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +28 -38
- package/dist/hooks/ui/useMobile.d.ts.map +1 -1
- package/dist/hooks/ui/useNotifications.d.ts +5 -4
- package/dist/hooks/ui/useNotifications.d.ts.map +1 -1
- package/dist/{index-DxGGCUCL.js → index-gWiv5-6R.js} +2 -2
- package/dist/{toast-DZWzsFB2.js → toast-CUZ-UU-l.js} +412 -384
- package/package.json +7 -3
package/dist/hooks/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as S from "react";
|
|
2
2
|
import { useState as E, useEffect as m } from "react";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
3
|
+
const u = 768;
|
|
4
|
+
function _() {
|
|
5
5
|
const [t, s] = E(!1);
|
|
6
6
|
return m(() => {
|
|
7
|
-
const e = window.matchMedia(`(max-width: ${
|
|
8
|
-
s(window.innerWidth <
|
|
7
|
+
const e = window.matchMedia(`(max-width: ${String(u - 1)}px)`), o = () => {
|
|
8
|
+
s(window.innerWidth < u);
|
|
9
9
|
};
|
|
10
|
-
return e.addEventListener("change", o), s(window.innerWidth <
|
|
10
|
+
return e.addEventListener("change", o), s(window.innerWidth < u), () => e.removeEventListener("change", o);
|
|
11
11
|
}, []), t;
|
|
12
12
|
}
|
|
13
13
|
const p = 1, A = 1e6;
|
|
14
|
-
let
|
|
14
|
+
let a = 0;
|
|
15
15
|
function h() {
|
|
16
|
-
return
|
|
16
|
+
return a = (a + 1) % Number.MAX_SAFE_INTEGER, a.toString();
|
|
17
17
|
}
|
|
18
|
-
const T = /* @__PURE__ */ new Map(),
|
|
18
|
+
const T = /* @__PURE__ */ new Map(), f = (t) => {
|
|
19
19
|
if (T.has(t))
|
|
20
20
|
return;
|
|
21
21
|
const s = setTimeout(() => {
|
|
@@ -39,8 +39,8 @@ const T = /* @__PURE__ */ new Map(), S = (t) => {
|
|
|
39
39
|
};
|
|
40
40
|
case "DISMISS_TOAST": {
|
|
41
41
|
const { toastId: e } = s;
|
|
42
|
-
return e ?
|
|
43
|
-
|
|
42
|
+
return e ? f(e) : t.toasts.forEach((o) => {
|
|
43
|
+
f(o.id);
|
|
44
44
|
}), {
|
|
45
45
|
...t,
|
|
46
46
|
toasts: t.toasts.map(
|
|
@@ -67,7 +67,7 @@ function r(t) {
|
|
|
67
67
|
s(c);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function d({ ...t }) {
|
|
71
71
|
const s = h(), e = (n) => r({
|
|
72
72
|
type: "UPDATE_TOAST",
|
|
73
73
|
toast: { ...n, id: s }
|
|
@@ -88,38 +88,28 @@ function l({ ...t }) {
|
|
|
88
88
|
update: e
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const [t, s] =
|
|
93
|
-
return
|
|
91
|
+
function I() {
|
|
92
|
+
const [t, s] = S.useState(c);
|
|
93
|
+
return S.useEffect(() => (i.push(s), () => {
|
|
94
94
|
const e = i.indexOf(s);
|
|
95
95
|
e > -1 && i.splice(e, 1);
|
|
96
96
|
}), [t]), {
|
|
97
97
|
...t,
|
|
98
|
-
toast:
|
|
98
|
+
toast: d,
|
|
99
99
|
dismiss: (e) => r({ type: "DISMISS_TOAST", toastId: e })
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
showError: (o, n, f) => {
|
|
112
|
-
console.error(n, f), t({
|
|
113
|
-
title: o,
|
|
114
|
-
description: n,
|
|
115
|
-
variant: "destructive"
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
};
|
|
102
|
+
const M = () => ({
|
|
103
|
+
showSuccess: (e, o) => {
|
|
104
|
+
d({ title: e, description: o });
|
|
105
|
+
},
|
|
106
|
+
showError: (e, o, n) => {
|
|
107
|
+
console.error(o, n), d({ title: e, description: o, variant: "destructive" });
|
|
108
|
+
}
|
|
109
|
+
});
|
|
120
110
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
d as toast,
|
|
112
|
+
_ as useMobile,
|
|
113
|
+
M as useNotifications,
|
|
114
|
+
I as useToast
|
|
125
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMobile.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useMobile.tsx"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,
|
|
1
|
+
{"version":3,"file":"useMobile.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useMobile.tsx"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,IAAI,OAAO,CAcnC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
showSuccess: (title: string, description?: string
|
|
3
|
-
showError: (title: string, description?: string
|
|
4
|
-
}
|
|
1
|
+
export interface UseNotificationsResult {
|
|
2
|
+
showSuccess: (title: string, description?: string) => void;
|
|
3
|
+
showError: (title: string, description?: string, error?: Error | null) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const useNotifications: () => UseNotificationsResult;
|
|
5
6
|
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useNotifications.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useNotifications.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;CAChF;AAED,eAAO,MAAM,gBAAgB,QAAO,sBAcnC,CAAC"}
|