@rkosafo/cai.components 0.0.75 → 0.0.79

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.
Files changed (39) hide show
  1. package/dist/forms/button-toggle/ButtonToggle.svelte +119 -0
  2. package/dist/forms/button-toggle/ButtonToggle.svelte.d.ts +139 -0
  3. package/dist/forms/button-toggle/ButtonToggleGroup.svelte +0 -0
  4. package/dist/forms/button-toggle/ButtonToggleGroup.svelte.d.ts +26 -0
  5. package/dist/forms/button-toggle/CheckIcon.svelte +28 -0
  6. package/dist/forms/button-toggle/CheckIcon.svelte.d.ts +4 -0
  7. package/dist/forms/button-toggle/index.d.ts +4 -0
  8. package/dist/forms/button-toggle/index.js +4 -0
  9. package/dist/forms/button-toggle/theme.d.ts +347 -0
  10. package/dist/forms/button-toggle/theme.js +129 -0
  11. package/dist/forms/toggle/Toggle.svelte +70 -0
  12. package/dist/forms/toggle/Toggle.svelte.d.ts +3 -0
  13. package/dist/forms/toggle/index.d.ts +2 -0
  14. package/dist/forms/toggle/index.js +2 -0
  15. package/dist/forms/toggle/theme.d.ts +280 -0
  16. package/dist/forms/toggle/theme.js +97 -0
  17. package/dist/index.d.ts +3 -0
  18. package/dist/index.js +3 -0
  19. package/dist/themes/themes.d.ts +3 -0
  20. package/dist/themes/themes.js +3 -0
  21. package/dist/types/index.d.ts +59 -1
  22. package/dist/ui/modal/theme.d.ts +26 -26
  23. package/dist/ui/modal/theme.js +25 -25
  24. package/dist/ui/speedDial/SpeedDial.svelte +77 -0
  25. package/dist/ui/speedDial/SpeedDial.svelte.d.ts +21 -0
  26. package/dist/ui/speedDial/SpeedDialButton.svelte +75 -0
  27. package/dist/ui/speedDial/SpeedDialButton.svelte.d.ts +20 -0
  28. package/dist/ui/speedDial/SpeedDialTrigger.svelte +79 -0
  29. package/dist/ui/speedDial/SpeedDialTrigger.svelte.d.ts +18 -0
  30. package/dist/ui/speedDial/index.d.ts +4 -0
  31. package/dist/ui/speedDial/index.js +4 -0
  32. package/dist/ui/speedDial/theme.d.ts +75 -0
  33. package/dist/ui/speedDial/theme.js +35 -0
  34. package/dist/ui/tab/Tab.svelte +45 -19
  35. package/dist/ui/toast/index.d.ts +1 -2
  36. package/dist/ui/toast/index.js +3 -1
  37. package/dist/utils/index.d.ts +1 -0
  38. package/dist/utils/index.js +10 -0
  39. package/package.json +2 -1
