@fluentui/web-components 3.0.0-beta.77 → 3.0.0-beta.78

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 (151) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/dist/dts/dropdown/define.d.ts +1 -0
  3. package/dist/dts/dropdown/dropdown.d.ts +492 -0
  4. package/dist/dts/dropdown/dropdown.definition.d.ts +9 -0
  5. package/dist/dts/dropdown/dropdown.options.d.ts +53 -0
  6. package/dist/dts/dropdown/dropdown.styles.d.ts +6 -0
  7. package/dist/dts/dropdown/dropdown.template.d.ts +38 -0
  8. package/dist/dts/dropdown/index.d.ts +5 -0
  9. package/dist/dts/index-rollup.d.ts +3 -0
  10. package/dist/dts/index.d.ts +3 -0
  11. package/dist/dts/listbox/define.d.ts +1 -0
  12. package/dist/dts/listbox/index.d.ts +5 -0
  13. package/dist/dts/listbox/listbox.d.ts +116 -0
  14. package/dist/dts/listbox/listbox.definition.d.ts +9 -0
  15. package/dist/dts/listbox/listbox.options.d.ts +10 -0
  16. package/dist/dts/listbox/listbox.styles.d.ts +6 -0
  17. package/dist/dts/listbox/listbox.template.d.ts +17 -0
  18. package/dist/dts/option/define.d.ts +1 -0
  19. package/dist/dts/option/index.d.ts +5 -0
  20. package/dist/dts/option/option.d.ts +260 -0
  21. package/dist/dts/option/option.definition.d.ts +9 -0
  22. package/dist/dts/option/option.options.d.ts +20 -0
  23. package/dist/dts/option/option.styles.d.ts +6 -0
  24. package/dist/dts/option/option.template.d.ts +16 -0
  25. package/dist/dts/patterns/start-end.d.ts +16 -2
  26. package/dist/dts/styles/states/index.d.ts +34 -0
  27. package/dist/dts/utils/element-internals.d.ts +3 -6
  28. package/dist/dts/utils/index.d.ts +1 -0
  29. package/dist/dts/utils/language.d.ts +9 -0
  30. package/dist/dts/utils/support.d.ts +15 -0
  31. package/dist/dts/utils/unique-id.d.ts +9 -0
  32. package/dist/esm/accordion/accordion.js +2 -3
  33. package/dist/esm/accordion/accordion.js.map +1 -1
  34. package/dist/esm/anchor-button/anchor-button.js +2 -4
  35. package/dist/esm/anchor-button/anchor-button.js.map +1 -1
  36. package/dist/esm/avatar/avatar.js +11 -12
  37. package/dist/esm/avatar/avatar.js.map +1 -1
  38. package/dist/esm/button/button.js +19 -23
  39. package/dist/esm/button/button.js.map +1 -1
  40. package/dist/esm/button/button.template.js +1 -1
  41. package/dist/esm/button/button.template.js.map +1 -1
  42. package/dist/esm/checkbox/checkbox.js +10 -11
  43. package/dist/esm/checkbox/checkbox.js.map +1 -1
  44. package/dist/esm/compound-button/compound-button.template.js +1 -1
  45. package/dist/esm/compound-button/compound-button.template.js.map +1 -1
  46. package/dist/esm/counter-badge/counter-badge.js +1 -2
  47. package/dist/esm/counter-badge/counter-badge.js.map +1 -1
  48. package/dist/esm/dialog-body/dialog-body.template.js +2 -2
  49. package/dist/esm/dialog-body/dialog-body.template.js.map +1 -1
  50. package/dist/esm/divider/divider.js +4 -5
  51. package/dist/esm/divider/divider.js.map +1 -1
  52. package/dist/esm/dropdown/define.js +4 -0
  53. package/dist/esm/dropdown/define.js.map +1 -0
  54. package/dist/esm/dropdown/dropdown.definition.js +20 -0
  55. package/dist/esm/dropdown/dropdown.definition.js.map +1 -0
  56. package/dist/esm/dropdown/dropdown.js +779 -0
  57. package/dist/esm/dropdown/dropdown.js.map +1 -0
  58. package/dist/esm/dropdown/dropdown.options.js +43 -0
  59. package/dist/esm/dropdown/dropdown.options.js.map +1 -0
  60. package/dist/esm/dropdown/dropdown.styles.js +213 -0
  61. package/dist/esm/dropdown/dropdown.styles.js.map +1 -0
  62. package/dist/esm/dropdown/dropdown.template.js +92 -0
  63. package/dist/esm/dropdown/dropdown.template.js.map +1 -0
  64. package/dist/esm/dropdown/index.js +6 -0
  65. package/dist/esm/dropdown/index.js.map +1 -0
  66. package/dist/esm/field/field.js +3 -4
  67. package/dist/esm/field/field.js.map +1 -1
  68. package/dist/esm/form-associated/form-associated.js +3 -5
  69. package/dist/esm/form-associated/form-associated.js.map +1 -1
  70. package/dist/esm/index-rollup.js +3 -0
  71. package/dist/esm/index-rollup.js.map +1 -1
  72. package/dist/esm/index.js +3 -0
  73. package/dist/esm/index.js.map +1 -1
  74. package/dist/esm/listbox/define.js +4 -0
  75. package/dist/esm/listbox/define.js.map +1 -0
  76. package/dist/esm/listbox/index.js +6 -0
  77. package/dist/esm/listbox/index.js.map +1 -0
  78. package/dist/esm/listbox/listbox.definition.js +17 -0
  79. package/dist/esm/listbox/listbox.definition.js.map +1 -0
  80. package/dist/esm/listbox/listbox.js +175 -0
  81. package/dist/esm/listbox/listbox.js.map +1 -0
  82. package/dist/esm/listbox/listbox.options.js +15 -0
  83. package/dist/esm/listbox/listbox.options.js.map +1 -0
  84. package/dist/esm/listbox/listbox.styles.js +26 -0
  85. package/dist/esm/listbox/listbox.styles.js.map +1 -0
  86. package/dist/esm/listbox/listbox.template.js +33 -0
  87. package/dist/esm/listbox/listbox.template.js.map +1 -0
  88. package/dist/esm/menu/menu.js +23 -32
  89. package/dist/esm/menu/menu.js.map +1 -1
  90. package/dist/esm/menu-item/menu-item.js +9 -14
  91. package/dist/esm/menu-item/menu-item.js.map +1 -1
  92. package/dist/esm/menu-list/menu-list.js +4 -5
  93. package/dist/esm/menu-list/menu-list.js.map +1 -1
  94. package/dist/esm/option/define.js +4 -0
  95. package/dist/esm/option/define.js.map +1 -0
  96. package/dist/esm/option/index.js +6 -0
  97. package/dist/esm/option/index.js.map +1 -0
  98. package/dist/esm/option/option.definition.js +17 -0
  99. package/dist/esm/option/option.definition.js.map +1 -0
  100. package/dist/esm/option/option.js +296 -0
  101. package/dist/esm/option/option.js.map +1 -0
  102. package/dist/esm/option/option.options.js +15 -0
  103. package/dist/esm/option/option.options.js.map +1 -0
  104. package/dist/esm/option/option.styles.js +127 -0
  105. package/dist/esm/option/option.styles.js.map +1 -0
  106. package/dist/esm/option/option.template.js +42 -0
  107. package/dist/esm/option/option.template.js.map +1 -0
  108. package/dist/esm/patterns/start-end.js +12 -0
  109. package/dist/esm/patterns/start-end.js.map +1 -1
  110. package/dist/esm/progress-bar/progress-bar.js +3 -4
  111. package/dist/esm/progress-bar/progress-bar.js.map +1 -1
  112. package/dist/esm/radio-group/radio-group.js +27 -38
  113. package/dist/esm/radio-group/radio-group.js.map +1 -1
  114. package/dist/esm/rating-display/rating-display.js +7 -13
  115. package/dist/esm/rating-display/rating-display.js.map +1 -1
  116. package/dist/esm/slider/slider.js +13 -16
  117. package/dist/esm/slider/slider.js.map +1 -1
  118. package/dist/esm/styles/states/index.js +34 -0
  119. package/dist/esm/styles/states/index.js.map +1 -1
  120. package/dist/esm/tablist/tablist.js +5 -7
  121. package/dist/esm/tablist/tablist.js.map +1 -1
  122. package/dist/esm/tabs/tabs.js +5 -8
  123. package/dist/esm/tabs/tabs.js.map +1 -1
  124. package/dist/esm/text-input/text-input.js +13 -15
  125. package/dist/esm/text-input/text-input.js.map +1 -1
  126. package/dist/esm/textarea/textarea.js +20 -29
  127. package/dist/esm/textarea/textarea.js.map +1 -1
  128. package/dist/esm/theme/set-theme.js +1 -2
  129. package/dist/esm/theme/set-theme.js.map +1 -1
  130. package/dist/esm/tooltip/tooltip.js +13 -18
  131. package/dist/esm/tooltip/tooltip.js.map +1 -1
  132. package/dist/esm/utils/direction.js +1 -2
  133. package/dist/esm/utils/direction.js.map +1 -1
  134. package/dist/esm/utils/element-internals.js +8 -11
  135. package/dist/esm/utils/element-internals.js.map +1 -1
  136. package/dist/esm/utils/get-initials.js +2 -2
  137. package/dist/esm/utils/get-initials.js.map +1 -1
  138. package/dist/esm/utils/index.js +1 -0
  139. package/dist/esm/utils/index.js.map +1 -1
  140. package/dist/esm/utils/language.js +12 -0
  141. package/dist/esm/utils/language.js.map +1 -0
  142. package/dist/esm/utils/support.js +16 -0
  143. package/dist/esm/utils/support.js.map +1 -0
  144. package/dist/esm/utils/unique-id.js +14 -0
  145. package/dist/esm/utils/unique-id.js.map +1 -0
  146. package/dist/esm/utils/whitespace-filter.js +1 -1
  147. package/dist/esm/utils/whitespace-filter.js.map +1 -1
  148. package/dist/web-components.d.ts +1928 -862
  149. package/dist/web-components.js +1665 -445
  150. package/dist/web-components.min.js +344 -322
  151. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Fri, 17 Jan 2025 04:07:28 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 04 Feb 2025 04:07:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [3.0.0-beta.78](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.78)
