@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
@@ -1,4 +1,4 @@
1
- import { generateLayoutGlobalCSS, generateThemeCSS, generateTypographyGlobalCSS, themeOptionsFromSearchParams } from '../theming/index.js';
1
+ import { generateThemeCSS, generateTypographyGlobalCSS, themeOptionsFromSearchParams } from '../theming/index.js';
2
2
  import { getSearchParams } from '../utils/cli.js';
3
3
 
4
4
  process.stdout.write(
@@ -9,4 +9,3 @@ process.stdout.write(
9
9
  ),
10
10
  );
11
11
  process.stdout.write(generateTypographyGlobalCSS());
12
- process.stdout.write(generateLayoutGlobalCSS());
@@ -3,13 +3,50 @@ import DensityMixin from '../mixins/DensityMixin.js';
3
3
  import ShapeMixin from '../mixins/ShapeMixin.js';
4
4
  import ThemableMixin from '../mixins/ThemableMixin.js';
5
5
 
6
- import styles from './Badge.css' assert { type: 'css'};
7
-
8
6
  export default CustomElement
9
7
  .mixin(ThemableMixin)
10
8
  .mixin(DensityMixin)
11
9
  .mixin(ShapeMixin)
12
10
  .extend()
13
- .css(styles)
14
11
  .html/* html */`<slot id=slot></slot>`
12
+ .css`
13
+ :host {
14
+ --mdw-shape__size: 8px;
15
+ --mdw-ink: var(--mdw-color__on-error);
16
+ --mdw-shape__bg: rgb(var(--mdw-color__error));
17
+ --mdw-type__font: var(--mdw-typescale__label-small__font);
18
+ --mdw-type__letter-spacing: var(--mdw-typescale__label-small__letter-spacing);
19
+ position: relative;
20
+
21
+ display: inline-block;
22
+ vertical-align: middle;
23
+
24
+ box-sizing: border-box;
25
+ min-block-size: var(--mdw-typescale__label-small__line-height);
26
+ min-inline-size: var(--mdw-typescale__label-small__line-height);
27
+ padding-inline: max(4px, calc(4px + (var(--mdw-density) * 2px)));
28
+
29
+ color: rgb(var(--mdw-ink));
30
+
31
+ font: var(--mdw-type__font);
32
+ letter-spacing: var(--mdw-type__letter-spacing);
33
+ text-align: center;
34
+ }
35
+
36
+ @supports (width: 1lh) {
37
+ :host {
38
+ min-block-size: 1lh; /* Clamps to 1:1 */
39
+ min-inline-size: 1lh; /* Clamps to 1:1 */
40
+ padding-inline: max(0.25lh, calc(0.25lh + (var(--mdw-density) * 2px)));
41
+ }
42
+ }
43
+
44
+ :host(:empty) {
45
+ vertical-align: middle;
46
+ }
47
+
48
+ :host(:empty) #shape {
49
+ inset: 5px;
50
+ }
51
+ `
15
52
  .autoRegister('mdw-badge');
@@ -1,7 +1,21 @@
1
- import styles from './Body.css' assert { type: 'css' };
2
1
  import Box from './Box.js';
3
2
 
4
3
  export default Box
5
4
  .extend()
6
- .css(styles)
5
+ .css`
6
+ :host {
7
+ font: var(--mdw-typescale__body-large__font);
8
+ letter-spacing: var(--mdw-typescale__body-large__letter-spacing);
9
+ }
10
+
11
+ :host([size="medium"]) {
12
+ font: var(--mdw-typescale__body-medium__font);
13
+ letter-spacing: var(--mdw-typescale__body-medium__letter-spacing);
14
+ }
15
+
16
+ :host([size="small"]) {
17
+ font: var(--mdw-typescale__body-small__font);
18
+ letter-spacing: var(--mdw-typescale__body-small__letter-spacing);
19
+ }
20
+ `
7
21
  .autoRegister('mdw-body');
@@ -1,7 +1,6 @@
1
1
  import AriaReflectorMixin from '../mixins/AriaReflectorMixin.js';
2
2
  import AriaToolbarMixin from '../mixins/AriaToolbarMixin.js';
