@material/web 1.0.0-pre.12 → 1.0.0-pre.13

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 (76) hide show
  1. package/button/lib/_icon.scss +9 -9
  2. package/button/lib/_outlined-button.scss +4 -0
  3. package/button/lib/elevated-styles.css.js +1 -1
  4. package/button/lib/elevated-styles.css.js.map +1 -1
  5. package/button/lib/filled-styles.css.js +1 -1
  6. package/button/lib/filled-styles.css.js.map +1 -1
  7. package/button/lib/outlined-styles.css.js +1 -1
  8. package/button/lib/outlined-styles.css.js.map +1 -1
  9. package/button/lib/shared-styles.css.js +1 -1
  10. package/button/lib/shared-styles.css.js.map +1 -1
  11. package/button/lib/text-styles.css.js +1 -1
  12. package/button/lib/text-styles.css.js.map +1 -1
  13. package/button/lib/tonal-styles.css.js +1 -1
  14. package/button/lib/tonal-styles.css.js.map +1 -1
  15. package/chips/lib/filter-chip.js +1 -1
  16. package/chips/lib/filter-chip.js.map +1 -1
  17. package/chips/lib/input-chip.js +1 -1
  18. package/chips/lib/input-chip.js.map +1 -1
  19. package/dialog/lib/_dialog.scss +2 -2
  20. package/dialog/lib/_tokens.scss +5 -22
  21. package/dialog/lib/dialog-styles.css.js +1 -1
  22. package/dialog/lib/dialog-styles.css.js.map +1 -1
  23. package/field/lib/_supporting-text.scss +6 -16
  24. package/field/lib/field.d.ts +26 -2
  25. package/field/lib/field.js +98 -13
  26. package/field/lib/field.js.map +1 -1
  27. package/field/lib/outlined-field.d.ts +1 -2
  28. package/field/lib/outlined-field.js.map +1 -1
  29. package/field/lib/shared-styles.css.js +1 -1
  30. package/field/lib/shared-styles.css.js.map +1 -1
  31. package/labs/segmentedbutton/lib/_shared.scss +7 -7
  32. package/labs/segmentedbutton/lib/outlined-styles.css.js +1 -1
  33. package/labs/segmentedbutton/lib/outlined-styles.css.js.map +1 -1
  34. package/labs/segmentedbutton/lib/shared-styles.css.js +1 -1
  35. package/labs/segmentedbutton/lib/shared-styles.css.js.map +1 -1
  36. package/labs/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
  37. package/labs/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
  38. package/list/harness.d.ts +24 -0
  39. package/list/harness.js +25 -0
  40. package/list/harness.js.map +1 -1
  41. package/list/lib/listitem/harness.d.ts +21 -1
  42. package/list/lib/listitem/harness.js +16 -2
  43. package/list/lib/listitem/harness.js.map +1 -1
  44. package/list/lib/listitemlink/list-item-link-only.d.ts +1 -0
  45. package/list/lib/listitemlink/list-item-link-only.js +4 -1
  46. package/list/lib/listitemlink/list-item-link-only.js.map +1 -1
  47. package/menu/harness.js.map +1 -1
  48. package/package.json +2 -1
  49. package/radio/lib/single-selection-controller.js +2 -3
  50. package/radio/lib/single-selection-controller.js.map +1 -1
  51. package/select/harness.js.map +1 -1
  52. package/select/lib/select.d.ts +0 -10
  53. package/select/lib/select.js +4 -40
  54. package/select/lib/select.js.map +1 -1
  55. package/tabs/lib/tab.js +3 -1
  56. package/tabs/lib/tab.js.map +1 -1
  57. package/tabs/lib/tabs.js +2 -0
  58. package/tabs/lib/tabs.js.map +1 -1
  59. package/textfield/lib/_shared.scss +0 -4
  60. package/textfield/lib/shared-styles.css.js +1 -1
  61. package/textfield/lib/shared-styles.css.js.map +1 -1
  62. package/textfield/lib/text-field.d.ts +2 -13
  63. package/textfield/lib/text-field.js +35 -89
  64. package/textfield/lib/text-field.js.map +1 -1
  65. package/tokens/_md-comp-dialog.scss +48 -6
  66. package/tokens/_md-comp-elevated-button.scss +17 -7
  67. package/tokens/_md-comp-elevation.scss +11 -2
  68. package/tokens/_md-comp-filled-button.scss +17 -7
  69. package/tokens/_md-comp-filled-tonal-button.scss +17 -7
  70. package/tokens/_md-comp-list-item.scss +5 -0
  71. package/tokens/_md-comp-menu-item.scss +1 -0
  72. package/tokens/_md-comp-outlined-button.scss +19 -9
  73. package/tokens/_md-comp-outlined-segmented-button.scss +19 -13
  74. package/tokens/_md-comp-slider.scss +48 -2
  75. package/tokens/_md-comp-text-button.scss +17 -7
  76. package/tokens/_values.scss +1 -1
