pejay-ui 1.3.5 → 1.4.1

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.
@@ -0,0 +1,54 @@
1
+ import { toastStore } from "./store";
2
+ import type { ToastData } from "./types";
3
+
4
+ type ToastOptions = ToastData;
5
+ type ShortcutOptions = Omit<ToastData, "type">;
6
+
7
+ function createToast(options: ToastOptions) {
8
+ if (options.dismiss) {
9
+ toastStore.remove(options.dismiss);
10
+ }
11
+ return toastStore.add(options);
12
+ }
13
+
14
+ const handleShortcut = (
15
+ type: ToastData["type"],
16
+ messageOrOptions: string | ShortcutOptions,
17
+ options?: ShortcutOptions
18
+ ) => {
19
+ if (typeof messageOrOptions === "string") {
20
+ return createToast({ message: messageOrOptions, ...options, type });
21
+ }
22
+ return createToast({ ...messageOrOptions, type });
23
+ };
24
+
25
+ export const toast = Object.assign(
26
+ (options: ToastOptions) => {
27
+ return createToast(options);
28
+ },
29
+ {
30
+ success: (messageOrOptions: string | ShortcutOptions, options?: ShortcutOptions) => {
31
+ return handleShortcut("success", messageOrOptions, options);
32
+ },
33
+
34
+ error: (messageOrOptions: string | ShortcutOptions, options?: ShortcutOptions) => {
35
+ return handleShortcut("error", messageOrOptions, options);
36
+ },
37
+
38
+ info: (messageOrOptions: string | ShortcutOptions, options?: ShortcutOptions) => {
39
+ return handleShortcut("info", messageOrOptions, options);
40
+ },
41
+
42
+ warning: (messageOrOptions: string | ShortcutOptions, options?: ShortcutOptions) => {
43
+ return handleShortcut("warning", messageOrOptions, options);
44
+ },
45
+
46
+ custom: (options: { content: React.ReactNode | ((id: string) => React.ReactNode); id?: string; duration?: number; dismiss?: string }) => {
47
+ return createToast({ ...options, type: "custom" });
48
+ },
49
+
50
+ dismiss: (id: string) => {
51
+ toastStore.remove(id);
52
+ },
53
+ },
54
+ );
@@ -0,0 +1,15 @@
1
+ export type ToastType = "info" | "error" | "warning" | "success" | "custom";
2
+
3
+ export type Listener = (toasts: ToastData[]) => void;
4
+ export interface ToastData {
5
+ id?: string;
6
+ title?: string;
7
+ description?: string;
8
+ message?: string;
9
+ type?: ToastType;
10
+ duration?: number;
11
+ showClose?: boolean;
12
+ dismiss?: string;
13
+ icon?: React.ReactNode;
14
+ content?: React.ReactNode | ((id: string) => React.ReactNode);
15
+ }
package/registry.json DELETED
@@ -1,256 +0,0 @@
1
- {
2
- "button": {
3
- "name": "Button",
4
- "category": "button",
5
- "files": ["templates/button/Button.tsx", "templates/button/tooltip.tsx"],
6
- "utils": ["cn.ts"],
7
- "peerDependencies": ["clsx", "tailwind-merge"]
8
- },
9
- "form/input": {
10
- "name": "Input",
11
- "category": "form",
12
- "files": ["templates/form/input.tsx"],
13
- "utils": ["cn.ts"],
14
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
15
- },
16
- "form/amount-input": {
17
- "name": "AmountInput",
18
- "category": "form",
19
- "files": ["templates/form/amount-input.tsx"],
20
- "utils": ["cn.ts"],
21
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
22
- },
23
- "form/checkbox": {
24
- "name": "Checkbox",
25
- "category": "form",
26
- "files": ["templates/form/checkbox.tsx"],
27
- "utils": ["cn.ts"],
28
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
29
- },
30
- "form/checkbox-group": {
31
- "name": "CheckboxGroup",
32
- "category": "form",
33
- "files": ["templates/form/checkbox-group.tsx"],
34
- "utils": ["cn.ts"],
35
- "peerDependencies": ["clsx", "tailwind-merge"],
36
- "dependencies": ["form/checkbox"]
37
- },
38
- "form/date-picker": {
39
- "name": "DatePicker",
40
- "category": "form",
41
- "files": ["templates/form/date-picker.tsx"],
42
- "utils": ["cn.ts"],
43
- "peerDependencies": [
44
- "clsx",
45
- "tailwind-merge",
46
- "lucide-react",
47
- "@floating-ui/react"
48
- ],
49
- "dependencies": ["dropdown/select-input"]
50
- },
51
- "form/date-range-picker": {
52
- "name": "DateRangePicker",
53
- "category": "form",
54
- "files": ["templates/form/date-range-picker.tsx"],
55
- "utils": ["cn.ts"],
56
- "peerDependencies": [
57
- "clsx",
58
- "tailwind-merge",
59
- "lucide-react",
60
- "@floating-ui/react"
61
- ],
62
- "dependencies": ["dropdown/select-input"]
63
- },
64
- "form/email-input": {
65
- "name": "EmailInput",
66
- "category": "form",
67
- "files": ["templates/form/email-input.tsx"],
68
- "utils": ["cn.ts"],
69
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
70
- },
71
- "form/file-input": {
72
- "name": "FileInput",
73
- "category": "form",
74
- "files": ["templates/form/file-input.tsx"],
75
- "utils": ["cn.ts"],
76
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
77
- },
78
- "form/number-input": {
79
- "name": "NumberInput",
80
- "category": "form",
81
- "files": ["templates/form/number-input.tsx"],
82
- "utils": ["cn.ts"],
83
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
84
- },
85
- "form/password-input": {
86
- "name": "PasswordInput",
87
- "category": "form",
88
- "files": ["templates/form/password-input.tsx"],
89
- "utils": ["cn.ts"],
90
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
91
- },
92
- "form/phone-input": {
93
- "name": "PhoneInput",
94
- "category": "form",
95
- "files": ["templates/form/phone-input.tsx"],
96
- "utils": ["cn.ts"],
97
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
98
- },
99
- "form/radio": {
100
- "name": "Radio",
101
- "category": "form",
102
- "files": ["templates/form/radio.tsx"],
103
- "utils": ["cn.ts"],
104
- "peerDependencies": ["clsx", "tailwind-merge"]
105
- },
106
- "form/radio-group": {
107
- "name": "RadioGroup",
108
- "category": "form",
109
- "files": ["templates/form/radio-group.tsx"],
110
- "utils": ["cn.ts"],
111
- "peerDependencies": ["clsx", "tailwind-merge"],
112
- "dependencies": ["form/radio"]
113
- },
114
- "form/range-slider": {
115
- "name": "RangeSlider",
116
- "category": "form",
117
- "files": ["templates/form/range-slider.tsx"],
118
- "utils": ["cn.ts"],
119
- "peerDependencies": ["clsx", "tailwind-merge"]
120
- },
121
- "form/switch": {
122
- "name": "Switch",
123
- "category": "form",
124
- "files": ["templates/form/switch.tsx"],
125
- "utils": ["cn.ts"],
126
- "peerDependencies": ["clsx", "tailwind-merge"]
127
- },
128
- "form/textarea": {
129
- "name": "Textarea",
130
- "category": "form",
131
- "files": ["templates/form/textarea.tsx"],
132
- "utils": ["cn.ts"],
133
- "peerDependencies": ["clsx", "tailwind-merge"]
134
- },
135
- "form/time-picker": {
136
- "name": "TimePicker",
137
- "category": "form",
138
- "files": ["templates/form/time-picker.tsx"],
139
- "utils": ["cn.ts"],
140
- "peerDependencies": [
141
- "clsx",
142
- "tailwind-merge",
143
- "lucide-react",
144
- "@floating-ui/react"
145
- ],
146
- "dependencies": ["dropdown/select-input"]
147
- },
148
- "form/time-range-picker": {
149
- "name": "TimeRangePicker",
150
- "category": "form",
151
- "files": ["templates/form/time-range-picker.tsx"],
152
- "utils": ["cn.ts"],
153
- "peerDependencies": [
154
- "clsx",
155
- "tailwind-merge",
156
- "lucide-react",
157
- "@floating-ui/react"
158
- ],
159
- "dependencies": ["dropdown/select-input"]
160
- },
161
- "form/url-input": {
162
- "name": "UrlInput",
163
- "category": "form",
164
- "files": ["templates/form/url-input.tsx"],
165
- "utils": ["cn.ts"],
166
- "peerDependencies": ["clsx", "tailwind-merge", "lucide-react"]
167
- },
168
- "dropdown/select-input": {
169
- "name": "SelectInput",
170
- "category": "select-dropdown",
171
- "files": ["templates/select-dropdown/select-input.tsx"],
172
- "utils": ["cn.ts"],
173
- "peerDependencies": [
174
- "clsx",
175
- "tailwind-merge",
176
- "lucide-react",
177
- "@floating-ui/react"
178
- ]
179
- },
180
- "dropdown/multiselect-input": {
181
- "name": "MultiselectInput",
182
- "category": "select-dropdown",
183
- "files": ["templates/select-dropdown/multiselect-input.tsx"],
184
- "utils": ["cn.ts"],
185
- "peerDependencies": [
186
- "clsx",
187
- "tailwind-merge",
188
- "lucide-react",
189
- "@floating-ui/react"
190
- ]
191
- },
192
- "tanstack-query-client": {
193
- "name": "TanstackQueryClient",
194
- "category": "scaffold",
195
- "subcategory": "tanstack-query",
196
- "targetDirName": "tanstack-query",
197
- "files": ["templates/scaffolds/tanstack-query"],
198
- "peerDependencies": ["@tanstack/react-query"]
199
- },
200
- "react-router-client": {
201
- "name": "ReactRouterClient",
202
- "category": "scaffold",
203
- "subcategory": "react-router",
204
- "targetDirName": "react-router",
205
- "files": ["templates/scaffolds/react-router"],
206
- "peerDependencies": ["react-router-dom"]
207
- },
208
- "tanstack-router-client": {
209
- "name": "TanstackRouterClient",
210
- "category": "scaffold",
211
- "subcategory": "tanstack-router",
212
- "targetDirName": "tanstack-router",
213
- "files": ["templates/scaffolds/tanstack-router"],
214
- "peerDependencies": ["@tanstack/react-router"]
215
- },
216
- "axios-client": {
217
- "name": "AxiosClient",
218
- "category": "scaffold",
219
- "subcategory": "axios",
220
- "targetDirName": "axios",
221
- "files": ["templates/scaffolds/axios"],
222
- "peerDependencies": ["axios"]
223
- },
224
- "redux-store-client": {
225
- "name": "ReduxStoreClient",
226
- "category": "scaffold",
227
- "subcategory": "redux-store",
228
- "targetDirName": "redux-store",
229
- "files": ["templates/scaffolds/redux-store"],
230
- "peerDependencies": ["@reduxjs/toolkit", "react-redux", "redux-persist"]
231
- },
232
- "rtk-query-client": {
233
- "name": "RtkQueryClient",
234
- "category": "scaffold",
235
- "subcategory": "rtk-query",
236
- "targetDirName": "rtk-query",
237
- "files": ["templates/scaffolds/rtk-query"],
238
- "peerDependencies": ["@reduxjs/toolkit", "react-redux"]
239
- },
240
- "layouts/lv1": {
241
- "name": "AppLayout",
242
- "category": "layouts",
243
- "files": [
244
- "templates/layouts/lv1/app-layout.tsx",
245
- "templates/layouts/lv1/sidebar-menu.tsx",
246
- "templates/layouts/lv1/index.ts"
247
- ],
248
- "utils": ["cn.ts"],
249
- "peerDependencies": [
250
- "clsx",
251
- "tailwind-merge",
252
- "lucide-react"
253
- ]
254
- }
255
- }
256
-