3
3
 
4
- import styles from './BottomAppBar.css' assert { type: 'css' };
5
4
  import Surface from './Surface.js';
6
5
 
7
6
  /**
@@ -21,5 +20,29 @@ export default Surface
21
20
  .observe({
22
21
  color: { empty: 'surface' },
23
22
  })
24
- .css(styles)
23
+ .css`
24
+ /* https://m3.material.io/components/bottom-app-bar/specs */
25
+
26
+ :host {
27
+ --mdw-surface__tint: var(--mdw-surface__tint__2);
28
+ --mdw-surface__tint__raised: var(--mdw-surface__tint__2);
29
+ --mdw-bg: var(--mdw-color__surface);
30
+ --mdw-ink: var(--mdw-color__on-surface);
31
+
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 8px;
35
+ justify-content: flex-start;
36
+
37
+ box-sizing: content-box;
38
+ /* Don't apply density */
39
+ block-size: 56px;
40
+ padding-block: 12px;
41
+ padding-inline: 8px 16px;
42
+
43
+ box-shadow: none;
44
+
45
+ direction: ltr;
46
+ }
47
+ `
25
48
  .autoRegister('mdw-bottom-app-bar');
package/components/Box.js CHANGED
@@ -2,8 +2,6 @@ import CustomElement from '../core/CustomElement.js';
2
2
  import FlexableMixin from '../mixins/FlexableMixin.js';
3
3
  import ThemableMixin from '../mixins/ThemableMixin.js';
4
4
 
5
- import styles from './Box.css' assert { type: 'css' };
6
-
7
5
  /**
8
6
  * Containers are stateless elements that may have a color and ink.
9
7
  * They should have simple geometry for rendering and layout.
@@ -19,6 +17,38 @@ export default CustomElement
19
17
  empty: true,
20
18
  },
21
19
  })
22
- .css(styles)
20
+ .css`
21
+ :host {
22
+ display: block;
23
+ }
24
+
25
+ :host([inline]) {
26
+ display: inline-block;
27
+ }
28
+
29
+ :host([flex]:where([inline])) {
30
+ display: inline-flex;
31
+ }
32
+
33
+ :host([color]) {
34
+ background-color: rgb(var(--mdw-bg));
35
+ color: rgb(var(--mdw-ink));
36
+ }
37
+
38
+ :host([ink]) {
39
+ color: rgb(var(--mdw-ink));
40
+ }
41
+
42
+ :host([type-style]) {
43
+ font: var(--mdw-type__font);
44
+ letter-spacing: var(--mdw-type__letter-spacing);
45
+ }
46
+
47
+ #slot {
48
+ /* Passthrough from parent */
49
+ block-size: inherit;
50
+ inline-size: inherit;
51
+ }
52
+ `
23
53
  .html/* html */`<slot id=slot type-style={typeStyle}></slot>`
24
54
  .autoRegister('mdw-box');
@@ -8,8 +8,6 @@ import StateMixin from '../mixins/StateMixin.js';
8
8
  import SurfaceMixin from '../mixins/SurfaceMixin.js';
9
9
  import ThemableMixin from '../mixins/ThemableMixin.js';
10
10
 
11
- import styles from './Button.css' assert { type: 'css' };
12
-
13
11
  export default CustomElement
14
12
  .mixin(ThemableMixin)
15
13
  .mixin(DensityMixin)
@@ -42,7 +40,6 @@ export default CustomElement
42
40
  return icon ?? svg ?? src ?? svgPath;
43
41
  },
44
42
  })
45
- .css(styles)
46
43
  .html/* html */`
47
44
  <mdw-icon _if={hasIcon} id=icon ink={iconInk} disabled={disabledState} outlined={outlined} aria-hidden=true svg={svg} src={src} svg-path={svgPath}>{icon}</mdw-icon>
48
45
  <slot id=slot disabled={disabledState}></slot>
@@ -63,14 +60,154 @@ export default CustomElement
63
60
  control.setAttribute('type', 'button');
64
61
  },
65
62
  })
