@krosoft/react 0.0.14 → 0.0.16
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-CEoOCk2t.js +132 -0
- package/dist/components/core/index.js +3 -2
- package/dist/components/core/states/LoadingState.d.ts +6 -0
- package/dist/components/core/states/LoadingState.d.ts.map +1 -0
- package/dist/components/core/states/index.d.ts +1 -0
- package/dist/components/core/states/index.d.ts.map +1 -1
- package/dist/components/core/states/index.js +3 -2
- package/dist/components/index.js +9 -8
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/hooks/ui/useMobile.d.ts +2 -0
- package/dist/hooks/ui/useMobile.d.ts.map +1 -0
- package/dist/hooks/ui/useNotifications.d.ts +5 -0
- package/dist/hooks/ui/useNotifications.d.ts.map +1 -0
- package/dist/hooks/ui/useToast.d.ts +45 -0
- package/dist/hooks/ui/useToast.d.ts.map +1 -0
- package/package.json +3 -1
- package/dist/ErrorState-CghWXpM0.js +0 -8
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as N, createContext as y, forwardRef as h, createElement as l } from "react";
|
|
3
|
+
const P = ({ message: e }) => /* @__PURE__ */ p("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-md animate-fade-in", children: [
|
|
4
|
+
/* @__PURE__ */ a("p", { className: "font-semibold mb-2", children: "Une erreur est survenue." }),
|
|
5
|
+
e ? /* @__PURE__ */ a("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 x = (...e) => e.filter((t, r, o) => !!t && t.trim() !== "" && o.indexOf(t) === r).join(" ").trim();
|
|
14
|
+
/**
|
|
15
|
+
* @license lucide-react v1.7.0 - ISC
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the ISC license.
|
|
18
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
const A = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
21
|
+
/**
|
|
22
|
+
* @license lucide-react v1.7.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
const S = (e) => e.replace(
|
|
28
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
29
|
+
(t, r, o) => o ? o.toUpperCase() : r.toLowerCase()
|
|
30
|
+
);
|
|
31
|
+
/**
|
|
32
|
+
* @license lucide-react v1.7.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
const m = (e) => {
|
|
38
|
+
const t = S(e);
|
|
39
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @license lucide-react v1.7.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
var i = {
|
|
48
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
49
|
+
width: 24,
|
|
50
|
+
height: 24,
|
|
51
|
+
viewBox: "0 0 24 24",
|
|
52
|
+
fill: "none",
|
|
53
|
+
stroke: "currentColor",
|
|
54
|
+
strokeWidth: 2,
|
|
55
|
+
strokeLinecap: "round",
|
|
56
|
+
strokeLinejoin: "round"
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @license lucide-react v1.7.0 - ISC
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the ISC license.
|
|
62
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/
|
|
64
|
+
const W = (e) => {
|
|
65
|
+
for (const t in e)
|
|
66
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
67
|
+
return !0;
|
|
68
|
+
return !1;
|
|
69
|
+
}, j = y({}), $ = () => N(j), z = h(
|
|
70
|
+
({ color: e, size: t, strokeWidth: r, absoluteStrokeWidth: o, className: n = "", children: s, iconNode: f, ...d }, C) => {
|
|
71
|
+
const {
|
|
72
|
+
size: c = 24,
|
|
73
|
+
strokeWidth: u = 2,
|
|
74
|
+
absoluteStrokeWidth: b = !1,
|
|
75
|
+
color: w = "currentColor",
|
|
76
|
+
className: k = ""
|
|
77
|
+
} = $() ?? {}, g = o ?? b ? Number(r ?? u) * 24 / Number(t ?? c) : r ?? u;
|
|
78
|
+
return l(
|
|
79
|
+
"svg",
|
|
80
|
+
{
|
|
81
|
+
ref: C,
|
|
82
|
+
...i,
|
|
83
|
+
width: t ?? c ?? i.width,
|
|
84
|
+
height: t ?? c ?? i.height,
|
|
85
|
+
stroke: e ?? w,
|
|
86
|
+
strokeWidth: g,
|
|
87
|
+
className: x("lucide", k, n),
|
|
88
|
+
...!s && !W(d) && { "aria-hidden": "true" },
|
|
89
|
+
...d
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
...f.map(([v, L]) => l(v, L)),
|
|
93
|
+
...Array.isArray(s) ? s : [s]
|
|
94
|
+
]
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
/**
|
|
99
|
+
* @license lucide-react v1.7.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/
|
|
104
|
+
const E = (e, t) => {
|
|
105
|
+
const r = h(
|
|
106
|
+
({ className: o, ...n }, s) => l(z, {
|
|
107
|
+
ref: s,
|
|
108
|
+
iconNode: t,
|
|
109
|
+
className: x(
|
|
110
|
+
`lucide-${A(m(e))}`,
|
|
111
|
+
`lucide-${e}`,
|
|
112
|
+
o
|
|
113
|
+
),
|
|
114
|
+
...n
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
return r.displayName = m(e), r;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @license lucide-react v1.7.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/
|
|
125
|
+
const U = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], _ = E("loader-circle", U), Z = ({ message: e }) => /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in", children: [
|
|
126
|
+
/* @__PURE__ */ a(_, { className: "size-8 animate-spin mb-4 text-primary" }),
|
|
127
|
+
e ? /* @__PURE__ */ a("p", { className: "font-semibold text-sm", children: e }) : null
|
|
128
|
+
] });
|
|
129
|
+
export {
|
|
130
|
+
P as E,
|
|
131
|
+
Z as L
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingState.d.ts","sourceRoot":"","sources":["../../../../src/components/core/states/LoadingState.tsx"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,GAAI,aAAa,iBAAiB,KAAG,KAAK,CAAC,GAAG,CAAC,OAOvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/core/states/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/core/states/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { E as e } from "../
|
|
2
|
-
import { A as
|
|
1
|
+
import { E as t, L as e } from "../LoadingState-CEoOCk2t.js";
|
|
2
|
+
import { A as o, a as i, b as l, B as A, c as d } from "../badge-DUEyCWfa.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
o as Alert,
|
|
5
|
+
i as AlertDescription,
|
|
6
|
+
l as AlertTitle,
|
|
7
|
+
A as Badge,
|
|
8
|
+
t as ErrorState,
|
|
9
|
+
e as LoadingState,
|
|
10
|
+
d as badgeVariants
|
|
10
11
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
|
|
5
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
6
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
|
|
7
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
14
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
15
|
+
export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
|
16
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa,8CAA2B,CAAC;AAE/C,QAAA,MAAM,aAAa,kKAYjB,CAAC;AAmBH,QAAA,MAAM,KAAK;;qHAYT,CAAC;AAGH,QAAA,MAAM,WAAW,kKAYf,CAAC;AAGH,QAAA,MAAM,UAAU,iKAcd,CAAC;AAGH,QAAA,MAAM,UAAU,2JASd,CAAC;AAGH,QAAA,MAAM,gBAAgB,iKASpB,CAAC;AAGH,KAAK,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AAE/D,KAAK,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMobile.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useMobile.tsx"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,YAcxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useNotifications.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;yBAGC,MAAM,gBAAgB,MAAM,GAAG,SAAS;uBAQ3D,MAAM,gBACC,MAAM,GAAG,SAAS,UACxB,KAAK,GAAG,IAAI;CAcvB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ToastActionElement, ToastProps } from "../../components/ui/toast";
|
|
3
|
+
type ToasterToast = ToastProps & {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
action?: ToastActionElement;
|
|
8
|
+
};
|
|
9
|
+
declare const actionTypes: {
|
|
10
|
+
readonly ADD_TOAST: "ADD_TOAST";
|
|
11
|
+
readonly UPDATE_TOAST: "UPDATE_TOAST";
|
|
12
|
+
readonly DISMISS_TOAST: "DISMISS_TOAST";
|
|
13
|
+
readonly REMOVE_TOAST: "REMOVE_TOAST";
|
|
14
|
+
};
|
|
15
|
+
type ActionType = typeof actionTypes;
|
|
16
|
+
type Action = {
|
|
17
|
+
type: ActionType["ADD_TOAST"];
|
|
18
|
+
toast: ToasterToast;
|
|
19
|
+
} | {
|
|
20
|
+
type: ActionType["UPDATE_TOAST"];
|
|
21
|
+
toast: Partial<ToasterToast>;
|
|
22
|
+
} | {
|
|
23
|
+
type: ActionType["DISMISS_TOAST"];
|
|
24
|
+
toastId?: ToasterToast["id"];
|
|
25
|
+
} | {
|
|
26
|
+
type: ActionType["REMOVE_TOAST"];
|
|
27
|
+
toastId?: ToasterToast["id"];
|
|
28
|
+
};
|
|
29
|
+
interface State {
|
|
30
|
+
toasts: ToasterToast[];
|
|
31
|
+
}
|
|
32
|
+
export declare const reducer: (state: State, action: Action) => State;
|
|
33
|
+
type Toast = Omit<ToasterToast, "id">;
|
|
34
|
+
declare function toast({ ...props }: Toast): {
|
|
35
|
+
id: string;
|
|
36
|
+
dismiss: () => void;
|
|
37
|
+
update: (props: ToasterToast) => void;
|
|
38
|
+
};
|
|
39
|
+
declare function useToast(): {
|
|
40
|
+
toast: typeof toast;
|
|
41
|
+
dismiss: (toastId?: string) => void;
|
|
42
|
+
toasts: ToasterToast[];
|
|
43
|
+
};
|
|
44
|
+
export { useToast, toast };
|
|
45
|
+
//# sourceMappingURL=useToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useToast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAKhF,KAAK,YAAY,GAAG,UAAU,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;CAKP,CAAC;AASX,KAAK,UAAU,GAAG,OAAO,WAAW,CAAC;AAErC,KAAK,MAAM,GACP;IACE,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9B,KAAK,EAAE,YAAY,CAAC;CACrB,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEN,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAoBD,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,MAAM,KAAG,KAmDtD,CAAC;AAaF,KAAK,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAEtC,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK;;;oBAGT,YAAY;EAwBpC;AAED,iBAAS,QAAQ;;wBAgBO,MAAM;YApIpB,YAAY,EAAE;EAsIvB;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krosoft/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Krosoft shared React package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
"react": ">=18.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
35
36
|
"class-variance-authority": "^0.7.1",
|
|
36
37
|
"clsx": "^2.1.1",
|
|
38
|
+
"lucide-react": "^1.7.0",
|
|
37
39
|
"tailwind-merge": "^2.6.1"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
const d = ({ message: e }) => /* @__PURE__ */ t("div", { className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-md animate-fade-in", children: [
|
|
3
|
-
/* @__PURE__ */ r("p", { className: "font-semibold mb-2", children: "Une erreur est survenue." }),
|
|
4
|
-
e ? /* @__PURE__ */ r("p", { className: "text-sm opacity-80", children: e }) : null
|
|
5
|
-
] });
|
|
6
|
-
export {
|
|
7
|
-
d as E
|
|
8
|
-
};
|