m3-svelte 6.0.4 → 7.0.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 (56) hide show
  1. package/package/buttons/Button.svelte +39 -33
  2. package/package/buttons/Button.svelte.d.ts +7 -5
  3. package/package/buttons/ConnectedButtons.svelte +0 -6
  4. package/package/buttons/FAB.svelte +1 -4
  5. package/package/buttons/SplitButton.svelte +3 -6
  6. package/package/containers/Card.svelte +4 -6
  7. package/package/containers/ListItem.svelte +25 -20
  8. package/package/containers/ListItem.svelte.d.ts +7 -6
  9. package/package/containers/MenuItem.svelte +3 -4
  10. package/package/containers/Snackbar.svelte +2 -5
  11. package/package/{misc → etc}/colors.d.ts +2 -2
  12. package/package/{misc → etc}/colors.js +28 -17
  13. package/package/etc/layer.css +38 -0
  14. package/package/etc/layer.d.ts +1 -0
  15. package/package/etc/layer.js +142 -0
  16. package/package/etc/recommended-styles.css +8 -0
  17. package/package/{misc → etc}/styles.css +73 -47
  18. package/package/{misc → etc}/tailwind-styles.css +0 -2
  19. package/package/forms/Checkbox.svelte +1 -3
  20. package/package/forms/Chip.svelte +22 -14
  21. package/package/forms/Chip.svelte.d.ts +5 -2
  22. package/package/forms/DateField.svelte +9 -5
  23. package/package/forms/DateFieldOutlined.svelte +9 -5
  24. package/package/forms/RadioAnim1.svelte +1 -3
  25. package/package/forms/RadioAnim2.svelte +1 -3
  26. package/package/forms/RadioAnim3.svelte +1 -3
  27. package/package/forms/Select.svelte +4 -7
  28. package/package/forms/SelectOutlined.svelte +2 -5
  29. package/package/forms/TextField.svelte +2 -5
  30. package/package/forms/TextFieldMultiline.svelte +2 -3
  31. package/package/forms/TextFieldOutlined.svelte +2 -5
  32. package/package/forms/TextFieldOutlinedMultiline.svelte +2 -3
  33. package/package/forms/_picker/FocusPicker.svelte +1 -4
  34. package/package/forms/_picker/Header.svelte +22 -30
  35. package/package/forms/_picker/Item.svelte +1 -5
  36. package/package/index.d.ts +3 -7
  37. package/package/index.js +3 -7
  38. package/package/misc/animation.js +5 -1
  39. package/package/misc/badge.js +1 -1
  40. package/package/misc/typing-utils.d.ts +14 -5
  41. package/package/nav/NavCMLXItem.svelte +7 -10
  42. package/package/nav/NavCMLXItem.svelte.d.ts +2 -2
  43. package/package/nav/Tabs.svelte +1 -4
  44. package/package/nav/TabsLink.svelte +7 -4
  45. package/package/nav/VariableTabs.svelte +1 -4
  46. package/package/nav/VariableTabsLink.svelte +1 -3
  47. package/package.json +35 -19
  48. package/package/buttons/TogglePrimitive.svelte +0 -22
  49. package/package/buttons/TogglePrimitive.svelte.d.ts +0 -11
  50. package/package/misc/Layer.svelte +0 -213
  51. package/package/misc/Layer.svelte.d.ts +0 -3
  52. package/package/misc/recommended-styles.css +0 -41
  53. package/package/misc/utils.d.ts +0 -3
  54. package/package/misc/utils.js +0 -37
  55. /package/package/{misc → etc}/unocss-preset.d.ts +0 -0
  56. /package/package/{misc → etc}/unocss-preset.js +0 -0
