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.
Files changed (96) hide show
  1. package/declarations/components/buttons/chip.d.ts +35 -4
  2. package/declarations/components/collections/dropdown.d.ts +18 -0
  3. package/declarations/components/collections/listbox/item.d.ts +13 -0
  4. package/declarations/components/collections/listbox/listbox.d.ts +15 -6
  5. package/declarations/components/forms/autocomplete.d.ts +13 -5
  6. package/declarations/components/forms/checkbox-group.d.ts +20 -0
  7. package/declarations/components/forms/checkbox.d.ts +22 -0
  8. package/declarations/components/forms/form-control.d.ts +49 -0
  9. package/declarations/components/forms/form-description.d.ts +12 -0
  10. package/declarations/components/forms/form-feedback.d.ts +21 -0
  11. package/declarations/components/forms/form.d.ts +1 -1
  12. package/declarations/components/forms/input.d.ts +44 -1
  13. package/declarations/components/forms/label.d.ts +13 -0
  14. package/declarations/components/forms/native-select.d.ts +103 -6
  15. package/declarations/components/forms/radio-group.d.ts +21 -0
  16. package/declarations/components/forms/radio.d.ts +27 -0
  17. package/declarations/components/forms/select/end-content.d.ts +31 -0
  18. package/declarations/components/forms/select/native-mirror.d.ts +44 -0
  19. package/declarations/components/forms/select/select.d.ts +425 -0
  20. package/declarations/components/forms/select/selected-items.d.ts +80 -0
  21. package/declarations/components/forms/select/trigger.d.ts +76 -0
  22. package/declarations/components/forms/select/types.d.ts +411 -0
  23. package/declarations/components/forms/select.d.ts +2 -531
  24. package/declarations/components/forms/textarea.d.ts +35 -0
  25. package/declarations/components/overlays/drawer.d.ts +3 -0
  26. package/declarations/components/overlays/modal.d.ts +3 -0
  27. package/declarations/components/overlays/overlay.d.ts +23 -0
  28. package/declarations/components/overlays/popover.d.ts +62 -0
  29. package/declarations/components/overlays/portal-target.d.ts +5 -1
  30. package/declarations/components/status/progress-bar.d.ts +5 -0
  31. package/declarations/components/utilities/divider.d.ts +14 -0
  32. package/declarations/components/utilities/spinner.d.ts +8 -0
  33. package/declarations/utils/listManager.d.ts +30 -5
  34. package/dist/components/buttons/chip.js +1 -1
  35. package/dist/components/buttons/chip.js.map +1 -1
  36. package/dist/components/collections/dropdown.js +13 -1
  37. package/dist/components/collections/dropdown.js.map +1 -1
  38. package/dist/components/collections/listbox/item.js +13 -1
  39. package/dist/components/collections/listbox/item.js.map +1 -1
  40. package/dist/components/collections/listbox/listbox.js +12 -1
  41. package/dist/components/collections/listbox/listbox.js.map +1 -1
  42. package/dist/components/collections/simple-table/column.js +1 -1
  43. package/dist/components/collections/simple-table/column.js.map +1 -1
  44. package/dist/components/forms/autocomplete.js +0 -3
  45. package/dist/components/forms/autocomplete.js.map +1 -1
  46. package/dist/components/forms/checkbox-group.js.map +1 -1
  47. package/dist/components/forms/checkbox.js.map +1 -1
  48. package/dist/components/forms/field.js +1 -1
  49. package/dist/components/forms/form-control.js +1 -1
  50. package/dist/components/forms/form-control.js.map +1 -1
  51. package/dist/components/forms/form-description.js.map +1 -1
  52. package/dist/components/forms/form-feedback.js.map +1 -1
  53. package/dist/components/forms/index.js +1 -1
  54. package/dist/components/forms/input.js +32 -1
  55. package/dist/components/forms/input.js.map +1 -1
  56. package/dist/components/forms/label.js.map +1 -1
  57. package/dist/components/forms/native-select.js +2 -2
  58. package/dist/components/forms/native-select.js.map +1 -1
  59. package/dist/components/forms/radio-group.js.map +1 -1
  60. package/dist/components/forms/radio.js.map +1 -1
  61. package/dist/components/forms/select/end-content.js +24 -0
  62. package/dist/components/forms/select/end-content.js.map +1 -0
  63. package/dist/components/forms/select/native-mirror.js +29 -0
  64. package/dist/components/forms/select/native-mirror.js.map +1 -0
  65. package/dist/components/forms/select/select.js +599 -0
  66. package/dist/components/forms/select/select.js.map +1 -0
  67. package/dist/components/forms/select/selected-items.js +63 -0
  68. package/dist/components/forms/select/selected-items.js.map +1 -0
  69. package/dist/components/forms/select/trigger.js +30 -0
  70. package/dist/components/forms/select/trigger.js.map +1 -0
  71. package/dist/components/forms/select/types.js +2 -0
  72. package/dist/components/forms/select/types.js.map +1 -0
  73. package/dist/components/forms/select.js +1 -387
  74. package/dist/components/forms/select.js.map +1 -1
  75. package/dist/components/forms/textarea.js.map +1 -1
  76. package/dist/components/overlays/drawer.js.map +1 -1
  77. package/dist/components/overlays/modal.js.map +1 -1
  78. package/dist/components/overlays/overlay.js.map +1 -1
  79. package/dist/components/overlays/popover.js +53 -2
  80. package/dist/components/overlays/popover.js.map +1 -1
  81. package/dist/components/overlays/portal-target.js.map +1 -1
  82. package/dist/components/status/progress-bar.js +8 -1
  83. package/dist/components/status/progress-bar.js.map +1 -1
  84. package/dist/components/utilities/avatar.js +1 -1
  85. package/dist/components/utilities/avatar.js.map +1 -1
  86. package/dist/components/utilities/divider.js +8 -2
  87. package/dist/components/utilities/divider.js.map +1 -1
  88. package/dist/components/utilities/spinner.js +1 -1
  89. package/dist/components/utilities/spinner.js.map +1 -1
  90. package/dist/forms.js +1 -1
  91. package/dist/index.js +1 -1
  92. package/dist/utils/listManager.js +63 -4
  93. package/dist/utils/listManager.js.map +1 -1
  94. package/dist/utils/nested-data.js +10 -1
  95. package/dist/utils/nested-data.js.map +1 -1
  96. package/package.json +4 -4