@@ -4,6 +4,6 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { css } from 'lit';
7
- export const styles = css `:host{--_container-height: var(--md-outlined-segmented-button-container-height, 40px);--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-icon-opacity: var(--md-outlined-segmented-button-disabled-icon-opacity, 0.38);--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-outlined-segmented-button-disabled-label-text-opacity, 0.38);--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-opacity: var(--md-outlined-segmented-button-disabled-outline-opacity, 0.12);--_focus-state-layer-opacity: var(--md-outlined-segmented-button-focus-state-layer-opacity, 0.12);--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_outline-width: var(--md-outlined-segmented-button-outline-width, 1px);--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-state-layer-color: var(--md-outlined-segmented-button-selected-focus-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-with-icon-icon-color: var(--md-outlined-segmented-button-selected-with-icon-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_shape: var(--md-outlined-segmented-button-shape, 9999px);--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-outlined-segmented-button-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-with-icon-icon-color: var(--md-outlined-segmented-button-unselected-with-icon-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_with-icon-icon-size: var(--md-outlined-segmented-button-with-icon-icon-size, 18px);--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */
7
+ export const styles = css `:host{--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-size: var(--md-outlined-segmented-button-icon-size, 18px);--_selected-icon-color: var(--md-outlined-segmented-button-selected-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-icon-color: var(--md-outlined-segmented-button-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=outlined-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"outlined-styles.css.js","sourceRoot":"","sources":["outlined-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_container-height: var(--md-outlined-segmented-button-container-height, 40px);--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-icon-opacity: var(--md-outlined-segmented-button-disabled-icon-opacity, 0.38);--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-outlined-segmented-button-disabled-label-text-opacity, 0.38);--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-opacity: var(--md-outlined-segmented-button-disabled-outline-opacity, 0.12);--_focus-state-layer-opacity: var(--md-outlined-segmented-button-focus-state-layer-opacity, 0.12);--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_outline-width: var(--md-outlined-segmented-button-outline-width, 1px);--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-state-layer-color: var(--md-outlined-segmented-button-selected-focus-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-with-icon-icon-color: var(--md-outlined-segmented-button-selected-with-icon-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_shape: var(--md-outlined-segmented-button-shape, 9999px);--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-state-layer-color: var(--md-outlined-segmented-button-unselected-focus-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-with-icon-icon-color: var(--md-outlined-segmented-button-unselected-with-icon-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_with-icon-icon-size: var(--md-outlined-segmented-button-with-icon-icon-size, 18px);--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"outlined-styles.css.js","sourceRoot":"","sources":["outlined-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-size: var(--md-outlined-segmented-button-icon-size, 18px);--_selected-icon-color: var(--md-outlined-segmented-button-selected-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-icon-color: var(--md-outlined-segmented-button-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */\n`;\n "]}
package/list/harness.d.ts CHANGED
@@ -7,6 +7,17 @@ import { Harness } from '../testing/harness.js';
7
7
  import { List } from './lib/list.js';
8
8
  import { ListItemHarness } from './lib/listitem/harness.js';
9
9
  export { ListItemHarness } from './lib/listitem/harness.js';
10
+ declare const NAVIGABLE_KEYS: {
11
+ readonly ArrowDown: "ArrowDown";
12
+ readonly ArrowUp: "ArrowUp";
13
+ readonly Home: "Home";
14
+ readonly End: "End";
15
+ };
16
+ /**
17
+ * Keys that are handled by MdList. Keys not included in this are not handled by
18
+ * MdList and should be dispatched by yourself.
19
+ */
20
+ export type HandledListKeys = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];
10
21
  /**
11
22
  * Test harness for list.
12
23
  */
@@ -17,4 +28,17 @@ export declare class ListHarness extends Harness<List> {
17
28
  protected getInteractiveElement(): Promise<HTMLElement>;
18
29
  /** @return List item harnesses. */
19
30
  getItems(): ListItemHarness[];
31
+ /**
32
+ * Constructs keyboard events that are handled by List and makes sure that
33
+ * they are constructed in a manner that List understands.
34
+ *
35
+ * @param key The key to dispatch on the list.
36
+ */
37
+ pressHandledKey<T extends string = HandledListKeys>(key: T): Promise<void>;
38
+ /**
39
+ * Dispatches a keypress on the list. It may or may not be a supported event.
40
+ *
41
+ * @param key The key to dispatch on the list.
42
+ */
43
+ keypress(key: string, init?: KeyboardEventInit): Promise<void>;
20
44
  }
package/list/harness.js CHANGED
@@ -6,6 +6,12 @@
6
6
  import { Harness } from '../testing/harness.js';
7
7
  import { ListItemHarness } from './lib/listitem/harness.js';
8
8
  export { ListItemHarness } from './lib/listitem/harness.js';
9
+ const NAVIGABLE_KEYS = {
10
+ 'ArrowDown': 'ArrowDown',
11
+ 'ArrowUp': 'ArrowUp',
12
+ 'Home': 'Home',
13
+ 'End': 'End',
14
+ };
9
15
  /**
10
16
  * Test harness for list.
11
17
  */
@@ -21,5 +27,24 @@ export class ListHarness extends Harness {
21
27
  getItems() {
22
28
  return this.element.items.map((item) => new ListItemHarness(item));
23
29
  }
30
+ /**
31
+ * Constructs keyboard events that are handled by List and makes sure that
32
+ * they are constructed in a manner that List understands.
33
+ *
34
+ * @param key The key to dispatch on the list.
35
+ */
36
+ async pressHandledKey(key) {
37
+ await this.keypress(key, { code: key });
38
+ }
39
+ /**
40
+ * Dispatches a keypress on the list. It may or may not be a supported event.
41
+ *
42
+ * @param key The key to dispatch on the list.
43
+ */
44
+ async keypress(key, init = {}) {
45
+ const nativeList = this.element.renderRoot.querySelector('ul');
46
+ init = { code: key, ...init };
47
+ this.simulateKeypress(nativeList, key, init);
48
+ }
24
49
  }
25
50
  //# sourceMappingURL=harness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,mCAAmC;IACnC,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {List} from './lib/list.js';\nimport {ListItemHarness} from './lib/listitem/harness.js';\n\nexport {ListItemHarness} from './lib/listitem/harness.js';\n\n/**\n * Test harness for list.\n */\nexport class ListHarness extends Harness<List> {\n /**\n * Returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return List item harnesses. */\n getItems() {\n return this.element.items.map((item) => new ListItemHarness(item));\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,MAAM,cAAc,GAAG;IACrB,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACJ,CAAC;AASX;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,mCAAmC;IACnC,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CACzB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAAkB,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAqC,GAAM;QAC9D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACM,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,OAAO,EAAuB;QACjE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC;QAChE,IAAI,GAAG,EAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,EAAC,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {List} from './lib/list.js';\nimport {ListItemHarness} from './lib/listitem/harness.js';\nimport {ListItemEl} from './lib/listitem/list-item.js';\n\nexport {ListItemHarness} from './lib/listitem/harness.js';\n\nconst NAVIGABLE_KEYS = {\n 'ArrowDown': 'ArrowDown',\n 'ArrowUp': 'ArrowUp',\n 'Home': 'Home',\n 'End': 'End',\n} as const;\n\n/**\n * Keys that are handled by MdList. Keys not included in this are not handled by\n * MdList and should be dispatched by yourself.\n */\nexport type HandledListKeys =\n typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\n/**\n * Test harness for list.\n */\nexport class ListHarness extends Harness<List> {\n /**\n * Returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return List item harnesses. */\n getItems() {\n return this.element.items.map(\n (item) => new ListItemHarness(item as ListItemEl));\n }\n\n /**\n * Constructs keyboard events that are handled by List and makes sure that\n * they are constructed in a manner that List understands.\n *\n * @param key The key to dispatch on the list.\n */\n async pressHandledKey<T extends string = HandledListKeys>(key: T) {\n await this.keypress(key, {code: key});\n }\n\n /**\n * Dispatches a keypress on the list. It may or may not be a supported event.\n *\n * @param key The key to dispatch on the list.\n */\n override async keypress(key: string, init = {} as KeyboardEventInit) {\n const nativeList = this.element.renderRoot.querySelector('ul')!;\n init = {code: key, ...init};\n this.simulateKeypress(nativeList, key, init);\n }\n}\n"]}
@@ -3,11 +3,31 @@
3
3
  * Copyright 2022 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { LitElement } from 'lit';
6
7
  import { Harness } from '../../../testing/harness.js';
7
8
  import { ListItem } from './list-item.js';
9
+ declare const NAVIGABLE_KEYS: {
10
+ readonly ArrowDown: "ArrowDown";
11
+ readonly ArrowUp: "ArrowUp";
12
+ readonly Home: "Home";
13
+ readonly End: "End";
14
+ };
15
+ /**
16
+ * Keys that are handled by MdList. Keys not included in this are not handled by
17
+ * MdList and should be dispatched by yourself.
18
+ */
19
+ export type HandledListKeys = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];
8
20
  /**
9
21
  * Test harness for list item.
10
22
  */
11
- export declare class ListItemHarness extends Harness<ListItem> {
23
+ export declare class ListItemHarness extends Harness<ListItem & LitElement> {
12
24
  getInteractiveElement(): Promise<HTMLElement>;
25
+ /**
26
+ * Constructs keyboard events that are handled by List and makes sure that
27
+ * they are constructed in a manner that List understands.
28
+ *
29
+ * @param key The key to dispatch on the list.
30
+ */
31
+ pressHandledKey<T extends string = HandledListKeys>(key: T): Promise<void>;
13
32
  }
33
+ export {};
@@ -4,14 +4,28 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { Harness } from '../../../testing/harness.js';
7
+ const NAVIGABLE_KEYS = {
8
+ 'ArrowDown': 'ArrowDown',
9
+ 'ArrowUp': 'ArrowUp',
10
+ 'Home': 'Home',
11
+ 'End': 'End',
12
+ };
7
13
  /**
8
14
  * Test harness for list item.
9
15
  */
10
16
  export class ListItemHarness extends Harness {
11
17
  async getInteractiveElement() {
12
18
  await this.element.updateComplete;
13
- return this.element
14
- .renderRoot.querySelector('.list-item');
19
+ return this.element.renderRoot.querySelector('.list-item');
20
+ }
21
+ /**
22
+ * Constructs keyboard events that are handled by List and makes sure that
23
+ * they are constructed in a manner that List understands.
24
+ *
25
+ * @param key The key to dispatch on the list.
26
+ */
27
+ async pressHandledKey(key) {
28
+ await this.keypress(key, { code: key });
15
29
  }
16
30
  }
17
31
  //# sourceMappingURL=harness.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAIpD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAiB;IAC3C,KAAK,CAAC,qBAAqB;QAClC,MAAO,IAAI,CAAC,OAAiC,CAAC,cAAc,CAAC;QAC7D,OAAQ,IAAI,CAAC,OAAiC;aAClC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAgB,CAAC;IACpE,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../../../testing/harness.js';\n\nimport {ListItem} from './list-item.js';\n\n/**\n * Test harness for list item.\n */\nexport class ListItemHarness extends Harness<ListItem> {\n override async getInteractiveElement() {\n await (this.element as unknown as LitElement).updateComplete;\n return (this.element as unknown as LitElement)\n .renderRoot.querySelector('.list-item') as HTMLElement;\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAIpD,MAAM,cAAc,GAAG;IACrB,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,KAAK;CACJ,CAAC;AASX;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAA4B;IACtD,KAAK,CAAC,qBAAqB;QAClC,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAgB,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAqC,GAAM;QAC9D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../../../testing/harness.js';\n\nimport {ListItem} from './list-item.js';\n\nconst NAVIGABLE_KEYS = {\n 'ArrowDown': 'ArrowDown',\n 'ArrowUp': 'ArrowUp',\n 'Home': 'Home',\n 'End': 'End',\n} as const;\n\n/**\n * Keys that are handled by MdList. Keys not included in this are not handled by\n * MdList and should be dispatched by yourself.\n */\nexport type HandledListKeys =\n typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\n/**\n * Test harness for list item.\n */\nexport class ListItemHarness extends Harness<ListItem&LitElement> {\n override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.element.renderRoot.querySelector('.list-item') as HTMLElement;\n }\n\n /**\n * Constructs keyboard events that are handled by List and makes sure that\n * they are constructed in a manner that List understands.\n *\n * @param key The key to dispatch on the list.\n */\n async pressHandledKey<T extends string = HandledListKeys>(key: T) {\n await this.keypress(key, {code: key});\n }\n}\n"]}
@@ -19,4 +19,5 @@ export declare class ListItemLinkOnly extends ListItemLink {
19
19
  disabled: boolean;
20
20
  };
21
21
  renderRipple(): typeof nothing | import("lit-html").TemplateResult<2 | 1>;
22
+ renderFocusRing(): typeof nothing | import("lit-html").TemplateResult<2 | 1>;
22
23
  }
@@ -26,8 +26,11 @@ export class ListItemLinkOnly extends ListItemLink {
26
26
  renderRipple() {
27
27
  return this.noninteractive ? nothing : super.renderRipple();
28
28
  }
29
+ renderFocusRing() {
30
+ return this.noninteractive ? nothing : super.renderFocusRing();
31
+ }
29
32
  }
30
33
  __decorate([
31
- property()
34
+ property({ type: Boolean })
32
35
  ], ListItemLinkOnly.prototype, "noninteractive", void 0);
33
36
  //# sourceMappingURL=list-item-link-only.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-item-link-only.js","sourceRoot":"","sources":["list-item-link-only.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,gEAAgE;AAChE,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAAlD;;QACE;;;WAGG;QACS,mBAAc,GAAG,KAAK,CAAC;IAYrC,CAAC;IAVU,gBAAgB;QACvB,OAAO;YACL,GAAG,KAAK,CAAC,gBAAgB,EAAE;YAC3B,gBAAgB,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IAEQ,YAAY;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;CACF;AAZa;IAAX,QAAQ,EAAE;wDAAwB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {ListItemLink} from './list-item-link.js';\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemLinkOnly extends ListItemLink {\n /**\n * Removes the hover and click ripples from the item when true. Clicking the\n * link will still cause link navigation.\n */\n @property() noninteractive = false;\n\n override getRenderClasses() {\n return {\n ...super.getRenderClasses(),\n 'noninteractive': this.noninteractive,\n };\n }\n\n override renderRipple() {\n return this.noninteractive ? nothing : super.renderRipple();\n }\n}\n"]}
1
+ {"version":3,"file":"list-item-link-only.js","sourceRoot":"","sources":["list-item-link-only.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,gEAAgE;AAChE,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAAlD;;QACE;;;WAGG;QACwB,mBAAc,GAAG,KAAK,CAAC;IAgBpD,CAAC;IAdU,gBAAgB;QACvB,OAAO;YACL,GAAG,KAAK,CAAC,gBAAgB,EAAE;YAC3B,gBAAgB,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;IAEQ,YAAY;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;IAEQ,eAAe;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IACjE,CAAC;CACF;AAhB4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wDAAwB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {ListItemLink} from './list-item-link.js';\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class ListItemLinkOnly extends ListItemLink {\n /**\n * Removes the hover and click ripples from the item when true. Clicking the\n * link will still cause link navigation.\n */\n @property({type: Boolean}) noninteractive = false;\n\n override getRenderClasses() {\n return {\n ...super.getRenderClasses(),\n 'noninteractive': this.noninteractive,\n };\n }\n\n override renderRipple() {\n return this.noninteractive ? nothing : super.renderRipple();\n }\n\n override renderFocusRing() {\n return this.noninteractive ? nothing : super.renderFocusRing();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO;SACR;QAED,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,MAAM,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Menu} from './lib/menu.js';\nimport {MenuItemHarness} from './lib/menuitem/harness.js';\n\nexport {MenuItemHarness} from './lib/menuitem/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class MenuHarness extends Harness<Menu> {\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n await this.show();\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.items.map((item) => new MenuItemHarness(item));\n }\n\n async show(quick = true) {\n const menu = this.element;\n menu.quick = quick;\n if (menu.open) {\n return;\n }\n\n const opened = new Promise((resolve) => {\n menu.addEventListener('opened', () => {\n resolve(true);\n }, {once: true});\n });\n\n menu.show();\n await opened;\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAa;IAC5C;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;IAC5D,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CACzB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAA8B,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO;SACR;QAED,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,MAAM,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {Harness} from '../testing/harness.js';\n\nimport {Menu} from './lib/menu.js';\nimport {MenuItemHarness} from './lib/menuitem/harness.js';\n\nexport {MenuItemHarness} from './lib/menuitem/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class MenuHarness extends Harness<Menu> {\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n await this.show();\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.items.map(\n (item) => new MenuItemHarness(item as typeof item&LitElement));\n }\n\n async show(quick = true) {\n const menu = this.element;\n menu.quick = quick;\n if (menu.open) {\n return;\n }\n\n const opened = new Promise((resolve) => {\n menu.addEventListener('opened', () => {\n resolve(true);\n }, {once: true});\n });\n\n menu.show();\n await opened;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@material/web",
3
- "version": "1.0.0-pre.12",
3
+ "version": "1.0.0-pre.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,6 +37,7 @@
37
37
  "!catalog"
38
38
  ],
39
39
  "workspaces": [
40
+ ".",
40
41
  "catalog"
41
42
  ],
42
43
  "dependencies": {
@@ -107,10 +107,9 @@ export class SingleSelectionController {
107
107
  sibling.tabIndex = -1;
108
108
  }
109
109
  }
110
- // The next sibling should be checked and focused.
111
- nextSibling.checked = true;
110
+ // The next sibling should be checked, focused and dispatch a change event
112
111
  nextSibling.removeAttribute('tabindex');
113
- nextSibling.focus();
112
+ nextSibling.click();
114
113
  break;
115
114
  }
116
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"single-selection-controller.js","sourceRoot":"","sources":["single-selection-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAA6B,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QAHjD,YAAO,GAAG,KAAK,CAAC;QAChB,SAAI,GAAoB,IAAI,CAAC;QAyCpB,kBAAa,GAAG,GAAG,EAAE;YACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAEe,mBAAc,GAAG,GAAG,EAAE;YACrC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAmDF;;;;WAIG;QACc,kBAAa,GAAG,CAAC,KAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,KAAK,WAAW,CAAC;YACzC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,SAAS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YAC9B,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SACrC;IACH,CAAC;IAED;;;OAGG;IACK,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,OAAO,KAAK,CAAC,IAAI,CACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAyB,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;CAwEF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController} from 'lit';\n\n/**\n * An element that supports single-selection with `SingleSelectionController`.\n */\nexport interface SingleSelectionElement extends HTMLElement {\n /**\n * Whether or not the element is selected.\n */\n checked: boolean;\n}\n\n/**\n * A `ReactiveController` that provides root node-scoped single selection for\n * elements, similar to native `<input type=\"radio\">` selection.\n *\n * To use, elements should add the controller and call\n * `selectionController.handleCheckedChange()` in a getter/setter. This must\n * be synchronous to match native behavior.\n *\n * @example\n * const CHECKED = Symbol('checked');\n *\n * class MyToggle extends LitElement {\n * get checked() { return this[CHECKED]; }\n * set checked(checked: boolean) {\n * const oldValue = this.checked;\n * if (oldValue === checked) {\n * return;\n * }\n *\n * this[CHECKED] = checked;\n * this.selectionController.handleCheckedChange();\n * this.requestUpdate('checked', oldValue);\n * }\n *\n * [CHECKED] = false;\n *\n * private selectionController = new SingleSelectionController(this);\n *\n * constructor() {\n * super();\n * this.addController(this.selectionController);\n * }\n * }\n */\nexport class SingleSelectionController implements ReactiveController {\n private focused = false;\n private root: ParentNode|null = null;\n\n constructor(private readonly host: SingleSelectionElement) {}\n\n hostConnected() {\n this.root = this.host.getRootNode() as ParentNode;\n this.host.addEventListener('keydown', this.handleKeyDown);\n this.host.addEventListener('focusin', this.handleFocusIn);\n this.host.addEventListener('focusout', this.handleFocusOut);\n if (this.host.checked) {\n // Uncheck other siblings when attached if already checked. This mimics\n // native <input type=\"radio\"> behavior.\n this.uncheckSiblings();\n }\n\n // Update for the newly added host.\n this.updateTabIndices();\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.handleKeyDown);\n this.host.removeEventListener('focusin', this.handleFocusIn);\n this.host.removeEventListener('focusout', this.handleFocusOut);\n // Update for siblings that are still connected.\n this.updateTabIndices();\n this.root = null;\n }\n\n /**\n * Should be called whenever the host's `checked` property changes\n * synchronously.\n */\n handleCheckedChange() {\n if (!this.host.checked) {\n return;\n }\n\n this.uncheckSiblings();\n this.updateTabIndices();\n }\n\n private readonly handleFocusIn = () => {\n this.focused = true;\n this.updateTabIndices();\n };\n\n private readonly handleFocusOut = () => {\n this.focused = false;\n this.updateTabIndices();\n };\n\n private uncheckSiblings() {\n for (const sibling of this.getNamedSiblings()) {\n if (sibling !== this.host) {\n sibling.checked = false;\n }\n }\n }\n\n /**\n * Updates the `tabindex` of the host and its siblings.\n */\n private updateTabIndices() {\n // There are three tabindex states for a group of elements:\n // 1. If any are checked, that element is focusable.\n const siblings = this.getNamedSiblings();\n const checkedSibling = siblings.find(sibling => sibling.checked);\n // 2. If an element is focused, the others are no longer focusable.\n if (checkedSibling || this.focused) {\n const focusable = checkedSibling || this.host;\n focusable.removeAttribute('tabindex');\n\n for (const sibling of siblings) {\n if (sibling !== focusable) {\n sibling.tabIndex = -1;\n }\n }\n return;\n }\n\n // 3. If none are checked or focused, all are focusable.\n for (const sibling of siblings) {\n sibling.removeAttribute('tabindex');\n }\n }\n\n /**\n * Retrieves all siblings in the host element's root with the same `name`\n * attribute.\n */\n private getNamedSiblings() {\n const name = this.host.getAttribute('name');\n if (!name || !this.root) {\n return [];\n }\n\n return Array.from(\n this.root.querySelectorAll<SingleSelectionElement>(`[name=\"${name}\"]`));\n }\n\n /**\n * Handles arrow key events from the host. Using the arrow keys will\n * select and check the next or previous sibling with the host's\n * `name` attribute.\n */\n private readonly handleKeyDown = (event: KeyboardEvent) => {\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n // Ignore non-arrow keys\n if (!isLeft && !isRight && !isDown && !isUp) {\n return;\n }\n\n // Don't try to select another sibling if there aren't any.\n const siblings = this.getNamedSiblings();\n if (!siblings.length) {\n return;\n }\n\n // Prevent default interactions on the element for arrow keys,\n // since this controller will introduce new behavior.\n event.preventDefault();\n\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this.host).direction === 'rtl';\n const forwards = isRtl ? isLeft || isDown : isRight || isDown;\n\n const hostIndex = siblings.indexOf(this.host);\n let nextIndex = forwards ? hostIndex + 1 : hostIndex - 1;\n // Search for the next sibling that is not disabled to select.\n // If we return to the host index, there is nothing to select.\n while (nextIndex !== hostIndex) {\n if (nextIndex >= siblings.length) {\n // Return to start if moving past the last item.\n nextIndex = 0;\n } else if (nextIndex < 0) {\n // Go to end if moving before the first item.\n nextIndex = siblings.length - 1;\n }\n\n // Check if the next sibling is disabled. If so,\n // move the index and continue searching.\n const nextSibling = siblings[nextIndex];\n if (nextSibling.hasAttribute('disabled')) {\n if (forwards) {\n nextIndex++;\n } else {\n nextIndex--;\n }\n\n continue;\n }\n\n // Uncheck and remove focusability from other siblings.\n for (const sibling of siblings) {\n if (sibling !== nextSibling) {\n sibling.checked = false;\n sibling.tabIndex = -1;\n }\n }\n\n // The next sibling should be checked and focused.\n nextSibling.checked = true;\n nextSibling.removeAttribute('tabindex');\n nextSibling.focus();\n break;\n }\n };\n}\n"]}
1
+ {"version":3,"file":"single-selection-controller.js","sourceRoot":"","sources":["single-selection-controller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAA6B,IAA4B;QAA5B,SAAI,GAAJ,IA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AAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACjE,mEAAmE;QACnE,IAAI,cAAc,IAAI,IAAI,CAAC,OAAO,EAAE;YAClC,MAAM,SAAS,GAAG,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC;YAC9C,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAEtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;iBACvB;aACF;YACD,OAAO;SACR;QAED,wDAAwD;QACxD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SACrC;IACH,CAAC;IAED;;;OAGG;IACK,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,OAAO,KAAK,CAAC,IAAI,CACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAyB,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;CAuEF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {ReactiveController} from 'lit';\n\n/**\n * An element that supports single-selection with `SingleSelectionController`.\n */\nexport interface SingleSelectionElement extends HTMLElement {\n /**\n * Whether or not the element is selected.\n */\n checked: boolean;\n}\n\n/**\n * A `ReactiveController` that provides root node-scoped single selection for\n * elements, similar to native `<input type=\"radio\">` selection.\n *\n * To use, elements should add the controller and call\n * `selectionController.handleCheckedChange()` in a getter/setter. This must\n * be synchronous to match native behavior.\n *\n * @example\n * const CHECKED = Symbol('checked');\n *\n * class MyToggle extends LitElement {\n * get checked() { return this[CHECKED]; }\n * set checked(checked: boolean) {\n * const oldValue = this.checked;\n * if (oldValue === checked) {\n * return;\n * }\n *\n * this[CHECKED] = checked;\n * this.selectionController.handleCheckedChange();\n * this.requestUpdate('checked', oldValue);\n * }\n *\n * [CHECKED] = false;\n *\n * private selectionController = new SingleSelectionController(this);\n *\n * constructor() {\n * super();\n * this.addController(this.selectionController);\n * }\n * }\n */\nexport class SingleSelectionController implements ReactiveController {\n private focused = false;\n private root: ParentNode|null = null;\n\n constructor(private readonly host: SingleSelectionElement) {}\n\n hostConnected() {\n this.root = this.host.getRootNode() as ParentNode;\n this.host.addEventListener('keydown', this.handleKeyDown);\n this.host.addEventListener('focusin', this.handleFocusIn);\n this.host.addEventListener('focusout', this.handleFocusOut);\n if (this.host.checked) {\n // Uncheck other siblings when attached if already checked. This mimics\n // native <input type=\"radio\"> behavior.\n this.uncheckSiblings();\n }\n\n // Update for the newly added host.\n this.updateTabIndices();\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.handleKeyDown);\n this.host.removeEventListener('focusin', this.handleFocusIn);\n this.host.removeEventListener('focusout', this.handleFocusOut);\n // Update for siblings that are still connected.\n this.updateTabIndices();\n this.root = null;\n }\n\n /**\n * Should be called whenever the host's `checked` property changes\n * synchronously.\n */\n handleCheckedChange() {\n if (!this.host.checked) {\n return;\n }\n\n this.uncheckSiblings();\n this.updateTabIndices();\n }\n\n private readonly handleFocusIn = () => {\n this.focused = true;\n this.updateTabIndices();\n };\n\n private readonly handleFocusOut = () => {\n this.focused = false;\n this.updateTabIndices();\n };\n\n private uncheckSiblings() {\n for (const sibling of this.getNamedSiblings()) {\n if (sibling !== this.host) {\n sibling.checked = false;\n }\n }\n }\n\n /**\n * Updates the `tabindex` of the host and its siblings.\n */\n private updateTabIndices() {\n // There are three tabindex states for a group of elements:\n // 1. If any are checked, that element is focusable.\n const siblings = this.getNamedSiblings();\n const checkedSibling = siblings.find(sibling => sibling.checked);\n // 2. If an element is focused, the others are no longer focusable.\n if (checkedSibling || this.focused) {\n const focusable = checkedSibling || this.host;\n focusable.removeAttribute('tabindex');\n\n for (const sibling of siblings) {\n if (sibling !== focusable) {\n sibling.tabIndex = -1;\n }\n }\n return;\n }\n\n // 3. If none are checked or focused, all are focusable.\n for (const sibling of siblings) {\n sibling.removeAttribute('tabindex');\n }\n }\n\n /**\n * Retrieves all siblings in the host element's root with the same `name`\n * attribute.\n */\n private getNamedSiblings() {\n const name = this.host.getAttribute('name');\n if (!name || !this.root) {\n return [];\n }\n\n return Array.from(\n this.root.querySelectorAll<SingleSelectionElement>(`[name=\"${name}\"]`));\n }\n\n /**\n * Handles arrow key events from the host. Using the arrow keys will\n * select and check the next or previous sibling with the host's\n * `name` attribute.\n */\n private readonly handleKeyDown = (event: KeyboardEvent) => {\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n // Ignore non-arrow keys\n if (!isLeft && !isRight && !isDown && !isUp) {\n return;\n }\n\n // Don't try to select another sibling if there aren't any.\n const siblings = this.getNamedSiblings();\n if (!siblings.length) {\n return;\n }\n\n // Prevent default interactions on the element for arrow keys,\n // since this controller will introduce new behavior.\n event.preventDefault();\n\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this.host).direction === 'rtl';\n const forwards = isRtl ? isLeft || isDown : isRight || isDown;\n\n const hostIndex = siblings.indexOf(this.host);\n let nextIndex = forwards ? hostIndex + 1 : hostIndex - 1;\n // Search for the next sibling that is not disabled to select.\n // If we return to the host index, there is nothing to select.\n while (nextIndex !== hostIndex) {\n if (nextIndex >= siblings.length) {\n // Return to start if moving past the last item.\n nextIndex = 0;\n } else if (nextIndex < 0) {\n // Go to end if moving before the first item.\n nextIndex = siblings.length - 1;\n }\n\n // Check if the next sibling is disabled. If so,\n // move the index and continue searching.\n const nextSibling = siblings[nextIndex];\n if (nextSibling.hasAttribute('disabled')) {\n if (forwards) {\n nextIndex++;\n } else {\n nextIndex--;\n }\n\n continue;\n }\n\n // Uncheck and remove focusability from other siblings.\n for (const sibling of siblings) {\n if (sibling !== nextSibling) {\n sibling.checked = false;\n sibling.tabIndex = -1;\n }\n }\n\n // The next sibling should be checked, focused and dispatch a change event\n nextSibling.removeAttribute('tabindex');\n nextSibling.click();\n break;\n }\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QAC/E,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QACtB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACR,wEAAwE,CAAC,CAAC;SAC/E;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/lib/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './lib/select.js';\nimport {SelectOptionHarness} from './lib/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element = await (new SelectFieldHardness(field)).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map((item) => new SelectOptionHarness(item));\n }\n\n async click(quick = true) {\n this.element.quick = quick;\n await this.element.updateComplete;\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()');\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAe;IACtC,QAAQ;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAU,CAAC;IAClE,CAAC;IACD;;OAEG;IACgB,KAAK,CAAC,qBAAqB;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEQ,KAAK,CAAC,UAAU;QACvB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,OAAO,GACT,MAAM,CAAC,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC;QACnE,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAA8B,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI;QACtB,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,OAAO,CAAC,IAAI,CACR,wEAAwE,CAAC,CAAC;SAC/E;QACD,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;CACF;AAED,+BAA+B;AAC/B,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,4EAA4E;IACnE,qBAAqB;QAC5B,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\n\nimport {FieldHarness} from '../field/harness.js';\nimport {Field} from '../field/lib/field.js';\nimport {Harness} from '../testing/harness.js';\n\nimport {Select} from './lib/select.js';\nimport {SelectOptionHarness} from './lib/selectoption/harness.js';\n\n/**\n * Test harness for menu.\n */\nexport class SelectHarness extends Harness<Select> {\n protected getField() {\n return this.element.renderRoot.querySelector('.field') as Field;\n }\n /**\n * Shows the menu and returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return this.getField();\n }\n\n override async startHover() {\n const field = await this.getField();\n const element =\n await (new SelectFieldHardness(field)).getInteractiveElement();\n this.simulateStartHover(element);\n }\n\n /** @return ListItem harnesses for the menu's items. */\n getItems() {\n return this.element.options.map(\n (item) => new SelectOptionHarness(item as typeof item&LitElement));\n }\n\n async click(quick = true) {\n this.element.quick = quick;\n await this.element.updateComplete;\n const field = await this.getField();\n field.click();\n }\n\n async clickOption(index: number) {\n const menu = this.element.renderRoot.querySelector('md-menu')!;\n if (!menu.open) {\n console.warn(\n 'Internal menu is not open. Try calling SelectHarness.prototype.click()');\n }\n (await this.getItems()[index].getInteractiveElement()).click();\n }\n}\n\n// Private class (not exported)\nclass SelectFieldHardness extends FieldHarness {\n /* Expose so that we can call it from our internal code in SelectHarness. */\n override getInteractiveElement() {\n return super.getInteractiveElement();\n }\n}\n"]}
@@ -73,12 +73,6 @@ export declare abstract class Select extends LitElement {
73
73
  * Text to display in the field. Only set for SSR.
74
74
  */
75
75
  displayText: string;
76
- /**
77
- * When set to true, the error text's `role="alert"` will be removed, then
78
- * re-added after an animation frame. This will re-announce an error message
79
- * to screen readers.
80
- */
81
- private refreshErrorAlert;
82
76
  private focused;
83
77
  private open;
84
78
  private readonly field;
@@ -132,9 +126,6 @@ export declare abstract class Select extends LitElement {
132
126
  private renderLeadingIcon;
133
127
  private renderTrailingIcon;
134
128
  private renderLabel;
135
- private renderSupportingText;
136
- private getSupportingText;
137
- private shouldErrorAnnounce;
138
129
  private renderMenu;
139
130
  private renderMenuContent;
140
131
  /**
@@ -165,7 +156,6 @@ export declare abstract class Select extends LitElement {
165
156
  private updateValueAndDisplayText;
166
157
  protected update(changed: PropertyValues<this>): void;
167
158
  protected firstUpdated(changed: PropertyValues<this>): Promise<void>;
168
- protected updated(changedProperties: PropertyValues): void;
169
159
  /**
170
160
  * Focuses and activates the last selected item upon opening, and resets other
171
161
  * active items.
@@ -6,7 +6,7 @@
6
6
  var _a;
7
7
  import { __decorate } from "tslib";
8
8
  import '../../menu/menu.js';
9
- import { html, LitElement, nothing } from 'lit';
9
+ import { html, LitElement } from 'lit';
10
10
  import { property, query, queryAssignedElements, state } from 'lit/decorators.js';
11
11
  import { classMap } from 'lit/directives/class-map.js';
12
12
  import { html as staticHtml } from 'lit/static-html.js';
@@ -83,12 +83,6 @@ export class Select extends LitElement {
83
83
  * Text to display in the field. Only set for SSR.
84
84
  */
85
85
  this.displayText = '';
86
- /**
87
- * When set to true, the error text's `role="alert"` will be removed, then
88
- * re-added after an animation frame. This will re-announce an error message
89
- * to screen readers.
90
- */
91
- this.refreshErrorAlert = false;
92
86
  this.focused = false;
93
87
  this.open = false;
94
88
  this[_a] = '';
@@ -166,6 +160,7 @@ export class Select extends LitElement {
166
160
  };
167
161
  }
168
162
  renderField() {
163
+ // TODO(b/290078041): add aria-label/describedby
169
164
  return staticHtml `
170
165
  <${this.fieldTag}
171
166
  aria-haspopup="listbox"
@@ -181,6 +176,8 @@ export class Select extends LitElement {
181
176
  .error=${this.error}
182
177
  .hasStart=${this.hasLeadingIcon}
183
178
  .hasEnd=${this.hasTrailingIcon}
179
+ supporting-text=${this.supportingText}
180
+ error-text=${this.errorText}
184
181
  @keydown =${this.handleKeydown}
185
182
  @click=${this.handleClick}
186
183
  @focus=${this.handleFocus}
@@ -193,7 +190,6 @@ export class Select extends LitElement {
193
190
  this.renderLeadingIcon(),
194
191
  this.renderLabel(),
195
192
  this.renderTrailingIcon(),
196
- this.renderSupportingText(),
197
193
  ];
198
194
  }
199
195
  renderLeadingIcon() {
@@ -217,25 +213,6 @@ export class Select extends LitElement {
217
213
  id="label"
218
214
  class="label">${this.displayText || html `&nbsp;`}</div>`;
219
215
  }
220
- renderSupportingText() {
221
- const text = this.getSupportingText();
222
- if (!text) {
223
- return nothing;
224
- }
225
- return html `<span id="support"
226
- slot="supporting-text"
227
- role=${this.shouldErrorAnnounce() ? 'alert' : nothing}>${text}</span>`;
228
- }
229
- getSupportingText() {
230
- return this.error && this.errorText ? this.errorText : this.supportingText;
231
- }
232
- shouldErrorAnnounce() {
233
- // Announce if there is an error and error text visible.
234
- // If refreshErrorAlert is true, do not announce. This will remove the
235
- // role="alert" attribute. Another render cycle will happen after an
236
- // animation frame to re-add the role.
237
- return this.error && !!this.errorText && !this.refreshErrorAlert;
238
- }
239
216
  renderMenu() {
240
217
  return html `
241
218
  <md-menu
@@ -375,16 +352,6 @@ export class Select extends LitElement {
375
352
  }
376
353
  super.firstUpdated(changed);
377
354
  }
378
- updated(changedProperties) {
379
- // Keep changedProperties arg so that subclasses may call it
380
- if (this.refreshErrorAlert) {
381
- // The past render cycle removed the role="alert" from the error message.
382
- // Re-add it after an animation frame to re-announce the error.
383
- requestAnimationFrame(() => {
384
- this.refreshErrorAlert = false;
385
- });
386
- }
387
- }
388
355
  /**
389
356
  * Focuses and activates the last selected item upon opening, and resets other
390
357
  * active items.
@@ -559,9 +526,6 @@ __decorate([
559
526
  __decorate([
560
527
  property({ attribute: 'display-text' })
561
528
  ], Select.prototype, "displayText", void 0);
562
- __decorate([
563
- state()
564
- ], Select.prototype, "refreshErrorAlert", void 0);
565
529
  __decorate([
566
530
  state()
567
531
  ], Select.prototype, "focused", void 0);