@shortfuse/materialdesignweb 0.7.1-0 → 0.7.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 (138) hide show
  1. package/bin/generate-css.js +1 -2
  2. package/components/Badge.js +40 -3
  3. package/components/Body.js +16 -2
  4. package/components/BottomAppBar.js +25 -2
  5. package/components/Box.js +33 -3
  6. package/components/Button.js +146 -9
  7. package/components/Card.js +111 -3
  8. package/components/Checkbox.js +91 -3
  9. package/components/CheckboxIcon.js +92 -4
  10. package/components/Chip.js +38 -2
  11. package/components/Dialog.js +237 -3
  12. package/components/DialogActions.js +3 -2
  13. package/components/Divider.js +44 -3
  14. package/components/ExtendedFab.js +27 -2
  15. package/components/Fab.js +26 -2
  16. package/components/FilterChip.js +83 -2
  17. package/components/Headline.js +16 -2
  18. package/components/Icon.js +80 -4
  19. package/components/IconButton.js +153 -2
  20. package/components/Label.js +16 -2
  21. package/components/Layout.js +21 -3
  22. package/components/List.js +15 -2
  23. package/components/ListItem.js +229 -3
  24. package/components/ListOption.js +37 -3
  25. package/components/ListSelect.js +12 -2
  26. package/components/Menu.js +173 -3
  27. package/components/MenuItem.js +55 -2
  28. package/components/Nav.js +19 -2
  29. package/components/NavBar.js +37 -2
  30. package/components/NavBarItem.js +44 -2
  31. package/components/NavDrawer.js +34 -2
  32. package/components/NavDrawerItem.js +44 -2
  33. package/components/NavItem.js +183 -3
  34. package/components/NavRail.js +50 -2
  35. package/components/NavRailItem.js +25 -2
  36. package/components/Pane.js +263 -3
  37. package/components/Progress.js +469 -10
  38. package/components/Radio.js +97 -3
  39. package/components/RadioIcon.js +77 -5
  40. package/components/Ripple.js +76 -3
  41. package/components/SegmentedButton.js +97 -2
  42. package/components/SegmentedButtonGroup.js +15 -2
  43. package/components/Select.js +54 -2
  44. package/components/Shape.js +55 -18
  45. package/components/Slider.js +309 -3
  46. package/components/Snackbar.js +82 -2
  47. package/components/Surface.js +13 -4
  48. package/components/Switch.js +67 -4
  49. package/components/SwitchIcon.js +272 -5
  50. package/components/Tab.js +87 -3
  51. package/components/TabContent.js +21 -21
  52. package/components/TabList.js +131 -2
  53. package/components/TextArea.js +97 -3
  54. package/components/Title.js +16 -2
  55. package/components/Tooltip.js +42 -2
  56. package/components/TopAppBar.js +212 -3
  57. package/core/template.js +36 -9
  58. package/mixins/ControlMixin.js +65 -2
  59. package/mixins/DensityMixin.js +17 -3
  60. package/mixins/FlexableMixin.js +81 -3
  61. package/mixins/RippleMixin.js +15 -4
  62. package/mixins/ShapeMixin.js +279 -8
  63. package/mixins/StateMixin.js +87 -5
  64. package/mixins/SurfaceMixin.js +152 -3
  65. package/mixins/TextFieldMixin.js +661 -2
  66. package/mixins/ThemableMixin.js +206 -3
  67. package/mixins/TooltipTriggerMixin.js +30 -4
  68. package/mixins/TouchTargetMixin.js +29 -4
  69. package/package.json +2 -1
  70. package/theming/loader.js +0 -2
  71. package/components/Badge.css +0 -38
  72. package/components/Body.css +0 -14
  73. package/components/BottomAppBar.css +0 -23
  74. package/components/Box.css +0 -31
  75. package/components/Button.css +0 -147
  76. package/components/Card.css +0 -109
  77. package/components/Checkbox.css +0 -89
  78. package/components/CheckboxIcon.css +0 -90
  79. package/components/Chip.css +0 -35
  80. package/components/Dialog.css +0 -235
  81. package/components/Divider.css +0 -41
  82. package/components/ExtendedFab.css +0 -24
  83. package/components/Fab.css +0 -23
  84. package/components/FilterChip.css +0 -80
  85. package/components/Headline.css +0 -14
  86. package/components/Icon.css +0 -76
  87. package/components/IconButton.css +0 -150
  88. package/components/Label.css +0 -14
  89. package/components/Layout.css +0 -19
  90. package/components/List.css +0 -12
  91. package/components/ListItem.css +0 -224
  92. package/components/ListOption.css +0 -34
  93. package/components/ListSelect.css +0 -9
  94. package/components/Menu.css +0 -171
  95. package/components/MenuItem.css +0 -53
  96. package/components/Nav.css +0 -17
  97. package/components/NavBar.css +0 -34
  98. package/components/NavBarItem.css +0 -41
  99. package/components/NavDrawer.css +0 -31
  100. package/components/NavDrawerItem.css +0 -42
  101. package/components/NavItem.css +0 -181
  102. package/components/NavRail.css +0 -47
  103. package/components/NavRailItem.css +0 -25
  104. package/components/Outline.css +0 -138
  105. package/components/Pane.css +0 -261
  106. package/components/Progress.css +0 -75
  107. package/components/ProgressCircle.css +0 -226
  108. package/components/ProgressLine.css +0 -155
  109. package/components/Radio.css +0 -95
  110. package/components/RadioIcon.css +0 -73
  111. package/components/Ripple.css +0 -74
  112. package/components/SegmentedButton.css +0 -94
  113. package/components/SegmentedButtonGroup.css +0 -12
  114. package/components/Select.css +0 -52
  115. package/components/Shape.css +0 -132
  116. package/components/Slider.css +0 -307
  117. package/components/Snackbar.css +0 -80
  118. package/components/Surface.css +0 -10
  119. package/components/Switch.css +0 -64
  120. package/components/SwitchIcon.css +0 -178
  121. package/components/SwitchIconAnimations.css +0 -89
  122. package/components/Tab.css +0 -85
  123. package/components/TabList.css +0 -129
  124. package/components/TextArea.css +0 -93
  125. package/components/Title.css +0 -14
  126. package/components/Tooltip.css +0 -40
  127. package/components/TopAppBar.css +0 -209
  128. package/mixins/ControlMixin.css +0 -57
  129. package/mixins/DensityMixin.css +0 -40
  130. package/mixins/FlexableMixin.css +0 -79
  131. package/mixins/RippleMixin.css +0 -12
  132. package/mixins/ShapeMixin.css +0 -135
  133. package/mixins/StateMixin.css +0 -82
  134. package/mixins/SurfaceMixin.css +0 -150
  135. package/mixins/TextFieldMixin.css +0 -657
  136. package/mixins/ThemableMixin.css +0 -204
  137. package/mixins/TooltipTriggerMixin.css +0 -27
  138. package/mixins/TouchTargetMixin.css +0 -26