@@ -5,18 +5,55 @@ import { type FormControlSharedArgs } from './form-control';
5
5
  import { ListManager, type ListItem } from '../../utils/listManager';
6
6
  import type { WithBoundArgs } from '@glint/template';
7
7
  type ItemCompBounded = WithBoundArgs<typeof NativeSelectItem, 'manager'>;
8
+ type ItemCompBoundedWithItem = WithBoundArgs<typeof NativeSelectItem, 'manager' | 'item'>;
8
9
  interface BaseArgs<T> extends FormControlSharedArgs {
10
+ /**
11
+ * Keys of the options that cannot be selected. Disabled options are still
12
+ * rendered and announced, they just cannot be picked.
13
+ */
9
14
  disabledKeys?: string[];
15
+ /**
16
+ * Renders an extra empty option, letting the user clear the selection.
17
+ * Label it with the placeholder argument.
18
+ *
19
+ * @defaultValue false
20
+ */
10
21
  allowEmpty?: boolean;
22
+ /**
23
+ * Collection used to render the options. Strings and numbers become both the
24
+ * key and the label; objects use key or id for the key and label, value,
25
+ * name or title for the label. Use the :item block when your data does not
26
+ * follow those conventions.
27
+ */
11
28
  items?: T[];
29
+ /**
30
+ * Id applied to the select element and referenced by its label. One is
31
+ * generated when omitted.
32
+ */
12
33
  id?: string;
34
+ /**
35
+ * Name of the select element, used when the surrounding form is submitted.
36
+ */
13
37
  name?: string;
38
+ /**
39
+ * The size of the control.
40
+ *
41
+ * @defaultValue 'md'
42
+ */
14
43
  size?: NativeSelectVariants['size'];
44
+ /**
45
+ * Per-slot class overrides: base, innerContainer, input, startContent,
46
+ * endContent and icon.
47
+ */
15
48
  classes?: SlotsToClasses<NativeSelectSlots>;
16
49
  /**
17
50
  * Placeholder text used when `allowEmpty` is set to `true`.
18
51
  */
19
52
  placeholder?: string;
53
+ /**
54
+ * Called with the key of an option whenever it is acted upon, including when
55
+ * the same option is picked again. Use onSelectionChange to track state.
56
+ */
20
57
  onAction?: (key: string) => void;
21
58
  /**
22
59
  * @internal
@@ -40,15 +77,48 @@ interface BaseArgs<T> extends FormControlSharedArgs {
40
77
  endContentPointerEvents?: 'none' | 'auto';
41
78
  }
42
79
  interface SingleNativeSelectArgs<T> extends BaseArgs<T> {
80
+ /**
81
+ * Whether one option or several can be selected. Multiple renders the native
82
+ * multi-select list box and switches to selectedKeys.
83
+ *
84
+ * @defaultValue 'single'
85
+ */
43
86
  selectionMode?: 'single' | undefined;
87
+ /**
88
+ * The selected key in single selection mode. The component is controlled:
89
+ * update this from onSelectionChange.
90
+ */
44
91
  selectedKey?: string | null;
92
+ /**
93
+ * Not available in single selection mode; use selectedKey.
94
+ */
45
95
  selectedKeys?: never;
96
+ /**
97
+ * Called with the newly selected key, or null when the selection is cleared
98
+ * through the allowEmpty option.
99
+ */
46
100
  onSelectionChange?: (key: string | null) => void;
47
101
  }
