@material/web 1.0.2-nightly.f7a66a8.0 → 1.1.1

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 (120) hide show
  1. package/checkbox/internal/checkbox.d.ts +1 -0
  2. package/checkbox/internal/checkbox.js +6 -1
  3. package/checkbox/internal/checkbox.js.map +1 -1
  4. package/chips/internal/_shared.scss +16 -3
  5. package/chips/internal/_trailing-icon.scss +2 -1
  6. package/chips/internal/assist-styles.css.js +1 -1
  7. package/chips/internal/assist-styles.css.js.map +1 -1
  8. package/chips/internal/chip-set.js +2 -6
  9. package/chips/internal/chip-set.js.map +1 -1
  10. package/chips/internal/chip.d.ts +8 -0
  11. package/chips/internal/chip.js +17 -2
  12. package/chips/internal/chip.js.map +1 -1
  13. package/chips/internal/filter-chip.d.ts +8 -0
  14. package/chips/internal/filter-chip.js +17 -4
  15. package/chips/internal/filter-chip.js.map +1 -1
  16. package/chips/internal/filter-styles.css.js +1 -1
  17. package/chips/internal/filter-styles.css.js.map +1 -1
  18. package/chips/internal/input-styles.css.js +1 -1
  19. package/chips/internal/input-styles.css.js.map +1 -1
  20. package/chips/internal/shared-styles.css.js +1 -1
  21. package/chips/internal/shared-styles.css.js.map +1 -1
  22. package/chips/internal/suggestion-styles.css.js +1 -1
  23. package/chips/internal/suggestion-styles.css.js.map +1 -1
  24. package/chips/internal/trailing-icon-styles.css.js +1 -1
  25. package/chips/internal/trailing-icon-styles.css.js.map +1 -1
  26. package/chips/internal/trailing-icons.js +8 -4
  27. package/chips/internal/trailing-icons.js.map +1 -1
  28. package/fab/internal/_shared.scss +1 -0
  29. package/fab/internal/shared-styles.css.js +1 -1
  30. package/fab/internal/shared-styles.css.js.map +1 -1
  31. package/field/internal/_content.scss +3 -1
  32. package/field/internal/shared-styles.css.js +1 -1
  33. package/field/internal/shared-styles.css.js.map +1 -1
  34. package/internal/aria/aria.d.ts +0 -29
  35. package/internal/aria/aria.js +0 -141
  36. package/internal/aria/aria.js.map +1 -1
  37. package/internal/controller/form-submitter.js +2 -2
  38. package/internal/controller/form-submitter.js.map +1 -1
  39. package/labs/behaviors/constraint-validation.d.ts +2 -2
  40. package/labs/behaviors/constraint-validation.js +18 -1
  41. package/labs/behaviors/constraint-validation.js.map +1 -1
  42. package/labs/behaviors/element-internals.js +1 -5
  43. package/labs/behaviors/element-internals.js.map +1 -1
  44. package/labs/behaviors/focusable.js +20 -7
  45. package/labs/behaviors/focusable.js.map +1 -1
  46. package/labs/behaviors/form-associated.js +31 -11
  47. package/labs/behaviors/form-associated.js.map +1 -1
  48. package/labs/behaviors/on-report-validity.d.ts +70 -0
  49. package/labs/behaviors/on-report-validity.js +185 -0
  50. package/labs/behaviors/on-report-validity.js.map +1 -0
  51. package/labs/behaviors/validators/checkbox-validator.d.ts +6 -3
  52. package/labs/behaviors/validators/checkbox-validator.js.map +1 -1
  53. package/labs/behaviors/validators/radio-validator.d.ts +38 -0
  54. package/labs/behaviors/validators/radio-validator.js +65 -0
  55. package/labs/behaviors/validators/radio-validator.js.map +1 -0
  56. package/labs/behaviors/validators/select-validator.d.ts +35 -0
  57. package/labs/behaviors/validators/select-validator.js +33 -0
  58. package/labs/behaviors/validators/select-validator.js.map +1 -0
  59. package/labs/behaviors/validators/text-field-validator.d.ts +110 -0
  60. package/labs/behaviors/validators/text-field-validator.js +146 -0
  61. package/labs/behaviors/validators/text-field-validator.js.map +1 -0
  62. package/labs/behaviors/validators/validator.d.ts +4 -0
  63. package/labs/behaviors/validators/validator.js.map +1 -1
  64. package/labs/card/internal/_outlined-card.scss +1 -1
  65. package/labs/card/internal/_shared.scss +10 -2
  66. package/labs/card/internal/outlined-styles.css.js +1 -1
  67. package/labs/card/internal/outlined-styles.css.js.map +1 -1
  68. package/labs/card/internal/shared-styles.css.js +1 -1
  69. package/labs/card/internal/shared-styles.css.js.map +1 -1
  70. package/labs/segmentedbutton/internal/_shared.scss +1 -0
  71. package/labs/segmentedbutton/internal/shared-styles.css.js +1 -1
  72. package/labs/segmentedbutton/internal/shared-styles.css.js.map +1 -1
  73. package/list/internal/list.js +2 -6
  74. package/list/internal/list.js.map +1 -1
  75. package/list/internal/listitem/_list-item.scss +2 -0
  76. package/list/internal/listitem/list-item-styles.css.js +1 -1
  77. package/list/internal/listitem/list-item-styles.css.js.map +1 -1
  78. package/menu/internal/controllers/menuItemController.d.ts +13 -1
  79. package/menu/internal/controllers/menuItemController.js +32 -6
  80. package/menu/internal/controllers/menuItemController.js.map +1 -1
  81. package/menu/internal/menu.js +7 -8
  82. package/menu/internal/menu.js.map +1 -1
  83. package/menu/internal/menuitem/menu-item.d.ts +2 -0
  84. package/menu/internal/menuitem/menu-item.js +13 -1
  85. package/menu/internal/menuitem/menu-item.js.map +1 -1
  86. package/package.json +1 -1
  87. package/radio/internal/radio.d.ts +11 -1
  88. package/radio/internal/radio.js +28 -2
  89. package/radio/internal/radio.js.map +1 -1
  90. package/radio/internal/single-selection-controller.d.ts +5 -5
  91. package/radio/internal/single-selection-controller.js +16 -14
  92. package/radio/internal/single-selection-controller.js.map +1 -1
  93. package/select/internal/_shared.scss +5 -0
  94. package/select/internal/select.d.ts +21 -72
  95. package/select/internal/select.js +106 -184
  96. package/select/internal/select.js.map +1 -1
  97. package/select/internal/selectoption/select-option.d.ts +2 -0
  98. package/select/internal/selectoption/select-option.js +13 -1
  99. package/select/internal/selectoption/select-option.js.map +1 -1
  100. package/select/internal/selectoption/selectOptionController.d.ts +7 -3
  101. package/select/internal/selectoption/selectOptionController.js +8 -11
  102. package/select/internal/selectoption/selectOptionController.js.map +1 -1
  103. package/select/internal/shared-styles.css.js +1 -1
  104. package/select/internal/shared-styles.css.js.map +1 -1
  105. package/switch/internal/_icon.scss +14 -10
  106. package/switch/internal/switch-styles.css.js +1 -1
  107. package/switch/internal/switch-styles.css.js.map +1 -1
  108. package/switch/internal/switch.js +12 -8
  109. package/switch/internal/switch.js.map +1 -1
  110. package/tabs/internal/tab.js +2 -6
  111. package/tabs/internal/tab.js.map +1 -1
  112. package/tabs/internal/tabs.js +2 -6
  113. package/tabs/internal/tabs.js.map +1 -1
  114. package/textfield/internal/text-field.d.ts +9 -74
  115. package/textfield/internal/text-field.js +34 -150
  116. package/textfield/internal/text-field.js.map +1 -1
  117. package/tokens/_md-comp-assist-chip.scss +11 -0
  118. package/tokens/_md-comp-filter-chip.scss +14 -0
  119. package/tokens/_md-comp-input-chip.scss +14 -0
  120. package/tokens/_md-comp-suggestion-chip.scss +11 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Validator } from './validator.js';
