@fluentui/web-components 3.0.0-beta.24 → 3.0.0-beta.26

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 (81) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/dist/dts/checkbox/checkbox.d.ts +258 -32
  3. package/dist/dts/checkbox/checkbox.options.d.ts +13 -10
  4. package/dist/dts/checkbox/checkbox.template.d.ts +3 -2
  5. package/dist/dts/checkbox/index.d.ts +2 -2
  6. package/dist/dts/field/define.d.ts +1 -0
  7. package/dist/dts/field/field.bench.d.ts +3 -0
  8. package/dist/dts/field/field.d.ts +99 -0
  9. package/dist/dts/field/field.definition.d.ts +9 -0
  10. package/dist/dts/field/field.options.d.ts +41 -0
  11. package/dist/dts/field/field.styles.d.ts +6 -0
  12. package/dist/dts/field/field.template.d.ts +6 -0
  13. package/dist/dts/field/index.d.ts +6 -0
  14. package/dist/dts/index-rollup.d.ts +1 -0
  15. package/dist/dts/index.d.ts +2 -0
  16. package/dist/dts/switch/switch.d.ts +2 -39
  17. package/dist/dts/text-input/text-input.d.ts +50 -8
  18. package/dist/dts/utils/element-internals.d.ts +20 -0
  19. package/dist/esm/checkbox/checkbox.definition.js +1 -1
  20. package/dist/esm/checkbox/checkbox.definition.js.map +1 -1
  21. package/dist/esm/checkbox/checkbox.js +346 -41
  22. package/dist/esm/checkbox/checkbox.js.map +1 -1
  23. package/dist/esm/checkbox/checkbox.options.js +0 -8
  24. package/dist/esm/checkbox/checkbox.options.js.map +1 -1
  25. package/dist/esm/checkbox/checkbox.styles.js +145 -123
  26. package/dist/esm/checkbox/checkbox.styles.js.map +1 -1
  27. package/dist/esm/checkbox/checkbox.template.js +23 -34
  28. package/dist/esm/checkbox/checkbox.template.js.map +1 -1
  29. package/dist/esm/checkbox/index.js +1 -1
  30. package/dist/esm/checkbox/index.js.map +1 -1
  31. package/dist/esm/dialog/dialog.styles.js +9 -2
  32. package/dist/esm/dialog/dialog.styles.js.map +1 -1
  33. package/dist/esm/field/define.js +4 -0
  34. package/dist/esm/field/define.js.map +1 -0
  35. package/dist/esm/field/field.bench.js +10 -0
  36. package/dist/esm/field/field.bench.js.map +1 -0
  37. package/dist/esm/field/field.definition.js +20 -0
  38. package/dist/esm/field/field.definition.js.map +1 -0
  39. package/dist/esm/field/field.js +139 -0
  40. package/dist/esm/field/field.js.map +1 -0
  41. package/dist/esm/field/field.options.js +27 -0
  42. package/dist/esm/field/field.options.js.map +1 -0
  43. package/dist/esm/field/field.styles.js +186 -0
  44. package/dist/esm/field/field.styles.js.map +1 -0
  45. package/dist/esm/field/field.template.js +26 -0
  46. package/dist/esm/field/field.template.js.map +1 -0
  47. package/dist/esm/field/index.js +6 -0
  48. package/dist/esm/field/index.js.map +1 -0
  49. package/dist/esm/index-rollup.js +1 -0
  50. package/dist/esm/index-rollup.js.map +1 -1
  51. package/dist/esm/index.js +1 -0
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/label/label.styles.js +12 -5
  54. package/dist/esm/label/label.styles.js.map +1 -1
  55. package/dist/esm/switch/switch.js +2 -52
  56. package/dist/esm/switch/switch.js.map +1 -1
  57. package/dist/esm/switch/switch.styles.js +34 -55
  58. package/dist/esm/switch/switch.styles.js.map +1 -1
  59. package/dist/esm/switch/switch.template.js +6 -16
  60. package/dist/esm/switch/switch.template.js.map +1 -1
  61. package/dist/esm/text/text.styles.js +48 -24
  62. package/dist/esm/text/text.styles.js.map +1 -1
  63. package/dist/esm/text-input/text-input.definition.js +3 -0
  64. package/dist/esm/text-input/text-input.definition.js.map +1 -1
  65. package/dist/esm/text-input/text-input.js +78 -20
  66. package/dist/esm/text-input/text-input.js.map +1 -1
  67. package/dist/esm/text-input/text-input.styles.js +14 -9
  68. package/dist/esm/text-input/text-input.styles.js.map +1 -1
  69. package/dist/esm/text-input/text-input.template.js +39 -33
  70. package/dist/esm/text-input/text-input.template.js.map +1 -1
  71. package/dist/esm/theme/set-theme.js +10 -5
  72. package/dist/esm/theme/set-theme.js.map +1 -1
  73. package/dist/esm/utils/element-internals.js +32 -0
  74. package/dist/esm/utils/element-internals.js.map +1 -0
  75. package/dist/web-components.d.ts +506 -138
  76. package/dist/web-components.js +2264 -1692
  77. package/dist/web-components.min.js +243 -238
  78. package/package.json +1 -1
  79. package/dist/dts/checkbox/checkbox.form-associated.d.ts +0 -14
  80. package/dist/esm/checkbox/checkbox.form-associated.js +0 -14
  81. package/dist/esm/checkbox/checkbox.form-associated.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Thu, 06 Jun 2024 04:06:09 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 10 Jun 2024 04:07:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [3.0.0-beta.26](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.26)