@@ -0,0 +1,119 @@
1
+ <!-- <script lang="ts">
2
+ import CheckIcon from './CheckIcon.svelte';
3
+ import { buttonToggle } from './theme.js';
4
+ import type { VariantProps } from 'tailwind-variants';
5
+ import clsx from 'clsx';
6
+ import type { ButtonToggleProps } from '../../index.js';
7
+ import { getButtonToggleContext } from '../../context';
8
+ import { untrack } from 'svelte';
9
+ import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
10
+
11
+ let {
12
+ value,
13
+ selected = false,
14
+ children,
15
+ iconSlot,
16
+ color,
17
+ class: className,
18
+ iconClass,
19
+ txtClass,
20
+ contentClass,
21
+ classes,
22
+ ...restProps
23
+ }: ButtonToggleProps = $props();
24
+
25
+ warnThemeDeprecation(
26
+ 'ButtonToggle',
27
+ untrack(() => ({ iconClass, txtClass, contentClass })),
28
+ { iconClass: 'icon', txtClass: 'text', contentClass: 'content' }
29
+ );
30
+
31
+ // button(className), content, text, icon
32
+ const styling = $derived(classes ?? { icon: iconClass, text: txtClass, content: contentClass });
33
+
34
+ const theme = $derived(getTheme('buttonToggle'));
35
+
36
+ // Get context - it will be undefined if used outside ButtonToggleGroup
37
+ const ctx = getButtonToggleContext();
38
+
39
+ // Extract context values with fallbacks
40
+ const { toggleSelected, isSelected, multiSelect, size, roundedSize, ctxIconClass, ctxBtnClass } =
41
+ {
42
+ toggleSelected: ctx?.toggleSelected ?? (() => {}),
43
+ isSelected: ctx?.isSelected ?? (() => false),
44
+ multiSelect: ctx?.multiSelect ?? false,
45
+ size: ctx?.size,
46
+ roundedSize: ctx?.roundedSize,
47
+ ctxIconClass: ctx?.ctxIconClass,
48
+ ctxBtnClass: ctx?.ctxBtnClass
49
+ };
50
+
51
+ // Use context color if available, otherwise use prop color, otherwise default to "primary"
52
+ const actualColor = $derived(
53
+ (ctx?.color ?? color ?? 'primary') as VariantProps<typeof buttonToggle>['color']
54
+ );
55
+ const actualIconClass = ctxIconClass;
56
+
57
+ // Filter size to only valid buttonToggle sizes (no 'xs')
58
+ const actualSize = (size === 'xs' ? 'sm' : size) as VariantProps<typeof buttonToggle>['size'];
59
+ // roundedSize is already validated by type system
60
+ const actualRoundedSize = roundedSize as VariantProps<typeof buttonToggle>['roundedSize'];
61
+
62
+ function handleClick() {
63
+ toggleSelected(value);
64
+ }
65
+
66
+ const { button, content, text, icon } = $derived(
67
+ buttonToggle({ selected, color: actualColor, size: actualSize })
68
+ );
69
+
70
+ $effect(() => {
71
+ selected = isSelected(value);
72
+ });
73
+ </script>
74
+
75
+ <button
76
+ type="button"
77
+ class={button({
78
+ selected,
79
+ color: actualColor,
80
+ size: actualSize,
81
+ roundedSize: actualRoundedSize,
82
+ class: clsx(theme?.button, ctxBtnClass, className)
83
+ })}
84
+ data-selected={selected}
85
+ onclick={handleClick}
86
+ role={multiSelect ? 'checkbox' : 'radio'}
87
+ aria-checked={selected}
88
+ {...restProps}
89
+ >
90
+ <div class={content({ class: clsx(theme?.content, styling.content) })}>
91
+ {#if selected}
92
+ {#if iconSlot}
93
+ {@render iconSlot()}
94
+ {:else}
95
+ <CheckIcon class={icon({ class: clsx(theme?.icon ?? actualIconClass, styling.icon) })} />
96
+ {/if}
97
+ {/if}
98
+ <span class={text({ selected, class: clsx(theme?.text, styling.text) })}>
99
+ {@render children()}
100
+ </span>
101
+ </div>
102
+ </button>
103
+
104
+ @component
105
+ [Go to docs](https://flowbite-svelte.com/)
106
+ ## Type
107
+ [ButtonToggleProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L441)
108
+ ## Props
109
+ @prop value
110
+ @prop selected = false
111
+ @prop children
112
+ @prop iconSlot
113
+ @prop color
114
+ @prop class: className
115
+ @prop iconClass
116
+ @prop txtClass
117
+ @prop contentClass
118
+ @prop classes
119
+ @prop ...restProps -->
@@ -0,0 +1,139 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ /**
15
+ * <script lang="ts">
16
+ * import CheckIcon from './CheckIcon.svelte';
17
+ * import { buttonToggle } from './theme.js';
18
+ * import type { VariantProps } from 'tailwind-variants';
19
+ * import clsx from 'clsx';
20
+ * import type { ButtonToggleProps } from '../../index.js';
21
+ * import { getButtonToggleContext } from '../../context';
22
+ * import { untrack } from 'svelte';
23
+ * import { getTheme, warnThemeDeprecation } from '../../themes/themeUtils.js';
24
+ *
25
+ * let {
26
+ * value,
27
+ * selected = false,
28
+ * children,
29
+ * iconSlot,
30
+ * color,
31
+ * class: className,
32
+ * iconClass,
33
+ * txtClass,
34
+ * contentClass,
35
+ * classes,
36
+ * ...restProps
37
+ * }: ButtonToggleProps = $props();
38
+ *
39
+ * warnThemeDeprecation(
40
+ * 'ButtonToggle',
41
+ * untrack(() => ({ iconClass, txtClass, contentClass })),
42
+ * { iconClass: 'icon', txtClass: 'text', contentClass: 'content' }
43
+ * );
44
+ *
45
+ * // button(className), content, text, icon
46
+ * const styling = $derived(classes ?? { icon: iconClass, text: txtClass, content: contentClass });
47
+ *
48
+ * const theme = $derived(getTheme('buttonToggle'));
49
+ *
50
+ * // Get context - it will be undefined if used outside ButtonToggleGroup
51
+ * const ctx = getButtonToggleContext();
52
+ *
53
+ * // Extract context values with fallbacks
54
+ * const { toggleSelected, isSelected, multiSelect, size, roundedSize, ctxIconClass, ctxBtnClass } =
55
+ * {
56
+ * toggleSelected: ctx?.toggleSelected ?? (() => {}),
57
+ * isSelected: ctx?.isSelected ?? (() => false),
58
+ * multiSelect: ctx?.multiSelect ?? false,
59
+ * size: ctx?.size,
60
+ * roundedSize: ctx?.roundedSize,
61
+ * ctxIconClass: ctx?.ctxIconClass,
62
+ * ctxBtnClass: ctx?.ctxBtnClass
63
+ * };
64
+ *
65
+ * // Use context color if available, otherwise use prop color, otherwise default to "primary"
66
+ * const actualColor = $derived(
67
+ * (ctx?.color ?? color ?? 'primary') as VariantProps<typeof buttonToggle>['color']
68
+ * );
69
+ * const actualIconClass = ctxIconClass;
70
+ *
71
+ * // Filter size to only valid buttonToggle sizes (no 'xs')
72
+ * const actualSize = (size === 'xs' ? 'sm' : size) as VariantProps<typeof buttonToggle>['size'];
73
+ * // roundedSize is already validated by type system
74
+ * const actualRoundedSize = roundedSize as VariantProps<typeof buttonToggle>['roundedSize'];
75
+ *
76
+ * function handleClick() {
77
+ * toggleSelected(value);
78
+ * }
79
+ *
80
+ * const { button, content, text, icon } = $derived(
81
+ * buttonToggle({ selected, color: actualColor, size: actualSize })
82
+ * );
83
+ *
84
+ * $effect(() => {
85
+ * selected = isSelected(value);
86
+ * });
87
+ * </script>
88
+ *
89
+ * <button
90
+ * type="button"
91
+ * class={button({
92
+ * selected,
93
+ * color: actualColor,
94
+ * size: actualSize,
95
+ * roundedSize: actualRoundedSize,
96
+ * class: clsx(theme?.button, ctxBtnClass, className)
97
+ * })}
98
+ * data-selected={selected}
99
+ * onclick={handleClick}
100
+ * role={multiSelect ? 'checkbox' : 'radio'}
101
+ * aria-checked={selected}
102
+ * {...restProps}
103
+ * >
104
+ * <div class={content({ class: clsx(theme?.content, styling.content) })}>
105
+ * {#if selected}
106
+ * {#if iconSlot}
107
+ * {@render iconSlot()}
108
+ * {:else}
109
+ * <CheckIcon class={icon({ class: clsx(theme?.icon ?? actualIconClass, styling.icon) })} />
110
+ * {/if}
111
+ * {/if}
112
+ * <span class={text({ selected, class: clsx(theme?.text, styling.text) })}>
113
+ * {@render children()}
114
+ * </span>
115
+ * </div>
116
+ * </button>
117
+ *
118
+ *
119
+ * [Go to docs](https://flowbite-svelte.com/)
120
+ * ## Type
121
+ * [ButtonToggleProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L441)
122
+ * ## Props
123
+ * @prop value
124
+ * @prop selected = false
125
+ * @prop children
126
+ * @prop iconSlot
127
+ * @prop color
128
+ * @prop class: className
129
+ * @prop iconClass
130
+ * @prop txtClass
131
+ * @prop contentClass
132
+ * @prop classes
133
+ * @prop ...restProps
134
+ */
135
+ declare const ButtonToggle: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
136
+ [evt: string]: CustomEvent<any>;
137
+ }, {}, {}, string>;
138
+ type ButtonToggle = InstanceType<typeof ButtonToggle>;
139
+ export default ButtonToggle;
@@ -0,0 +1,26 @@
1
+ export default ButtonToggleGroup;
2
+ type ButtonToggleGroup = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const ButtonToggleGroup: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { CheckIconProps } from '../../types/index.js';
3
+ import clsx from 'clsx';
4
+ let { class: className, ...restProps }: CheckIconProps = $props();
5
+ </script>
6
+
7
+ <svg
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ width="16"
10
+ height="16"
11
+ viewBox="0 0 24 24"
12
+ fill="none"
13
+ stroke="currentColor"
14
+ stroke-width="2"
15
+ stroke-linecap="round"
16
+ stroke-linejoin="round"
17
+ class={clsx(className)}
18
+ {...restProps}
19
+ >
20
+ <polyline points="20 6 9 17 4 12"></polyline>
21
+ </svg>
22
+
23
+ <!--
24
+
25
+ ## Props
26
+ @prop class: className
27
+ @prop ...restProps
28
+ -->
@@ -0,0 +1,4 @@
1
+ import type { CheckIconProps } from '../../types/index.js';
2
+ declare const CheckIcon: import("svelte").Component<CheckIconProps, {}, "">;
3
+ type CheckIcon = ReturnType<typeof CheckIcon>;
4
+ export default CheckIcon;
@@ -0,0 +1,4 @@
1
+ export { default as ButtonToggleGroup } from './ButtonToggleGroup.svelte';
2
+ export { default as ButtonToggle } from './ButtonToggle.svelte';
3
+ export { default as CheckIcon } from './CheckIcon.svelte';
4
+ export { buttonToggleGroup, buttonToggle } from './theme.js';
@@ -0,0 +1,4 @@
1
+ export { default as ButtonToggleGroup } from './ButtonToggleGroup.svelte';
2
+ export { default as ButtonToggle } from './ButtonToggle.svelte';
3
+ export { default as CheckIcon } from './CheckIcon.svelte';
4
+ export { buttonToggleGroup, buttonToggle } from './theme.js';
@@ -0,0 +1,347 @@
1
+ import type { Classes } from '../../themes/themeUtils.js';
2
+ import { type VariantProps } from 'tailwind-variants';
3
+ export declare const buttonToggleGroup: import("tailwind-variants").TVReturnType<{
4
+ roundedSize: {
5
+ sm: string;
6
+ md: string;
7
+ lg: string;
8
+ xl: string;
9
+ full: string;
10
+ };
11
+ }, undefined, "inline-flex border border-gray-300 overflow-hidden", {
12
+ roundedSize: {
13
+ sm: string;
14
+ md: string;
15
+ lg: string;
16
+ xl: string;
17
+ full: string;
18
+ };
19
+ }, undefined, import("tailwind-variants").TVReturnType<{
20
+ roundedSize: {
21
+ sm: string;
22
+ md: string;
23
+ lg: string;
24
+ xl: string;
25
+ full: string;
26
+ };
27
+ }, undefined, "inline-flex border border-gray-300 overflow-hidden", unknown, unknown, undefined>>;
28
+ export type ButtonToggleVariants = VariantProps<typeof buttonToggle> & Classes<typeof buttonToggle>;
29
+ export declare const buttonToggle: import("tailwind-variants").TVReturnType<{
30
+ selected: {
31
+ true: {
32
+ text: string;
33
+ };
34
+ false: {};
35
+ };
36
+ size: {
37
+ sm: {
38
+ button: string;
39
+ };
40
+ md: {
41
+ button: string;
42
+ };
43
+ lg: {
44
+ button: string;
45
+ };
46
+ xl: {
47
+ button: string;
48
+ };
49
+ };
50
+ roundedSize: {
51
+ sm: {
52
+ button: string;
53
+ };
54
+ md: {
55
+ button: string;
56
+ };
57
+ lg: {
58
+ button: string;
59
+ };
60
+ xl: {
61
+ button: string;
62
+ };
63
+ full: {
64
+ button: string;
65
+ };
66
+ };
67
+ color: {
68
+ primary: {
69
+ button: string;
70
+ };
71
+ secondary: {
72
+ button: string;
73
+ };
74
+ gray: {
75
+ button: string;
76
+ };
77
+ red: {
78
+ button: string;
79
+ };
80
+ orange: {
81
+ button: string;
82
+ };
83
+ amber: {
84
+ button: string;
85
+ };
86
+ yellow: {
87
+ button: string;
88
+ };
89
+ lime: {
90
+ button: string;
91
+ };
92
+ green: {
93
+ button: string;
94
+ };
95
+ emerald: {
96
+ button: string;
97
+ };
98
+ teal: {
99
+ button: string;
100
+ };
101
+ cyan: {
102
+ button: string;
103
+ };
104
+ sky: {
105
+ button: string;
106
+ };
107
+ blue: {
108
+ button: string;
109
+ };
110
+ indigo: {
111
+ button: string;
112
+ };
113
+ violet: {
114
+ button: string;
115
+ };
116
+ purple: {
117
+ button: string;
118
+ };
119
+ fuchsia: {
120
+ button: string;
121
+ };
122
+ pink: {
123
+ button: string;
124
+ };
125
+ rose: {
126
+ button: string;
127
+ };
128
+ none: {};
129
+ };
130
+ }, {
131
+ button: string;
132
+ content: string;
133
+ text: string;
134
+ icon: string;
135
+ }, undefined, {
136
+ selected: {
137
+ true: {
138
+ text: string;
139
+ };
140
+ false: {};
141
+ };
142
+ size: {
143
+ sm: {
144
+ button: string;
145
+ };
146
+ md: {
147
+ button: string;
148
+ };
149
+ lg: {
150
+ button: string;
151
+ };
152
+ xl: {
153
+ button: string;
154
+ };
155
+ };
156
+ roundedSize: {
157
+ sm: {
158
+ button: string;
159
+ };
160
+ md: {
161
+ button: string;
162
+ };
163
+ lg: {
164
+ button: string;
165
+ };
166
+ xl: {
167
+ button: string;
168
+ };
169
+ full: {
170
+ button: string;
171
+ };
172
+ };
173
+ color: {
174
+ primary: {
175
+ button: string;
176
+ };
177
+ secondary: {
178
+ button: string;
179
+ };
180
+ gray: {
181
+ button: string;
182
+ };
183
+ red: {
184
+ button: string;
185
+ };
186
+ orange: {
187
+ button: string;
188
+ };
189
+ amber: {
190
+ button: string;
191
+ };
192
+ yellow: {
193
+ button: string;
194
+ };
195
+ lime: {
196
+ button: string;
197
+ };
198
+ green: {
199
+ button: string;
200
+ };
201
+ emerald: {
202
+ button: string;
203
+ };
204
+ teal: {
205
+ button: string;
206
+ };
207
+ cyan: {
208
+ button: string;
209
+ };
210
+ sky: {
211
+ button: string;
212
+ };
213
+ blue: {
214
+ button: string;
215
+ };
216
+ indigo: {
217
+ button: string;
218
+ };
219
+ violet: {
220
+ button: string;
221
+ };
222
+ purple: {
223
+ button: string;
224
+ };
225
+ fuchsia: {
226
+ button: string;
227
+ };
228
+ pink: {
229
+ button: string;
230
+ };
231
+ rose: {
232
+ button: string;
233
+ };
234
+ none: {};
235
+ };
236
+ }, {
237
+ button: string;
238
+ content: string;
239
+ text: string;
240
+ icon: string;
241
+ }, import("tailwind-variants").TVReturnType<{
242
+ selected: {
243
+ true: {
244
+ text: string;
245
+ };
246
+ false: {};
247
+ };
248
+ size: {
249
+ sm: {
250
+ button: string;
251
+ };
252
+ md: {
253
+ button: string;
254
+ };
255
+ lg: {
256
+ button: string;
257
+ };
258
+ xl: {
259
+ button: string;
260
+ };
261
+ };
262
+ roundedSize: {
263
+ sm: {
264
+ button: string;
265
+ };
266
+ md: {
267
+ button: string;
268
+ };
269
+ lg: {
270
+ button: string;
271
+ };
272
+ xl: {
273
+ button: string;
274
+ };
275
+ full: {
276
+ button: string;
277
+ };
278
+ };
279
+ color: {
280
+ primary: {
281
+ button: string;
282
+ };
283
+ secondary: {
284
+ button: string;
285
+ };
286
+ gray: {
287
+ button: string;
288
+ };
289
+ red: {
290
+ button: string;
291
+ };
292
+ orange: {
293
+ button: string;
294
+ };
295
+ amber: {
296
+ button: string;
297
+ };
298
+ yellow: {
299
+ button: string;
300
+ };
301
+ lime: {
302
+ button: string;
303
+ };
304
+ green: {
305
+ button: string;
306
+ };
307
+ emerald: {
308
+ button: string;
309
+ };
310
+ teal: {
311
+ button: string;
312
+ };
313
+ cyan: {
314
+ button: string;
315
+ };
316
+ sky: {
317
+ button: string;
318
+ };
319
+ blue: {
320
+ button: string;
321
+ };
322
+ indigo: {
323
+ button: string;
324
+ };
325
+ violet: {
326
+ button: string;
327
+ };
328
+ purple: {
329
+ button: string;
330
+ };
331
+ fuchsia: {
332
+ button: string;
333
+ };
334
+ pink: {
335
+ button: string;
336
+ };
337
+ rose: {
338
+ button: string;
339
+ };
340
+ none: {};
341
+ };
342
+ }, {
343
+ button: string;
344
+ content: string;
345
+ text: string;
346
+ icon: string;
347
+ }, undefined, unknown, unknown, undefined>>;