@frontile/forms 0.18.0-alpha.11 → 0.18.0-alpha.13
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/package.json +14 -14
- package/declarations/components/checkbox-group.d.ts +0 -42
- package/declarations/components/checkbox.d.ts +0 -40
- package/declarations/components/field-types.d.ts +0 -14
- package/declarations/components/field.d.ts +0 -85
- package/declarations/components/form-control.d.ts +0 -47
- package/declarations/components/form-description.d.ts +0 -18
- package/declarations/components/form-feedback.d.ts +0 -22
- package/declarations/components/form.d.ts +0 -254
- package/declarations/components/icons.d.ts +0 -7
- package/declarations/components/input.d.ts +0 -145
- package/declarations/components/label.d.ts +0 -40
- package/declarations/components/native-select.d.ts +0 -154
- package/declarations/components/radio-group.d.ts +0 -43
- package/declarations/components/radio.d.ts +0 -41
- package/declarations/components/select.d.ts +0 -531
- package/declarations/components/switch.d.ts +0 -152
- package/declarations/components/textarea.d.ts +0 -69
- package/declarations/utils/index.d.ts +0 -3
- package/declarations/utils/nested-data.d.ts +0 -44
- package/declarations/utils/standard-validator.d.ts +0 -151
- package/dist/form-CVuJDJUq.js +0 -726
- package/dist/form-CVuJDJUq.js.map +0 -1
- package/dist/index-6gTa9ocT.js +0 -23
- package/dist/index-6gTa9ocT.js.map +0 -1
- package/dist/index-CeaQc-U7.js +0 -23
- package/dist/index-CeaQc-U7.js.map +0 -1
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js +0 -67
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js.map +0 -1
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import type Owner from '@ember/owner';
|
|
3
|
-
import { type ListItem } from './native-select';
|
|
4
|
-
import { type ListboxSignature } from '@frontile/collections';
|
|
5
|
-
import { type SelectSlots, type SelectVariants, type SlotsToClasses } from '@frontile/theme';
|
|
6
|
-
import { type PopoverSignature, type ContentSignature } from '@frontile/overlays';
|
|
7
|
-
import { type FormControlSharedArgs } from './form-control';
|
|
8
|
-
interface BaseSelectArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'middleware' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ListboxSignature<T>['Args'], 'appearance' | 'intent' | 'disabledKeys' | 'allowEmpty' | 'items' | 'onAction'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'transitionDuration' | 'backdrop' | 'disableTransitions' | 'focusTrapOptions' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'backdropTransition' | 'transition'>, FormControlSharedArgs {
|
|
9
|
-
}
|
|
10
|
-
interface BaseSingleSelectArgs<T> extends BaseSelectArgs<T> {
|
|
11
|
-
/**
|
|
12
|
-
* The currently selected key for single selection mode.
|
|
13
|
-
*
|
|
14
|
-
* **Data Flow:**
|
|
15
|
-
* - Pass this to set the initial selection
|
|
16
|
-
* - Update this in your `onSelectionChange` handler to maintain two-way binding
|
|
17
|
-
* - The component calls `onSelectionChange` whenever the user changes the selection
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```gts
|
|
21
|
-
* import { tracked } from '@glimmer/tracking';
|
|
22
|
-
*
|
|
23
|
-
* class MyComponent {
|
|
24
|
-
* @tracked selectedKey = 'option1';
|
|
25
|
-
*
|
|
26
|
-
* handleSelectionChange = (key: string | null) => {
|
|
27
|
-
* this.selectedKey = key; // Update parent state
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* <template>
|
|
31
|
-
* <Select
|
|
32
|
-
* @selectedKey={{this.selectedKey}}
|
|
33
|
-
* @onSelectionChange={{this.handleSelectionChange}}
|
|
34
|
-
* @items={{this.items}}
|
|
35
|
-
* />
|
|
36
|
-
* </template>
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
selectedKey?: string | null;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use selectedKey for single selection mode
|
|
43
|
-
*/
|
|
44
|
-
selectedKeys?: never;
|
|
45
|
-
/**
|
|
46
|
-
* Callback fired when the selection changes in single mode.
|
|
47
|
-
*
|
|
48
|
-
* Update your `@selectedKey` state in this callback to maintain two-way binding.
|
|
49
|
-
*
|
|
50
|
-
* @param key - The newly selected key, or null if selection was cleared
|
|
51
|
-
*/
|
|
52
|
-
onSelectionChange?: (key: string | null) => void;
|
|
53
|
-
}
|
|
54
|
-
interface ExplicitSingleSelectArgs<T> extends BaseSingleSelectArgs<T> {
|
|
55
|
-
/**
|
|
56
|
-
* Determines the selection mode of the select component.
|
|
57
|
-
* - 'single': Only one item can be selected at a time.
|
|
58
|
-
*/
|
|
59
|
-
selectionMode: 'single';
|
|
60
|
-
}
|
|
61
|
-
interface DefaultSingleSelectArgs<T> extends BaseSingleSelectArgs<T> {
|
|
62
|
-
/**
|
|
63
|
-
* Determines the selection mode of the select component.
|
|
64
|
-
* - 'single': Only one item can be selected at a time.
|
|
65
|
-
* @defaultValue 'single'
|
|
66
|
-
*/
|
|
67
|
-
selectionMode?: undefined;
|
|
68
|
-
}
|
|
69
|
-
interface MultipleSelectArgs<T> extends BaseSelectArgs<T> {
|
|
70
|
-
/**
|
|
71
|
-
* Determines the selection mode of the select component.
|
|
72
|
-
* - 'multiple': Allows multiple selections.
|
|
73
|
-
*/
|
|
74
|
-
selectionMode: 'multiple';
|
|
75
|
-
/**
|
|
76
|
-
* @deprecated Use selectedKeys for multiple selection mode
|
|
77
|
-
*/
|
|
78
|
-
selectedKey?: never;
|
|
79
|
-
/**
|
|
80
|
-
* The currently selected keys for multiple selection mode.
|
|
81
|
-
*
|
|
82
|
-
* **Data Flow:**
|
|
83
|
-
* - Pass this to set the initial selection (array of keys)
|
|
84
|
-
* - Update this in your `onSelectionChange` handler to maintain two-way binding
|
|
85
|
-
* - The component calls `onSelectionChange` whenever the user changes the selection
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```gts
|
|
89
|
-
* import { tracked } from '@glimmer/tracking';
|
|
90
|
-
*
|
|
91
|
-
* class MyComponent {
|
|
92
|
-
* @tracked selectedKeys = ['option1', 'option2'];
|
|
93
|
-
*
|
|
94
|
-
* handleSelectionChange = (keys: string[]) => {
|
|
95
|
-
* this.selectedKeys = keys; // Update parent state
|
|
96
|
-
* }
|
|
97
|
-
*
|
|
98
|
-
* <template>
|
|
99
|
-
* <Select
|
|
100
|
-
* @selectionMode="multiple"
|
|
101
|
-
* @selectedKeys={{this.selectedKeys}}
|
|
102
|
-
* @onSelectionChange={{this.handleSelectionChange}}
|
|
103
|
-
* @items={{this.items}}
|
|
104
|
-
* />
|
|
105
|
-
* </template>
|
|
106
|
-
* }
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
selectedKeys?: string[];
|
|
110
|
-
/**
|
|
111
|
-
* Callback fired when the selection changes in multiple mode.
|
|
112
|
-
*
|
|
113
|
-
* Update your `@selectedKeys` state in this callback to maintain two-way binding.
|
|
114
|
-
*
|
|
115
|
-
* @param keys - The newly selected keys (empty array if all selections cleared)
|
|
116
|
-
*/
|
|
117
|
-
onSelectionChange?: (keys: string[]) => void;
|
|
118
|
-
}
|
|
119
|
-
type SelectArgs<T> = (ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T> | MultipleSelectArgs<T>) & {
|
|
120
|
-
/**
|
|
121
|
-
* The unique identifier for the select component.
|
|
122
|
-
*/
|
|
123
|
-
id?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Defines the input size of the select.
|
|
126
|
-
*/
|
|
127
|
-
inputSize?: SelectVariants['size'];
|
|
128
|
-
/**
|
|
129
|
-
* Defines the size of the popover dropdown.
|
|
130
|
-
* - 'sm': Small
|
|
131
|
-
* - 'md': Medium
|
|
132
|
-
* - 'lg': Large
|
|
133
|
-
* - 'trigger': Same size as the trigger
|
|
134
|
-
*
|
|
135
|
-
* @defaultValue 'trigger'
|
|
136
|
-
*/
|
|
137
|
-
popoverSize?: 'sm' | 'md' | 'lg' | 'trigger';
|
|
138
|
-
/**
|
|
139
|
-
* Custom classes to style different slots within the select component.
|
|
140
|
-
*/
|
|
141
|
-
classes?: SlotsToClasses<SelectSlots>;
|
|
142
|
-
/**
|
|
143
|
-
* Whether the select should close upon selecting an item.
|
|
144
|
-
*
|
|
145
|
-
* @defaultValue true
|
|
146
|
-
*/
|
|
147
|
-
closeOnItemSelect?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Whether scrolling should be blocked when the select dropdown is open.
|
|
150
|
-
*
|
|
151
|
-
* @defaultValue true
|
|
152
|
-
*/
|
|
153
|
-
blockScroll?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Whether the focus trap should be disabled when the dropdown is open.
|
|
156
|
-
*
|
|
157
|
-
* @defaultValue true
|
|
158
|
-
*/
|
|
159
|
-
disableFocusTrap?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* The placeholder text displayed when no option is selected.
|
|
162
|
-
*/
|
|
163
|
-
placeholder?: string;
|
|
164
|
-
/**
|
|
165
|
-
* Whether the select should be disabled, preventing user interaction.
|
|
166
|
-
*/
|
|
167
|
-
isDisabled?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Allows filtering of the items in the select dropdown.
|
|
170
|
-
* If true, a search input is displayed for filtering.
|
|
171
|
-
*
|
|
172
|
-
* @defaultValue false
|
|
173
|
-
*/
|
|
174
|
-
isFilterable?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Function to filter the items in the select.
|
|
177
|
-
* The default implementation performs a case-insensitive search.
|
|
178
|
-
*
|
|
179
|
-
* @param itemValue - The value of an item in the dropdown.
|
|
180
|
-
* @param filterValue - The user's input in the filter/search box.
|
|
181
|
-
* @returns A boolean indicating whether the item should be shown.
|
|
182
|
-
*/
|
|
183
|
-
filter?: (itemValue: string, filterValue: string) => boolean;
|
|
184
|
-
/**
|
|
185
|
-
* If true, the select will show a loading spinner instead of the dropdown icon.
|
|
186
|
-
*/
|
|
187
|
-
isLoading?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
* The name attribute for the select component, useful for form submissions.
|
|
190
|
-
*/
|
|
191
|
-
name?: string;
|
|
192
|
-
/**
|
|
193
|
-
* Whether to include a clear button in the select component.
|
|
194
|
-
* If enabled, this allows users to clear the selection.
|
|
195
|
-
* This option ignores the `allowEmpty` setting.
|
|
196
|
-
*
|
|
197
|
-
* @defaultValue false
|
|
198
|
-
*/
|
|
199
|
-
isClearable?: boolean;
|
|
200
|
-
/**
|
|
201
|
-
* Controls pointer-events property of startContent.
|
|
202
|
-
* If you want to pass the click event to the input, set it to `none`.
|
|
203
|
-
*
|
|
204
|
-
* @defaultValue 'auto'
|
|
205
|
-
*/
|
|
206
|
-
startContentPointerEvents?: 'none' | 'auto';
|
|
207
|
-
/**
|
|
208
|
-
* Controls pointer-events property of endContent.
|
|
209
|
-
* Defaults to `none` to pass click events to the input. If your content
|
|
210
|
-
* needs to capture events, add the `pointer-events-auto` class to that element.
|
|
211
|
-
*
|
|
212
|
-
* @defaultValue 'none'
|
|
213
|
-
*/
|
|
214
|
-
endContentPointerEvents?: 'none' | 'auto';
|
|
215
|
-
/**
|
|
216
|
-
* If true, hides the empty content when there are no options available.
|
|
217
|
-
*
|
|
218
|
-
* @defaultValue false
|
|
219
|
-
*/
|
|
220
|
-
hideEmptyContent?: boolean;
|
|
221
|
-
/**
|
|
222
|
-
* Callback fired when the select component loses focus.
|
|
223
|
-
*/
|
|
224
|
-
onBlur?: () => void;
|
|
225
|
-
};
|
|
226
|
-
interface SelectSignature<T> {
|
|
227
|
-
Args: SelectArgs<T>;
|
|
228
|
-
Element: HTMLDivElement;
|
|
229
|
-
Blocks: ListboxSignature<T>['Blocks'] & {
|
|
230
|
-
/**
|
|
231
|
-
* Content to display at the **beginning** of the select component.
|
|
232
|
-
* This can be an icon, a label, or any custom UI element.
|
|
233
|
-
*
|
|
234
|
-
* Example: A search icon or a custom label.
|
|
235
|
-
*/
|
|
236
|
-
startContent: [];
|
|
237
|
-
/**
|
|
238
|
-
* Content to display at the **end** of the select component.
|
|
239
|
-
* This can be an icon, a button, or any custom UI element.
|
|
240
|
-
*
|
|
241
|
-
* Example: A clear button or a dropdown arrow.
|
|
242
|
-
*/
|
|
243
|
-
endContent: [];
|
|
244
|
-
/**
|
|
245
|
-
* The content to display when there are no available options.
|
|
246
|
-
* If `hideEmptyContent` argument is true, this content will not be shown.
|
|
247
|
-
*/
|
|
248
|
-
emptyContent: [];
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Select Component - A feature-rich dropdown selection component
|
|
253
|
-
*
|
|
254
|
-
* ## Selection State Architecture
|
|
255
|
-
*
|
|
256
|
-
* This component uses a **two-way data binding pattern** for managing selection state:
|
|
257
|
-
*
|
|
258
|
-
* ### Data Flow
|
|
259
|
-
* 1. **External → Internal (Initialization & Updates)**
|
|
260
|
-
* - Parent passes `@selectedKey` or `@selectedKeys` as arguments
|
|
261
|
-
* - Constructor initializes internal tracked properties (`_selectedKey` or `_selectedKeys`)
|
|
262
|
-
* - Modifiers (`updateSingleSelectValue`, `updateMultipleSelectValue`) sync internal state
|
|
263
|
-
* when parent updates the arguments
|
|
264
|
-
*
|
|
265
|
-
* 2. **Internal State Management**
|
|
266
|
-
* - `_selectedKey` / `_selectedKeys`: Internal tracked state (prefixed with underscore)
|
|
267
|
-
* - These serve as the "source of truth" for rendering and reactivity
|
|
268
|
-
* - Getters (`getSelectedKey`, `selectedKeys`) expose this internal state to the template
|
|
269
|
-
*
|
|
270
|
-
* 3. **Internal → External (User Interactions)**
|
|
271
|
-
* - User interactions trigger selection change handlers
|
|
272
|
-
* - Handlers update internal `_selectedKey` / `_selectedKeys` for immediate UI update
|
|
273
|
-
* - Handlers call parent's `@onSelectionChange` callback to notify of state change
|
|
274
|
-
* - Parent updates its state, which flows back through step 1
|
|
275
|
-
*
|
|
276
|
-
* ### Why Both Internal State AND Callbacks?
|
|
277
|
-
* - **Internal state:** Enables immediate, responsive UI updates (`_selectedKey` / `_selectedKeys`)
|
|
278
|
-
* - **Parent callback:** Enables parent to take action when changes occur (`@onSelectionChange`)
|
|
279
|
-
* - This pattern provides both responsive UX and parent inclusion over state
|
|
280
|
-
*
|
|
281
|
-
* ### Example Flow
|
|
282
|
-
* ```
|
|
283
|
-
* User clicks item
|
|
284
|
-
* → onSelectionChange handler
|
|
285
|
-
* → Updates _selectedKey (immediate UI update)
|
|
286
|
-
* → Calls parent's @onSelectionChange callback
|
|
287
|
-
* → Parent updates its @selectedKey state
|
|
288
|
-
* → updateSingleSelectValue modifier syncs _selectedKey with new arg value
|
|
289
|
-
* ```
|
|
290
|
-
*/
|
|
291
|
-
declare class Select<T = unknown> extends Component<SelectSignature<T>> {
|
|
292
|
-
nodes: ListItem[];
|
|
293
|
-
isOpen: boolean;
|
|
294
|
-
/**
|
|
295
|
-
* Internal tracked state for single selection mode.
|
|
296
|
-
* Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.
|
|
297
|
-
*/
|
|
298
|
-
_selectedKey: string | null;
|
|
299
|
-
/**
|
|
300
|
-
* Internal tracked state for multiple selection mode.
|
|
301
|
-
* Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.
|
|
302
|
-
*/
|
|
303
|
-
_selectedKeys: string[];
|
|
304
|
-
/**
|
|
305
|
-
* Initializes the component and sets up initial selection state.
|
|
306
|
-
*
|
|
307
|
-
* **Initialization:**
|
|
308
|
-
* 1. Determines selection mode (single vs multiple)
|
|
309
|
-
* 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state
|
|
310
|
-
* 3. Logs warnings if incorrect args are used for the selection mode
|
|
311
|
-
*
|
|
312
|
-
* Note: After instantiation, modifiers keep internal state synced with external arguments.
|
|
313
|
-
*/
|
|
314
|
-
constructor(owner: Owner, args: SelectArgs<T>);
|
|
315
|
-
validateArgs(): void;
|
|
316
|
-
filterValue?: string;
|
|
317
|
-
containerRef: {
|
|
318
|
-
"__#1@#private": any;
|
|
319
|
-
current: HTMLDivElement | undefined;
|
|
320
|
-
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
321
|
-
Args: {
|
|
322
|
-
Positional: unknown[];
|
|
323
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
324
|
-
};
|
|
325
|
-
Element: HTMLDivElement;
|
|
326
|
-
}>;
|
|
327
|
-
};
|
|
328
|
-
triggerRef: {
|
|
329
|
-
"__#1@#private": any;
|
|
330
|
-
current: HTMLButtonElement | HTMLInputElement | undefined;
|
|
331
|
-
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
332
|
-
Args: {
|
|
333
|
-
Positional: unknown[];
|
|
334
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
335
|
-
};
|
|
336
|
-
Element: HTMLButtonElement | HTMLInputElement;
|
|
337
|
-
}>;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Handles selection changes from the Listbox component.
|
|
341
|
-
*
|
|
342
|
-
* **Flow:**
|
|
343
|
-
* 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates
|
|
344
|
-
* 2. Calls parent's `@onSelectionChange` callback to notify of the change
|
|
345
|
-
* 3. Parent updates its state, which flows back via modifier to complete the cycle
|
|
346
|
-
*
|
|
347
|
-
* **Side effects:**
|
|
348
|
-
* - Clears filter value (for searchable selects)
|
|
349
|
-
* - Triggers form input event for native form integration
|
|
350
|
-
*
|
|
351
|
-
* @param keys - Array of selected keys from Listbox (converted to single value in single mode)
|
|
352
|
-
*/
|
|
353
|
-
onSelectionChange: (keys: string[]) => void;
|
|
354
|
-
/**
|
|
355
|
-
* Handles selection changes from the native <select> element.
|
|
356
|
-
*
|
|
357
|
-
* This is similar to `onSelectionChange` but accepts a single key directly
|
|
358
|
-
* rather than an array, matching the native select's single-value API.
|
|
359
|
-
*
|
|
360
|
-
* **Flow:**
|
|
361
|
-
* 1. Updates internal `_selectedKey` for immediate UI update
|
|
362
|
-
* 2. Calls parent's `@onSelectionChange` callback
|
|
363
|
-
*
|
|
364
|
-
* @param key - The selected key, or null if cleared
|
|
365
|
-
*/
|
|
366
|
-
onSingleSelectionChange: (key: string | null) => void;
|
|
367
|
-
onOpenChange: (isOpen: boolean) => void;
|
|
368
|
-
onFilterChange: (event: Event) => void;
|
|
369
|
-
/**
|
|
370
|
-
* Returns current selection as an array for template rendering.
|
|
371
|
-
*
|
|
372
|
-
* Normalizes both single and multiple selection modes to a consistent array interface:
|
|
373
|
-
* - Multiple mode: Returns `_selectedKeys` directly
|
|
374
|
-
* - Single mode: Converts `_selectedKey` to array format (or empty array if null)
|
|
375
|
-
*
|
|
376
|
-
* Note: Always returns internal tracked state rather than arguments. External updates
|
|
377
|
-
* sync through modifiers to maintain consistency.
|
|
378
|
-
*
|
|
379
|
-
* @returns Array of selected keys (empty array if none selected)
|
|
380
|
-
*/
|
|
381
|
-
get selectedKeys(): string[];
|
|
382
|
-
/**
|
|
383
|
-
* Returns the selected key for single selection mode.
|
|
384
|
-
*
|
|
385
|
-
* **Returns:**
|
|
386
|
-
* - Single mode: Returns `_selectedKey` (string or null)
|
|
387
|
-
* - Multiple mode: Returns null (not applicable)
|
|
388
|
-
*
|
|
389
|
-
* Note: Always returns internal tracked state rather than arguments. External updates
|
|
390
|
-
* sync through modifiers to maintain consistency.
|
|
391
|
-
*
|
|
392
|
-
* @returns The selected key, or null if none selected or in multiple mode
|
|
393
|
-
*/
|
|
394
|
-
get getSelectedKey(): string | null;
|
|
395
|
-
get blockScroll(): boolean;
|
|
396
|
-
get disableFocusTrap(): boolean;
|
|
397
|
-
onAction: (key: string) => void;
|
|
398
|
-
handleBlur(): void;
|
|
399
|
-
clearSelectedKeys: () => void;
|
|
400
|
-
onItemsChange: (nodes: ListItem[], _: "add" | "remove") => void;
|
|
401
|
-
didClose: () => void;
|
|
402
|
-
get selectedText(): string;
|
|
403
|
-
get selectedTextValue(): string;
|
|
404
|
-
get backdrop(): "blur" | "none" | "transparent" | "faded";
|
|
405
|
-
get classes(): {
|
|
406
|
-
base: (slotProps?: ({
|
|
407
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
408
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
409
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
410
|
-
hasStartContent?: boolean | undefined;
|
|
411
|
-
hasEndContent?: boolean | undefined;
|
|
412
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
413
|
-
innerContainer: (slotProps?: ({
|
|
414
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
415
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
416
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
417
|
-
hasStartContent?: boolean | undefined;
|
|
418
|
-
hasEndContent?: boolean | undefined;
|
|
419
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
420
|
-
startContent: (slotProps?: ({
|
|
421
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
422
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
423
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
424
|
-
hasStartContent?: boolean | undefined;
|
|
425
|
-
hasEndContent?: boolean | undefined;
|
|
426
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
427
|
-
endContent: (slotProps?: ({
|
|
428
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
429
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
430
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
431
|
-
hasStartContent?: boolean | undefined;
|
|
432
|
-
hasEndContent?: boolean | undefined;
|
|
433
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
434
|
-
input: (slotProps?: ({
|
|
435
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
436
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
437
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
438
|
-
hasStartContent?: boolean | undefined;
|
|
439
|
-
hasEndContent?: boolean | undefined;
|
|
440
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
441
|
-
} & {
|
|
442
|
-
base: (slotProps?: ({
|
|
443
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
444
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
445
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
446
|
-
hasStartContent?: boolean | undefined;
|
|
447
|
-
hasEndContent?: boolean | undefined;
|
|
448
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
449
|
-
placeholder: (slotProps?: ({
|
|
450
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
451
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
452
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
453
|
-
hasStartContent?: boolean | undefined;
|
|
454
|
-
hasEndContent?: boolean | undefined;
|
|
455
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
456
|
-
listbox: (slotProps?: ({
|
|
457
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
458
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
459
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
460
|
-
hasStartContent?: boolean | undefined;
|
|
461
|
-
hasEndContent?: boolean | undefined;
|
|
462
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
463
|
-
icon: (slotProps?: ({
|
|
464
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
465
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
466
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
467
|
-
hasStartContent?: boolean | undefined;
|
|
468
|
-
hasEndContent?: boolean | undefined;
|
|
469
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
470
|
-
clearButton: (slotProps?: ({
|
|
471
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
472
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
473
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
474
|
-
hasStartContent?: boolean | undefined;
|
|
475
|
-
hasEndContent?: boolean | undefined;
|
|
476
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
477
|
-
input: (slotProps?: ({
|
|
478
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
479
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
480
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
481
|
-
hasStartContent?: boolean | undefined;
|
|
482
|
-
hasEndContent?: boolean | undefined;
|
|
483
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
484
|
-
emptyContent: (slotProps?: ({
|
|
485
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
486
|
-
startContentPointerEvents?: "none" | "auto" | undefined;
|
|
487
|
-
endContentPointerEvents?: "none" | "auto" | undefined;
|
|
488
|
-
hasStartContent?: boolean | undefined;
|
|
489
|
-
hasEndContent?: boolean | undefined;
|
|
490
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
491
|
-
} & {};
|
|
492
|
-
get isClearable(): boolean | undefined;
|
|
493
|
-
get filterFieldValue(): string;
|
|
494
|
-
get filteredItems(): T[] | undefined;
|
|
495
|
-
get showEmptyContent(): boolean;
|
|
496
|
-
get autoActivateMode(): 'first' | 'selected';
|
|
497
|
-
/**
|
|
498
|
-
* Syncs internal `_selectedKeys` with external `@selectedKeys` argument.
|
|
499
|
-
*
|
|
500
|
-
* Runs whenever `@selectedKeys` changes:
|
|
501
|
-
* - Updates `_selectedKeys` to match the new external value
|
|
502
|
-
* - Normalizes undefined/null to empty array
|
|
503
|
-
*
|
|
504
|
-
* This enables UI updates when the external value changes.
|
|
505
|
-
*/
|
|
506
|
-
updateMultipleSelectValue: import("ember-modifier").FunctionBasedModifier<{
|
|
507
|
-
Args: {
|
|
508
|
-
Positional: [string[] | null | undefined];
|
|
509
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
510
|
-
};
|
|
511
|
-
Element: HTMLDivElement;
|
|
512
|
-
}>;
|
|
513
|
-
/**
|
|
514
|
-
* Syncs internal `_selectedKey` with external `@selectedKey` argument.
|
|
515
|
-
*
|
|
516
|
-
* Runs whenever `@selectedKey` changes:
|
|
517
|
-
* - Updates `_selectedKey` to match the new external value
|
|
518
|
-
* - Handles null values for cleared selections
|
|
519
|
-
*
|
|
520
|
-
* This enables UI updates when the external value changes.
|
|
521
|
-
*/
|
|
522
|
-
updateSingleSelectValue: import("ember-modifier").FunctionBasedModifier<{
|
|
523
|
-
Args: {
|
|
524
|
-
Positional: [string | null | undefined];
|
|
525
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
526
|
-
};
|
|
527
|
-
Element: HTMLDivElement;
|
|
528
|
-
}>;
|
|
529
|
-
}
|
|
530
|
-
export { Select, type SelectSignature };
|
|
531
|
-
export default Select;
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { type FormControlSharedArgs } from './form-control';
|
|
3
|
-
import { type SwitchVariants, type SwitchSlots, type SlotsToClasses } from '@frontile/theme';
|
|
4
|
-
import type Owner from '@ember/owner';
|
|
5
|
-
interface Args extends FormControlSharedArgs {
|
|
6
|
-
/**
|
|
7
|
-
* Controls the current selected state of the Switch.
|
|
8
|
-
* When provided a boolean value, the component operates in a controlled mode.
|
|
9
|
-
*/
|
|
10
|
-
isSelected?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Sets the initial selected state of the Switch when used in uncontrolled mode.
|
|
13
|
-
* @defaultValue false
|
|
14
|
-
*/
|
|
15
|
-
defaultSelected?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The name attribute for the input element.
|
|
18
|
-
* Useful for form submissions.
|
|
19
|
-
*/
|
|
20
|
-
name?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The size of the Switch.
|
|
23
|
-
*/
|
|
24
|
-
size?: SwitchVariants['size'];
|
|
25
|
-
/**
|
|
26
|
-
* The visual intent (e.g., color or style) of the Switch.
|
|
27
|
-
* @defaultValue 'primary'
|
|
28
|
-
*/
|
|
29
|
-
intent?: SwitchVariants['intent'];
|
|
30
|
-
/**
|
|
31
|
-
* Custom classes to style different slots of the Switch component.
|
|
32
|
-
*/
|
|
33
|
-
classes?: SlotsToClasses<SwitchSlots>;
|
|
34
|
-
/**
|
|
35
|
-
* Whether the Switch is disabled.
|
|
36
|
-
* When true, user interaction is prevented.
|
|
37
|
-
*/
|
|
38
|
-
isDisabled?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Callback triggered when the Switch value changes.
|
|
41
|
-
* Receives the new boolean value and, optionally, the triggering Event.
|
|
42
|
-
*/
|
|
43
|
-
onChange?: ((value: boolean, event: Event) => void) | ((value: boolean) => void);
|
|
44
|
-
/**
|
|
45
|
-
* Callback triggered when the Switch loses focus (blur event).
|
|
46
|
-
*/
|
|
47
|
-
onBlur?: () => void;
|
|
48
|
-
}
|
|
49
|
-
interface SwitchSignature {
|
|
50
|
-
Args: Args;
|
|
51
|
-
Blocks: {
|
|
52
|
-
startContent: [];
|
|
53
|
-
thumbContent: [{
|
|
54
|
-
isSelected: boolean;
|
|
55
|
-
}];
|
|
56
|
-
endContent: [];
|
|
57
|
-
};
|
|
58
|
-
Element: HTMLInputElement;
|
|
59
|
-
}
|
|
60
|
-
declare class Switch extends Component<SwitchSignature> {
|
|
61
|
-
_isSelected: boolean;
|
|
62
|
-
constructor(owner: Owner, args: Args);
|
|
63
|
-
get isControlled(): boolean;
|
|
64
|
-
get isSelected(): boolean;
|
|
65
|
-
handleChange: (event: Event) => void;
|
|
66
|
-
handleBlur: () => void;
|
|
67
|
-
get classes(): {
|
|
68
|
-
base: (slotProps?: ({
|
|
69
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
70
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
71
|
-
isDisabled?: boolean | undefined;
|
|
72
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
73
|
-
labelContainer: (slotProps?: ({
|
|
74
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
75
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
76
|
-
isDisabled?: boolean | undefined;
|
|
77
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
78
|
-
label: (slotProps?: ({
|
|
79
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
80
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
81
|
-
isDisabled?: boolean | undefined;
|
|
82
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
83
|
-
wrapper: (slotProps?: ({
|
|
84
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
85
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
86
|
-
isDisabled?: boolean | undefined;
|
|
87
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
88
|
-
hiddenInput: (slotProps?: ({
|
|
89
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
90
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
91
|
-
isDisabled?: boolean | undefined;
|
|
92
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
93
|
-
thumb: (slotProps?: ({
|
|
94
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
95
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
96
|
-
isDisabled?: boolean | undefined;
|
|
97
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
98
|
-
startContent: (slotProps?: ({
|
|
99
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
100
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
101
|
-
isDisabled?: boolean | undefined;
|
|
102
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
103
|
-
endContent: (slotProps?: ({
|
|
104
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
105
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
106
|
-
isDisabled?: boolean | undefined;
|
|
107
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
108
|
-
} & {
|
|
109
|
-
base: (slotProps?: ({
|
|
110
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
111
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
112
|
-
isDisabled?: boolean | undefined;
|
|
113
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
114
|
-
labelContainer: (slotProps?: ({
|
|
115
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
116
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
117
|
-
isDisabled?: boolean | undefined;
|
|
118
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
119
|
-
label: (slotProps?: ({
|
|
120
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
121
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
122
|
-
isDisabled?: boolean | undefined;
|
|
123
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
124
|
-
wrapper: (slotProps?: ({
|
|
125
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
126
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
127
|
-
isDisabled?: boolean | undefined;
|
|
128
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
129
|
-
hiddenInput: (slotProps?: ({
|
|
130
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
131
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
132
|
-
isDisabled?: boolean | undefined;
|
|
133
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
134
|
-
thumb: (slotProps?: ({
|
|
135
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
136
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
137
|
-
isDisabled?: boolean | undefined;
|
|
138
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
139
|
-
startContent: (slotProps?: ({
|
|
140
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
141
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
142
|
-
isDisabled?: boolean | undefined;
|
|
143
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
144
|
-
endContent: (slotProps?: ({
|
|
145
|
-
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
146
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
147
|
-
isDisabled?: boolean | undefined;
|
|
148
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
149
|
-
} & {};
|
|
150
|
-
}
|
|
151
|
-
export { Switch, type SwitchSignature };
|
|
152
|
-
export default Switch;
|