@@ -0,0 +1,142 @@
1
+ import "./layer.css";
2
+ const activePointerRipples = [];
3
+ const activeKeyboardRipples = [];
4
+ const isEnabled = (node) => {
5
+ if (node instanceof HTMLButtonElement && node.disabled)
6
+ return false;
7
+ if (node instanceof HTMLInputElement && node.disabled)
8
+ return false;
9
+ if (node instanceof HTMLLabelElement) {
10
+ const control = node.control;
11
+ if (control instanceof HTMLInputElement && control.disabled)
12
+ return false;
13
+ }
14
+ return true;
15
+ };
16
+ const createRippleSvg = (node, x, y, width, height) => {
17
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches)
18
+ return null;
19
+ const size = Math.hypot(Math.max(x, width - x), Math.max(y, height - y)) * 2.5;
20
+ const speed = Math.max(Math.min(Math.log(size) * 50, 600), 200);
21
+ const gradient = document.createElementNS("http://www.w3.org/2000/svg", "radialGradient");
22
+ gradient.id = `ripple-${Date.now()}-${Math.random().toString(36).slice(2)}`;
23
+ const stops = [
24
+ { offset: "0%", opacity: "0.12" },
25
+ { offset: "70%", opacity: "0.12" },
26
+ { offset: "100%", opacity: "0" },
27
+ ];
28
+ for (const { offset, opacity } of stops) {
29
+ const stop = document.createElementNS("http://www.w3.org/2000/svg", "stop");
30
+ stop.setAttribute("offset", offset);
31
+ stop.setAttribute("stop-color", "currentColor");
32
+ stop.setAttribute("stop-opacity", opacity);
33
+ gradient.appendChild(stop);
34
+ }
35
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
36
+ circle.setAttribute("cx", `${x}`);
37
+ circle.setAttribute("cy", `${y}`);
38
+ circle.setAttribute("r", "0");
39
+ circle.setAttribute("fill", `url(#${gradient.id})`);
40
+ const expand = document.createElementNS("http://www.w3.org/2000/svg", "animate");
41
+ expand.setAttribute("attributeName", "r");
42
+ expand.setAttribute("from", "0");
43
+ expand.setAttribute("to", `${size / 2}`);
44
+ expand.setAttribute("dur", `${speed}ms`);
45
+ expand.setAttribute("fill", "freeze");
46
+ expand.setAttribute("calcMode", "spline");
47
+ expand.setAttribute("keySplines", "0.4 0, 0.2 1");
48
+ circle.appendChild(expand);
49
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
50
+ svg.classList.add("active-ripple");
51
+ svg.style.cssText = [
52
+ "position: absolute",
53
+ "inset: 0",
54
+ "width: 100%",
55
+ "height: 100%",
56
+ "overflow: hidden",
57
+ "border-radius: inherit",
58
+ "pointer-events: none",
59
+ ].join(";");
60
+ svg.appendChild(gradient);
61
+ svg.appendChild(circle);
62
+ const ua = navigator.userAgent;
63
+ const isFirefox = ua.includes("Firefox");
64
+ const isTrulySafari = !ua.includes("Chrome") && ua.includes("Safari");
65
+ if (!isFirefox && !isTrulySafari && size > 100) {
66
+ const filter = document.createElementNS("http://www.w3.org/2000/svg", "filter");
67
+ filter.id = `noise-${Date.now()}-${Math.random().toString(36).slice(2)}`;
68
+ const turb = document.createElementNS("http://www.w3.org/2000/svg", "feTurbulence");
69
+ turb.setAttribute("type", "fractalNoise");
70
+ turb.setAttribute("baseFrequency", "0.6");
71
+ turb.setAttribute("seed", Math.random().toString());
72
+ const blur = document.createElementNS("http://www.w3.org/2000/svg", "feDisplacementMap");
73
+ blur.setAttribute("in", "SourceGraphic");
74
+ // implicitly uses result of previous filter primitive as in2
75
+ blur.setAttribute("scale", `${size ** 2 * 0.0002}`);
76
+ blur.setAttribute("xChannelSelector", "R");
77
+ blur.setAttribute("yChannelSelector", "B");
78
+ filter.appendChild(turb);
79
+ filter.appendChild(blur);
80
+ circle.setAttribute("filter", `url(#${filter.id})`);
81
+ svg.appendChild(filter);
82
+ }
83
+ node.appendChild(svg);
84
+ return () => {
85
+ const fade = document.createElementNS("http://www.w3.org/2000/svg", "animate");
86
+ fade.setAttribute("attributeName", "opacity");
87
+ fade.setAttribute("from", "1");
88
+ fade.setAttribute("to", "0");
89
+ fade.setAttribute("dur", "800ms");
90
+ fade.setAttribute("fill", "freeze");
91
+ fade.setAttribute("calcMode", "spline");
92
+ fade.setAttribute("keySplines", "0.4 0, 0.2 1");
93
+ circle.appendChild(fade);
94
+ fade.beginElement();
95
+ setTimeout(() => svg.remove(), 800);
96
+ };
97
+ };
98
+ if (typeof document != "undefined") {
99
+ document.documentElement.classList.add("js");
100
+ // Pointer events
101
+ document.addEventListener("pointerdown", (e) => {
102
+ if (e.button != 0)
103
+ return;
104
+ const layer = e.target.closest(".m3-layer");
105
+ if (!layer || !isEnabled(layer))
106
+ return;
107
+ const rect = layer.getBoundingClientRect();
108
+ const cancel = createRippleSvg(layer, e.clientX - rect.left, e.clientY - rect.top, rect.width, rect.height);
109
+ if (cancel) {
110
+ activePointerRipples.push(cancel);
111
+ }
112
+ });
113
+ const cancelPointerRipples = () => {
114
+ for (const cancel of activePointerRipples)
115
+ cancel();
116
+ activePointerRipples.length = 0;
117
+ };
118
+ document.addEventListener("pointerup", cancelPointerRipples);
119
+ document.addEventListener("dragend", cancelPointerRipples);
120
+ // Keyboard events
121
+ document.addEventListener("keydown", (e) => {
122
+ if (e.repeat)
123
+ return;
124
+ const target = e.target;
125
+ const layer = target.closest(".m3-layer");
126
+ if (!layer || !isEnabled(layer))
127
+ return;
128
+ const isActivate = e.key == "Enter" || (e.key == " " && layer.tagName == "BUTTON");
129
+ if (!isActivate)
130
+ return;
131
+ const rect = layer.getBoundingClientRect();
132
+ const cancel = createRippleSvg(layer, rect.width / 2, rect.height / 2, rect.width, rect.height);
133
+ if (cancel) {
134
+ activeKeyboardRipples.push(cancel);
135
+ }
136
+ });
137
+ document.addEventListener("keyup", () => {
138
+ for (const cancel of activeKeyboardRipples)
139
+ cancel();
140
+ activeKeyboardRipples.length = 0;
141
+ });
142
+ }
@@ -0,0 +1,8 @@
1
+ [placeholder]::placeholder {
2
+ color: --translucent(var(--m3c-on-surface), 0.5);
3
+ opacity: 1;
4
+ }
5
+ ::selection {
6
+ background-color: var(--m3c-tertiary-container);
7
+ color: var(--m3c-on-tertiary-container);
8
+ }
@@ -1,10 +1,30 @@
1
- @function --translucent(--color, --opacity) {
2
- result: oklab(from var(--color) l a b / var(--opacity));
3
- }
4
- /* DEPRECATED: This default --m3-density function will be removed in a future version.
5
- For new themes, pick which option you actually want. */
6
- @function --m3-density(--size) {
7
- result: calc(var(--size) + (var(--m3v-density, 0) * 0.25rem));
1
+ @layer base {
2
+ /* Reset a few things */
3
+ *,
4
+ *::before,
5
+ *::after {
6
+ box-sizing: inherit;
7
+ }
8
+ .m3-container {
9
+ box-sizing: border-box;
10
+ -webkit-tap-highlight-color: transparent;
11
+ }
12
+ .m3-container a,
13
+ a.m3-container {
14
+ text-decoration: none;
15
+ }
16
+ .m3-container dialog,
17
+ dialog.m3-container {
18
+ margin: auto;
19
+ }
20
+
21
+ :root {
22
+ accent-color: var(--m3c-primary);
23
+ }
24
+ :focus-visible {
25
+ outline: none;
26
+ @apply --m3-focused-outward;
27
+ }
8
28
  }
9
29
 
10
30
  @layer tokens {
@@ -39,7 +59,7 @@
39
59
  --m3-optical-centering-coefficient: 0.11;
40
60
 
41
61
  /* Typography */
42
- --m3-font: Roboto, system-ui;
62
+ --m3-font: "Google Sans Flex", Roboto, system-ui;
43
63
  --m3-font-mono: "Google Sans Code", "Roboto Mono", monospace;
44
64
 
45
65
  /* Expressive easing */
@@ -120,12 +140,7 @@
120
140
  );
121
141
  }