63
+ .css`
64
+ /* https://m3.material.io/components/buttons/specs */
65
+
66
+ :host {
67
+ --mdw-shape__size: var(--mdw-shape__full);
68
+ --mdw-ink: var(--mdw-color__primary);
69
+
70
+ --mdw-type__font: var(--mdw-typescale__label-large__font);
71
+ --mdw-type__letter-spacing: var(--mdw-typescale__label-large__letter-spacing);
72
+
73
+ display: inline-flex;
74
+
75
+ align-items: center;
76
+ gap: 0;
77
+ justify-content: center;
78
+ vertical-align: middle;
79
+
80
+ /* box-sizing: border-box; */
81
+ min-block-size: 24px;
82
+ min-inline-size: 24px;
83
+
84
+ padding-block: calc(8px + (var(--mdw-density) * 2px));
85
+ padding-inline: calc(12px + (var(--mdw-density) * 2px));
86
+
87
+ -webkit-tap-highlight-color: transparent;
88
+ -webkit-user-select: none;
89
+ user-select: none;
90
+
91
+ color: rgb(var(--mdw-ink));
92
+
93
+ font: var(--mdw-type__font);
94
+ letter-spacing: var(--mdw-type__letter-spacing);
95
+ }
96
+
97
+ :host(:where([elevated],[filled])) {
98
+ will-change: filter;
99
+ }
100
+
101
+ /** Elevated Color Defaults */
102
+ :host(:where([elevated])) {
103
+ --mdw-bg: var(--mdw-color__surface);
104
+ --mdw-ink: var(--mdw-color__primary);
105
+ --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
106
+ --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
107
+ --mdw-surface__tint: var(--mdw-surface__tint__1);
108
+ --mdw-surface__tint__raised: var(--mdw-surface__tint__2);
109
+ }
110
+ /** Filled Color Defaults */
111
+ :host(:where([filled])) {
112
+ --mdw-bg: var(--mdw-color__primary);
113
+ --mdw-ink: var(--mdw-color__on-primary);
114
+ --mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
115
+ --mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
116
+ --mdw-surface__tint: 0;
117
+ --mdw-surface__tint__raised: var(--mdw-surface__tint__1);
118
+ }
119
+ /** Filled Tonal Color Defaults */
120
+ :host(:where([filled="tonal"])) {
121
+ --mdw-bg: var(--mdw-color__secondary-container);
122
+ --mdw-ink: var(--mdw-color__on-secondary-container);
123
+ }
124
+ /** Outlined Color Defaults */
125
+ :host(:where([outlined])) {
126
+ --mdw-ink: var(--mdw-color__primary);
127
+ }
128
+
129
+ :host(:where([icon])) {
130
+ gap: 8px;
131
+
132
+ padding-inline: calc(12px + (var(--mdw-density) * 2px)) calc(16px + (var(--mdw-density) * 2px));
133
+ }
134
+
135
+ :host(:where([outlined], [elevated], [filled])) {
136
+ padding-inline: calc(24px + (var(--mdw-density) * 2px));
137
+ }
138
+
139
+ :host(:where([icon]):where([outlined], [elevated], [filled])) {
140
+ gap: 8px;
141
+
142
+ padding-inline: calc(16px + (var(--mdw-density) * 2px)) calc(24px + (var(--mdw-density) * 2px));
143
+ }
144
+
145
+ #shape:where([elevated],[filled],[color]) {
146
+ background-color: rgb(var(--mdw-bg));
147
+ }
148
+
149
+ #slot {
150
+ text-align: center;
151
+ text-decoration: none;
152
+ white-space: nowrap;
153
+ }
154
+
155
+ #control {
156
+ cursor: inherit;
157
+ }
158
+
159
+ :host([disabled]) {
160
+ /* cursor: not-allowed; */
161
+
162
+ color: rgba(var(--mdw-color__on-surface), 0.38);
163
+ }
164
+
165
+ #shape[disabled]:is([elevated], [filled]) {
166
+ background-color: rgba(var(--mdw-color__on-surface), 0.12);
167
+ color: rgba(var(--mdw-color__on-surface), 0.38);
168
+ }
169
+
170
+ #slot[disabled] {
171
+ color: rgba(var(--mdw-color__on-surface), 0.38);
172
+ }
173
+
174
+ #icon {
175
+ font-size: calc(18/14 * 1em);
176
+ font-variation-settings: 'FILL' 1;
177
+ }
178
+
179
+ #icon[outlined] {
180
+ font-variation-settings: 'FILL' 0;
181
+ }
182
+
183
+ #icon[disabled] {
184
+ opacity: 0.38;
185
+
186
+ color: rgba(var(--mdw-color__on-surface));
187
+ }
188
+
189
+ #label {
190
+ cursor: pointer;
191
+ }
192
+
193
+ #label[disabled] {
194
+ cursor: not-allowed;
195
+ }
196
+
197
+ @media (any-pointer: coarse) {
198
+ #touch-target {
199
+ visibility: visible;
200
+ }
201
+ }
202
+ `
66
203
  .childEvents({
67
204
  control: {
68
- /**
69
- * Duplicates button for form submission
70
- * @see https://github.com/WICG/webcomponents/issues/814
71
- * @param {{currentTarget:HTMLInputElement}} event
72
- * @type {any}
73
- */
205
+ /**
206
+ * Duplicates button for form submission
207
+ * @see https://github.com/WICG/webcomponents/issues/814
208
+ * @param {{currentTarget:HTMLInputElement}} event
209
+ * @type {any}
210
+ */
74
211
  '~click'({ currentTarget }) {
75
212
  if (currentTarget.disabled) return;
76
213
  if (currentTarget.type !== 'submit') return;
@@ -7,8 +7,6 @@ import ShapeMixin from '../mixins/ShapeMixin.js';
7
7
  import StateMixin from '../mixins/StateMixin.js';
8
8
  import SurfaceMixin from '../mixins/SurfaceMixin.js';
9
9
 
10
- import styles from './Card.css' assert { type: 'css' };
11
-
12
10
  const SUPPORTS_INERT = 'inert' in HTMLElement.prototype;
13
11
 
14
12
  export default CustomElement
@@ -48,7 +46,117 @@ export default CustomElement
48
46
  <div _if={showBlocker} id=inert-blocker></div>
49
47
  <slot id=slot disabled={disabledState}></slot>
50
48
  `
51
- .css(styles)
49
+ .css`
50
+ /* https://m3.material.io/components/cards/specs */
51
+
52
+ :host {
53
+ --mdw-shape__size: 12px;
54
+ --mdw-surface__tint: var(--mdw-surface__tint__0);
55
+ --mdw-surface__tint__raised: var(--mdw-surface__tint);
56
+
57
+ --mdw-surface__shadow__resting: none;
58
+ --mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
59
+ /* padding-inline: 12px; */
60
+
61
+ --mdw-bg: var(--mdw-color__surface);
62
+ --mdw-ink: var(--mdw-color__on-surface);
63
+ position: relative;
64
+
65
+ display: block;
66
+
67
+ color: rgb(var(--mdw-ink));
68
+
69
+ font: var(--mdw-type__font);
70
+ letter-spacing: var(--mdw-type__letter-spacing);
71
+ }
72
+
73
+ #shape:is([elevated],[filled]) {
74
+ background-color: rgb(var(--mdw-bg));
75
+ }
76
+
77
+ :host(:where([filled])) {
78
+ --mdw-bg: var(--mdw-color__surface-variant);
79
+ --mdw-ink: var(--mdw-color__on-surface-variant);
80
+ }
81
+
82
+ :host(:where([elevated])) {
83
+ --mdw-bg: var(--mdw-color__surface);
84
+ --mdw-ink: var(--mdw-color__on-surface);
85
+ }
86
+
87
+ :host([filled]) {
88
+ --mdw-surface__tint: var(--mdw-surface__tint__0);
89
+ --mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
90
+ }
91
+
92
+ :host([filled][actionable]) {
93
+ --mdw-surface__tint__raised: var(--mdw-surface__tint__1);
94
+ --mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
95
+ }
96
+
97
+ :host([elevated]) {
98
+ --mdw-surface__tint: var(--mdw-surface__tint__1);
99
+ --mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
100
+ }
101
+
102
+ :host([elevated][actionable]) {
103
+ --mdw-surface__tint__raised: var(--mdw-surface__tint__2);
104
+ --mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
105
+ }
106
+
107
+ #shape[disabled] {
108
+
109
+ /* Works on images */
110
+ filter: grayscale();
111
+
112
+ color: rgb(var(--mdw-color__on-surface));
113
+ }
114
+
115
+ :host([disabled]) {
116
+ cursor: not-allowed;
117
+
118
+ filter: grayscale();
119
+ opacity: 0.38;
120
+ }
121
+
122
+ #slot[disabled] {
123
+ color: rgb(var(--mdw-color__on-surface));
124
+ }
125
+
126
+ #outline[disabled] {
127
+ color: rgba(var(--mdw-color__on-surface), calc(0.12/0.38));
128
+ }
129
+
130
+ /** Firefox and Safari do not support [inert] */
131
+
132
+ #inert-blocker {
133
+ position: absolute;
134
+ inset: 0;
135
+
136
+ cursor: not-allowed;
137
+ pointer-events: auto;
138
+
139
+ z-index: 99;
140
+ }
141
+
142
+ #shape[disabled][elevated] {
143
+ background-color: rgba(var(--mdw-color__surface-variant));
144
+ }
145
+
146
+ #action {
147
+ --mdw-ink: inherit;
148
+ --mdw-shape__size: inherit;
149
+
150
+ position: absolute;
151
+ inset: 0;
152
+
153
+ padding: 0;
154
+
155
+ z-index: 0;
156
+
157
+ color: inherit
158
+ }
159
+ `
52
160
  .on({
53
161
  composed() {
54
162
  const { slot, surface, surfaceTint, shape, outline } = this.refs;
@@ -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 './Checkbox.css' assert { type: 'css' };
11
-
12
10
  export default CustomElement
13
11
  .mixin(ThemableMixin)
14
12
  .mixin(StateMixin)
@@ -34,7 +32,97 @@ export default CustomElement
34
32
  return (indeterminate ? indeterminateIcon : icon);
35
33
  },
36
34
  })
37
- .css(styles)
35
+ .css`
36
+ /* https://m3.material.io/components/checkbox/specs */
37
+
38
+ :host {
39
+ --mdw-ink: var(--mdw-color__on-primary);
40
+ --mdw-bg: var(--mdw-color__primary);
41
+
42
+ display: inline-grid;
43
+ align-items: baseline;
44
+ gap: 12px;
45
+ grid-auto-flow: column;
46
+ justify-content: flex-start;
47
+
48
+ cursor: pointer;
49
+
50
+ transition: none 100ms cubic-bezier(0.4, 0.0, 1, 1);
51
+ }
52
+
53
+ :host([disabled]) {
54
+ opacity: 0.38;
55
+ }
56
+
57
+ :host(:empty) {
58
+ vertical-align: -11.5%;
59
+
60
+ line-height: 18px;
61
+ }
62
+
63
+ :host(:empty) #checkbox {
64
+ transform: none;
65
+ }
66
+
67
+ #control {
68
+ grid-column: 1/1;
69
+
70
+ cursor: inherit;
71
+ }
72
+
73
+ #label {
74
+ cursor: inherit;
75
+ }
76
+
77
+ #label[disabled] {
78
+ cursor: not-allowed;
79
+ }
80
+
81
+ #state,
82
+ #ripple-container {
83
+ inset-block-start: 50%;
84
+ inset-inline-start: 50%;
85
+
86
+ block-size: 40px;
87
+ inline-size: 40px;
88
+
89
+ transform: translateX(-50%) translateY(-50%);
90
+
91
+ border-radius: 50%;
92
+ }
93
+
94
+ #checkbox {
95
+ position: relative;
96
+
97
+ display: inline-flex;
98
+
99
+ grid-column: 1 / 1;
100
+
101
+ pointer-events: none;
102
+
103
+ transform: translateY(11.5%);
104
+
105
+ color: rgb(var(--mdw-color__on-surface));
106
+ }
107
+
108
+ #checkbox[selected] {
109
+ color: rgb(var(--mdw-bg));
110
+ }
111
+
112
+ #checkbox[disabled] {
113
+ color: rgb(var(--mdw-color__on-surface));
114
+ }
115
+
116
+ #checkbox[errored] {
117
+ color: rgb(var(--mdw-color__error));
118
+ }
119
+
120
+ #icon {
121
+ --mdw-ink: inherit;
122
+ --mdw-bg: inherit;
123
+ --disabled-opacity: 1;
124
+ }
125
+ `
38
126
  .on({
39
127
  composed({ html }) {
40
128
  const { label, control, state, rippleContainer, touchTarget } = this.refs;
@@ -3,9 +3,6 @@ import CustomElement from '../core/CustomElement.js';
3
3
  import ShapeMixin from '../mixins/ShapeMixin.js';
4
4
  import ThemableMixin from '../mixins/ThemableMixin.js';
5
5
 
6
- import styles from './CheckboxIcon.css' assert {type: 'css'};
7
- import outlineStyles from './Outline.css' assert {type:'css'};
8
-
9
6
  export default CustomElement
10
7
  .mixin(ThemableMixin)
11
8
  .mixin(ShapeMixin)
@@ -22,7 +19,98 @@ export default CustomElement
22
19
  set(value) { this.selected = value; },
23
20
  },
24
21
  })
25
- .css(outlineStyles, styles)
22
+ .css`
23
+ /* https://m3.material.io/components/checkbox/specs */
24
+
25
+ :host {
26
+ --mdw-ink: var(--mdw-color__on-primary);
27
+ --mdw-bg: var(--mdw-color__primary);
28
+ --mdw-shape__size: 2px;
29
+ --disabled-opacity: 0.38;
30
+ position: relative;
31
+
32
+ display: inline-block;
33
+ align-items: center;
34
+ justify-content: center;
35
+
36
+ box-sizing: border-box;
37
+ block-size: 18px;
38
+ inline-size: 18px;
39
+
40
+ font-size: 18px;
41
+ line-height: 18px;
42
+ }
43
+
44
+ #shape {
45
+ --mdw-shape__size: inherit;
46
+ position: absolute;
47
+ inset: 0;
48
+
49
+ z-index: auto;
50
+
51
+ background-color: transparent;
52
+ }
53
+
54
+ #icon {
55
+ position: absolute;
56
+ inset: 0;
57
+
58
+ opacity: 0;
59
+
60
+ background-color: rgb(var(--mdw-bg));
61
+ color: rgb(var(--mdw-ink));
62
+
63
+ transition-duration: 200ms;
64
+ transition-property: opacity, background-color, color;
65
+ will-change: opacity;
66
+ }
67
+
68
+ #outline {
69
+ filter:
70
+ drop-shadow(1px 0px 0px currentColor)
71
+ drop-shadow(0px 1px 0px currentColor)
72
+ drop-shadow(-1px 0px 0px currentColor)
73
+ drop-shadow(0px -1px 0px currentColor);
74
+
75
+ color: rgb(var(--mdw-color__on-surface));
76
+
77
+ transition-duration: 200ms;
78
+ transition-property: opacity, background-color, color;
79
+ will-change: opacity;
80
+ }
81
+
82
+ /* Selected */
83
+
84
+ #icon[selected] {
85
+ opacity: 1;
86
+ }
87
+
88
+ #outline[selected] {
89
+ opacity: 0;
90
+ }
91
+
92
+ /* Errored */
93
+
94
+ #icon[errored] {
95
+ background-color: rgb(var(--mdw-color__error));
96
+ color: rgb(var(--mdw-color__on-error));
97
+ }
98
+
99
+ #outline[errored] {
100
+ color: rgb(var(--mdw-color__error));
101
+ }
102
+
103
+ /* Disabled */
104
+
105
+ #icon[disabled] {
106
+ background-color: rgba(var(--mdw-color__on-surface), var(--disabled-opacity));
107
+ color: rgb(var(--mdw-color__surface), var(--disabled-opacity));
108
+ }
109
+
110
+ #outline[disabled] {
111
+ color: rgb(var(--mdw-color__on-surface), var(--disabled-opacity));
112
+ }
113
+ `
26
114
  .on({
27
115
  composed({ html }) {
28
116
  const { outline, shape } = this.refs;