@fluentui/web-components 3.0.0-beta.10 → 3.0.0-beta.12

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 (109) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/dts/button/button.d.ts +173 -90
  3. package/dist/dts/button/button.definition.d.ts +3 -1
  4. package/dist/dts/button/button.options.d.ts +16 -1
  5. package/dist/dts/button/button.styles.d.ts +5 -0
  6. package/dist/dts/button/button.template.d.ts +7 -1
  7. package/dist/dts/form-associated/form-associated.d.ts +0 -74
  8. package/dist/dts/index.d.ts +3 -0
  9. package/dist/dts/toggle-button/toggle-button.d.ts +29 -26
  10. package/dist/dts/toggle-button/toggle-button.styles.d.ts +7 -0
  11. package/dist/dts/utils/behaviors/match-media-stylesheet-behavior.d.ts +124 -0
  12. package/dist/dts/utils/display.d.ts +17 -0
  13. package/dist/dts/utils/index.d.ts +2 -0
  14. package/dist/esm/accordion/accordion.styles.js +1 -1
  15. package/dist/esm/accordion/accordion.styles.js.map +1 -1
  16. package/dist/esm/accordion-item/accordion-item.styles.js +1 -1
  17. package/dist/esm/accordion-item/accordion-item.styles.js.map +1 -1
  18. package/dist/esm/anchor-button/anchor-button.styles.js +254 -3
  19. package/dist/esm/anchor-button/anchor-button.styles.js.map +1 -1
  20. package/dist/esm/avatar/avatar.styles.js +1 -1
  21. package/dist/esm/avatar/avatar.styles.js.map +1 -1
  22. package/dist/esm/button/button.definition.js +3 -4
  23. package/dist/esm/button/button.definition.js.map +1 -1
  24. package/dist/esm/button/button.js +233 -126
  25. package/dist/esm/button/button.js.map +1 -1
  26. package/dist/esm/button/button.options.js +10 -0
  27. package/dist/esm/button/button.options.js.map +1 -1
  28. package/dist/esm/button/button.styles.js +52 -55
  29. package/dist/esm/button/button.styles.js.map +1 -1
  30. package/dist/esm/button/button.template.js +13 -39
  31. package/dist/esm/button/button.template.js.map +1 -1
  32. package/dist/esm/checkbox/checkbox.styles.js +1 -1
  33. package/dist/esm/checkbox/checkbox.styles.js.map +1 -1
  34. package/dist/esm/compound-button/compound-button.definition.js +0 -3
  35. package/dist/esm/compound-button/compound-button.definition.js.map +1 -1
  36. package/dist/esm/compound-button/compound-button.styles.js +7 -7
  37. package/dist/esm/compound-button/compound-button.template.js +3 -39
  38. package/dist/esm/compound-button/compound-button.template.js.map +1 -1
  39. package/dist/esm/dialog/dialog.styles.js +1 -1
  40. package/dist/esm/dialog/dialog.styles.js.map +1 -1
  41. package/dist/esm/divider/divider.styles.js +1 -1
  42. package/dist/esm/divider/divider.styles.js.map +1 -1
  43. package/dist/esm/form-associated/form-associated.js.map +1 -1
  44. package/dist/esm/index.js +3 -0
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/label/label.styles.js +1 -1
  47. package/dist/esm/label/label.styles.js.map +1 -1
  48. package/dist/esm/menu-button/menu-button.definition.js +0 -3
  49. package/dist/esm/menu-button/menu-button.definition.js.map +1 -1
  50. package/dist/esm/menu-button/menu-button.template.js +5 -1
  51. package/dist/esm/menu-button/menu-button.template.js.map +1 -1
  52. package/dist/esm/menu-item/menu-item.styles.js +1 -1
  53. package/dist/esm/menu-item/menu-item.styles.js.map +1 -1
  54. package/dist/esm/menu-list/menu-list.styles.js +1 -1
  55. package/dist/esm/menu-list/menu-list.styles.js.map +1 -1
  56. package/dist/esm/progress-bar/progress-bar.styles.js +1 -1
  57. package/dist/esm/progress-bar/progress-bar.styles.js.map +1 -1
  58. package/dist/esm/radio/radio.styles.js +1 -1
  59. package/dist/esm/radio/radio.styles.js.map +1 -1
  60. package/dist/esm/radio-group/radio-group.styles.js +1 -1
  61. package/dist/esm/radio-group/radio-group.styles.js.map +1 -1
  62. package/dist/esm/slider/slider.styles.js +1 -1
  63. package/dist/esm/slider/slider.styles.js.map +1 -1
  64. package/dist/esm/spinner/spinner.styles.js +1 -1
  65. package/dist/esm/spinner/spinner.styles.js.map +1 -1
  66. package/dist/esm/styles/partials/badge.partials.js +1 -1
  67. package/dist/esm/styles/partials/badge.partials.js.map +1 -1
  68. package/dist/esm/switch/switch.styles.js +1 -1
  69. package/dist/esm/switch/switch.styles.js.map +1 -1
  70. package/dist/esm/tab/tab.styles.js +1 -1
  71. package/dist/esm/tab/tab.styles.js.map +1 -1
  72. package/dist/esm/tab-panel/tab-panel.styles.js +1 -1
  73. package/dist/esm/tab-panel/tab-panel.styles.js.map +1 -1
  74. package/dist/esm/tabs/tabs.styles.js +1 -1
  75. package/dist/esm/tabs/tabs.styles.js.map +1 -1
  76. package/dist/esm/text/text.styles.js +1 -1
  77. package/dist/esm/text/text.styles.js.map +1 -1
  78. package/dist/esm/text-input/text-input.styles.js +1 -1
  79. package/dist/esm/text-input/text-input.styles.js.map +1 -1
  80. package/dist/esm/toggle-button/toggle-button.definition.js +0 -3
  81. package/dist/esm/toggle-button/toggle-button.definition.js.map +1 -1
  82. package/dist/esm/toggle-button/toggle-button.js +42 -85
  83. package/dist/esm/toggle-button/toggle-button.js.map +1 -1
  84. package/dist/esm/toggle-button/toggle-button.styles.js +31 -26
  85. package/dist/esm/toggle-button/toggle-button.styles.js.map +1 -1
  86. package/dist/esm/utils/behaviors/match-media-stylesheet-behavior.js +142 -0
  87. package/dist/esm/utils/behaviors/match-media-stylesheet-behavior.js.map +1 -0
  88. package/dist/esm/utils/display.js +15 -0
  89. package/dist/esm/utils/display.js.map +1 -0
  90. package/dist/esm/utils/index.js +2 -0
  91. package/dist/esm/utils/index.js.map +1 -1
  92. package/dist/fluent-web-components.api.json +1213 -771
  93. package/dist/storybook/{284.0946b1fb.iframe.bundle.js → 289.703b1698.iframe.bundle.js} +2 -2
  94. package/dist/storybook/{284.0946b1fb.iframe.bundle.js.LICENSE.txt → 289.703b1698.iframe.bundle.js.LICENSE.txt} +1 -1
  95. package/dist/storybook/iframe.html +1 -1
  96. package/dist/storybook/main.d55b693e.iframe.bundle.js +2 -0
  97. package/dist/storybook/project.json +1 -1
  98. package/dist/web-components.d.ts +407 -219
  99. package/dist/web-components.js +807 -671
  100. package/dist/web-components.min.js +140 -139
  101. package/docs/api-report.md +107 -77
  102. package/package.json +4 -3
  103. package/playwright.config.ts +2 -3
  104. package/tensile.config.js +0 -2
  105. package/dist/dts/button/button.form-associated.d.ts +0 -14
  106. package/dist/esm/button/button.form-associated.js +0 -14
  107. package/dist/esm/button/button.form-associated.js.map +0 -1
  108. package/dist/storybook/main.b9de79ac.iframe.bundle.js +0 -2
  109. /package/dist/storybook/{main.b9de79ac.iframe.bundle.js.LICENSE.txt → main.d55b693e.iframe.bundle.js.LICENSE.txt} +0 -0