122
142
  }
123
- /* Not tokens because they may be dynamically get/set and aren't generally constant */
124
- @property --m3v-bottom-offset {
125
- syntax: "<length>";
126
- inherits: true;
127
- initial-value: 0;
128
- }
143
+ /* Background is dynamic, so not a token */
129
144
  :root {
130
145
  --m3v-background: var(--m3c-surface);
131
146
  }
@@ -135,21 +150,21 @@
135
150
  font-family: var(--m3-font);
136
151
  font-size: 3.563rem;
137
152
  line-height: 1.123;
138
- letter-spacing: 0;
153
+ /*letter-spacing: 0;*/
139
154
  font-weight: 400;
140
155
  }
141
156
  @mixin --m3-display-medium {
142
157
  font-family: var(--m3-font);
143
158
  font-size: 2.813rem;
144
159
  line-height: 1.156;
145
- letter-spacing: 0;
160
+ /*letter-spacing: 0;*/
146
161
  font-weight: 400;
147
162
  }
148
163
  @mixin --m3-display-small {
149
164
  font-family: var(--m3-font);
150
165
  font-size: 2.25rem;
151
166
  line-height: 1.222;
152
- letter-spacing: 0;
167
+ /*letter-spacing: 0;*/
153
168
  font-weight: 400;
154
169
  }
