@urbicon-ui/blocks 6.21.1 → 6.21.3
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/components/NumberInput/NumberInput.svelte +197 -0
- package/dist/components/NumberInput/NumberInput.svelte.d.ts +4 -0
- package/dist/components/NumberInput/index.d.ts +55 -0
- package/dist/components/NumberInput/index.js +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/i18n/index.d.ts +6 -0
- package/dist/primitives/Avatar/avatar.variants.d.ts +6 -6
- package/dist/primitives/Badge/Badge.svelte +18 -8
- package/dist/primitives/Badge/index.d.ts +26 -6
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +11 -6
- package/dist/primitives/Breadcrumb/index.d.ts +2 -2
- package/dist/primitives/Button/button.variants.d.ts +4 -4
- package/dist/primitives/ButtonGroup/index.d.ts +1 -1
- package/dist/primitives/Card/card.variants.d.ts +5 -5
- package/dist/primitives/Checkbox/Checkbox.svelte +3 -3
- package/dist/primitives/Combobox/Combobox.svelte +478 -104
- package/dist/primitives/Combobox/combobox.variants.d.ts +89 -17
- package/dist/primitives/Combobox/combobox.variants.js +94 -13
- package/dist/primitives/Combobox/index.d.ts +166 -51
- package/dist/primitives/ConfirmDialog/index.d.ts +19 -0
- package/dist/primitives/Dialog/Dialog.svelte +74 -0
- package/dist/primitives/Dialog/dialog.variants.d.ts +9 -9
- package/dist/primitives/Dialog/index.d.ts +12 -1
- package/dist/primitives/Drawer/Drawer.svelte +2 -1
- package/dist/primitives/Drawer/drawer.variants.d.ts +8 -0
- package/dist/primitives/Drawer/drawer.variants.js +45 -10
- package/dist/primitives/Drawer/index.d.ts +13 -4
- package/dist/primitives/FormField/FormField.svelte +6 -6
- package/dist/primitives/FormField/index.d.ts +13 -4
- package/dist/primitives/Input/Input.svelte +8 -4
- package/dist/primitives/Input/input.variants.d.ts +9 -9
- package/dist/primitives/Menu/Menu.svelte +66 -4
- package/dist/primitives/Menu/index.d.ts +25 -0
- package/dist/primitives/Pagination/Pagination.svelte +28 -13
- package/dist/primitives/Pagination/index.d.ts +44 -0
- package/dist/primitives/Popover/Popover.svelte +34 -3
- package/dist/primitives/Popover/index.d.ts +3 -3
- package/dist/primitives/RadioGroup/RadioGroup.svelte +3 -3
- package/dist/primitives/Select/Select.svelte +21 -11
- package/dist/primitives/Select/index.d.ts +7 -0
- package/dist/primitives/Select/select.variants.d.ts +17 -17
- package/dist/primitives/Select/select.variants.js +18 -0
- package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -3
- package/dist/primitives/Slider/Slider.svelte +4 -8
- package/dist/primitives/Spinner/spinner.variants.d.ts +16 -16
- package/dist/primitives/Textarea/Textarea.svelte +13 -5
- package/dist/primitives/Textarea/textarea.variants.d.ts +7 -7
- package/dist/primitives/Textarea/textarea.variants.js +5 -2
- package/dist/primitives/Toast/Toaster.svelte +42 -2
- package/dist/primitives/Toast/index.d.ts +30 -0
- package/dist/primitives/Toast/toast.store.svelte.d.ts +25 -1
- package/dist/primitives/Toast/toast.store.svelte.js +91 -1
- package/dist/primitives/Toast/toast.variants.d.ts +18 -0
- package/dist/primitives/Toast/toast.variants.js +15 -0
- package/dist/primitives/Toggle/Toggle.svelte +17 -3
- package/dist/primitives/Toggle/index.d.ts +8 -2
- package/dist/primitives/Toggle/toggle.variants.d.ts +7 -0
- package/dist/primitives/Toggle/toggle.variants.js +26 -0
- package/dist/primitives/Toolbar/toolbar.variants.d.ts +6 -6
- package/dist/primitives/Tooltip/Tooltip.svelte +47 -21
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/primitives/Tooltip/index.d.ts +31 -3
- package/dist/primitives/Tooltip/tooltip.variants.d.ts +4 -4
- package/dist/primitives/Tooltip/tooltip.variants.js +2 -2
- package/dist/primitives/index.d.ts +3 -3
- package/dist/style/semantic.css +55 -29
- package/dist/translations/de.d.ts +3 -0
- package/dist/translations/de.js +4 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +4 -1
- package/dist/utils/figma-token-export.d.ts +13 -0
- package/dist/utils/figma-token-export.js +99 -26
- package/dist/utils/guide.svelte.d.ts +8 -2
- package/dist/utils/guide.svelte.js +86 -5
- package/dist/utils/use-form-field.svelte.d.ts +9 -9
- package/dist/utils/use-form-field.svelte.js +12 -12
- package/package.json +3 -3
|
@@ -2,14 +2,14 @@ import { type SlotNames, type VariantProps } from '../../utils/variants.js';
|
|
|
2
2
|
export declare const comboboxVariants: ((props?: {
|
|
3
3
|
tier?: "commit" | "modify" | undefined;
|
|
4
4
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
5
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
6
6
|
open?: boolean | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
8
|
} | undefined) => {
|
|
9
9
|
base: (props?: ({
|
|
10
10
|
tier?: "commit" | "modify" | undefined;
|
|
11
11
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
12
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
12
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
13
13
|
open?: boolean | undefined;
|
|
14
14
|
disabled?: boolean | undefined;
|
|
15
15
|
} & {
|
|
@@ -18,7 +18,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
18
18
|
label: (props?: ({
|
|
19
19
|
tier?: "commit" | "modify" | undefined;
|
|
20
20
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
21
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
21
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
22
22
|
open?: boolean | undefined;
|
|
23
23
|
disabled?: boolean | undefined;
|
|
24
24
|
} & {
|
|
@@ -27,7 +27,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
27
27
|
requiredMark: (props?: ({
|
|
28
28
|
tier?: "commit" | "modify" | undefined;
|
|
29
29
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
30
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
30
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
31
31
|
open?: boolean | undefined;
|
|
32
32
|
disabled?: boolean | undefined;
|
|
33
33
|
} & {
|
|
@@ -36,7 +36,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
36
36
|
inputWrapper: (props?: ({
|
|
37
37
|
tier?: "commit" | "modify" | undefined;
|
|
38
38
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
39
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
39
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
40
40
|
open?: boolean | undefined;
|
|
41
41
|
disabled?: boolean | undefined;
|
|
42
42
|
} & {
|
|
@@ -45,7 +45,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
45
45
|
input: (props?: ({
|
|
46
46
|
tier?: "commit" | "modify" | undefined;
|
|
47
47
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
48
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
48
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
49
49
|
open?: boolean | undefined;
|
|
50
50
|
disabled?: boolean | undefined;
|
|
51
51
|
} & {
|
|
@@ -54,16 +54,16 @@ export declare const comboboxVariants: ((props?: {
|
|
|
54
54
|
message: (props?: ({
|
|
55
55
|
tier?: "commit" | "modify" | undefined;
|
|
56
56
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
57
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
57
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
58
58
|
open?: boolean | undefined;
|
|
59
59
|
disabled?: boolean | undefined;
|
|
60
60
|
} & {
|
|
61
61
|
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
62
62
|
}) | undefined) => string;
|
|
63
|
-
|
|
63
|
+
helper: (props?: ({
|
|
64
64
|
tier?: "commit" | "modify" | undefined;
|
|
65
65
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
66
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
66
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
67
67
|
open?: boolean | undefined;
|
|
68
68
|
disabled?: boolean | undefined;
|
|
69
69
|
} & {
|
|
@@ -72,7 +72,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
72
72
|
listbox: (props?: ({
|
|
73
73
|
tier?: "commit" | "modify" | undefined;
|
|
74
74
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
75
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
75
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
76
76
|
open?: boolean | undefined;
|
|
77
77
|
disabled?: boolean | undefined;
|
|
78
78
|
} & {
|
|
@@ -81,7 +81,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
81
81
|
option: (props?: ({
|
|
82
82
|
tier?: "commit" | "modify" | undefined;
|
|
83
83
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
84
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
84
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
85
85
|
open?: boolean | undefined;
|
|
86
86
|
disabled?: boolean | undefined;
|
|
87
87
|
} & {
|
|
@@ -90,7 +90,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
90
90
|
optionActive: (props?: ({
|
|
91
91
|
tier?: "commit" | "modify" | undefined;
|
|
92
92
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
93
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
93
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
94
94
|
open?: boolean | undefined;
|
|
95
95
|
disabled?: boolean | undefined;
|
|
96
96
|
} & {
|
|
@@ -99,7 +99,25 @@ export declare const comboboxVariants: ((props?: {
|
|
|
99
99
|
optionSelected: (props?: ({
|
|
100
100
|
tier?: "commit" | "modify" | undefined;
|
|
101
101
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
102
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
102
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
103
|
+
open?: boolean | undefined;
|
|
104
|
+
disabled?: boolean | undefined;
|
|
105
|
+
} & {
|
|
106
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
107
|
+
}) | undefined) => string;
|
|
108
|
+
group: (props?: ({
|
|
109
|
+
tier?: "commit" | "modify" | undefined;
|
|
110
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
111
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
112
|
+
open?: boolean | undefined;
|
|
113
|
+
disabled?: boolean | undefined;
|
|
114
|
+
} & {
|
|
115
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
116
|
+
}) | undefined) => string;
|
|
117
|
+
groupLabel: (props?: ({
|
|
118
|
+
tier?: "commit" | "modify" | undefined;
|
|
119
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
120
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
103
121
|
open?: boolean | undefined;
|
|
104
122
|
disabled?: boolean | undefined;
|
|
105
123
|
} & {
|
|
@@ -108,7 +126,16 @@ export declare const comboboxVariants: ((props?: {
|
|
|
108
126
|
noResults: (props?: ({
|
|
109
127
|
tier?: "commit" | "modify" | undefined;
|
|
110
128
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
111
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
129
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
130
|
+
open?: boolean | undefined;
|
|
131
|
+
disabled?: boolean | undefined;
|
|
132
|
+
} & {
|
|
133
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
134
|
+
}) | undefined) => string;
|
|
135
|
+
loading: (props?: ({
|
|
136
|
+
tier?: "commit" | "modify" | undefined;
|
|
137
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
138
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
112
139
|
open?: boolean | undefined;
|
|
113
140
|
disabled?: boolean | undefined;
|
|
114
141
|
} & {
|
|
@@ -117,7 +144,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
117
144
|
clear: (props?: ({
|
|
118
145
|
tier?: "commit" | "modify" | undefined;
|
|
119
146
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
120
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
147
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
121
148
|
open?: boolean | undefined;
|
|
122
149
|
disabled?: boolean | undefined;
|
|
123
150
|
} & {
|
|
@@ -126,7 +153,7 @@ export declare const comboboxVariants: ((props?: {
|
|
|
126
153
|
chevronButton: (props?: ({
|
|
127
154
|
tier?: "commit" | "modify" | undefined;
|
|
128
155
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
129
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
156
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
130
157
|
open?: boolean | undefined;
|
|
131
158
|
disabled?: boolean | undefined;
|
|
132
159
|
} & {
|
|
@@ -135,7 +162,52 @@ export declare const comboboxVariants: ((props?: {
|
|
|
135
162
|
chevron: (props?: ({
|
|
136
163
|
tier?: "commit" | "modify" | undefined;
|
|
137
164
|
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
138
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
165
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
166
|
+
open?: boolean | undefined;
|
|
167
|
+
disabled?: boolean | undefined;
|
|
168
|
+
} & {
|
|
169
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
170
|
+
}) | undefined) => string;
|
|
171
|
+
control: (props?: ({
|
|
172
|
+
tier?: "commit" | "modify" | undefined;
|
|
173
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
174
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
175
|
+
open?: boolean | undefined;
|
|
176
|
+
disabled?: boolean | undefined;
|
|
177
|
+
} & {
|
|
178
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
179
|
+
}) | undefined) => string;
|
|
180
|
+
search: (props?: ({
|
|
181
|
+
tier?: "commit" | "modify" | undefined;
|
|
182
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
183
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
184
|
+
open?: boolean | undefined;
|
|
185
|
+
disabled?: boolean | undefined;
|
|
186
|
+
} & {
|
|
187
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
188
|
+
}) | undefined) => string;
|
|
189
|
+
tag: (props?: ({
|
|
190
|
+
tier?: "commit" | "modify" | undefined;
|
|
191
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
192
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
193
|
+
open?: boolean | undefined;
|
|
194
|
+
disabled?: boolean | undefined;
|
|
195
|
+
} & {
|
|
196
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
197
|
+
}) | undefined) => string;
|
|
198
|
+
tagLabel: (props?: ({
|
|
199
|
+
tier?: "commit" | "modify" | undefined;
|
|
200
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
201
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
202
|
+
open?: boolean | undefined;
|
|
203
|
+
disabled?: boolean | undefined;
|
|
204
|
+
} & {
|
|
205
|
+
class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
|
|
206
|
+
}) | undefined) => string;
|
|
207
|
+
tagRemove: (props?: ({
|
|
208
|
+
tier?: "commit" | "modify" | undefined;
|
|
209
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
210
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
|
|
139
211
|
open?: boolean | undefined;
|
|
140
212
|
disabled?: boolean | undefined;
|
|
141
213
|
} & {
|
|
@@ -15,7 +15,7 @@ export const comboboxVariants = tv({
|
|
|
15
15
|
'disabled:opacity-50 disabled:cursor-not-allowed'
|
|
16
16
|
],
|
|
17
17
|
message: 'text-xs text-danger',
|
|
18
|
-
|
|
18
|
+
helper: 'text-xs text-text-tertiary',
|
|
19
19
|
// `position`, `width`, `overflow-y` are set inline in Combobox.svelte
|
|
20
20
|
// so the native `popover="manual"` top-layer rendering works
|
|
21
21
|
// correctly and the UA's `overflow: auto` doesn't render a duplicate
|
|
@@ -38,7 +38,14 @@ export const comboboxVariants = tv({
|
|
|
38
38
|
],
|
|
39
39
|
optionActive: 'bg-surface-hover',
|
|
40
40
|
optionSelected: 'bg-surface-selected font-medium',
|
|
41
|
+
// Grouped options (parity with Select). `group` is a bare container; the
|
|
42
|
+
// label is a quiet, uppercase section header.
|
|
43
|
+
group: '',
|
|
44
|
+
groupLabel: 'px-3 py-1.5 text-xs font-medium text-text-tertiary uppercase tracking-wider',
|
|
41
45
|
noResults: 'px-3 py-4 text-center text-sm text-text-tertiary',
|
|
46
|
+
// Async-search in-flight message (queryFn). Mirrors noResults so both listbox
|
|
47
|
+
// status rows read alike; separate slot so consumers can style them apart.
|
|
48
|
+
loading: 'px-3 py-4 text-center text-sm text-text-tertiary',
|
|
42
49
|
clear: [
|
|
43
50
|
'absolute right-2 top-1/2 -translate-y-1/2 rounded-modify p-1.5',
|
|
44
51
|
'text-text-tertiary hover:text-text-primary',
|
|
@@ -58,46 +65,120 @@ export const comboboxVariants = tv({
|
|
|
58
65
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50',
|
|
59
66
|
'disabled:cursor-not-allowed disabled:hover:text-text-tertiary'
|
|
60
67
|
],
|
|
61
|
-
chevron: ['w-4 h-4', 'transition-transform duration-[var(--blocks-duration-fast)]']
|
|
68
|
+
chevron: ['w-4 h-4', 'transition-transform duration-[var(--blocks-duration-fast)]'],
|
|
69
|
+
// ── Multi-select tokenizer (only rendered when `multiple`) ──────────────
|
|
70
|
+
// In multi mode the visible frame moves from the `input` onto `control`: a
|
|
71
|
+
// flex-wrap box that holds the selected tags and a borderless search input.
|
|
72
|
+
// The `input` slot (and its full tier/variant/size styling) stays the frame
|
|
73
|
+
// for single mode — untouched — so the two modes never fight over the same
|
|
74
|
+
// classes. Frame colour/radius/size come from the axes below, mirroring how
|
|
75
|
+
// `input` is styled for single mode.
|
|
76
|
+
control: [
|
|
77
|
+
'flex w-full flex-wrap items-center border bg-surface-base cursor-text',
|
|
78
|
+
'transition-colors duration-[var(--blocks-duration-fast)]',
|
|
79
|
+
'focus-within:outline-none focus-within:ring-2 focus-within:ring-primary/50 focus-within:border-primary'
|
|
80
|
+
],
|
|
81
|
+
// Borderless search input inside `control`; the frame owns the border/ring.
|
|
82
|
+
search: [
|
|
83
|
+
'flex-1 min-w-[6rem] border-0 bg-transparent p-0 text-text-primary placeholder:text-text-tertiary',
|
|
84
|
+
'focus-visible:outline-none focus-visible:ring-0',
|
|
85
|
+
'disabled:cursor-not-allowed'
|
|
86
|
+
],
|
|
87
|
+
// Removable selection chip. `customTag` replaces this entirely.
|
|
88
|
+
tag: [
|
|
89
|
+
'inline-flex max-w-full items-center gap-1 rounded-modify bg-surface-interactive text-text-primary font-medium'
|
|
90
|
+
],
|
|
91
|
+
tagLabel: 'truncate',
|
|
92
|
+
tagRemove: [
|
|
93
|
+
'inline-flex shrink-0 items-center justify-center rounded-full',
|
|
94
|
+
'text-text-tertiary hover:text-text-primary',
|
|
95
|
+
'transition-colors duration-[var(--blocks-duration-fast)]',
|
|
96
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50',
|
|
97
|
+
'disabled:cursor-not-allowed'
|
|
98
|
+
]
|
|
62
99
|
},
|
|
63
100
|
variants: {
|
|
64
101
|
// 3-tier semantic radius for the Combobox input. Default `modify`.
|
|
65
|
-
// Options keep their own r-interactive; only the input
|
|
102
|
+
// Options keep their own r-interactive; only the input (and, in multi mode,
|
|
103
|
+
// the tokenizer `control`) rounding flips.
|
|
66
104
|
tier: {
|
|
67
|
-
modify: { input: 'rounded-modify' },
|
|
68
|
-
commit: { input: 'rounded-commit' }
|
|
105
|
+
modify: { input: 'rounded-modify', control: 'rounded-modify' },
|
|
106
|
+
commit: { input: 'rounded-commit', control: 'rounded-commit' }
|
|
69
107
|
},
|
|
70
108
|
// Visual style, at parity with Input / Textarea / Select. Default
|
|
71
109
|
// `outlined` reproduces the historical Combobox frame exactly.
|
|
110
|
+
// Each variant styles both the single-mode `input` frame and the multi-mode
|
|
111
|
+
// `control` frame identically; `control` drops the per-tag `hover:` shifts
|
|
112
|
+
// that would misfire when hovering a chip inside the box.
|
|
72
113
|
variant: {
|
|
73
114
|
// Surface-family border: form-control frames stay quiet (`border-subtle`);
|
|
74
115
|
// the `border-neutral` intent token is reserved for Action surfaces
|
|
75
116
|
// (Outline-Button, Menu) where the border must read as clickable.
|
|
76
|
-
outlined: {
|
|
117
|
+
outlined: {
|
|
118
|
+
input: 'border-border-subtle hover:border-border-default',
|
|
119
|
+
control: 'border-border-subtle hover:border-border-default'
|
|
120
|
+
},
|
|
77
121
|
filled: {
|
|
78
|
-
input: 'bg-surface-interactive border-transparent hover:bg-surface-hover focus-visible:bg-surface-base'
|
|
122
|
+
input: 'bg-surface-interactive border-transparent hover:bg-surface-hover focus-visible:bg-surface-base',
|
|
123
|
+
control: 'bg-surface-interactive border-transparent focus-within:bg-surface-base'
|
|
79
124
|
},
|
|
80
125
|
ghost: {
|
|
81
|
-
input: 'bg-transparent border-transparent hover:bg-surface-subtle focus-visible:bg-surface-base focus-visible:border-border-subtle'
|
|
126
|
+
input: 'bg-transparent border-transparent hover:bg-surface-subtle focus-visible:bg-surface-base focus-visible:border-border-subtle',
|
|
127
|
+
control: 'bg-transparent border-transparent focus-within:bg-surface-base focus-within:border-border-subtle'
|
|
82
128
|
},
|
|
83
129
|
underline: {
|
|
84
|
-
input: 'bg-transparent border-0 border-b-2 border-border-subtle rounded-none focus-visible:ring-0'
|
|
130
|
+
input: 'bg-transparent border-0 border-b-2 border-border-subtle rounded-none focus-visible:ring-0',
|
|
131
|
+
control: 'bg-transparent border-0 border-b-2 border-border-subtle rounded-none focus-within:ring-0'
|
|
85
132
|
}
|
|
86
133
|
},
|
|
87
134
|
size: {
|
|
88
|
-
|
|
135
|
+
// Full xs–xl scale, mirroring Input's h-7…h-14 ladder (form-family
|
|
136
|
+
// symmetry: a dense form should not pair an xs Input with an sm Combobox).
|
|
137
|
+
// The multi-mode tokenizer (`control`/`search`/`tag`) tracks the same
|
|
138
|
+
// ladder: `control` uses `min-h-*` (not `h-*`) so it grows as tags wrap,
|
|
139
|
+
// and reserves right padding (`pr-*`) for the absolute chevron/clear.
|
|
140
|
+
xs: {
|
|
89
141
|
// `pointer-coarse:text-base` floors the input to 16px on touch-primary
|
|
90
142
|
// devices so iOS Safari doesn't auto-zoom (and never un-zoom) on focus.
|
|
143
|
+
input: 'h-7 px-2 pr-7 text-xs pointer-coarse:text-base',
|
|
144
|
+
option: 'px-2 py-1 text-xs min-h-[1.75rem]',
|
|
145
|
+
control: 'min-h-7 gap-1 px-1.5 py-1 pr-7',
|
|
146
|
+
search: 'text-xs pointer-coarse:text-base',
|
|
147
|
+
tag: 'text-xs px-1.5 py-0.5',
|
|
148
|
+
tagRemove: '[&_svg]:h-2.5 [&_svg]:w-2.5'
|
|
149
|
+
},
|
|
150
|
+
sm: {
|
|
151
|
+
// See `xs` — floor to 16px on touch to avoid iOS Safari focus-zoom.
|
|
91
152
|
input: 'h-8 px-3 pr-8 text-sm pointer-coarse:text-base',
|
|
92
|
-
option: 'px-2 py-1.5 text-sm min-h-[2rem]'
|
|
153
|
+
option: 'px-2 py-1.5 text-sm min-h-[2rem]',
|
|
154
|
+
control: 'min-h-8 gap-1 px-2 py-1 pr-8',
|
|
155
|
+
search: 'text-sm pointer-coarse:text-base',
|
|
156
|
+
tag: 'text-xs px-2 py-0.5',
|
|
157
|
+
tagRemove: '[&_svg]:h-3 [&_svg]:w-3'
|
|
93
158
|
},
|
|
94
159
|
md: {
|
|
95
160
|
input: 'h-10 px-3 pr-8 text-base',
|
|
96
|
-
option: 'px-3 py-2 text-sm min-h-[2.5rem]'
|
|
161
|
+
option: 'px-3 py-2 text-sm min-h-[2.5rem]',
|
|
162
|
+
control: 'min-h-10 gap-1.5 px-2 py-1.5 pr-8',
|
|
163
|
+
search: 'text-base',
|
|
164
|
+
tag: 'text-sm px-2 py-0.5',
|
|
165
|
+
tagRemove: '[&_svg]:h-3 [&_svg]:w-3'
|
|
97
166
|
},
|
|
98
167
|
lg: {
|
|
99
168
|
input: 'h-12 px-4 pr-10 text-lg',
|
|
100
|
-
option: 'px-3 py-2.5 text-base min-h-[3rem]'
|
|
169
|
+
option: 'px-3 py-2.5 text-base min-h-[3rem]',
|
|
170
|
+
control: 'min-h-12 gap-2 px-3 py-2 pr-10',
|
|
171
|
+
search: 'text-lg',
|
|
172
|
+
tag: 'text-base px-2.5 py-1',
|
|
173
|
+
tagRemove: '[&_svg]:h-3.5 [&_svg]:w-3.5'
|
|
174
|
+
},
|
|
175
|
+
xl: {
|
|
176
|
+
input: 'h-14 px-6 pr-12 text-xl',
|
|
177
|
+
option: 'px-4 py-3 text-lg min-h-[3.5rem]',
|
|
178
|
+
control: 'min-h-14 gap-2 px-4 py-2.5 pr-12',
|
|
179
|
+
search: 'text-xl',
|
|
180
|
+
tag: 'text-lg px-3 py-1',
|
|
181
|
+
tagRemove: '[&_svg]:h-4 [&_svg]:w-4'
|
|
101
182
|
}
|
|
102
183
|
},
|
|
103
184
|
open: {
|
|
@@ -9,53 +9,27 @@ export interface ComboboxOption<T extends SelectValue = string> {
|
|
|
9
9
|
value: T;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/** A labelled group of combobox options (parity with Select's `groups`). */
|
|
13
|
+
export interface ComboboxGroup<T extends SelectValue = string> {
|
|
14
|
+
label: string;
|
|
15
|
+
options: ComboboxOption<T>[];
|
|
16
|
+
}
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @tag form
|
|
18
|
-
* @related Select
|
|
19
|
-
* @related Input
|
|
20
|
-
* @related Menu
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```svelte
|
|
24
|
-
* <Combobox
|
|
25
|
-
* options={[
|
|
26
|
-
* { label: 'Apple', value: 'apple' },
|
|
27
|
-
* { label: 'Banana', value: 'banana' },
|
|
28
|
-
* { label: 'Cherry', value: 'cherry' }
|
|
29
|
-
* ]}
|
|
30
|
-
* bind:value={selected}
|
|
31
|
-
* placeholder="Search fruit…"
|
|
32
|
-
* />
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example Numeric IDs — the generic value type keeps `value` typed as `number`
|
|
36
|
-
* ```svelte
|
|
37
|
-
* <Combobox
|
|
38
|
-
* options={tenants.map((t) => ({ label: t.name, value: t.id }))}
|
|
39
|
-
* bind:value={tenantId}
|
|
40
|
-
* />
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```svelte
|
|
45
|
-
* <Combobox
|
|
46
|
-
* options={countries}
|
|
47
|
-
* bind:value={country}
|
|
48
|
-
* filter={(option, query) => option.label.toLowerCase().startsWith(query.toLowerCase())}
|
|
49
|
-
* clearable
|
|
50
|
-
* size="lg"
|
|
51
|
-
* />
|
|
52
|
-
* ```
|
|
18
|
+
* Shared props for both single- and multi-select Combobox modes. The
|
|
19
|
+
* mode-specific shapes (`value`, `onValueChange`, and the multi-only tag props)
|
|
20
|
+
* live on {@link ComboboxSingleProps} / {@link ComboboxMultipleProps} and narrow
|
|
21
|
+
* against `multiple`.
|
|
53
22
|
*/
|
|
54
|
-
|
|
23
|
+
interface ComboboxBaseProps<T extends SelectValue = string> extends ComboboxVariants, Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
55
24
|
/** Array of selectable options. Each needs a unique `value`. */
|
|
56
|
-
options
|
|
57
|
-
/**
|
|
58
|
-
|
|
25
|
+
options?: ComboboxOption<T>[];
|
|
26
|
+
/**
|
|
27
|
+
* Grouped options with section labels, at parity with Select. Takes precedence
|
|
28
|
+
* over `options` when set. Filtering runs per group; groups whose options all
|
|
29
|
+
* filter out are hidden, and keyboard navigation flows across the flattened,
|
|
30
|
+
* still-visible options exactly as it does for a flat list.
|
|
31
|
+
*/
|
|
32
|
+
groups?: ComboboxGroup<T>[];
|
|
59
33
|
/** Current search query text. Supports `bind:query` for external control (e.g. server-side filtering). */
|
|
60
34
|
query?: string;
|
|
61
35
|
/** Placeholder shown when the input is empty. @default 'Search…' */
|
|
@@ -66,22 +40,49 @@ export interface ComboboxProps<T extends SelectValue = string> extends ComboboxV
|
|
|
66
40
|
helper?: string;
|
|
67
41
|
/** Error message — replaces helper text and flags the field as invalid. */
|
|
68
42
|
error?: string;
|
|
69
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Marks the field as required. Adds the asterisk on the label. @default false
|
|
45
|
+
*
|
|
46
|
+
* In multi-select mode this is visual only — the transient search input
|
|
47
|
+
* carries no native `required` (it is cleared after each pick), so enforce a
|
|
48
|
+
* minimum selection in your submit handler.
|
|
49
|
+
*/
|
|
70
50
|
required?: boolean;
|
|
71
|
-
/** Custom filter replacing the built-in case-insensitive label match. Return `true` to include an option. */
|
|
51
|
+
/** Custom filter replacing the built-in case-insensitive label match. Return `true` to include an option. Ignored when `queryFn` is set (the server filters). */
|
|
72
52
|
filter?: (option: ComboboxOption<T>, query: string) => boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Server-side search (analogous to the Table remote-mode API). When set, the
|
|
55
|
+
* Combobox stops filtering client-side and instead calls `queryFn` — debounced
|
|
56
|
+
* by {@link debounceMs} — on each query change, replacing the option list with
|
|
57
|
+
* the resolved result. The `AbortSignal` is aborted when a newer query
|
|
58
|
+
* supersedes an in-flight request, so a slow stale response never clobbers a
|
|
59
|
+
* fresh one. Aborted rejections are swallowed; other rejections leave the
|
|
60
|
+
* previous options in place (and warn in dev). `options`/`groups` are ignored
|
|
61
|
+
* in this mode. The selected option's label is cached so it survives result
|
|
62
|
+
* sets that no longer contain it.
|
|
63
|
+
*/
|
|
64
|
+
queryFn?: (query: string, signal: AbortSignal) => Promise<ComboboxOption<T>[]>;
|
|
65
|
+
/** Debounce applied to `queryFn` in milliseconds. @default 250 */
|
|
66
|
+
debounceMs?: number;
|
|
67
|
+
/** Text shown in the listbox while an async `queryFn` request is in flight. @default 'Loading…' */
|
|
68
|
+
loadingText?: string;
|
|
73
69
|
/** Show a clear button when a value is selected. Click or press Escape to reset. @default false */
|
|
74
70
|
clearable?: boolean;
|
|
75
71
|
/** Disable the entire combobox. @default false */
|
|
76
72
|
disabled?: boolean;
|
|
77
|
-
/** Shared `name` for a hidden input for native form submission. */
|
|
73
|
+
/** Shared `name` for a hidden input for native form submission. In multi-select mode one hidden input is emitted per selected value. */
|
|
78
74
|
name?: string;
|
|
79
75
|
/** Text displayed when the filter produces no matches. @default 'No results found' */
|
|
80
76
|
noResultsText?: string;
|
|
81
|
-
/** Fires after the selected value changes. Receives the new value or `null` on clear. */
|
|
82
|
-
onValueChange?: (value: T | null) => void;
|
|
83
77
|
/** Controls the open state of the listbox. Supports `bind:open`. @default false */
|
|
84
78
|
open?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Fires when the listbox opens or closes from user interaction (focus,
|
|
81
|
+
* typing, chevron toggle, selection, Escape, outside click). Receives the
|
|
82
|
+
* new open state — use it e.g. to lazy-load options on first open. Not
|
|
83
|
+
* called when the consumer writes `bind:open` directly.
|
|
84
|
+
*/
|
|
85
|
+
onOpenChange?: (open: boolean) => void;
|
|
85
86
|
/** Custom option renderer. Receives the option and whether it is selected. */
|
|
86
87
|
customOption?: Snippet<[ComboboxOption<T>, boolean]>;
|
|
87
88
|
/**
|
|
@@ -115,8 +116,9 @@ export interface ComboboxProps<T extends SelectValue = string> extends ComboboxV
|
|
|
115
116
|
/** Remove all default tv() classes — only user-provided classes apply. @default false */
|
|
116
117
|
unstyled?: boolean;
|
|
117
118
|
/** Per-slot class overrides merged with tv() styles. Slots: base | label | requiredMark |
|
|
118
|
-
* inputWrapper | input | message |
|
|
119
|
-
* noResults | clear | chevron
|
|
119
|
+
* inputWrapper | input | message | helper | listbox | option | optionActive | optionSelected |
|
|
120
|
+
* group | groupLabel | loading | noResults | clear | chevron | control | search | tag |
|
|
121
|
+
* tagLabel | tagRemove */
|
|
120
122
|
slotClasses?: Partial<Record<ComboboxSlots, string>>;
|
|
121
123
|
/**
|
|
122
124
|
* Apply a named preset registered via `<BlocksProvider presets={{ Combobox: {...} }}>`.
|
|
@@ -128,6 +130,119 @@ export interface ComboboxProps<T extends SelectValue = string> extends ComboboxV
|
|
|
128
130
|
/** Deterministic HTML `id` for the component. Auto-generated when omitted. */
|
|
129
131
|
id?: string;
|
|
130
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Single-select arm (the default). `value` is `T | null`, and `onValueChange`
|
|
135
|
+
* receives the new value or `null` on clear. Selecting an option closes the
|
|
136
|
+
* listbox and mirrors the picked label back into the input.
|
|
137
|
+
*/
|
|
138
|
+
export interface ComboboxSingleProps<T extends SelectValue = string> extends ComboboxBaseProps<T> {
|
|
139
|
+
/** Single-select mode (the default). Omit or set to `false` explicitly. */
|
|
140
|
+
multiple?: false;
|
|
141
|
+
/** Currently selected value. Supports `bind:value` for two-way binding. */
|
|
142
|
+
value?: T | null;
|
|
143
|
+
/** Fires after the selected value changes. Receives the new value or `null` on clear. */
|
|
144
|
+
onValueChange?: (value: T | null) => void;
|
|
145
|
+
/** Disallowed in single mode — only relevant for multi-select. */
|
|
146
|
+
maxItems?: never;
|
|
147
|
+
/** Disallowed in single mode — only relevant for multi-select. */
|
|
148
|
+
onRemoveTag?: never;
|
|
149
|
+
/** Disallowed in single mode — only relevant for multi-select. */
|
|
150
|
+
customTag?: never;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Multi-select arm. `value` is an array of the selected values, rendered as
|
|
154
|
+
* removable tag chips below the search input. Selecting an option adds a tag and
|
|
155
|
+
* keeps the listbox open so several picks flow without re-opening; the search
|
|
156
|
+
* query is cleared after each pick. Backspace on an empty query removes the last
|
|
157
|
+
* tag.
|
|
158
|
+
*/
|
|
159
|
+
export interface ComboboxMultipleProps<T extends SelectValue = string> extends ComboboxBaseProps<T> {
|
|
160
|
+
/** Enable multi-select mode. */
|
|
161
|
+
multiple: true;
|
|
162
|
+
/** Currently selected values. Supports `bind:value`. @default [] */
|
|
163
|
+
value?: T[];
|
|
164
|
+
/** Fires after the selection changes. Receives the new array. */
|
|
165
|
+
onValueChange?: (value: T[]) => void;
|
|
166
|
+
/**
|
|
167
|
+
* Cap the number of selected values. Once reached, options that aren't already
|
|
168
|
+
* selected become non-selectable (and are skipped by keyboard navigation) until
|
|
169
|
+
* a tag is removed; already-selected options can still be toggled off.
|
|
170
|
+
*/
|
|
171
|
+
maxItems?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Fires when a single value is removed from the selection — via the tag's
|
|
174
|
+
* remove button, Backspace on an empty query, or toggling a selected option
|
|
175
|
+
* off. Receives the removed value. `onValueChange` fires alongside it with the
|
|
176
|
+
* resulting array; use `onRemoveTag` for per-tag side effects (analytics, exit
|
|
177
|
+
* animations). Note: the bulk clear button does NOT fire this per tag — it
|
|
178
|
+
* signals through `onValueChange([])` only.
|
|
179
|
+
*/
|
|
180
|
+
onRemoveTag?: (value: T) => void;
|
|
181
|
+
/**
|
|
182
|
+
* Custom tag renderer replacing the default chip. Receives the selected option
|
|
183
|
+
* and a `remove` callback — call it to drop the tag (fires `onRemoveTag` +
|
|
184
|
+
* `onValueChange`). Use it to render a `<Badge>` or any bespoke chip.
|
|
185
|
+
*
|
|
186
|
+
* Positional args: `(option, remove)`.
|
|
187
|
+
*/
|
|
188
|
+
customTag?: Snippet<[ComboboxOption<T>, () => void]>;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @description Searchable menu (autocomplete) combining a text input with a
|
|
192
|
+
* filterable option list. Implements the ARIA combobox pattern with keyboard
|
|
193
|
+
* navigation, custom filtering, and two-way bindable state. Single-select by
|
|
194
|
+
* default; pass `multiple` for an array-bound multi-select that renders picks as
|
|
195
|
+
* removable tag chips.
|
|
196
|
+
*
|
|
197
|
+
* @tag form
|
|
198
|
+
* @related Select
|
|
199
|
+
* @related Input
|
|
200
|
+
* @related Menu
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```svelte
|
|
204
|
+
* <Combobox
|
|
205
|
+
* options={[
|
|
206
|
+
* { label: 'Apple', value: 'apple' },
|
|
207
|
+
* { label: 'Banana', value: 'banana' },
|
|
208
|
+
* { label: 'Cherry', value: 'cherry' }
|
|
209
|
+
* ]}
|
|
210
|
+
* bind:value={selected}
|
|
211
|
+
* placeholder="Search fruit…"
|
|
212
|
+
* />
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example Numeric IDs — the generic value type keeps `value` typed as `number`
|
|
216
|
+
* ```svelte
|
|
217
|
+
* <Combobox
|
|
218
|
+
* options={tenants.map((t) => ({ label: t.name, value: t.id }))}
|
|
219
|
+
* bind:value={tenantId}
|
|
220
|
+
* />
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* @example Multi-select with removable tags
|
|
224
|
+
* ```svelte
|
|
225
|
+
* <Combobox
|
|
226
|
+
* options={skills}
|
|
227
|
+
* multiple
|
|
228
|
+
* bind:value={selectedSkills}
|
|
229
|
+
* maxItems={5}
|
|
230
|
+
* placeholder="Add skills…"
|
|
231
|
+
* />
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @example Grouped options — filtering hides empty groups automatically
|
|
235
|
+
* ```svelte
|
|
236
|
+
* <Combobox
|
|
237
|
+
* groups={[
|
|
238
|
+
* { label: 'Fruit', options: [{ label: 'Apple', value: 'apple' }] },
|
|
239
|
+
* { label: 'Veg', options: [{ label: 'Carrot', value: 'carrot' }] }
|
|
240
|
+
* ]}
|
|
241
|
+
* bind:value={food}
|
|
242
|
+
* />
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
export type ComboboxProps<T extends SelectValue = string> = ComboboxSingleProps<T> | ComboboxMultipleProps<T>;
|
|
131
246
|
/** Backwards-compatible alias for {@link ComboboxOption} (legacy name). */
|
|
132
247
|
export type ComboboxOptionType<T extends SelectValue = string> = ComboboxOption<T>;
|
|
133
248
|
export { default as Combobox } from './Combobox.svelte';
|