@@ -4,6 +4,8 @@ import { ElementStyles } from '@microsoft/fast-element';
4
4
  import { ElementViewTemplate } from '@microsoft/fast-element';
5
5
  import { FASTElement } from '@microsoft/fast-element';
6
6
  import { FASTElementDefinition } from '@microsoft/fast-element';
7
+ import type { HostBehavior } from '@microsoft/fast-element';
8
+ import type { HostController } from '@microsoft/fast-element';
7
9
  import { HTMLDirective } from '@microsoft/fast-element';
8
10
  import { Orientation } from '@microsoft/fast-web-utilities';
9
11
  import type { SyntheticViewTemplate } from '@microsoft/fast-element';
@@ -1216,171 +1218,276 @@ export declare const borderRadiusXLarge = "var(--borderRadiusXLarge)";
1216
1218
 
1217
1219
  /**
1218
1220
  * A Button Custom HTML Element.
1219
- * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element }.
1221
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | `<button>`} element.
1220
1222
  *
1221
1223
  * @slot start - Content which can be provided before the button content
1222
1224
  * @slot end - Content which can be provided after the button content
1223
1225
  * @slot - The default slot for button content
1224
- * @csspart control - The button element
1225
- * @csspart content - The element wrapping button content
1226
+ * @csspart content - The button content container
1226
1227
  *
1227
1228
  * @public
1228
1229
  */