48
102
  interface MultipleNativeSelectArgs<T> extends BaseArgs<T> {
103
+ /**
104
+ * Whether one option or several can be selected. Multiple renders the native
105
+ * multi-select list box and switches to selectedKeys.
106
+ *
107
+ * @defaultValue 'single'
108
+ */
49
109
  selectionMode: 'multiple';
110
+ /**
111
+ * Not available in multiple selection mode; use selectedKeys.
112
+ */
50
113
  selectedKey?: never;
114
+ /**
115
+ * The selected keys in multiple selection mode. The component is controlled:
116
+ * update this from onSelectionChange.
117
+ */
51
118
  selectedKeys?: string[];
119
+ /**
120
+ * Called with every selected key each time the selection changes.
121
+ */
52
122
  onSelectionChange?: (keys: string[]) => void;
53
123
  }
54
124
  type Args<T> = SingleNativeSelectArgs<T> | MultipleNativeSelectArgs<T>;
@@ -56,12 +126,14 @@ interface NativeSelectSignature<T> {
56
126
  Args: Args<T>;
57
127
  Element: HTMLSelectElement;
58
128
  Blocks: {
59
- item: [{
60
- item: T;
61
- key: string;
62
- label: string;
63
- Item: ItemCompBounded;
64
- }];
129
+ item: [
130
+ {
131
+ item: T;
132
+ key: string;
133
+ label: string;
134
+ Item: ItemCompBoundedWithItem;
135
+ }
136
+ ];
65
137
  default: [{
66
138
  Item: ItemCompBounded;
67
139
  }];
@@ -82,6 +154,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
82
154
  endContentPointerEvents?: "none" | "auto" | undefined;
83
155
  hasStartContent?: boolean | undefined;
84
156
  hasEndContent?: boolean | undefined;
157
+ hasChips?: boolean | undefined;
85
158
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
86
159
  innerContainer: (slotProps?: ({
87
160
  size?: "sm" | "md" | "lg" | undefined;
@@ -89,6 +162,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
89
162
  endContentPointerEvents?: "none" | "auto" | undefined;
90
163
  hasStartContent?: boolean | undefined;
91
164
  hasEndContent?: boolean | undefined;
165
+ hasChips?: boolean | undefined;
92
166
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
93
167
  startContent: (slotProps?: ({
94
168
  size?: "sm" | "md" | "lg" | undefined;
@@ -96,6 +170,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
96
170
  endContentPointerEvents?: "none" | "auto" | undefined;
97
171
  hasStartContent?: boolean | undefined;
98
172
  hasEndContent?: boolean | undefined;
173
+ hasChips?: boolean | undefined;
99
174
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
100
175
  endContent: (slotProps?: ({
101
176
  size?: "sm" | "md" | "lg" | undefined;
@@ -103,6 +178,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
103
178
  endContentPointerEvents?: "none" | "auto" | undefined;
104
179
  hasStartContent?: boolean | undefined;
105
180
  hasEndContent?: boolean | undefined;
181
+ hasChips?: boolean | undefined;
106
182
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
107
183
  input: (slotProps?: ({
108
184
  size?: "sm" | "md" | "lg" | undefined;
@@ -110,6 +186,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
110
186
  endContentPointerEvents?: "none" | "auto" | undefined;
111
187
  hasStartContent?: boolean | undefined;
112
188
  hasEndContent?: boolean | undefined;
189
+ hasChips?: boolean | undefined;
113
190
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
114
191
  } & {
115
192
  input: (slotProps?: ({
@@ -118,6 +195,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
118
195
  endContentPointerEvents?: "none" | "auto" | undefined;
119
196
  hasStartContent?: boolean | undefined;
120
197
  hasEndContent?: boolean | undefined;
198
+ hasChips?: boolean | undefined;
121
199
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
122
200
  icon: (slotProps?: ({
123
201
  size?: "sm" | "md" | "lg" | undefined;
@@ -125,6 +203,7 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
125
203
  endContentPointerEvents?: "none" | "auto" | undefined;
126
204
  hasStartContent?: boolean | undefined;
127
205
  hasEndContent?: boolean | undefined;
206
+ hasChips?: boolean | undefined;
128
207
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
129
208
  } & {};
130
209
  get isMultiple(): boolean;
@@ -132,9 +211,27 @@ declare class NativeSelect<T = unknown> extends Component<NativeSelectSignature<
132
211
  }
133
212
  export interface SelectItemSignature {
134
213
  Args: {
214
+ /**
215
+ * The ListManager that tracks selection for the parent select. It is bound
216
+ * for you on the yielded Item component.
217
+ */
135
218
  manager: ListManager;
219
+ /**
220
+ * Value of the rendered option, and the key reported by onSelectionChange,
221
+ * selectedKey or selectedKeys, and disabledKeys.
222
+ */
136
223
  key: string;
224
+ /**
225
+ * Text representation of the option, used for matching. Defaults to the
226
+ * option's rendered text content.
227
+ */
137
228
  textValue?: string;
229
+ /**
230
+ * The entry of `@items` this option renders, remembered on the registered
231
+ * list item so a selection can hand it back. Bound for you on the Item
232
+ * yielded from the `:item` block; block-form options have no such entry.
233
+ */
234
+ item?: unknown;
138
235
  };
139
236
  Element: HTMLOptionElement;
140
237
  Blocks: {
@@ -4,11 +4,32 @@ import { type FormControlSharedArgs } from './form-control';
4
4
  import { type RadioGroupSlots, type RadioVariants, type SlotsToClasses } from '@frontile/theme';
5
5
  import type { WithBoundArgs } from '@glint/template';
6
6
  interface Args<T> extends FormControlSharedArgs {
7
+ /**
8
+ * The name attribute applied to every radio in the group, which is what makes
9
+ * the browser treat them as mutually exclusive.
10
+ */
7
11
  name?: string;
12
+ /**
13
+ * The currently selected value. Pair with `onChange` to control the group.
14
+ */
8
15
  value?: T;
16
+ /**
17
+ * Callback when the selected radio changes, receiving the new value.
18
+ */
9
19
  onChange?: RadioSignature<T>['Args']['onChange'];
20
+ /**
21
+ * The size applied to every radio in the group and to the group's label.
22
+ */
10
23
  size?: RadioVariants['size'];
24
+ /**
25
+ * Class names for each slot of the component, merged with the theme's.
26
+ */
11
27
  classes?: SlotsToClasses<RadioGroupSlots>;
28
+ /**
29
+ * How the radios are laid out.
30
+ *
31
+ * @defaultValue 'vertical'
32
+ */
12
33
  orientation?: 'horizontal' | 'vertical';
13
34
  }
14
35
  interface RadioGroupSignature<T> {
@@ -2,12 +2,39 @@ import Component from '@glimmer/component';
2
2
  import { type FormControlSharedArgs } from './form-control';
3
3
  import { type SlotsToClasses, type RadioVariants, type RadioSlots } from '@frontile/theme';
4
4
  interface Args<T> extends FormControlSharedArgs {
5
+ /**
6
+ * The value this radio represents. It is passed to `onChange` when the radio
7
+ * is selected, and compared against `checkedValue` to decide whether it is.
8
+ */
5
9
  value: T;
10
+ /**
11
+ * The currently selected value of the group. This radio renders as checked
12
+ * when it equals `value`. Usually supplied by RadioGroup rather than set
13
+ * directly.
14
+ */
6
15
  checkedValue?: T | undefined | null;
16
+ /**
17
+ * The name attribute shared by the radios in a group, which is what makes the
18
+ * browser treat them as mutually exclusive.
19
+ */
7
20
  name?: string;
21
+ /**
22
+ * The size of the radio and its label.
23
+ *
24
+ * @defaultValue 'md'
25
+ */
8
26
  size?: RadioVariants['size'];
27
+ /**
28
+ * Class names for each slot of the component, merged with the theme's.
29
+ */
9
30
  classes?: SlotsToClasses<RadioSlots>;
31
+ /**
32
+ * Callback when onchange is triggered
33
+ */
10
34
  onChange?: (value: T, event: Event) => void;
35
+ /**
36
+ * Callback when onblur is triggered
37
+ */
11
38
  onBlur?: () => void;
12
39
  }
13
40
  interface RadioSignature<T> {
@@ -0,0 +1,31 @@
1
+ import type { TOC } from '@ember/component/template-only';
2
+ import type { SelectSlots, SelectVariants, SlotsToClasses } from '@frontile/theme';
3
+ import type { SelectClasses } from './types';
4
+ interface SelectEndContentSignature {
5
+ Args: {
6
+ classes: SelectClasses;
7
+ userClasses?: SlotsToClasses<SelectSlots>;
8
+ /**
9
+ * Defaults to `none` so clicks fall through to the trigger; content that
10
+ * needs its own events opts back in per element.
11
+ */
12
+ endContentPointerEvents?: 'none' | 'auto';
13
+ inputSize?: SelectVariants['size'];
14
+ isLoading?: boolean;
15
+ /** Whether the clear button takes the chevron's place. */
16
+ isClearable?: boolean;
17
+ onClear: () => void;
18
+ };
19
+ Blocks: {
20
+ /** Consumer content, rendered before the spinner/clear/chevron cluster. */
21
+ default: [];
22
+ };
23
+ Element: HTMLDivElement;
24
+ }
25
+ /**
26
+ * The cluster at the end of the field: any consumer content, then exactly one
27
+ * of the loading spinner, the clear button, or the chevron.
28
+ */
29
+ declare const SelectEndContent: TOC<SelectEndContentSignature>;
30
+ export { SelectEndContent, type SelectEndContentSignature };
31
+ export default SelectEndContent;
@@ -0,0 +1,44 @@
1
+ import Component from '@glimmer/component';
2
+ import { type ListItem, type NativeSelectSignature } from '../native-select';
3
+ interface SelectNativeMirrorSignature<T> {
4
+ Args: {
5
+ /**
6
+ * The **unfiltered** collection. The mirror carries the form value, which
7
+ * must not shrink to whatever the listbox filter currently shows, so it is
8
+ * deliberately never handed `filteredItems`.
9
+ */
10
+ items?: T[];
11
+ allowEmpty?: boolean;
12
+ disabledKeys?: string[];
13
+ selectionMode?: 'single' | 'multiple';
14
+ /** Read in multiple selection mode. */
15
+ selectedKeys: string[];
16
+ /** Read in single selection mode. */
17
+ selectedKey: string | null;
18
+ /** Selection handler for multiple selection mode. */
19
+ onSelectionChange: (keys: string[]) => void;
20
+ /** Selection handler for single selection mode. */
21
+ onSingleSelectionChange: (key: string | null) => void;
22
+ onItemsChange: (nodes: ListItem[], action: 'add' | 'remove') => void;
23
+ placeholder?: string;
24
+ id?: string;
25
+ name?: string;
26
+ isDisabled?: boolean;
27
+ };
28
+ Blocks: {
29
+ default: NativeSelectSignature<T>['Blocks']['default'];
30
+ };
31
+ }
32
+ /**
33
+ * The visually hidden native `<select>` that makes a Select submit with a form.
34
+ *
35
+ * Single and multiple selection mode differ only in three arguments, so those
36
+ * three are curried onto the component and everything else -- the element, its
37
+ * attributes and both blocks -- is written **once**. Two copies of this used to
38
+ * sit side by side in `select.gts`, and a fix to the submitted value landed in
39
+ * one of them and not the other.
40
+ */
41
+ declare class SelectNativeMirror<T = unknown> extends Component<SelectNativeMirrorSignature<T>> {
42
+ }
43
+ export { SelectNativeMirror, type SelectNativeMirrorSignature };
44
+ export default SelectNativeMirror;