@rkosafo/cai.components 0.0.80 → 0.0.81
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/ui/modal/Modal.svelte +97 -52
- package/dist/ui/toast/Toast.svelte +120 -281
- package/dist/ui/toast/Toast.svelte.d.ts +27 -52
- package/dist/ui/toast/index.d.ts +2 -1
- package/dist/ui/toast/index.js +1 -3
- package/package.json +1 -1
- package/dist/forms/FormSelect/index.d.ts +0 -1
- package/dist/forms/FormSelect/index.js +0 -1
- package/dist/forms/input/index.d.ts +0 -4
- package/dist/forms/input/index.js +0 -5
- package/dist/forms/input/theme.d.ts +0 -301
- package/dist/forms/input/theme.js +0 -100
- package/dist/layout/TF/Sidebar/Sidebar.svelte +0 -148
- package/dist/layout/TF/Sidebar/Sidebar.svelte.d.ts +0 -4
- package/dist/layout/TF/Sidebar/index.d.ts +0 -1
- package/dist/layout/TF/Sidebar/index.js +0 -1
- package/dist/layout/TF/Wrapper/index.d.ts +0 -1
- package/dist/layout/TF/Wrapper/index.js +0 -1
- package/dist/ui/accordion/theme.d.ts +0 -96
- package/dist/ui/accordion/theme.js +0 -59
- package/dist/ui/speedDial/SpeedDial.svelte +0 -77
- package/dist/ui/speedDial/SpeedDial.svelte.d.ts +0 -21
- package/dist/ui/tableLoader/TableLoader.svelte +0 -24
- package/dist/ui/tableLoader/TableLoader.svelte.d.ts +0 -13
|
@@ -1,75 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
borderColor?: string;
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
textColor?: string;
|
|
10
|
-
iconColor?: string;
|
|
11
|
-
style?: any;
|
|
12
|
-
action?: {
|
|
13
|
-
label: string | boolean;
|
|
14
|
-
onClick: () => void;
|
|
15
|
-
buttonStyle?: string;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface ToastTheme {
|
|
19
|
-
success?: Partial<CustomToastOptions>;
|
|
20
|
-
error?: Partial<CustomToastOptions>;
|
|
21
|
-
warning?: Partial<CustomToastOptions>;
|
|
22
|
-
info?: Partial<CustomToastOptions>;
|
|
23
|
-
loading?: Partial<CustomToastOptions>;
|
|
24
|
-
custom?: Partial<CustomToastOptions>;
|
|
25
|
-
}
|
|
1
|
+
import { toast as originalToast, type DefaultToastOptions, type Renderable, resolveValue, type ToastOptions, type ToastPosition, type ValueOrFunction } from 'svelte-french-toast';
|
|
2
|
+
export { CheckmarkIcon, ErrorIcon, LoaderIcon, ToastBar, ToastIcon, useToaster, useToasterStore } from 'svelte-french-toast';
|
|
3
|
+
export { resolveValue };
|
|
4
|
+
export type { DefaultToastOptions, IconTheme, Toast, ToastOptions, ToastPosition, ToastType, Renderable, ValueFunction, ValueOrFunction } from 'svelte-french-toast';
|
|
5
|
+
export type CustomToastOptions = ToastOptions;
|
|
6
|
+
export type ToastTheme = Record<string, never>;
|
|
26
7
|
export interface ToasterProps {
|
|
27
8
|
position?: ToastPosition;
|
|
28
9
|
duration?: number;
|
|
29
|
-
|
|
10
|
+
toastOptions?: DefaultToastOptions;
|
|
11
|
+
reverseOrder?: boolean;
|
|
12
|
+
gutter?: number;
|
|
13
|
+
containerStyle?: string;
|
|
14
|
+
containerClassName?: string;
|
|
15
|
+
fireWithSound?: boolean;
|
|
30
16
|
className?: string;
|
|
31
|
-
|
|
17
|
+
theme?: ToastTheme;
|
|
32
18
|
richColors?: boolean;
|
|
33
19
|
customIcons?: boolean;
|
|
34
20
|
closeButton?: boolean;
|
|
35
21
|
pauseOnHover?: boolean;
|
|
36
|
-
reverseOrder?: boolean;
|
|
37
22
|
visibleToasts?: number;
|
|
38
23
|
expand?: boolean;
|
|
39
24
|
gap?: number;
|
|
40
25
|
offset?: number | string;
|
|
41
26
|
}
|
|
42
|
-
export declare const toast: {
|
|
43
|
-
success: (message: string, options?: CustomToastOptions) => string;
|
|
44
|
-
error: (message: string, options?: CustomToastOptions) => string;
|
|
45
|
-
warning: (message: string, options?: CustomToastOptions) => string;
|
|
46
|
-
info: (message: string, options?: CustomToastOptions) => string;
|
|
47
|
-
loading: (message: string, options?: CustomToastOptions) => string;
|
|
48
|
-
promise: <T>(promise: Promise<T>, messages: {
|
|
49
|
-
loading: string;
|
|
50
|
-
success: string;
|
|
51
|
-
error: string;
|
|
52
|
-
}, options?: {
|
|
53
|
-
loading?: CustomToastOptions;
|
|
54
|
-
success?: CustomToastOptions;
|
|
55
|
-
error?: CustomToastOptions;
|
|
56
|
-
}) => Promise<T>;
|
|
57
|
-
custom: (message: string, type?: ToastType, options?: CustomToastOptions) => string;
|
|
58
|
-
action: (message: string, action: {
|
|
59
|
-
label: string;
|
|
60
|
-
onClick: () => void;
|
|
61
|
-
}, options?: CustomToastOptions) => string;
|
|
62
|
-
dismiss: (toastId?: string) => void;
|
|
63
|
-
remove: (toastId?: string) => void;
|
|
64
|
-
};
|
|
65
27
|
export declare function updateToastConfig(config: {
|
|
66
28
|
duration?: number;
|
|
29
|
+
fireWithSound?: boolean;
|
|
67
30
|
theme?: ToastTheme;
|
|
68
31
|
richColors?: boolean;
|
|
69
32
|
}): void;
|
|
33
|
+
export declare const toast: ((message: Renderable, options?: ToastOptions) => string) & {
|
|
34
|
+
success: (message: Renderable, options?: ToastOptions) => string;
|
|
35
|
+
error: (message: Renderable, options?: ToastOptions) => string;
|
|
36
|
+
loading: (message: Renderable, options?: ToastOptions) => string;
|
|
37
|
+
promise: <T>(promise: Promise<T>, msgs: {
|
|
38
|
+
loading: Renderable;
|
|
39
|
+
success: ValueOrFunction<Renderable, T>;
|
|
40
|
+
error: ValueOrFunction<Renderable, any>;
|
|
41
|
+
}, opts?: DefaultToastOptions) => Promise<T>;
|
|
42
|
+
dismiss: (toastId?: string) => void;
|
|
43
|
+
remove: (toastId?: string) => void;
|
|
44
|
+
custom: (message: Renderable, options?: ToastOptions) => string;
|
|
45
|
+
};
|
|
70
46
|
export { originalToast };
|
|
71
47
|
export type { ToastOptions };
|
|
72
|
-
import { toast as originalToast, type ToastOptions } from 'svelte-french-toast';
|
|
73
48
|
declare const Toast: import("svelte").Component<ToasterProps, {}, "">;
|
|
74
49
|
type Toast = ReturnType<typeof Toast>;
|
|
75
50
|
export default Toast;
|
package/dist/ui/toast/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as Toaster, toast, originalToast, updateToastConfig } from './Toast.svelte';
|
|
2
|
+
export type { ToasterProps, ToastType, CustomToastOptions, ToastTheme, ToastOptions } from './Toast.svelte';
|
package/dist/ui/toast/index.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// export type { ToasterProps, ToastType, CustomToastOptions, ToastTheme } from './Toast.svelte';
|
|
3
|
-
export * from 'svelte-french-toast';
|
|
1
|
+
export { default as Toaster, toast, originalToast, updateToastConfig } from './Toast.svelte';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FormSelect } from './FormSelect.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FormSelect } from './FormSelect.svelte';
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import type { Classes } from '../../themes/themeUtils.js';
|
|
2
|
-
import { type VariantProps } from 'tailwind-variants';
|
|
3
|
-
export type InputVariants = VariantProps<typeof input> & Classes<typeof input>;
|
|
4
|
-
export declare const input: import("tailwind-variants").TVReturnType<{
|
|
5
|
-
size: {
|
|
6
|
-
sm: {
|
|
7
|
-
input: string;
|
|
8
|
-
};
|
|
9
|
-
md: {
|
|
10
|
-
input: string;
|
|
11
|
-
};
|
|
12
|
-
lg: {
|
|
13
|
-
input: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
color: {
|
|
17
|
-
default: {
|
|
18
|
-
input: string;
|
|
19
|
-
};
|
|
20
|
-
tinted: {
|
|
21
|
-
input: string;
|
|
22
|
-
};
|
|
23
|
-
primary: {
|
|
24
|
-
input: string;
|
|
25
|
-
};
|
|
26
|
-
secondary: {
|
|
27
|
-
input: string;
|
|
28
|
-
};
|
|
29
|
-
green: {
|
|
30
|
-
input: string;
|
|
31
|
-
};
|
|
32
|
-
emerald: {
|
|
33
|
-
input: string;
|
|
34
|
-
};
|
|
35
|
-
red: {
|
|
36
|
-
input: string;
|
|
37
|
-
};
|
|
38
|
-
blue: {
|
|
39
|
-
input: string;
|
|
40
|
-
};
|
|
41
|
-
yellow: {
|
|
42
|
-
input: string;
|
|
43
|
-
};
|
|
44
|
-
orange: {
|
|
45
|
-
input: string;
|
|
46
|
-
};
|
|
47
|
-
gray: {
|
|
48
|
-
input: string;
|
|
49
|
-
};
|
|
50
|
-
teal: {
|
|
51
|
-
input: string;
|
|
52
|
-
};
|
|
53
|
-
cyan: {
|
|
54
|
-
input: string;
|
|
55
|
-
};
|
|
56
|
-
sky: {
|
|
57
|
-
input: string;
|
|
58
|
-
};
|
|
59
|
-
indigo: {
|
|
60
|
-
input: string;
|
|
61
|
-
};
|
|
62
|
-
lime: {
|
|
63
|
-
input: string;
|
|
64
|
-
};
|
|
65
|
-
amber: {
|
|
66
|
-
input: string;
|
|
67
|
-
};
|
|
68
|
-
violet: {
|
|
69
|
-
input: string;
|
|
70
|
-
};
|
|
71
|
-
purple: {
|
|
72
|
-
input: string;
|
|
73
|
-
};
|
|
74
|
-
fuchsia: {
|
|
75
|
-
input: string;
|
|
76
|
-
};
|
|
77
|
-
pink: {
|
|
78
|
-
input: string;
|
|
79
|
-
};
|
|
80
|
-
rose: {
|
|
81
|
-
input: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
grouped: {
|
|
85
|
-
false: {
|
|
86
|
-
input: string;
|
|
87
|
-
};
|
|
88
|
-
true: {
|
|
89
|
-
input: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
}, {
|
|
93
|
-
base: string;
|
|
94
|
-
input: string;
|
|
95
|
-
left: string;
|
|
96
|
-
right: string;
|
|
97
|
-
close: string;
|
|
98
|
-
combo: string;
|
|
99
|
-
comboItem: string;
|
|
100
|
-
div: string;
|
|
101
|
-
svg: string;
|
|
102
|
-
wrapper: string;
|
|
103
|
-
}, undefined, {
|
|
104
|
-
size: {
|
|
105
|
-
sm: {
|
|
106
|
-
input: string;
|
|
107
|
-
};
|
|
108
|
-
md: {
|
|
109
|
-
input: string;
|
|
110
|
-
};
|
|
111
|
-
lg: {
|
|
112
|
-
input: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
color: {
|
|
116
|
-
default: {
|
|
117
|
-
input: string;
|
|
118
|
-
};
|
|
119
|
-
tinted: {
|
|
120
|
-
input: string;
|
|
121
|
-
};
|
|
122
|
-
primary: {
|
|
123
|
-
input: string;
|
|
124
|
-
};
|
|
125
|
-
secondary: {
|
|
126
|
-
input: string;
|
|
127
|
-
};
|
|
128
|
-
green: {
|
|
129
|
-
input: string;
|
|
130
|
-
};
|
|
131
|
-
emerald: {
|
|
132
|
-
input: string;
|
|
133
|
-
};
|
|
134
|
-
red: {
|
|
135
|
-
input: string;
|
|
136
|
-
};
|
|
137
|
-
blue: {
|
|
138
|
-
input: string;
|
|
139
|
-
};
|
|
140
|
-
yellow: {
|
|
141
|
-
input: string;
|
|
142
|
-
};
|
|
143
|
-
orange: {
|
|
144
|
-
input: string;
|
|
145
|
-
};
|
|
146
|
-
gray: {
|
|
147
|
-
input: string;
|
|
148
|
-
};
|
|
149
|
-
teal: {
|
|
150
|
-
input: string;
|
|
151
|
-
};
|
|
152
|
-
cyan: {
|
|
153
|
-
input: string;
|
|
154
|
-
};
|
|
155
|
-
sky: {
|
|
156
|
-
input: string;
|
|
157
|
-
};
|
|
158
|
-
indigo: {
|
|
159
|
-
input: string;
|
|
160
|
-
};
|
|
161
|
-
lime: {
|
|
162
|
-
input: string;
|
|
163
|
-
};
|
|
164
|
-
amber: {
|
|
165
|
-
input: string;
|
|
166
|
-
};
|
|
167
|
-
violet: {
|
|
168
|
-
input: string;
|
|
169
|
-
};
|
|
170
|
-
purple: {
|
|
171
|
-
input: string;
|
|
172
|
-
};
|
|
173
|
-
fuchsia: {
|
|
174
|
-
input: string;
|
|
175
|
-
};
|
|
176
|
-
pink: {
|
|
177
|
-
input: string;
|
|
178
|
-
};
|
|
179
|
-
rose: {
|
|
180
|
-
input: string;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
grouped: {
|
|
184
|
-
false: {
|
|
185
|
-
input: string;
|
|
186
|
-
};
|
|
187
|
-
true: {
|
|
188
|
-
input: string;
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
}, {
|
|
192
|
-
base: string;
|
|
193
|
-
input: string;
|
|
194
|
-
left: string;
|
|
195
|
-
right: string;
|
|
196
|
-
close: string;
|
|
197
|
-
combo: string;
|
|
198
|
-
comboItem: string;
|
|
199
|
-
div: string;
|
|
200
|
-
svg: string;
|
|
201
|
-
wrapper: string;
|
|
202
|
-
}, import("tailwind-variants").TVReturnType<{
|
|
203
|
-
size: {
|
|
204
|
-
sm: {
|
|
205
|
-
input: string;
|
|
206
|
-
};
|
|
207
|
-
md: {
|
|
208
|
-
input: string;
|
|
209
|
-
};
|
|
210
|
-
lg: {
|
|
211
|
-
input: string;
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
color: {
|
|
215
|
-
default: {
|
|
216
|
-
input: string;
|
|
217
|
-
};
|
|
218
|
-
tinted: {
|
|
219
|
-
input: string;
|
|
220
|
-
};
|
|
221
|
-
primary: {
|
|
222
|
-
input: string;
|
|
223
|
-
};
|
|
224
|
-
secondary: {
|
|
225
|
-
input: string;
|
|
226
|
-
};
|
|
227
|
-
green: {
|
|
228
|
-
input: string;
|
|
229
|
-
};
|
|
230
|
-
emerald: {
|
|
231
|
-
input: string;
|
|
232
|
-
};
|
|
233
|
-
red: {
|
|
234
|
-
input: string;
|
|
235
|
-
};
|
|
236
|
-
blue: {
|
|
237
|
-
input: string;
|
|
238
|
-
};
|
|
239
|
-
yellow: {
|
|
240
|
-
input: string;
|
|
241
|
-
};
|
|
242
|
-
orange: {
|
|
243
|
-
input: string;
|
|
244
|
-
};
|
|
245
|
-
gray: {
|
|
246
|
-
input: string;
|
|
247
|
-
};
|
|
248
|
-
teal: {
|
|
249
|
-
input: string;
|
|
250
|
-
};
|
|
251
|
-
cyan: {
|
|
252
|
-
input: string;
|
|
253
|
-
};
|
|
254
|
-
sky: {
|
|
255
|
-
input: string;
|
|
256
|
-
};
|
|
257
|
-
indigo: {
|
|
258
|
-
input: string;
|
|
259
|
-
};
|
|
260
|
-
lime: {
|
|
261
|
-
input: string;
|
|
262
|
-
};
|
|
263
|
-
amber: {
|
|
264
|
-
input: string;
|
|
265
|
-
};
|
|
266
|
-
violet: {
|
|
267
|
-
input: string;
|
|
268
|
-
};
|
|
269
|
-
purple: {
|
|
270
|
-
input: string;
|
|
271
|
-
};
|
|
272
|
-
fuchsia: {
|
|
273
|
-
input: string;
|
|
274
|
-
};
|
|
275
|
-
pink: {
|
|
276
|
-
input: string;
|
|
277
|
-
};
|
|
278
|
-
rose: {
|
|
279
|
-
input: string;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
grouped: {
|
|
283
|
-
false: {
|
|
284
|
-
input: string;
|
|
285
|
-
};
|
|
286
|
-
true: {
|
|
287
|
-
input: string;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
}, {
|
|
291
|
-
base: string;
|
|
292
|
-
input: string;
|
|
293
|
-
left: string;
|
|
294
|
-
right: string;
|
|
295
|
-
close: string;
|
|
296
|
-
combo: string;
|
|
297
|
-
comboItem: string;
|
|
298
|
-
div: string;
|
|
299
|
-
svg: string;
|
|
300
|
-
wrapper: string;
|
|
301
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { tv } from 'tailwind-variants';
|
|
2
|
-
export const input = tv({
|
|
3
|
-
slots: {
|
|
4
|
-
base: 'relative w-full',
|
|
5
|
-
input: 'block w-full disabled:cursor-not-allowed disabled:opacity-50 rtl:text-right focus:outline-hidden',
|
|
6
|
-
left: 'flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400 pointer-events-none start-0 p-2.5',
|
|
7
|
-
right: 'flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400 end-0 p-2.5',
|
|
8
|
-
close: 'absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-black',
|
|
9
|
-
combo: 'absolute top-full right-0 left-0 z-20 mt-1 max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800',
|
|
10
|
-
comboItem: 'text-gray-900 dark:text-gray-50',
|
|
11
|
-
div: '',
|
|
12
|
-
svg: '',
|
|
13
|
-
wrapper: ''
|
|
14
|
-
},
|
|
15
|
-
variants: {
|
|
16
|
-
size: {
|
|
17
|
-
sm: { input: 'text-xs px-2 py-1' },
|
|
18
|
-
md: { input: 'text-sm px-2.5 py-2.5' },
|
|
19
|
-
lg: { input: 'sm:text-base px-3 py-3' }
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
default: {
|
|
23
|
-
input: 'border border-gray-300 dark:border-gray-600 focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-500 dark:focus:ring-primary-500 text-gray-900 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 text-gray-900 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400'
|
|
24
|
-
},
|
|
25
|
-
tinted: {
|
|
26
|
-
input: 'border border-gray-300 dark:border-gray-500 bg-gray-50 text-gray-900 dark:bg-gray-600 dark:text-white dark:placeholder-gray-400'
|
|
27
|
-
},
|
|
28
|
-
primary: {
|
|
29
|
-
input: 'border border-primary-200 dark:border-primary-400 focus:ring-primary-500 focus:border-primary-600 dark:focus:ring-primary-500 dark:focus:border-primary-500 bg-primary-50 text-primary-900 placeholder-primary-700 dark:text-primary-400 dark:placeholder-primary-500 dark:bg-gray-700'
|
|
30
|
-
},
|
|
31
|
-
secondary: {
|
|
32
|
-
input: 'border border-secondary-200 dark:border-secondary-400 focus:ring-secondary-500 focus:border-secondary-600 dark:focus:ring-secondary-500 dark:focus:border-secondary-500 bg-secondary-50 text-secondary-900 placeholder-secondary-700 dark:text-secondary-400 dark:placeholder-secondary-500 dark:bg-gray-700'
|
|
33
|
-
},
|
|
34
|
-
green: {
|
|
35
|
-
input: 'border border-green-200 dark:border-green-400 focus:ring-green-500 focus:border-green-600 dark:focus:ring-green-500 dark:focus:border-green-500 bg-green-50 text-green-900 placeholder-green-700 dark:text-green-400 dark:placeholder-green-500 dark:bg-gray-700'
|
|
36
|
-
},
|
|
37
|
-
emerald: {
|
|
38
|
-
input: 'border border-emerald-200 dark:border-emerald-400 focus:ring-emerald-500 focus:border-emerald-600 dark:focus:ring-emerald-500 dark:focus:border-emerald-500 bg-emerald-50 text-emerald-900 placeholder-emerald-700 dark:text-emerald-400 dark:placeholder-emerald-500 dark:bg-gray-700'
|
|
39
|
-
},
|
|
40
|
-
red: {
|
|
41
|
-
input: 'border border-red-200 dark:border-red-400 focus:ring-red-500 focus:border-red-600 dark:focus:ring-red-500 dark:focus:border-red-500 bg-red-50 text-red-900 placeholder-red-700 dark:text-red-400 dark:placeholder-red-500 dark:bg-gray-700'
|
|
42
|
-
},
|
|
43
|
-
blue: {
|
|
44
|
-
input: 'border border-blue-200 dark:border-blue-400 focus:ring-blue-500 focus:border-blue-600 dark:focus:ring-blue-500 dark:focus:border-blue-500 bg-blue-50 text-blue-900 placeholder-blue-700 dark:text-blue-400 dark:placeholder-blue-500 dark:bg-gray-700'
|
|
45
|
-
},
|
|
46
|
-
yellow: {
|
|
47
|
-
input: 'border border-yellow-200 dark:border-yellow-400 focus:ring-yellow-500 focus:border-yellow-600 dark:focus:ring-yellow-500 dark:focus:border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 dark:text-yellow-400 dark:placeholder-yellow-500 dark:bg-gray-700'
|
|
48
|
-
},
|
|
49
|
-
orange: {
|
|
50
|
-
input: 'border border-orange-200 dark:border-orange-400 focus:ring-orange-500 focus:border-orange-600 dark:focus:ring-orange-500 dark:focus:border-orange-500 bg-orange-50 text-orange-900 placeholder-orange-700 dark:text-orange-400 dark:placeholder-orange-500 dark:bg-gray-700'
|
|
51
|
-
},
|
|
52
|
-
gray: {
|
|
53
|
-
input: 'border border-gray-200 dark:border-gray-400 focus:ring-gray-500 focus:border-gray-600 dark:focus:ring-gray-500 dark:focus:border-gray-500 bg-gray-50 text-gray-900 placeholder-gray-700 dark:text-gray-400 dark:placeholder-gray-500 dark:bg-gray-700'
|
|
54
|
-
},
|
|
55
|
-
teal: {
|
|
56
|
-
input: 'border border-teal-200 dark:border-teal-400 focus:ring-teal-500 focus:border-teal-600 dark:focus:ring-teal-500 dark:focus:border-teal-500 bg-teal-50 text-teal-900 placeholder-teal-700 dark:text-teal-400 dark:placeholder-teal-500 dark:bg-gray-700'
|
|
57
|
-
},
|
|
58
|
-
cyan: {
|
|
59
|
-
input: 'border border-cyan-200 dark:border-cyan-400 focus:ring-cyan-500 focus:border-cyan-600 dark:focus:ring-cyan-500 dark:focus:border-cyan-500 bg-cyan-50 text-cyan-900 placeholder-cyan-700 dark:text-cyan-400 dark:placeholder-cyan-500 dark:bg-gray-700'
|
|
60
|
-
},
|
|
61
|
-
sky: {
|
|
62
|
-
input: 'border border-sky-200 dark:border-sky-400 focus:ring-sky-500 focus:border-sky-600 dark:focus:ring-sky-500 dark:focus:border-sky-500 bg-sky-50 text-sky-900 placeholder-sky-700 dark:text-sky-400 dark:placeholder-sky-500 dark:bg-gray-700'
|
|
63
|
-
},
|
|
64
|
-
indigo: {
|
|
65
|
-
input: 'border border-indigo-200 dark:border-indigo-400 focus:ring-indigo-500 focus:border-indigo-600 dark:focus:ring-indigo-500 dark:focus:border-indigo-500 bg-indigo-50 text-indigo-900 placeholder-indigo-700 dark:text-indigo-400 dark:placeholder-indigo-500 dark:bg-gray-700'
|
|
66
|
-
},
|
|
67
|
-
lime: {
|
|
68
|
-
input: 'border border-lime-200 dark:border-lime-400 focus:ring-lime-500 focus:border-lime-600 dark:focus:ring-lime-500 dark:focus:border-lime-500 bg-lime-50 text-lime-900 placeholder-lime-700 dark:text-lime-400 dark:placeholder-lime-500 dark:bg-gray-700'
|
|
69
|
-
},
|
|
70
|
-
amber: {
|
|
71
|
-
input: 'border border-amber-200 dark:border-amber-400 focus:ring-amber-500 focus:border-amber-600 dark:focus:ring-amber-500 dark:focus:border-amber-500 bg-amber-50 text-amber-900 placeholder-amber-700 dark:text-amber-400 dark:placeholder-amber-500 dark:bg-gray-700'
|
|
72
|
-
},
|
|
73
|
-
violet: {
|
|
74
|
-
input: 'border border-violet-200 dark:border-violet-400 focus:ring-violet-500 focus:border-violet-600 dark:focus:ring-violet-500 dark:focus:border-violet-500 bg-violet-50 text-violet-900 placeholder-violet-700 dark:text-violet-400 dark:placeholder-violet-500 dark:bg-gray-700'
|
|
75
|
-
},
|
|
76
|
-
purple: {
|
|
77
|
-
input: 'border border-purple-200 dark:border-purple-400 focus:ring-purple-500 focus:border-purple-600 dark:focus:ring-purple-500 dark:focus:border-purple-500 bg-purple-50 text-purple-900 placeholder-purple-700 dark:text-purple-400 dark:placeholder-purple-500 dark:bg-gray-700'
|
|
78
|
-
},
|
|
79
|
-
fuchsia: {
|
|
80
|
-
input: 'border border-fuchsia-200 dark:border-fuchsia-400 focus:ring-fuchsia-500 focus:border-fuchsia-600 dark:focus:ring-fuchsia-500 dark:focus:border-fuchsia-500 bg-fuchsia-50 text-fuchsia-900 placeholder-fuchsia-700 dark:text-fuchsia-400 dark:placeholder-fuchsia-500 dark:bg-gray-700'
|
|
81
|
-
},
|
|
82
|
-
pink: {
|
|
83
|
-
input: 'border border-pink-200 dark:border-pink-400 focus:ring-pink-500 focus:border-pink-600 dark:focus:ring-pink-500 dark:focus:border-pink-500 bg-pink-50 text-pink-900 placeholder-pink-700 dark:text-pink-400 dark:placeholder-pink-500 dark:bg-gray-700'
|
|
84
|
-
},
|
|
85
|
-
rose: {
|
|
86
|
-
input: 'border border-rose-200 dark:border-rose-400 focus:ring-rose-500 focus:border-rose-600 dark:focus:ring-rose-500 dark:focus:border-rose-500 bg-rose-50 text-rose-900 placeholder-rose-700 dark:text-rose-400 dark:placeholder-rose-500 dark:bg-gray-700'
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
grouped: {
|
|
90
|
-
false: { input: 'rounded-lg' },
|
|
91
|
-
true: {
|
|
92
|
-
input: 'first:rounded-s-lg last:rounded-e-lg not-first:-ms-px'
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
defaultVariants: {
|
|
97
|
-
size: 'md',
|
|
98
|
-
color: 'default'
|
|
99
|
-
}
|
|
100
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../../utils/index.js';
|
|
3
|
-
import { page } from '$app/state';
|
|
4
|
-
import { IconifyIcon, type IMenuItem, type TFSidebarProps } from '../../../index.js';
|
|
5
|
-
import { slide } from 'svelte/transition';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
homeUrl,
|
|
9
|
-
logoUrl,
|
|
10
|
-
appName,
|
|
11
|
-
appShortName,
|
|
12
|
-
hideSidebar = false,
|
|
13
|
-
menuItems = [],
|
|
14
|
-
logo,
|
|
15
|
-
isActiveFunction
|
|
16
|
-
}: TFSidebarProps = $props();
|
|
17
|
-
|
|
18
|
-
let activeUrl = $state('');
|
|
19
|
-
let openNestedIndexes = $state<Set<number>>(new Set());
|
|
20
|
-
|
|
21
|
-
$effect(() => {
|
|
22
|
-
activeUrl = page.url.pathname;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Function to toggle nested menu by index
|
|
26
|
-
function toggleNestedMenu(index: number) {
|
|
27
|
-
handleMenuItemClick();
|
|
28
|
-
const newOpenIndexes = new Set(openNestedIndexes);
|
|
29
|
-
|
|
30
|
-
if (newOpenIndexes.has(index)) {
|
|
31
|
-
// If already open, close it
|
|
32
|
-
newOpenIndexes.delete(index);
|
|
33
|
-
} else {
|
|
34
|
-
// If opening new one, just add it (don't clear others)
|
|
35
|
-
newOpenIndexes.add(index);
|
|
36
|
-
}
|
|
37
|
-
openNestedIndexes = newOpenIndexes;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Function to handle regular menu item clicks (non-nested)
|
|
41
|
-
function handleMenuItemClick() {
|
|
42
|
-
// Close all nested menus when clicking a regular menu item
|
|
43
|
-
openNestedIndexes = new Set();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Function to check if a menu item or any of its children is active
|
|
47
|
-
function isItemOrChildActive(item: IMenuItem): boolean {
|
|
48
|
-
if (isActiveFunction) {
|
|
49
|
-
return isActiveFunction(item);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (item.path === activeUrl) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Check if any child is active
|
|
57
|
-
if (item.items) {
|
|
58
|
-
return item.items.some((child) => child.path === activeUrl);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
{#snippet menuItemSnippet(item: IMenuItem, active: boolean)}
|
|
66
|
-
<li class:active class="relative">
|
|
67
|
-
<a
|
|
68
|
-
class="space-x-3 pl-3 {active ? 'text-[#3C91E6]' : ''}"
|
|
69
|
-
href={item.path}
|
|
70
|
-
onclick={() => handleMenuItemClick()}
|
|
71
|
-
>
|
|
72
|
-
<IconifyIcon icon={item.icon} class={active ? 'text-[#3C91E6]' : ''} />
|
|
73
|
-
<span class="text hidden md:block {active ? 'text-[#3C91E6]' : ''}">{item.title}</span>
|
|
74
|
-
</a>
|
|
75
|
-
</li>
|
|
76
|
-
{/snippet}
|
|
77
|
-
|
|
78
|
-
{#snippet nestedItemSnippet(item: IMenuItem, index: number)}
|
|
79
|
-
{@const isActive = isItemOrChildActive(item)}
|
|
80
|
-
{@const isOpen = openNestedIndexes.has(index)}
|
|
81
|
-
|
|
82
|
-
<div class="mx-1 rounded-[5px] px-1.5 py-2 {isActive ? 'bg-[#cfe8ff79] text-[#3C91E6]' : ''}">
|
|
83
|
-
<button
|
|
84
|
-
class="flex w-full items-center space-x-3 pl-3"
|
|
85
|
-
onclick={() => toggleNestedMenu(index)}
|
|
86
|
-
type="button"
|
|
87
|
-
>
|
|
88
|
-
<IconifyIcon icon={item.icon} class={isActive ? 'text-[#3C91E6]' : ''} />
|
|
89
|
-
<span class="text hidden md:block {isActive ? 'text-[#3C91E6]' : ''}">{item.title}</span>
|
|
90
|
-
<IconifyIcon
|
|
91
|
-
icon="ri:arrow-down-s-line"
|
|
92
|
-
class="ml-auto transition-transform duration-200 {isOpen ? 'rotate-180' : ''}"
|
|
93
|
-
/>
|
|
94
|
-
</button>
|
|
95
|
-
{#if isOpen}
|
|
96
|
-
<ul transition:slide class="sub-menu space-y-0 py-1">
|
|
97
|
-
{#each item.items! as child}
|
|
98
|
-
{@const isChildActive = isActiveFunction
|
|
99
|
-
? isActiveFunction(child)
|
|
100
|
-
: activeUrl === child.path}
|
|
101
|
-
<div class="pl-4">
|
|
102
|
-
<li class="relative">
|
|
103
|
-
<a
|
|
104
|
-
class="flex items-center space-x-3 rounded transition-colors hover:bg-[#cfe8ff] {isChildActive
|
|
105
|
-
? 'bg-[#cfe8ff] text-[#3C91E6]'
|
|
106
|
-
: ''}"
|
|
107
|
-
href={child.path}
|
|
108
|
-
>
|
|
109
|
-
{#if child.icon}
|
|
110
|
-
<IconifyIcon icon={child.icon} class={isChildActive ? 'text-[#3C91E6]' : ''} />
|
|
111
|
-
{/if}
|
|
112
|
-
<span class="text hidden md:block {isChildActive ? 'text-[#3C91E6]' : ''}"
|
|
113
|
-
>{child.title}</span
|
|
114
|
-
>
|
|
115
|
-
</a>
|
|
116
|
-
</li>
|
|
117
|
-
</div>
|
|
118
|
-
{/each}
|
|
119
|
-
</ul>
|
|
120
|
-
{/if}
|
|
121
|
-
</div>
|
|
122
|
-
{/snippet}
|
|
123
|
-
|
|
124
|
-
<section id="tf-sidebar" class={cn('relative')} class:hide={hideSidebar}>
|
|
125
|
-
<a href={homeUrl} class="brand flex flex-col pt-4" onclick={() => handleMenuItemClick()}>
|
|
126
|
-
{#if logo}
|
|
127
|
-
{@render logo()}
|
|
128
|
-
{:else}
|
|
129
|
-
<img src={logoUrl} alt="Logo" class={hideSidebar ? 'w-12' : 'w-12 md:w-24'} loading="lazy" />
|
|
130
|
-
{/if}
|
|
131
|
-
<span class="text-base font-thin {hideSidebar ? 'block' : 'md:hidden'}">{appShortName}</span>
|
|
132
|
-
<p class="text-center text-lg font-medium {hideSidebar ? 'hidden' : 'hidden md:block'}">
|
|
133
|
-
{appName}
|
|
134
|
-
</p>
|
|
135
|
-
</a>
|
|
136
|
-
{#if menuItems.length > 0}
|
|
137
|
-
<ul class="side-menu top relative pt-4">
|
|
138
|
-
{#each menuItems as item, index}
|
|
139
|
-
{@const active = isActiveFunction ? isActiveFunction(item) : activeUrl === item.path}
|
|
140
|
-
{#if item.items}
|
|
141
|
-
{@render nestedItemSnippet(item, index)}
|
|
142
|
-
{:else}
|
|
143
|
-
{@render menuItemSnippet(item, active)}
|
|
144
|
-
{/if}
|
|
145
|
-
{/each}
|
|
146
|
-
</ul>
|
|
147
|
-
{/if}
|
|
148
|
-
</section>
|