155
170
 
@@ -158,21 +173,21 @@
158
173
  font-family: var(--m3-font);
159
174
  font-size: 2rem;
160
175
  line-height: 1.25;
161
- letter-spacing: 0;
176
+ /*letter-spacing: 0;*/
162
177
  font-weight: 400;
163
178
  }
164
179
  @mixin --m3-headline-medium {
165
180
  font-family: var(--m3-font);
166
181
  font-size: 1.75rem;
167
182
  line-height: 1.286;
168
- letter-spacing: 0;
183
+ /*letter-spacing: 0;*/
169
184
  font-weight: 400;
170
185
  }
171
186
  @mixin --m3-headline-small {
172
187
  font-family: var(--m3-font);
173
188
  font-size: 1.5rem;
174
189
  line-height: 1.333;
175
- letter-spacing: 0;
190
+ /*letter-spacing: 0;*/
176
191
  font-weight: 400;
177
192
  }
178
193
 
@@ -181,21 +196,21 @@
181
196
  font-family: var(--m3-font);
182
197
  font-size: 1.375rem;
183
198
  line-height: 1.273;
184
- letter-spacing: 0;
199
+ /*letter-spacing: 0;*/
185
200
  font-weight: 400;
186
201
  }
187
202
  @mixin --m3-title-medium {
188
203
  font-family: var(--m3-font);
189
204
  font-size: 1rem;
190
205
  line-height: 1.5;
191
- letter-spacing: 0;
206
+ /*letter-spacing: 0;*/
192
207
  font-weight: 500;
193
208
  }
194
209
  @mixin --m3-title-small {
195
210
  font-family: var(--m3-font);
196
211
  font-size: 0.875rem;
197
212
  line-height: 1.429;
198
- letter-spacing: 0.006rem;
213
+ /*letter-spacing: 0.006rem;*/
199
214
  font-weight: 500;
200
215
  }
201
216
 
