frontile 0.18.0-alpha.13 → 0.18.0-alpha.15
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/declarations/components/buttons/chip.d.ts +35 -4
- package/declarations/components/collections/dropdown.d.ts +18 -0
- package/declarations/components/collections/listbox/item.d.ts +13 -0
- package/declarations/components/collections/listbox/listbox.d.ts +15 -6
- package/declarations/components/forms/autocomplete.d.ts +13 -5
- package/declarations/components/forms/checkbox-group.d.ts +20 -0
- package/declarations/components/forms/checkbox.d.ts +22 -0
- package/declarations/components/forms/form-control.d.ts +49 -0
- package/declarations/components/forms/form-description.d.ts +12 -0
- package/declarations/components/forms/form-feedback.d.ts +21 -0
- package/declarations/components/forms/form.d.ts +1 -1
- package/declarations/components/forms/input.d.ts +44 -1
- package/declarations/components/forms/label.d.ts +13 -0
- package/declarations/components/forms/native-select.d.ts +103 -6
- package/declarations/components/forms/radio-group.d.ts +21 -0
- package/declarations/components/forms/radio.d.ts +27 -0
- package/declarations/components/forms/select/end-content.d.ts +31 -0
- package/declarations/components/forms/select/native-mirror.d.ts +44 -0
- package/declarations/components/forms/select/select.d.ts +425 -0
- package/declarations/components/forms/select/selected-items.d.ts +80 -0
- package/declarations/components/forms/select/trigger.d.ts +76 -0
- package/declarations/components/forms/select/types.d.ts +411 -0
- package/declarations/components/forms/select.d.ts +2 -531
- package/declarations/components/forms/textarea.d.ts +35 -0
- package/declarations/components/overlays/drawer.d.ts +3 -0
- package/declarations/components/overlays/modal.d.ts +3 -0
- package/declarations/components/overlays/overlay.d.ts +23 -0
- package/declarations/components/overlays/popover.d.ts +62 -0
- package/declarations/components/overlays/portal-target.d.ts +5 -1
- package/declarations/components/status/progress-bar.d.ts +5 -0
- package/declarations/components/utilities/divider.d.ts +14 -0
- package/declarations/components/utilities/spinner.d.ts +8 -0
- package/declarations/utils/listManager.d.ts +30 -5
- package/dist/components/buttons/chip.js +1 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/collections/dropdown.js +13 -1
- package/dist/components/collections/dropdown.js.map +1 -1
- package/dist/components/collections/listbox/item.js +13 -1
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +12 -1
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/simple-table/column.js +1 -1
- package/dist/components/collections/simple-table/column.js.map +1 -1
- package/dist/components/forms/autocomplete.js +0 -3
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/checkbox-group.js.map +1 -1
- package/dist/components/forms/checkbox.js.map +1 -1
- package/dist/components/forms/field.js +1 -1
- package/dist/components/forms/form-control.js +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-description.js.map +1 -1
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/index.js +1 -1
- package/dist/components/forms/input.js +32 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/label.js.map +1 -1
- package/dist/components/forms/native-select.js +2 -2
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/radio-group.js.map +1 -1
- package/dist/components/forms/radio.js.map +1 -1
- package/dist/components/forms/select/end-content.js +24 -0
- package/dist/components/forms/select/end-content.js.map +1 -0
- package/dist/components/forms/select/native-mirror.js +29 -0
- package/dist/components/forms/select/native-mirror.js.map +1 -0
- package/dist/components/forms/select/select.js +599 -0
- package/dist/components/forms/select/select.js.map +1 -0
- package/dist/components/forms/select/selected-items.js +63 -0
- package/dist/components/forms/select/selected-items.js.map +1 -0
- package/dist/components/forms/select/trigger.js +30 -0
- package/dist/components/forms/select/trigger.js.map +1 -0
- package/dist/components/forms/select/types.js +2 -0
- package/dist/components/forms/select/types.js.map +1 -0
- package/dist/components/forms/select.js +1 -387
- package/dist/components/forms/select.js.map +1 -1
- package/dist/components/forms/textarea.js.map +1 -1
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/modal.js.map +1 -1
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/overlays/popover.js +53 -2
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/portal-target.js.map +1 -1
- package/dist/components/status/progress-bar.js +8 -1
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/avatar.js +1 -1
- package/dist/components/utilities/avatar.js.map +1 -1
- package/dist/components/utilities/divider.js +8 -2
- package/dist/components/utilities/divider.js.map +1 -1
- package/dist/components/utilities/spinner.js +1 -1
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/listManager.js +63 -4
- package/dist/utils/listManager.js.map +1 -1
- package/dist/utils/nested-data.js +10 -1
- package/dist/utils/nested-data.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type Owner from '@ember/owner';
|
|
3
|
+
import type { ListItem } from '../native-select';
|
|
4
|
+
import type { ResolvedSelectChipOptions, SelectArgs, SelectChipOptions, SelectSignature, SelectedItem, SelectedItemBlockArg } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* A dropdown selection component: a custom listbox in a popover, backed by a
|
|
7
|
+
* visually hidden native `<select>` so the value submits with a form.
|
|
8
|
+
*
|
|
9
|
+
* Selection can be controlled with `@selectedKey` / `@selectedKeys` plus
|
|
10
|
+
* `@onSelectionChange`, or left uncontrolled.
|
|
11
|
+
*/
|
|
12
|
+
declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
13
|
+
/**
|
|
14
|
+
* Every item registered by the hidden native `<select>`, in item order.
|
|
15
|
+
*
|
|
16
|
+
* The hidden select is deliberately given the *unfiltered* `@items` — it
|
|
17
|
+
* carries the form value, which must not shrink to the filter — so this
|
|
18
|
+
* covers the whole list even while the listbox is filtered down. Chips and
|
|
19
|
+
* the joined text value can therefore be resolved straight from it.
|
|
20
|
+
*/
|
|
21
|
+
nodes: ListItem[];
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Internal tracked state for single selection mode.
|
|
25
|
+
* Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.
|
|
26
|
+
*/
|
|
27
|
+
_selectedKey: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Internal tracked state for multiple selection mode.
|
|
30
|
+
* Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.
|
|
31
|
+
*/
|
|
32
|
+
_selectedKeys: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Initializes the component and sets up initial selection state.
|
|
35
|
+
*
|
|
36
|
+
* **Initialization:**
|
|
37
|
+
* 1. Determines selection mode (single vs multiple)
|
|
38
|
+
* 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state
|
|
39
|
+
* 3. Logs warnings if incorrect args are used for the selection mode
|
|
40
|
+
*
|
|
41
|
+
* Note: After instantiation, modifiers keep internal state synced with external arguments.
|
|
42
|
+
*/
|
|
43
|
+
constructor(owner: Owner, args: SelectArgs<T>);
|
|
44
|
+
validateArgs(): void;
|
|
45
|
+
filterValue?: string;
|
|
46
|
+
containerRef: {
|
|
47
|
+
current: HTMLDivElement | undefined;
|
|
48
|
+
"__#9@#onChange"?: ((el: HTMLDivElement | undefined) => void) | undefined;
|
|
49
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
50
|
+
Args: {
|
|
51
|
+
Positional: unknown[];
|
|
52
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
53
|
+
};
|
|
54
|
+
Element: HTMLDivElement;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
triggerRef: {
|
|
58
|
+
current: HTMLInputElement | HTMLButtonElement | undefined;
|
|
59
|
+
"__#9@#onChange"?: ((el: HTMLInputElement | HTMLButtonElement | undefined) => void) | undefined;
|
|
60
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
61
|
+
Args: {
|
|
62
|
+
Positional: unknown[];
|
|
63
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
64
|
+
};
|
|
65
|
+
Element: HTMLInputElement | HTMLButtonElement;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
chipsContainerRef: {
|
|
69
|
+
current: HTMLDivElement | undefined;
|
|
70
|
+
"__#9@#onChange"?: ((el: HTMLDivElement | undefined) => void) | undefined;
|
|
71
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
72
|
+
Args: {
|
|
73
|
+
Positional: unknown[];
|
|
74
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
75
|
+
};
|
|
76
|
+
Element: HTMLDivElement;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Handles selection changes from the Listbox component.
|
|
81
|
+
*
|
|
82
|
+
* **Flow:**
|
|
83
|
+
* 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates
|
|
84
|
+
* 2. Calls parent's `@onSelectionChange` callback to notify of the change
|
|
85
|
+
* 3. Parent updates its state, which flows back via modifier to complete the cycle
|
|
86
|
+
*
|
|
87
|
+
* **Side effects:**
|
|
88
|
+
* - Clears filter value (for searchable selects)
|
|
89
|
+
* - Triggers form input event for native form integration
|
|
90
|
+
*
|
|
91
|
+
* @param keys - Array of selected keys from Listbox (converted to single value in single mode)
|
|
92
|
+
*/
|
|
93
|
+
onSelectionChange: (keys: string[]) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Handles selection changes from the native <select> element.
|
|
96
|
+
*
|
|
97
|
+
* This is similar to `onSelectionChange` but accepts a single key directly
|
|
98
|
+
* rather than an array, matching the native select's single-value API.
|
|
99
|
+
*
|
|
100
|
+
* **Flow:**
|
|
101
|
+
* 1. Updates internal `_selectedKey` for immediate UI update
|
|
102
|
+
* 2. Calls parent's `@onSelectionChange` callback
|
|
103
|
+
*
|
|
104
|
+
* @param key - The selected key, or null if cleared
|
|
105
|
+
*/
|
|
106
|
+
onSingleSelectionChange: (key: string | null) => void;
|
|
107
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
108
|
+
onFilterChange: (event: Event) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Backspace on an empty filter removes the last chip — the familiar tag-input
|
|
111
|
+
* gesture. With text in the filter, Backspace edits the text as usual.
|
|
112
|
+
*/
|
|
113
|
+
handleFilterKeydown: (event: KeyboardEvent) => void;
|
|
114
|
+
/**
|
|
115
|
+
* The non-filterable counterpart of {@link handleFilterKeydown}.
|
|
116
|
+
*
|
|
117
|
+
* Chip close buttons are deliberately outside the tab order (they would
|
|
118
|
+
* otherwise cost a Tab stop each before the combobox is reached), so
|
|
119
|
+
* Backspace/Delete on the trigger is the *only* keyboard route to removing a
|
|
120
|
+
* chip here. There is no text to edit on a button trigger, so both keys act
|
|
121
|
+
* immediately; `preventDefault` keeps Backspace from navigating back.
|
|
122
|
+
*/
|
|
123
|
+
handleTriggerKeydown: (event: KeyboardEvent) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Removes the trailing chip. `removeSelectedKey` applies the same
|
|
126
|
+
* `@allowEmpty` rule the chip close buttons follow, so the last required
|
|
127
|
+
* selection stays put.
|
|
128
|
+
*/
|
|
129
|
+
removeLastSelectedKey(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Returns current selection as an array for template rendering.
|
|
132
|
+
*
|
|
133
|
+
* Normalizes both single and multiple selection modes to a consistent array interface:
|
|
134
|
+
* - Multiple mode: Returns `_selectedKeys` directly
|
|
135
|
+
* - Single mode: Converts `_selectedKey` to array format (or empty array if null)
|
|
136
|
+
*
|
|
137
|
+
* Note: Always returns internal tracked state rather than arguments. External updates
|
|
138
|
+
* sync through modifiers to maintain consistency.
|
|
139
|
+
*
|
|
140
|
+
* @returns Array of selected keys (empty array if none selected)
|
|
141
|
+
*/
|
|
142
|
+
get selectedKeys(): string[];
|
|
143
|
+
/**
|
|
144
|
+
* Returns the selected key for single selection mode.
|
|
145
|
+
*
|
|
146
|
+
* **Returns:**
|
|
147
|
+
* - Single mode: Returns `_selectedKey` (string or null)
|
|
148
|
+
* - Multiple mode: Returns null (not applicable)
|
|
149
|
+
*
|
|
150
|
+
* Note: Always returns internal tracked state rather than arguments. External updates
|
|
151
|
+
* sync through modifiers to maintain consistency.
|
|
152
|
+
*
|
|
153
|
+
* @returns The selected key, or null if none selected or in multiple mode
|
|
154
|
+
*/
|
|
155
|
+
get getSelectedKey(): string | null;
|
|
156
|
+
get blockScroll(): boolean;
|
|
157
|
+
get disableFocusTrap(): boolean;
|
|
158
|
+
onAction: (key: string) => void;
|
|
159
|
+
handleBlur(): void;
|
|
160
|
+
/**
|
|
161
|
+
* In chips mode the trigger is only as wide as the room left over beside the
|
|
162
|
+
* chips, so the field's padding -- and the strip under the chevron -- are not
|
|
163
|
+
* part of it, and with a single selection the trigger can be a narrow sliver.
|
|
164
|
+
* Without this, clicking anywhere else in the field would do nothing, while
|
|
165
|
+
* the same click anywhere on a non-chips field opens the dropdown (there the
|
|
166
|
+
* trigger *is* the whole field). Forwards such a click to the trigger,
|
|
167
|
+
* including clicks on a chip's own body, so the whole field is a click
|
|
168
|
+
* target. The one exception is a chip's close button: within the chips
|
|
169
|
+
* container the only `<button>` elements a chip ever renders are its close
|
|
170
|
+
* button (see chip.gts / close-button.gts), so `closest('button')` combined
|
|
171
|
+
* with containment against `chipsContainerRef` identifies it without relying
|
|
172
|
+
* on any test-only attribute. Clicks on the trigger itself are left alone
|
|
173
|
+
* too, since it already handles its own clicks.
|
|
174
|
+
*/
|
|
175
|
+
handleFieldClick: (event: MouseEvent) => void;
|
|
176
|
+
clearSelectedKeys: () => void;
|
|
177
|
+
/**
|
|
178
|
+
* Resolved chip appearance: `@chip` wins, then the Select's own `@intent`,
|
|
179
|
+
* then chip defaults tuned for sitting inside a field.
|
|
180
|
+
*/
|
|
181
|
+
get chipOptions(): ResolvedSelectChipOptions;
|
|
182
|
+
/**
|
|
183
|
+
* Whether chips may be removed. Mirrors the listbox: with `@allowEmpty`
|
|
184
|
+
* false — the default — the final selection cannot be deselected, so its
|
|
185
|
+
* chip renders without a close button rather than with a dead one.
|
|
186
|
+
*/
|
|
187
|
+
get chipsRemovable(): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Removes a single selection from a chip's close button. Routes through
|
|
190
|
+
* `onSelectionChange`, which already syncs internal state, notifies the
|
|
191
|
+
* parent and dispatches the form input event.
|
|
192
|
+
*/
|
|
193
|
+
removeSelectedKey: (key: string) => void;
|
|
194
|
+
onItemsChange: (nodes: ListItem[], _: "add" | "remove") => void;
|
|
195
|
+
didClose: () => void;
|
|
196
|
+
/**
|
|
197
|
+
* Whether selections render as chips. Chips are the default presentation for
|
|
198
|
+
* multiple selection mode; `@selectedItemsDisplay="text"` opts back out to the
|
|
199
|
+
* comma-joined string.
|
|
200
|
+
*/
|
|
201
|
+
get showChips(): boolean;
|
|
202
|
+
get hasSelection(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* The accessible name for the trigger when its own text cannot supply one.
|
|
205
|
+
*
|
|
206
|
+
* Left to itself the trigger names itself from its own text -- the selected
|
|
207
|
+
* label, or the placeholder -- and that is still what happens in the plain
|
|
208
|
+
* case; see the trigger, which only applies this when it has to.
|
|
209
|
+
*
|
|
210
|
+
* Two cases need it:
|
|
211
|
+
*
|
|
212
|
+
* - **Chips mode.** The trigger renders nothing; the chips are its siblings
|
|
213
|
+
* and are read separately. Naming the *control* is both enough and
|
|
214
|
+
* correct here -- appending the selection would have it read twice -- so
|
|
215
|
+
* this returns the bare name.
|
|
216
|
+
* - **A `:selectedItem` block.** The block owns the trigger's content and may
|
|
217
|
+
* render nothing readable at all (an avatar, an icon), which would leave
|
|
218
|
+
* the combobox announced as an unnamed button. The selection is not
|
|
219
|
+
* readable anywhere else in that case, so the name carries it: the control
|
|
220
|
+
* name *and* the selected options' text.
|
|
221
|
+
*
|
|
222
|
+
* The two halves are composed so that the separator only appears when both
|
|
223
|
+
* are there. A selected key with no registered option behind it resolves to
|
|
224
|
+
* no text at all, and `"Owner, "` is announced as "Owner comma"; and with
|
|
225
|
+
* neither `@label` nor `@placeholder` the only control name available is the
|
|
226
|
+
* hardcoded, unlocalizable `Select options`, so the selected text is left to
|
|
227
|
+
* name the control on its own rather than be prefixed by English.
|
|
228
|
+
*/
|
|
229
|
+
get triggerAccessibleName(): string;
|
|
230
|
+
/**
|
|
231
|
+
* The selected options in item order (not click order) so chips do not
|
|
232
|
+
* reorder underneath the user as they select.
|
|
233
|
+
*
|
|
234
|
+
* Resolved against `nodes`, which the hidden native `<select>` populates from
|
|
235
|
+
* the unfiltered `@items`, so a chip stays put while a filter hides the item
|
|
236
|
+
* it came from.
|
|
237
|
+
*/
|
|
238
|
+
get selectedItems(): SelectedItem[];
|
|
239
|
+
/**
|
|
240
|
+
* The same selection `selectedItems` describes, rendered as text.
|
|
241
|
+
*
|
|
242
|
+
* Chips and this string are two presentations of one thing, so they read one
|
|
243
|
+
* projection: walking `nodes` a second time here is how a fix to the
|
|
244
|
+
* selection's contents once landed in the chips and not in the text.
|
|
245
|
+
*/
|
|
246
|
+
get selectedTextValue(): string;
|
|
247
|
+
get backdrop(): "blur" | "transparent" | "none" | "faded";
|
|
248
|
+
get classes(): {
|
|
249
|
+
base: (slotProps?: ({
|
|
250
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
251
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
252
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
253
|
+
hasStartContent?: boolean | undefined;
|
|
254
|
+
hasEndContent?: boolean | undefined;
|
|
255
|
+
hasChips?: boolean | undefined;
|
|
256
|
+
isFilterable?: boolean | undefined;
|
|
257
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
258
|
+
innerContainer: (slotProps?: ({
|
|
259
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
260
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
261
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
262
|
+
hasStartContent?: boolean | undefined;
|
|
263
|
+
hasEndContent?: boolean | undefined;
|
|
264
|
+
hasChips?: boolean | undefined;
|
|
265
|
+
isFilterable?: boolean | undefined;
|
|
266
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
267
|
+
startContent: (slotProps?: ({
|
|
268
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
269
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
270
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
271
|
+
hasStartContent?: boolean | undefined;
|
|
272
|
+
hasEndContent?: boolean | undefined;
|
|
273
|
+
hasChips?: boolean | undefined;
|
|
274
|
+
isFilterable?: boolean | undefined;
|
|
275
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
276
|
+
endContent: (slotProps?: ({
|
|
277
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
278
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
279
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
280
|
+
hasStartContent?: boolean | undefined;
|
|
281
|
+
hasEndContent?: boolean | undefined;
|
|
282
|
+
hasChips?: boolean | undefined;
|
|
283
|
+
isFilterable?: boolean | undefined;
|
|
284
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
285
|
+
input: (slotProps?: ({
|
|
286
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
287
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
288
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
289
|
+
hasStartContent?: boolean | undefined;
|
|
290
|
+
hasEndContent?: boolean | undefined;
|
|
291
|
+
hasChips?: boolean | undefined;
|
|
292
|
+
isFilterable?: boolean | undefined;
|
|
293
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
294
|
+
} & {
|
|
295
|
+
base: (slotProps?: ({
|
|
296
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
297
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
298
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
299
|
+
hasStartContent?: boolean | undefined;
|
|
300
|
+
hasEndContent?: boolean | undefined;
|
|
301
|
+
hasChips?: boolean | undefined;
|
|
302
|
+
isFilterable?: boolean | undefined;
|
|
303
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
304
|
+
placeholder: (slotProps?: ({
|
|
305
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
306
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
307
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
308
|
+
hasStartContent?: boolean | undefined;
|
|
309
|
+
hasEndContent?: boolean | undefined;
|
|
310
|
+
hasChips?: boolean | undefined;
|
|
311
|
+
isFilterable?: boolean | undefined;
|
|
312
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
313
|
+
listbox: (slotProps?: ({
|
|
314
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
315
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
316
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
317
|
+
hasStartContent?: boolean | undefined;
|
|
318
|
+
hasEndContent?: boolean | undefined;
|
|
319
|
+
hasChips?: boolean | undefined;
|
|
320
|
+
isFilterable?: boolean | undefined;
|
|
321
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
322
|
+
icon: (slotProps?: ({
|
|
323
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
324
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
325
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
326
|
+
hasStartContent?: boolean | undefined;
|
|
327
|
+
hasEndContent?: boolean | undefined;
|
|
328
|
+
hasChips?: boolean | undefined;
|
|
329
|
+
isFilterable?: boolean | undefined;
|
|
330
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
331
|
+
clearButton: (slotProps?: ({
|
|
332
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
333
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
334
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
335
|
+
hasStartContent?: boolean | undefined;
|
|
336
|
+
hasEndContent?: boolean | undefined;
|
|
337
|
+
hasChips?: boolean | undefined;
|
|
338
|
+
isFilterable?: boolean | undefined;
|
|
339
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
340
|
+
input: (slotProps?: ({
|
|
341
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
342
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
343
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
344
|
+
hasStartContent?: boolean | undefined;
|
|
345
|
+
hasEndContent?: boolean | undefined;
|
|
346
|
+
hasChips?: boolean | undefined;
|
|
347
|
+
isFilterable?: boolean | undefined;
|
|
348
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
349
|
+
emptyContent: (slotProps?: ({
|
|
350
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
351
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
352
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
353
|
+
hasStartContent?: boolean | undefined;
|
|
354
|
+
hasEndContent?: boolean | undefined;
|
|
355
|
+
hasChips?: boolean | undefined;
|
|
356
|
+
isFilterable?: boolean | undefined;
|
|
357
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
358
|
+
chipsField: (slotProps?: ({
|
|
359
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
360
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
361
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
362
|
+
hasStartContent?: boolean | undefined;
|
|
363
|
+
hasEndContent?: boolean | undefined;
|
|
364
|
+
hasChips?: boolean | undefined;
|
|
365
|
+
isFilterable?: boolean | undefined;
|
|
366
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
367
|
+
chipsContainer: (slotProps?: ({
|
|
368
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
369
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
370
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
371
|
+
hasStartContent?: boolean | undefined;
|
|
372
|
+
hasEndContent?: boolean | undefined;
|
|
373
|
+
hasChips?: boolean | undefined;
|
|
374
|
+
isFilterable?: boolean | undefined;
|
|
375
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
376
|
+
chip: (slotProps?: ({
|
|
377
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
378
|
+
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
379
|
+
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
380
|
+
hasStartContent?: boolean | undefined;
|
|
381
|
+
hasEndContent?: boolean | undefined;
|
|
382
|
+
hasChips?: boolean | undefined;
|
|
383
|
+
isFilterable?: boolean | undefined;
|
|
384
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
385
|
+
} & {};
|
|
386
|
+
get isClearable(): boolean | undefined;
|
|
387
|
+
get filterFieldValue(): string;
|
|
388
|
+
get filteredItems(): T[] | undefined;
|
|
389
|
+
get showEmptyContent(): boolean;
|
|
390
|
+
get autoActivateMode(): 'first' | 'selected';
|
|
391
|
+
/**
|
|
392
|
+
* Syncs internal `_selectedKeys` with external `@selectedKeys` argument.
|
|
393
|
+
*
|
|
394
|
+
* Runs whenever `@selectedKeys` changes:
|
|
395
|
+
* - Updates `_selectedKeys` to match the new external value
|
|
396
|
+
* - Normalizes undefined/null to empty array
|
|
397
|
+
*
|
|
398
|
+
* This enables UI updates when the external value changes.
|
|
399
|
+
*/
|
|
400
|
+
updateMultipleSelectValue: import("ember-modifier").FunctionBasedModifier<{
|
|
401
|
+
Args: {
|
|
402
|
+
Positional: [string[] | null | undefined];
|
|
403
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
404
|
+
};
|
|
405
|
+
Element: HTMLDivElement;
|
|
406
|
+
}>;
|
|
407
|
+
/**
|
|
408
|
+
* Syncs internal `_selectedKey` with external `@selectedKey` argument.
|
|
409
|
+
*
|
|
410
|
+
* Runs whenever `@selectedKey` changes:
|
|
411
|
+
* - Updates `_selectedKey` to match the new external value
|
|
412
|
+
* - Handles null values for cleared selections
|
|
413
|
+
*
|
|
414
|
+
* This enables UI updates when the external value changes.
|
|
415
|
+
*/
|
|
416
|
+
updateSingleSelectValue: import("ember-modifier").FunctionBasedModifier<{
|
|
417
|
+
Args: {
|
|
418
|
+
Positional: [string | null | undefined];
|
|
419
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
420
|
+
};
|
|
421
|
+
Element: HTMLDivElement;
|
|
422
|
+
}>;
|
|
423
|
+
}
|
|
424
|
+
export { Select, type SelectSignature, type SelectChipOptions, type SelectedItem, type SelectedItemBlockArg };
|
|
425
|
+
export default Select;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
import type { ModifierLike } from '@glint/template';
|
|
3
|
+
import type { SlotsToClasses, SelectSlots } from '@frontile/theme';
|
|
4
|
+
import type { ResolvedSelectChipOptions, SelectClasses, SelectedItem, SelectedItemBlockArg } from './types';
|
|
5
|
+
interface SelectedTextSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
/** The selection, in item order. */
|
|
8
|
+
items: SelectedItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Whether the `:item` block is the consumer's own content rather than the
|
|
11
|
+
* fallback the Select fills it with.
|
|
12
|
+
*
|
|
13
|
+
* A block cannot be passed conditionally in Glimmer, so the Select always
|
|
14
|
+
* supplies one; this is how the plain presentation stays *exactly* what it
|
|
15
|
+
* was -- the whole selection as one joined string in a single text node --
|
|
16
|
+
* instead of becoming a per-item loop that merely renders the same
|
|
17
|
+
* characters.
|
|
18
|
+
*/
|
|
19
|
+
hasCustomContent?: boolean;
|
|
20
|
+
};
|
|
21
|
+
Blocks: {
|
|
22
|
+
/** Content for one selected option, in place of its text. */
|
|
23
|
+
item: [SelectedItemBlockArg<never>];
|
|
24
|
+
};
|
|
25
|
+
Element: HTMLSpanElement;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The selection presented as a comma-joined string, inside the trigger.
|
|
29
|
+
*
|
|
30
|
+
* The text presentation and the chips presentation are the two renderings of
|
|
31
|
+
* one selection, so they live in one file and read the same
|
|
32
|
+
* {@link SelectedItem} projection.
|
|
33
|
+
*/
|
|
34
|
+
declare const SelectedText: TOC<SelectedTextSignature>;
|
|
35
|
+
interface SelectedChipsSignature {
|
|
36
|
+
Args: {
|
|
37
|
+
/** The selection, in item order, so chips do not reorder as they are picked. */
|
|
38
|
+
items: SelectedItem[];
|
|
39
|
+
/**
|
|
40
|
+
* Installed on the chips container. The field click forwarder reads this
|
|
41
|
+
* ref to tell a chip body apart from a chip close button structurally,
|
|
42
|
+
* without depending on any attribute.
|
|
43
|
+
*/
|
|
44
|
+
containerRef: ModifierLike<{
|
|
45
|
+
Element: HTMLDivElement;
|
|
46
|
+
}>;
|
|
47
|
+
classes: SelectClasses;
|
|
48
|
+
userClasses?: SlotsToClasses<SelectSlots>;
|
|
49
|
+
chipOptions: ResolvedSelectChipOptions;
|
|
50
|
+
isDisabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether a chip may be removed at all. When false the chip renders with no
|
|
53
|
+
* close button rather than a dead one.
|
|
54
|
+
*/
|
|
55
|
+
isRemovable: boolean;
|
|
56
|
+
onRemove: (key: string) => void;
|
|
57
|
+
};
|
|
58
|
+
Blocks: {
|
|
59
|
+
/**
|
|
60
|
+
* The body of one chip, in place of the option's text. The chip chrome --
|
|
61
|
+
* its appearance, its dot and its close button -- is not the block's to
|
|
62
|
+
* replace, so it stays put around whatever is rendered here.
|
|
63
|
+
*/
|
|
64
|
+
item: [SelectedItemBlockArg<never>];
|
|
65
|
+
};
|
|
66
|
+
Element: HTMLDivElement;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The selection presented as a row of removable {@link Chip}s beside the
|
|
70
|
+
* trigger.
|
|
71
|
+
*
|
|
72
|
+
* The close buttons are deliberately outside the tab order
|
|
73
|
+
* (`@closeButtonTabIndex="-1"`) so the trigger keeps the first Tab stop in the
|
|
74
|
+
* field; Backspace on the field is the keyboard route to removal.
|
|
75
|
+
*
|
|
76
|
+
* The close button's title is built from `textValue`, never from the block, so
|
|
77
|
+
* a chip whose body is purely graphical is still announced as "Remove <label>".
|
|
78
|
+
*/
|
|
79
|
+
declare const SelectedChips: TOC<SelectedChipsSignature>;
|
|
80
|
+
export { SelectedChips, SelectedText, type SelectedChipsSignature, type SelectedTextSignature };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
import type { ModifierLike } from '@glint/template';
|
|
3
|
+
import type { SlotsToClasses, SelectSlots } from '@frontile/theme';
|
|
4
|
+
import type { SelectClasses, SelectedItem, SelectedItemBlockArg } from './types';
|
|
5
|
+
interface SelectTriggerSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
/** Whether the trigger is a filter input rather than a button. */
|
|
8
|
+
isFilterable?: boolean;
|
|
9
|
+
/** The popover's `trigger` modifier: what opens the dropdown. */
|
|
10
|
+
trigger: ModifierLike<{
|
|
11
|
+
Element: HTMLElement;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Records the trigger element. The field click forwarder and the listbox's
|
|
15
|
+
* keyboard-event host both need the live element.
|
|
16
|
+
*/
|
|
17
|
+
triggerRef: ModifierLike<{
|
|
18
|
+
Element: HTMLInputElement | HTMLButtonElement;
|
|
19
|
+
}>;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
showChips: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Names the trigger when its own text cannot.
|
|
24
|
+
*
|
|
25
|
+
* In chips mode the trigger renders no text of its own (the chips are its
|
|
26
|
+
* siblings and are read separately), so without this the combobox would be
|
|
27
|
+
* announced unnamed. The same is true whenever `@hasCustomContent` is set:
|
|
28
|
+
* the block may render nothing readable at all.
|
|
29
|
+
*/
|
|
30
|
+
accessibleName: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the consumer supplied a `:selectedItem` block, i.e. whether the
|
|
33
|
+
* text inside the trigger is theirs rather than the option's label.
|
|
34
|
+
*
|
|
35
|
+
* Two things hang off this: the `<button>` trigger stops trusting its own
|
|
36
|
+
* text content for its accessible name, and {@link SelectedText} switches
|
|
37
|
+
* from the joined string to a per-selection loop. The filterable
|
|
38
|
+
* `<input>` trigger ignores it -- the block never renders there, so the
|
|
39
|
+
* input's own value still names it.
|
|
40
|
+
*/
|
|
41
|
+
hasCustomContent?: boolean;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
hasSelection: boolean;
|
|
44
|
+
hasStartContent: boolean;
|
|
45
|
+
classes: SelectClasses;
|
|
46
|
+
userClasses?: SlotsToClasses<SelectSlots>;
|
|
47
|
+
/** The selection, for the text presentation inside a button trigger. */
|
|
48
|
+
items: SelectedItem[];
|
|
49
|
+
/** Current value of the filter input. */
|
|
50
|
+
filterValue: string;
|
|
51
|
+
onFilterInput: (event: Event) => void;
|
|
52
|
+
onFilterKeydown: (event: KeyboardEvent) => void;
|
|
53
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
54
|
+
onBlur: () => void;
|
|
55
|
+
};
|
|
56
|
+
Blocks: {
|
|
57
|
+
/**
|
|
58
|
+
* Content for one selected option, forwarded straight through to
|
|
59
|
+
* {@link SelectedText}. Always supplied by the Select -- a block cannot be
|
|
60
|
+
* passed conditionally -- so `@hasCustomContent` is what says whether it
|
|
61
|
+
* holds the consumer's markup or the plain-label fallback.
|
|
62
|
+
*/
|
|
63
|
+
selectedItem: [SelectedItemBlockArg<never>];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The Select's trigger: a filter `<input>` when `@isFilterable`, otherwise a
|
|
68
|
+
* `<button>`.
|
|
69
|
+
*
|
|
70
|
+
* Both carry `data-component="select-trigger"` and the same `input` slot, whose
|
|
71
|
+
* `hasChips` variant is what gives the trigger a hittable box when it has to
|
|
72
|
+
* share a flex line with the chips instead of being the whole field.
|
|
73
|
+
*/
|
|
74
|
+
declare const SelectTrigger: TOC<SelectTriggerSignature>;
|
|
75
|
+
export { SelectTrigger, type SelectTriggerSignature };
|
|
76
|
+
export default SelectTrigger;
|