@@ -4,12 +4,10 @@ import CustomElement from '../core/CustomElement.js';
4
4
  import ShapeMixin from '../mixins/ShapeMixin.js';
5
5
  import ThemableMixin from '../mixins/ThemableMixin.js';
6
6
 
7
- import styles from './SwitchIcon.css' assert {type: 'css'};
8
- import animations from './SwitchIconAnimations.css' assert {type:'css'};
9
-
10
7
  export default CustomElement
11
8
  .mixin(ThemableMixin)
12
9
  .mixin(ShapeMixin)
10
+ .extend()
13
11
  .observe({
14
12
  selected: 'boolean',
15
13
  icon: 'string',
@@ -53,7 +51,6 @@ export default CustomElement
53
51
  return Boolean(icon || src || unselectedIcon || unselectedSrc);
54
52
  },
55
53
  })
56
- .css(styles, animations)
57
54
  .html/* html */`
58
55
  <div id=thumb selected={checked} pressed={pressed} disabled={disabled}>
59
56
  <mdw-shape id=thumb-shape shape-style=full selected={checked} pressed={pressed} hovered={hovered} focused={focused} icon={hasIcon}
@@ -85,5 +82,275 @@ export default CustomElement
85
82
  }
86
83
  },
87
84
  })
88
- .extend()
85
+ .css`
86
+ /* https://m3.material.io/components/switch/specs */
87
+
88
+ :host {
89
+ --mdw-ink: var(--mdw-color__on-primary);
90
+ --mdw-bg: var(--mdw-color__primary);
91
+ --mdw-shape__size: var(--mdw-shape__full);
92
+ --mdw-switch__value: 0;
93
+
94
+ position: relative;
95
+
96
+ display: inline-block;
97
+ vertical-align: middle;
98
+
99
+ box-sizing: border-box;
100
+ block-size: 32px;
101
+ inline-size: 52px;
102
+ container-type: inline-size;
103
+ container-name: switch-icon;
104
+ }
105
+
106
+ :host([selected]) {
107
+ --mdw-switch__value: 1;
108
+ }
109
+
110
+ :host([disabled]) {
111
+ opacity: 0.38;
112
+ }
113
+
114
+ #track{
115
+ position: absolute;
116
+ inset: 0;
117
+
118
+ background-color: rgb(var(--mdw-color__surface-variant));
119
+ }
120
+
121
+ #track[selected] {
122
+ background-color: rgb(var(--mdw-bg));
123
+ }
124
+
125
+ #track[disabled] {
126
+ opacity: calc(0.12/0.38);
127
+ }
128
+
129
+ #track[disabled][selected] {
130
+ background-color: rgb(var(--mdw-color__on-surface));
131
+ }
132
+
133
+ #outline {
134
+ filter:
135
+ drop-shadow(1px 0px 0px currentColor)
136
+ drop-shadow(0px 1px 0px currentColor)
137
+ drop-shadow(-1px 0px 0px currentColor)
138
+ drop-shadow(0px -1px 0px currentColor);
139
+
140
+ color: rgb(var(--mdw-color__outline));
141
+ }
142
+
143
+ #outline:is([pressed],[focused]) {
144
+ color: rgb(var(--mdw-color__outline));
145
+ }
146
+
147
+ #outline[disabled] {
148
+ color: rgb(var(--mdw-color__on-surface));
149
+ }
150
+
151
+ #outline[selected] {
152
+ color: transparent;
153
+ }
154
+
155
+ /** Thumb (state) **/
156
+
157
+ #thumb {
158
+ --thumb-color: var(--mdw-ink);
159
+ position: absolute;
160
+ inset-block: 0;
161
+ inset-inline-start: 0;
162
+
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+
167
+ transform: translateX(calc(var(--mdw-dir, 1) * var(--mdw-switch__value) * (52px - 100%)));
168
+
169
+ aspect-ratio: 1/1;
170
+ }
171
+
172
+ :dir(rtl) #thumb {
173
+ --mdw-dir: -1;
174
+ }
175
+
176
+ @supports(width: 1cqw) {
177
+ #thumb {
178
+ transform: translateX(calc(var(--mdw-dir, 1) * var(--mdw-switch__value) * (100cqw - 100%)));
179
+ }
180
+ }
181
+
182
+ #slot {
183
+ color: rgb(var(--mdw-color__on-surface));
184
+ }
185
+
186
+ #slot[selected] {
187
+ color: rgb(var(--mdw-bg));
188
+ }
189
+
190
+ /** Thumb Shape **/
191
+
192
+ #thumb-shape {
193
+ --mdw-shape__size: inherit;
194
+
195
+ position: absolute;
196
+
197
+ inset: 2px;
198
+
199
+ transform: scale(calc(16/28));
200
+ z-index: 0;
201
+ }
202
+
203
+ #thumb-shape[icon] {
204
+ transform: scale(calc(24/28));
205
+ }
206
+
207
+ #thumb-shape:not([selected]) {
208
+ --mdw-bg: var(--mdw-color__outline);
209
+ --mdw-ink: var(--mdw-color__surface-variant);
210
+ }
211
+
212
+ #thumb-shape[selected] {
213
+ transform: scale(calc(24/28));
214
+ }
215
+
216
+ #thumb-shape[selected]:not([active]) {
217
+ --mdw-bg: var(--thumb-color);
218
+ }
219
+
220
+ #thumb-shape[pressed]:not([disabled]) {
221
+ transform: scale(1);
222
+ }
223
+
224
+ /** Thumb Icons **/
225
+
226
+ .icon {
227
+ position: absolute;
228
+ inset-block-start: 50%;
229
+ inset-inline-start: 50%;
230
+
231
+ opacity: 0;
232
+ transform: translateX(-50%) translateY(-50%);
233
+
234
+ font-size: 16px;
235
+
236
+ /* border-radius: 50%; */
237
+ }
238
+
239
+ .icon:not([src]):empty {
240
+ display: none;
241
+ }
242
+
243
+ #icon, #unselected-icon {
244
+ opacity: 1;
245
+
246
+ font-variation-settings: 'FILL' 0;
247
+ }
248
+
249
+ #unselected-icon[selected] {
250
+ opacity: 0;
251
+ }
252
+
253
+ #selected-icon[selected] {
254
+ opacity: 1;
255
+ }
256
+
257
+ #icon[selected] {
258
+ font-variation-settings: 'FILL' 1;
259
+ }
260
+
261
+ #thumb[disabled] {
262
+ color: rgb(var(--mdw-color__on-surface));
263
+ }
264
+ `
265
+ .css`
266
+ /* https://m3.material.io/components/switch/specs */
267
+
268
+ :host {
269
+ /*FastOutLinearInInterpolator*/
270
+ --mdw-switch__transition-timing__collapse: cubic-bezier(0.4, 0.0, 1, 1);
271
+ --mdw-switch__transition-duration__collapse: 375ms;
272
+ /*LinearOutSlowInInterpolator*/
273
+ --mdw-switch__transition-timing__expand: cubic-bezier(0.0, 0.0, 0.2, 1);
274
+ --mdw-switch__transition-duration__expand: 500ms;
275
+ --scale-delay: var(--mdw-switch__transition-duration);
276
+
277
+ --mdw-switch__transition-duration: var(--mdw-switch__transition-duration__collapse);
278
+ --mdw-switch__transition-timing: var(--mdw-switch__transition-timing__collapse);
279
+ --mdw-switch__transition-delay__color: calc(var(--mdw-switch__transition-duration) / 2);
280
+ --mdw-switch__transition-delay__translate: calc(var(--mdw-switch__transition-duration) / 2);
281
+ --mdw-switch__transition-delay__scale: calc(var(--mdw-switch__transition-duration) / 2);
282
+
283
+ transition-delay: var(--mdw-switch__transition-delay__color);
284
+ transition-duration: calc(var(--mdw-switch__transition-duration) / 2);
285
+ /* 2 legged animation */
286
+ transition-timing-function: var(--mdw-switch__transition-timing);
287
+ }
288
+
289
+ #track {
290
+ transition-delay: var(--mdw-switch__transition-delay__color);
291
+ transition-duration: inherit;
292
+ transition-property: background-color;
293
+ transition-timing-function: inherit;
294
+ }
295
+
296
+ #outline {
297
+ transition-delay: var(--mdw-switch__transition-delay__color);
298
+ transition-duration: inherit;
299
+ transition-property: background-color, color;
300
+ transition-timing-function: inherit;
301
+ }
302
+
303
+ #thumb {
304
+ transition-delay: var(--mdw-switch__transition-delay__translate);
305
+ transition-duration: inherit;
306
+ transition-property: transform;
307
+ transition-timing-function: inherit;
308
+ }
309
+
310
+ #thumb-shape, .icon {
311
+ /* (selected => unselected): stall color+scale */
312
+ transition-delay: var(--mdw-switch__transition-delay__scale), var(--mdw-switch__transition-delay__color), var(--mdw-switch__transition-delay__color);
313
+ transition-duration: inherit;
314
+ transition-property: transform, background-color, color;
315
+ transition-timing-function: inherit;
316
+ }
317
+
318
+ :host([icon]) {
319
+ --mdw-switch__transition-delay__translate: 0s;
320
+ }
321
+
322
+ .icon {
323
+ transition-property: transform, opacity, color;
324
+ }
325
+
326
+ /* unselected => selected */
327
+ :host([selected]) {
328
+ --mdw-switch__transition-delay__color: 0s;
329
+ --mdw-switch__transition-delay__scale: 0s;
330
+ /* --mdw-switch__transition-delay__translate: 0s; */
331
+ --mdw-switch__transition-duration: var(--mdw-switch__transition-duration__expand);
332
+ --mdw-switch__transition-timing: var(--mdw-switch__transition-timing__expand);
333
+ }
334
+
335
+ /* active => selected */
336
+ :host([selected][pressed]) {
337
+ /* --mdw-switch__transition-delay__color: 0s; */
338
+ /* --mdw-switch__transition-delay__scale: 0s; */
339
+ --mdw-switch__transition-delay__translate: 0s;
340
+ }
341
+
342
+ /* selected => unselected */
343
+ :host(:not([selected])) {
344
+ /* --mdw-switch__transition-delay__color: 0s; */
345
+ /* --mdw-switch__transition-delay__scale: 0s; */
346
+ --mdw-switch__transition-delay__translate: 0s;
347
+ }
348
+
349
+ /* unselected => active */
350
+ :host([pressed]:not([selected])) {
351
+ /* --mdw-switch__transition-delay__color: 0s; */
352
+ --mdw-switch__transition-delay__scale: 0s;
353
+ /* --mdw-switch__transition-delay__translate: 0s; */
354
+ }
355
+ `
89
356
  .autoRegister('mdw-switch-icon');
package/components/Tab.js CHANGED
@@ -8,8 +8,6 @@ import ScrollListenerMixin from '../mixins/ScrollListenerMixin.js';
8
8
  import ShapeMixin from '../mixins/ShapeMixin.js';
9
9
  import StateMixin from '../mixins/StateMixin.js';
10
10
 
11
- import styles from './Tab.css' assert { type: 'css' };
12
-
13
11
  export default CustomElement
14
12
  .mixin(ShapeMixin)
15
13
  .mixin(StateMixin)
@@ -49,7 +47,6 @@ export default CustomElement
49
47
  this.refs.anchor.focus(options);
50
48
  },
51
49
  })
52
- .css(styles)
53
50
  .html/* html */`
