@juspay/svelte-ui-components 4.16.0 → 4.18.0
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/Select/Select.svelte +561 -218
- package/dist/Select/properties.d.ts +46 -0
- package/dist-wc/index.js +1608 -1465
- package/package.json +1 -1
|
@@ -20,12 +20,52 @@ export type MandatorySelectProperties = {
|
|
|
20
20
|
items: SelectItem[] | string[];
|
|
21
21
|
};
|
|
22
22
|
export type SelectHierarchy = 'default' | 'ghost';
|
|
23
|
+
/** Placement of the `searchable` filter input. See `searchPosition`. */
|
|
24
|
+
export type SelectSearchPosition = 'trigger' | 'menu';
|
|
23
25
|
export type OptionalSelectProperties = {
|
|
24
26
|
value?: string[];
|
|
25
27
|
multiple?: boolean;
|
|
26
28
|
searchable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Where the `searchable` filter input lives. `'trigger'` (the default) keeps
|
|
31
|
+
* today's behaviour: the input replaces the trigger's label and is focused
|
|
32
|
+
* automatically on open.
|
|
33
|
+
*
|
|
34
|
+
* `'menu'` puts it inside the open dropdown instead, which is what the
|
|
35
|
+
* design-system keyboard contract specifies — the trigger stays a plain
|
|
36
|
+
* combobox, and the search box is reached by Tab AFTER opening rather than
|
|
37
|
+
* by being focused for you. That difference is the point: with the input in
|
|
38
|
+
* the trigger there is no way to open the menu and keep focus on the
|
|
39
|
+
* combobox, so a keyboard user who wanted to arrow through the options had
|
|
40
|
+
* to type first.
|
|
41
|
+
*
|
|
42
|
+
* No effect unless `searchable` is also set.
|
|
43
|
+
*/
|
|
44
|
+
searchPosition?: SelectSearchPosition;
|
|
27
45
|
placeholder?: string;
|
|
28
46
|
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Renders the error treatment on the trigger — a red border that outranks
|
|
49
|
+
* the hover and focus border colours, so the field still reads as invalid
|
|
50
|
+
* while the user is in it. Independent of any validation the consumer runs;
|
|
51
|
+
* this is the server- or form-driven flag, matching `Input.forceError`.
|
|
52
|
+
*/
|
|
53
|
+
error?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Message shown below the trigger while `error` is true, in a `role="alert"`
|
|
56
|
+
* region wired to the combobox through `aria-describedby`. A string rather
|
|
57
|
+
* than a snippet, following `Input`'s `onErrorMessage`: the content is a
|
|
58
|
+
* sentence, and making it a snippet would mean every consumer rebuilds the
|
|
59
|
+
* alert semantics that make it announce.
|
|
60
|
+
*/
|
|
61
|
+
errorMessage?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a clear (×) button to the trigger whenever there is a selection. It
|
|
64
|
+
* resets the value WITHOUT opening the menu, which is the whole point —
|
|
65
|
+
* clearing through the menu costs an open, a hunt and a second click.
|
|
66
|
+
* Hidden while `disabled`, and never rendered when nothing is selected.
|
|
67
|
+
*/
|
|
68
|
+
clearable?: boolean;
|
|
29
69
|
bottomContent?: Snippet;
|
|
30
70
|
/**
|
|
31
71
|
* Snippet for rendering a custom multi-select option indicator, receiving `{ checked, indeterminate }`.
|
|
@@ -97,6 +137,12 @@ export type OptionalSelectProperties = {
|
|
|
97
137
|
};
|
|
98
138
|
export type SelectEventProperties = {
|
|
99
139
|
onchange?: (value: string[]) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Fires when the clear button empties the selection, after `onchange` has
|
|
142
|
+
* already reported the new empty value. Use it to distinguish "cleared" from
|
|
143
|
+
* "deselected the last item", which `onchange` alone cannot tell apart.
|
|
144
|
+
*/
|
|
145
|
+
onclear?: () => void;
|
|
100
146
|
onopen?: () => void;
|
|
101
147
|
onclose?: () => void;
|
|
102
148
|
};
|