@@ -205,21 +220,21 @@ or for very small text in the content body, such as captions. */
205
220
  font-family: var(--m3-font);
206
221
  font-size: 0.875rem;
207
222
  line-height: 1.429;
208
- letter-spacing: 0.006rem;
223
+ /*letter-spacing: 0.006rem;*/
209
224
  font-weight: 500;
210
225
  }
211
226
  @mixin --m3-label-medium {
212
227
  font-family: var(--m3-font);
213
228
  font-size: 0.75rem;
214
229
  line-height: 1.333;
215
- letter-spacing: 0.031rem;
230
+ /*letter-spacing: 0.031rem;*/
216
231
  font-weight: 500;
217
232
  }
218
233
  @mixin --m3-label-small {
219
234
  font-family: var(--m3-font);
220
235
  font-size: 0.688rem;
221
236
  line-height: 1.455;
222
- letter-spacing: 0.031rem;
237
+ /*letter-spacing: 0.031rem;*/
223
238
  font-weight: 500;
224
239
  }
225
240
 
@@ -228,47 +243,58 @@ or for very small text in the content body, such as captions. */
228
243
  font-family: var(--m3-font);
229
244
  font-size: 1rem;
230
245
  line-height: 1.5;
231
- letter-spacing: 0;
246
+ /*letter-spacing: 0;*/
232
247
  font-weight: 400;
233
248
  }
234
249
  @mixin --m3-body-medium {
235
250
  font-family: var(--m3-font);
236
251
  font-size: 0.875rem;
237
252
  line-height: 1.429;
238
- letter-spacing: 0.016rem;
253
+ /*letter-spacing: 0.016rem;*/
239
254
  font-weight: 400;
240
255
  }
241
256
  @mixin --m3-body-small {
242
257
  font-family: var(--m3-font);
243
258
  font-size: 0.75rem;
244
259
  line-height: 1.333;
245
- letter-spacing: 0.025rem;
260
+ /*letter-spacing: 0.025rem;*/
246
261
  font-weight: 400;
247
262
  }