7
+ /**
8
+ * A validator that provides constraint validation that emulates `<input>` and
9
+ * `<textarea>` validation.
10
+ */
11
+ export class TextFieldValidator extends Validator {
12
+ computeValidity({ state, renderedControl }) {
13
+ let inputOrTextArea = renderedControl;
14
+ if (isInputState(state) && !inputOrTextArea) {
15
+ // Get cached <input> or create it.
16
+ inputOrTextArea = this.inputControl || document.createElement('input');
17
+ // Cache the <input> to re-use it next time.
18
+ this.inputControl = inputOrTextArea;
19
+ }
20
+ else if (!inputOrTextArea) {
21
+ // Get cached <textarea> or create it.
22
+ inputOrTextArea =
23
+ this.textAreaControl || document.createElement('textarea');
24
+ // Cache the <textarea> to re-use it next time.
25
+ this.textAreaControl = inputOrTextArea;
26
+ }
27
+ // Set this variable so we can check it for input-specific properties.
28
+ const input = isInputState(state)
29
+ ? inputOrTextArea
30
+ : null;
31
+ // Set input's "type" first, since this can change the other properties
32
+ if (input) {
33
+ input.type = state.type;
34
+ }
35
+ if (inputOrTextArea.value !== state.value) {
36
+ // Only programmatically set the value if there's a difference. When using
37
+ // the rendered control, the value will always be up to date. Setting the
38
+ // property (even if it's the same string) will reset the internal <input>
39
+ // dirty flag, making minlength and maxlength validation reset.
40
+ inputOrTextArea.value = state.value;
41
+ }
42
+ inputOrTextArea.required = state.required;
43
+ // The following IDLAttribute properties will always hydrate an attribute,
44
+ // even if set to a the default value ('' or -1). The presence of the
45
+ // attribute triggers constraint validation, so we must remove the attribute
46
+ // when empty.
47
+ if (input) {
48
+ const inputState = state;
49
+ if (inputState.pattern) {
50
+ input.pattern = inputState.pattern;
51
+ }
52
+ else {
53
+ input.removeAttribute('pattern');
54
+ }
55
+ if (inputState.min) {
56
+ input.min = inputState.min;
57
+ }
58
+ else {
59
+ input.removeAttribute('min');
60
+ }
61
+ if (inputState.max) {
62
+ input.max = inputState.max;
63
+ }
64
+ else {
65
+ input.removeAttribute('max');
66
+ }
67
+ if (inputState.step) {
68
+ input.step = inputState.step;
69
+ }
70
+ else {
71
+ input.removeAttribute('step');
72
+ }
73
+ }
74
+ // Use -1 to represent no minlength and maxlength, which is what the
75
+ // platform input returns. However, it will throw an error if you try to
76
+ // manually set it to -1.
77
+ if (state.minLength > -1) {
78
+ inputOrTextArea.minLength = state.minLength;
79
+ }
80
+ else {
81
+ inputOrTextArea.removeAttribute('minlength');
82
+ }
83
+ if (state.maxLength > -1) {
84
+ inputOrTextArea.maxLength = state.maxLength;
85
+ }
86
+ else {
87
+ inputOrTextArea.removeAttribute('maxlength');
88
+ }
89
+ return {
90
+ validity: inputOrTextArea.validity,
91
+ validationMessage: inputOrTextArea.validationMessage,
92
+ };
93
+ }
94
+ equals({ state: prev }, { state: next }) {
95
+ // Check shared input and textarea properties
96
+ const inputOrTextAreaEqual = prev.type === next.type &&
97
+ prev.value === next.value &&
98
+ prev.required === next.required &&
99
+ prev.minLength === next.minLength &&
100
+ prev.maxLength === next.maxLength;
101
+ if (!isInputState(prev) || !isInputState(next)) {
102
+ // Both are textareas, all relevant properties are equal.
103
+ return inputOrTextAreaEqual;
104
+ }
105
+ // Check additional input-specific properties.
106
+ return (inputOrTextAreaEqual &&
107
+ prev.pattern === next.pattern &&
108
+ prev.min === next.min &&
109
+ prev.max === next.max &&
110
+ prev.step === next.step);
111
+ }
112
+ copy({ state }) {
113
+ // Don't hold a reference to the rendered control when copying since we
114
+ // don't use it when checking if the state changed.
115
+ return {
116
+ state: isInputState(state)
117
+ ? this.copyInput(state)
118
+ : this.copyTextArea(state),
119
+ renderedControl: null,
120
+ };
121
+ }
122
+ copyInput(state) {
123
+ const { type, pattern, min, max, step } = state;
124
+ return {
125
+ ...this.copySharedState(state),
126
+ type,
127
+ pattern,
128
+ min,
129
+ max,
130
+ step,
131
+ };
132
+ }
133
+ copyTextArea(state) {
134
+ return {
135
+ ...this.copySharedState(state),
136
+ type: state.type,
137
+ };
138
+ }
139
+ copySharedState({ value, required, minLength, maxLength, }) {
140
+ return { value, required, minLength, maxLength };
141
+ }
142
+ }
143
+ function isInputState(state) {
144
+ return state.type !== 'textarea';
145
+ }
146
+ //# sourceMappingURL=text-field-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field-validator.js","sourceRoot":"","sources":["text-field-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAoGzC;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAyB;IAI5C,eAAe,CAAC,EAAC,KAAK,EAAE,eAAe,EAAiB;QACzE,IAAI,eAAe,GAAG,eAAe,CAAC;QACtC,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE;YAC3C,mCAAmC;YACnC,eAAe,GAAG,IAAI,CAAC,YAAY,IAAI,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACvE,4CAA4C;YAC5C,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC;SACrC;aAAM,IAAI,CAAC,eAAe,EAAE;YAC3B,sCAAsC;YACtC,eAAe;gBACb,IAAI,CAAC,eAAe,IAAI,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC7D,+CAA+C;YAC/C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;SACxC;QAED,sEAAsE;QACtE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAE,eAAoC;YACvC,CAAC,CAAC,IAAI,CAAC;QAET,uEAAuE;QACvE,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;SACzB;QAED,IAAI,eAAe,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE;YACzC,0EAA0E;YAC1E,yEAAyE;YACzE,0EAA0E;YAC1E,+DAA+D;YAC/D,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;SACrC;QAED,eAAe,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE1C,0EAA0E;QAC1E,qEAAqE;QACrE,4EAA4E;QAC5E,cAAc;QACd,IAAI,KAAK,EAAE;YACT,MAAM,UAAU,GAAG,KAAmB,CAAC;YACvC,IAAI,UAAU,CAAC,OAAO,EAAE;gBACtB,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;aACpC;iBAAM;gBACL,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;aAClC;YAED,IAAI,UAAU,CAAC,GAAG,EAAE;gBAClB,KAAK,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;aAC5B;iBAAM;gBACL,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;aAC9B;YAED,IAAI,UAAU,CAAC,GAAG,EAAE;gBAClB,KAAK,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;aAC5B;iBAAM;gBACL,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;aAC9B;YAED,IAAI,UAAU,CAAC,IAAI,EAAE;gBACnB,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;aAC9B;iBAAM;gBACL,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;aAC/B;SACF;QAED,oEAAoE;QACpE,wEAAwE;QACxE,yBAAyB;QACzB,IAAI,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE;YACxB,eAAe,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;SAC7C;aAAM;YACL,eAAe,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAC9C;QAED,IAAI,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE;YACxB,eAAe,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;SAC7C;aAAM;YACL,eAAe,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAC9C;QAED,OAAO;YACL,QAAQ,EAAE,eAAe,CAAC,QAAQ;YAClC,iBAAiB,EAAE,eAAe,CAAC,iBAAiB;SACrD,CAAC;IACJ,CAAC;IAEkB,MAAM,CACvB,EAAC,KAAK,EAAE,IAAI,EAAiB,EAC7B,EAAC,KAAK,EAAE,IAAI,EAAiB;QAE7B,6CAA6C;QAC7C,MAAM,oBAAoB,GACxB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YACvB,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;YACzB,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;YAC/B,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS;YACjC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC;QAEpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YAC9C,yDAAyD;YACzD,OAAO,oBAAoB,CAAC;SAC7B;QAED,8CAA8C;QAC9C,OAAO,CACL,oBAAoB;YACpB,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO;YAC7B,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG;YACrB,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG;YACrB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CACxB,CAAC;IACJ,CAAC;IAEkB,IAAI,CAAC,EAAC,KAAK,EAAiB;QAC7C,uEAAuE;QACvE,mDAAmD;QACnD,OAAO;YACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;gBACxB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBACvB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAC5B,eAAe,EAAE,IAAI;SACtB,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,KAAiB;QACjC,MAAM,EAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC;QAC9C,OAAO;YACL,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;YAC9B,IAAI;YACJ,OAAO;YACP,GAAG;YACH,GAAG;YACH,IAAI;SACL,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,KAAoB;QACvC,OAAO;YACL,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;YAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,GACmB;QAC5B,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAC,CAAC;IACjD,CAAC;CACF;AAED,SAAS,YAAY,CAAC,KAAiC;IACrD,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Validator} from './validator.js';\n\n/**\n * Constraint validation for a text field.\n */\nexport interface TextFieldState {\n /**\n * The input or textarea state to validate.\n */\n state: InputState | TextAreaState;\n\n /**\n * The `<input>` or `<textarea>` that is rendered on the page.\n *\n * `minlength` and `maxlength` validation do not apply until a user has\n * interacted with the control and the element is internally marked as dirty.\n * This is a spec quirk, the two properties behave differently from other\n * constraint validation.\n *\n * This means we need an actual rendered element instead of a virtual one,\n * since the virtual element will never be marked as dirty.\n *\n * This can be `null` if the element has not yet rendered, and the validator\n * will fall back to virtual elements for other constraint validation\n * properties, which do apply even if the control is not dirty.\n */\n renderedControl: HTMLInputElement | HTMLTextAreaElement | null;\n}\n\n/**\n * Constraint validation properties for an `<input>`.\n */\nexport interface InputState extends SharedInputAndTextAreaState {\n /**\n * The `<input>` type.\n *\n * Not all constraint validation properties apply to every type. See\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation#validation-related_attributes\n * for which properties will apply to which types.\n */\n readonly type: string;\n\n /**\n * The regex pattern a value must match.\n */\n readonly pattern: string;\n\n /**\n * The minimum value.\n */\n readonly min: string;\n\n /**\n * The maximum value.\n */\n readonly max: string;\n\n /**\n * The step interval of the value.\n */\n readonly step: string;\n}\n\n/**\n * Constraint validation properties for a `<textarea>`.\n */\nexport interface TextAreaState extends SharedInputAndTextAreaState {\n /**\n * The type, must be \"textarea\" to inform the validator to use `<textarea>`\n * instead of `<input>`.\n */\n readonly type: 'textarea';\n}\n\n/**\n * Constraint validation properties shared between an `<input>` and\n * `<textarea>`.\n */\ninterface SharedInputAndTextAreaState {\n /**\n * The current value.\n */\n readonly value: string;\n\n /**\n * Whether the textarea is required.\n */\n readonly required: boolean;\n\n /**\n * The minimum length of the value.\n */\n readonly minLength: number;\n\n /**\n * The maximum length of the value.\n */\n readonly maxLength: number;\n}\n\n/**\n * A validator that provides constraint validation that emulates `<input>` and\n * `<textarea>` validation.\n */\nexport class TextFieldValidator extends Validator<TextFieldState> {\n private inputControl?: HTMLInputElement;\n private textAreaControl?: HTMLTextAreaElement;\n\n protected override computeValidity({state, renderedControl}: TextFieldState) {\n let inputOrTextArea = renderedControl;\n if (isInputState(state) && !inputOrTextArea) {\n // Get cached <input> or create it.\n inputOrTextArea = this.inputControl || document.createElement('input');\n // Cache the <input> to re-use it next time.\n this.inputControl = inputOrTextArea;\n } else if (!inputOrTextArea) {\n // Get cached <textarea> or create it.\n inputOrTextArea =\n this.textAreaControl || document.createElement('textarea');\n // Cache the <textarea> to re-use it next time.\n this.textAreaControl = inputOrTextArea;\n }\n\n // Set this variable so we can check it for input-specific properties.\n const input = isInputState(state)\n ? (inputOrTextArea as HTMLInputElement)\n : null;\n\n // Set input's \"type\" first, since this can change the other properties\n if (input) {\n input.type = state.type;\n }\n\n if (inputOrTextArea.value !== state.value) {\n // Only programmatically set the value if there's a difference. When using\n // the rendered control, the value will always be up to date. Setting the\n // property (even if it's the same string) will reset the internal <input>\n // dirty flag, making minlength and maxlength validation reset.\n inputOrTextArea.value = state.value;\n }\n\n inputOrTextArea.required = state.required;\n\n // The following IDLAttribute properties will always hydrate an attribute,\n // even if set to a the default value ('' or -1). The presence of the\n // attribute triggers constraint validation, so we must remove the attribute\n // when empty.\n if (input) {\n const inputState = state as InputState;\n if (inputState.pattern) {\n input.pattern = inputState.pattern;\n } else {\n input.removeAttribute('pattern');\n }\n\n if (inputState.min) {\n input.min = inputState.min;\n } else {\n input.removeAttribute('min');\n }\n\n if (inputState.max) {\n input.max = inputState.max;\n } else {\n input.removeAttribute('max');\n }\n\n if (inputState.step) {\n input.step = inputState.step;\n } else {\n input.removeAttribute('step');\n }\n }\n\n // Use -1 to represent no minlength and maxlength, which is what the\n // platform input returns. However, it will throw an error if you try to\n // manually set it to -1.\n if (state.minLength > -1) {\n inputOrTextArea.minLength = state.minLength;\n } else {\n inputOrTextArea.removeAttribute('minlength');\n }\n\n if (state.maxLength > -1) {\n inputOrTextArea.maxLength = state.maxLength;\n } else {\n inputOrTextArea.removeAttribute('maxlength');\n }\n\n return {\n validity: inputOrTextArea.validity,\n validationMessage: inputOrTextArea.validationMessage,\n };\n }\n\n protected override equals(\n {state: prev}: TextFieldState,\n {state: next}: TextFieldState,\n ) {\n // Check shared input and textarea properties\n const inputOrTextAreaEqual =\n prev.type === next.type &&\n prev.value === next.value &&\n prev.required === next.required &&\n prev.minLength === next.minLength &&\n prev.maxLength === next.maxLength;\n\n if (!isInputState(prev) || !isInputState(next)) {\n // Both are textareas, all relevant properties are equal.\n return inputOrTextAreaEqual;\n }\n\n // Check additional input-specific properties.\n return (\n inputOrTextAreaEqual &&\n prev.pattern === next.pattern &&\n prev.min === next.min &&\n prev.max === next.max &&\n prev.step === next.step\n );\n }\n\n protected override copy({state}: TextFieldState): TextFieldState {\n // Don't hold a reference to the rendered control when copying since we\n // don't use it when checking if the state changed.\n return {\n state: isInputState(state)\n ? this.copyInput(state)\n : this.copyTextArea(state),\n renderedControl: null,\n };\n }\n\n private copyInput(state: InputState): InputState {\n const {type, pattern, min, max, step} = state;\n return {\n ...this.copySharedState(state),\n type,\n pattern,\n min,\n max,\n step,\n };\n }\n\n private copyTextArea(state: TextAreaState): TextAreaState {\n return {\n ...this.copySharedState(state),\n type: state.type,\n };\n }\n\n private copySharedState({\n value,\n required,\n minLength,\n maxLength,\n }: SharedInputAndTextAreaState): SharedInputAndTextAreaState {\n return {value, required, minLength, maxLength};\n }\n}\n\nfunction isInputState(state: InputState | TextAreaState): state is InputState {\n return state.type !== 'textarea';\n}\n"]}
@@ -70,6 +70,10 @@ export declare abstract class Validator<State> {
70
70
  * Creates a copy of a state. This is used to cache state and check if it
71
71
  * changes.
72
72
  *
73
+ * Note: do NOT spread the {...state} to copy it. The actual state object is
74
+ * a web component, and trying to spread its getter/setter properties won't
75
+ * work.
76
+ *
73
77
  * @param state The state to copy.
74
78
  * @return A copy of the state.
75
79
  */
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,SAAS;IAgB7B;;;;;OAKG;IACH,YAA6B,eAA4B;QAA5B,oBAAe,GAAf,eAAe,CAAa;QAfzD;;;WAGG;QACK,oBAAe,GAAuB;YAC5C,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,EAAE;SACtB,CAAC;IAQ0D,CAAC;IAE7D;;;;;;;;;OASG;IACH,WAAW;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACrC,MAAM,eAAe,GACnB,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,EAAE;YACpB,OAAO,IAAI,CAAC,eAAe,CAAC;SAC7B;QAED,MAAM,EAAC,QAAQ,EAAE,iBAAiB,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG;YACrB,iBAAiB;YACjB,QAAQ,EAAE;gBACR,uEAAuE;gBACvE,kDAAkD;gBAClD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,cAAc,EAAE,QAAQ,CAAC,cAAc;gBACvC,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,YAAY,EAAE,QAAQ,CAAC,YAAY;aACpC;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CAkCF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A class that computes and caches `ValidityStateFlags` for a component with\n * a given `State` interface.\n *\n * Cached performance before computing validity is important since constraint\n * validation must be checked frequently and synchronously when properties\n * change.\n *\n * @template State The expected interface of properties relevant to constraint\n * validation.\n */\nexport abstract class Validator<State> {\n /**\n * The previous state, used to determine if state changed and validation needs\n * to be re-computed.\n */\n private prevState?: State;\n\n /**\n * The current validity state and message. This is cached and returns if\n * constraint validation state does not change.\n */\n private currentValidity: ValidityAndMessage = {\n validity: {},\n validationMessage: '',\n };\n\n /**\n * Creates a new validator.\n *\n * @param getCurrentState A callback that returns the current state of\n * constraint validation-related properties.\n */\n constructor(private readonly getCurrentState: () => State) {}\n\n /**\n * Returns the current `ValidityStateFlags` and validation message for the\n * validator.\n *\n * If the constraint validation state has not changed, this will return a\n * cached result. This is important since `getValidity()` can be called\n * frequently in response to synchronous property changes.\n *\n * @return The current validity and validation message.\n */\n getValidity(): ValidityAndMessage {\n const state = this.getCurrentState();\n const hasStateChanged =\n !this.prevState || !this.equals(this.prevState, state);\n if (!hasStateChanged) {\n return this.currentValidity;\n }\n\n const {validity, validationMessage} = this.computeValidity(state);\n this.prevState = this.copy(state);\n this.currentValidity = {\n validationMessage,\n validity: {\n // Change any `ValidityState` instances into `ValidityStateFlags` since\n // `ValidityState` cannot be easily `{...spread}`.\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n },\n };\n\n return this.currentValidity;\n }\n\n /**\n * Computes the `ValidityStateFlags` and validation message for a given set\n * of constraint validation properties.\n *\n * Implementations can use platform elements like `<input>` and `<select>` to\n * sync state and compute validation along with i18n'd messages. This function\n * may be expensive, and is only called when state changes.\n *\n * @param state The new state of constraint validation properties.\n * @return An object containing a `validity` property with\n * `ValidityStateFlags` and a `validationMessage` property.\n */\n protected abstract computeValidity(state: State): ValidityAndMessage;\n\n /**\n * Checks if two states are equal. This is used to check against cached state\n * to see if validity needs to be re-computed.\n *\n * @param prev The previous state.\n * @param next The next state.\n * @return True if the states are equal, or false if not.\n */\n protected abstract equals(prev: State, next: State): boolean;\n\n /**\n * Creates a copy of a state. This is used to cache state and check if it\n * changes.\n *\n * @param state The state to copy.\n * @return A copy of the state.\n */\n protected abstract copy(state: State): State;\n}\n\n/**\n * An object containing `ValidityStateFlags` and a corresponding validation\n * message.\n */\nexport interface ValidityAndMessage {\n /**\n * Validity flags.\n */\n validity: ValidityStateFlags;\n\n /**\n * The validation message for the associated flags. It may not be an empty\n * string if any of the validity flags are `true`.\n */\n validationMessage: string;\n}\n"]}
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,SAAS;IAgB7B;;;;;OAKG;IACH,YAA6B,eAA4B;QAA5B,oBAAe,GAAf,eAAe,CAAa;QAfzD;;;WAGG;QACK,oBAAe,GAAuB;YAC5C,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,EAAE;SACtB,CAAC;IAQ0D,CAAC;IAE7D;;;;;;;;;OASG;IACH,WAAW;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACrC,MAAM,eAAe,GACnB,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,EAAE;YACpB,OAAO,IAAI,CAAC,eAAe,CAAC;SAC7B;QAED,MAAM,EAAC,QAAQ,EAAE,iBAAiB,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG;YACrB,iBAAiB;YACjB,QAAQ,EAAE;gBACR,uEAAuE;gBACvE,kDAAkD;gBAClD,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,cAAc,EAAE,QAAQ,CAAC,cAAc;gBACvC,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,YAAY,EAAE,QAAQ,CAAC,YAAY;aACpC;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CAsCF","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * A class that computes and caches `ValidityStateFlags` for a component with\n * a given `State` interface.\n *\n * Cached performance before computing validity is important since constraint\n * validation must be checked frequently and synchronously when properties\n * change.\n *\n * @template State The expected interface of properties relevant to constraint\n * validation.\n */\nexport abstract class Validator<State> {\n /**\n * The previous state, used to determine if state changed and validation needs\n * to be re-computed.\n */\n private prevState?: State;\n\n /**\n * The current validity state and message. This is cached and returns if\n * constraint validation state does not change.\n */\n private currentValidity: ValidityAndMessage = {\n validity: {},\n validationMessage: '',\n };\n\n /**\n * Creates a new validator.\n *\n * @param getCurrentState A callback that returns the current state of\n * constraint validation-related properties.\n */\n constructor(private readonly getCurrentState: () => State) {}\n\n /**\n * Returns the current `ValidityStateFlags` and validation message for the\n * validator.\n *\n * If the constraint validation state has not changed, this will return a\n * cached result. This is important since `getValidity()` can be called\n * frequently in response to synchronous property changes.\n *\n * @return The current validity and validation message.\n */\n getValidity(): ValidityAndMessage {\n const state = this.getCurrentState();\n const hasStateChanged =\n !this.prevState || !this.equals(this.prevState, state);\n if (!hasStateChanged) {\n return this.currentValidity;\n }\n\n const {validity, validationMessage} = this.computeValidity(state);\n this.prevState = this.copy(state);\n this.currentValidity = {\n validationMessage,\n validity: {\n // Change any `ValidityState` instances into `ValidityStateFlags` since\n // `ValidityState` cannot be easily `{...spread}`.\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n },\n };\n\n return this.currentValidity;\n }\n\n /**\n * Computes the `ValidityStateFlags` and validation message for a given set\n * of constraint validation properties.\n *\n * Implementations can use platform elements like `<input>` and `<select>` to\n * sync state and compute validation along with i18n'd messages. This function\n * may be expensive, and is only called when state changes.\n *\n * @param state The new state of constraint validation properties.\n * @return An object containing a `validity` property with\n * `ValidityStateFlags` and a `validationMessage` property.\n */\n protected abstract computeValidity(state: State): ValidityAndMessage;\n\n /**\n * Checks if two states are equal. This is used to check against cached state\n * to see if validity needs to be re-computed.\n *\n * @param prev The previous state.\n * @param next The next state.\n * @return True if the states are equal, or false if not.\n */\n protected abstract equals(prev: State, next: State): boolean;\n\n /**\n * Creates a copy of a state. This is used to cache state and check if it\n * changes.\n *\n * Note: do NOT spread the {...state} to copy it. The actual state object is\n * a web component, and trying to spread its getter/setter properties won't\n * work.\n *\n * @param state The state to copy.\n * @return A copy of the state.\n */\n protected abstract copy(state: State): State;\n}\n\n/**\n * An object containing `ValidityStateFlags` and a corresponding validation\n * message.\n */\nexport interface ValidityAndMessage {\n /**\n * Validity flags.\n */\n validity: ValidityStateFlags;\n\n /**\n * The validation message for the associated flags. It may not be an empty\n * string if any of the validity flags are `true`.\n */\n validationMessage: string;\n}\n"]}
@@ -34,6 +34,6 @@
34
34
  }
35
35
 
36
36
  .container {
37
- outline: var(--_outline-width) solid var(--_outline-color);
37
+ border: var(--_outline-width) solid var(--_outline-color);
38
38
  }
39
39
  }
@@ -10,9 +10,12 @@
10
10
  @mixin styles() {
11
11
  :host {
12
12
  border-radius: var(--_container-shape);
13
+ box-sizing: border-box;
13
14
  display: flex;
14
- padding: 16px;
15
+ flex-direction: column;
15
16
  position: relative;
17
+ // Reset z-index for background elements.
18
+ z-index: 0;
16
19
  }
17
20
 
18
21
  // Separate element will be needed for disabled opacities (b/307361748)
@@ -21,10 +24,14 @@
21
24
  border-radius: inherit;
22
25
  inset: 0;
23
26
  position: absolute;
27
+ // Place behind content.
28
+ z-index: -1;
24
29
  }
25
30
 
26
31
  md-elevation {
27
32
  border-radius: inherit;
33
+ // Place behind content.
34
+ z-index: -1;
28
35
 
29
36
  @include elevation.theme(
30
37
  (
@@ -35,6 +42,7 @@
35
42
  }
36
43
 
37
44
  slot {
38
- z-index: 0; // Place content above background elements
45
+ // Allow content to inherit card's border radius
46
+ border-radius: inherit;
39
47
  }
40
48
  }
@@ -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-color: var(--md-outlined-card-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-outlined-card-container-elevation, 0);--_container-shadow-color: var(--md-outlined-card-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-outlined-card-container-shape, 12px);--_outline-color: var(--md-outlined-card-outline-color, var(--md-sys-color-outline-variant, #cac4d0));--_outline-width: var(--md-outlined-card-outline-width, 1px)}.container{outline:var(--_outline-width) solid var(--_outline-color)}/*# sourceMappingURL=outlined-styles.css.map */
7
+ export const styles = css `:host{--_container-color: var(--md-outlined-card-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-outlined-card-container-elevation, 0);--_container-shadow-color: var(--md-outlined-card-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-outlined-card-container-shape, 12px);--_outline-color: var(--md-outlined-card-outline-color, var(--md-sys-color-outline-variant, #cac4d0));--_outline-width: var(--md-outlined-card-outline-width, 1px)}.container{border:var(--_outline-width) solid var(--_outline-color)}/*# 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-color: var(--md-outlined-card-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-outlined-card-container-elevation, 0);--_container-shadow-color: var(--md-outlined-card-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-outlined-card-container-shape, 12px);--_outline-color: var(--md-outlined-card-outline-color, var(--md-sys-color-outline-variant, #cac4d0));--_outline-width: var(--md-outlined-card-outline-width, 1px)}.container{outline:var(--_outline-width) solid var(--_outline-color)}/*# 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{--_container-color: var(--md-outlined-card-container-color, var(--md-sys-color-surface, #fef7ff));--_container-elevation: var(--md-outlined-card-container-elevation, 0);--_container-shadow-color: var(--md-outlined-card-container-shadow-color, var(--md-sys-color-shadow, #000));--_container-shape: var(--md-outlined-card-container-shape, 12px);--_outline-color: var(--md-outlined-card-outline-color, var(--md-sys-color-outline-variant, #cac4d0));--_outline-width: var(--md-outlined-card-outline-width, 1px)}.container{border:var(--_outline-width) solid var(--_outline-color)}/*# sourceMappingURL=outlined-styles.css.map */\n`;\n "]}
@@ -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{border-radius:var(--_container-shape);display:flex;padding:16px;position:relative}.container{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}md-elevation{border-radius:inherit;--md-elevation-level: var(--_container-elevation);--md-elevation-shadow-color: var(--_container-shadow-color)}slot{z-index:0}/*# sourceMappingURL=shared-styles.css.map */
7
+ export const styles = css `:host{border-radius:var(--_container-shape);box-sizing:border-box;display:flex;flex-direction:column;position:relative;z-index:0}.container{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute;z-index:-1}md-elevation{border-radius:inherit;z-index:-1;--md-elevation-level: var(--_container-elevation);--md-elevation-shadow-color: var(--_container-shadow-color)}slot{border-radius:inherit}/*# sourceMappingURL=shared-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=shared-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-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{border-radius:var(--_container-shape);display:flex;padding:16px;position:relative}.container{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute}md-elevation{border-radius:inherit;--md-elevation-level: var(--_container-elevation);--md-elevation-shadow-color: var(--_container-shadow-color)}slot{z-index:0}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-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{border-radius:var(--_container-shape);box-sizing:border-box;display:flex;flex-direction:column;position:relative;z-index:0}.container{background:var(--_container-color);border-radius:inherit;inset:0;position:absolute;z-index:-1}md-elevation{border-radius:inherit;z-index:-1;--md-elevation-level: var(--_container-elevation);--md-elevation-shadow-color: var(--_container-shadow-color)}slot{border-radius:inherit}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
@@ -45,6 +45,7 @@
45
45
  :host {
46
46
  display: inline-flex;
47
47
  outline: none;
48
+ -webkit-tap-highlight-color: transparent;
48
49
  }
49
50
 
50
51
  .md3-segmented-button {
@@ -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 `@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */
7
+ export const styles = css `@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=shared-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-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`@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-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`@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
@@ -6,7 +6,6 @@
6
6
  import { __decorate } from "tslib";
7
7
  import { html, isServer, LitElement } from 'lit';
8
8
  import { queryAssignedElements } from 'lit/decorators.js';
9
- import { polyfillARIAMixin, polyfillElementInternalsAria, } from '../../internal/aria/aria.js';
10
9
  import { ListController, NavigableKeys } from './list-controller.js';
11
10
  const NAVIGABLE_KEY_SET = new Set(Object.values(NavigableKeys));
12
11
  // tslint:disable-next-line:enforce-comments-on-exported-symbols
@@ -30,9 +29,9 @@ export class List extends LitElement {
30
29
  isNavigableKey: (key) => NAVIGABLE_KEY_SET.has(key),
31
30
  isActivatable: (item) => !item.disabled && item.type !== 'text',
32
31
  });
33
- this.internals = polyfillElementInternalsAria(this,
32
+ this.internals =
34
33
  // Cast needed for closure
35
- this.attachInternals());
34
+ this.attachInternals();
36
35
  if (!isServer) {
37
36
  this.internals.role = 'list';
38
37
  this.addEventListener('keydown', this.listController.handleKeydown);
@@ -66,9 +65,6 @@ export class List extends LitElement {
66
65
  return this.listController.activatePreviousItem();
67
66
  }
68
67
  }
69
- (() => {
70
- polyfillARIAMixin(List);
71
- })();
72
68
  __decorate([
73
69
  queryAssignedElements({ flatten: true })
74
70
  ], List.prototype, "slotItems", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAGnE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAMxE,gEAAgE;AAChE,MAAM,OAAO,IAAK,SAAQ,UAAU;IAgBlC,cAAc;IACd,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;IACnC,CAAC;IAuBD;QACE,KAAK,EAAE,CAAC;QAtBO,mBAAc,GAAG,IAAI,cAAc,CAAW;YAC7D,MAAM,EAAE,CAAC,IAAiB,EAAoB,EAAE,CAC9C,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;YACnC,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS;YACtC,KAAK,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK;YACvD,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;YACrB,CAAC;YACD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;gBACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,CAAC;YACD,cAAc,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC;YACnD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;SAChE,CAAC,CAAC;QAEc,cAAS,GAAG,4BAA4B,CACvD,IAAI;QACJ,0BAA0B;QACzB,IAAoB,CAAC,eAAe,EAAE,CACxC,CAAC;QAIA,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;SACrE;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;;4BAEa,IAAI,CAAC,cAAc,CAAC,iBAAiB;8BACnC,IAAI,CAAC,cAAc,CAAC,mBAAmB;sBAC/C,IAAI,CAAC,cAAc,CAAC,YAAY;;KAEjD,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,oBAAoB;QAClB,OAAO,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;IACpD,CAAC;CACF;AA9EC;IACE,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,GAAA,CAAA;AAWS;IADT,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCACmC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {queryAssignedElements} from 'lit/decorators.js';\n\nimport {\n polyfillARIAMixin,\n polyfillElementInternalsAria,\n} from '../../internal/aria/aria.js';\n\nimport {ListController, NavigableKeys} from './list-controller.js';\nimport {ListItem as SharedListItem} from './list-navigation-helpers.js';\n\nconst NAVIGABLE_KEY_SET = new Set<string>(Object.values(NavigableKeys));\n\ninterface ListItem extends SharedListItem {\n type: 'text' | 'button' | 'link';\n}\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class List extends LitElement {\n static {\n polyfillARIAMixin(List);\n }\n\n /**\n * An array of activatable and disableable list items. Queries every assigned\n * element that has the `md-list-item` attribute.\n *\n * _NOTE:_ This is a shallow, flattened query via\n * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct\n * children / directly slotted elements.\n */\n @queryAssignedElements({flatten: true})\n protected slotItems!: Array<ListItem | (HTMLElement & {item?: ListItem})>;\n\n /** @export */\n get items() {\n return this.listController.items;\n }\n\n private readonly listController = new ListController<ListItem>({\n isItem: (item: HTMLElement): item is ListItem =>\n item.hasAttribute('md-list-item'),\n getPossibleItems: () => this.slotItems,\n isRtl: () => getComputedStyle(this).direction === 'rtl',\n deactivateItem: (item) => {\n item.tabIndex = -1;\n },\n activateItem: (item) => {\n item.tabIndex = 0;\n },\n isNavigableKey: (key) => NAVIGABLE_KEY_SET.has(key),\n isActivatable: (item) => !item.disabled && item.type !== 'text',\n });\n\n private readonly internals = polyfillElementInternalsAria(\n this,\n // Cast needed for closure\n (this as HTMLElement).attachInternals(),\n );\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'list';\n this.addEventListener('keydown', this.listController.handleKeydown);\n }\n }\n\n protected override render() {\n return html`\n <slot\n @deactivate-items=${this.listController.onDeactivateItems}\n @request-activation=${this.listController.onRequestActivation}\n @slotchange=${this.listController.onSlotchange}>\n </slot>\n `;\n }\n\n /**\n * Activates the next item in the list. If at the end of the list, the first\n * item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activateNextItem(): ListItem | null {\n return this.listController.activateNextItem();\n }\n\n /**\n * Activates the previous item in the list. If at the start of the list, the\n * last item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activatePreviousItem(): ListItem | null {\n return this.listController.activatePreviousItem();\n }\n}\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAGnE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAMxE,gEAAgE;AAChE,MAAM,OAAO,IAAK,SAAQ,UAAU;IAYlC,cAAc;IACd,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;IACnC,CAAC;IAqBD;QACE,KAAK,EAAE,CAAC;QApBO,mBAAc,GAAG,IAAI,cAAc,CAAW;YAC7D,MAAM,EAAE,CAAC,IAAiB,EAAoB,EAAE,CAC9C,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;YACnC,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS;YACtC,KAAK,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK;YACvD,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;YACrB,CAAC;YACD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;gBACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,CAAC;YACD,cAAc,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC;YACnD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;SAChE,CAAC,CAAC;QAEc,cAAS;QACxB,0BAA0B;QACzB,IAAoB,CAAC,eAAe,EAAE,CAAC;QAIxC,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;YAC7B,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;SACrE;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;;4BAEa,IAAI,CAAC,cAAc,CAAC,iBAAiB;8BACnC,IAAI,CAAC,cAAc,CAAC,mBAAmB;sBAC/C,IAAI,CAAC,cAAc,CAAC,YAAY;;KAEjD,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,oBAAoB;QAClB,OAAO,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;IACpD,CAAC;CACF;AA/DW;IADT,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;uCACmC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {queryAssignedElements} from 'lit/decorators.js';\n\nimport {ListController, NavigableKeys} from './list-controller.js';\nimport {ListItem as SharedListItem} from './list-navigation-helpers.js';\n\nconst NAVIGABLE_KEY_SET = new Set<string>(Object.values(NavigableKeys));\n\ninterface ListItem extends SharedListItem {\n type: 'text' | 'button' | 'link';\n}\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class List extends LitElement {\n /**\n * An array of activatable and disableable list items. Queries every assigned\n * element that has the `md-list-item` attribute.\n *\n * _NOTE:_ This is a shallow, flattened query via\n * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct\n * children / directly slotted elements.\n */\n @queryAssignedElements({flatten: true})\n protected slotItems!: Array<ListItem | (HTMLElement & {item?: ListItem})>;\n\n /** @export */\n get items() {\n return this.listController.items;\n }\n\n private readonly listController = new ListController<ListItem>({\n isItem: (item: HTMLElement): item is ListItem =>\n item.hasAttribute('md-list-item'),\n getPossibleItems: () => this.slotItems,\n isRtl: () => getComputedStyle(this).direction === 'rtl',\n deactivateItem: (item) => {\n item.tabIndex = -1;\n },\n activateItem: (item) => {\n item.tabIndex = 0;\n },\n isNavigableKey: (key) => NAVIGABLE_KEY_SET.has(key),\n isActivatable: (item) => !item.disabled && item.type !== 'text',\n });\n\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'list';\n this.addEventListener('keydown', this.listController.handleKeydown);\n }\n }\n\n protected override render() {\n return html`\n <slot\n @deactivate-items=${this.listController.onDeactivateItems}\n @request-activation=${this.listController.onRequestActivation}\n @slotchange=${this.listController.onSlotchange}>\n </slot>\n `;\n }\n\n /**\n * Activates the next item in the list. If at the end of the list, the first\n * item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activateNextItem(): ListItem | null {\n return this.listController.activateNextItem();\n }\n\n /**\n * Activates the previous item in the list. If at the start of the list, the\n * last item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activatePreviousItem(): ListItem | null {\n return this.listController.activatePreviousItem();\n }\n}\n"]}
@@ -37,6 +37,7 @@
37
37
  :host {
38
38
  border-radius: map.get($tokens, 'container-shape');
39
39
  display: flex;
40
+ -webkit-tap-highlight-color: transparent;
40
41
 
41
42
  @include ripple.theme(
42
43
  (
@@ -84,6 +85,7 @@
84
85
  outline: none;
85
86
  // hide android tap color since we have ripple
86
87
  -webkit-tap-highlight-color: transparent;
88
+ width: 100%;
87
89
  }
88
90
 
89
91
  .list-item.interactive {
@@ -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{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */
7
+ export const styles = css `:host{display:flex;-webkit-tap-highlight-color:rgba(0,0,0,0);--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0);width:100%}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */
8
8
  `;
9
9
  //# sourceMappingURL=list-item-styles.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-item-styles.css.js","sourceRoot":"","sources":["list-item-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{display:flex;--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */\n`;\n "]}
1
+ {"version":3,"file":"list-item-styles.css.js","sourceRoot":"","sources":["list-item-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{display:flex;-webkit-tap-highlight-color:rgba(0,0,0,0);--md-ripple-hover-color: var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0);width:100%}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, 0.3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-list-item-one-line-container-height, 56px);padding-top:var(--md-list-item-top-space, 12px);padding-bottom:var(--md-list-item-bottom-space, 12px);padding-inline-start:var(--md-list-item-leading-space, 16px);padding-inline-end:var(--md-list-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}@media(forced-colors: active){.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}/*# sourceMappingURL=list-item-styles.css.map */\n`;\n "]}
@@ -60,6 +60,14 @@ export interface MenuItemControllerConfig {
60
60
  * A function that returns the headline element of the menu item.
61
61
  */
62
62
  getHeadlineElements: () => HTMLElement[];
63
+ /**
64
+ * A function that returns the supporting-text element of the menu item.
65
+ */
66
+ getSupportingTextElements: () => HTMLElement[];
67
+ /**
68
+ * A function that returns the default slot / misc content.
69
+ */
70
+ getDefaultElements: () => Node[];
63
71
  /**
64
72
  * The HTML Element that accepts user interactions like click. Used for
65
73
  * occasions like programmatically clicking anchor tags when `Enter` is
@@ -75,6 +83,8 @@ export declare class MenuItemController implements ReactiveController {
75
83
  private readonly host;
76
84
  private internalTypeaheadText;
77
85
  private readonly getHeadlineElements;
86
+ private readonly getSupportingTextElements;
87
+ private readonly getDefaultElements;
78
88
  private readonly getInteractiveElement;
79
89
  /**
80
90
  * @param host The MenuItem in which to attach this controller to.
@@ -83,7 +93,9 @@ export declare class MenuItemController implements ReactiveController {
83
93
  constructor(host: ReactiveControllerHost & MenuItem, config: MenuItemControllerConfig);
84
94
  /**
85
95
  * The text that is selectable via typeahead. If not set, defaults to the
86
- * innerText of the item slotted into the `"headline"` slot.
96
+ * innerText of the item slotted into the `"headline"` slot, and if there are
97
+ * no slotted elements into headline, then it checks the _default_ slot, and
98
+ * then the `"supporting-text"` slot if nothing is in _default_.
87
99
  */
88
100
  get typeaheadText(): string;
89
101
  /**
@@ -39,10 +39,15 @@ export class MenuItemController {
39
39
  interactiveElement.click();
40
40
  }
41
41
  }
42
- if (this.host.keepOpen || event.defaultPrevented)
42
+ if (event.defaultPrevented)
43
43
  return;
44
+ // If the host has keepOpen = true we should ignore clicks & Space/Enter,
45
+ // however we always maintain the ability to close a menu with a explicit
46
+ // `escape` keypress.
44
47
  const keyCode = event.code;
45
- if (!event.defaultPrevented && isClosableKey(keyCode)) {
48
+ if (this.host.keepOpen && keyCode !== 'Escape')
49
+ return;
50
+ if (isClosableKey(keyCode)) {
46
51
  event.preventDefault();
47
52
  this.host.dispatchEvent(createDefaultCloseMenuEvent(this.host, {
48
53
  kind: CloseReason.KEYDOWN,
@@ -50,14 +55,17 @@ export class MenuItemController {
50
55
  }));
51
56
  }
52
57
  };
53
- const { getHeadlineElements, getInteractiveElement } = config;
54
- this.getHeadlineElements = getHeadlineElements;
55
- this.getInteractiveElement = getInteractiveElement;
58
+ this.getHeadlineElements = config.getHeadlineElements;
59
+ this.getSupportingTextElements = config.getSupportingTextElements;
60
+ this.getDefaultElements = config.getDefaultElements;
61
+ this.getInteractiveElement = config.getInteractiveElement;
56
62
  this.host.addController(this);
57
63
  }
58
64
  /**
59
65
  * The text that is selectable via typeahead. If not set, defaults to the
60
- * innerText of the item slotted into the `"headline"` slot.
66
+ * innerText of the item slotted into the `"headline"` slot, and if there are
67
+ * no slotted elements into headline, then it checks the _default_ slot, and
68
+ * then the `"supporting-text"` slot if nothing is in _default_.
61
69
  */
62
70
  get typeaheadText() {
63
71
  if (this.internalTypeaheadText !== null) {
@@ -70,6 +78,24 @@ export class MenuItemController {
70
78
  textParts.push(headlineElement.textContent.trim());
71
79
  }
72
80
  });
81
+ // If there are no headline elements, check the default slot's text content
82
+ if (textParts.length === 0) {
83
+ this.getDefaultElements().forEach((defaultElement) => {
84
+ if (defaultElement.textContent && defaultElement.textContent.trim()) {
85
+ textParts.push(defaultElement.textContent.trim());
86
+ }
87
+ });
88
+ }
89
+ // If there are no headline nor default slot elements, check the
90
+ //supporting-text slot's text content
91
+ if (textParts.length === 0) {
92
+ this.getSupportingTextElements().forEach((supportingTextElement) => {
93
+ if (supportingTextElement.textContent &&
94
+ supportingTextElement.textContent.trim()) {
95
+ textParts.push(supportingTextElement.textContent.trim());
96
+ }
97
+ });
98
+ }
73
99
  return textParts.join(' ');
74
100
  }
75
101
  /**