@expressivecss/expressive 0.1.0-alpha.3 → 0.2.0

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 (154) hide show
  1. package/LICENSE +82 -2
  2. package/README.md +153 -43
  3. package/dist/css/expressive.css +7121 -9658
  4. package/dist/css/expressive.css.map +1 -0
  5. package/dist/css/expressive.min.css +1 -1
  6. package/dist/css/expressive.min.css.map +1 -0
  7. package/dist/js/expressive.cjs +7521 -0
  8. package/dist/js/expressive.cjs.map +7 -0
  9. package/dist/js/expressive.js +7383 -8099
  10. package/dist/js/expressive.js.map +7 -1
  11. package/dist/js/expressive.min.js +75 -1
  12. package/dist/js/expressive.min.js.map +7 -1
  13. package/dist/js/expressive.mjs +7292 -7998
  14. package/dist/js/expressive.mjs.map +7 -1
  15. package/dist/types/behaviors/dialogs.d.ts +25 -0
  16. package/dist/{js → types}/components/autocomplete.d.ts +10 -1
  17. package/dist/{js → types}/components/buttons.d.ts +11 -1
  18. package/dist/{js → types}/components/cards.d.ts +10 -1
  19. package/dist/{js → types}/components/carousel.d.ts +4 -5
  20. package/dist/{js/forms/character-counter.d.ts → types/components/characterCounter.d.ts} +1 -1
  21. package/dist/{js → types}/components/chips.d.ts +1 -1
  22. package/dist/{js → types}/components/collapsible.d.ts +1 -1
  23. package/dist/{js → types}/components/datepicker.d.ts +63 -2
  24. package/dist/{js → types}/components/dropdown.d.ts +3 -3
  25. package/dist/types/components/index.d.ts +23 -0
  26. package/dist/{js/components/materialbox.d.ts → types/components/lightbox.d.ts} +21 -21
  27. package/dist/{js → types}/components/modal.d.ts +1 -1
  28. package/dist/{js → types}/components/parallax.d.ts +11 -5
  29. package/dist/{js → types}/components/pushpin.d.ts +1 -1
  30. package/dist/{js/forms → types/components}/range.d.ts +3 -3
  31. package/dist/types/components/registry.d.ts +107 -0
  32. package/dist/{js → types}/components/scrollspy.d.ts +6 -9
  33. package/dist/{js/forms → types/components}/select.d.ts +11 -2
  34. package/dist/{js → types}/components/sidenav.d.ts +1 -1
  35. package/dist/{js → types}/components/slider.d.ts +3 -2
  36. package/dist/{js → types}/components/tabs.d.ts +3 -2
  37. package/dist/{js/components/tap-target.d.ts → types/components/tapTarget.d.ts} +2 -2
  38. package/dist/{js → types}/components/timepicker.d.ts +13 -5
  39. package/dist/{js/components/toast.d.ts → types/components/toasts.d.ts} +28 -4
  40. package/dist/{js → types}/components/tooltip.d.ts +2 -2
  41. package/dist/types/core/bounding.d.ts +6 -0
  42. package/dist/{js/foundation → types/core}/component.d.ts +1 -1
  43. package/dist/types/core/edges.d.ts +6 -0
  44. package/dist/{js/foundation → types/core}/utils.d.ts +21 -14
  45. package/dist/types/index.d.ts +7 -0
  46. package/dist/{js/plugins/docked-display.d.ts → types/plugins/dockedDisplayPlugin.d.ts} +7 -0
  47. package/package.json +60 -36
  48. package/src/sass/README.md +200 -0
  49. package/src/sass/abstracts/_breakpoints.scss +69 -0
  50. package/src/sass/abstracts/_elevation.scss +34 -0
  51. package/src/sass/abstracts/_index.scss +7 -0
  52. package/src/sass/abstracts/_mixins.scss +171 -0
  53. package/src/sass/abstracts/_variables.scss +57 -0
  54. package/src/{scss/layout/_table.scss → sass/base/_global.scss} +64 -2
  55. package/src/{scss/layout → sass/base}/_grid.scss +6 -6
  56. package/src/sass/base/_index.scss +6 -0
  57. package/src/{scss/foundation → sass/base}/_normalize.scss +51 -139
  58. package/src/sass/base/_typography.scss +90 -0
  59. package/src/sass/components/_badges.scss +77 -0
  60. package/src/{scss → sass}/components/_breadcrumb.scss +2 -0
  61. package/src/sass/components/_buttons.scss +407 -0
  62. package/src/sass/components/_cards.scss +328 -0
  63. package/src/{scss → sass}/components/_carousel.scss +5 -3
  64. package/src/sass/components/_chips.scss +140 -0
  65. package/src/sass/components/_collapsible.scss +81 -0
  66. package/src/{scss → sass}/components/_collection.scss +2 -2
  67. package/src/{scss/components/_date-picker.scss → sass/components/_datepicker.scss} +51 -44
  68. package/src/sass/components/_docked-display.scss +11 -0
  69. package/src/sass/components/_dropdown.scss +129 -0
  70. package/src/{scss/components/_material-icons.scss → sass/components/_icons-material-design.scss} +2 -0
  71. package/src/sass/components/_index.scss +35 -0
  72. package/src/{scss/components/_material-box.scss → sass/components/_lightbox.scss} +6 -4
  73. package/src/sass/components/_modal.scss +208 -0
  74. package/src/sass/components/_navbar.scss +345 -0
  75. package/src/{scss/layout/_footer.scss → sass/components/_page-footer.scss} +7 -6
  76. package/src/{scss → sass}/components/_pagination.scss +4 -3
  77. package/src/{scss → sass}/components/_parallax.scss +4 -1
  78. package/src/{scss → sass}/components/_preloader.scss +19 -97
  79. package/src/{scss → sass}/components/_pulse.scss +2 -0
  80. package/src/sass/components/_pushpin.scss +11 -0
  81. package/src/{scss → sass}/components/_sidenav.scss +99 -82
  82. package/src/{scss → sass}/components/_slider.scss +3 -1
  83. package/src/{scss/components/_table-of-contents.scss → sass/components/_table_of_contents.scss} +2 -0
  84. package/src/sass/components/_tabs.scss +232 -0
  85. package/src/{scss/components/_tap-target.scss → sass/components/_tapTarget.scss} +24 -22
  86. package/src/{scss/components/_time-picker.scss → sass/components/_timepicker.scss} +56 -56
  87. package/src/sass/components/_toast.scss +260 -0
  88. package/src/sass/components/_toolbar.scss +192 -0
  89. package/src/sass/components/_tooltip.scss +166 -0
  90. package/src/{scss → sass}/components/_transitions.scss +4 -4
  91. package/src/sass/components/forms/_checkboxes.scss +288 -0
  92. package/src/sass/components/forms/_fieldset.scss +128 -0
  93. package/src/{scss → sass/components}/forms/_file-input.scss +11 -9
  94. package/src/{scss → sass/components}/forms/_index.scss +2 -0
  95. package/src/sass/components/forms/_input-fields.scss +326 -0
  96. package/src/sass/components/forms/_radio-buttons.scss +190 -0
  97. package/src/sass/components/forms/_range.scss +310 -0
  98. package/src/sass/components/forms/_select.scss +103 -0
  99. package/src/sass/components/forms/_switches.scss +239 -0
  100. package/src/sass/expressive.scss +60 -0
  101. package/src/sass/tokens/_index.scss +4 -0
  102. package/src/sass/tokens/_reference.scss +265 -0
  103. package/src/sass/tokens/_theme.scss +49 -0
  104. package/src/sass/utilities/_helpers.scss +63 -0
  105. package/src/sass/utilities/_index.scss +8 -0
  106. package/src/{scss → sass}/utilities/_spacing.scss +4 -3
  107. package/src/sass/utilities/_typescale.scss +45 -0
  108. package/src/sass/utilities/_visibility.scss +63 -0
  109. package/src/sass/utilities/_z-depth.scss +18 -0
  110. package/dist/js/components/index.d.ts +0 -21
  111. package/dist/js/forms/index.d.ts +0 -4
  112. package/dist/js/foundation/index.d.ts +0 -2
  113. package/dist/js/index.d.ts +0 -52
  114. package/dist/js/plugins/index.d.ts +0 -1
  115. package/src/scss/components/_appbar.scss +0 -454
  116. package/src/scss/components/_badges.scss +0 -77
  117. package/src/scss/components/_buttons.scss +0 -412
  118. package/src/scss/components/_cards.scss +0 -267
  119. package/src/scss/components/_chips.scss +0 -147
  120. package/src/scss/components/_collapsible.scss +0 -84
  121. package/src/scss/components/_dropdown.scss +0 -98
  122. package/src/scss/components/_index.scss +0 -28
  123. package/src/scss/components/_modal.scss +0 -84
  124. package/src/scss/components/_tabs.scss +0 -176
  125. package/src/scss/components/_toast.scss +0 -70
  126. package/src/scss/components/_tooltip.scss +0 -49
  127. package/src/scss/components/_video.scss +0 -15
  128. package/src/scss/expressive.scss +0 -7
  129. package/src/scss/forms/_checkboxes.scss +0 -199
  130. package/src/scss/forms/_input-fields.scss +0 -360
  131. package/src/scss/forms/_radio-buttons.scss +0 -114
  132. package/src/scss/forms/_range.scss +0 -148
  133. package/src/scss/forms/_select.scss +0 -108
  134. package/src/scss/forms/_switches.scss +0 -127
  135. package/src/scss/foundation/_base.scss +0 -71
  136. package/src/scss/foundation/_color-palette.scss +0 -402
  137. package/src/scss/foundation/_index.scss +0 -10
  138. package/src/scss/foundation/_mixins.scss +0 -198
  139. package/src/scss/foundation/_motion.scss +0 -70
  140. package/src/scss/foundation/_shape.scss +0 -30
  141. package/src/scss/foundation/_state-layers.scss +0 -68
  142. package/src/scss/foundation/_theme.scss +0 -238
  143. package/src/scss/foundation/_tokens.scss +0 -511
  144. package/src/scss/foundation/_variables.scss +0 -57
  145. package/src/scss/layout/_index.scss +0 -3
  146. package/src/scss/utilities/_a11y.scss +0 -77
  147. package/src/scss/utilities/_elevation.scss +0 -63
  148. package/src/scss/utilities/_helpers.scss +0 -50
  149. package/src/scss/utilities/_index.scss +0 -7
  150. package/src/scss/utilities/_responsive.scss +0 -62
  151. package/src/scss/utilities/_typography.scss +0 -115
  152. /package/dist/{js/forms → types/behaviors}/forms.d.ts +0 -0
  153. /package/dist/{js/components → types/behaviors}/waves.d.ts +0 -0
  154. /package/src/{scss → sass}/utilities/_colors.scss +0 -0