8
+
9
+ Tue, 04 Feb 2025 04:07:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.77..@fluentui/web-components_v3.0.0-beta.78)
11
+
12
+ ### Changes
13
+
14
+ - add Dropdown, Listbox, and Option components ([PR #32116](https://github.com/microsoft/fluentui/pull/32116) by 863023+radium-v@users.noreply.github.com)
15
+ - fix: dropdown opens then closes on space key ([PR #33767](https://github.com/microsoft/fluentui/pull/33767) by 863023+radium-v@users.noreply.github.com)
16
+
7
17
  ## [3.0.0-beta.77](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.77)
8
18
 
9
- Fri, 17 Jan 2025 04:07:28 GMT
19
+ Fri, 17 Jan 2025 04:07:40 GMT
10
20
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.76..@fluentui/web-components_v3.0.0-beta.77)
11
21
 
12
22
  ### Changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,492 @@
1
+ import { FASTElement } from '@microsoft/fast-element';
2
+ import type { Listbox } from '../listbox/listbox.js';
3
+ import type { DropdownOption } from '../option/option.js';
4
+ import { DropdownAppearance, DropdownSize, DropdownType } from './dropdown.options.js';
5
+ /**
6
+ * A Dropdown Custom HTML Element.
7
+ * Implements the {@link https://w3c.github.io/aria/#combobox | ARIA combobox } role.
8
+ *
9
+ * @remarks
10
+ * The Dropdown element does not provide a form association value. Instead, the slotted Option elements handle form
11
+ * association the same way as {@link (Checkbox:class)} elements. See the {@link (DropdownOption:class)} element for
12
+ * more details.
13
+ *
14
+ * @slot - The default slot. Accepts a {@link (Listbox:class)} element.
15
+ * @slot indicator - The indicator slot.
16
+ * @slot control - The control slot. This slot is automatically populated and should not be manually manipulated.
17
+ *
18
+ * @public
19
+ */
20
+ export declare class BaseDropdown extends FASTElement {
21
+ /**
22
+ * The ID of the current active descendant.
23
+ *
24
+ * @public
25
+ */
26
+ get activeDescendant(): string | undefined;
27
+ /**
28
+ * The index of the currently active option.
29
+ *
30
+ * @internal
31
+ */
32
+ activeIndex: number;
33
+ /**
34
+ * Sets the active index when the active index property changes.
35
+ *
36
+ * @param prev - the previous active index
37
+ * @param next - the current active index
38
+ * @internal
39
+ */
40
+ activeIndexChanged(prev: number | undefined, next: number | undefined): void;
41
+ /**
42
+ * The `aria-labelledby` attribute value of the dropdown.
43
+ *
44
+ * @public
45
+ */
46
+ ariaLabelledBy: string;
47
+ /**
48
+ * Reference to the control element.
49
+ * @internal
50
+ */
51
+ control: HTMLInputElement;
52
+ /**
53
+ * Updates properties on the control element when the control slot changes.
54
+ *
55
+ * @param prev - the previous control element
56
+ * @param next - the current control element
57
+ * @internal
58
+ * @remarks
59
+ * The control element is assigned to the dropdown via the control slot with manual slot assignment.
60
+ */
61
+ controlChanged(prev: HTMLInputElement | undefined, next: HTMLInputElement | undefined): void;
62
+ /**
63
+ * The disabled state of the dropdown.
64
+ * @public
65
+ */
66
+ disabled?: boolean;
67
+ /**
68
+ * Updates the disabled state of the options when the disabled property changes.
69
+ *
70
+ * @param prev - the previous disabled state
71
+ * @param next - the current disabled state
72
+ */
73
+ disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
74
+ /**
75
+ * The display value for the control.
76
+ *
77
+ * @public
78
+ */
79
+ get displayValue(): string;
80
+ /**
81
+ * Sets the listbox ID to a unique value if one is not provided.
82
+ *
83
+ * @override
84
+ * @public
85
+ * @remarks
86
+ * HTML Attribute: `id`
87
+ */
88
+ id: string;
89
+ /**
90
+ * Reference to the indicator button element.
91
+ *
92
+ * @internal
93
+ */
94
+ indicator: HTMLDivElement;
95
+ /**
96
+ * Reference to the indicator slot element.
97
+ *
98
+ * @internal
99
+ */
100
+ indicatorSlot?: HTMLSlotElement;
101
+ /**
102
+ * The value of the selected option.
103
+ *
104
+ * @public
105
+ * @remarks
106
+ * HTML Attribute: `value`
107
+ */
108
+ initialValue?: string;
109
+ /**
110
+ * Reference to the slotted listbox element.
111
+ *
112
+ * @internal
113
+ */
114
+ listbox: Listbox;
115
+ /**
116
+ * Updates properties on the listbox element when the listbox reference changes.
117
+ *
118
+ * @param prev - the previous listbox element
119
+ * @param next - the current listbox element
120
+ * @internal
121
+ *
122
+ * @remarks
123
+ * The listbox element is assigned to the dropdown via the default slot with manual slot assignment.
124
+ */
125
+ listboxChanged(prev: Listbox | undefined, next: Listbox | undefined): void;
126
+ /**
127
+ * Reference to the listbox slot element.
128
+ *
129
+ * @internal
130
+ */
131
+ listboxSlot: HTMLSlotElement;
132
+ /**
133
+ * Indicates whether the dropdown allows multiple options to be selected.
134
+ *
135
+ * @public
136
+ * @remarks
137
+ * HTML Attribute: `multiple`
138
+ */
139
+ multiple?: boolean;
140
+ /**
141
+ * Toggles between single and multiple selection modes when the `multiple` property changes.
142
+ *
143
+ * @param prev - the previous multiple state
144
+ * @param next - the next multiple state
145
+ * @internal
146
+ */
147
+ protected multipleChanged(prev: boolean | undefined, next: boolean | undefined): void;
148
+ /**
149
+ * The name of the dropdown.
150
+ *
151
+ * @public
152
+ * @remarks
153
+ * HTML Attribute: `name`
154
+ */
155
+ name: string;
156
+ /**
157
+ * Updates the name of the options when the name property changes.
158
+ *
159
+ * @param prev - the previous name
160
+ * @param next - the current name
161
+ */
162
+ nameChanged(prev: string, next: string): void;
163
+ /**
164
+ * Indicates whether the dropdown is open.
165
+ *
166
+ * @public
167
+ * @remarks
168
+ * HTML Attribute: `open`
169
+ */
170
+ open: boolean;
171
+ /**
172
+ * Handles the open state of the dropdown.
173
+ *
174
+ * @param prev - the previous open state
175
+ * @param next - the current open state
176
+ *
177
+ * @internal
178
+ */
179
+ openChanged(prev: boolean | undefined, next: boolean | undefined): void;
180
+ /**
181
+ * The placeholder text of the dropdown.
182
+ *
183
+ * @public
184
+ */
185
+ placeholder: string;
186
+ /**
187
+ * The required state of the dropdown.
188
+ *
189
+ * @public
190
+ * @remarks
191
+ * HTML Attribute: `required`
192
+ */
193
+ required: boolean;
194
+ /**
195
+ * The dropdown type.
196
+ *
197
+ * @public
198
+ * @remarks
199
+ * HTML Attribute: `type`
200
+ */
201
+ type: DropdownType;
202
+ /**
203
+ * Changes the slotted control element based on the dropdown type.
204
+ *
205
+ * @param prev - the previous dropdown type
206
+ * @param next - the current dropdown type
207
+ * @internal
208
+ */
209
+ typeChanged(prev: DropdownType | undefined, next: DropdownType | undefined): void;
210
+ /**
211
+ * The initial value of the control. When the control is a combobox, this value is used to set the value of the
212
+ * control when the dropdown is initialized.
213
+ *
214
+ * @public
215
+ * @remarks
216
+ * HTML Attribute: `value`
217
+ */
218
+ valueAttribute: string;
219
+ /**
220
+ * The slot element for the control.
221
+ * @internal
222
+ */
223
+ controlSlot: HTMLSlotElement;
224
+ /**
225
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
226
+ *
227
+ * @internal
228
+ */
229
+ elementInternals: ElementInternals;
230
+ /**
231
+ * The collection of enabled options.
232
+ * @public
233
+ */
234
+ get enabledOptions(): DropdownOption[];
235
+ /**
236
+ * The form-associated flag.
237
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
238
+ *
239
+ * @public
240
+ */
241
+ static formAssociated: boolean;
242
+ /**
243
+ * Resets the form value to its initial value when the form is reset.
244
+ *
245
+ * @internal
246
+ */
247
+ formResetCallback(): void;
248
+ /**
249
+ * A reference to the first freeform option, if present.
250
+ *
251
+ * @internal
252
+ */
253
+ private get freeformOption();
254
+ /**
255
+ * Indicates whether the dropdown is a combobox.
256
+ *
257
+ * @internal
258
+ */
259
+ private get isCombobox();
260
+ /**
261
+ * The list formatter for the dropdown. Used to format the display value when the dropdown is in multiple selection mode.
262
+ *
263
+ * @internal
264
+ */
265
+ private listFormatter?;
266
+ /**
267
+ * The list collator for the dropdown. Used to filter options based on the input value.
268
+ *
269
+ * @internal
270
+ */
271
+ private listCollator?;
272
+ /**
273
+ * The collection of all child options.
274
+ *
275
+ * @public
276
+ */
277
+ get options(): DropdownOption[];
278
+ /**
279
+ * The index of the first selected option, scoped to the enabled options.
280
+ *
281
+ * @internal
282
+ * @remarks
283
+ * This property is a reflection of {@link Listbox.selectedIndex}.
284
+ */
285
+ get selectedIndex(): number;
286
+ /**
287
+ * The collection of selected options.
288
+ *
289
+ * @public
290
+ * @remarks
291
+ * This property is a reflection of {@link Listbox.selectedOptions}.
292
+ */
293
+ get selectedOptions(): DropdownOption[];
294
+ /**
295
+ * The fallback validation message, taken from a native `<input>` element.
296
+ *
297
+ * @internal
298
+ */
299
+ private validationFallbackMessage;
300
+ /**
301
+ * The validation message. Uses the browser's default validation message for native checkboxes if not otherwise
302
+ * specified (e.g., via `setCustomValidity`).
303
+ *
304
+ * @internal
305
+ */
306
+ get validationMessage(): string;
307
+ /**
308
+ * The current value of the selected option.
309
+ *
310
+ * @public
311
+ */
312
+ get value(): string | null;
313
+ set value(next: string | null);
314
+ /**
315
+ * Handles the change events for the dropdown.
316
+ *
317
+ * @param e - the event object
318
+ *
319
+ * @public
320
+ */
321
+ changeHandler(e: Event): boolean | void;
322
+ /**
323
+ * Handles the click events for the dropdown.
324
+ *
325
+ * @param e - the event object
326
+ *
327
+ * @public
328
+ */
329
+ clickHandler(e: PointerEvent): boolean | void;
330
+ constructor();
331
+ /**
332
+ * Filters the options based on the input value.
333
+ *
334
+ * @param value - the input value to filter the options by
335
+ * @param collection - the collection of options to filter
336
+ * @returns the filtered options
337
+ * @internal
338
+ */
339
+ filterOptions(value: string, collection?: DropdownOption[]): DropdownOption[];
340
+ /**
341
+ * Focuses the control when the dropdown receives focus.
342
+ *
343
+ * @internal
344
+ */
345
+ focus(options?: FocusOptions): void;
346
+ /**
347
+ * Toggles the listbox when the control element loses focus.
348
+ *
349
+ * @param e - the focus event
350
+ * @internal
351
+ */
352
+ focusoutHandler(e: FocusEvent): boolean | void;
353
+ /**
354
+ * Ensures the active index is within bounds of the enabled options. Out-of-bounds indices are wrapped to the opposite
355
+ * end of the range.
356
+ *
357
+ * @param index - the desired index
358
+ * @param upperBound - the upper bound of the range
359
+ * @returns the index in bounds
360
+ * @internal
361
+ */
362
+ private getEnabledIndexInBounds;
363
+ /**
364
+ * Handles the input events for the dropdown from the control element.
365
+ *
366
+ * @param e - the input event
367
+ * @public
368
+ */
369
+ inputHandler(e: InputEvent): boolean | void;
370
+ /**
371
+ * Inserts the control element based on the dropdown type.
372
+ *
373
+ * @public
374
+ * @remarks
375
+ * This method can be overridden in derived classes to provide custom control elements, though this is not recommended.
376
+ */
377
+ protected insertControl(): void;
378
+ /**
379
+ * Handles the keydown events for the dropdown.
380
+ *
381
+ * @param e - the keyboard event
382
+ * @public
383
+ */
384
+ keydownHandler(e: KeyboardEvent): boolean | void;
385
+ /**
386
+ * Prevents the default behavior of the mousedown event. This is necessary to prevent the input from losing focus
387
+ * when the dropdown is open.
388
+ *
389
+ * @param e - the mouse event
390
+ *
391
+ * @internal
392
+ */
393
+ mousedownHandler(e: MouseEvent): boolean | void;
394
+ /**
395
+ * Selects an option by index.
396
+ *
397
+ * @param index - The index of the option to select.
398
+ * @public
399
+ */
400
+ selectOption(index?: number): void;
401
+ /**
402
+ * Sets the validity of the element.
403
+ *
404
+ * @param flags - Validity flags to set.
405
+ * @param message - Optional message to supply. If not provided, the element's `validationMessage` will be used.
406
+ * @param anchor - Optional anchor to use for the validation message.
407
+ *
408
+ * @internal
409
+ */
410
+ setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
411
+ /**
412
+ * Updates the freeform option with the provided value.
413
+ *
414
+ * @param value - the value to update the freeform option with
415
+ * @internal
416
+ */
417
+ protected updateFreeformOption(value?: string): void;
418
+ }
419
+ /**
420
+ * The Fluent Dropdown Element. Implements {@link @microsoft/fast-foundation#BaseDropdown}.
421
+ *
422
+ * @slot - The default slot. Accepts a {@link (Listbox:class)} element.
423
+ * @slot indicator - The indicator slot.
424
+ * @slot control - The control slot. This slot is automatically populated and should not be manually manipulated.
425
+ *
426
+ * @public
427
+ */
428
+ export declare class Dropdown extends BaseDropdown {
429
+ /**
430
+ * Static property for the anchor positioning fallback observer. The observer is used to flip the listbox when it is
431
+ * out of view.
432
+ * @remarks This is only used when the browser does not support CSS anchor positioning.
433
+ * @internal
434
+ */
435
+ private static AnchorPositionFallbackObserver;
436
+ /**
437
+ * The appearance of the dropdown.
438
+ *
439
+ * @public
440
+ * @remarks
441
+ * HTML Attribute: `appearance`
442
+ */
443
+ appearance: DropdownAppearance;
444
+ /**
445
+ * Swaps appearance states when the appearance property changes.
446
+ *
447
+ * @param prev - the previous appearance state
448
+ * @param next - the current appearance state
449
+ * @internal
450
+ */
451
+ appearanceChanged(prev: DropdownAppearance | undefined, next: DropdownAppearance | undefined): void;
452
+ /**
453
+ * The size of the dropdown.
454
+ * @public
455
+ * @remarks
456
+ * HTML Attribute: `size`
457
+ */
458
+ size?: DropdownSize;
459
+ /**
460
+ * Swaps size states when the size property changes.
461
+ *
462
+ * @param prev - the previous size state
463
+ * @param next - the current size state
464
+ * @internal
465
+ */
466
+ sizeChanged(prev: DropdownSize | undefined, next: DropdownSize | undefined): void;
467
+ connectedCallback(): void;
468
+ constructor();
469
+ disconnectedCallback(): void;
470
+ /**
471
+ * Handles the connected event for the listbox.
472
+ *
473
+ * @param e - the event object
474
+ * @internal
475
+ */
476
+ private listboxConnectedHandler;
477
+ /**
478
+ * Adds or removes the window event listener based on the open state.
479
+ *
480
+ * @param prev - the previous open state
481
+ * @param next - the current open state
482
+ * @internal
483
+ */
484
+ openChanged(prev: boolean | undefined, next: boolean | undefined): void;
485
+ /**
486
+ * When anchor positioning isn't supported, an intersection observer is used to flip the listbox when it hits the
487
+ * viewport bounds. One static observer is used for all dropdowns.
488
+ *
489
+ * @internal
490
+ */
491
+ private anchorPositionFallback;
492
+ }
@@ -0,0 +1,9 @@
1
+ import { Dropdown } from './dropdown.js';
2
+ /**
3
+ * The Fluent Dropdown Element.
4
+ *
5
+ * @public
6
+ * @remarks
7
+ * HTML Element: `<fluent-dropdown>`
8
+ */
9
+ export declare const definition: import("@microsoft/fast-element").FASTElementDefinition<typeof Dropdown>;
@@ -0,0 +1,53 @@
1
+ import type { StaticallyComposableHTML } from '../utils/template-helpers.js';
2
+ import type { ValuesOf } from '../utils/typings.js';
3
+ import type { BaseDropdown } from './dropdown.js';
4
+ /**
5
+ * Predicate function that determines if the element should be considered a dropdown.
6
+ *
7
+ * @param element - The element to check.
8
+ * @param tagName - The tag name to check.
9
+ * @returns true if the element is a dropdown.
10
+ * @public
11
+ */
12
+ export declare function isDropdown(element?: Node | null, tagName?: string): element is BaseDropdown;
13
+ /**
14
+ * Values for the `appearance` attribute of the {@link (Dropdown:class)} component.
15
+ * @public
16
+ */
17
+ export declare const DropdownAppearance: {
18
+ filledDarker: string;
19
+ filledLighter: string;
20
+ outline: string;
21
+ transparent: string;
22
+ };
23
+ /** @public */
24
+ export type DropdownAppearance = ValuesOf<typeof DropdownAppearance>;
25
+ /**
26
+ * Template options for the {@link (Dropdown:class)} component.
27
+ * @public
28
+ */
29
+ export type DropdownOptions = {
30
+ indicator?: StaticallyComposableHTML<BaseDropdown>;
31
+ };
32
+ /**
33
+ * Values for the `size` attribute of the {@link (Dropdown:class)} component.
34
+ * @public
35
+ */
36
+ export declare const DropdownSize: {
37
+ readonly small: "small";
38
+ readonly medium: "medium";
39
+ readonly large: "large";
40
+ };
41
+ /** @public */
42
+ export type DropdownSize = ValuesOf<typeof DropdownSize>;
43
+ /**
44
+ * Values for the `type` attribute of the {@link (Dropdown:class)} component.
45
+ * @public
46
+ */
47
+ export declare const DropdownType: {
48
+ readonly combobox: "combobox";
49
+ readonly dropdown: "dropdown";
50
+ readonly select: "select";
51
+ };
52
+ /** @public */
53
+ export type DropdownType = ValuesOf<typeof DropdownType>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Styles for the {@link (Dropdown:class)} component.
3
+ *
4
+ * @public
5
+ */
6
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,38 @@
1
+ import { type ElementViewTemplate } from '@microsoft/fast-element';
2
+ import type { BaseDropdown } from './dropdown.js';
3
+ import type { DropdownOptions } from './dropdown.options.js';
4
+ /**
5
+ * The template partial for the dropdown input element. This template is used when the `type` property is set to "combobox".
6
+ *
7
+ * @public
8
+ * @remarks
9
+ * Since the input element must be present in the light DOM for ARIA to function correctly, this template should not be
10
+ * overridden.
11
+ * @see {@link BaseDropdown.insertControl}
12
+ */
13
+ export declare const dropdownInputTemplate: import("@microsoft/fast-element").ViewTemplate<BaseDropdown, any>;
14
+ /**
15
+ * The template partial for the dropdown button element. This template is used when the `type` property is set to "dropdown".
16
+ *
17
+ * @public
18
+ * @remarks
19
+ * Since the button element must be present in the light DOM for ARIA to function correctly, this template should not be
20
+ * overridden.
21
+ * @see {@link BaseDropdown.insertControl}
22
+ */
23
+ export declare const dropdownButtonTemplate: import("@microsoft/fast-element").ViewTemplate<BaseDropdown, any>;
24
+ /**
25
+ * Generates a template for the {@link (Dropdown:class)} component.
26
+ *
27
+ * @param options - The {@link (DropdownOptions:interface)} to use for generating the template.
28
+ * @returns The template object.
29
+ *
30
+ * @public
31
+ */
32
+ export declare function dropdownTemplate<T extends BaseDropdown>(options?: DropdownOptions): ElementViewTemplate<T>;
33
+ /**
34
+ * Template for the Dropdown component.
35
+ *
36
+ * @public
37
+ */
38
+ export declare const template: ElementViewTemplate<BaseDropdown>;
@@ -0,0 +1,5 @@
1
+ export { definition as DropdownDefinition } from './dropdown.definition.js';
2
+ export { BaseDropdown, Dropdown } from './dropdown.js';
3
+ export { DropdownAppearance, DropdownSize, DropdownType, isDropdown, type DropdownOptions, } from './dropdown.options.js';
4
+ export { styles as DropdownStyles } from './dropdown.styles.js';
5
+ export { dropdownButtonTemplate, dropdownInputTemplate, template as DropdownTemplate, dropdownTemplate, } from './dropdown.template.js';
@@ -12,15 +12,18 @@ import './dialog-body/define.js';
12
12
  import './divider/define.js';
13
13
  import './drawer/define.js';
14
14
  import './drawer-body/define.js';
15
+ import './dropdown/define.js';
15
16
  import './field/define.js';
16
17
  import './image/define.js';
17
18
  import './label/define.js';
18
19
  import './link/define.js';
20
+ import './listbox/define.js';
19
21
  import './menu-button/define.js';
20
22
  import './menu-item/define.js';
21
23
  import './menu-list/define.js';
22
24
  import './menu/define.js';
23
25
  import './message-bar/define.js';
26
+ import './option/define.js';
24
27
  import './progress-bar/define.js';
25
28
  import './radio-group/define.js';
26
29
  import './radio/define.js';
@@ -15,6 +15,8 @@ export { DialogBody, DialogBodyDefinition, DialogBodyTemplate, DialogBodyStyles
15
15
  export { BaseDivider, Divider, DividerAlignContent, DividerAppearance, DividerDefinition, DividerOrientation, DividerRole, DividerStyles, DividerTemplate, } from './divider/index.js';
16
16
  export { Drawer, DrawerDefinition, DrawerPosition, DrawerSize, DrawerType, DrawerTemplate, DrawerStyles, } from './drawer/index.js';
17
17
  export { DrawerBody, DrawerBodyDefinition, DrawerBodyTemplate, DrawerBodyStyles } from './drawer-body/index.js';
18
+ export { DropdownDefinition, BaseDropdown, Dropdown, DropdownAppearance, DropdownSize, DropdownType, isDropdown, type DropdownOptions, DropdownStyles, dropdownButtonTemplate, dropdownInputTemplate, DropdownTemplate, } from './dropdown/index.js';
19
+ export { ListboxDefinition, Listbox, isListbox, ListboxStyles, ListboxTemplate, listboxTemplate, } from './listbox/index.js';
18
20
  export { BaseField, Field, FieldLabelPosition, ValidationFlags, FieldDefinition, FieldStyles, FieldTemplate, } from './field/index.js';
19
21
  export type { SlottableInput } from './field/index.js';
20
22
  export { FluentDesignSystem } from './fluent-design-system.js';
@@ -28,6 +30,7 @@ export { MenuItem, MenuItemDefinition, MenuItemRole, MenuItemStyles, MenuItemTem
28
30
  export type { MenuItemColumnCount, MenuItemOptions } from './menu-item/index.js';
29
31
  export { MenuList, MenuListDefinition, MenuListStyles, MenuListTemplate } from './menu-list/index.js';
30
32
  export { Menu, MenuDefinition, MenuStyles, MenuTemplate } from './menu/index.js';
33
+ export { DropdownOption, DropdownOptionDefinition, DropdownOptionStyles, DropdownOptionTemplate, isDropdownOption, type DropdownOptionOptions, } from './option/index.js';
31
34
  export { StartEnd, endSlotTemplate, startSlotTemplate } from './patterns/start-end.js';
32
35
  export type { StartOptions, EndOptions, StartEndOptions } from './patterns/start-end.js';
33
36
  export { BaseProgressBar, ProgressBar, ProgressBarDefinition, ProgressBarShape, ProgressBarStyles, ProgressBarTemplate, ProgressBarThickness, ProgressBarValidationState, } from './progress-bar/index.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export { definition as ListboxDefinition } from './listbox.definition.js';
2
+ export { Listbox } from './listbox.js';
3
+ export { isListbox } from './listbox.options.js';
4
+ export { styles as ListboxStyles } from './listbox.styles.js';
5
+ export { template as ListboxTemplate, listboxTemplate } from './listbox.template.js';