@fluentui/web-components 3.0.0-beta.82 → 3.0.0-beta.84

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 (153) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/dts/accordion-item/accordion-item.base.d.ts +71 -0
  3. package/dist/dts/accordion-item/accordion-item.d.ts +1 -71
  4. package/dist/dts/accordion-item/index.d.ts +2 -1
  5. package/dist/dts/anchor-button/anchor-button.base.d.ts +144 -0
  6. package/dist/dts/anchor-button/anchor-button.d.ts +2 -144
  7. package/dist/dts/anchor-button/index.d.ts +2 -1
  8. package/dist/dts/avatar/avatar.base.d.ts +42 -0
  9. package/dist/dts/avatar/avatar.d.ts +2 -42
  10. package/dist/dts/avatar/index.d.ts +2 -1
  11. package/dist/dts/button/button.base.d.ts +242 -0
  12. package/dist/dts/button/button.d.ts +2 -242
  13. package/dist/dts/button/index.d.ts +2 -1
  14. package/dist/dts/checkbox/checkbox.base.d.ts +288 -0
  15. package/dist/dts/checkbox/checkbox.d.ts +1 -288
  16. package/dist/dts/checkbox/index.d.ts +2 -1
  17. package/dist/dts/divider/divider.base.d.ts +49 -0
  18. package/dist/dts/divider/divider.d.ts +2 -49
  19. package/dist/dts/divider/index.d.ts +2 -1
  20. package/dist/dts/dropdown/dropdown.base.d.ts +418 -0
  21. package/dist/dts/dropdown/dropdown.d.ts +2 -418
  22. package/dist/dts/dropdown/dropdown.options.d.ts +1 -1
  23. package/dist/dts/dropdown/dropdown.template.d.ts +1 -1
  24. package/dist/dts/dropdown/index.d.ts +2 -1
  25. package/dist/dts/field/field.base.d.ts +120 -0
  26. package/dist/dts/field/field.d.ts +2 -120
  27. package/dist/dts/field/index.d.ts +2 -1
  28. package/dist/dts/link/link.d.ts +1 -1
  29. package/dist/dts/listbox/listbox.d.ts +1 -1
  30. package/dist/dts/progress-bar/index.d.ts +2 -1
  31. package/dist/dts/progress-bar/progress-bar.base.d.ts +73 -0
  32. package/dist/dts/progress-bar/progress-bar.d.ts +2 -73
  33. package/dist/dts/radio/radio.d.ts +1 -1
  34. package/dist/dts/rating-display/index.d.ts +2 -1
  35. package/dist/dts/rating-display/rating-display.base.d.ts +89 -0
  36. package/dist/dts/rating-display/rating-display.d.ts +1 -89
  37. package/dist/dts/spinner/index.d.ts +2 -1
  38. package/dist/dts/spinner/spinner.base.d.ts +14 -0
  39. package/dist/dts/spinner/spinner.d.ts +1 -14
  40. package/dist/dts/switch/switch.d.ts +1 -1
  41. package/dist/dts/tablist/index.d.ts +2 -1
  42. package/dist/dts/tablist/tablist.base.d.ts +95 -0
  43. package/dist/dts/tablist/tablist.d.ts +2 -94
  44. package/dist/dts/tabs/tabs.base.d.ts +90 -0
  45. package/dist/dts/tabs/tabs.d.ts +2 -90
  46. package/dist/dts/text-input/index.d.ts +2 -1
  47. package/dist/dts/text-input/text-input.base.d.ts +393 -0
  48. package/dist/dts/text-input/text-input.d.ts +2 -393
  49. package/dist/dts/textarea/index.d.ts +2 -1
  50. package/dist/dts/textarea/textarea.base.d.ts +347 -0
  51. package/dist/dts/textarea/textarea.d.ts +2 -347
  52. package/dist/esm/accordion/accordion.js +1 -1
  53. package/dist/esm/accordion/accordion.js.map +1 -1
  54. package/dist/esm/accordion-item/accordion-item.base.js +94 -0
  55. package/dist/esm/accordion-item/accordion-item.base.js.map +1 -0
  56. package/dist/esm/accordion-item/accordion-item.js +2 -91
  57. package/dist/esm/accordion-item/accordion-item.js.map +1 -1
  58. package/dist/esm/accordion-item/index.js +2 -1
  59. package/dist/esm/accordion-item/index.js.map +1 -1
  60. package/dist/esm/anchor-button/anchor-button.base.js +147 -0
  61. package/dist/esm/anchor-button/anchor-button.base.js.map +1 -0
  62. package/dist/esm/anchor-button/anchor-button.js +3 -145
  63. package/dist/esm/anchor-button/anchor-button.js.map +1 -1
  64. package/dist/esm/anchor-button/index.js +2 -1
  65. package/dist/esm/anchor-button/index.js.map +1 -1
  66. package/dist/esm/avatar/avatar.base.js +28 -0
  67. package/dist/esm/avatar/avatar.base.js.map +1 -0
  68. package/dist/esm/avatar/avatar.js +2 -26
  69. package/dist/esm/avatar/avatar.js.map +1 -1
  70. package/dist/esm/avatar/index.js +2 -1
  71. package/dist/esm/avatar/index.js.map +1 -1
  72. package/dist/esm/button/button.base.js +283 -0
  73. package/dist/esm/button/button.base.js.map +1 -0
  74. package/dist/esm/button/button.js +3 -281
  75. package/dist/esm/button/button.js.map +1 -1
  76. package/dist/esm/button/button.styles.js +2 -1
  77. package/dist/esm/button/button.styles.js.map +1 -1
  78. package/dist/esm/button/index.js +2 -1
  79. package/dist/esm/button/index.js.map +1 -1
  80. package/dist/esm/checkbox/checkbox.base.js +366 -0
  81. package/dist/esm/checkbox/checkbox.base.js.map +1 -0
  82. package/dist/esm/checkbox/checkbox.js +2 -363
  83. package/dist/esm/checkbox/checkbox.js.map +1 -1
  84. package/dist/esm/checkbox/index.js +2 -1
  85. package/dist/esm/checkbox/index.js.map +1 -1
  86. package/dist/esm/divider/divider.base.js +61 -0
  87. package/dist/esm/divider/divider.base.js.map +1 -0
  88. package/dist/esm/divider/divider.js +3 -58
  89. package/dist/esm/divider/divider.js.map +1 -1
  90. package/dist/esm/divider/index.js +2 -1
  91. package/dist/esm/divider/index.js.map +1 -1
  92. package/dist/esm/dropdown/dropdown.base.js +677 -0
  93. package/dist/esm/dropdown/dropdown.base.js.map +1 -0
  94. package/dist/esm/dropdown/dropdown.js +3 -674
  95. package/dist/esm/dropdown/dropdown.js.map +1 -1
  96. package/dist/esm/dropdown/index.js +2 -1
  97. package/dist/esm/dropdown/index.js.map +1 -1
  98. package/dist/esm/field/field.base.js +189 -0
  99. package/dist/esm/field/field.base.js.map +1 -0
  100. package/dist/esm/field/field.js +3 -187
  101. package/dist/esm/field/field.js.map +1 -1
  102. package/dist/esm/field/index.js +2 -1
  103. package/dist/esm/field/index.js.map +1 -1
  104. package/dist/esm/link/link.js +1 -1
  105. package/dist/esm/link/link.js.map +1 -1
  106. package/dist/esm/progress-bar/index.js +2 -1
  107. package/dist/esm/progress-bar/index.js.map +1 -1
  108. package/dist/esm/progress-bar/progress-bar.base.js +90 -0
  109. package/dist/esm/progress-bar/progress-bar.base.js.map +1 -0
  110. package/dist/esm/progress-bar/progress-bar.js +3 -87
  111. package/dist/esm/progress-bar/progress-bar.js.map +1 -1
  112. package/dist/esm/radio/radio.js +1 -1
  113. package/dist/esm/radio/radio.js.map +1 -1
  114. package/dist/esm/rating-display/index.js +2 -1
  115. package/dist/esm/rating-display/index.js.map +1 -1
  116. package/dist/esm/rating-display/rating-display.base.js +94 -0
  117. package/dist/esm/rating-display/rating-display.base.js.map +1 -0
  118. package/dist/esm/rating-display/rating-display.js +2 -92
  119. package/dist/esm/rating-display/rating-display.js.map +1 -1
  120. package/dist/esm/spinner/index.js +2 -1
  121. package/dist/esm/spinner/index.js.map +1 -1
  122. package/dist/esm/spinner/spinner.base.js +18 -0
  123. package/dist/esm/spinner/spinner.base.js.map +1 -0
  124. package/dist/esm/spinner/spinner.js +2 -17
  125. package/dist/esm/spinner/spinner.js.map +1 -1
  126. package/dist/esm/switch/switch.js +1 -1
  127. package/dist/esm/switch/switch.js.map +1 -1
  128. package/dist/esm/tablist/index.js +2 -1
  129. package/dist/esm/tablist/index.js.map +1 -1
  130. package/dist/esm/tablist/tablist.base.js +248 -0
  131. package/dist/esm/tablist/tablist.base.js.map +1 -0
  132. package/dist/esm/tablist/tablist.js +3 -221
  133. package/dist/esm/tablist/tablist.js.map +1 -1
  134. package/dist/esm/tabs/tabs.base.js +279 -0
  135. package/dist/esm/tabs/tabs.base.js.map +1 -0
  136. package/dist/esm/tabs/tabs.js +2 -276
  137. package/dist/esm/tabs/tabs.js.map +1 -1
  138. package/dist/esm/text-input/index.js +2 -1
  139. package/dist/esm/text-input/index.js.map +1 -1
  140. package/dist/esm/text-input/text-input.base.js +409 -0
  141. package/dist/esm/text-input/text-input.base.js.map +1 -0
  142. package/dist/esm/text-input/text-input.js +3 -407
  143. package/dist/esm/text-input/text-input.js.map +1 -1
  144. package/dist/esm/textarea/index.js +2 -1
  145. package/dist/esm/textarea/index.js.map +1 -1
  146. package/dist/esm/textarea/textarea.base.js +494 -0
  147. package/dist/esm/textarea/textarea.base.js.map +1 -0
  148. package/dist/esm/textarea/textarea.js +3 -491
  149. package/dist/esm/textarea/textarea.js.map +1 -1
  150. package/dist/web-components.d.ts +1 -0
  151. package/dist/web-components.js +707 -556
  152. package/dist/web-components.min.js +265 -265
  153. package/package.json +5 -1
@@ -0,0 +1,418 @@
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 { 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, shouldEmit?: boolean): 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
+ }