@casinogate/ui 0.0.4 → 1.0.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.
- package/README.md +886 -90
- package/dist/app.d.ts +1 -1
- package/dist/app.html +9 -9
- package/dist/assets/css/root.css +585 -0
- package/dist/assets/css/theme.css +2 -0
- package/dist/components/button/button.stories.svelte +2 -2
- package/dist/components/checkbox/checkbox.stories.svelte +2 -2
- package/dist/components/checkbox/components/checkbox.root.svelte +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/collapsible/collapsible.stories.svelte +2 -2
- package/dist/components/collapsible/components/collapsaible.svelte.js +1 -1
- package/dist/components/collapsible/components/collapsaible.trigger.svelte +2 -2
- package/dist/components/data-table/README.md +1285 -0
- package/dist/components/data-table/components/data-table.body.svelte +33 -0
- package/dist/components/data-table/components/data-table.body.svelte.d.ts +8 -0
- package/dist/components/data-table/components/data-table.cell.svelte +48 -0
- package/dist/components/data-table/components/data-table.cell.svelte.d.ts +10 -0
- package/dist/components/data-table/components/data-table.head.svelte +48 -0
- package/dist/components/data-table/components/data-table.head.svelte.d.ts +10 -0
- package/dist/components/data-table/components/data-table.header.svelte +41 -0
- package/dist/components/data-table/components/data-table.header.svelte.d.ts +7 -0
- package/dist/components/data-table/components/data-table.resize-handler.svelte +31 -0
- package/dist/components/data-table/components/data-table.resize-handler.svelte.d.ts +7 -0
- package/dist/components/data-table/components/data-table.root.svelte +55 -0
- package/dist/components/data-table/components/data-table.root.svelte.d.ts +34 -0
- package/dist/components/data-table/components/data-table.row.svelte +35 -0
- package/dist/components/data-table/components/data-table.row.svelte.d.ts +7 -0
- package/dist/components/data-table/components/data-table.sort-button.svelte +51 -0
- package/dist/components/data-table/components/data-table.sort-button.svelte.d.ts +7 -0
- package/dist/components/data-table/components/data-table.svelte.d.ts +139 -0
- package/dist/components/data-table/components/data-table.svelte.js +248 -0
- package/dist/components/data-table/components/data-table.table.svelte +33 -0
- package/dist/components/data-table/components/data-table.table.svelte.d.ts +8 -0
- package/dist/components/data-table/components/flex-render.svelte +32 -0
- package/dist/components/data-table/components/flex-render.svelte.d.ts +30 -0
- package/dist/components/data-table/data-table.stories.svelte +327 -0
- package/dist/components/data-table/data-table.stories.svelte.d.ts +4 -0
- package/dist/components/data-table/data-table.svelte +118 -0
- package/dist/components/data-table/data-table.svelte.d.ts +32 -0
- package/dist/components/data-table/index.js +27 -0
- package/dist/components/data-table/models/create-table.svelte.d.ts +19 -0
- package/dist/components/data-table/models/create-table.svelte.js +35 -0
- package/dist/components/data-table/models/index.d.ts +1 -0
- package/dist/components/data-table/models/index.js +1 -0
- package/dist/components/data-table/styles.d.ts +176 -0
- package/dist/components/data-table/styles.js +83 -0
- package/dist/components/data-table/types.d.ts +1 -0
- package/dist/components/data-table/types.js +1 -0
- package/dist/components/data-table/utils/index.d.ts +4 -0
- package/dist/components/data-table/utils/index.js +4 -0
- package/dist/components/data-table/utils/pagination-state.svelte.d.ts +10 -0
- package/dist/components/data-table/utils/pagination-state.svelte.js +26 -0
- package/dist/components/data-table/utils/render-helper.d.ts +90 -0
- package/dist/components/data-table/utils/render-helper.js +99 -0
- package/dist/components/data-table/utils/resize-state.svelte.d.ts +10 -0
- package/dist/components/data-table/utils/resize-state.svelte.js +23 -0
- package/dist/components/data-table/utils/row-models.d.ts +7 -0
- package/dist/components/data-table/utils/row-models.js +7 -0
- package/dist/components/data-table/utils/row-selection-state.svelte.d.ts +10 -0
- package/dist/components/data-table/utils/row-selection-state.svelte.js +23 -0
- package/dist/components/icons/caret-down.svelte +12 -0
- package/dist/components/icons/caret-down.svelte.d.ts +3 -0
- package/dist/components/icons/caret-up.svelte +12 -0
- package/dist/components/icons/caret-up.svelte.d.ts +3 -0
- package/dist/components/icons/check.svelte +12 -0
- package/dist/components/icons/check.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-down.svelte +12 -0
- package/dist/components/icons/chevron-down.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-left.svelte +12 -0
- package/dist/components/icons/chevron-left.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-right.svelte +12 -0
- package/dist/components/icons/chevron-right.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-small-down.svelte +14 -0
- package/dist/components/icons/chevron-small-down.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-small-left.svelte +14 -0
- package/dist/components/icons/chevron-small-left.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-small-right.svelte +14 -0
- package/dist/components/icons/chevron-small-right.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-small-up.svelte +14 -0
- package/dist/components/icons/chevron-small-up.svelte.d.ts +3 -0
- package/dist/components/icons/chevron-up.svelte +12 -0
- package/dist/components/icons/chevron-up.svelte.d.ts +3 -0
- package/dist/components/icons/dots.svelte +20 -0
- package/dist/components/icons/dots.svelte.d.ts +3 -0
- package/dist/components/icons/error.svelte +12 -0
- package/dist/components/icons/error.svelte.d.ts +3 -0
- package/dist/components/icons/eye-crossed.svelte +14 -0
- package/dist/components/icons/eye-crossed.svelte.d.ts +3 -0
- package/dist/components/icons/eye.svelte +17 -0
- package/dist/components/icons/eye.svelte.d.ts +3 -0
- package/dist/components/icons/index.d.ts +22 -0
- package/dist/components/icons/index.js +21 -0
- package/dist/components/icons/info.svelte +12 -0
- package/dist/components/icons/info.svelte.d.ts +3 -0
- package/dist/components/icons/minus.svelte +12 -0
- package/dist/components/icons/minus.svelte.d.ts +3 -0
- package/dist/components/icons/sort.svelte +16 -0
- package/dist/components/icons/sort.svelte.d.ts +3 -0
- package/dist/components/icons/spinner.svelte +9 -0
- package/dist/components/icons/spinner.svelte.d.ts +3 -0
- package/dist/components/icons/success.svelte +12 -0
- package/dist/components/icons/success.svelte.d.ts +3 -0
- package/dist/components/icons/types.d.ts +2 -0
- package/dist/components/icons/types.js +1 -0
- package/dist/components/icons/warning.svelte +12 -0
- package/dist/components/icons/warning.svelte.d.ts +3 -0
- package/dist/components/input/index.d.ts +6 -0
- package/dist/components/input/index.js +5 -0
- package/dist/components/input/input.password.svelte +38 -0
- package/dist/components/input/input.password.svelte.d.ts +7 -0
- package/dist/components/input/input.stories.svelte +41 -0
- package/dist/components/input/input.stories.svelte.d.ts +19 -0
- package/dist/components/input/input.svelte +65 -0
- package/dist/components/input/input.svelte.d.ts +12 -0
- package/dist/components/input/styles.d.ts +141 -0
- package/dist/components/input/styles.js +64 -0
- package/dist/components/pagination/components/pagination.ellipsis.svelte +27 -0
- package/dist/components/pagination/components/pagination.ellipsis.svelte.d.ts +7 -0
- package/dist/components/pagination/components/pagination.item.svelte +16 -0
- package/dist/components/pagination/components/pagination.item.svelte.d.ts +5 -0
- package/dist/components/pagination/components/pagination.next-button.svelte +28 -0
- package/dist/components/pagination/components/pagination.next-button.svelte.d.ts +5 -0
- package/dist/components/pagination/components/pagination.prev-button.svelte +28 -0
- package/dist/components/pagination/components/pagination.prev-button.svelte.d.ts +5 -0
- package/dist/components/pagination/components/pagination.root.svelte +29 -0
- package/dist/components/pagination/components/pagination.root.svelte.d.ts +6 -0
- package/dist/components/pagination/index.d.ts +16 -0
- package/dist/components/pagination/index.js +16 -0
- package/dist/components/pagination/pagination.stories.svelte +69 -0
- package/dist/components/pagination/pagination.stories.svelte.d.ts +19 -0
- package/dist/components/pagination/presets/basic.svelte +31 -0
- package/dist/components/pagination/presets/basic.svelte.d.ts +5 -0
- package/dist/components/pagination/presets/index.d.ts +1 -0
- package/dist/components/pagination/presets/index.js +1 -0
- package/dist/components/pagination/styles.d.ts +98 -0
- package/dist/components/pagination/styles.js +51 -0
- package/dist/components/segment/components/segment.item.svelte +38 -0
- package/dist/components/segment/components/segment.item.svelte.d.ts +9 -0
- package/dist/components/segment/components/segment.root.svelte +66 -0
- package/dist/components/segment/components/segment.root.svelte.d.ts +13 -0
- package/dist/components/segment/components/segment.thumb.svelte +0 -0
- package/dist/components/segment/components/segment.thumb.svelte.d.ts +26 -0
- package/dist/components/segment/components/segmet.svelte.d.ts +43 -0
- package/dist/components/segment/components/segmet.svelte.js +74 -0
- package/dist/components/segment/index.d.ts +7 -0
- package/dist/components/segment/index.js +6 -0
- package/dist/components/segment/segment.stories.svelte +43 -0
- package/dist/components/segment/segment.stories.svelte.d.ts +18 -0
- package/dist/components/segment/styles.d.ts +107 -0
- package/dist/components/segment/styles.js +58 -0
- package/dist/components/select/components/select.content.svelte +0 -0
- package/dist/components/select/components/select.content.svelte.d.ts +26 -0
- package/dist/components/select/components/select.item.svelte +0 -0
- package/dist/components/select/components/select.item.svelte.d.ts +26 -0
- package/dist/components/select/components/select.root.svelte +27 -0
- package/dist/components/select/components/select.root.svelte.d.ts +6 -0
- package/dist/components/select/components/select.trigger.svelte +52 -0
- package/dist/components/select/components/select.trigger.svelte.d.ts +10 -0
- package/dist/components/select/components/select.viewport.svelte +0 -0
- package/dist/components/select/components/select.viewport.svelte.d.ts +26 -0
- package/dist/components/select/index.d.ts +7 -0
- package/dist/components/select/index.js +6 -0
- package/dist/components/select/select.stories.svelte +53 -0
- package/dist/components/select/select.stories.svelte.d.ts +18 -0
- package/dist/components/select/styles.d.ts +149 -0
- package/dist/components/select/styles.js +93 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/skeleton/skeleton.stories.svelte +121 -0
- package/dist/components/skeleton/skeleton.stories.svelte.d.ts +19 -0
- package/dist/components/skeleton/skeleton.svelte +25 -0
- package/dist/components/skeleton/skeleton.svelte.d.ts +8 -0
- package/dist/components/skeleton/styles.d.ts +78 -0
- package/dist/components/skeleton/styles.js +30 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.stories.svelte +29 -0
- package/dist/components/spinner/spinner.stories.svelte.d.ts +19 -0
- package/dist/components/spinner/spinner.svelte +24 -0
- package/dist/components/spinner/spinner.svelte.d.ts +9 -0
- package/dist/components/switch/index.d.ts +7 -2
- package/dist/components/switch/index.js +6 -3
- package/dist/components/switch/model/index.d.ts +1 -1
- package/dist/components/switch/model/index.js +1 -1
- package/dist/components/switch/model/switch-model.svelte.d.ts +1 -1
- package/dist/components/switch/model/switch-model.svelte.js +1 -1
- package/dist/components/switch/presets/basic.svelte +14 -0
- package/dist/components/switch/presets/basic.svelte.d.ts +5 -0
- package/dist/components/switch/switch.stories.svelte +16 -9
- package/dist/components/switch/switch.stories.svelte.d.ts +1 -0
- package/dist/components/toast/toast.component.svelte +2 -5
- package/dist/components/toast/toast.stories.svelte +2 -2
- package/dist/index.d.ts +10 -1
- package/dist/index.js +10 -1
- package/dist/internal/mocks/data-table.d.ts +9 -0
- package/dist/internal/mocks/data-table.js +146 -0
- package/dist/internal/types/common.d.ts +1 -0
- package/dist/internal/utils/attrs.d.ts +3 -0
- package/dist/internal/utils/attrs.js +9 -0
- package/dist/internal/utils/objects.d.ts +12 -0
- package/dist/internal/utils/objects.js +52 -0
- package/dist/internal/utils/tailwindcss.js +1 -0
- package/package.json +9 -2
- package/dist/assets/icons/check.svg +0 -4
- package/dist/assets/icons/chevron-down.svg +0 -4
- package/dist/assets/icons/chevron-left.svg +0 -4
- package/dist/assets/icons/chevron-right.svg +0 -4
- package/dist/assets/icons/chevron-small-down.svg +0 -4
- package/dist/assets/icons/chevron-small-left.svg +0 -4
- package/dist/assets/icons/chevron-small-right.svg +0 -4
- package/dist/assets/icons/chevron-small-up.svg +0 -4
- package/dist/assets/icons/chevron-up.svg +0 -4
- package/dist/assets/icons/error.svg +0 -4
- package/dist/assets/icons/info.svg +0 -4
- package/dist/assets/icons/minus.svg +0 -4
- package/dist/assets/icons/success.svg +0 -4
- package/dist/assets/icons/warning.svg +0 -3
- package/dist/internal/types/attrs.d.ts +0 -1
- package/dist/internal/types/attrs.js +0 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Context } from 'runed';
|
|
2
|
+
import type { ReadableBox } from 'svelte-toolbelt';
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
variant: {
|
|
6
|
+
primary: {
|
|
7
|
+
root: string[];
|
|
8
|
+
item: string[];
|
|
9
|
+
thumb: string[];
|
|
10
|
+
};
|
|
11
|
+
clear: {};
|
|
12
|
+
};
|
|
13
|
+
rounded: {
|
|
14
|
+
sm: {
|
|
15
|
+
root: string[];
|
|
16
|
+
};
|
|
17
|
+
md: {
|
|
18
|
+
root: string[];
|
|
19
|
+
};
|
|
20
|
+
clear: {};
|
|
21
|
+
};
|
|
22
|
+
size: {
|
|
23
|
+
sm: {
|
|
24
|
+
item: string[];
|
|
25
|
+
};
|
|
26
|
+
md: {
|
|
27
|
+
item: string[];
|
|
28
|
+
};
|
|
29
|
+
lg: {
|
|
30
|
+
item: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
root: string[];
|
|
35
|
+
item: string[];
|
|
36
|
+
thumb: string[];
|
|
37
|
+
}, undefined, {
|
|
38
|
+
variant: {
|
|
39
|
+
primary: {
|
|
40
|
+
root: string[];
|
|
41
|
+
item: string[];
|
|
42
|
+
thumb: string[];
|
|
43
|
+
};
|
|
44
|
+
clear: {};
|
|
45
|
+
};
|
|
46
|
+
rounded: {
|
|
47
|
+
sm: {
|
|
48
|
+
root: string[];
|
|
49
|
+
};
|
|
50
|
+
md: {
|
|
51
|
+
root: string[];
|
|
52
|
+
};
|
|
53
|
+
clear: {};
|
|
54
|
+
};
|
|
55
|
+
size: {
|
|
56
|
+
sm: {
|
|
57
|
+
item: string[];
|
|
58
|
+
};
|
|
59
|
+
md: {
|
|
60
|
+
item: string[];
|
|
61
|
+
};
|
|
62
|
+
lg: {
|
|
63
|
+
item: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
root: string[];
|
|
68
|
+
item: string[];
|
|
69
|
+
thumb: string[];
|
|
70
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
71
|
+
variant: {
|
|
72
|
+
primary: {
|
|
73
|
+
root: string[];
|
|
74
|
+
item: string[];
|
|
75
|
+
thumb: string[];
|
|
76
|
+
};
|
|
77
|
+
clear: {};
|
|
78
|
+
};
|
|
79
|
+
rounded: {
|
|
80
|
+
sm: {
|
|
81
|
+
root: string[];
|
|
82
|
+
};
|
|
83
|
+
md: {
|
|
84
|
+
root: string[];
|
|
85
|
+
};
|
|
86
|
+
clear: {};
|
|
87
|
+
};
|
|
88
|
+
size: {
|
|
89
|
+
sm: {
|
|
90
|
+
item: string[];
|
|
91
|
+
};
|
|
92
|
+
md: {
|
|
93
|
+
item: string[];
|
|
94
|
+
};
|
|
95
|
+
lg: {
|
|
96
|
+
item: string[];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
root: string[];
|
|
101
|
+
item: string[];
|
|
102
|
+
thumb: string[];
|
|
103
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
104
|
+
export type SegmentVariantsProps = VariantProps<typeof segmentVariants>;
|
|
105
|
+
type SegmentStylesContextValues = ReadableBox<ReturnType<typeof segmentVariants>>;
|
|
106
|
+
export declare const SegmentStylesContext: Context<SegmentStylesContextValues>;
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { keyWithPrefix } from '../../internal/utils/common.js';
|
|
2
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
3
|
+
import { Context } from 'runed';
|
|
4
|
+
export const segmentVariants = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
root: [
|
|
7
|
+
'cgui:flex cgui:items-center cgui:p-1',
|
|
8
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
9
|
+
'cgui:data-[disabled=""]:opacity-50 cgui:data-[disabled=""]:cursor-not-allowed cgui:data-[disabled=""]:pointer-events-none',
|
|
10
|
+
],
|
|
11
|
+
item: [
|
|
12
|
+
'cgui:flex cgui:items-center cgui:justify-center cgui:flex-1',
|
|
13
|
+
'cgui:font-medium cgui:text-body-2',
|
|
14
|
+
'cgui:rounded-[inherit]',
|
|
15
|
+
'cgui:cursor-pointer cgui:overflow-hidden cgui:select-none',
|
|
16
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
17
|
+
],
|
|
18
|
+
thumb: [
|
|
19
|
+
'cgui:rounded-[inherit] cgui:pointer-events-none',
|
|
20
|
+
'cgui:shadow-segment-thumb',
|
|
21
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
primary: {
|
|
27
|
+
root: ['cgui:bg-surface-primary-light cgui:border cgui:border-stroke-divider'],
|
|
28
|
+
item: [
|
|
29
|
+
'cgui:text-fg-regular',
|
|
30
|
+
'cgui:data-[active=""]:text-fg-primary cgui:data-[active=""]:bg-surface-white cgui:data-[active=""]:shadow-segment-thumb',
|
|
31
|
+
],
|
|
32
|
+
thumb: ['cgui:bg-surface-white'],
|
|
33
|
+
},
|
|
34
|
+
clear: {},
|
|
35
|
+
},
|
|
36
|
+
rounded: {
|
|
37
|
+
sm: {
|
|
38
|
+
root: ['cgui:rounded-sm'],
|
|
39
|
+
},
|
|
40
|
+
md: {
|
|
41
|
+
root: ['cgui:rounded-md'],
|
|
42
|
+
},
|
|
43
|
+
clear: {},
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
sm: {
|
|
47
|
+
item: ['cgui:h-6'],
|
|
48
|
+
},
|
|
49
|
+
md: {
|
|
50
|
+
item: ['cgui:h-8.5'],
|
|
51
|
+
},
|
|
52
|
+
lg: {
|
|
53
|
+
item: ['cgui:h-11'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
export const SegmentStylesContext = new Context(keyWithPrefix('segment-styles'));
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Select;
|
|
2
|
+
type Select = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Select: $$__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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Select;
|
|
2
|
+
type Select = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Select: $$__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,27 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type SelectRootProps = SelectRootPropsPrimitive & SelectVariantsProps;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { box } from 'svelte-toolbelt';
|
|
7
|
+
|
|
8
|
+
import { SelectStylesContext, selectVariants, type SelectVariantsProps } from '../styles.js';
|
|
9
|
+
|
|
10
|
+
import { Select as SelectPrimitive, type SelectRootProps as SelectRootPropsPrimitive } from 'bits-ui';
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
value = $bindable(''),
|
|
14
|
+
open = $bindable(false),
|
|
15
|
+
size = 'md',
|
|
16
|
+
variant = 'primary',
|
|
17
|
+
rounded = 'sm',
|
|
18
|
+
w = 'full',
|
|
19
|
+
...restProps
|
|
20
|
+
}: SelectRootProps = $props();
|
|
21
|
+
|
|
22
|
+
const variants = $derived(selectVariants({ size, variant, rounded, w }));
|
|
23
|
+
|
|
24
|
+
SelectStylesContext.set(box.with(() => variants));
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<SelectPrimitive.Root bind:value={value as never} bind:open {...restProps} />
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type SelectRootProps = SelectRootPropsPrimitive & SelectVariantsProps;
|
|
2
|
+
import { type SelectVariantsProps } from '../styles.js';
|
|
3
|
+
import { type SelectRootProps as SelectRootPropsPrimitive } from 'bits-ui';
|
|
4
|
+
declare const Select: import("svelte").Component<SelectRootProps, {}, "value" | "open">;
|
|
5
|
+
type Select = ReturnType<typeof Select>;
|
|
6
|
+
export default Select;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type SelectTriggerProps = WithoutChild<SelectTriggerPropsPrimitive> & {
|
|
3
|
+
startChevron?: Snippet;
|
|
4
|
+
|
|
5
|
+
endChevron?: Snippet;
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { getDataActive } from '../../../internal/utils/attrs.js';
|
|
11
|
+
import { cn } from '../../../internal/utils/common.js';
|
|
12
|
+
import { Select as SelectPrimitive, useId, type SelectTriggerProps as SelectTriggerPropsPrimitive } from 'bits-ui';
|
|
13
|
+
import type { Snippet } from 'svelte';
|
|
14
|
+
import type { WithoutChild } from 'svelte-toolbelt';
|
|
15
|
+
import { SelectStylesContext } from '../styles.js';
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
ref = $bindable(null),
|
|
19
|
+
id = useId(),
|
|
20
|
+
class: className,
|
|
21
|
+
startChevron,
|
|
22
|
+
endChevron,
|
|
23
|
+
children,
|
|
24
|
+
...restProps
|
|
25
|
+
}: SelectTriggerProps = $props();
|
|
26
|
+
|
|
27
|
+
const styles = SelectStylesContext.get();
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<SelectPrimitive.Trigger
|
|
31
|
+
bind:ref
|
|
32
|
+
{id}
|
|
33
|
+
data-slot="trigger"
|
|
34
|
+
data-start-chevron={getDataActive(Boolean(startChevron))}
|
|
35
|
+
data-end-chevron={getDataActive(Boolean(endChevron))}
|
|
36
|
+
class={cn(styles.current.trigger(), className)}
|
|
37
|
+
{...restProps}
|
|
38
|
+
>
|
|
39
|
+
{#if startChevron}
|
|
40
|
+
<span data-slot="start-chevron" class={styles.current.chevron()}>
|
|
41
|
+
{@render startChevron()}
|
|
42
|
+
</span>
|
|
43
|
+
{/if}
|
|
44
|
+
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
|
|
47
|
+
{#if endChevron}
|
|
48
|
+
<span data-slot="end-chevron" class={styles.current.chevron()}>
|
|
49
|
+
{@render endChevron()}
|
|
50
|
+
</span>
|
|
51
|
+
{/if}
|
|
52
|
+
</SelectPrimitive.Trigger>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SelectTriggerProps = WithoutChild<SelectTriggerPropsPrimitive> & {
|
|
2
|
+
startChevron?: Snippet;
|
|
3
|
+
endChevron?: Snippet;
|
|
4
|
+
};
|
|
5
|
+
import { type SelectTriggerProps as SelectTriggerPropsPrimitive } from 'bits-ui';
|
|
6
|
+
import type { Snippet } from 'svelte';
|
|
7
|
+
import type { WithoutChild } from 'svelte-toolbelt';
|
|
8
|
+
declare const Select: import("svelte").Component<SelectTriggerProps, {}, "ref">;
|
|
9
|
+
type Select = ReturnType<typeof Select>;
|
|
10
|
+
export default Select;
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Select;
|
|
2
|
+
type Select = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Select: $$__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,7 @@
|
|
|
1
|
+
import { type SelectRootProps } from './components/select.root.svelte';
|
|
2
|
+
import { type SelectTriggerProps } from './components/select.trigger.svelte';
|
|
3
|
+
export declare const SelectPrimitive: {
|
|
4
|
+
Root: import("svelte").Component<SelectRootProps, {}, "value" | "open">;
|
|
5
|
+
Trigger: import("svelte").Component<SelectTriggerProps, {}, "ref">;
|
|
6
|
+
};
|
|
7
|
+
export type { SelectRootProps, SelectTriggerProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { ChevronDownIcon } from '../icons/index.js';
|
|
3
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
4
|
+
import type { Parameters } from '@storybook/sveltekit';
|
|
5
|
+
import type { ComponentProps } from 'svelte';
|
|
6
|
+
import { SelectPrimitive } from './index.js';
|
|
7
|
+
|
|
8
|
+
const parameters: Parameters = {
|
|
9
|
+
controls: {
|
|
10
|
+
include: ['size', 'variant', 'rounded', 'w'],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { Story } = defineMeta({
|
|
15
|
+
title: 'UI Kit/Select',
|
|
16
|
+
component: SelectPrimitive.Root,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
type Args = ComponentProps<typeof SelectPrimitive.Root>;
|
|
21
|
+
|
|
22
|
+
const args: Args = {
|
|
23
|
+
size: 'md',
|
|
24
|
+
variant: 'primary',
|
|
25
|
+
rounded: 'sm',
|
|
26
|
+
w: 'full',
|
|
27
|
+
type: 'single',
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#snippet startChevron()}
|
|
32
|
+
<ChevronDownIcon class="cgui:size-4" />
|
|
33
|
+
{/snippet}
|
|
34
|
+
|
|
35
|
+
{#snippet endChevron()}
|
|
36
|
+
<ChevronDownIcon class="cgui:size-4" />
|
|
37
|
+
{/snippet}
|
|
38
|
+
|
|
39
|
+
<Story name="Basic" {args} {parameters}>
|
|
40
|
+
{#snippet template(args: Args)}
|
|
41
|
+
<SelectPrimitive.Root {...args}>
|
|
42
|
+
<SelectPrimitive.Trigger>Select</SelectPrimitive.Trigger>
|
|
43
|
+
</SelectPrimitive.Root>
|
|
44
|
+
{/snippet}
|
|
45
|
+
</Story>
|
|
46
|
+
|
|
47
|
+
<Story name="With Chevron" {args} {parameters}>
|
|
48
|
+
{#snippet template(args: Args)}
|
|
49
|
+
<SelectPrimitive.Root {...args}>
|
|
50
|
+
<SelectPrimitive.Trigger {startChevron} {endChevron}>Select</SelectPrimitive.Trigger>
|
|
51
|
+
</SelectPrimitive.Root>
|
|
52
|
+
{/snippet}
|
|
53
|
+
</Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
declare const Select: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Select = InstanceType<typeof Select>;
|
|
18
|
+
export default Select;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Context } from 'runed';
|
|
2
|
+
import type { ReadableBox } from 'svelte-toolbelt';
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
export declare const selectVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
variant: {
|
|
6
|
+
primary: {
|
|
7
|
+
trigger: string[];
|
|
8
|
+
};
|
|
9
|
+
outline: {
|
|
10
|
+
trigger: string[];
|
|
11
|
+
};
|
|
12
|
+
clear: {};
|
|
13
|
+
};
|
|
14
|
+
size: {
|
|
15
|
+
sm: {
|
|
16
|
+
trigger: string[];
|
|
17
|
+
};
|
|
18
|
+
md: {
|
|
19
|
+
trigger: string[];
|
|
20
|
+
chevron: never[];
|
|
21
|
+
};
|
|
22
|
+
lg: {
|
|
23
|
+
trigger: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
rounded: {
|
|
27
|
+
sm: {
|
|
28
|
+
trigger: string[];
|
|
29
|
+
};
|
|
30
|
+
md: {
|
|
31
|
+
trigger: string[];
|
|
32
|
+
};
|
|
33
|
+
lg: {
|
|
34
|
+
trigger: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
w: {
|
|
38
|
+
full: {
|
|
39
|
+
trigger: string[];
|
|
40
|
+
};
|
|
41
|
+
auto: {
|
|
42
|
+
trigger: string[];
|
|
43
|
+
};
|
|
44
|
+
fit: {
|
|
45
|
+
trigger: string[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}, {
|
|
49
|
+
trigger: string[];
|
|
50
|
+
chevron: string[];
|
|
51
|
+
}, undefined, {
|
|
52
|
+
variant: {
|
|
53
|
+
primary: {
|
|
54
|
+
trigger: string[];
|
|
55
|
+
};
|
|
56
|
+
outline: {
|
|
57
|
+
trigger: string[];
|
|
58
|
+
};
|
|
59
|
+
clear: {};
|
|
60
|
+
};
|
|
61
|
+
size: {
|
|
62
|
+
sm: {
|
|
63
|
+
trigger: string[];
|
|
64
|
+
};
|
|
65
|
+
md: {
|
|
66
|
+
trigger: string[];
|
|
67
|
+
chevron: never[];
|
|
68
|
+
};
|
|
69
|
+
lg: {
|
|
70
|
+
trigger: string[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
rounded: {
|
|
74
|
+
sm: {
|
|
75
|
+
trigger: string[];
|
|
76
|
+
};
|
|
77
|
+
md: {
|
|
78
|
+
trigger: string[];
|
|
79
|
+
};
|
|
80
|
+
lg: {
|
|
81
|
+
trigger: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
w: {
|
|
85
|
+
full: {
|
|
86
|
+
trigger: string[];
|
|
87
|
+
};
|
|
88
|
+
auto: {
|
|
89
|
+
trigger: string[];
|
|
90
|
+
};
|
|
91
|
+
fit: {
|
|
92
|
+
trigger: string[];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
trigger: string[];
|
|
97
|
+
chevron: string[];
|
|
98
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
99
|
+
variant: {
|
|
100
|
+
primary: {
|
|
101
|
+
trigger: string[];
|
|
102
|
+
};
|
|
103
|
+
outline: {
|
|
104
|
+
trigger: string[];
|
|
105
|
+
};
|
|
106
|
+
clear: {};
|
|
107
|
+
};
|
|
108
|
+
size: {
|
|
109
|
+
sm: {
|
|
110
|
+
trigger: string[];
|
|
111
|
+
};
|
|
112
|
+
md: {
|
|
113
|
+
trigger: string[];
|
|
114
|
+
chevron: never[];
|
|
115
|
+
};
|
|
116
|
+
lg: {
|
|
117
|
+
trigger: string[];
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
rounded: {
|
|
121
|
+
sm: {
|
|
122
|
+
trigger: string[];
|
|
123
|
+
};
|
|
124
|
+
md: {
|
|
125
|
+
trigger: string[];
|
|
126
|
+
};
|
|
127
|
+
lg: {
|
|
128
|
+
trigger: string[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
w: {
|
|
132
|
+
full: {
|
|
133
|
+
trigger: string[];
|
|
134
|
+
};
|
|
135
|
+
auto: {
|
|
136
|
+
trigger: string[];
|
|
137
|
+
};
|
|
138
|
+
fit: {
|
|
139
|
+
trigger: string[];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
}, {
|
|
143
|
+
trigger: string[];
|
|
144
|
+
chevron: string[];
|
|
145
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
146
|
+
export type SelectVariantsProps = VariantProps<typeof selectVariants>;
|
|
147
|
+
type SelectStylesContextValues = ReadableBox<ReturnType<typeof selectVariants>>;
|
|
148
|
+
export declare const SelectStylesContext: Context<SelectStylesContextValues>;
|
|
149
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
|
+
import { Context } from 'runed';
|
|
3
|
+
import { keyWithPrefix } from './../../internal/utils/common.js';
|
|
4
|
+
export const selectVariants = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
trigger: [
|
|
7
|
+
'cgui:relative cgui:flex cgui:items-center cgui:justify-start cgui:flex-wrap',
|
|
8
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
9
|
+
],
|
|
10
|
+
chevron: [
|
|
11
|
+
'cgui:absolute cgui:top-1/2 cgui:-translate-y-1/2 cgui:flex cgui:items-center cgui:justify-center cgui:size-6',
|
|
12
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
13
|
+
'cgui:text-icon-regular',
|
|
14
|
+
'cgui:data-[slot=start-chevron]:left-0 cgui:data-[slot=end-chevron]:right-0',
|
|
15
|
+
'cgui:data-[slot=start-chevron]:translate-x-1/2 cgui:data-[slot=end-chevron]:-translate-x-1/2',
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
primary: {
|
|
21
|
+
trigger: [
|
|
22
|
+
'cgui:bg-surface-lightest cgui:border cgui:border-stroke-default',
|
|
23
|
+
'cgui:data-[placeholder]:text-fg-regular cgui:text-fg-dark',
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
outline: {
|
|
27
|
+
trigger: [
|
|
28
|
+
'cgui:data-[placeholder]:text-fg-regular cgui:text-fg-dark',
|
|
29
|
+
'cgui:border-b cgui:border-b-stroke-default',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
clear: {},
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
sm: {
|
|
36
|
+
trigger: [
|
|
37
|
+
'cgui:min-h-7.5',
|
|
38
|
+
'cgui:px-2.5 cgui:py-1.5',
|
|
39
|
+
'cgui:data-[start-chevron]:pl-8 cgui:data-[end-chevron]:pr-8',
|
|
40
|
+
],
|
|
41
|
+
// chevron: ['cgui:data-[start-chevron]:left-2.5 cgui:data-[end-chevron]:right-2.5'],
|
|
42
|
+
},
|
|
43
|
+
md: {
|
|
44
|
+
trigger: [
|
|
45
|
+
'cgui:min-h-9',
|
|
46
|
+
'cgui:px-3 cgui:py-2',
|
|
47
|
+
'cgui:data-[start-chevron]:pl-10 cgui:data-[end-chevron]:pr-10',
|
|
48
|
+
],
|
|
49
|
+
chevron: [],
|
|
50
|
+
// chevron: ['cgui:data-[start-chevron]:left-3 cgui:data-[end-chevron]:right-3'],
|
|
51
|
+
},
|
|
52
|
+
lg: {
|
|
53
|
+
trigger: [
|
|
54
|
+
'cgui:min-h-11',
|
|
55
|
+
'cgui:px-4 cgui:py-2.5',
|
|
56
|
+
'cgui:data-[start-chevron]:pl-14 cgui:data-[end-chevron]:pr-14',
|
|
57
|
+
],
|
|
58
|
+
// chevron: ['cgui:data-[start-chevron]:left-4 cgui:data-[end-chevron]:right-4'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
rounded: {
|
|
62
|
+
sm: {
|
|
63
|
+
trigger: ['cgui:rounded-sm'],
|
|
64
|
+
},
|
|
65
|
+
md: {
|
|
66
|
+
trigger: ['cgui:rounded-md'],
|
|
67
|
+
},
|
|
68
|
+
lg: {
|
|
69
|
+
trigger: ['cgui:rounded-lg'],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
w: {
|
|
73
|
+
full: {
|
|
74
|
+
trigger: ['cgui:w-full'],
|
|
75
|
+
},
|
|
76
|
+
auto: {
|
|
77
|
+
trigger: ['cgui:w-auto'],
|
|
78
|
+
},
|
|
79
|
+
fit: {
|
|
80
|
+
trigger: ['cgui:w-fit'],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
compoundVariants: [
|
|
85
|
+
{
|
|
86
|
+
variant: 'outline',
|
|
87
|
+
class: {
|
|
88
|
+
trigger: ['cgui:rounded-none'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
});
|
|
93
|
+
export const SelectStylesContext = new Context(keyWithPrefix('select-styles'));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Skeleton, type SkeletonProps } from './skeleton.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Skeleton } from './skeleton.svelte';
|