248
- @layer base {
249
- /* Reset a few things */
250
- *,
251
- *::before,
252
- *::after {
253
- box-sizing: inherit;
263
+
264
+ @keyframes focus-outward {
265
+ 0% {
266
+ box-shadow: 0 0 0 0px var(--m3c-secondary);
254
267
  }
255
- .m3-container {
256
- box-sizing: border-box;
257
- -webkit-tap-highlight-color: transparent;
268
+ 100% {
269
+ box-shadow: 0 0 0 3px var(--m3c-secondary);
258
270
  }
259
- .m3-container a,
260
- a.m3-container {
261
- text-decoration: none;
271
+ }
272
+ @keyframes focus-inward {
273
+ 0% {
274
+ box-shadow: inset 0 0 0 0px var(--m3c-secondary);
262
275
  }
263
- .m3-container dialog,
264
- dialog.m3-container {
265
- margin: auto;
276
+ 100% {
277
+ box-shadow: inset 0 0 0 3px var(--m3c-secondary);
266
278
  }
267
-
268
- :root {
269
- accent-color: var(--m3c-primary);
279
+ }
280
+ @mixin --m3-focused-outward {
281
+ animation: focus-outward 0.6s cubic-bezier(0.14, 5.63, 0.4, 0.5) forwards;
282
+ }
283
+ @mixin --m3-focused-inward {
284
+ animation: focus-inward 0.6s cubic-bezier(0.14, 5.63, 0.4, 0.5) forwards;
285
+ }
286
+ @mixin --m3-focus-inward {
287
+ &:focus-visible {
288
+ @apply --m3-focused-inward;
270
289
  }
271
290
  }
291
+ @mixin --m3-focus-none {
292
+ animation: none;
293
+ }
294
+
295
+ @function --translucent(--color, --opacity) {
296
+ result: oklab(from var(--color) l a b / var(--opacity));
297
+ }
272
298
 
273
299
  /* Emphasized easing timing function derived from this code:
274
300
  const createBezierLUT = (points: number[][], pointCount: number = 100): number[][] => {
@@ -40,8 +40,6 @@
40
40
  --default-transition-timing-function: var(--ease);
41
41
  --default-transition-duration: var(--m3-duration);
42
42
 
43
- --color-background: var(--m3c-background);
44
- --color-on-background: var(--m3c-on-background);
45
43
  --color-surface: var(--m3c-surface);
46
44
  --color-surface-dim: var(--m3c-surface-dim);
47
45
  --color-surface-bright: var(--m3c-surface-bright);
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from "svelte";
3
- import Layer from "../misc/Layer.svelte";
4
3
  import type { DivAttrs } from "../misc/typing-utils";
5
4
 
6
5
  // MUST BE WRAPPED IN A <label>
@@ -14,8 +13,7 @@
14
13
 
15
14
  <div class="m3-container" {...extra}>
16
15
  {@render children()}
17
- <div class="layer-container">
18
- <Layer />
16
+ <div class="layer-container m3-layer">
19
17
  <div class="checkbox-box"></div>
20
18
  </div>
21
19
  <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@@ -2,10 +2,10 @@
2
2
  import type { Snippet } from "svelte";
3
3
  import type { IconifyIcon } from "@iconify/types";
4
4
  import Icon from "../misc/Icon.svelte";
5
- import Layer from "../misc/Layer.svelte";
6
- import type { LabelAttrs, AnchorAttrs, ButtonAttrs } from "../misc/typing-utils";
5
+ import type { AnchorAttrs, ButtonAttrs, NotLink } from "../misc/typing-utils";
6
+ import type { HTMLLabelAttributes } from "svelte/elements";
7
7
 
8
- type ActionProps = LabelAttrs | AnchorAttrs | ButtonAttrs;
8
+ type ActionProps = AnchorAttrs | (NotLink<HTMLLabelAttributes> & { label: true }) | ButtonAttrs;
9
9
 
10
10
  let {
11
11
  variant,
@@ -35,7 +35,6 @@
35
35
  </script>
36
36
 
37
37
  {#snippet content()}
38
- <Layer />
39
38
  {#if icon}
40
39
  <Icon {icon} class="leading" />
41
40
  {/if}
@@ -45,16 +44,22 @@
45
44
  {/if}
46
45
  {/snippet}
47
46
 
48
- {#if "for" in extra}
49
- <label class="m3-container {variant}" class:elevated class:selected {...extra}>
50
- {@render content()}
51
- </label>
52
- {:else if "href" in extra}
53
- <a class="m3-container {variant}" class:elevated class:selected {...extra}>
47
+ {#if extra.href != undefined}
48
+ <a class="m3-container {variant} m3-layer" class:elevated class:selected {...extra}>
54
49
  {@render content()}
55
50
  </a>
51
+ {:else if "label" in extra}
52
+ <label class="m3-container {variant} m3-layer" class:elevated class:selected {...extra}>
53
+ {@render content()}
54
+ </label>
56
55
  {:else}
57
- <button class="m3-container {variant}" class:elevated class:selected {...extra} type="button">
56
+ <button
57
+ class="m3-container {variant} m3-layer"
58
+ class:elevated
59
+ class:selected
60
+ {...extra}
61
+ type="button"
62
+ >
58
63
  {@render content()}
59
64
  </button>
60
65
  {/if}
@@ -76,13 +81,16 @@
76
81
  background-color: var(--m3c-surface);
77
82
  color: var(--m3c-on-surface-variant);
78
83
  border: solid 1px var(--m3c-outline);
79
- position: relative;
80
84
  cursor: pointer;
81
85
  transition: var(--m3-easing-fast);
82
86
  }
83
87
 
84
- .m3-container > :global(:is(.ripple-container, .tint)) {
85
- inset: -1px;
88
+ .m3-container::before,
89
+ .m3-container::after,
90
+ .m3-container > :global(.active-ripple) {
91
+ inset: -1px !important;
92
+ width: calc(100% + 2px) !important;
93
+ height: calc(100% + 2px) !important;
86
94
  }
87
95
  .m3-container > :global(svg) {
88
96
  width: 1.125rem;
@@ -1,7 +1,10 @@
1
1
  import type { Snippet } from "svelte";
2
2
  import type { IconifyIcon } from "@iconify/types";
3
- import type { LabelAttrs, AnchorAttrs, ButtonAttrs } from "../misc/typing-utils";
4
- type ActionProps = LabelAttrs | AnchorAttrs | ButtonAttrs;
3
+ import type { AnchorAttrs, ButtonAttrs, NotLink } from "../misc/typing-utils";
4
+ import type { HTMLLabelAttributes } from "svelte/elements";
5
+ type ActionProps = AnchorAttrs | (NotLink<HTMLLabelAttributes> & {
6
+ label: true;
7
+ }) | ButtonAttrs;
5
8
  type $$ComponentProps = {
6
9
  /**
7
10
  * general is filter/suggestion since they're the same.
@@ -4,7 +4,6 @@
4
4
  import type { TransitionConfig } from "svelte/transition";
5
5
  import iconCalendar from "@ktibow/iconset-material-symbols/calendar-today-outline";
6
6
  import Icon from "../misc/Icon.svelte";
7
- import Layer from "../misc/Layer.svelte";
8
7
 
9
8
  import DatePickerDocked from "./DatePickerDocked.svelte";
10
9
  import { easeEmphasized } from "../misc/easing";
@@ -66,10 +65,15 @@ opacity: ${Math.min(t * 3, 1)};`,
66
65
  use:clickOutside
67
66
  style:--anchor-name="--{id}"
68
67
  >
69
- <input type="date" class="focus-none" {disabled} {required} {id} bind:value {...extra} />
68
+ <input type="date" {disabled} {required} {id} bind:value {...extra} />
70
69
  <label for={id}>{label}</label>
71
- <button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
72
- <Layer />
70
+ <button
71
+ type="button"
72
+ class="m3-layer"
73
+ {disabled}
74
+ title={datePickerTitle}
75
+ onclick={() => (picker = !picker)}
76
+ >
73
77
  <Icon icon={iconCalendar} size={24} />
74
78
  </button>
75
79
  {#if picker}
@@ -117,12 +121,12 @@ opacity: ${Math.min(t * 3, 1)};`,
117
121
  }
118
122
  input {
119
123
  @apply --m3-body-large;
124
+ @apply --m3-focus-none;
120
125
  position: absolute;
121
126
  inset: 0;
122
127
  width: 100%;
123
128
  height: 100%;
124
129
  border: none;
125
- outline: none;
126
130
 
127
131
  padding: 1rem 1rem 0rem 1rem;
128
132
  padding-inline-start: 0.875rem;
@@ -4,7 +4,6 @@
4
4
  import type { TransitionConfig } from "svelte/transition";
5
5
  import iconCalendar from "@ktibow/iconset-material-symbols/calendar-today-outline";
6
6
  import Icon from "../misc/Icon.svelte";
7
- import Layer from "../misc/Layer.svelte";
8
7
 
9
8
  import DatePickerDocked from "./DatePickerDocked.svelte";
10
9
  import { easeEmphasized } from "../misc/easing";
@@ -66,11 +65,16 @@ opacity: ${Math.min(t * 3, 1)};`,
66
65
  use:clickOutside
67
66
  style:--anchor-name="--{id}"
68
67
  >
69
- <input type="date" class="focus-none" {disabled} {required} {id} bind:value {...extra} />
68
+ <input type="date" {disabled} {required} {id} bind:value {...extra} />
70
69
  <div class="layer"></div>
71
70
  <label for={id}>{label}</label>
72
- <button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
73
- <Layer />
71
+ <button
72
+ type="button"
73
+ class="m3-layer"
74
+ {disabled}
75
+ title={datePickerTitle}
76
+ onclick={() => (picker = !picker)}
77
+ >
74
78
  <Icon icon={iconCalendar} size={24} />
75
79
  </button>
76
80
  {#if picker}
@@ -120,12 +124,12 @@ opacity: ${Math.min(t * 3, 1)};`,
120
124
  }
121
125
  input {
122
126
  @apply --m3-body-large;
127
+ @apply --m3-focus-none;
123
128
  position: absolute;
124
129
  inset: 0;
125
130
  width: 100%;
126
131
  height: 100%;
127
132
  border: none;
128
- outline: none;
129
133
 
130
134
  padding: 1rem;
131
135
  padding-inline-start: 0.875rem;
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from "svelte";
3
- import Layer from "../misc/Layer.svelte";
4
3
  import type { DivAttrs } from "../misc/typing-utils";
5
4
 
6
5
  // MUST BE WRAPPED IN A <label>
@@ -14,8 +13,7 @@
14
13
 
15
14
  <div class="m3-container" {...extra}>
16
15
  {@render children()}
17
- <div class="layer-container">
18
- <Layer />
16
+ <div class="layer-container m3-layer">
19
17
  <div class="radio-circle"></div>
20
18
  <div class="radio-dot"></div>
21
19
  </div>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from "svelte";
3
- import Layer from "../misc/Layer.svelte";
4
3
  import type { DivAttrs } from "../misc/typing-utils";
5
4
 
6
5
  // MUST BE WRAPPED IN A <label>
@@ -14,8 +13,7 @@
14
13
 
15
14
  <div class="m3-container" {...extra}>
16
15
  {@render children()}
17
- <div class="layer-container">
18
- <Layer />
16
+ <div class="layer-container m3-layer">
19
17
  <div class="radio-circle"></div>
20
18
  <div class="radio-dot"></div>
21
19
  </div>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from "svelte";
3
- import Layer from "../misc/Layer.svelte";
4
3
  import type { DivAttrs } from "../misc/typing-utils";
5
4
 
6
5
  // MUST BE WRAPPED IN A <label>
@@ -14,8 +13,7 @@
14
13
 
15
14
  <div class="m3-container" {...extra}>
16
15
  {@render children()}
17
- <div class="layer-container">
18
- <Layer />
16
+ <div class="layer-container m3-layer">
19
17
  <div class="radio-circle"></div>
20
18
  <div class="radio-dot"></div>
21
19
  </div>
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import type { IconifyIcon } from "@iconify/types";
3
3
  import type { HTMLOptionAttributes, HTMLSelectAttributes } from "svelte/elements";
4
- import Layer from "../misc/Layer.svelte";
5
4
  import Icon from "../misc/Icon.svelte";
6
5
 
7
6
  type Option = { icon?: IconifyIcon; text: string; value: string } & HTMLOptionAttributes;
@@ -30,10 +29,9 @@
30
29
  >
31
30
  <select style:--width={width} bind:value {id} {...extra}>
32
31
  {#each options as { icon, text, ...extra }, i (i)}
33
- <option class="focus-inset" {...extra}>
34
- <Layer />
32
+ <option {...extra} class="m3-layer">
35
33
  {#if icon}
36
- <Icon {icon} size={24} />
34
+ <Icon {icon} size={24} style="grid-row: 1" />
37
35
  {/if}
38
36
  {@render render(text)}
39
37
  </option>
@@ -102,7 +100,6 @@
102
100
  box-shadow var(--m3-easing-fast);
103
101
 
104
102
  border: none;
105
- position: relative;
106
103
 
107
104
  &:enabled {
108
105
  cursor: pointer;
@@ -166,6 +163,7 @@
166
163
  }
167
164
 
168
165
  option {
166
+ @apply --m3-focus-inward;
169
167
  display: grid;
170
168
  grid-template-columns: auto 1fr;
171
169
  padding-inline: 1rem;
@@ -183,8 +181,7 @@
183
181
  color: var(--m3c-on-primary-container);
184
182
  }
185
183
 
186
- > *,
187
- > :global(svg) {
184
+ > * {
188
185
  grid-row: 1;
189
186
  }
190
187
  &::checkmark {