@fluentui/web-components 3.0.0-beta.39 → 3.0.0-beta.40

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 (77) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/dist/dts/accordion/accordion.d.ts +35 -12
  3. package/dist/dts/accordion-item/accordion-item.d.ts +42 -14
  4. package/dist/dts/accordion-item/accordion-item.options.d.ts +2 -2
  5. package/dist/dts/accordion-item/index.d.ts +1 -1
  6. package/dist/dts/checkbox/checkbox.d.ts +98 -48
  7. package/dist/dts/field/field.d.ts +30 -1
  8. package/dist/dts/field/field.options.d.ts +2 -0
  9. package/dist/dts/index.d.ts +1 -1
  10. package/dist/dts/radio/index.d.ts +1 -1
  11. package/dist/dts/radio/radio.d.ts +38 -35
  12. package/dist/dts/radio/radio.options.d.ts +14 -0
  13. package/dist/dts/radio/radio.styles.d.ts +3 -1
  14. package/dist/dts/radio/radio.template.d.ts +13 -1
  15. package/dist/dts/radio-group/radio-group.d.ts +211 -49
  16. package/dist/dts/radio-group/radio-group.template.d.ts +1 -1
  17. package/dist/dts/styles/states/index.d.ts +20 -0
  18. package/dist/dts/switch/switch.d.ts +1 -0
  19. package/dist/dts/utils/root-active-element.d.ts +1 -0
  20. package/dist/esm/accordion/accordion.js +46 -85
  21. package/dist/esm/accordion/accordion.js.map +1 -1
  22. package/dist/esm/accordion-item/accordion-item.js +63 -19
  23. package/dist/esm/accordion-item/accordion-item.js.map +1 -1
  24. package/dist/esm/accordion-item/accordion-item.options.js +1 -1
  25. package/dist/esm/accordion-item/accordion-item.options.js.map +1 -1
  26. package/dist/esm/accordion-item/accordion-item.styles.js +41 -63
  27. package/dist/esm/accordion-item/accordion-item.styles.js.map +1 -1
  28. package/dist/esm/accordion-item/accordion-item.template.js +24 -43
  29. package/dist/esm/accordion-item/accordion-item.template.js.map +1 -1
  30. package/dist/esm/accordion-item/index.js +1 -1
  31. package/dist/esm/accordion-item/index.js.map +1 -1
  32. package/dist/esm/checkbox/checkbox.js +146 -97
  33. package/dist/esm/checkbox/checkbox.js.map +1 -1
  34. package/dist/esm/checkbox/checkbox.styles.js +1 -6
  35. package/dist/esm/checkbox/checkbox.styles.js.map +1 -1
  36. package/dist/esm/checkbox/checkbox.template.js.map +1 -1
  37. package/dist/esm/field/field.js +91 -29
  38. package/dist/esm/field/field.js.map +1 -1
  39. package/dist/esm/field/field.options.js.map +1 -1
  40. package/dist/esm/field/field.styles.js +31 -16
  41. package/dist/esm/field/field.styles.js.map +1 -1
  42. package/dist/esm/field/field.template.js +1 -1
  43. package/dist/esm/field/field.template.js.map +1 -1
  44. package/dist/esm/index.js +1 -1
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/radio/radio.js +59 -72
  47. package/dist/esm/radio/radio.js.map +1 -1
  48. package/dist/esm/radio/radio.options.js +2 -0
  49. package/dist/esm/radio/radio.options.js.map +1 -0
  50. package/dist/esm/radio/radio.styles.js +95 -88
  51. package/dist/esm/radio/radio.styles.js.map +1 -1
  52. package/dist/esm/radio/radio.template.js +21 -24
  53. package/dist/esm/radio/radio.template.js.map +1 -1
  54. package/dist/esm/radio-group/radio-group.js +416 -313
  55. package/dist/esm/radio-group/radio-group.js.map +1 -1
  56. package/dist/esm/radio-group/radio-group.styles.js +26 -32
  57. package/dist/esm/radio-group/radio-group.styles.js.map +1 -1
  58. package/dist/esm/radio-group/radio-group.template.js +6 -21
  59. package/dist/esm/radio-group/radio-group.template.js.map +1 -1
  60. package/dist/esm/styles/states/index.js +20 -0
  61. package/dist/esm/styles/states/index.js.map +1 -1
  62. package/dist/esm/switch/switch.js +4 -0
  63. package/dist/esm/switch/switch.js.map +1 -1
  64. package/dist/esm/switch/switch.styles.js +3 -6
  65. package/dist/esm/switch/switch.styles.js.map +1 -1
  66. package/dist/esm/switch/switch.template.js.map +1 -1
  67. package/dist/esm/theme/set-theme.js +3 -6
  68. package/dist/esm/theme/set-theme.js.map +1 -1
  69. package/dist/esm/utils/root-active-element.js +9 -0
  70. package/dist/esm/utils/root-active-element.js.map +1 -0
  71. package/dist/web-components.d.ts +461 -181
  72. package/dist/web-components.js +1387 -1233
  73. package/dist/web-components.min.js +262 -258
  74. package/package.json +1 -1
  75. package/dist/dts/radio/radio.form-associated.d.ts +0 -14
  76. package/dist/esm/radio/radio.form-associated.js +0 -14
  77. package/dist/esm/radio/radio.form-associated.js.map +0 -1
@@ -19,8 +19,9 @@ import { ViewTemplate } from '@microsoft/fast-element';
19
19
  * An Accordion Custom HTML Element
20
20
  * Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
21
21
  *
22
+ * @slot - The default slot for the accordion items
22
23
  * @fires change - Fires a custom 'change' event when the active item changes