54
51
  <a id=anchor role=tab
55
52
  aria-label={ariaLabel}
@@ -100,4 +97,91 @@ export default CustomElement
100
97
  },
101
98
  },
102
99
  })
100
+ .css`
101
+ /* https://m3.material.io/components/tabs/specs */
102
+
103
+ :host {
104
+ display: inline-flex;
105
+
106
+ min-inline-size: 64px;
107
+
108
+ cursor: pointer;
109
+ }
110
+
111
+ #anchor {
112
+ display: flex;
113
+ align-items: center;
114
+ flex-direction: column;
115
+ justify-content: center;
116
+
117
+ box-sizing: border-box;
118
+ block-size: 100%;
119
+ inline-size: 100%;
120
+ flex: 1;
121
+
122
+ padding-block: 6px;
123
+ padding-inline: 12px;
124
+
125
+ cursor: pointer;
126
+ outline: none;
127
+
128
+ color: inherit;
129
+
130
+ text-decoration: inherit;
131
+ }
132
+
133
+ #icon {
134
+ padding-block: 4px;
135
+
136
+ font-size: 24px;
137
+ font-variation-settings: 'FILL' 0;
138
+
139
+ }
140
+
141
+ #shape[disabled],
142
+ #anchor[disabled] {
143
+ cursor: not-allowed;
144
+
145
+ background-color: rgba(var(--mdw-color__on-surface), 0.12);
146
+ color: rgba(var(--mdw-color__on-surface), 0.38);
147
+ }
148
+
149
+ :host([active]) {
150
+ color: rgb(var(--mdw-ink));
151
+ }
152
+
153
+ #icon[active] {
154
+ font-variation-settings: 'FILL' 1;
155
+ }
156
+
157
+ #slot {
158
+ display: block;
159
+ overflow-x: hidden;
160
+ overflow-y: hidden;
161
+
162
+ max-block-size: var(--mdw-typescale__title-small__line-height);
163
+
164
+ max-inline-size: 100%;
165
+
166
+ cursor: inherit;
167
+ outline: none;
168
+
169
+ opacity: var(--mdw-nav-item__anchor__opacity, 1);
170
+ transform: translateY(var(--mdw-nav-item__offset-y, 0));
171
+
172
+ color: inherit;
173
+
174
+ font: var(--mdw-typescale__title-small__font);
175
+ letter-spacing: var(--mdw-typescale__title-small__letter-spacing);
176
+ text-align: center;
177
+ text-decoration: inherit;
178
+ text-overflow: ellipsis;
179
+ text-transform: none;
180
+ white-space: nowrap;
181
+ word-break: break-word;
182
+
183
+ transition: opacity, color, transform 200ms;
184
+ will-change: opacity, transform;
185
+ }
186
+ `
103
187
  .autoRegister('mdw-tab');