1229
- export declare class Button extends FormAssociatedButton {
1230
+ export declare class Button extends FASTElement {
1230
1231
  /**
1231
- * Determines if the element should receive document focus on page load.
1232
+ * Indicates the styled appearance of the button.
1232
1233
  *
1233
1234
  * @public
1234
1235
  * @remarks
1235
- * HTML Attribute: autofocus
1236
+ * HTML Attribute: `appearance`
1237
+ */
1238
+ appearance?: ButtonAppearance;
1239
+ /**
1240
+ * Indicates the button should be focused when the page is loaded.
1241
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#autofocus | `autofocus`} attribute
1242
+ *
1243
+ * @public
1244
+ * @remarks
1245
+ * HTML Attribute: `autofocus`
1236
1246
  */
1237
1247
  autofocus: boolean;
1238
1248
  /**
1239
- * The id of a form to associate the element to.
1249
+ * Default slotted content.
1250
+ *
1251
+ * @public
1252
+ */
1253
+ defaultSlottedContent: HTMLElement[];
1254
+ /**
1255
+ * Sets the element's disabled state.
1256
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled | `disabled`} attribute
1240
1257
  *
1241
1258
  * @public
1242
1259
  * @remarks
1243
- * HTML Attribute: form
1260
+ * HTML Attribute: `disabled`
1244
1261
  */
1245
- formId: string;
1262
+ disabled?: boolean;
1246
1263
  /**
1247
- * See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element} for more details.
1264
+ * Indicates that the button is focusable while disabled.
1248
1265
  *
1249
1266
  * @public
1250
1267
  * @remarks
1251
- * HTML Attribute: formaction
1268
+ * HTML Attribute: `disabled-focusable`
1252
1269
  */
1253
- formaction: string;
1254
- protected formactionChanged(): void;
1270
+ disabledFocusable: boolean;
1255
1271
  /**
1256
- * See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element} for more details.
1272
+ * Sets the element's internal disabled state when the element is focusable while disabled.
1273
+ *
1274
+ * @param previous - the previous disabledFocusable value
1275
+ * @param next - the current disabledFocusable value
1276
+ * @internal
1277
+ */
1278
+ disabledFocusableChanged(previous: boolean, next: boolean): void;
1279
+ /**
1280
+ * The internal {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
1281
+ *
1282
+ * @internal
1283
+ */
1284
+ protected elementInternals: ElementInternals;
1285
+ /**
1286
+ * The associated form element.
1287
+ *
1288
+ * @public
1289
+ */
1290
+ get form(): HTMLFormElement | null;
1291
+ /**
1292
+ * The URL that processes the form submission.
1293
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formaction | `formaction`} attribute
1257
1294
  *
1258
1295
  * @public
1259
1296
  * @remarks
1260
- * HTML Attribute: formenctype
1297
+ * HTML Attribute: `formaction`
1261
1298
  */
1262
- formenctype: string;
1263
- protected formenctypeChanged(): void;
1299
+ formAction?: string;
1264
1300
  /**
1265
- * See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element} for more details.
1301
+ * The form-associated flag.
1302
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example | Form-associated custom elements}
1303
+ *
1304
+ * @public
1305
+ */
1306
+ static readonly formAssociated = true;
1307
+ /**
1308
+ * The id of a form to associate the element to.
1309
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form | `form`} attribute
1266
1310
  *
1267
1311
  * @public
1268
1312
  * @remarks
1269
- * HTML Attribute: formmethod
1313
+ * HTML Attribute: `form`
1270
1314
  */
1271
- formmethod: string;
1272
- protected formmethodChanged(): void;
1315
+ formAttribute?: string;
1273
1316
  /**
1274
- * See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element} for more details.
1317
+ * The encoding type for the form submission.
1318
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formenctype | `formenctype`} attribute
1275
1319
  *
1276
1320
  * @public
1277
1321
  * @remarks
1278
- * HTML Attribute: formnovalidate
1322
+ * HTML Attribute: `formenctype`
1279
1323
  */
1280
- formnovalidate: boolean;
1281
- protected formnovalidateChanged(): void;
1324
+ formEnctype?: string;
1282
1325
  /**
1283
- * See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element} for more details.
1326
+ * The HTTP method that the browser uses to submit the form.
1327
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formmethod | `formmethod`} attribute
1284
1328
  *
1285
1329
  * @public
1286
1330
  * @remarks
1287
- * HTML Attribute: formtarget
1331
+ * HTML Attribute: `formmethod`
1288
1332
  */
1289
- formtarget: '_self' | '_blank' | '_parent' | '_top';
1290
- protected formtargetChanged(): void;
1333
+ formMethod?: string;
1291
1334
  /**
1292
- * The button type.
1335
+ * Indicates that the form will not be validated when submitted.
1336
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formnovalidate | `formnovalidate`} attribute
1293
1337
  *
1294
1338
  * @public
1295
1339
  * @remarks
1296
- * HTML Attribute: type
1340
+ * HTML Attribute: `formnovalidate`
1297
1341
  */
1298
- type: ButtonType;
1299
- protected typeChanged(previous: ButtonType | undefined, next: ButtonType): void;
1342
+ formNoValidate?: boolean;
1300
1343
  /**
1301
- * The appearance the button should have.
1344
+ * The internal form submission fallback control.
1345
+ *
1346
+ * @internal
1347
+ */
1348
+ private formSubmissionFallbackControl?;
1349
+ /**
1350
+ * The internal slot for the form submission fallback control.
1351
+ *
1352
+ * @internal
1353
+ */
1354
+ private formSubmissionFallbackControlSlot?;
1355
+ /**
1356
+ * The target frame or window to open the form submission in.
1357
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#formtarget | `formtarget`} attribute
1302
1358
  *
1303
1359
  * @public
1304
1360
  * @remarks
1305
- * HTML Attribute: appearance
1361
+ * HTML Attribute: `formtarget`
1306
1362
  */
1307
- appearance?: ButtonAppearance | undefined;
1363
+ formTarget?: ButtonFormTarget;
1308
1364
  /**
1309
- * The shape the button should have.
1365
+ * Indicates that the button should only display as an icon with no text content.
1310
1366
  *
1311
1367
  * @public
1312
1368
  * @remarks
1313
- * HTML Attribute: shape
1369
+ * HTML Attribute: `icon-only`
1314
1370
  */
1315
- shape?: ButtonShape | undefined;
1371
+ iconOnly: boolean;
1316
1372
  /**
1317
- * The size the button should have.
1373
+ * A reference to all associated label elements.
1374
+ *
1375
+ * @public
1376
+ */
1377
+ get labels(): ReadonlyArray<Node>;
1378
+ /**
1379
+ * The name of the element. This element's value will be surfaced during form submission under the provided name.
1380
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#name | `name`} attribute
1318
1381
  *
1319
1382
  * @public
1320
1383
  * @remarks
1321
- * HTML Attribute: size
1384
+ * HTML Attribute: `name`
1322
1385
  */
1323
- size?: ButtonSize;
1386
+ name?: string;
1324
1387
  /**
1325
- * The button has an icon only, no text content
1388
+ * The shape of the button.
1326
1389
  *
1327
1390
  * @public
1328
1391
  * @remarks
1329
- * HTML Attribute: icon-only
1392
+ * HTML Attribute: `shape`
1330
1393
  */
1331
- iconOnly: boolean;
1394
+ shape?: ButtonShape;
1332
1395
  /**
1333
- * The button is disabled but focusable
1396
+ * The size of the button.
1334
1397
  *
1335
1398
  * @public
1336
1399
  * @remarks
1337
- * HTML Attribute: disabled-focusable
1400
+ * HTML Attribute: `size`
1338
1401
  */
1339
- disabledFocusable?: boolean;
1340
- protected disabledFocusableChanged(prev: boolean, next: boolean): void;
1402
+ size?: ButtonSize;
1341
1403
  /**
1342
- * Prevents disabledFocusable click events
1404
+ * The button type.
1405
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type | `type`} attribute
1406
+ *
1407
+ * @public
1408
+ * @remarks
1409
+ * HTML Attribute: `type`
1343
1410
  */
1344
- private handleDisabledFocusableClick;
1411
+ type: ButtonType;
1345
1412
  /**
1413
+ * Removes the form submission fallback control when the type changes.
1346
1414
  *
1347
- * Default slotted content
1415
+ * @param previous - the previous type value
1416
+ * @param next - the new type value
1417
+ * @internal
1418
+ */
1419
+ typeChanged(previous: ButtonType, next: ButtonType): void;
1420
+ /**
1421
+ * The value attribute.
1422
+ *
1423
+ * @see The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#value | `value`} attribute
1348
1424
  *
1349
1425
  * @public
1350
1426
  * @remarks
1427
+ * HTML Attribute: `value`
1351
1428
  */
1352
- defaultSlottedContent: HTMLElement[];
1353
- /** {@inheritDoc (FormAssociated:interface).validate} */
1354
- validate(): void;
1429
+ value?: string;
1355
1430
  /**
1431
+ * Handles the button click event.
1432
+ *
1433
+ * @param e - The event object
1356
1434
  * @internal
1357
1435
  */
1436
+ clickHandler(e: Event): boolean | void;
1358
1437
  connectedCallback(): void;
1359
- disconnectedCallback(): void;
1438
+ constructor();
1439
+ /**
1440
+ * This fallback creates a new slot, then creates a submit button to mirror the custom element's
1441
+ * properties. The submit button is then appended to the slot and the form is submitted.
1442
+ *
1443
+ * @internal
1444
+ * @privateRemarks
1445
+ * This is a workaround until {@link https://github.com/WICG/webcomponents/issues/814 | WICG/webcomponents/issues/814} is resolved.
1446
+ */
1447
+ private createAndInsertFormSubmissionFallbackControl;
1360
1448
  /**
1361
- * Submits the parent form
1449
+ * Invoked when a connected component's form or fieldset has its disabled state changed.
1450
+ *
1451
+ * @param disabled - the disabled value of the form / fieldset
1452
+ *
1453
+ * @internal
1362
1454
  */
1363
- private handleSubmission;
1455
+ formDisabledCallback(disabled: boolean): void;
1364
1456
  /**
1365
- * Resets the parent form
1457
+ * Handles keypress events for the button.
1458
+ *
1459
+ * @param e - the keyboard event
1460
+ * @returns - the return value of the click handler
1461
+ * @public
1366
1462
  */
1367
- private handleFormReset;
1368
- control: HTMLButtonElement;
1463
+ keypressHandler(e: KeyboardEvent): boolean | void;
1464
+ /**
1465
+ * Presses the button.
1466
+ *
1467
+ * @public
1468
+ */
1469
+ protected press(): void;
1470
+ /**
1471
+ * Resets the associated form.
1472
+ *
1473
+ * @public
1474
+ */
1475
+ resetForm(): void;
1476
+ /**
1477
+ * Submits the associated form.
1478
+ *
1479
+ * @internal
1480
+ */
1481
+ private submitForm;
1369
1482
  }
1370
1483
 
1371
1484
  /**
1372
- * Mark internal because exporting class and interface of the same name
1373
- * confuses API documenter.
1374
- * TODO: https://github.com/microsoft/fast/issues/3317
1375
1485
  * @internal
1486
+ * @privateRemarks
1487
+ * Mark internal because exporting class and interface of the same name confuses API documenter.
1488
+ * TODO: https://github.com/microsoft/fast/issues/3317
1376
1489
  */
1377
- export declare interface Button extends StartEnd, DelegatesARIAButton {
1378
- }
1379
-
1380
- declare class _Button extends FASTElement {
1381
- }
1382
-
1383
- declare interface _Button extends FormAssociated {
1490
+ export declare interface Button extends StartEnd {
1384
1491
  }
1385
1492
 
1386
1493
  /**
@@ -1402,14 +1509,33 @@ export declare const ButtonAppearance: {
1402
1509
  export declare type ButtonAppearance = ValuesOf<typeof ButtonAppearance>;
1403
1510
 
1404
1511
  /**
1512
+ * The definition for the Fluent Button component.
1513
+ *
1405
1514
  * @public
1406
1515
  * @remarks
1407
- * HTML Element: \<fluent-button\>
1516
+ * HTML Element: `<fluent-button>`
1408
1517
  */
1409
1518
  export declare const ButtonDefinition: FASTElementDefinition<typeof Button>;
1410
1519
 
1411
1520
  /**
1412
- * Button configuration options
1521
+ * Button `formtarget` attribute values.
1522
+ * @public
1523
+ */
1524
+ export declare const ButtonFormTarget: {
1525
+ readonly blank: "_blank";
1526
+ readonly self: "_self";
1527
+ readonly parent: "_parent";
1528
+ readonly top: "_top";
1529
+ };
1530
+
1531
+ /**
1532
+ * Types for the `formtarget` attribute values.
1533
+ * @public
1534
+ */
1535
+ export declare type ButtonFormTarget = ValuesOf<typeof ButtonFormTarget>;
1536
+
1537
+ /**
1538
+ * Button configuration options.
1413
1539
  * @public
1414
1540
  */
1415
1541
  declare type ButtonOptions = StartEndOptions<Button>;
@@ -1450,6 +1576,11 @@ export declare const ButtonSize: {
1450
1576
  */
1451
1577
  export declare type ButtonSize = ValuesOf<typeof ButtonSize>;
1452
1578
 
1579
+ /**
1580
+ * The template for the Button component.
1581
+ *
1582
+ * @public
1583
+ */
1453
1584
  export declare const ButtonTemplate: ElementViewTemplate<Button>;
1454
1585
 
1455
1586
  /**
@@ -2488,6 +2619,12 @@ export declare const CounterBadgeStyles: ElementStyles;
2488
2619
  */
2489
2620
  export declare const CounterBadgeTemplate: ElementViewTemplate<CounterBadge>;
2490
2621
 
2622
+ /**
2623
+ * Define all possible CSS display values.
2624
+ * @public
2625
+ */
2626
+ export declare type CSSDisplayPropertyValue = 'block' | 'contents' | 'flex' | 'grid' | 'inherit' | 'initial' | 'inline' | 'inline-block' | 'inline-flex' | 'inline-grid' | 'inline-table' | 'list-item' | 'none' | 'run-in' | 'table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row' | 'table-row-group';
2627
+
2491
2628
  export declare const curveAccelerateMax = "var(--curveAccelerateMax)";
2492
2629
 
2493
2630
  export declare const curveAccelerateMid = "var(--curveAccelerateMid)";
@@ -2507,35 +2644,10 @@ export declare const curveEasyEaseMax = "var(--curveEasyEaseMax)";
2507
2644
  export declare const curveLinear = "var(--curveLinear)";
2508
2645
 
2509
2646
  /**
2510
- * Includes ARIA states and properties relating to the ARIA button role
2511
- *
2647
+ * This can be used to construct a behavior to apply a prefers color scheme: dark only stylesheet.
2512
2648
  * @public
2513
2649
  */
2514
- export declare class DelegatesARIAButton {
2515
- /**
2516
- * See {@link https://www.w3.org/WAI/PF/aria/roles#button} for more information
2517
- * @public
2518
- * @remarks
2519
- * HTML Attribute: aria-expanded
2520
- */
2521
- ariaExpanded: 'true' | 'false' | string | null;
2522
- /**
2523
- * See {@link https://www.w3.org/WAI/PF/aria/roles#button} for more information
2524
- * @public
2525
- * @remarks
2526
- * HTML Attribute: aria-pressed
2527
- */
2528
- ariaPressed: 'true' | 'false' | 'mixed' | string | null;
2529
- }
2530
-
2531
- /**
2532
- * Mark internal because exporting class and interface of the same name
2533
- * confuses API documenter.
2534
- * TODO: https://github.com/microsoft/fast/issues/3317
2535
- * @internal
2536
- */
2537
- export declare interface DelegatesARIAButton extends ARIAGlobalStatesAndProperties {
2538
- }
2650
+ export declare const darkModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
2539
2651
 
2540
2652
  /**
2541
2653
  * Includes ARIA states and properties relating to the ARIA link role
@@ -2794,6 +2906,14 @@ export declare const DialogStyles: ElementStyles;
2794
2906
  */
2795
2907
  export declare const DialogTemplate: ElementViewTemplate<Dialog>;
2796
2908
 
2909
+ /**
2910
+ * Applies a CSS display property.
2911
+ * Also adds CSS rules to not display the element when the [hidden] attribute is applied to the element.
2912
+ * @param display - The CSS display property value
2913
+ * @public
2914
+ */
2915
+ export declare function display(displayValue: CSSDisplayPropertyValue): string;
2916
+
2797
2917
  /**
2798
2918
  * @class Divider component
2799
2919
  *
@@ -2946,63 +3066,6 @@ export declare const durationUltraFast = "var(--durationUltraFast)";
2946
3066
 
2947
3067
  export declare const durationUltraSlow = "var(--durationUltraSlow)";
2948
3068
 
2949
- /**
2950
- * Source:
2951
- * https://html.spec.whatwg.org/multipage/custom-elements.html#elementinternals
2952
- */
2953
- declare interface ElementInternals_2 {
2954
- /**
2955
- * Returns the form owner of internals target element.
2956
- */
2957
- readonly form: HTMLFormElement | null;
2958
- /**
2959
- * Returns a NodeList of all the label elements that internals target element is associated with.
2960
- */
2961
- readonly labels: NodeList;
2962
- /**
2963
- * Returns the error message that would be shown to the user if internals target element was to be checked for validity.
2964
- */
2965
- readonly validationMessage: string;
2966
- /**
2967
- * Returns the ValidityState object for internals target element.
2968
- */
2969
- readonly validity: ValidityState;
2970
- /**
2971
- * Returns true if internals target element will be validated when the form is submitted; false otherwise.
2972
- */
2973
- readonly willValidate: boolean;
2974
- /**
2975
- * Returns true if internals target element has no validity problems; false otherwise. Fires an invalid event at the element in the latter case.
2976
- */
2977
- checkValidity(): boolean;
2978
- /**
2979
- * Returns true if internals target element has no validity problems; otherwise,
2980
- * returns false, fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user.
2981
- */
2982
- reportValidity(): boolean;
2983
- /**
2984
- * Sets both the state and submission value of internals target element to value.
2985
- *
2986
- * While "null" isn't enumerated as a argument type (here)[https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface],
2987
- * In practice it appears to remove the value from the form data on submission. Adding it as a valid type here
2988
- * becuase that capability is required for checkbox and radio types
2989
- */
2990
- setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
2991
- /**
2992
- * Marks internals target element as suffering from the constraints indicated by the flags argument,
2993
- * and sets the element's validation message to message.
2994
- * If anchor is specified, the user agent might use
2995
- * it to indicate problems with the constraints of internals target
2996
- * element when the form owner is validated interactively or reportValidity() is called.
2997
- */
2998
- setValidity(flags: ValidityStateFlags, message?: string, anchor?: HTMLElement): void;
2999
- }
3000
-
3001
- declare let ElementInternals_2: {
3002
- prototype: ElementInternals_2;
3003
- new (): ElementInternals_2;
3004
- };
3005
-
3006
3069
  /**
3007
3070
  * End configuration options
3008
3071
  * @public
@@ -3051,6 +3114,12 @@ export declare const fontWeightRegular = "var(--fontWeightRegular)";
3051
3114
 
3052
3115
  export declare const fontWeightSemibold = "var(--fontWeightSemibold)";
3053
3116
 
3117
+ /**
3118
+ * This can be used to construct a behavior to apply a forced-colors only stylesheet.
3119
+ * @public
3120
+ */
3121
+ export declare const forcedColorsStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
3122
+
3054
3123
  /**
3055
3124
  * Base function for providing Custom Element Form Association.
3056
3125
  *
@@ -3063,10 +3132,10 @@ declare function FormAssociated<T extends ConstructableFormAssociated>(BaseCtor:
3063
3132
  *
3064
3133
  * @beta
3065
3134
  */
3066
- declare interface FormAssociated extends Omit<ElementInternals_2, 'labels'> {
3135
+ declare interface FormAssociated extends Omit<ElementInternals, 'labels'> {
3067
3136
  dirtyValue: boolean;
3068
3137
  disabled: boolean;
3069
- readonly elementInternals: ElementInternals_2 | null;
3138
+ readonly elementInternals: ElementInternals | null;
3070
3139
  readonly formAssociated: boolean;
3071
3140
  initialValue: string;
3072
3141
  readonly labels: ReadonlyArray<Node[]>;
@@ -3093,15 +3162,6 @@ declare interface FormAssociated extends Omit<ElementInternals_2, 'labels'> {
3093
3162
  valueChanged(previous: string, next: string): void;
3094
3163
  }
3095
3164
 
3096
- /**
3097
- * @beta
3098
- */
3099
- declare class FormAssociatedButton extends FormAssociatedButton_base {
3100
- proxy: HTMLInputElement;
3101
- }
3102
-
3103
- declare const FormAssociatedButton_base: typeof _Button;
3104
-
3105
3165
  /**
3106
3166
  * @beta
3107
3167
  */
@@ -3147,6 +3207,22 @@ declare class FormAssociatedTextField extends FormAssociatedTextField_base {
3147
3207
 
3148
3208
  declare const FormAssociatedTextField_base: typeof _TextField;
3149
3209
 
3210
+ /**
3211
+ * Determines the current localization direction of an element.
3212
+ *
3213
+ * @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
3214
+ * @returns the localization direction of the element
3215
+ *
3216
+ * @public
3217
+ */
3218
+ export declare const getDirection: (rootNode: HTMLElement) => Direction;
3219
+
3220
+ /**
3221
+ * A CSS fragment to set `display: none;` when the host is hidden using the [hidden] attribute.
3222
+ * @public
3223
+ */
3224
+ export declare const hidden = ":host([hidden]){display:none}";
3225
+
3150
3226
  /**
3151
3227
  * The base class used for constucting a fluent image custom element
3152
3228
  * @public
@@ -3333,6 +3409,12 @@ declare const LabelWeight: {
3333
3409
  */
3334
3410
  declare type LabelWeight = ValuesOf<typeof LabelWeight>;
3335
3411
 
3412
+ /**
3413
+ * This can be used to construct a behavior to apply a prefers color scheme: light only stylesheet.
3414
+ * @public
3415
+ */
3416
+ export declare const lightModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
3417
+
3336
3418
  export declare const lineHeightBase100 = "var(--lineHeightBase100)";
3337
3419
 
3338
3420
  export declare const lineHeightBase200 = "var(--lineHeightBase200)";
@@ -3353,6 +3435,117 @@ export declare const lineHeightHero800 = "var(--lineHeightHero800)";
3353
3435
 
3354
3436
  export declare const lineHeightHero900 = "var(--lineHeightHero900)";
3355
3437
 
3438
+ /**
3439
+ * An abstract behavior to react to media queries. Implementations should implement
3440
+ * the `constructListener` method to perform some action based on media query changes.
3441
+ *
3442
+ * @public
3443
+ */
3444
+ export declare abstract class MatchMediaBehavior implements HostBehavior {
3445
+ /**
3446
+ * The behavior needs to operate on element instances but elements might share a behavior instance.
3447
+ * To ensure proper attachment / detachment per instance, we construct a listener for
3448
+ * each bind invocation and cache the listeners by element reference.
3449
+ */
3450
+ private listenerCache;
3451
+ /**
3452
+ * The media query that the behavior operates on.
3453
+ */
3454
+ readonly query: MediaQueryList;
3455
+ /**
3456
+ *
3457
+ * @param query - The media query to operate from.
3458
+ */
3459
+ constructor(query: MediaQueryList);
3460
+ /**
3461
+ * Constructs a function that will be invoked with the MediaQueryList context
3462
+ * @param controller - The host controller orchestrating this behavior.
3463
+ */
3464
+ protected abstract constructListener(controller: HostController): MediaQueryListListener;
3465
+ /**
3466
+ * Binds the behavior to the element.
3467
+ * @param controller - The host controller orchestrating this behavior.
3468
+ */
3469
+ connectedCallback(controller: HostController): void;
3470
+ /**
3471
+ * Unbinds the behavior from the element.
3472
+ * @param controller - The host controller orchestrating this behavior.
3473
+ */
3474
+ disconnectedCallback(controller: HostController): void;
3475
+ }
3476
+
3477
+ /**
3478
+ * A behavior to add or remove a stylesheet from an element based on a media query. The behavior ensures that
3479
+ * styles are applied while the a query matches the environment and that styles are not applied if the query does
3480
+ * not match the environment.
3481
+ *
3482
+ * @public
3483
+ */
3484
+ export declare class MatchMediaStyleSheetBehavior extends MatchMediaBehavior {
3485
+ /**
3486
+ * The media query that the behavior operates on.
3487
+ */
3488
+ readonly query: MediaQueryList;
3489
+ /**
3490
+ * The styles object to be managed by the behavior.
3491
+ */
3492
+ readonly styles: ElementStyles;
3493
+ /**
3494
+ * Constructs a {@link MatchMediaStyleSheetBehavior} instance.
3495
+ * @param query - The media query to operate from.
3496
+ * @param styles - The styles to coordinate with the query.
3497
+ */
3498
+ constructor(query: MediaQueryList, styles: ElementStyles);
3499
+ /**
3500
+ * Defines a function to construct {@link MatchMediaStyleSheetBehavior | MatchMediaStyleSheetBehaviors} for
3501
+ * a provided query.
3502
+ * @param query - The media query to operate from.
3503
+ *
3504
+ * @public
3505
+ * @example
3506
+ *
3507
+ * ```ts
3508
+ * import { css } from "@microsoft/fast-element";
3509
+ * import { MatchMediaStyleSheetBehavior } from "@fluentui/web-components";
3510
+ *
3511
+ * const landscapeBehavior = MatchMediaStyleSheetBehavior.with(
3512
+ * window.matchMedia("(orientation: landscape)")
3513
+ * );
3514
+ *
3515
+ * const styles = css`
3516
+ * :host {
3517
+ * width: 200px;
3518
+ * height: 400px;
3519
+ * }
3520
+ * `
3521
+ * .withBehaviors(landscapeBehavior(css`
3522
+ * :host {
3523
+ * width: 400px;
3524
+ * height: 200px;
3525
+ * }
3526
+ * `))
3527
+ * ```
3528
+ */
3529
+ static with(query: MediaQueryList): (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
3530
+ /**
3531
+ * Constructs a match-media listener for a provided element.
3532
+ * @param source - the element for which to attach or detach styles.
3533
+ */
3534
+ protected constructListener(controller: HostController): MediaQueryListListener;
3535
+ /**
3536
+ * Unbinds the behavior from the element.
3537
+ * @param controller - The host controller orchestrating this behavior.
3538
+ * @internal
3539
+ */
3540
+ removedCallback(controller: HostController<any>): void;
3541
+ }
3542
+
3543
+ /**
3544
+ * An event listener fired by a {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList | MediaQueryList }.
3545
+ * @public
3546
+ */
3547
+ export declare type MediaQueryListListener = (this: MediaQueryList, ev?: MediaQueryListEvent) => void;
3548
+
3356
3549
  /**
3357
3550
  * The Menu class represents a menu component.
3358
3551
  * @public
@@ -3936,7 +4129,7 @@ export declare const MenuTemplate: ElementViewTemplate<Menu>;
3936
4129
  *
3937
4130
  * @public
3938
4131
  */
3939
- declare class ProgressBar_2 extends BaseProgress {
4132
+ export declare class ProgressBar extends BaseProgress {
3940
4133
  /**
3941
4134
  * The thickness of the progress bar
3942
4135
  *
@@ -3960,7 +4153,6 @@ declare class ProgressBar_2 extends BaseProgress {
3960
4153
  */
3961
4154
  validationState: ProgressBarValidationState | null;
3962
4155
  }
3963
- export { ProgressBar_2 as ProgressBar }
3964
4156
 
3965
4157
  /**
3966
4158
  * The Fluent ProgressBar Element.
@@ -3970,7 +4162,7 @@ export { ProgressBar_2 as ProgressBar }
3970
4162
  * @remarks
3971
4163
  * HTML Element: \<fluent-progress-bar\>
3972
4164
  */
3973
- export declare const ProgressBarDefinition: FASTElementDefinition<typeof ProgressBar_2>;
4165
+ export declare const ProgressBarDefinition: FASTElementDefinition<typeof ProgressBar>;
3974
4166
 
3975
4167
  /**
3976
4168
  * ProgressBarShape Constants
@@ -3992,7 +4184,7 @@ export declare type ProgressBarShape = ValuesOf<typeof ProgressBarShape>;
3992
4184
  */
3993
4185
  export declare const ProgressBarStyles: ElementStyles;
3994
4186
 
3995
- export declare const ProgressBarTemplate: ElementViewTemplate<ProgressBar_2>;
4187
+ export declare const ProgressBarTemplate: ElementViewTemplate<ProgressBar>;
3996
4188
 
3997
4189
  /**
3998
4190
  * ProgressBarThickness Constants
@@ -4030,8 +4222,8 @@ export declare type ProgressBarValidationState = ValuesOf<typeof ProgressBarVali
4030
4222
  * @public
4031
4223
  */
4032
4224
  export declare type ProgressOptions = {
4033
- indeterminateIndicator1?: StaticallyComposableHTML<ProgressBar_2>;
4034
- indeterminateIndicator2?: StaticallyComposableHTML<ProgressBar_2>;
4225
+ indeterminateIndicator1?: StaticallyComposableHTML<ProgressBar>;
4226
+ indeterminateIndicator2?: StaticallyComposableHTML<ProgressBar>;
4035
4227
  };
4036
4228
 
4037
4229
  /**
@@ -4760,6 +4952,11 @@ export declare const strokeWidthThickest = "var(--strokeWidthThickest)";
4760
4952
 
4761
4953
  export declare const strokeWidthThin = "var(--strokeWidthThin)";
4762
4954
 
4955
+ /**
4956
+ * The styles for the Button component.
4957
+ *
4958
+ * @public
4959
+ */
4763
4960
  declare const styles: ElementStyles;
4764
4961
  export { styles as ButtonStyles }
4765
4962
  export { styles as MenuButtonStyles }
@@ -5429,51 +5626,54 @@ export declare const TextWeight: {
5429
5626
  export declare type TextWeight = ValuesOf<typeof TextWeight>;
5430
5627
 
5431
5628
  /**
5432
- * The base class used for constructing a fluent-toggle-button custom element
5629
+ * The base class used for constructing a `<fluent-toggle-button>` custom element.
5630
+ *
5433
5631
  * @public
5434
5632
  */
5435
5633
  export declare class ToggleButton extends Button {
5436
5634
  /**
5437
- * Tracks whether the "checked" property has been changed.
5438
- * This is necessary to provide consistent behavior with
5439
- * normal input checkboxes
5635
+ * Indicates the pressed state of the control.
5636
+ *
5637
+ * @public
5638
+ * @remarks
5639
+ * HTML Attribute: `pressed`
5640
+ */
5641
+ pressed: boolean;
5642
+ /**
5643
+ * Updates the pressed state when the `pressed` property changes.
5644
+ *
5645
+ * @internal
5440
5646
  */
5441
- protected dirtyChecked: boolean;
5647
+ protected pressedChanged(): void;
5442
5648
  /**
5443
- * Provides the default checkedness of the input element
5444
- * Passed down to proxy
5649
+ * Indicates the mixed state of the control. This property takes precedence over `pressed`.
5445
5650
  *
5446
5651
  * @public
5447
5652
  * @remarks
5448
- * HTML Attribute: checked
5653
+ * HTML Attribute: `mixed`
5449
5654
  */
5450
- checkedAttribute: boolean;
5451
- protected checkedAttributeChanged(): void;
5452
- defaultChecked: boolean;
5453
- protected defaultCheckedChanged(): void;
5655
+ mixed?: boolean;
5454
5656
  /**
5455
- * The checked state of the control.
5657
+ * Updates the pressed state when the `mixed` property changes.
5456
5658
  *
5457
- * @public
5659
+ * @param previous - the previous mixed state
5660
+ * @param next - the current mixed state
5661
+ * @internal
5458
5662
  */
5459
- checked: boolean;
5460
- protected checkedChanged(prev: boolean | undefined, next: boolean): void;
5663
+ protected mixedChanged(): void;
5461
5664
  /**
5462
- * The current checkedness of the element. This property serves as a mechanism
5463
- * to set the `checked` property through both property assignment and the
5464
- * .setAttribute() method. This is useful for setting the field's checkedness
5465
- * in UI libraries that bind data through the .setAttribute() API
5466
- * and don't support IDL attribute binding.
5665
+ * Toggles the pressed state of the button.
5666
+ *
5667
+ * @override
5467
5668
  */
5468
- currentChecked: boolean;
5469
- currentCheckedChanged(prev: boolean | undefined, next: boolean): void;
5470
- constructor();
5669
+ protected press(): void;
5471
5670
  connectedCallback(): void;
5472
- disconnectedCallback(): void;
5473
5671
  /**
5672
+ * Sets the `aria-pressed` attribute based on the `pressed` and `mixed` properties.
5673
+ *
5474
5674
  * @internal
5475
5675
  */
5476
- protected handleToggleButtonClick: (e: MouseEvent) => void;
5676
+ private setPressedState;
5477
5677
  }
5478
5678
 
5479
5679
  /**
@@ -5534,6 +5734,13 @@ export declare const ToggleButtonSize: {
5534
5734
  */
5535
5735
  export declare type ToggleButtonSize = ValuesOf<typeof ToggleButtonSize>;
5536
5736
 
5737
+ /**
5738
+ * The styles for the ToggleButton component.
5739
+ *
5740
+ * @public
5741
+ * @privateRemarks
5742
+ * TODO: Need to support icon hover styles
5743
+ */
5537
5744
  export declare const ToggleButtonStyles: ElementStyles;
5538
5745
 
5539
5746
  /**
@@ -5542,25 +5749,6 @@ export declare const ToggleButtonStyles: ElementStyles;
5542
5749
  */
5543
5750
  export declare const ToggleButtonTemplate: ElementViewTemplate<ToggleButton>;
5544
5751
 
5545
- /**
5546
- * This file enables typing support for ElementInternals APIs.
5547
- * It is largely taken from https://github.com/microsoft/TSJS-lib-generator/pull/818/files.
5548
- *
5549
- * When TypeScript adds support for these APIs we can delete this file.
5550
- */
5551
- declare interface ValidityStateFlags {
5552
- badInput?: boolean;
5553
- customError?: boolean;
5554
- patternMismatch?: boolean;
5555
- rangeOverflow?: boolean;
5556
- rangeUnderflow?: boolean;
5557
- stepMismatch?: boolean;
5558
- tooLong?: boolean;
5559
- tooShort?: boolean;
5560
- typeMismatch?: boolean;
5561
- valueMissing?: boolean;
5562
- }
5563
-
5564
5752
  /**
5565
5753
  * Helper for enumerating a type from a const object
5566
5754
  * Example: export type Foo = ValuesOf\<typeof Foo\>