8
+
9
+ Mon, 10 Jun 2024 04:07:51 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.25..@fluentui/web-components_v3.0.0-beta.26)
11
+
12
+ ### Changes
13
+
14
+ - feat: refactor Switch to use ElementInternals by extending BaseCheckbox ([PR #31613](https://github.com/microsoft/fluentui/pull/31613) by 13071055+chrisdholt@users.noreply.github.com)
15
+ - fixes the border-color for switch when in the checked state on rest ([PR #31628](https://github.com/microsoft/fluentui/pull/31628) by 13071055+chrisdholt@users.noreply.github.com)
16
+ - add try-catch block to ensure that registered properties can be updated dynamically ([PR #31629](https://github.com/microsoft/fluentui/pull/31629) by 13071055+chrisdholt@users.noreply.github.com)
17
+
18
+ ## [3.0.0-beta.25](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.25)
19
+
20
+ Fri, 07 Jun 2024 04:06:31 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.24..@fluentui/web-components_v3.0.0-beta.25)
22
+
23
+ ### Changes
24
+
25
+ - Use ElementInternals for Checkbox component ([PR #31468](https://github.com/microsoft/fluentui/pull/31468) by 863023+radium-v@users.noreply.github.com)
26
+ - Move dialog border styles to forcedColors mode ([PR #31609](https://github.com/microsoft/fluentui/pull/31609) by rupertdavid@microsoft.com)
27
+
7
28
  ## [3.0.0-beta.24](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.24)
8
29
 
9
- Thu, 06 Jun 2024 04:06:09 GMT
30
+ Thu, 06 Jun 2024 04:06:19 GMT
10
31
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.23..@fluentui/web-components_v3.0.0-beta.24)
11
32
 
12
33
  ### Changes
@@ -1,75 +1,301 @@
1
- import type { StaticallyComposableHTML } from '../utils/template-helpers.js';
2
- import { FormAssociatedCheckbox } from './checkbox.form-associated.js';
3
- import { CheckboxLabelPosition, CheckboxShape, CheckboxSize } from './checkbox.options.js';
4
- /**
5
- * Checkbox configuration options
6
- * @public
7
- */
8
- export type CheckboxOptions = {
9
- checkedIndicator?: StaticallyComposableHTML<Checkbox>;
10
- indeterminateIndicator?: StaticallyComposableHTML<Checkbox>;
11
- };
1
+ import { FASTElement } from '@microsoft/fast-element';
2
+ import { CheckboxShape, CheckboxSize } from './checkbox.options.js';
12
3
  /**
13
4
  * A Checkbox Custom HTML Element.
14
5
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
15
6
  *
16
7
  * @slot checked-indicator - The checked indicator
17
8
  * @slot indeterminate-indicator - The indeterminate indicator
18
- * @slot - The default slot for the label
19
- * @csspart control - The element representing the visual checkbox control
20
- * @csspart label - The label
21
9
  * @fires change - Emits a custom change event when the checked state changes
10
+ * @fires input - Emits a custom input event when the checked state changes
22
11
  *
23
12
  * @public
24
13
  */
25
- export declare class Checkbox extends FormAssociatedCheckbox {
14
+ export declare class BaseCheckbox extends FASTElement {
26
15
  /**
27
- * Sets shape of the checkbox.
16
+ * Indicates that the element should get focus after the page finishes loading.
17
+ * @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#autofocus | `autofocus`} attribute
28
18
  *
29
19
  * @public
30
20
  * @remarks
31
- * HTML Attribute: shape
21
+ * HTML Attribute: `autofocus`
32
22
  */
33
- shape?: CheckboxShape;
23
+ autofocus: boolean;
34
24
  /**
35
- * Sets size of the checkbox.
25
+ * The element's current checked state.
36
26
  *
37
27
  * @public
28
+ */
29
+ get checked(): boolean;
30
+ set checked(state: boolean);
31
+ /**
32
+ * The element's disabled state.
33
+ * @public
38
34
  * @remarks
39
- * HTML Attribute: size
35
+ * HTML Attribute: `disabled`
40
36
  */
41
- size?: CheckboxSize;
37
+ disabled: boolean;
38
+ /**
39
+ * The id of a form to associate the element to.
40
+ * @see The {@link https://developer.mozilla.org/docs/Web/HTML/Element/input#form | `form`} attribute
41
+ *
42
+ * @public
43
+ * @remarks
44
+ * HTML Attribute: `form`
45
+ */
46
+ formAttribute?: string;
47
+ /**
48
+ * Indicates that the element is in an indeterminate or mixed state.
49
+ *
50
+ * @public
51
+ */
52
+ indeterminate?: boolean;
53
+ /**
54
+ * Synchronizes the element's indeterminate state with the internal ElementInternals state.
55
+ *
56
+ * @internal
57
+ */
58
+ indeterminateChanged(prev: boolean, next: boolean): void;
42
59
  /**
43
- * Sets position of the label relative to the input
60
+ * The element's checked state.
44
61
  *
45
62
  * @public
46
63
  * @remarks
47
- * HTML Attribute: label-position
64
+ * HTML Attribute: `checked`
48
65
  */
49
- labelPosition?: CheckboxLabelPosition;
66
+ initialChecked?: boolean;
50
67
  /**
51
- * The element's value to be included in form submission when checked.
52
- * Default to "on" to reach parity with input[type="checkbox"]
68
+ * Updates the form value when the checked state changes.
53
69
  *
54
70
  * @internal
55
71
  */
72
+ initialCheckedChanged(prev: boolean | undefined, next: boolean): void;
73
+ /**
74
+ * The initial value of the input.
75
+ *
76
+ * @public
77
+ * @remarks
78
+ * HTML Attribute: `value`
79
+ */
56
80
  initialValue: string;
57
81
  /**
82
+ * Sets the value of the input when the value attribute changes.
83
+ *
84
+ * @param prev - The previous value
85
+ * @param next - The current value
58
86
  * @internal
59
87
  */
60
- defaultSlottedNodes: Node[];
88
+ initialValueChanged(prev: string, next: string): void;
61
89
  /**
62
- * The indeterminate state of the control
90
+ * The name of the element. This element's value will be surfaced during form submission under the provided name.
91
+ *
92
+ * @public
93
+ * @remarks
94
+ * HTML Attribute: `name`
95
+ */
96
+ name: string;
97
+ /**
98
+ * The element's required state.
99
+ *
100
+ * @public
101
+ * @remarks
102
+ * HTML Attribute: `required`
103
+ */
104
+ required: boolean;
105
+ /**
106
+ * Sets the validity of the control when the required state changes.
107
+ *
108
+ * @param prev - The previous required state
109
+ * @param next - The current required state
110
+ * @internal
63
111
  */
64
- indeterminate: boolean;
112
+ requiredChanged(prev: boolean, next: boolean): void;
113
+ /**
114
+ * The internal checked state of the control.
115
+ *
116
+ * @internal
117
+ */
118
+ private _checked;
119
+ /**
120
+ * Indicates that the checked state has been changed by the user.
121
+ *
122
+ * @internal
123
+ */
124
+ private dirtyChecked;
125
+ /**
126
+ * The associated `<form>` element.
127
+ *
128
+ * @public
129
+ * @remarks
130
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/form | `ElementInternals.form`} property.
131
+ */
132
+ get form(): HTMLFormElement | null;
133
+ /**
134
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
135
+ *
136
+ * @internal
137
+ */
138
+ elementInternals: ElementInternals;
139
+ /**
140
+ * The form-associated flag.
141
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
142
+ *
143
+ * @public
144
+ */
145
+ static formAssociated: boolean;
146
+ /**
147
+ * A reference to all associated `<label>` elements.
148
+ *
149
+ * @public
150
+ */
151
+ get labels(): ReadonlyArray<Node>;
152
+ /**
153
+ * The fallback validation message, taken from a native checkbox `<input>` element.
154
+ *
155
+ * @internal
156
+ */
157
+ private _validationFallbackMessage;
158
+ /**
159
+ * The validation message. Uses the browser's default validation message for native checkboxes if not otherwise
160
+ * specified (e.g., via `setCustomValidity`).
161
+ *
162
+ * @public
163
+ * @remarks
164
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage | `ElementInternals.validationMessage`} property.
165
+ */
166
+ get validationMessage(): string;
167
+ /**
168
+ * The element's validity state.
169
+ *
170
+ * @public
171
+ * @remarks
172
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/validity | `ElementInternals.validity`} property.
173
+ */
174
+ get validity(): ValidityState;
175
+ /**
176
+ * The internal value of the input.
177
+ *
178
+ * @internal
179
+ */
180
+ private _value;
181
+ /**
182
+ * The current value of the input.
183
+ *
184
+ * @public
185
+ */
186
+ get value(): string;
187
+ set value(value: string);
188
+ /**
189
+ * Determines if the control can be submitted for constraint validation.
190
+ *
191
+ * @public
192
+ * @remarks
193
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate | `ElementInternals.willValidate`} property.
194
+ */
195
+ get willValidate(): boolean;
196
+ /**
197
+ * Sets the `elementInternals.ariaChecked` value based on the checked state.
198
+ *
199
+ * @internal
200
+ */
201
+ private setAriaChecked;
202
+ /**
203
+ * Checks the validity of the element and returns the result.
204
+ *
205
+ * @public
206
+ * @remarks
207
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity | `HTMLInputElement.checkValidity()`} method.
208
+ */
209
+ checkValidity(): boolean;
210
+ /**
211
+ * Toggles the checked state when the user clicks the element.
212
+ *
213
+ * @param e - the event object
214
+ * @internal
215
+ */
216
+ clickHandler(e: MouseEvent): boolean | void;
217
+ connectedCallback(): void;
65
218
  constructor();
66
- private toggleChecked;
67
219
  /**
220
+ * Updates the form value when a user changes the `checked` state.
221
+ *
222
+ * @param e - the event object
223
+ * @internal
224
+ */
225
+ inputHandler(e: Event): boolean | void;
226
+ /**
227
+ * Prevents scrolling when the user presses the space key.
228
+ *
229
+ * @param e - the event object
230
+ * @internal
231
+ */
232
+ keydownHandler(e: KeyboardEvent): boolean | void;
233
+ /**
234
+ * Toggles the checked state when the user releases the space key.
235
+ *
236
+ * @param e - the event object
68
237
  * @internal
69
238
  */
70
- keypressHandler: (e: KeyboardEvent) => void;
239
+ keyupHandler(e: KeyboardEvent): boolean | void;
71
240
  /**
241
+ * Resets the form value to its initial value when the form is reset.
242
+ *
72
243
  * @internal
73
244
  */
74
- clickHandler: (e: MouseEvent) => void;
245
+ formResetCallback(): void;
246
+ /**
247
+ * Reports the validity of the element.
248
+ *
249
+ * @public
250
+ * @remarks
251
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity | `HTMLInputElement.reportValidity()`} method.
252
+ */
253
+ reportValidity(): boolean;
254
+ /**
255
+ * Reflects the {@link https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue | `ElementInternals.setFormValue()`} method.
256
+ *
257
+ * @internal
258
+ */
259
+ setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
260
+ /**
261
+ * Sets a custom validity message.
262
+ *
263
+ * @param message - The message to set
264
+ * @public
265
+ */
266
+ setCustomValidity(message: string): void;
267
+ /**
268
+ * Sets the validity of the control.
269
+ *
270
+ * @param flags - Validity flags to set.
271
+ * @param message - Optional message to supply. If not provided, the control's `validationMessage` will be used.
272
+ * @param anchor - Optional anchor to use for the validation message.
273
+ *
274
+ * @internal
275
+ */
276
+ setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
277
+ /**
278
+ * Toggles the checked state of the control.
279
+ *
280
+ * @public
281
+ */
282
+ private toggleChecked;
283
+ }
284
+ export declare class Checkbox extends BaseCheckbox {
285
+ /**
286
+ * Indicates the shape of the checkbox.
287
+ *
288
+ * @public
289
+ * @remarks
290
+ * HTML Attribute: `shape`
291
+ */
292
+ shape: CheckboxShape;
293
+ /**
294
+ * Indicates the size of the checkbox.
295
+ *
296
+ * @public
297
+ * @remarks
298
+ * HTML Attribute: `size`
299
+ */
300
+ size?: CheckboxSize;
75
301
  }
@@ -1,4 +1,14 @@
1
- import type { ValuesOf } from '../utils/index.js';
1
+ import type { StaticallyComposableHTML } from '../utils/template-helpers.js';
2
+ import type { ValuesOf } from '../utils/typings.js';
3
+ import type { Checkbox } from './checkbox.js';
4
+ /**
5
+ * Checkbox configuration options
6
+ * @public
7
+ */
8
+ export type CheckboxOptions = {
9
+ checkedIndicator?: StaticallyComposableHTML<Checkbox>;
10
+ indeterminateIndicator?: StaticallyComposableHTML<Checkbox>;
11
+ };
2
12
  /**
3
13
  * Checkbox shape
4
14
  * @public
@@ -7,6 +17,7 @@ export declare const CheckboxShape: {
7
17
  readonly circular: "circular";
8
18
  readonly square: "square";
9
19
  };
20
+ /** @public */
10
21
  export type CheckboxShape = ValuesOf<typeof CheckboxShape>;
11
22
  /**
12
23
  * Checkbox size
@@ -16,13 +27,5 @@ export declare const CheckboxSize: {
16
27
  readonly medium: "medium";
17
28
  readonly large: "large";
18
29
  };
30
+ /** @public */
19
31
  export type CheckboxSize = ValuesOf<typeof CheckboxSize>;
20
- /**
21
- * Checkbox label position
22
- * @public
23
- */
24
- export declare const CheckboxLabelPosition: {
25
- readonly before: "before";
26
- readonly after: "after";
27
- };
28
- export type CheckboxLabelPosition = ValuesOf<typeof CheckboxLabelPosition>;
@@ -1,5 +1,6 @@
1
- import { ElementViewTemplate } from '@microsoft/fast-element';
2
- import type { Checkbox, CheckboxOptions } from './checkbox.js';
1
+ import type { ElementViewTemplate } from '@microsoft/fast-element';
2
+ import type { Checkbox } from './checkbox.js';
3
+ import type { CheckboxOptions } from './checkbox.options.js';
3
4
  /**
4
5
  * Template for the Checkbox component
5
6
  * @public
@@ -1,6 +1,6 @@
1
1
  export { definition as CheckboxDefinition } from './checkbox.definition.js';
2
2
  export { Checkbox } from './checkbox.js';
3
- export type { CheckboxOptions } from './checkbox.js';
4
- export { CheckboxLabelPosition, CheckboxShape, CheckboxSize } from './checkbox.options.js';
3
+ export { CheckboxShape, CheckboxSize } from './checkbox.options.js';
4
+ export type { CheckboxOptions } from './checkbox.options.js';
5
5
  export { styles as CheckboxStyles } from './checkbox.styles.js';
6
6
  export { template as CheckboxTemplate } from './checkbox.template.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ declare const itemRenderer: () => HTMLElement;
2
+ export default itemRenderer;
3
+ export { tests } from '../utils/benchmark-wrapper.js';
@@ -0,0 +1,99 @@
1
+ import { FASTElement } from '@microsoft/fast-element';
2
+ import { LabelPosition, SlottableInput } from './field.options.js';
3
+ /**
4
+ * A Field Custom HTML Element.
5
+ *
6
+ * @public
7
+ */
8
+ export declare class Field extends FASTElement {
9
+ /**
10
+ * The position of the label relative to the input.
11
+ *
12
+ * @public
13
+ * @remarks
14
+ * HTML Attribute: `label-position`
15
+ */
16
+ labelPosition: LabelPosition;
17
+ /**
18
+ * The slotted message elements. Filtered to only include elements with a `flag` attribute.
19
+ *
20
+ * @internal
21
+ */
22
+ messageSlot: Element[];
23
+ /**
24
+ * Adds or removes the `invalid` event listener based on the presence of slotted message elements.
25
+ *
26
+ * @param prev - the previous list of slotted message elements
27
+ * @param next - the current list of slotted message elements
28
+ * @internal
29
+ */
30
+ messageSlotChanged(prev: Element[], next: Element[]): void;
31
+ /**
32
+ * The slotted inputs.
33
+ *
34
+ * @internal
35
+ * @privateRemarks
36
+ * This field is populated with the `children` directive in the template rather than `slotted`.
37
+ */
38
+ slottedInputs: SlottableInput[];
39
+ /**
40
+ * Sets the `input` property to the first slotted input.
41
+ *
42
+ * @param prev - The previous collection of inputs.
43
+ * @param next - The current collection of inputs.
44
+ * @internal
45
+ */
46
+ slottedInputsChanged(prev: SlottableInput[] | undefined, next: SlottableInput[] | undefined): void;
47
+ /**
48
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
49
+ *
50
+ * @internal
51
+ */
52
+ elementInternals: ElementInternals;
53
+ /**
54
+ * Reference to the first slotted input.
55
+ *
56
+ * @public
57
+ */
58
+ input: SlottableInput;
59
+ /**
60
+ * Calls the `setStates` method when a `change` event is emitted from the slotted input.
61
+ *
62
+ * @param e - the event object
63
+ * @internal
64
+ */
65
+ changeHandler(e: Event): void;
66
+ /**
67
+ * Redirects `click` events to the slotted input.
68
+ *
69
+ * @internal
70
+ */
71
+ clickHandler(e: MouseEvent): boolean | void;
72
+ /**
73
+ * Applies the `focus-visible` state to the element when the slotted input receives visible focus.
74
+ *
75
+ * @param e - the focus event
76
+ * @internal
77
+ */
78
+ focusinHandler(e: FocusEvent): boolean | void;
79
+ /**
80
+ * Removes the `focus-visible` state from the field when a slotted input loses focus.
81
+ *
82
+ * @param e - the focus event
83
+ * @internal
84
+ */
85
+ focusoutHandler(e: FocusEvent): boolean | void;
86
+ /**
87
+ * Toggles validity state flags on the element when the slotted input emits an `invalid` event (if slotted validation messages are present).
88
+ *
89
+ * @param e - the event object
90
+ * @internal
91
+ */
92
+ invalidHandler(e: Event): boolean | void;
93
+ /**
94
+ * Toggles the field's states based on the slotted input.
95
+ *
96
+ * @internal
97
+ */
98
+ setStates(): void;
99
+ }
@@ -0,0 +1,9 @@
1
+ import { Field } from './field.js';
2
+ /**
3
+ * The Fluent Field Element
4
+ *
5
+ * @public
6
+ * @remarks
7
+ * HTML Element: `<fluent-field>`
8
+ */
9
+ export declare const definition: import("@microsoft/fast-element").FASTElementDefinition<typeof Field>;
@@ -0,0 +1,41 @@
1
+ import type { ValuesOf } from '../utils/typings.js';
2
+ /**
3
+ * Label position values
4
+ * @public
5
+ */
6
+ export declare const LabelPosition: {
7
+ readonly above: "above";
8
+ readonly after: "after";
9
+ readonly before: "before";
10
+ };
11
+ /** @public */
12
+ export type LabelPosition = ValuesOf<typeof LabelPosition>;
13
+ /**
14
+ * Synthetic type for slotted input elements
15
+ * @public
16
+ */
17
+ export type SlottableInput = HTMLElement & ElementInternals & {
18
+ elementInternals?: ElementInternals;
19
+ required: boolean;
20
+ disabled: boolean;
21
+ readOnly: boolean;
22
+ };
23
+ /**
24
+ * Synthetic type for slotted message elements
25
+ * @public
26
+ */
27
+ export declare const ValidationFlags: {
28
+ readonly badInput: "bad-input";
29
+ readonly customError: "custom-error";
30
+ readonly patternMismatch: "pattern-mismatch";
31
+ readonly rangeOverflow: "range-overflow";
32
+ readonly rangeUnderflow: "range-underflow";
33
+ readonly stepMismatch: "step-mismatch";
34
+ readonly tooLong: "too-long";
35
+ readonly tooShort: "too-short";
36
+ readonly typeMismatch: "type-mismatch";
37
+ readonly valueMissing: "value-missing";
38
+ readonly valid: "valid";
39
+ };
40
+ /** @public */
41
+ export type ValidationFlags = ValuesOf<typeof ValidationFlags>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The styles for the {@link Field} component.
3
+ *
4
+ * @public
5
+ */
6
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,6 @@
1
+ import { ElementViewTemplate } from '@microsoft/fast-element';
2
+ /**
3
+ * Template for the Field component
4
+ * @public
5
+ */
6
+ export declare const template: ElementViewTemplate;
@@ -0,0 +1,6 @@
1
+ export { Field } from './field.js';
2
+ export { LabelPosition as FieldLabelPosition, ValidationFlags } from './field.options.js';
3
+ export type { SlottableInput } from './field.options.js';
4
+ export { definition as FieldDefinition } from './field.definition.js';
5
+ export { styles as FieldStyles } from './field.styles.js';
6
+ export { template as FieldTemplate } from './field.template.js';
@@ -10,6 +10,7 @@ import './counter-badge/define.js';
10
10
  import './dialog/define.js';
11
11
  import './dialog-body/define.js';
12
12
  import './divider/define.js';
13
+ import './field/define.js';
13
14
  import './image/define.js';
14
15
  import './label/define.js';
15
16
  import './menu-button/define.js';
@@ -14,6 +14,8 @@ export { CounterBadge, CounterBadgeAppearance, CounterBadgeColor, CounterBadgeDe
14
14
  export { Dialog, DialogType, DialogDefinition, DialogTemplate, DialogStyles } from './dialog/index.js';
15
15
  export { DialogBody, DialogBodyDefinition, DialogBodyTemplate, DialogBodyStyles } from './dialog-body/index.js';
16
16
  export { Divider, DividerAlignContent, DividerAppearance, DividerDefinition, DividerOrientation, DividerRole, DividerStyles, DividerTemplate, } from './divider/index.js';
17
+ export { Field, FieldLabelPosition, ValidationFlags, FieldDefinition, FieldStyles, FieldTemplate, } from './field/index.js';
18
+ export type { SlottableInput } from './field/index.js';
17
19
  export { FluentDesignSystem } from './fluent-design-system.js';
18
20
  export { Image, ImageDefinition, ImageFit, ImageShape, ImageStyles, ImageTemplate } from './image/index.js';
19
21
  export { Label, LabelDefinition, LabelSize, LabelStyles, LabelTemplate, LabelWeight } from './label/index.js';
@@ -1,44 +1,7 @@
1
1
  import type { StaticallyComposableHTML } from '../utils/index.js';
2
- import { SwitchLabelPosition } from './switch.options.js';
3
- import { FormAssociatedSwitch } from './switch.form-associated.js';
2
+ import { BaseCheckbox } from '../checkbox/checkbox.js';
4
3
  export type SwitchOptions = {
5
4
  switch?: StaticallyComposableHTML<Switch>;
6
5
  };
7
- export declare class Switch extends FormAssociatedSwitch {
8
- /**
9
- * The label position of the switch
10
- *
11
- * @public
12
- * @remarks
13
- * HTML Attribute: labelposition
14
- */
15
- labelPosition: SwitchLabelPosition | undefined;
16
- /**
17
- * When true, the control 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.
18
- * @public
19
- * @remarks
20
- * HTML Attribute: readonly
21
- */
22
- readOnly: boolean;
23
- protected readOnlyChanged(): void;
24
- /**
25
- * The element's value to be included in form submission when checked.
26
- * Default to "on" to reach parity with input[type="checkbox"]
27
- *
28
- * @internal
29
- */
30
- initialValue: string;
31
- /**
32
- * @internal
33
- */
34
- defaultSlottedNodes: Node[];
35
- constructor();
36
- /**
37
- * @internal
38
- */
39
- keypressHandler: (e: KeyboardEvent) => void;
40
- /**
41
- * @internal
42
- */
43
- clickHandler: (e: MouseEvent) => void;
6
+ export declare class Switch extends BaseCheckbox {
44
7
  }