@@ -7,27 +7,6 @@ import TabPanel from './TabPanel.js';
7
7
  export default CustomElement
8
8
  .mixin(ResizeObserverMixin)
9
9
  .extend()
10
- .css`
11
- :host {
12
- display: grid;
13
- grid-auto-columns: 100%;
14
- grid-auto-flow: column;
15
- grid-template-columns: 100%;
16
- overflow-x: auto;
17
- scroll-behavior: smooth;
18
- scroll-snap-type: x mandatory;
19
- scrollbar-width: none;
20
-
21
- flex-grow: 1;
22
- -webkit-scroll-snap-type-x: mandatory;
23
- scroll-snap-type-x: mandatory;
24
- -webkit-scroll-snap-points-x: repeat(100%);
25
- scroll-snap-points-x: repeat(100%);
26
- overscroll-behavior-x: none;
27
-
28
- will-change: transform; /* Avoid repaint on scroll */
29
- }
30
- `
31
10
  .set({
32
11
  /** @type {InstanceType<TabPanel>[]} */
33
12
  _panelNodes: [],
@@ -148,4 +127,25 @@ export default CustomElement
148
127
  .events({
149
128
  scroll: 'updatePanels',
150
129
  })
130
+ .css`
131
+ :host {
132
+ display: grid;
133
+ grid-auto-columns: 100%;
134
+ grid-auto-flow: column;
135
+ grid-template-columns: 100%;
136
+ overflow-x: auto;
137
+ scroll-behavior: smooth;
138
+ scroll-snap-type: x mandatory;
139
+ scrollbar-width: none;
140
+
141
+ flex-grow: 1;
142
+ -webkit-scroll-snap-type-x: mandatory;
143
+ scroll-snap-type-x: mandatory;
144
+ -webkit-scroll-snap-points-x: repeat(100%);
145
+ scroll-snap-points-x: repeat(100%);
146
+ overscroll-behavior-x: none;
147
+
148
+ will-change: transform; /* Avoid repaint on scroll */
149
+ }
150
+ `
151
151
  .autoRegister('mdw-tab-content');
@@ -8,7 +8,6 @@ import ShapeMixin from '../mixins/ShapeMixin.js';
8
8
  import ThemableMixin from '../mixins/ThemableMixin.js';
9
9
 
10
10
  import Tab from './Tab.js';
11
- import styles from './TabList.css' assert { type: 'css' };
12
11
 
13
12
  export default CustomElement
14
13
  .mixin(ThemableMixin)
@@ -258,7 +257,6 @@ export default CustomElement
258
257
  .set({
259
258
  ariaRole: 'tablist',
260
259
  })
261
- .css(styles)
262
260
  .html/* html */`
263
261
  <slot id=slot ink={ink} type-style={typeStyle}></slot>
264
262
  <div id=indicator aria-hidden=true style={_indicatorStyle} active={active} secondary={secondary}>
@@ -306,4 +304,135 @@ export default CustomElement
306
304
  },
307
305
  },
308
306
  })
307
+ .css`
308
+ /* https://m3.material.io/components/tabs/specs */
309
+
310
+ :host {
311
+ --mdw-ink: var(--mdw-color__primary);
312
+ --mdw-shape__bg: rgb(var(--mdw-color__surface));
313
+ position: relative;
314
+ position: sticky;
315
+ inset-block-start: 0;
316
+ inset-inline: 0;
317
+
318
+ display: grid;
319
+ align-items: stretch;
320
+ grid-auto-columns: minmax(auto, 1fr);
321
+ grid-auto-flow: column;
322
+ justify-content: space-evenly;
323
+ overflow-y: hidden;
324
+
325
+ box-sizing: border-box;
326
+ min-block-size: 48px;
327
+ inline-size: 100%;
328
+ flex:none;
329
+
330
+ color: inherit;
331
+
332
+ text-align: center;
333
+
334
+ will-change: transform;
335
+ }
336
+
337
+ #indicator {
338
+ --corner: 3;
339
+ --width: 24;
340
+ --offset: 0;
341
+ --visibility: 0;
342
+ --transition-ratio: 1;
343
+ position: absolute;
344
+ inset-block-end: 0;
345
+ inset-inline: 0;
346
+
347
+ overflow-y: clip;
348
+
349
+ block-size: 3px;
350
+ inline-size: 100%;
351
+
352
+ pointer-events: none;
353
+
354
+ opacity: 1;
355
+ transform: translateY(calc(100% * (1 - var(--visibility))));
356
+
357
+ color: inherit;
358
+
359
+ transition: transform 200ms;
360
+ will-change: transform;
361
+ }
362
+
363
+ .indicator-piece {
364
+ position: absolute;
365
+ inset-block: 0;
366
+
367
+ opacity: 1;
368
+ /* opacity: 0.60; */
369
+ transform-origin: 0 0;
370
+ z-index:1;
371
+
372
+ background-color: currentColor;
373
+
374
+ transition: transform;
375
+ transition-duration: calc(200ms * var(--transition-ratio));
376
+ will-change: transform;
377
+ }
378
+
379
+ #indicator-start {
380
+ /* stylelint-disable-next-line liberty/use-logical-spec */
381
+ left: 0;
382
+
383
+ inline-size: calc(2 * 1px * var(--corner));
384
+
385
+ transform: translateX(var(--offset));
386
+
387
+ /* stylelint-disable-next-line liberty/use-logical-spec */
388
+ border-top-left-radius: calc(1px * var(--corner));
389
+ }
390
+
391
+ #indicator-center {
392
+ /* Chrome has rendering issues upscaling small elements */
393
+ --precision: 100;
394
+
395
+ position: absolute;
396
+ /* stylelint-disable-next-line liberty/use-logical-spec */
397
+ left: calc(1px * var(--corner));
398
+
399
+ inline-size: calc(1px * var(--precision));
400
+
401
+ transform: translateX(var(--offset)) scaleX(calc((var(--width) - (2 * var(--corner))) / var(--precision)));
402
+
403
+ }
404
+
405
+ #indicator-end {
406
+ position: absolute;
407
+ /* stylelint-disable-next-line liberty/use-logical-spec */
408
+ left: 0;
409
+
410
+ inline-size: calc(2 * 1px * var(--corner));
411
+
412
+ transform:
413
+ translateX(var(--offset))
414
+ translateX(calc(-2px * var(--corner)))
415
+ translateX(calc(var(--width) * 1px));
416
+
417
+ /* stylelint-disable-next-line liberty/use-logical-spec */
418
+ border-top-right-radius: calc(1px * var(--corner));
419
+ }
420
+
421
+ #indicator[active] {
422
+ --visibility: 1;
423
+ color: rgb(var(--mdw-ink));
424
+ }
425
+
426
+ #indicator[secondary] {
427
+ --corner: 0;
428
+ }
429
+
430
+ :host([scrollable]) {
431
+ grid-auto-columns: max-content;
432
+ justify-content: flex-start;
433
+ overflow-x: auto;
434
+
435
+ padding-inline: 48px
436
+ }
437
+ `
309
438
  .autoRegister('mdw-tab-list');
@@ -5,8 +5,6 @@ import StateMixin from '../mixins/StateMixin.js';
5
5
  import TextFieldMixin from '../mixins/TextFieldMixin.js';
6
6
  import ThemableMixin from '../mixins/ThemableMixin.js';
7
7
 
8
- import styles from './TextArea.css' assert { type: 'css' };
9
-
10
8
  /** @implements {HTMLTextAreaElement} */
11
9
  export default class TextArea extends CustomElement
12
10
  .mixin(ThemableMixin)
@@ -17,7 +15,103 @@ export default class TextArea extends CustomElement
17
15
  static { this.autoRegister('mdw-textarea'); }
18
16
 
19
17
  static {
20
- this.css(styles);
18
+ // eslint-disable-next-line no-unused-expressions
19
+ this.css`
20
+ /* https://m3.material.io/components/text-fields/specs */
21
+
22
+ :host {
23
+ display: inline-grid;
24
+ grid-auto-flow: row;
25
+ grid-template-rows: minmax(0, 100%);
26
+ }
27
+
28
+ :host(:is([filled][label])) {
29
+ --control__margin-top: calc((var(--mdw-text-field__ratio) * 8px) + var(--mdw-typescale__body-small__line-height));
30
+ --control__padding-top: 0px;
31
+ --control__padding-bottom: calc((var(--mdw-text-field__ratio) * 8px) - 1px);
32
+ --control__margin-bottom: 1px;
33
+ }
34
+
35
+ #label {
36
+ --max-rows: none;
37
+ --line-height: var(--mdw-typescale__body-large__line-height);
38
+ --expected-height: calc((var(--control__margin-top) + var(--control__padding-top) + var(--line-height) + var(--control__padding-bottom) + var(--control__margin-bottom)));
39
+ max-block-size: 100%;
40
+ grid-row: 1 / 1;
41
+ padding: 0;
42
+ }
43
+
44
+ @supports(height: 1lh) {
45
+ #label {
46
+ --line-height: 1lh;
47
+ }
48
+ }
49
+
50
+ #slot {
51
+ display: none;
52
+ }
53
+
54
+ #control {
55
+ -ms-overflow-style: -ms-autohiding-scrollbar;
56
+ overflow-y: auto;
57
+ -webkit-overflow-scrolling: touch;
58
+
59
+ box-sizing: border-box;
60
+ block-size: 100%;
61
+
62
+ min-block-size: var(--expected-height);
63
+ /* Avoid clipping on resize */
64
+ max-block-size: inherit;
65
+ inline-size: 100% !important; /* !important to override user-agent resize */
66
+ padding-inline: 16px;
67
+ }
68
+
69
+ #control[icon] {
70
+ padding-inline-start: 0;
71
+ }
72
+
73
+ #control[minrows] {
74
+ min-block-size: calc((var(--min-rows) * var(--line-height))
75
+ + var(--control__margin-top)
76
+ + var(--control__padding-top)
77
+ + var(--control__padding-bottom)
78
+ + var(--control__margin-bottom)
79
+ );
80
+ }
81
+
82
+ #control[maxrows] {
83
+ max-block-size: calc((var(--max-rows) * var(--line-height))
84
+ + var(--control__margin-top)
85
+ + var(--control__padding-top)
86
+ + var(--control__padding-bottom)
87
+ + var(--control__margin-bottom)
88
+ );
89
+ }
90
+
91
+ #control:is([icon], [input-prefix]) {
92
+ padding-inline-start: 0;
93
+ }
94
+
95
+ #control:is([trailing-icon], [input-suffix]) {
96
+ padding-inline-end: 0;
97
+ }
98
+
99
+ #suffix {
100
+ padding-inline-end: 16px;
101
+ }
102
+
103
+ mdw-icon {
104
+ align-self: flex-start;
105
+
106
+ margin-block-start: calc((var(--expected-height) - var(--mdw-icon__size)) / 2);
107
+ }
108
+
109
+ #control[fixed] {
110
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
111
+ resize: none;
112
+ }
113
+
114
+ `;
21
115
  this.childEvents({ slot: { slotchange: 'onSlotChange' } });
22
116
  this.on({
23
117
  composed() {