@@ -0,0 +1,288 @@
1
+ @use "../../abstracts" as *;
2
+
3
+ // Checkboxes.
4
+ //
5
+ // Anatomy is the HTML. A <label> wrapping <input type="checkbox"> is
6
+ // the control. The label text is a sibling of the input — no extra class,
7
+ // no required <span>. input + span still works (legacy / BeerCSS / Select).
8
+ // label.switch is a switch, not a checkbox — leave it alone.
9
+ //
10
+ // Tokens follow https://m3.material.io/components/checkbox/specs
11
+ // container 18dp, 2dp corners
12
+ // unselected 2dp on-surface-variant outline
13
+ // selected primary fill, on-primary check
14
+ // indeterminate primary fill, on-primary dash
15
+ // state layer 40dp, 8% hover / 10% focus
16
+ // touch target 48dp
17
+ // label body-large / on-surface
18
+ // disabled on-surface 38%
19
+ //
20
+ // .filled-in is a no-op: the selected state is always the filled box.
21
+
22
+ $_cb-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 9.5 7.5 13 14 5.5'/%3E%3C/svg%3E");
23
+ $_cb-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' d='M4.5 9h9'/%3E%3C/svg%3E");
24
+
25
+ label:has(> [type="checkbox"]):not(.switch),
26
+ .checkbox {
27
+ --md-comp-checkbox-container-size: 18px;
28
+ --md-comp-checkbox-container-shape: 2px;
29
+ --md-comp-checkbox-state-layer-size: 40px;
30
+
31
+ position: relative;
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 12px;
35
+ min-height: 48px;
36
+ margin: 0;
37
+ cursor: pointer;
38
+ user-select: none;
39
+ -webkit-tap-highlight-color: transparent;
40
+ color: var(--md-sys-color-on-surface);
41
+ @include typescale("body-large");
42
+ font-family: $font-stack;
43
+ }
44
+
45
+ nav:has(> label > [type="checkbox"]:not(.switch *)),
46
+ nav:has(> .checkbox) {
47
+ display: flex;
48
+ flex-wrap: wrap;
49
+ align-items: center;
50
+ gap: 8px 24px;
51
+ }
52
+
53
+ nav > label:has(> [type="checkbox"]):not(.switch),
54
+ nav > .checkbox {
55
+ display: inline-flex;
56
+ }
57
+
58
+ // Paint the box on the input. A following span (legacy) hides this
59
+ // control and draws the same anatomy. Nested :has() is invalid, so
60
+ // do not write :has(:not(:has(+ span))).
61
+ label:has(> [type="checkbox"]):not(.switch) > [type="checkbox"],
62
+ .checkbox > [type="checkbox"] {
63
+ appearance: none;
64
+ flex: 0 0 var(--md-comp-checkbox-container-size);
65
+ box-sizing: border-box;
66
+ width: var(--md-comp-checkbox-container-size);
67
+ height: var(--md-comp-checkbox-container-size);
68
+ margin: 0;
69
+ padding: 0;
70
+ border: 2px solid var(--md-sys-color-on-surface-variant);
71
+ border-radius: var(--md-comp-checkbox-container-shape);
72
+ background-color: transparent;
73
+ cursor: pointer;
74
+ transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
75
+
76
+ &:checked,
77
+ &:indeterminate {
78
+ border-color: var(--md-sys-color-primary);
79
+ background-color: var(--md-sys-color-primary);
80
+ }
81
+
82
+ &:hover {
83
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-on-surface) 8%, transparent);
84
+ }
85
+
86
+ &:checked:hover,
87
+ &:indeterminate:hover {
88
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-primary) 8%, transparent);
89
+ }
90
+
91
+ &:focus-visible,
92
+ &.tabbed:focus {
93
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-primary) 10%, transparent);
94
+ outline: none;
95
+ }
96
+
97
+ &.invalid,
98
+ &[aria-invalid="true"] {
99
+ border-color: var(--md-sys-color-error);
100
+ }
101
+
102
+ &.invalid:checked,
103
+ &.invalid:indeterminate,
104
+ &[aria-invalid="true"]:checked,
105
+ &[aria-invalid="true"]:indeterminate {
106
+ border-color: var(--md-sys-color-error);
107
+ background-color: var(--md-sys-color-error);
108
+ }
109
+
110
+ &.invalid:hover,
111
+ &[aria-invalid="true"]:hover {
112
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-error) 8%, transparent);
113
+ }
114
+
115
+ &:disabled {
116
+ border-color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
117
+ background-color: transparent;
118
+ box-shadow: none;
119
+ cursor: default;
120
+ }
121
+
122
+ &:disabled:checked,
123
+ &:disabled:indeterminate {
124
+ border-color: transparent;
125
+ background-color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
126
+ }
127
+
128
+ // Legacy: the span draws the box. Keep the input out of the way.
129
+ &:has(+ span) {
130
+ position: absolute;
131
+ opacity: 0;
132
+ width: 0;
133
+ height: 0;
134
+ border: 0;
135
+ background: none;
136
+ box-shadow: none;
137
+ pointer-events: none;
138
+ }
139
+ }
140
+
141
+ // Check / dash sit on the label so they can use on-primary as a mask
142
+ // (an <input> cannot host ::before, and a data-URI cannot see tokens).
143
+ // Skip when a span is drawing the icon.
144
+ label:has(> [type="checkbox"]):not(.switch):not(:has(> [type="checkbox"] + span)),
145
+ .checkbox:not(:has(> [type="checkbox"] + span)) {
146
+ &::before {
147
+ content: "";
148
+ position: absolute;
149
+ left: 0;
150
+ top: 50%;
151
+ width: var(--md-comp-checkbox-container-size);
152
+ height: var(--md-comp-checkbox-container-size);
153
+ margin-top: calc(var(--md-comp-checkbox-container-size) / -2);
154
+ pointer-events: none;
155
+ background-color: var(--md-sys-color-on-primary);
156
+ -webkit-mask: #{$_cb-check} center / contain no-repeat;
157
+ mask: #{$_cb-check} center / contain no-repeat;
158
+ opacity: 0;
159
+ }
160
+
161
+ &:has(> [type="checkbox"]:checked)::before,
162
+ &:has(> [type="checkbox"]:indeterminate)::before {
163
+ opacity: 1;
164
+ }
165
+
166
+ &:has(> [type="checkbox"]:indeterminate)::before {
167
+ -webkit-mask-image: #{$_cb-dash};
168
+ mask-image: #{$_cb-dash};
169
+ }
170
+
171
+ &:has(> [type="checkbox"].invalid:is(:checked, :indeterminate))::before,
172
+ &:has(> [type="checkbox"][aria-invalid="true"]:is(:checked, :indeterminate))::before {
173
+ background-color: var(--md-sys-color-on-error);
174
+ }
175
+
176
+ &:has(> [type="checkbox"]:disabled:is(:checked, :indeterminate))::before {
177
+ background-color: var(--md-sys-color-surface);
178
+ }
179
+ }
180
+
181
+ label:has(> [type="checkbox"]:disabled):not(.switch),
182
+ .checkbox:has([type="checkbox"]:disabled) {
183
+ color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
184
+ cursor: default;
185
+ }
186
+
187
+ // Legacy / BeerCSS / Select / Autocomplete: input + span draws the same
188
+ // 18dp anatomy. Exclude .switch — that file paints the track on a span.
189
+ $_cb-span: "*:not(.switch) > [type='checkbox'] + span:not(.lever, .supporting-text, .character-counter, .file-path)";
190
+
191
+ #{$_cb-span} {
192
+ position: relative;
193
+ display: inline-flex;
194
+ align-items: center;
195
+ min-height: 48px;
196
+ padding-left: 30px;
197
+ cursor: pointer;
198
+ user-select: none;
199
+ }
200
+
201
+ #{$_cb-span}::before,
202
+ #{$_cb-span}::after {
203
+ content: "";
204
+ position: absolute;
205
+ left: 0;
206
+ top: 50%;
207
+ box-sizing: border-box;
208
+ width: 18px;
209
+ height: 18px;
210
+ margin-top: -9px;
211
+ border-radius: 2px;
212
+ }
213
+
214
+ #{$_cb-span}::before {
215
+ border: 2px solid var(--md-sys-color-on-surface-variant);
216
+ background-color: transparent;
217
+ transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
218
+ }
219
+
220
+ #{$_cb-span}::after {
221
+ background-color: var(--md-sys-color-on-primary);
222
+ -webkit-mask: #{$_cb-check} center / contain no-repeat;
223
+ mask: #{$_cb-check} center / contain no-repeat;
224
+ opacity: 0;
225
+ }
226
+
227
+ *:not(.switch) > [type="checkbox"]:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
228
+ border-color: var(--md-sys-color-primary);
229
+ background-color: var(--md-sys-color-primary);
230
+ }
231
+
232
+ *:not(.switch) > [type="checkbox"]:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::after {
233
+ opacity: 1;
234
+ }
235
+
236
+ *:not(.switch) > [type="checkbox"]:indeterminate + span:not(.lever, .supporting-text, .character-counter, .file-path)::after {
237
+ -webkit-mask-image: #{$_cb-dash};
238
+ mask-image: #{$_cb-dash};
239
+ }
240
+
241
+ *:not(.switch) > [type="checkbox"]:hover + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
242
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-on-surface) 8%, transparent);
243
+ }
244
+
245
+ *:not(.switch) > [type="checkbox"]:is(:checked, :indeterminate):hover + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
246
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-primary) 8%, transparent);
247
+ }
248
+
249
+ *:not(.switch) > [type="checkbox"]:focus-visible + span:not(.lever, .supporting-text, .character-counter, .file-path)::before,
250
+ *:not(.switch) > [type="checkbox"].tabbed:focus + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
251
+ box-shadow: 0 0 0 11px color-mix(in oklab, var(--md-sys-color-primary) 10%, transparent);
252
+ }
253
+
254
+ *:not(.switch) > [type="checkbox"].invalid + span:not(.lever, .supporting-text, .character-counter, .file-path)::before,
255
+ *:not(.switch) > [type="checkbox"][aria-invalid="true"] + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
256
+ border-color: var(--md-sys-color-error);
257
+ }
258
+
259
+ *:not(.switch) > [type="checkbox"].invalid:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::before,
260
+ *:not(.switch) > [type="checkbox"][aria-invalid="true"]:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
261
+ border-color: var(--md-sys-color-error);
262
+ background-color: var(--md-sys-color-error);
263
+ }
264
+
265
+ *:not(.switch) > [type="checkbox"].invalid:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::after,
266
+ *:not(.switch) > [type="checkbox"][aria-invalid="true"]:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::after {
267
+ background-color: var(--md-sys-color-on-error);
268
+ }
269
+
270
+ *:not(.switch) > [type="checkbox"]:disabled + span:not(.lever, .supporting-text, .character-counter, .file-path) {
271
+ color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
272
+ cursor: default;
273
+ }
274
+
275
+ *:not(.switch) > [type="checkbox"]:disabled + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
276
+ border-color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
277
+ background-color: transparent;
278
+ box-shadow: none;
279
+ }
280
+
281
+ *:not(.switch) > [type="checkbox"]:disabled:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::before {
282
+ border-color: transparent;
283
+ background-color: color-mix(in oklab, var(--md-sys-color-on-surface) 38%, transparent);
284
+ }
285
+
286
+ *:not(.switch) > [type="checkbox"]:disabled:is(:checked, :indeterminate) + span:not(.lever, .supporting-text, .character-counter, .file-path)::after {
287
+ background-color: var(--md-sys-color-surface);
288
+ }
@@ -0,0 +1,128 @@
1
+ @use "../../abstracts" as *;
2
+
3
+ // Fieldsets.
4
+ //
5
+ // Anatomy is the HTML. A <fieldset> is the group. A <legend> is the
6
+ // headline. Direct children are the fields — .field, radios, switches,
7
+ // a <nav> of radios, a trailing <small> as supporting text. No wrapper
8
+ // class. .filled / .border / .rounded are helpers markup cannot express.
9
+ //
10
+ // M3 has no fieldset component. Tokens follow the outlined grouping
11
+ // container used around related form content, and the outlined text-field
12
+ // shape so a group of fields matches the fields:
13
+ // container transparent, 4dp corners, 1dp outline-variant
14
+ // filled surface-variant, no outline
15
+ // legend title-small / on-surface
16
+ // supporting body-small / on-surface-variant
17
+ // padding 16dp, 16dp between children
18
+ // disabled on-surface / outline at 38%
19
+ //
20
+ // Do not set display:flex — that pulls <legend> off the border.
21
+
22
+ fieldset {
23
+ --md-comp-fieldset-container-color: transparent;
24
+ --md-comp-fieldset-container-shape: 4px;
25
+ --md-comp-fieldset-outline-color: var(--md-sys-color-outline-variant);
26
+ --md-comp-fieldset-outline-width: 1px;
27
+ --md-comp-fieldset-legend-color: var(--md-sys-color-on-surface);
28
+
29
+ box-sizing: border-box;
30
+ min-inline-size: 0;
31
+ margin: 0;
32
+ padding: 16px;
33
+
34
+ & + & {
35
+ margin-block-start: 24px;
36
+ }
37
+ border: var(--md-comp-fieldset-outline-width) solid var(--md-comp-fieldset-outline-color);
38
+ border-radius: var(--md-comp-fieldset-container-shape);
39
+ background-color: var(--md-comp-fieldset-container-color);
40
+
41
+ > legend {
42
+ float: none;
43
+ width: auto;
44
+ max-width: calc(100% - 16px);
45
+ margin: 0;
46
+ margin-inline-start: -4px;
47
+ padding-inline: 8px;
48
+ color: var(--md-comp-fieldset-legend-color);
49
+ background-color: transparent;
50
+ @include typescale("title-small");
51
+
52
+ > i {
53
+ font-size: 18px;
54
+ width: 18px;
55
+ height: 18px;
56
+ line-height: 18px;
57
+ margin-inline-end: 8px;
58
+ vertical-align: -3px;
59
+ color: var(--md-sys-color-on-surface-variant);
60
+ }
61
+ }
62
+
63
+ > :not(legend) + * {
64
+ margin-block-start: 16px;
65
+ }
66
+
67
+ // Switches are inline-flex. Make a bare group stack; a <nav> keeps
68
+ // radios on one line. Consecutive 48dp rows don't need the 16dp gap.
69
+ > label,
70
+ > .switch {
71
+ display: flex;
72
+ align-items: center;
73
+ }
74
+
75
+ > :is(label, .switch) + :is(label, .switch) {
76
+ margin-block-start: 0;
77
+ }
78
+
79
+ > small {
80
+ display: block;
81
+ margin-block-start: 8px;
82
+ color: var(--md-sys-color-on-surface-variant);
83
+ @include typescale("body-small");
84
+ }
85
+ }
86
+
87
+ fieldset.filled {
88
+ --md-comp-fieldset-container-color: var(--md-sys-color-surface-variant);
89
+ --md-comp-fieldset-outline-color: transparent;
90
+ }
91
+
92
+ fieldset.outlined,
93
+ fieldset.border {
94
+ --md-comp-fieldset-container-color: transparent;
95
+ --md-comp-fieldset-outline-color: var(--md-sys-color-outline-variant);
96
+ }
97
+
98
+ fieldset.rounded {
99
+ --md-comp-fieldset-container-shape: 12px;
100
+ }
101
+
102
+ fieldset:disabled,
103
+ fieldset[disabled] {
104
+ --md-comp-fieldset-outline-color: color-mix(
105
+ in oklab,
106
+ var(--md-sys-color-on-surface) 12%,
107
+ transparent
108
+ );
109
+ --md-comp-fieldset-legend-color: color-mix(
110
+ in oklab,
111
+ var(--md-sys-color-on-surface) 38%,
112
+ transparent
113
+ );
114
+
115
+ > legend > i {
116
+ color: var(--md-comp-fieldset-legend-color);
117
+ }
118
+ }
119
+
120
+ fieldset.filled:disabled,
121
+ fieldset.filled[disabled] {
122
+ --md-comp-fieldset-outline-color: transparent;
123
+ --md-comp-fieldset-container-color: color-mix(
124
+ in oklab,
125
+ var(--md-sys-color-on-surface) 4%,
126
+ transparent
127
+ );
128
+ }
@@ -1,3 +1,5 @@
1
+ @use "../../abstracts" as *;
2
+
1
3
  .file-field {
2
4
  display: grid;
3
5
  grid-template-columns: min-content auto;
@@ -10,7 +12,10 @@
10
12
 
11
13
  input.file-path { width: 100%; }
12
14
 
13
- .btn {
15
+ > button,
16
+ > .btn {
17
+ position: relative;
18
+ overflow: hidden;
14
19
  height: 3rem;
15
20
  line-height: 3rem;
16
21
  }
@@ -21,20 +26,17 @@
21
26
 
22
27
  input[type=file] {
23
28
  position: absolute;
24
- top: 0;
25
- right: 0;
26
- left: 0;
27
- bottom: 0;
29
+ inset: 0;
28
30
  cursor: pointer;
29
31
  width: 100%;
30
32
  margin: 0;
31
33
  padding: 0;
32
34
  opacity: 0;
33
- font-size: 20px;
34
- filter: alpha(opacity=0);
35
+ font-size: 20px;
35
36
 
36
- // Needed to override webkit button
37
- &::-webkit-file-upload-button {
37
+ // Needed to override the UA-rendered button. `::file-selector-button` is
38
+ // the standardised name for the old ::-webkit-file-upload-button.
39
+ &::file-selector-button {
38
40
  display: none;
39
41
  }
40
42
  }
@@ -5,6 +5,7 @@
5
5
  @forward 'select';
6
6
  @forward 'file-input';
7
7
  @forward 'range';
8
+ @forward 'fieldset';
8
9
 
9
10
  // Remove Focus Boxes
10
11
  select:focus {
@@ -15,3 +16,4 @@ label {
15
16
  font-size: .8rem;
16
17
  color: var(--md-sys-color-on-surface-variant);
17
18
  }
19
+