@mehdashti/ui 0.1.0
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/README.md +228 -0
- package/dist/components/__tests__/button.test.d.ts +2 -0
- package/dist/components/__tests__/button.test.d.ts.map +1 -0
- package/dist/components/__tests__/button.test.js +105 -0
- package/dist/components/__tests__/button.test.js.map +1 -0
- package/dist/components/__tests__/input.test.d.ts +2 -0
- package/dist/components/__tests__/input.test.d.ts.map +1 -0
- package/dist/components/__tests__/input.test.js +270 -0
- package/dist/components/__tests__/input.test.js.map +1 -0
- package/dist/components/__tests__/label.test.d.ts +2 -0
- package/dist/components/__tests__/label.test.d.ts.map +1 -0
- package/dist/components/__tests__/label.test.js +181 -0
- package/dist/components/__tests__/label.test.js.map +1 -0
- package/dist/components/button.d.ts +28 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +45 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/button.stories.js +103 -0
- package/dist/components/button.stories.js.map +1 -0
- package/dist/components/dialog.d.ts +20 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +22 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dialog.stories.d.ts +44 -0
- package/dist/components/dialog.stories.d.ts.map +1 -0
- package/dist/components/dialog.stories.js +64 -0
- package/dist/components/dialog.stories.js.map +1 -0
- package/dist/components/input.d.ts +14 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +17 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/input.stories.d.ts +80 -0
- package/dist/components/input.stories.d.ts.map +1 -0
- package/dist/components/input.stories.js +142 -0
- package/dist/components/input.stories.js.map +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +10 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/label.stories.d.ts +52 -0
- package/dist/components/label.stories.d.ts.map +1 -0
- package/dist/components/label.stories.js +74 -0
- package/dist/components/label.stories.js.map +1 -0
- package/dist/components/select.d.ts +14 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +26 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/select.stories.d.ts +48 -0
- package/dist/components/select.stories.d.ts.map +1 -0
- package/dist/components/select.stories.js +67 -0
- package/dist/components/select.stories.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +21 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +13 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tabs.stories.d.ts +40 -0
- package/dist/components/tabs.stories.d.ts.map +1 -0
- package/dist/components/tabs.stories.js +100 -0
- package/dist/components/tabs.stories.js.map +1 -0
- package/dist/components/toast.d.ts +16 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +34 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toast.stories.d.ts +371 -0
- package/dist/components/toast.stories.d.ts.map +1 -0
- package/dist/components/toast.stories.js +228 -0
- package/dist/components/toast.stories.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +125 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ToastActionElement, ToastProps } from "../components/toast.js";
|
|
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=use-toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast.d.ts","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":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QAAQ,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const TOAST_LIMIT = 5;
|
|
3
|
+
const TOAST_REMOVE_DELAY = 1000000;
|
|
4
|
+
const actionTypes = {
|
|
5
|
+
ADD_TOAST: "ADD_TOAST",
|
|
6
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
7
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
8
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
9
|
+
};
|
|
10
|
+
let count = 0;
|
|
11
|
+
function genId() {
|
|
12
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
13
|
+
return count.toString();
|
|
14
|
+
}
|
|
15
|
+
const toastTimeouts = new Map();
|
|
16
|
+
const addToRemoveQueue = (toastId) => {
|
|
17
|
+
if (toastTimeouts.has(toastId)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const timeout = setTimeout(() => {
|
|
21
|
+
toastTimeouts.delete(toastId);
|
|
22
|
+
dispatch({
|
|
23
|
+
type: "REMOVE_TOAST",
|
|
24
|
+
toastId: toastId,
|
|
25
|
+
});
|
|
26
|
+
}, TOAST_REMOVE_DELAY);
|
|
27
|
+
toastTimeouts.set(toastId, timeout);
|
|
28
|
+
};
|
|
29
|
+
export const reducer = (state, action) => {
|
|
30
|
+
switch (action.type) {
|
|
31
|
+
case "ADD_TOAST":
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
35
|
+
};
|
|
36
|
+
case "UPDATE_TOAST":
|
|
37
|
+
return {
|
|
38
|
+
...state,
|
|
39
|
+
toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t),
|
|
40
|
+
};
|
|
41
|
+
case "DISMISS_TOAST": {
|
|
42
|
+
const { toastId } = action;
|
|
43
|
+
if (toastId) {
|
|
44
|
+
addToRemoveQueue(toastId);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
state.toasts.forEach((toast) => {
|
|
48
|
+
addToRemoveQueue(toast.id);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
...state,
|
|
53
|
+
toasts: state.toasts.map((t) => t.id === toastId || toastId === undefined
|
|
54
|
+
? {
|
|
55
|
+
...t,
|
|
56
|
+
open: false,
|
|
57
|
+
}
|
|
58
|
+
: t),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
case "REMOVE_TOAST":
|
|
62
|
+
if (action.toastId === undefined) {
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
toasts: [],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const listeners = [];
|
|
75
|
+
let memoryState = { toasts: [] };
|
|
76
|
+
function dispatch(action) {
|
|
77
|
+
memoryState = reducer(memoryState, action);
|
|
78
|
+
listeners.forEach((listener) => {
|
|
79
|
+
listener(memoryState);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function toast({ ...props }) {
|
|
83
|
+
const id = genId();
|
|
84
|
+
const update = (props) => dispatch({
|
|
85
|
+
type: "UPDATE_TOAST",
|
|
86
|
+
toast: { ...props, id },
|
|
87
|
+
});
|
|
88
|
+
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });
|
|
89
|
+
dispatch({
|
|
90
|
+
type: "ADD_TOAST",
|
|
91
|
+
toast: {
|
|
92
|
+
...props,
|
|
93
|
+
id,
|
|
94
|
+
open: true,
|
|
95
|
+
onOpenChange: (open) => {
|
|
96
|
+
if (!open)
|
|
97
|
+
dismiss();
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
id: id,
|
|
103
|
+
dismiss,
|
|
104
|
+
update,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function useToast() {
|
|
108
|
+
const [state, setState] = React.useState(memoryState);
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
listeners.push(setState);
|
|
111
|
+
return () => {
|
|
112
|
+
const index = listeners.indexOf(setState);
|
|
113
|
+
if (index > -1) {
|
|
114
|
+
listeners.splice(index, 1);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}, [state]);
|
|
118
|
+
return {
|
|
119
|
+
...state,
|
|
120
|
+
toast,
|
|
121
|
+
dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId }),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export { useToast, toast };
|
|
125
|
+
//# sourceMappingURL=use-toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toast.js","sourceRoot":"","sources":["../../src/hooks/use-toast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,kBAAkB,GAAG,OAAO,CAAC;AASnC,MAAM,WAAW,GAAG;IAClB,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,SAAS,KAAK;IACZ,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC9C,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AA0BD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAyC,CAAC;AAEvE,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3C,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAA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|
2
|
+
* @mehdashti/ui
|
|
3
|
+
*
|
|
4
|
+
* React UI components for Smart Platform
|
|
5
|
+
*/
|
|
6
|
+
export { cn } from "./lib/utils.js";
|
|
7
|
+
export { Button, buttonVariants, type ButtonProps } from "./components/button.js";
|
|
8
|
+
export { Input, type InputProps } from "./components/input.js";
|
|
9
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, } from "./components/select.js";
|
|
10
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, } from "./components/dialog.js";
|
|
11
|
+
export { Label } from "./components/label.js";
|
|
12
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, } from "./components/tabs.js";
|
|
13
|
+
export { type ToastProps, type ToastActionElement, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, } from "./components/toast.js";
|
|
14
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, } from "./components/table.js";
|
|
15
|
+
export { useToast, toast } from "./hooks/use-toast.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mehdashti/ui
|
|
3
|
+
*
|
|
4
|
+
* React UI components for Smart Platform
|
|
5
|
+
*/
|
|
6
|
+
// Utils
|
|
7
|
+
export { cn } from "./lib/utils.js";
|
|
8
|
+
// Components
|
|
9
|
+
export { Button, buttonVariants } from "./components/button.js";
|
|
10
|
+
export { Input } from "./components/input.js";
|
|
11
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, } from "./components/select.js";
|
|
12
|
+
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, } from "./components/dialog.js";
|
|
13
|
+
export { Label } from "./components/label.js";
|
|
14
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, } from "./components/tabs.js";
|
|
15
|
+
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, } from "./components/toast.js";
|
|
16
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, } from "./components/table.js";
|
|
17
|
+
// Hooks
|
|
18
|
+
export { useToast, toast } from "./hooks/use-toast.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAQ;AACR,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAmB,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,QAAQ;AACR,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue } from "clsx";
|
|
2
|
+
/**
|
|
3
|
+
* Merge Tailwind CSS classes with proper precedence
|
|
4
|
+
* Uses clsx for conditional classes and twMerge for deduplication
|
|
5
|
+
*/
|
|
6
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C;;;GAGG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
/**
|
|
4
|
+
* Merge Tailwind CSS classes with proper precedence
|
|
5
|
+
* Uses clsx for conditional classes and twMerge for deduplication
|
|
6
|
+
*/
|
|
7
|
+
export function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mehdashti/ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React UI components for Smart Platform",
|
|
5
|
+
"author": "mehdashti",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/mehdashti/smart-platform.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/mehdashti/smart-platform#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/mehdashti/smart-platform/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"react",
|
|
18
|
+
"ui-components",
|
|
19
|
+
"design-system",
|
|
20
|
+
"radix-ui",
|
|
21
|
+
"tailwind"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./button": {
|
|
33
|
+
"types": "./dist/components/button.d.ts",
|
|
34
|
+
"import": "./dist/components/button.js"
|
|
35
|
+
},
|
|
36
|
+
"./input": {
|
|
37
|
+
"types": "./dist/components/input.d.ts",
|
|
38
|
+
"import": "./dist/components/input.js"
|
|
39
|
+
},
|
|
40
|
+
"./select": {
|
|
41
|
+
"types": "./dist/components/select.d.ts",
|
|
42
|
+
"import": "./dist/components/select.js"
|
|
43
|
+
},
|
|
44
|
+
"./dialog": {
|
|
45
|
+
"types": "./dist/components/dialog.d.ts",
|
|
46
|
+
"import": "./dist/components/dialog.js"
|
|
47
|
+
},
|
|
48
|
+
"./label": {
|
|
49
|
+
"types": "./dist/components/label.d.ts",
|
|
50
|
+
"import": "./dist/components/label.js"
|
|
51
|
+
},
|
|
52
|
+
"./tabs": {
|
|
53
|
+
"types": "./dist/components/tabs.d.ts",
|
|
54
|
+
"import": "./dist/components/tabs.js"
|
|
55
|
+
},
|
|
56
|
+
"./toast": {
|
|
57
|
+
"types": "./dist/components/toast.d.ts",
|
|
58
|
+
"import": "./dist/components/toast.js"
|
|
59
|
+
},
|
|
60
|
+
"./table": {
|
|
61
|
+
"types": "./dist/components/table.d.ts",
|
|
62
|
+
"import": "./dist/components/table.js"
|
|
63
|
+
},
|
|
64
|
+
"./hooks/use-toast": {
|
|
65
|
+
"types": "./dist/hooks/use-toast.d.ts",
|
|
66
|
+
"import": "./dist/hooks/use-toast.js"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsc",
|
|
74
|
+
"dev": "tsc --watch",
|
|
75
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
76
|
+
"test": "vitest",
|
|
77
|
+
"test:ui": "vitest --ui",
|
|
78
|
+
"test:coverage": "vitest --coverage",
|
|
79
|
+
"storybook": "storybook dev -p 6006",
|
|
80
|
+
"build-storybook": "storybook build",
|
|
81
|
+
"clean": "rm -rf dist"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"react": "^18.0.0",
|
|
85
|
+
"react-dom": "^18.0.0"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@radix-ui/react-dialog": "^1.1.4",
|
|
89
|
+
"@radix-ui/react-label": "^2.1.1",
|
|
90
|
+
"@radix-ui/react-select": "^2.1.4",
|
|
91
|
+
"@radix-ui/react-slot": "^1.1.1",
|
|
92
|
+
"@radix-ui/react-tabs": "^1.1.2",
|
|
93
|
+
"@radix-ui/react-toast": "^1.2.4",
|
|
94
|
+
"class-variance-authority": "^0.7.1",
|
|
95
|
+
"clsx": "^2.1.1",
|
|
96
|
+
"tailwind-merge": "^2.6.0"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@mehdashti/tokens": "workspace:*",
|
|
100
|
+
"@smart/typescript-config": "workspace:*",
|
|
101
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
102
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
103
|
+
"@storybook/addon-links": "^8.6.14",
|
|
104
|
+
"@storybook/blocks": "^8.6.14",
|
|
105
|
+
"@storybook/react": "^8.6.14",
|
|
106
|
+
"@storybook/react-vite": "^8.6.14",
|
|
107
|
+
"@storybook/test": "^8.6.14",
|
|
108
|
+
"@types/react": "^18.3.18",
|
|
109
|
+
"@types/react-dom": "^18.3.5",
|
|
110
|
+
"react": "^18.3.1",
|
|
111
|
+
"react-dom": "^18.3.1",
|
|
112
|
+
"storybook": "^8.6.14",
|
|
113
|
+
"typescript": "^5.7.2"
|
|
114
|
+
}
|
|
115
|
+
}
|