@krosoft/react 0.0.18 → 0.0.20
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/LoadingState-C91zWRVu.js +20 -0
- package/dist/components/core/index.js +1 -1
- package/dist/components/core/states/index.js +1 -1
- package/dist/components/index.js +14 -7
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +12 -5
- package/dist/createLucideIcon-BxMj32TH.js +116 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +125 -1
- package/dist/toast-DZWzsFB2.js +1064 -0
- package/package.json +4 -4
- package/dist/LoadingState-CEoOCk2t.js +0 -132
- package/dist/badge-DUEyCWfa.js +0 -79
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as a } from "./createLucideIcon-BxMj32TH.js";
|
|
3
|
+
const d = ({ message: e }) => /* @__PURE__ */ r("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-md animate-fade-in", children: [
|
|
4
|
+
/* @__PURE__ */ t("p", { className: "font-semibold mb-2", children: "Une erreur est survenue." }),
|
|
5
|
+
e ? /* @__PURE__ */ t("p", { className: "text-sm opacity-80", children: e }) : null
|
|
6
|
+
] });
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v1.7.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
const s = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], c = a("loader-circle", s), o = ({ message: e }) => /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in", children: [
|
|
14
|
+
/* @__PURE__ */ t(c, { className: "size-8 animate-spin mb-4 text-primary" }),
|
|
15
|
+
e ? /* @__PURE__ */ t("p", { className: "font-semibold text-sm", children: e }) : null
|
|
16
|
+
] });
|
|
17
|
+
export {
|
|
18
|
+
d as E,
|
|
19
|
+
o as L
|
|
20
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { E as t, L as
|
|
2
|
-
import { A as
|
|
1
|
+
import { E as t, L as o } from "../LoadingState-C91zWRVu.js";
|
|
2
|
+
import { A as r, a as i, b as T, B as l, T as d, c as n, d as p, e as A, f as c, g, h as f, i as b } from "../toast-DZWzsFB2.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
r as Alert,
|
|
5
5
|
i as AlertDescription,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
T as AlertTitle,
|
|
7
|
+
l as Badge,
|
|
8
8
|
t as ErrorState,
|
|
9
|
-
|
|
10
|
-
d as
|
|
9
|
+
o as LoadingState,
|
|
10
|
+
d as Toast,
|
|
11
|
+
n as ToastAction,
|
|
12
|
+
p as ToastClose,
|
|
13
|
+
A as ToastDescription,
|
|
14
|
+
c as ToastProvider,
|
|
15
|
+
g as ToastTitle,
|
|
16
|
+
f as ToastViewport,
|
|
17
|
+
b as badgeVariants
|
|
11
18
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { Alert, AlertTitle, AlertDescription } from "./alert";
|
|
2
2
|
export { Badge, badgeVariants } from "./badge";
|
|
3
3
|
export type { BadgeProps } from "./badge";
|
|
4
|
+
export { Toast, ToastProvider, ToastViewport, ToastTitle, ToastDescription, ToastClose, ToastAction } from "./toast";
|
|
5
|
+
export type { ToastProps, ToastActionElement } from "./toast";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACrH,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as t, a as o, b as e, B as i, T as r, c as T, d as l, e as A, f as c, g as d, h as n, i as p } from "../../toast-DZWzsFB2.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
t as Alert,
|
|
4
|
+
o as AlertDescription,
|
|
5
|
+
e as AlertTitle,
|
|
6
6
|
i as Badge,
|
|
7
|
-
|
|
7
|
+
r as Toast,
|
|
8
|
+
T as ToastAction,
|
|
9
|
+
l as ToastClose,
|
|
10
|
+
A as ToastDescription,
|
|
11
|
+
c as ToastProvider,
|
|
12
|
+
d as ToastTitle,
|
|
13
|
+
n as ToastViewport,
|
|
14
|
+
p as badgeVariants
|
|
8
15
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useContext as b, createContext as L, forwardRef as C, createElement as i } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v1.7.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const h = (...e) => e.filter((t, o, r) => !!t && t.trim() !== "" && r.indexOf(t) === o).join(" ").trim();
|
|
9
|
+
/**
|
|
10
|
+
* @license lucide-react v1.7.0 - ISC
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the ISC license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const W = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
16
|
+
/**
|
|
17
|
+
* @license lucide-react v1.7.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
const S = (e) => e.replace(
|
|
23
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
24
|
+
(t, o, r) => r ? r.toUpperCase() : o.toLowerCase()
|
|
25
|
+
);
|
|
26
|
+
/**
|
|
27
|
+
* @license lucide-react v1.7.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/
|
|
32
|
+
const d = (e) => {
|
|
33
|
+
const t = S(e);
|
|
34
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @license lucide-react v1.7.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/
|
|
42
|
+
var c = {
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
width: 24,
|
|
45
|
+
height: 24,
|
|
46
|
+
viewBox: "0 0 24 24",
|
|
47
|
+
fill: "none",
|
|
48
|
+
stroke: "currentColor",
|
|
49
|
+
strokeWidth: 2,
|
|
50
|
+
strokeLinecap: "round",
|
|
51
|
+
strokeLinejoin: "round"
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @license lucide-react v1.7.0 - ISC
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the ISC license.
|
|
57
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/
|
|
59
|
+
const v = (e) => {
|
|
60
|
+
for (const t in e)
|
|
61
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
62
|
+
return !0;
|
|
63
|
+
return !1;
|
|
64
|
+
}, y = L({}), $ = () => b(y), j = C(
|
|
65
|
+
({ color: e, size: t, strokeWidth: o, absoluteStrokeWidth: r, className: a = "", children: s, iconNode: p, ...l }, m) => {
|
|
66
|
+
const {
|
|
67
|
+
size: n = 24,
|
|
68
|
+
strokeWidth: u = 2,
|
|
69
|
+
absoluteStrokeWidth: x = !1,
|
|
70
|
+
color: w = "currentColor",
|
|
71
|
+
className: f = ""
|
|
72
|
+
} = $() ?? {}, k = r ?? x ? Number(o ?? u) * 24 / Number(t ?? n) : o ?? u;
|
|
73
|
+
return i(
|
|
74
|
+
"svg",
|
|
75
|
+
{
|
|
76
|
+
ref: m,
|
|
77
|
+
...c,
|
|
78
|
+
width: t ?? n ?? c.width,
|
|
79
|
+
height: t ?? n ?? c.height,
|
|
80
|
+
stroke: e ?? w,
|
|
81
|
+
strokeWidth: k,
|
|
82
|
+
className: h("lucide", f, a),
|
|
83
|
+
...!s && !v(l) && { "aria-hidden": "true" },
|
|
84
|
+
...l
|
|
85
|
+
},
|
|
86
|
+
[
|
|
87
|
+
...p.map(([g, A]) => i(g, A)),
|
|
88
|
+
...Array.isArray(s) ? s : [s]
|
|
89
|
+
]
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
/**
|
|
94
|
+
* @license lucide-react v1.7.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/
|
|
99
|
+
const I = (e, t) => {
|
|
100
|
+
const o = C(
|
|
101
|
+
({ className: r, ...a }, s) => i(j, {
|
|
102
|
+
ref: s,
|
|
103
|
+
iconNode: t,
|
|
104
|
+
className: h(
|
|
105
|
+
`lucide-${W(d(e))}`,
|
|
106
|
+
`lucide-${e}`,
|
|
107
|
+
r
|
|
108
|
+
),
|
|
109
|
+
...a
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
return o.displayName = d(e), o;
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
I as c
|
|
116
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1,125 @@
|
|
|
1
|
-
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useState as E, useEffect as m } from "react";
|
|
3
|
+
const a = 768;
|
|
4
|
+
function M() {
|
|
5
|
+
const [t, s] = E(!1);
|
|
6
|
+
return m(() => {
|
|
7
|
+
const e = window.matchMedia(`(max-width: ${a - 1}px)`), o = () => {
|
|
8
|
+
s(window.innerWidth < a);
|
|
9
|
+
};
|
|
10
|
+
return e.addEventListener("change", o), s(window.innerWidth < a), () => e.removeEventListener("change", o);
|
|
11
|
+
}, []), t;
|
|
12
|
+
}
|
|
13
|
+
const p = 1, A = 1e6;
|
|
14
|
+
let u = 0;
|
|
15
|
+
function h() {
|
|
16
|
+
return u = (u + 1) % Number.MAX_SAFE_INTEGER, u.toString();
|
|
17
|
+
}
|
|
18
|
+
const T = /* @__PURE__ */ new Map(), S = (t) => {
|
|
19
|
+
if (T.has(t))
|
|
20
|
+
return;
|
|
21
|
+
const s = setTimeout(() => {
|
|
22
|
+
T.delete(t), r({
|
|
23
|
+
type: "REMOVE_TOAST",
|
|
24
|
+
toastId: t
|
|
25
|
+
});
|
|
26
|
+
}, A);
|
|
27
|
+
T.set(t, s);
|
|
28
|
+
}, O = (t, s) => {
|
|
29
|
+
switch (s.type) {
|
|
30
|
+
case "ADD_TOAST":
|
|
31
|
+
return {
|
|
32
|
+
...t,
|
|
33
|
+
toasts: [s.toast, ...t.toasts].slice(0, p)
|
|
34
|
+
};
|
|
35
|
+
case "UPDATE_TOAST":
|
|
36
|
+
return {
|
|
37
|
+
...t,
|
|
38
|
+
toasts: t.toasts.map((e) => e.id === s.toast.id ? { ...e, ...s.toast } : e)
|
|
39
|
+
};
|
|
40
|
+
case "DISMISS_TOAST": {
|
|
41
|
+
const { toastId: e } = s;
|
|
42
|
+
return e ? S(e) : t.toasts.forEach((o) => {
|
|
43
|
+
S(o.id);
|
|
44
|
+
}), {
|
|
45
|
+
...t,
|
|
46
|
+
toasts: t.toasts.map(
|
|
47
|
+
(o) => o.id === e || e === void 0 ? {
|
|
48
|
+
...o,
|
|
49
|
+
open: !1
|
|
50
|
+
} : o
|
|
51
|
+
)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
case "REMOVE_TOAST":
|
|
55
|
+
return s.toastId === void 0 ? {
|
|
56
|
+
...t,
|
|
57
|
+
toasts: []
|
|
58
|
+
} : {
|
|
59
|
+
...t,
|
|
60
|
+
toasts: t.toasts.filter((e) => e.id !== s.toastId)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}, i = [];
|
|
64
|
+
let c = { toasts: [] };
|
|
65
|
+
function r(t) {
|
|
66
|
+
c = O(c, t), i.forEach((s) => {
|
|
67
|
+
s(c);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function l({ ...t }) {
|
|
71
|
+
const s = h(), e = (n) => r({
|
|
72
|
+
type: "UPDATE_TOAST",
|
|
73
|
+
toast: { ...n, id: s }
|
|
74
|
+
}), o = () => r({ type: "DISMISS_TOAST", toastId: s });
|
|
75
|
+
return r({
|
|
76
|
+
type: "ADD_TOAST",
|
|
77
|
+
toast: {
|
|
78
|
+
...t,
|
|
79
|
+
id: s,
|
|
80
|
+
open: !0,
|
|
81
|
+
onOpenChange: (n) => {
|
|
82
|
+
n || o();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}), {
|
|
86
|
+
id: s,
|
|
87
|
+
dismiss: o,
|
|
88
|
+
update: e
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function _() {
|
|
92
|
+
const [t, s] = d.useState(c);
|
|
93
|
+
return d.useEffect(() => (i.push(s), () => {
|
|
94
|
+
const e = i.indexOf(s);
|
|
95
|
+
e > -1 && i.splice(e, 1);
|
|
96
|
+
}), [t]), {
|
|
97
|
+
...t,
|
|
98
|
+
toast: l,
|
|
99
|
+
dismiss: (e) => r({ type: "DISMISS_TOAST", toastId: e })
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const w = () => {
|
|
103
|
+
const { toast: t } = _();
|
|
104
|
+
return {
|
|
105
|
+
showSuccess: (o, n) => {
|
|
106
|
+
t({
|
|
107
|
+
title: o,
|
|
108
|
+
description: n
|
|
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
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
l as toast,
|
|
122
|
+
M as useMobile,
|
|
123
|
+
w as useNotifications,
|
|
124
|
+
_ as useToast
|
|
125
|
+
};
|