@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.
- package/bin/generate-css.js +1 -2
- package/components/Badge.js +40 -3
- package/components/Body.js +16 -2
- package/components/BottomAppBar.js +25 -2
- package/components/Box.js +33 -3
- package/components/Button.js +146 -9
- package/components/Card.js +111 -3
- package/components/Checkbox.js +91 -3
- package/components/CheckboxIcon.js +92 -4
- package/components/Chip.js +38 -2
- package/components/Dialog.js +237 -3
- package/components/DialogActions.js +3 -2
- package/components/Divider.js +44 -3
- package/components/ExtendedFab.js +27 -2
- package/components/Fab.js +26 -2
- package/components/FilterChip.js +83 -2
- package/components/Headline.js +16 -2
- package/components/Icon.js +80 -4
- package/components/IconButton.js +153 -2
- package/components/Label.js +16 -2
- package/components/Layout.js +21 -3
- package/components/List.js +15 -2
- package/components/ListItem.js +229 -3
- package/components/ListOption.js +37 -3
- package/components/ListSelect.js +12 -2
- package/components/Menu.js +173 -3
- package/components/MenuItem.js +55 -2
- package/components/Nav.js +19 -2
- package/components/NavBar.js +37 -2
- package/components/NavBarItem.js +44 -2
- package/components/NavDrawer.js +34 -2
- package/components/NavDrawerItem.js +44 -2
- package/components/NavItem.js +183 -3
- package/components/NavRail.js +50 -2
- package/components/NavRailItem.js +25 -2
- package/components/Pane.js +263 -3
- package/components/Progress.js +469 -10
- package/components/Radio.js +97 -3
- package/components/RadioIcon.js +77 -5
- package/components/Ripple.js +76 -3
- package/components/SegmentedButton.js +97 -2
- package/components/SegmentedButtonGroup.js +15 -2
- package/components/Select.js +54 -2
- package/components/Shape.js +55 -18
- package/components/Slider.js +309 -3
- package/components/Snackbar.js +82 -2
- package/components/Surface.js +13 -4
- package/components/Switch.js +67 -4
- package/components/SwitchIcon.js +272 -5
- package/components/Tab.js +87 -3
- package/components/TabContent.js +21 -21
- package/components/TabList.js +131 -2
- package/components/TextArea.js +97 -3
- package/components/Title.js +16 -2
- package/components/Tooltip.js +42 -2
- package/components/TopAppBar.js +212 -3
- package/core/template.js +36 -9
- package/mixins/ControlMixin.js +65 -2
- package/mixins/DensityMixin.js +17 -3
- package/mixins/FlexableMixin.js +81 -3
- package/mixins/RippleMixin.js +15 -4
- package/mixins/ShapeMixin.js +279 -8
- package/mixins/StateMixin.js +87 -5
- package/mixins/SurfaceMixin.js +152 -3
- package/mixins/TextFieldMixin.js +661 -2
- package/mixins/ThemableMixin.js +206 -3
- package/mixins/TooltipTriggerMixin.js +30 -4
- package/mixins/TouchTargetMixin.js +29 -4
- package/package.json +2 -1
- package/theming/loader.js +0 -2
- package/components/Badge.css +0 -38
- package/components/Body.css +0 -14
- package/components/BottomAppBar.css +0 -23
- package/components/Box.css +0 -31
- package/components/Button.css +0 -147
- package/components/Card.css +0 -109
- package/components/Checkbox.css +0 -89
- package/components/CheckboxIcon.css +0 -90
- package/components/Chip.css +0 -35
- package/components/Dialog.css +0 -235
- package/components/Divider.css +0 -41
- package/components/ExtendedFab.css +0 -24
- package/components/Fab.css +0 -23
- package/components/FilterChip.css +0 -80
- package/components/Headline.css +0 -14
- package/components/Icon.css +0 -76
- package/components/IconButton.css +0 -150
- package/components/Label.css +0 -14
- package/components/Layout.css +0 -19
- package/components/List.css +0 -12
- package/components/ListItem.css +0 -224
- package/components/ListOption.css +0 -34
- package/components/ListSelect.css +0 -9
- package/components/Menu.css +0 -171
- package/components/MenuItem.css +0 -53
- package/components/Nav.css +0 -17
- package/components/NavBar.css +0 -34
- package/components/NavBarItem.css +0 -41
- package/components/NavDrawer.css +0 -31
- package/components/NavDrawerItem.css +0 -42
- package/components/NavItem.css +0 -181
- package/components/NavRail.css +0 -47
- package/components/NavRailItem.css +0 -25
- package/components/Outline.css +0 -138
- package/components/Pane.css +0 -261
- package/components/Progress.css +0 -75
- package/components/ProgressCircle.css +0 -226
- package/components/ProgressLine.css +0 -155
- package/components/Radio.css +0 -95
- package/components/RadioIcon.css +0 -73
- package/components/Ripple.css +0 -74
- package/components/SegmentedButton.css +0 -94
- package/components/SegmentedButtonGroup.css +0 -12
- package/components/Select.css +0 -52
- package/components/Shape.css +0 -132
- package/components/Slider.css +0 -307
- package/components/Snackbar.css +0 -80
- package/components/Surface.css +0 -10
- package/components/Switch.css +0 -64
- package/components/SwitchIcon.css +0 -178
- package/components/SwitchIconAnimations.css +0 -89
- package/components/Tab.css +0 -85
- package/components/TabList.css +0 -129
- package/components/TextArea.css +0 -93
- package/components/Title.css +0 -14
- package/components/Tooltip.css +0 -40
- package/components/TopAppBar.css +0 -209
- package/mixins/ControlMixin.css +0 -57
- package/mixins/DensityMixin.css +0 -40
- package/mixins/FlexableMixin.css +0 -79
- package/mixins/RippleMixin.css +0 -12
- package/mixins/ShapeMixin.css +0 -135
- package/mixins/StateMixin.css +0 -82
- package/mixins/SurfaceMixin.css +0 -150
- package/mixins/TextFieldMixin.css +0 -657
- package/mixins/ThemableMixin.css +0 -204
- package/mixins/TooltipTriggerMixin.css +0 -27
- package/mixins/TouchTargetMixin.css +0 -26
package/components/Progress.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
/* https://m3.material.io/components/progress-indicators/specs */
|
|
2
|
+
|
|
1
3
|
import CustomElement from '../core/CustomElement.js';
|
|
2
4
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
3
5
|
|
|
4
|
-
import styles from './Progress.css' assert { type: 'css' };
|
|
5
|
-
import circleStyles from './ProgressCircle.css' assert { type: 'css' };
|
|
6
|
-
import lineStyles from './ProgressLine.css' assert { type: 'css' };
|
|
7
|
-
|
|
8
6
|
// https://html.spec.whatwg.org/multipage/form-elements.html#the-progress-element
|
|
9
7
|
|
|
10
8
|
export default CustomElement
|
|
@@ -39,13 +37,8 @@ export default CustomElement
|
|
|
39
37
|
return /** @type {HTMLProgressElement} */ (this.refs.progress).labels;
|
|
40
38
|
},
|
|
41
39
|
})
|
|
42
|
-
.css(
|
|
43
|
-
styles,
|
|
44
|
-
lineStyles,
|
|
45
|
-
circleStyles,
|
|
46
|
-
)
|
|
47
40
|
.html/* html */`
|
|
48
|
-
<div id=determinate style={_determinateStyle}>
|
|
41
|
+
<div id=determinate style="{_determinateStyle}">
|
|
49
42
|
<progress id=progress value={value} max={max} circle={circle}></progress>
|
|
50
43
|
<div _if={circle} id=circle>
|
|
51
44
|
<div id=semi1 class=semi></div>
|
|
@@ -64,4 +57,470 @@ export default CustomElement
|
|
|
64
57
|
</div>
|
|
65
58
|
</div>
|
|
66
59
|
`
|
|
60
|
+
.css`
|
|
61
|
+
/* Base Styles */
|
|
62
|
+
|
|
63
|
+
:host {
|
|
64
|
+
--mdw-bg: var(--mdw-color__surface-variant);
|
|
65
|
+
--mdw-ink: var(--mdw-color__primary);
|
|
66
|
+
--mdw-progress__opacity__duration: 500ms;
|
|
67
|
+
position: relative;
|
|
68
|
+
|
|
69
|
+
display: inline-block;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
vertical-align: middle;
|
|
72
|
+
|
|
73
|
+
min-block-size: 4px;
|
|
74
|
+
inline-size: 100%;
|
|
75
|
+
|
|
76
|
+
opacity: 1;
|
|
77
|
+
|
|
78
|
+
background-color: rgb(var(--mdw-bg));
|
|
79
|
+
color: rgb(var(--mdw-ink));
|
|
80
|
+
|
|
81
|
+
transition: opacity 500ms 275ms;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host([auto-hide]) {
|
|
85
|
+
will-change: opacity;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([auto-hide][value="100"]) {
|
|
89
|
+
opacity:0;
|
|
90
|
+
|
|
91
|
+
transition: opacity 1s 1s;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#determinate {
|
|
95
|
+
--previous: 0;
|
|
96
|
+
--value: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#progress {
|
|
100
|
+
position: absolute;
|
|
101
|
+
inset: 0;
|
|
102
|
+
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
block-size: 100%;
|
|
105
|
+
inline-size: 100%;
|
|
106
|
+
border: none; /* FireFox */
|
|
107
|
+
|
|
108
|
+
-moz-appearance: none;
|
|
109
|
+
appearance: none;
|
|
110
|
+
|
|
111
|
+
opacity:0;
|
|
112
|
+
transform: scaleX(var(--value, 0));
|
|
113
|
+
transform-origin: 0 0;
|
|
114
|
+
|
|
115
|
+
background-color: currentColor;
|
|
116
|
+
color: inherit;
|
|
117
|
+
|
|
118
|
+
transition: transform 275ms, opacity var(--mdw-progress__opacity__duration);
|
|
119
|
+
will-change: transform, opacity;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#progress::-webkit-progress-bar {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#progress::-moz-progress-bar {
|
|
127
|
+
display: none; /* Doesn't always work */
|
|
128
|
+
|
|
129
|
+
block-size: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#progress[value] {
|
|
133
|
+
opacity:1;
|
|
134
|
+
transform: scaleX(var(--value, 0));
|
|
135
|
+
}
|
|
136
|
+
`
|
|
137
|
+
.css`
|
|
138
|
+
/* Line Styles */
|
|
139
|
+
|
|
140
|
+
/* https://github.com/material-components/material-components-android/blob/ed77ab36ccac98df24e55060d58406c5981a9062/lib/java/com/google/android/material/progressindicator/ */
|
|
141
|
+
|
|
142
|
+
:host {
|
|
143
|
+
--mdw-progress__line1-head__timing: cubic-bezier(0.2, 0.8, 0, 1.0);
|
|
144
|
+
--mdw-progress__line1-tail__timing: cubic-bezier(0.4, 0.0, 1.0, 1.0);
|
|
145
|
+
--mdw-progress__line2-head__timing: cubic-bezier(0.0, 0.65, 0, 1.0);
|
|
146
|
+
--mdw-progress__line2-tail__timing: cubic-bezier(0.1, 0.45, 0, 1.0);
|
|
147
|
+
--mdw-progress__line__duration: 1800ms;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media (prefers-reduced-motion) {
|
|
151
|
+
:host {
|
|
152
|
+
--mdw-progress__line__duration: 18000ms
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.line {
|
|
157
|
+
opacity: 1;
|
|
158
|
+
|
|
159
|
+
transition: opacity var(--mdw-progress__opacity__duration);
|
|
160
|
+
will-change: opacity;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.line,
|
|
164
|
+
.line::after {
|
|
165
|
+
position: absolute;
|
|
166
|
+
inset: 0;
|
|
167
|
+
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
|
|
170
|
+
animation-duration: var(--mdw-progress__line__duration);
|
|
171
|
+
animation-timing-function: linear;
|
|
172
|
+
animation-iteration-count: infinite;
|
|
173
|
+
animation-fill-mode: forwards;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.line::after {
|
|
177
|
+
content: '';
|
|
178
|
+
|
|
179
|
+
background-color: currentColor;
|
|
180
|
+
|
|
181
|
+
animation: inherit;
|
|
182
|
+
will-change: transform;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#line1 {
|
|
186
|
+
animation-name: l1h;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
#line2 {
|
|
190
|
+
animation-name: l2h;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
#line1::after {
|
|
194
|
+
animation-name: l1t;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
#line2::after {
|
|
198
|
+
animation-name: l2t;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.line[value] {
|
|
202
|
+
opacity: 0;
|
|
203
|
+
visibility: hidden;
|
|
204
|
+
|
|
205
|
+
transition: opacity var(--mdw-progress__opacity__duration), visibility 1ms var(--mdw-progress__opacity__duration);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* L1H = 1267 / +533 = 70.39% - 100%
|
|
210
|
+
* L1T = 1000 / +567 = 55.56% - 87.05%
|
|
211
|
+
* L2H = 0333 / +850 = 18.50% - 65.72%
|
|
212
|
+
* L2T = 0000 / +750 = 0% - 41.67%
|
|
213
|
+
* Total = 1800ms
|
|
214
|
+
*
|
|
215
|
+
* t l1h l1t l2h l2t
|
|
216
|
+
* --------------------------------------
|
|
217
|
+
* 0.0000 0.0000 0.0000 0.0000 0.0000
|
|
218
|
+
* 0.1850 0.0000 0.0000 0.0000 0.5899
|
|
219
|
+
* 0.4167 0.0000 0.0000 0.7374 1.0000
|
|
220
|
+
* 0.5556 0.0000 0.0000 0.9072 1.0000
|
|
221
|
+
* 0.6572 0.0000 0.1544 1.0000 1.0000
|
|
222
|
+
* 0.7039 0.0000 0.2939 1.0000 1.0000
|
|
223
|
+
* 0.8706 0.7918 1.0000 1.0000 1.0000
|
|
224
|
+
* 1.0000 1.0000 1.0000 1.0000 1.0000
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
@keyframes l1h {
|
|
228
|
+
0% {
|
|
229
|
+
transform: translateX(0%);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
70.4% {
|
|
233
|
+
transform: translateX(0%);
|
|
234
|
+
|
|
235
|
+
animation-timing-function: var(--mdw-progress__line1-head__timing);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
100% {
|
|
239
|
+
transform: translateX(100%);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
@keyframes l1t {
|
|
243
|
+
0% {
|
|
244
|
+
transform: translateX(-100%);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
55.6% {
|
|
248
|
+
transform: translateX(-100%);
|
|
249
|
+
|
|
250
|
+
animation-timing-function: var(--mdw-progress__line1-tail__timing);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
87.1% {
|
|
254
|
+
transform: translateX(0%);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
100% {
|
|
258
|
+
transform: translateX(0%);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
@keyframes l2h {
|
|
262
|
+
0% {
|
|
263
|
+
transform: translateX(0%);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
18.5% {
|
|
267
|
+
transform: translateX(0%);
|
|
268
|
+
|
|
269
|
+
animation-timing-function: var(--mdw-progress__line2-head__timing);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
65.72% {
|
|
273
|
+
transform: translateX(100%);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
to {
|
|
277
|
+
transform: translateX(100%);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
@keyframes l2t {
|
|
281
|
+
0% {
|
|
282
|
+
transform: translateX(-100%);
|
|
283
|
+
|
|
284
|
+
animation-timing-function: var(--mdw-progress__line2-tail__timing);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
41.67% {
|
|
288
|
+
transform: translateX(0%);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
to {
|
|
292
|
+
transform: translateX(0%);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
`
|
|
297
|
+
.css`
|
|
298
|
+
/* Circle Styles */
|
|
299
|
+
/** https://github.com/material-components/material-components-android/blob/ed77ab36ccac98df24e55060d58406c5981a9062/lib/java/com/google/android/material/progressindicator/CircularIndeterminateAnimatorDelegate.java */
|
|
300
|
+
|
|
301
|
+
:host {
|
|
302
|
+
--mdw-progress__circle__timing: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
303
|
+
--mdw-progress__circle__margin: 4px;
|
|
304
|
+
--mdw-progress__circle__duration: 5400ms;
|
|
305
|
+
--mdw-progress__circle__duration__expand: 667ms;
|
|
306
|
+
--mdw-progress__circle__duration__collapse: 667ms;
|
|
307
|
+
--mdw-progress__circle__duration__fade-in: 333ms;
|
|
308
|
+
--mdw-progress__circle__duration__complete-end: 333ms;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
@media (prefers-reduced-motion) {
|
|
312
|
+
:host {
|
|
313
|
+
--mdw-progress__circle__duration: 54000ms;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
#circle {
|
|
318
|
+
--startA: min(0.5, var(--previous));
|
|
319
|
+
--endA: min(0.5, var(--value));
|
|
320
|
+
--travelA: max(
|
|
321
|
+
calc(var(--startA) - var(--endA)),
|
|
322
|
+
calc(var(--endA) - var(--startA))
|
|
323
|
+
);
|
|
324
|
+
--delayA: max(0, calc(var(--previous) - 0.5));
|
|
325
|
+
--startB: max(0, calc(var(--previous) - 0.5));
|
|
326
|
+
--endB: max(0, calc(var(--value) - 0.5));
|
|
327
|
+
--travelB: max(
|
|
328
|
+
calc(var(--startB) - var(--endB)),
|
|
329
|
+
calc(var(--endB) - var(--startB))
|
|
330
|
+
);
|
|
331
|
+
--delayB: max(0, 0.5 - calc(var(--previous)));
|
|
332
|
+
|
|
333
|
+
position: absolute;
|
|
334
|
+
inset: 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
:host([circle]) {
|
|
338
|
+
block-size: 48px;
|
|
339
|
+
inline-size: 48px;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
:host([circle]:not([color])) {
|
|
343
|
+
background-color: transparent;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
#progress[circle] {
|
|
347
|
+
visibility: hidden;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.semi {
|
|
351
|
+
position: absolute;
|
|
352
|
+
inset: var(--mdw-progress__circle__margin);
|
|
353
|
+
|
|
354
|
+
overflow: hidden;
|
|
355
|
+
|
|
356
|
+
box-sizing: border-box;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
#semi1 {
|
|
360
|
+
inset-inline-start: 50%;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
#semi2 {
|
|
364
|
+
inset-inline-end: 50%;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.semi::after {
|
|
368
|
+
content: "";
|
|
369
|
+
|
|
370
|
+
position: absolute;
|
|
371
|
+
inset: 0;
|
|
372
|
+
|
|
373
|
+
box-sizing: border-box;
|
|
374
|
+
border: solid currentcolor 4px;
|
|
375
|
+
|
|
376
|
+
transform: rotate(var(--rotation));
|
|
377
|
+
|
|
378
|
+
background-color: transparent;
|
|
379
|
+
border-radius: 50%;
|
|
380
|
+
|
|
381
|
+
transition: transform 400ms;
|
|
382
|
+
transition-timing-function: linear;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
#semi1::after {
|
|
386
|
+
--rotation: min(180deg, calc(var(--value) * 360deg));
|
|
387
|
+
inset-inline-start: -100%;
|
|
388
|
+
|
|
389
|
+
clip-path: inset(0 50% 0 0);
|
|
390
|
+
|
|
391
|
+
transition-delay: calc(var(--delayA) * var(--mdw-progress__circle__duration__expand));
|
|
392
|
+
transition-duration: calc(var(--travelA) * var(--mdw-progress__circle__duration__expand));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
#semi2::after {
|
|
396
|
+
--rotation: max(0deg, calc(var(--value) * 360deg - 180deg));
|
|
397
|
+
inset-inline-end: -100%;
|
|
398
|
+
|
|
399
|
+
clip-path: inset(0 0 0 50%);
|
|
400
|
+
|
|
401
|
+
transition-delay: calc(var(--delayB) * var(--mdw-progress__circle__duration__expand));
|
|
402
|
+
transition-duration: calc(var(--travelB) * var(--mdw-progress__circle__duration__expand));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
#indeterminate-circle {
|
|
406
|
+
position: absolute;
|
|
407
|
+
inset: 0;
|
|
408
|
+
|
|
409
|
+
display: block;
|
|
410
|
+
|
|
411
|
+
animation: rotate-cw calc(var(--mdw-progress__circle__duration) / 4) linear infinite;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.arc {
|
|
415
|
+
position: absolute;
|
|
416
|
+
inset: var(--mdw-progress__circle__margin);
|
|
417
|
+
|
|
418
|
+
overflow: hidden;
|
|
419
|
+
|
|
420
|
+
box-sizing: border-box;
|
|
421
|
+
|
|
422
|
+
animation: rotate-jump var(--mdw-progress__circle__duration) steps(1,end) infinite;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.arc::after {
|
|
426
|
+
content: "";
|
|
427
|
+
|
|
428
|
+
position: absolute;
|
|
429
|
+
inset: 0;
|
|
430
|
+
|
|
431
|
+
box-sizing: border-box;
|
|
432
|
+
border: solid currentcolor 4px;
|
|
433
|
+
|
|
434
|
+
background-color: transparent;
|
|
435
|
+
border-radius: 50%;
|
|
436
|
+
|
|
437
|
+
animation: grow-shrink calc(var(--mdw-progress__circle__duration) / 4) var(--mdw-progress__circle__timing) infinite;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
#arc2 {
|
|
441
|
+
inset-block-end: 50%;
|
|
442
|
+
inset-inline-start: 50%;
|
|
443
|
+
|
|
444
|
+
transform-origin: 0 100%;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
#arc3 {
|
|
448
|
+
inset-block-start: 50%;
|
|
449
|
+
inset-inline-end: 50%;
|
|
450
|
+
|
|
451
|
+
transform-origin: 100% 0;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
#arc4 {
|
|
455
|
+
inset-block-start: 50%;
|
|
456
|
+
inset-inline-start: 50%;
|
|
457
|
+
|
|
458
|
+
transform-origin: 0 0;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
#arc2:after {
|
|
462
|
+
inset-block-end: -100%;
|
|
463
|
+
inset-inline-start: -100%;
|
|
464
|
+
|
|
465
|
+
clip-path: polygon(0% 0%, 50% 0%, 50% 50%, 100% 50%, 100% 100%, 0% 100%);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
#arc3:after {
|
|
469
|
+
inset-block-start: -100%;
|
|
470
|
+
inset-inline-end: -100%;
|
|
471
|
+
|
|
472
|
+
clip-path: inset(0 50% 50% 0);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
#arc4:after {
|
|
476
|
+
inset-block-start: -100%;
|
|
477
|
+
inset-inline-start: -100%;
|
|
478
|
+
|
|
479
|
+
clip-path: inset(0 50% 0 0);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
@keyframes rotate-cw {
|
|
483
|
+
from {
|
|
484
|
+
transform: rotate(0deg);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
to {
|
|
488
|
+
transform: rotate(360deg);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
@keyframes rotate-jump {
|
|
493
|
+
0% { transform: scaleX(1) rotate(0deg); }
|
|
494
|
+
|
|
495
|
+
12.5% { transform: scaleX(-1) rotate(-270deg); }
|
|
496
|
+
|
|
497
|
+
25% { transform: scaleX(1) rotate(270deg); }
|
|
498
|
+
|
|
499
|
+
37.5% {transform: scaleX(-1) rotate(-180deg);}
|
|
500
|
+
|
|
501
|
+
50% { transform: scaleX(1) rotate(180deg); }
|
|
502
|
+
|
|
503
|
+
62.5% { transform: scaleX(-1) rotate(-90deg); }
|
|
504
|
+
|
|
505
|
+
75% { transform: scaleX(1) rotate(90deg); }
|
|
506
|
+
|
|
507
|
+
87.5% { transform: scaleX(-1) rotate(0deg); }
|
|
508
|
+
|
|
509
|
+
to { transform: scaleX(1) rotate(0deg); }
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
@keyframes grow-shrink {
|
|
513
|
+
from {
|
|
514
|
+
transform: rotate(calc(0.01 * 360deg));
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
50% {
|
|
518
|
+
transform: rotate(calc(0.73 * 360deg));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
to {
|
|
522
|
+
transform: rotate(calc(0.01 * 360deg));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
`
|
|
67
526
|
.autoRegister('mdw-progress');
|
package/components/Radio.js
CHANGED
|
@@ -7,8 +7,6 @@ import StateMixin from '../mixins/StateMixin.js';
|
|
|
7
7
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
8
8
|
import TouchTargetMixin from '../mixins/TouchTargetMixin.js';
|
|
9
9
|
|
|
10
|
-
import styles from './Radio.css' assert { type: 'css' };
|
|
11
|
-
|
|
12
10
|
export default CustomElement
|
|
13
11
|
.mixin(ThemableMixin)
|
|
14
12
|
.mixin(StateMixin)
|
|
@@ -20,7 +18,6 @@ export default CustomElement
|
|
|
20
18
|
type: 'radio',
|
|
21
19
|
stateLayer: true,
|
|
22
20
|
})
|
|
23
|
-
.css(styles)
|
|
24
21
|
.on({
|
|
25
22
|
composed({ html }) {
|
|
26
23
|
const { label, rippleContainer, state, control, touchTarget } = this.refs;
|
|
@@ -39,4 +36,101 @@ export default CustomElement
|
|
|
39
36
|
control.setAttribute('type', 'radio');
|
|
40
37
|
},
|
|
41
38
|
})
|
|
39
|
+
.css`
|
|
40
|
+
/* https://m3.material.io/components/radio/specs */
|
|
41
|
+
|
|
42
|
+
:host {
|
|
43
|
+
--mdw-ink: var(--mdw-color__primary);
|
|
44
|
+
--mdw-shape__size: var(--mdw-shape__full);
|
|
45
|
+
display: inline-grid;
|
|
46
|
+
align-items: baseline;
|
|
47
|
+
gap: 12px;
|
|
48
|
+
grid-auto-flow: column;
|
|
49
|
+
grid-template-rows: minmax(20px, auto);
|
|
50
|
+
grid-template-columns: 20px;
|
|
51
|
+
justify-content: flex-start;
|
|
52
|
+
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
transition: none 100ms cubic-bezier(0.4, 0.0, 1, 1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host(:empty) {
|
|
59
|
+
vertical-align: -11.5%;
|
|
60
|
+
|
|
61
|
+
line-height: 20px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host(:empty) #radio {
|
|
65
|
+
transform: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#control {
|
|
69
|
+
grid-column: 1/1;
|
|
70
|
+
|
|
71
|
+
cursor: inherit;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#label {
|
|
75
|
+
cursor: inherit;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#label[disabled] {
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#state {
|
|
83
|
+
pointer-events: auto;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#state,
|
|
87
|
+
#ripple-container {
|
|
88
|
+
inset-block-start: 50%;
|
|
89
|
+
inset-inline-start: 50%;
|
|
90
|
+
|
|
91
|
+
block-size: 40px;
|
|
92
|
+
inline-size: 40px;
|
|
93
|
+
|
|
94
|
+
transform: translateX(-50%) translateY(-50%);
|
|
95
|
+
|
|
96
|
+
border-radius: 50%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([disabled]) {
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
|
|
102
|
+
opacity: 0.38;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#radio {
|
|
106
|
+
position: relative;
|
|
107
|
+
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
|
|
110
|
+
grid-column: 1 / 1;
|
|
111
|
+
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
|
|
114
|
+
transform: translateY(11.5%);
|
|
115
|
+
|
|
116
|
+
color: rgb(var(--mdw-color__on-surface));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
#radio[selected] {
|
|
120
|
+
color: rgb(var(--mdw-ink));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#radio[disabled] {
|
|
124
|
+
color: rgb(var(--mdw-color__on-surface));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
#radio[errored] {
|
|
128
|
+
color: rgb(var(--mdw-color__error));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#icon {
|
|
132
|
+
--mdw-ink: inherit;
|
|
133
|
+
--disabled-opacity: 1;
|
|
134
|
+
}
|
|
135
|
+
`
|
|
42
136
|
.autoRegister('mdw-radio');
|
package/components/RadioIcon.js
CHANGED
|
@@ -2,12 +2,10 @@ import CustomElement from '../core/CustomElement.js';
|
|
|
2
2
|
import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
3
3
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
4
4
|
|
|
5
|
-
import outlineStyles from './Outline.css' assert {type:'css'};
|
|
6
|
-
import styles from './RadioIcon.css' assert {type: 'css'};
|
|
7
|
-
|
|
8
5
|
export default CustomElement
|
|
9
6
|
.mixin(ThemableMixin)
|
|
10
7
|
.mixin(ShapeMixin)
|
|
8
|
+
.extend()
|
|
11
9
|
.observe({
|
|
12
10
|
selected: 'boolean',
|
|
13
11
|
icon: 'string',
|
|
@@ -23,7 +21,6 @@ export default CustomElement
|
|
|
23
21
|
set(value) { this.selected = value; },
|
|
24
22
|
},
|
|
25
23
|
})
|
|
26
|
-
.css(outlineStyles, styles)
|
|
27
24
|
.html/* html */`
|
|
28
25
|
<div id=inner-shape class=shape selected={selected}></div>
|
|
29
26
|
`.on({
|
|
@@ -33,5 +30,80 @@ export default CustomElement
|
|
|
33
30
|
outline.setAttribute('selected', '{selected}');
|
|
34
31
|
},
|
|
35
32
|
})
|
|
36
|
-
.
|
|
33
|
+
.css`
|
|
34
|
+
/* https://m3.material.io/components/radio-button/specs */
|
|
35
|
+
|
|
36
|
+
:host {
|
|
37
|
+
--disabled-opacity: 0.38;
|
|
38
|
+
--mdw-ink: rgb(var(--mdw-color__primary));
|
|
39
|
+
/* Use CSS Variables to force filter to reapply (Chrome Bug) */
|
|
40
|
+
--color: rgb(var(--mdw-color__on-surface-variant));
|
|
41
|
+
position: relative;
|
|
42
|
+
|
|
43
|
+
display: inline-block;
|
|
44
|
+
|
|
45
|
+
block-size: 20px;
|
|
46
|
+
inline-size: 20px;
|
|
47
|
+
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
|
|
50
|
+
transition: opacity 200ms;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.shape {
|
|
54
|
+
--mdw-shape__size: var(--mdw-shape__full);
|
|
55
|
+
position: absolute;
|
|
56
|
+
inset: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#outline {
|
|
60
|
+
filter:
|
|
61
|
+
drop-shadow(1px 0px 0px var(--color))
|
|
62
|
+
drop-shadow(0px 1px 0px var(--color))
|
|
63
|
+
drop-shadow(-1px 0px 0px var(--color))
|
|
64
|
+
drop-shadow(0px -1px 0px var(--color))
|
|
65
|
+
;
|
|
66
|
+
|
|
67
|
+
color: var(--color);
|
|
68
|
+
|
|
69
|
+
will-change: filter, color;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#inner-shape {
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset: 0;
|
|
75
|
+
|
|
76
|
+
transform: scale(0);
|
|
77
|
+
|
|
78
|
+
background-color: var(--color);
|
|
79
|
+
|
|
80
|
+
transition: transform 200ms, background-color 100ms;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([hovered]) {
|
|
84
|
+
--color: rgb(var(--mdw-color__on-surface));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([focused]) {
|
|
88
|
+
--color: rgb(var(--mdw-color__on-surface));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host([selected]) {
|
|
92
|
+
--color: rgb(var(--mdw-ink));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([errored]) {
|
|
96
|
+
--color: rgb(var(--mdw-color__error));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([disabled]) {
|
|
100
|
+
--color: rgba(var(--mdw-color__on-surface));
|
|
101
|
+
opacity: var(--disabled-opacity);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
#inner-shape[selected] {
|
|
105
|
+
transform: scale(0.5);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
`
|
|
37
109
|
.autoRegister('mdw-radio-icon');
|