23
- * @csspart item - The slot for the accordion items
24
+ *
24
25
  * @public
25
26
  */
26
27
  export declare class Accordion extends FASTElement {
@@ -38,31 +39,53 @@ export declare class Accordion extends FASTElement {
38
39
  * @internal
39
40
  */
40
41
  slottedAccordionItems: HTMLElement[];
42
+ /**
43
+ * @internal
44
+ */
41
45
  protected accordionItems: Element[];
42
46
  /**
43
47
  * @internal
44
48
  */
45
49
  slottedAccordionItemsChanged(oldValue: HTMLElement[], newValue: HTMLElement[]): void;
46
50
  /**
51
+ * Watch for changes to the slotted accordion items `disabled` and `expanded` attributes
47
52
  * @internal
48
53
  */
49
54
  handleChange(source: any, propertyName: string): void;
50
- private activeid;
51
55
  private activeItemIndex;
52
- private accordionIds;
53
- private change;
56
+ /**
57
+ * Find the first expanded item in the accordion
58
+ * @returns {void}
59
+ */
54
60
  private findExpandedItem;
61
+ /**
62
+ * Resets event listeners and sets the `accordionItems` property
63
+ * then rebinds event listeners to each non-disabled item
64
+ * @returns {void}
65
+ */
55
66
  private setItems;
67
+ /**
68
+ * Checks if the accordion is in single expand mode
69
+ * @returns {boolean}
70
+ */
71
+ private isSingleExpandMode;
72
+ /**
73
+ * Controls the behavior of the accordion in single expand mode
74
+ * @param expandedItem The item to expand in single expand mode
75
+ * @returns {void}
76
+ */
56
77
  private setSingleExpandMode;
78
+ /**
79
+ * Removes event listeners from the previous accordion items
80
+ * @param oldValue An array of the previous accordion items
81
+ */
57
82
  private removeItemListeners;
58
- private activeItemChange;
59
- private handleExpandedChange;
60
- private getItemIds;
61
- private isSingleExpandMode;
62
- private handleItemKeyDown;
63
- private handleItemFocus;
64
- private adjust;
65
- private focusItem;
83
+ /**
84
+ * Changes the expanded state of the accordion item
85
+ * @param evt Click event
86
+ * @returns
87
+ */
88
+ private expandedChangedHandler;
66
89
  }
67
90
 
68
91
  /**
@@ -89,22 +112,24 @@ export declare type AccordionExpandMode = ValuesOf<typeof AccordionExpandMode>;
89
112
 
90
113
  /**
91
114
  *
92
- * @slot start - Content which can be provided between the heading and the icon
93
- * @slot end - Content which can be provided between the start slot and icon
115
+ * @slot start - Content positioned before heading in the collapsed state
94
116
  * @slot heading - Content which serves as the accordion item heading and text of the expand button
95
117
  * @slot - The default slot for accordion item content
96
- * @slot expanded-icon - The expanded icon
97
- * @slot collapsed-icon - The collapsed icon
98
- * @fires change - Fires a custom 'change' event when the button is invoked
118
+ * @slot marker-expanded - The expanded icon
119
+ * @slot marker-collapsed - The collapsed icon
99
120
  * @csspart heading - Wraps the button
100
121
  * @csspart button - The button which serves to invoke the item
101
- * @csspart heading-content - Wraps the slot for the heading content within the button
102
- * @csspart icon - The icon container
103
- * @csspart region - The wrapper for the accordion item content
122
+ * @csspart content - The wrapper for the accordion item content
104
123
  *
105
124
  * @public
106
125
  */
107
126
  export declare class AccordionItem extends FASTElement {
127
+ /**
128
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
129
+ *
130
+ * @internal
131
+ */
132
+ elementInternals: ElementInternals;
108
133
  /**
109
134
  * Configures the {@link https://www.w3.org/TR/wai-aria-1.1/#aria-level | level} of the
110
135
  * heading element.
@@ -122,6 +147,12 @@ export declare class AccordionItem extends FASTElement {
122
147
  * HTML attribute: expanded
123
148
  */
124
149
  expanded: boolean;
150
+ /**
151
+ * Handles expanded changes
152
+ * @param prev - previous value
153
+ * @param next - next value
154
+ */
155
+ expandedChanged(prev: boolean, next: boolean): void;
125
156
  /**
126
157
  * Disables an accordion item
127
158
  *
@@ -130,6 +161,12 @@ export declare class AccordionItem extends FASTElement {
130
161
  * HTML attribute: disabled
131
162
  */
132
163
  disabled: boolean;
164
+ /**
165
+ * Handles disabled changes
166
+ * @param prev - previous value
167
+ * @param next - next value
168
+ */
169
+ disabledChanged(prev: boolean, next: boolean): void;
133
170
  /**
134
171
  * The item ID
135
172
  *
@@ -146,6 +183,12 @@ export declare class AccordionItem extends FASTElement {
146
183
  * HTML Attribute: size
147
184
  */
148
185
  size?: AccordionItemSize;
186
+ /**
187
+ * Handles changes to size attribute
188
+ * @param prev - previous value
189
+ * @param next - next value
190
+ */
191
+ sizeChanged(prev: AccordionItemSize, next: AccordionItemSize): void;
149
192
  /**
150
193
  * Sets the width of the focus state.
151
194
  *
@@ -154,22 +197,30 @@ export declare class AccordionItem extends FASTElement {
154
197
  * HTML Attribute: block
155
198
  */
156
199
  block: boolean;
200
+ /**
201
+ * Handles changes to block attribute
202
+ * @param prev - previous value
203
+ * @param next - next value
204
+ */
205
+ blockChanged(prev: boolean, next: boolean): void;
157
206
  /**
158
207
  * Sets expand and collapsed icon position.
159
208
  *
160
209
  * @public
161
210
  * @remarks
162
- * HTML Attribute: expand-icon-position
211
+ * HTML Attribute: marker-position
163
212
  */
164
- expandIconPosition?: AccordionItemExpandIconPosition;
213
+ markerPosition?: AccordionItemMarkerPosition;
165
214
  /**
166
- * @internal
215
+ * Handles changes to marker-position attribute
216
+ * @param prev - previous value
217
+ * @param next - next value
167
218
  */
168
- expandbutton: HTMLElement;
219
+ markerPositionChanged(prev: AccordionItemMarkerPosition, next: AccordionItemMarkerPosition): void;
169
220
  /**
170
221
  * @internal
171
222
  */
172
- clickHandler: (e: MouseEvent) => void;
223
+ expandbutton: HTMLElement;
173
224
  }
174
225
 
175
226
  /**
@@ -192,7 +243,7 @@ export declare const accordionItemDefinition: FASTElementDefinition<typeof Accor
192
243
  /**
193
244
  * An Accordion Item expand/collapse icon can appear at the start or end of the accordion
194
245
  */
195
- export declare const AccordionItemExpandIconPosition: {
246
+ export declare const AccordionItemMarkerPosition: {
196
247
  readonly start: "start";
197
248
  readonly end: "end";
198
249
  };
@@ -201,7 +252,7 @@ export declare const AccordionItemExpandIconPosition: {
201
252
  * Applies expand/collapse icon position
202
253
  * @public
203
254
  */
204
- export declare type AccordionItemExpandIconPosition = ValuesOf<typeof AccordionItemExpandIconPosition>;
255
+ export declare type AccordionItemMarkerPosition = ValuesOf<typeof AccordionItemMarkerPosition>;
205
256
 
206
257
  /**
207
258
  * Accordion Item configuration options
@@ -984,13 +1035,7 @@ declare class BaseAnchor extends FASTElement {
984
1035
  }
985
1036
 
986
1037
  /**
987
- * A Checkbox Custom HTML Element.
988
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
989
- *
990
- * @slot checked-indicator - The checked indicator
991
- * @slot indeterminate-indicator - The indeterminate indicator
992
- * @fires change - Emits a custom change event when the checked state changes
993
- * @fires input - Emits a custom input event when the checked state changes
1038
+ * The base class for a component with a toggleable checked state.
994
1039
  *
995
1040
  * @public
996
1041
  */
@@ -1010,37 +1055,46 @@ declare class BaseCheckbox extends FASTElement {
1010
1055
  * @public
1011
1056
  */
1012
1057
  get checked(): boolean;
1013
- set checked(state: boolean);
1058
+ set checked(next: boolean);
1014
1059
  /**
1015
- * The element's disabled state.
1060
+ * The disabled state of the control.
1061
+ *
1016
1062
  * @public
1017
- * @remarks
1018
- * HTML Attribute: `disabled`
1019
1063
  */
1020
- disabled: boolean;
1064
+ disabled?: boolean;
1021
1065
  /**
1022
- * The id of a form to associate the element to.
1023
- * @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#form | `form`} attribute
1066
+ * Toggles the disabled state when the user changes the `disabled` property.
1024
1067
  *
1025
- * @public
1026
- * @remarks
1027
- * HTML Attribute: `form`
1068
+ * @internal
1028
1069
  */
1029
- formAttribute?: string;
1070
+ protected disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
1030
1071
  /**
1031
- * Indicates that the element is in an indeterminate or mixed state.
1072
+ * The initial disabled state of the control.
1032
1073
  *
1033
1074
  * @public
1075
+ * @remarks
1076
+ * HTML Attribute: `disabled`
1034
1077
  */
1035
- indeterminate?: boolean;
1078
+ disabledAttribute?: boolean;
1036
1079
  /**
1037
- * Synchronizes the element's indeterminate state with the internal ElementInternals state.
1080
+ * Sets the disabled state when the `disabled` attribute changes.
1038
1081
  *
1082
+ * @param prev - the previous value
1083
+ * @param next - the current value
1039
1084
  * @internal
1040
1085
  */
1041
- indeterminateChanged(prev: boolean, next: boolean): void;
1086
+ protected disabledAttributeChanged(prev: boolean | undefined, next: boolean | undefined): void;
1042
1087
  /**
1043
- * The element's checked state.
1088
+ * The id of a form to associate the element to.
1089
+ * @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#form | `form`} attribute
1090
+ *
1091
+ * @public
1092
+ * @remarks
1093
+ * HTML Attribute: `form`
1094
+ */
1095
+ formAttribute?: string;
1096
+ /**
1097
+ * The initial checked state of the element.
1044
1098
  *
1045
1099
  * @public
1046
1100
  * @remarks
@@ -1048,11 +1102,13 @@ declare class BaseCheckbox extends FASTElement {
1048
1102
  */
1049
1103
  initialChecked?: boolean;
1050
1104
  /**
1051
- * Updates the form value when the checked state changes.
1105
+ * Updates the checked state when the `checked` attribute is changed, unless the checked state has been changed by the user.
1052
1106
  *
1107
+ * @param prev - The previous initial checked state
1108
+ * @param next - The current initial checked state
1053
1109
  * @internal
1054
1110
  */
1055
- initialCheckedChanged(prev: boolean | undefined, next: boolean): void;
1111
+ protected initialCheckedChanged(prev: boolean | undefined, next: boolean | undefined): void;
1056
1112
  /**
1057
1113
  * The initial value of the input.
1058
1114
  *
@@ -1062,13 +1118,13 @@ declare class BaseCheckbox extends FASTElement {
1062
1118
  */
1063
1119
  initialValue: string;
1064
1120
  /**
1065
- * Sets the value of the input when the value attribute changes.
1121
+ * Sets the value of the input when the `value` attribute changes.
1066
1122
  *
1067
- * @param prev - The previous value
1068
- * @param next - The current value
1123
+ * @param prev - The previous initial value
1124
+ * @param next - The current initial value
1069
1125
  * @internal
1070
1126
  */
1071
- initialValueChanged(prev: string, next: string): void;
1127
+ protected initialValueChanged(prev: string, next: string): void;
1072
1128
  /**
1073
1129
  * The name of the element. This element's value will be surfaced during form submission under the provided name.
1074
1130
  *
@@ -1092,13 +1148,13 @@ declare class BaseCheckbox extends FASTElement {
1092
1148
  * @param next - The current required state
1093
1149
  * @internal
1094
1150
  */
1095
- requiredChanged(prev: boolean, next: boolean): void;
1151
+ protected requiredChanged(prev: boolean, next: boolean): void;
1096
1152
  /**
1097
1153
  * The internal checked state of the control.
1098
1154
  *
1099
1155
  * @internal
1100
1156
  */
1101
- private _checked;
1157
+ private _checked?;
1102
1158
  /**
1103
1159
  * Indicates that the checked state has been changed by the user.
1104
1160
  *
@@ -1131,7 +1187,7 @@ declare class BaseCheckbox extends FASTElement {
1131
1187
  *
1132
1188
  * @public
1133
1189
  */
1134
- get labels(): ReadonlyArray<Node>;
1190
+ get labels(): ReadonlyArray<HTMLLabelElement>;
1135
1191
  /**
1136
1192
  * The fallback validation message, taken from a native checkbox `<input>` element.
1137
1193
  *
@@ -1176,12 +1232,6 @@ declare class BaseCheckbox extends FASTElement {
1176
1232
  * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate | `ElementInternals.willValidate`} property.
1177
1233
  */
1178
1234
  get willValidate(): boolean;
1179
- /**
1180
- * Sets the `elementInternals.ariaChecked` value based on the checked state.
1181
- *
1182
- * @internal
1183
- */
1184
- private setAriaChecked;
1185
1235
  /**
1186
1236
  * Checks the validity of the element and returns the result.
1187
1237
  *
@@ -1198,14 +1248,13 @@ declare class BaseCheckbox extends FASTElement {
1198
1248
  */
1199
1249
  clickHandler(e: MouseEvent): boolean | void;
1200
1250
  connectedCallback(): void;
1201
- constructor();
1202
1251
  /**
1203
1252
  * Updates the form value when a user changes the `checked` state.
1204
1253
  *
1205
1254
  * @param e - the event object
1206
1255
  * @internal
1207
1256
  */
1208
- inputHandler(e: Event): boolean | void;
1257
+ inputHandler(e: InputEvent): boolean | void;
1209
1258
  /**
1210
1259
  * Prevents scrolling when the user presses the space key.
1211
1260
  *
@@ -1234,6 +1283,13 @@ declare class BaseCheckbox extends FASTElement {
1234
1283
  * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
1235
1284
  */
1236
1285
  reportValidity(): boolean;
1286
+ /**
1287
+ * Sets the ARIA checked state.
1288
+ *
1289
+ * @param value - The checked state
1290
+ * @internal
1291
+ */
1292
+ protected setAriaChecked(value?: boolean): void;
1237
1293
  /**
1238
1294
  * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
1239
1295
  *
@@ -1260,9 +1316,10 @@ declare class BaseCheckbox extends FASTElement {
1260
1316
  /**
1261
1317
  * Toggles the checked state of the control.
1262
1318
  *
1319
+ * @param force - Forces the element to be checked or unchecked
1263
1320
  * @public
1264
1321
  */
1265
- private toggleChecked;
1322
+ toggleChecked(force?: boolean): void;
1266
1323
  }
1267
1324
 
1268
1325
  /**
@@ -1798,27 +1855,31 @@ export declare const ButtonType: {
1798
1855
  export declare type ButtonType = ValuesOf<typeof ButtonType>;
1799
1856
 
1800
1857
  /**
1801
- * Creates a checkable form associated component.
1802
- * @beta
1803
- */
1804
- declare function CheckableFormAssociated<T extends ConstructableFormAssociated>(BaseCtor: T): T;
1805
-
1806
- /**
1807
- * Base class for providing Custom Element Form Association with checkable features.
1858
+ * A Checkbox Custom HTML Element.
1859
+ * Implements the {@link https://w3c.github.io/aria/#checkbox | ARIA checkbox }.
1808
1860
  *
1809
- * @beta
1861
+ * @slot checked-indicator - The checked indicator
1862
+ * @slot indeterminate-indicator - The indeterminate indicator
1863
+ * @fires change - Emits a custom change event when the checked state changes
1864
+ * @fires input - Emits a custom input event when the checked state changes
1865
+ *
1866
+ * @public
1810
1867
  */
1811
- declare interface CheckableFormAssociated extends FormAssociated {
1812
- currentChecked: boolean;
1813
- dirtyChecked: boolean;
1814
- checkedAttribute: boolean;
1815
- defaultChecked: boolean;
1816
- defaultCheckedChanged(oldValue: boolean | undefined, newValue: boolean): void;
1817
- checked: boolean;
1818
- checkedChanged(oldValue: boolean | undefined, newValue: boolean): void;
1819
- }
1820
-
1821
1868
  export declare class Checkbox extends BaseCheckbox {
1869
+ /**
1870
+ * Indicates that the element is in an indeterminate or mixed state.
1871
+ *
1872
+ * @public
1873
+ */
1874
+ indeterminate?: boolean;
1875
+ /**
1876
+ * Updates the indeterminate state when the `indeterminate` property changes.
1877
+ *
1878
+ * @param prev - the indeterminate state
1879
+ * @param next - the current indeterminate state
1880
+ * @internal
1881
+ */
1882
+ protected indeterminateChanged(prev: boolean | undefined, next: boolean | undefined): void;
1822
1883
  /**
1823
1884
  * Indicates the shape of the checkbox.
1824
1885
  *
@@ -1828,13 +1889,15 @@ export declare class Checkbox extends BaseCheckbox {
1828
1889
  */
1829
1890
  shape?: CheckboxShape;
1830
1891
  /**
1831
- * Handles changes to shape attribute custom states
1832
- * @param prev - the previous state
1833
- * @param next - the next state
1892
+ * Applies shape states when the `shape` property changes.
1893
+ *
1894
+ * @param prev - the previous shape value
1895
+ * @param next - the next shape value
1896
+ * @internal
1834
1897
  */
1835
- shapeChanged(prev: CheckboxShape | undefined, next: CheckboxShape | undefined): void;
1898
+ protected shapeChanged(prev: CheckboxShape | undefined, next: CheckboxShape | undefined): void;
1836
1899
  /**
1837
- * Indicates the size of the checkbox.
1900
+ * Indicates the size of the control.
1838
1901
  *
1839
1902
  * @public
1840
1903
  * @remarks
@@ -1842,11 +1905,28 @@ export declare class Checkbox extends BaseCheckbox {
1842
1905
  */
1843
1906
  size?: CheckboxSize;
1844
1907
  /**
1845
- * Handles changes to size attribute custom states
1908
+ * Applies size states when the `size` property changes.
1909
+ *
1846
1910
  * @param prev - the previous state
1847
1911
  * @param next - the next state
1912
+ * @internal
1848
1913
  */
1849
- sizeChanged(prev: CheckboxSize | undefined, next: CheckboxSize | undefined): void;
1914
+ protected sizeChanged(prev: CheckboxSize | undefined, next: CheckboxSize | undefined): void;
1915
+ constructor();
1916
+ /**
1917
+ * Sets the ARIA checked state. If the `indeterminate` flag is true, the value will be 'mixed'.
1918
+ *
1919
+ * @internal
1920
+ * @override
1921
+ */
1922
+ protected setAriaChecked(value?: boolean): void;
1923
+ /**
1924
+ * Toggles the checked state of the control.
1925
+ *
1926
+ * @param force - Forces the element to be checked or unchecked
1927
+ * @public
1928
+ */
1929
+ toggleChecked(force?: boolean): void;
1850
1930
  }
1851
1931
 
1852
1932
  /**
@@ -4877,6 +4957,19 @@ export declare class Field extends FASTElement {
4877
4957
  * HTML Attribute: `label-position`
4878
4958
  */
4879
4959
  labelPosition: FieldLabelPosition;
4960
+ /**
4961
+ * The slotted label elements.
4962
+ *
4963
+ * @internal
4964
+ */
4965
+ labelSlot: Node[];
4966
+ /**
4967
+ * Updates attributes on the slotted label elements.
4968
+ *
4969
+ * @param prev - the previous list of slotted label elements
4970
+ * @param next - the current list of slotted label elements
4971
+ */
4972
+ protected labelSlotChanged(prev: Node[], next: Node[]): void;
4880
4973
  /**
4881
4974
  * The slotted message elements. Filtered to only include elements with a `flag` attribute.
4882
4975
  *
@@ -4919,19 +5012,28 @@ export declare class Field extends FASTElement {
4919
5012
  * @public
4920
5013
  */
4921
5014
  input: SlottableInput;
5015
+ /**
5016
+ * Updates the field's states and label properties when the assigned input changes.
5017
+ *
5018
+ * @param prev - the previous input
5019
+ * @param next - the current input
5020
+ */
5021
+ inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
4922
5022
  /**
4923
5023
  * Calls the `setStates` method when a `change` event is emitted from the slotted input.
4924
5024
  *
4925
5025
  * @param e - the event object
4926
5026
  * @internal
4927
5027
  */
4928
- changeHandler(e: Event): void;
5028
+ changeHandler(e: Event): boolean | void;
4929
5029
  /**
4930
5030
  * Redirects `click` events to the slotted input.
4931
5031
  *
5032
+ * @param e - the event object
4932
5033
  * @internal
4933
5034
  */
4934
5035
  clickHandler(e: MouseEvent): boolean | void;
5036
+ constructor();
4935
5037
  /**
4936
5038
  * Applies the `focus-visible` state to the element when the slotted input receives visible focus.
4937
5039
  *
@@ -4953,12 +5055,19 @@ export declare class Field extends FASTElement {
4953
5055
  * @internal
4954
5056
  */
4955
5057
  invalidHandler(e: Event): boolean | void;
5058
+ /**
5059
+ * Sets ARIA and form-related attributes on slotted label elements.
5060
+ *
5061
+ * @internal
5062
+ */
5063
+ private setLabelProperties;
4956
5064
  /**
4957
5065
  * Toggles the field's states based on the slotted input.
4958
5066
  *
4959
5067
  * @internal
4960
5068
  */
4961
5069
  setStates(): void;
5070
+ setValidationStates(): void;
4962
5071
  }
4963
5072
 
4964
5073
  /**
@@ -5152,15 +5261,6 @@ declare interface FormAssociated extends Omit<ElementInternals, 'labels'> {
5152
5261
  valueChanged(previous: string, next: string): void;
5153
5262
  }
5154
5263
 
5155
- /**
5156
- * @beta
5157
- */
5158
- declare class FormAssociatedRadio extends FormAssociatedRadio_base {
5159
- proxy: HTMLInputElement;
5160
- }
5161
-
5162
- declare const FormAssociatedRadio_base: typeof _Radio;
5163
-
5164
5264
  /**
5165
5265
  * @beta
5166
5266
  */
@@ -6389,54 +6489,63 @@ export declare type ProgressBarValidationState = ValuesOf<typeof ProgressBarVali
6389
6489
 
6390
6490
  /**
6391
6491
  * A Radio Custom HTML Element.
6392
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radio | ARIA radio }.
6492
+ * Implements the {@link https://w3c.github.io/aria/#radio | ARIA `radio` role}.
6393
6493
  *
6394
- * @slot checked-indicator - The checked indicator
6395
- * @slot - The default slot for the label
6396
- * @csspart control - The element representing the visual radio control
6397
- * @csspart label - The label
6494
+ * @slot checked-indicator - The checked indicator slot
6398
6495
  * @fires change - Emits a custom change event when the checked state changes
6496
+ * @fires input - Emits a custom input event when the checked state changes
6399
6497
  *
6400
6498
  * @public
6401
6499
  */
6402
- export declare class Radio extends FormAssociatedRadio implements RadioControl {
6403
- /**
6404
- * The name of the radio. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname | name attribute} for more info.
6405
- */
6406
- name: string;
6500
+ export declare class Radio extends BaseCheckbox {
6501
+ connectedCallback(): void;
6502
+ constructor();
6407
6503
  /**
6408
- * The element's value to be included in form submission when checked.
6409
- * Default to "on" to reach parity with input[type="radio"]
6504
+ * Toggles the disabled state when the user changes the `disabled` property.
6410
6505
  *
6506
+ * @param prev - the previous value of the `disabled` property
6507
+ * @param next - the current value of the `disabled` property
6411
6508
  * @internal
6509
+ * @override
6412
6510
  */
6413
- initialValue: string;
6511
+ protected disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
6414
6512
  /**
6513
+ * This method is a no-op for the radio component.
6514
+ *
6415
6515
  * @internal
6516
+ * @override
6517
+ * @remarks
6518
+ * To make a group of radio controls required, see {@link RadioGroup.required}.
6416
6519
  */
6417
- defaultSlottedNodes: Node[];
6418
- private get radioGroup();
6520
+ protected requiredChanged(): void;
6419
6521
  /**
6522
+ * This method is a no-op for the radio component.
6523
+ *
6420
6524
  * @internal
6525
+ * @override
6526
+ * @remarks
6527
+ * The radio form value is controlled by the `RadioGroup` component.
6421
6528
  */
6422
- defaultCheckedChanged(): void;
6423
- constructor();
6529
+ setFormValue(): void;
6424
6530
  /**
6531
+ * Sets the validity of the control.
6532
+ *
6425
6533
  * @internal
6534
+ * @override
6535
+ * @remarks
6536
+ * The radio component does not have a `required` attribute, so this method always sets the validity to `true`.
6426
6537
  */
6427
- connectedCallback(): void;
6428
- private isInsideRadioGroup;
6538
+ setValidity(): void;
6429
6539
  /**
6430
- * Handles key presses on the radio.
6431
- * @beta
6540
+ * Toggles the checked state of the control.
6541
+ *
6542
+ * @param force - Forces the element to be checked or unchecked
6543
+ * @public
6544
+ * @override
6545
+ * @remarks
6546
+ * The radio checked state is controlled by the `RadioGroup` component, so the `force` parameter defaults to `true`.
6432
6547
  */
6433
- keypressHandler(e: KeyboardEvent): boolean | void;
6434
- }
6435
-
6436
- declare class _Radio extends FASTElement {
6437
- }
6438
-
6439
- declare interface _Radio extends CheckableFormAssociated {
6548
+ toggleChecked(force?: boolean): void;
6440
6549
  }
6441
6550
 
6442
6551
  /**
@@ -6455,106 +6564,267 @@ export declare type RadioControl = Pick<HTMLInputElement, 'checked' | 'disabled'
6455
6564
  export declare const RadioDefinition: FASTElementDefinition<typeof Radio>;
6456
6565
 
6457
6566
  /**
6458
- * The base class used for constructing a fluent-radio-group custom element
6567
+ * A Radio Group Custom HTML Element.
6568
+ * Implements the {@link https://w3c.github.io/aria/#radiogroup | ARIA `radiogroup` role}.
6569
+ *
6459
6570
  * @public
6571
+ *
6572
+ * @slot - The default slot for the radio group
6460
6573
  */
6461
6574
  export declare class RadioGroup extends FASTElement {
6462
6575
  /**
6463
- * sets radio layout styles
6576
+ * The index of the checked radio, scoped to the enabled radios.
6577
+ *
6578
+ * @internal
6579
+ */
6580
+ protected checkedIndex: number;
6581
+ /**
6582
+ * Sets the checked state of the nearest enabled radio when the `checkedIndex` changes.
6583
+ *
6584
+ * @param prev - the previous index
6585
+ * @param next - the current index
6586
+ * @internal
6587
+ */
6588
+ protected checkedIndexChanged(prev: number | undefined, next: number): void;
6589
+ /**
6590
+ * Indicates that the value has been changed by the user.
6591
+ */
6592
+ private dirtyState;
6593
+ /**
6594
+ * Disables the radio group and child radios.
6464
6595
  *
6465
6596
  * @public
6466
6597
  * @remarks
6467
- * HTML Attribute: stacked
6598
+ * HTML Attribute: `disabled`
6468
6599
  */
6469
- stacked: boolean;
6600
+ disabled: boolean;
6470
6601
  /**
6471
- * When true, the child radios will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute} for more information.
6602
+ * Sets the `disabled` attribute on all child radios when the `disabled` property changes.
6603
+ *
6604
+ * @param prev - the previous disabled value
6605
+ * @param next - the current disabled value
6606
+ * @internal
6607
+ */
6608
+ protected disabledChanged(prev?: boolean, next?: boolean): void;
6609
+ /**
6610
+ * The value of the checked radio.
6611
+ *
6472
6612
  * @public
6473
6613
  * @remarks
6474
- * HTML Attribute: readonly
6614
+ * HTML Attribute: `value`
6475
6615
  */
6476
- readOnly: boolean;
6616
+ initialValue?: string;
6477
6617
  /**
6478
- * Disables the radio group and child radios.
6618
+ * Sets the matching radio to checked when the value changes. If no radio matches the value, no radio will be checked.
6619
+ *
6620
+ * @param prev - the previous value
6621
+ * @param next - the current value
6622
+ */
6623
+ initialValueChanged(prev: string | undefined, next: string | undefined): void;
6624
+ /**
6625
+ * The name of the radio group.
6479
6626
  *
6480
6627
  * @public
6481
6628
  * @remarks
6482
- * HTML Attribute: disabled
6629
+ * HTML Attribute: `name`
6483
6630
  */
6484
- disabled: boolean;
6631
+ name: string;
6632
+ /**
6633
+ * Sets the `name` attribute on all child radios when the `name` property changes.
6634
+ *
6635
+ * @internal
6636
+ */
6637
+ protected nameChanged(prev: string | undefined, next: string | undefined): void;
6485
6638
  /**
6486
- * The name of the radio group. Setting this value will set the name value
6487
- * for all child radio elements.
6639
+ * The orientation of the group.
6488
6640
  *
6489
6641
  * @public
6490
6642
  * @remarks
6491
- * HTML Attribute: name
6643
+ * HTML Attribute: `orientation`
6492
6644
  */
6493
- name: string;
6494
- protected nameChanged(): void;
6645
+ orientation?: RadioGroupOrientation;
6646
+ /**
6647
+ * Sets the ariaOrientation attribute when the orientation changes.
6648
+ *
6649
+ * @param prev - the previous orientation
6650
+ * @param next - the current orientation
6651
+ * @internal
6652
+ */
6653
+ orientationChanged(prev: RadioGroupOrientation | undefined, next: RadioGroupOrientation | undefined): void;
6654
+ /**
6655
+ * The collection of all child radios.
6656
+ *
6657
+ * @public
6658
+ */
6659
+ radios: Radio[];
6660
+ /**
6661
+ * Updates the enabled radios collection when properties on the child radios change.
6662
+ *
6663
+ * @param prev - the previous radios
6664
+ * @param next - the current radios
6665
+ */
6666
+ radiosChanged(prev: Radio[] | undefined, next: Radio[] | undefined): void;
6495
6667
  /**
6496
- * The value of the checked radio
6668
+ * Indicates whether the radio group is required.
6497
6669
  *
6498
6670
  * @public
6499
6671
  * @remarks
6500
- * HTML Attribute: value
6672
+ * HTML Attribute: `required`
6501
6673
  */
6502
- value: string;
6503
- protected valueChanged(): void;
6674
+ required: boolean;
6504
6675
  /**
6505
- * The orientation of the group
6676
+ *
6677
+ * @param prev - the previous required value
6678
+ * @param next - the current required value
6679
+ */
6680
+ requiredChanged(prev: boolean, next: boolean): void;
6681
+ /**
6682
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
6683
+ *
6684
+ * @internal
6685
+ */
6686
+ elementInternals: ElementInternals;
6687
+ /**
6688
+ * A collection of child radios that are not disabled.
6689
+ *
6690
+ * @internal
6691
+ */
6692
+ get enabledRadios(): Radio[];
6693
+ /**
6694
+ * The form-associated flag.
6695
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
6696
+ *
6697
+ * @public
6698
+ */
6699
+ static formAssociated: boolean;
6700
+ /**
6701
+ * The fallback validation message, taken from a native checkbox `<input>` element.
6702
+ *
6703
+ * @internal
6704
+ */
6705
+ private _validationFallbackMessage;
6706
+ /**
6707
+ * The validation message. Uses the browser's default validation message for native checkboxes if not otherwise
6708
+ * specified (e.g., via `setCustomValidity`).
6709
+ *
6710
+ * @internal
6711
+ */
6712
+ get validationMessage(): string;
6713
+ /**
6714
+ * The element's validity state.
6506
6715
  *
6507
6716
  * @public
6508
6717
  * @remarks
6509
- * HTML Attribute: orientation
6718
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
6719
+ */
6720
+ get validity(): ValidityState;
6721
+ /**
6722
+ * The current value of the checked radio.
6723
+ *
6724
+ * @public
6510
6725
  */
6511
- orientation: RadioGroupOrientation;
6512
- childItems: HTMLElement[];
6726
+ get value(): string | null;
6727
+ set value(next: string | null);
6513
6728
  /**
6729
+ * Sets the checked state of all radios when any radio emits a `change` event.
6730
+ *
6731
+ * @param e - the change event
6732
+ */
6733
+ changeHandler(e: Event): boolean | void;
6734
+ /**
6735
+ * Checks the radio at the specified index.
6736
+ *
6737
+ * @param index - the index of the radio to check
6514
6738
  * @internal
6515
6739
  */
6516
- slottedRadioButtons: HTMLElement[];
6517
- protected slottedRadioButtonsChanged(oldValue: unknown, newValue: HTMLElement[]): void;
6518
- private selectedRadio;
6519
- private focusedRadio;
6520
- private direction;
6521
- private get parentToolbar();
6522
- private get isInsideToolbar();
6523
- private get isInsideFoundationToolbar();
6740
+ checkRadio(index?: number): void;
6524
6741
  /**
6742
+ * Checks the validity of the element and returns the result.
6743
+ *
6744
+ * @public
6745
+ * @remarks
6746
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity | `HTMLInputElement.checkValidity()`} method.
6747
+ */
6748
+ checkValidity(): boolean;
6749
+ /**
6750
+ * Handles click events for the radio group.
6751
+ *
6752
+ * @param e - the click event
6525
6753
  * @internal
6526
6754
  */
6527
- connectedCallback(): void;
6528
- disconnectedCallback(): void;
6529
- private setupRadioButtons;
6530
- private radioChangeHandler;
6531
- private moveToRadioByIndex;
6532
- private moveRightOffGroup;
6533
- private moveLeftOffGroup;
6755
+ clickHandler(e: MouseEvent): boolean | void;
6756
+ constructor();
6534
6757
  /**
6758
+ * Focuses the checked radio or the first enabled radio.
6759
+ *
6535
6760
  * @internal
6536
6761
  */
6537
- focusOutHandler: (e: FocusEvent) => boolean | void;
6762
+ focus(): void;
6538
6763
  /**
6764
+ * Enables tabbing through the radio group when the group receives focus.
6765
+ *
6766
+ * @param e - the focus event
6539
6767
  * @internal
6540
6768
  */
6541
- handleDisabledClick: (e: MouseEvent) => void | boolean;
6769
+ focusinHandler(e: FocusEvent): boolean | void;
6542
6770
  /**
6771
+ * Sets the tabindex of the radios based on the checked state when the radio group loses focus.
6772
+ *
6773
+ * @param e - the focusout event
6543
6774
  * @internal
6544
6775
  */
6545
- clickHandler: (e: MouseEvent) => void | boolean;
6546
- private shouldMoveOffGroupToTheRight;
6547
- private shouldMoveOffGroupToTheLeft;
6548
- private checkFocusedRadio;
6549
- private moveRight;
6550
- private moveLeft;
6776
+ focusoutHandler(e: FocusEvent): boolean | void;
6777
+ formResetCallback(): void;
6778
+ private getEnabledIndexInBounds;
6551
6779
  /**
6552
- * keyboard handling per https://w3c.github.io/aria-practices/#for-radio-groups-not-contained-in-a-toolbar
6553
- * navigation is different when there is an ancestor with role='toolbar'
6780
+ * Handles keydown events for the radio group.
6554
6781
  *
6782
+ * @param e - the keyboard event
6555
6783
  * @internal
6556
6784
  */
6557
- keydownHandler: (e: KeyboardEvent) => boolean | void;
6785
+ keydownHandler(e: KeyboardEvent): boolean | void;
6786
+ /**
6787
+ *
6788
+ * @param e - the disabled event
6789
+ */
6790
+ disabledRadioHandler(e: CustomEvent): void;
6791
+ /**
6792
+ * Reports the validity of the element.
6793
+ *
6794
+ * @public
6795
+ * @remarks
6796
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
6797
+ */
6798
+ reportValidity(): boolean;
6799
+ /**
6800
+ * Resets the `tabIndex` for all child radios when the radio group loses focus.
6801
+ *
6802
+ * @internal
6803
+ */
6804
+ private restrictFocus;
6805
+ /**
6806
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
6807
+ *
6808
+ * @internal
6809
+ */
6810
+ setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
6811
+ /**
6812
+ * Sets the validity of the element.
6813
+ *
6814
+ * @param flags - Validity flags to set.
6815
+ * @param message - Optional message to supply. If not provided, the element's `validationMessage` will be used.
6816
+ * @param anchor - Optional anchor to use for the validation message.
6817
+ *
6818
+ * @internal
6819
+ */
6820
+ setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
6821
+ /**
6822
+ * Updates the collection of child radios when the slot changes.
6823
+ *
6824
+ * @param e - the slot change event
6825
+ * @internal
6826
+ */
6827
+ slotchangeHandler(e: Event): void;
6558
6828
  }
6559
6829
 
6560
6830
  /**
@@ -6600,11 +6870,18 @@ export declare type RadioOptions = {
6600
6870
  checkedIndicator?: StaticallyComposableHTML<Radio>;
6601
6871
  };
6602
6872
 
6603
- /** Radio styles
6873
+ /**
6874
+ * Styles for the Radio component
6875
+ *
6604
6876
  * @public
6605
6877
  */
6606
6878
  export declare const RadioStyles: ElementStyles;
6607
6879
 
6880
+ /**
6881
+ * Template for the Radio component
6882
+ *
6883
+ * @public
6884
+ */
6608
6885
  export declare const RadioTemplate: ElementViewTemplate<Radio>;
6609
6886
 
6610
6887
  /**
@@ -7151,6 +7428,8 @@ export declare type SlottableInput = HTMLElement & ElementInternals & {
7151
7428
  required: boolean;
7152
7429
  disabled: boolean;
7153
7430
  readOnly: boolean;
7431
+ checked?: boolean;
7432
+ value?: string;
7154
7433
  };
7155
7434
 
7156
7435
  /**
@@ -7440,6 +7719,7 @@ export { styles as ButtonStyles }
7440
7719
  export { styles as MenuButtonStyles }
7441
7720
 
7442
7721
  export declare class Switch extends BaseCheckbox {
7722
+ constructor();
7443
7723
  }
7444
7724
 
7445
7725
  /**