m3-svelte 5.3.6 → 5.4.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 (35) hide show
  1. package/package/buttons/Button.svelte +0 -1
  2. package/package/buttons/FAB.svelte +0 -3
  3. package/package/containers/Card.svelte +0 -1
  4. package/package/containers/ListItem.svelte +0 -1
  5. package/package/containers/MenuItem.svelte +0 -1
  6. package/package/containers/Snackbar.svelte +0 -1
  7. package/package/forms/Checkbox.svelte +0 -1
  8. package/package/forms/Chip.svelte +0 -1
  9. package/package/forms/DateField.svelte +0 -1
  10. package/package/forms/DateFieldOutlined.svelte +0 -1
  11. package/package/forms/RadioAnim1.svelte +0 -2
  12. package/package/forms/RadioAnim2.svelte +0 -2
  13. package/package/forms/RadioAnim3.svelte +0 -2
  14. package/package/forms/Select.svelte +227 -0
  15. package/package/forms/Select.svelte.d.ts +16 -0
  16. package/package/forms/SelectOutlined.svelte +226 -0
  17. package/package/forms/SelectOutlined.svelte.d.ts +16 -0
  18. package/package/forms/Slider.svelte +5 -6
  19. package/package/forms/Switch.svelte +30 -6
  20. package/package/forms/Switch.svelte.d.ts +4 -0
  21. package/package/forms/TextField.svelte +0 -1
  22. package/package/forms/TextFieldOutlined.svelte +0 -1
  23. package/package/forms/_picker/FocusPicker.svelte +0 -1
  24. package/package/forms/_picker/Header.svelte +0 -1
  25. package/package/forms/_picker/Item.svelte +0 -1
  26. package/package/index.d.ts +12 -10
  27. package/package/index.js +12 -10
  28. package/package/misc/styles.css +2 -1
  29. package/package/nav/NavCMLX.svelte +1 -1
  30. package/package/nav/NavCMLXItem.svelte +7 -7
  31. package/package/nav/Tabs.svelte +0 -1
  32. package/package/nav/TabsLink.svelte +0 -1
  33. package/package/nav/VariableTabs.svelte +0 -1
  34. package/package/nav/VariableTabsLink.svelte +0 -1
  35. package/package.json +8 -8
@@ -96,7 +96,6 @@
96
96
  user-select: none;
97
97
  position: relative;
98
98
  overflow: hidden;
99
- -webkit-tap-highlight-color: transparent;
100
99
 
101
100
  &:disabled,
102
101
  &:is(:global(input:disabled) + label) {
@@ -127,9 +127,6 @@
127
127
  color: rgb(var(--m3-scheme-on-tertiary-container));
128
128
  }
129
129
 
130
- button {
131
- -webkit-tap-highlight-color: transparent;
132
- }
133
130
  @media (hover: hover) {
134
131
  .elevation-normal:hover {
135
132
  box-shadow: var(--m3-util-elevation-4);
@@ -47,7 +47,6 @@
47
47
  font: inherit;
48
48
  letter-spacing: inherit;
49
49
  cursor: pointer;
50
- -webkit-tap-highlight-color: transparent;
51
50
  }
52
51
  @media (hover: hover) {
53
52
  button:hover {
@@ -98,7 +98,6 @@
98
98
  position: relative;
99
99
  background: transparent;
100
100
  color: inherit;
101
- -webkit-tap-highlight-color: transparent;
102
101
  }
103
102
  button.m3-container,
104
103
  label.m3-container {
@@ -43,7 +43,6 @@
43
43
  background-color: transparent;
44
44
  color: rgb(var(--m3-scheme-on-surface));
45
45
 
46
- -webkit-tap-highlight-color: transparent;
47
46
  cursor: pointer;
48
47
  }
49
48
  .icon {
@@ -103,7 +103,6 @@
103
103
  border: none;
104
104
 
105
105
  background-color: transparent;
106
- -webkit-tap-highlight-color: transparent;
107
106
  cursor: pointer;
108
107
  position: relative;
109
108
  }
@@ -56,7 +56,6 @@
56
56
  border-radius: 0.125rem;
57
57
  border: solid 0.125rem currentColor;
58
58
  transition: var(--m3-util-easing-fast);
59
- -webkit-tap-highlight-color: transparent;
60
59
  }
61
60
 
62
61
  svg {
@@ -69,7 +69,6 @@
69
69
  border: solid 1px rgb(var(--m3-scheme-outline));
70
70
  position: relative;
71
71
  cursor: pointer;
72
- -webkit-tap-highlight-color: transparent;
73
72
  transition: var(--m3-util-easing-fast);
74
73
  }
75
74
 
@@ -143,7 +143,6 @@ opacity: ${Math.min(t * 3, 1)};`,
143
143
  color: rgb(var(--m3-scheme-on-surface-variant));
144
144
  border-top-right-radius: var(--m3-datefield-shape);
145
145
 
146
- -webkit-tap-highlight-color: transparent;
147
146
  cursor: pointer;
148
147
  }
149
148
 
@@ -178,7 +178,6 @@ opacity: ${Math.min(t * 3, 1)};`,
178
178
  color: rgb(var(--m3-scheme-on-surface-variant));
179
179
  border-top-right-radius: var(--m3-datefield-outlined-shape);
180
180
 
181
- -webkit-tap-highlight-color: transparent;
182
181
  cursor: pointer;
183
182
  }
184
183
 
@@ -52,7 +52,6 @@
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
54
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
55
  }
57
56
 
58
57
  .radio-dot {
@@ -64,7 +63,6 @@
64
63
  border-radius: var(--m3-util-rounding-full);
65
64
  background-color: currentColor;
66
65
  transition: scale var(--m3-util-easing-fast-spatial);
67
- -webkit-tap-highlight-color: transparent;
68
66
  }
69
67
 
70
68
  :global(input:focus-visible) + .layer-container {
@@ -52,7 +52,6 @@
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
54
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
55
  }
57
56
 
58
57
  .radio-dot {
@@ -63,7 +62,6 @@
63
62
  scale: 0;
64
63
  border-radius: var(--m3-util-rounding-full);
65
64
  background-color: currentColor;
66
- -webkit-tap-highlight-color: transparent;
67
65
  }
68
66
 
69
67
  :global(input:focus-visible) + .layer-container {
@@ -52,7 +52,6 @@
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
54
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
55
  }
57
56
 
58
57
  .radio-dot {
@@ -63,7 +62,6 @@
63
62
  border-radius: var(--m3-util-rounding-full);
64
63
  outline: solid 0 currentColor;
65
64
  transition: var(--m3-util-easing);
66
- -webkit-tap-highlight-color: transparent;
67
65
  }
68
66
 
69
67
  :global(input:focus-visible) + .layer-container {
@@ -0,0 +1,227 @@
1
+ <script lang="ts">
2
+ import type { IconifyIcon } from "@iconify/types";
3
+ import type { HTMLOptionAttributes, HTMLSelectAttributes } from "svelte/elements";
4
+ import Layer from "../misc/Layer.svelte";
5
+ import Icon from "../misc/_icon.svelte";
6
+
7
+ type Option = { icon?: IconifyIcon; text: string; value: string } & HTMLOptionAttributes;
8
+ let {
9
+ label,
10
+ options,
11
+ width = "auto",
12
+ value = $bindable(),
13
+ ...extra
14
+ }: {
15
+ label: string;
16
+ options: Option[];
17
+ width?: string;
18
+ value: string;
19
+ } & HTMLSelectAttributes = $props();
20
+ const id = $props.id();
21
+ </script>
22
+
23
+ {#snippet render(text: string)}
24
+ <span>{text}</span>
25
+ {/snippet}
26
+ <div
27
+ class="m3-container"
28
+ class:enabled={!extra.disabled}
29
+ style:align-self={width == "auto" ? "start" : undefined}
30
+ >
31
+ <select class="m3-font-body-large" style:--width={width} bind:value {id} {...extra}>
32
+ {#each options as { icon, text, ...extra }, i (i)}
33
+ <option class="focus-inset" {...extra}>
34
+ <Layer />
35
+ {#if icon}
36
+ <Icon {icon} width="1.5rem" height="1.5rem" />
37
+ {/if}
38
+ {@render render(text)}
39
+ </option>
40
+ {/each}
41
+ </select>
42
+ <label for={id} class="m3-font-body-small">
43
+ {label}
44
+ </label>
45
+ </div>
46
+
47
+ <style>
48
+ :root {
49
+ --m3-menu-shape: var(--m3-util-rounding-extra-small);
50
+ }
51
+
52
+ .m3-container {
53
+ display: flex;
54
+ flex-direction: column;
55
+ position: relative;
56
+ --secondary-color: rgb(var(--m3-scheme-on-surface-variant));
57
+ &.enabled {
58
+ &:hover {
59
+ --secondary-color: rgb(var(--m3-scheme-on-surface));
60
+ }
61
+ &:focus-within {
62
+ --secondary-color: rgb(var(--m3-scheme-primary));
63
+ select {
64
+ box-shadow: inset 0px -2px var(--secondary-color);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ label {
70
+ position: absolute;
71
+ top: 0.5rem;
72
+ inset-inline: 1rem;
73
+ color: var(--secondary-color);
74
+ pointer-events: none;
75
+ transition: color var(--m3-util-easing-fast);
76
+ }
77
+
78
+ select {
79
+ appearance: none;
80
+ }
81
+ select,
82
+ ::picker(select) {
83
+ appearance: base-select;
84
+ }
85
+
86
+ select {
87
+ display: flex;
88
+ align-items: center;
89
+ height: calc(3.5rem + var(--m3-util-density-term));
90
+ padding-top: calc(
91
+ var(--m3-font-body-small-size, 0.75rem) * var(--m3-font-body-small-height, 1.333)
92
+ );
93
+ padding-inline: 1rem;
94
+
95
+ border-radius: var(--m3-textfield-filled-shape) var(--m3-textfield-filled-shape) 0 0;
96
+ background-color: rgb(var(--m3-scheme-surface-container-highest));
97
+ transition:
98
+ background-color var(--m3-util-easing-fast),
99
+ box-shadow var(--m3-util-easing-fast);
100
+
101
+ border: none;
102
+ position: relative;
103
+
104
+ &:enabled {
105
+ cursor: pointer;
106
+ &:hover,
107
+ &:open {
108
+ background-color: color-mix(
109
+ in oklab,
110
+ rgb(var(--m3-scheme-surface-container-highest)),
111
+ currentColor 8%
112
+ );
113
+ }
114
+ &:active {
115
+ background-color: color-mix(
116
+ in oklab,
117
+ rgb(var(--m3-scheme-surface-container-highest)),
118
+ currentColor 12%
119
+ );
120
+ }
121
+ }
122
+
123
+ box-shadow: inset 0px -1px var(--secondary-color);
124
+ }
125
+
126
+ select::picker-icon {
127
+ scale: 1 0.6; /* yes we are squashing the arrow, surely you don't have a problem with that */
128
+ color: var(--secondary-color);
129
+ transition:
130
+ color var(--m3-util-easing-fast),
131
+ rotate var(--m3-util-easing-fast);
132
+ }
133
+ select:open::picker-icon {
134
+ rotate: 180deg;
135
+ }
136
+
137
+ ::picker(select) {
138
+ background-color: rgb(var(--m3-scheme-surface-container));
139
+ box-shadow: var(--m3-util-elevation-2);
140
+ border-radius: var(--m3-menu-shape);
141
+
142
+ box-sizing: border-box;
143
+ height: 0;
144
+ min-height: 0;
145
+ interpolate-size: allow-keywords;
146
+ overflow: hidden;
147
+ transition:
148
+ width var(--m3-util-easing-fast),
149
+ height var(--m3-util-easing-fast),
150
+ display var(--m3-util-duration-fast) allow-discrete,
151
+ overlay var(--m3-util-duration-fast) allow-discrete;
152
+
153
+ border: none;
154
+ cursor: auto;
155
+ }
156
+ select:open::picker(select) {
157
+ width: var(--width);
158
+ height: auto;
159
+ transition:
160
+ width 500ms linear,
161
+ height 500ms var(--m3-util-timing-function-emphasized-decel),
162
+ display 500ms allow-discrete,
163
+ overlay 500ms allow-discrete;
164
+ }
165
+ @starting-style {
166
+ select:open::picker(select) {
167
+ width: calc-size(var(--width), size - 0.001px);
168
+ height: 0;
169
+ }
170
+ }
171
+
172
+ option {
173
+ display: grid;
174
+ grid-template-columns: auto 1fr;
175
+ padding-inline: 1rem;
176
+ padding-block: calc(
177
+ (
178
+ 3rem + var(--m3-util-density-term) -
179
+ (var(--m3-font-body-large-size, 1rem) * var(--m3-font-body-large-height, 1.5))
180
+ ) /
181
+ 2
182
+ );
183
+ &:first-child {
184
+ margin-top: 0.5rem;
185
+ }
186
+ &:last-child {
187
+ margin-bottom: 0.5rem;
188
+ }
189
+
190
+ background-color: transparent;
191
+ &:checked {
192
+ background-color: rgb(var(--m3-scheme-primary-container));
193
+ color: rgb(var(--m3-scheme-on-primary-container));
194
+ }
195
+
196
+ > *,
197
+ > :global(svg) {
198
+ grid-row: 1;
199
+ }
200
+ &::checkmark {
201
+ opacity: 0;
202
+ grid-column: 2;
203
+ }
204
+ &:has(> :global(svg)) {
205
+ grid-template-columns: auto auto 1fr;
206
+ > :global(svg) {
207
+ margin-right: 0.5rem;
208
+ }
209
+ &:not(:checked) > :global(svg) {
210
+ color: rgb(var(--m3-scheme-on-surface-variant));
211
+ }
212
+ &:checked > :global(svg) {
213
+ opacity: 0.8;
214
+ }
215
+ &::checkmark {
216
+ grid-column: 3;
217
+ }
218
+ }
219
+
220
+ transition:
221
+ background-color var(--m3-util-easing-fast),
222
+ color var(--m3-util-easing-fast);
223
+
224
+ position: relative;
225
+ cursor: pointer;
226
+ }
227
+ </style>
@@ -0,0 +1,16 @@
1
+ import type { IconifyIcon } from "@iconify/types";
2
+ import type { HTMLOptionAttributes, HTMLSelectAttributes } from "svelte/elements";
3
+ type Option = {
4
+ icon?: IconifyIcon;
5
+ text: string;
6
+ value: string;
7
+ } & HTMLOptionAttributes;
8
+ type $$ComponentProps = {
9
+ label: string;
10
+ options: Option[];
11
+ width?: string;
12
+ value: string;
13
+ } & HTMLSelectAttributes;
14
+ declare const Select: import("svelte").Component<$$ComponentProps, {}, "value">;
15
+ type Select = ReturnType<typeof Select>;
16
+ export default Select;
@@ -0,0 +1,226 @@
1
+ <script lang="ts">
2
+ import type { IconifyIcon } from "@iconify/types";
3
+ import type { HTMLOptionAttributes, HTMLSelectAttributes } from "svelte/elements";
4
+ import Layer from "../misc/Layer.svelte";
5
+ import Icon from "../misc/_icon.svelte";
6
+
7
+ type Option = { icon?: IconifyIcon; text: string; value: string } & HTMLOptionAttributes;
8
+ let {
9
+ label,
10
+ options,
11
+ width = "auto",
12
+ value = $bindable(),
13
+ ...extra
14
+ }: {
15
+ label: string;
16
+ options: Option[];
17
+ width?: string;
18
+ value: string;
19
+ } & HTMLSelectAttributes = $props();
20
+ const id = $props.id();
21
+ </script>
22
+
23
+ {#snippet render(text: string)}
24
+ <span>{text}</span>
25
+ {/snippet}
26
+ <div
27
+ class="m3-container"
28
+ class:enabled={!extra.disabled}
29
+ style:align-self={width == "auto" ? "start" : undefined}
30
+ >
31
+ <select class="m3-font-body-large" style:--width={width} bind:value {id} {...extra}>
32
+ {#each options as { icon, text, ...extra }, i (i)}
33
+ <option class="focus-inset" {...extra}>
34
+ <Layer />
35
+ {#if icon}
36
+ <Icon {icon} width="1.5rem" height="1.5rem" />
37
+ {/if}
38
+ {@render render(text)}
39
+ </option>
40
+ {/each}
41
+ </select>
42
+ <div class="layer"></div>
43
+ <label for={id} class="m3-font-body-small">
44
+ {label}
45
+ </label>
46
+ </div>
47
+
48
+ <style>
49
+ /*
50
+ want to customize the label's background?
51
+ do this: <SelectOutlined --m3-util-background="rgb(var(--m3-scheme-surface-container))" />
52
+ */
53
+ :root {
54
+ --m3-menu-shape: var(--m3-util-rounding-extra-small);
55
+ --m3-select-outlined-shape: var(--m3-util-rounding-extra-small);
56
+ }
57
+
58
+ .m3-container {
59
+ display: flex;
60
+ flex-direction: column;
61
+ position: relative;
62
+ --secondary-color: rgb(var(--m3-scheme-on-surface-variant));
63
+ --outline-color: rgb(var(--m3-scheme-outline));
64
+ &.enabled {
65
+ &:hover {
66
+ --secondary-color: rgb(var(--m3-scheme-on-surface));
67
+ --outline-color: rgb(var(--m3-scheme-on-surface));
68
+ }
69
+ &:focus-within {
70
+ --secondary-color: rgb(var(--m3-scheme-primary));
71
+ --outline-color: rgb(var(--m3-scheme-primary));
72
+ .layer {
73
+ border-width: 0.125rem;
74
+ }
75
+ }
76
+ }
77
+ }
78
+ .layer {
79
+ position: absolute;
80
+ inset: 0;
81
+ border: 1px solid var(--outline-color);
82
+ border-radius: var(--m3-select-outlined-shape);
83
+ pointer-events: none;
84
+ transition: all 100ms;
85
+ }
86
+ label {
87
+ position: absolute;
88
+ top: 0;
89
+ inset-inline-start: 0.75rem;
90
+ translate: 0 -50%;
91
+ color: var(--secondary-color);
92
+ background-color: var(--m3-util-background, rgb(var(--m3-scheme-surface)));
93
+ padding: 0 0.25rem;
94
+ pointer-events: none;
95
+ transition: color var(--m3-util-easing-fast);
96
+ }
97
+
98
+ select {
99
+ appearance: none;
100
+ }
101
+ select,
102
+ ::picker(select) {
103
+ appearance: base-select;
104
+ }
105
+
106
+ select {
107
+ display: flex;
108
+ align-items: center;
109
+ height: calc(3.5rem + var(--m3-util-density-term));
110
+ padding-inline: 1rem;
111
+
112
+ border-radius: var(--m3-select-outlined-shape);
113
+ background-color: transparent;
114
+ color: rgb(var(--m3-scheme-on-surface));
115
+
116
+ border: none;
117
+ outline: none;
118
+ position: relative;
119
+
120
+ &:enabled {
121
+ cursor: pointer;
122
+ }
123
+ }
124
+
125
+ select::picker-icon {
126
+ scale: 1 0.6;
127
+ color: var(--secondary-color);
128
+ transition:
129
+ color var(--m3-util-easing-fast),
130
+ rotate var(--m3-util-easing-fast);
131
+ }
132
+ select:open::picker-icon {
133
+ rotate: 180deg;
134
+ }
135
+
136
+ ::picker(select) {
137
+ background-color: rgb(var(--m3-scheme-surface-container));
138
+ box-shadow: var(--m3-util-elevation-2);
139
+ border-radius: var(--m3-menu-shape);
140
+
141
+ box-sizing: border-box;
142
+ height: 0;
143
+ min-height: 0;
144
+ interpolate-size: allow-keywords;
145
+ overflow: hidden;
146
+ transition:
147
+ width var(--m3-util-easing-fast),
148
+ height var(--m3-util-easing-fast),
149
+ display var(--m3-util-duration-fast) allow-discrete,
150
+ overlay var(--m3-util-duration-fast) allow-discrete;
151
+
152
+ border: none;
153
+ cursor: auto;
154
+ }
155
+ select:open::picker(select) {
156
+ width: var(--width);
157
+ height: auto;
158
+ transition:
159
+ width 500ms linear,
160
+ height 500ms var(--m3-util-timing-function-emphasized-decel),
161
+ display 500ms allow-discrete,
162
+ overlay 500ms allow-discrete;
163
+ }
164
+ @starting-style {
165
+ select:open::picker(select) {
166
+ width: calc-size(var(--width), size - 0.001px);
167
+ height: 0;
168
+ }
169
+ }
170
+
171
+ option {
172
+ display: grid;
173
+ grid-template-columns: auto 1fr;
174
+ padding-inline: 1rem;
175
+ padding-block: calc(
176
+ (
177
+ 3rem + var(--m3-util-density-term) -
178
+ (var(--m3-font-body-large-size, 1rem) * var(--m3-font-body-large-height, 1.5))
179
+ ) /
180
+ 2
181
+ );
182
+ &:first-child {
183
+ margin-top: 0.5rem;
184
+ }
185
+ &:last-child {
186
+ margin-bottom: 0.5rem;
187
+ }
188
+
189
+ background-color: transparent;
190
+ &:checked {
191
+ background-color: rgb(var(--m3-scheme-primary-container));
192
+ color: rgb(var(--m3-scheme-on-primary-container));
193
+ }
194
+
195
+ > *,
196
+ > :global(svg) {
197
+ grid-row: 1;
198
+ }
199
+ &::checkmark {
200
+ opacity: 0;
201
+ grid-column: 2;
202
+ }
203
+ &:has(> :global(svg)) {
204
+ grid-template-columns: auto auto 1fr;
205
+ > :global(svg) {
206
+ margin-right: 0.5rem;
207
+ }
208
+ &:not(:checked) > :global(svg) {
209
+ color: rgb(var(--m3-scheme-on-surface-variant));
210
+ }
211
+ &:checked > :global(svg) {
212
+ opacity: 0.8;
213
+ }
214
+ &::checkmark {
215
+ grid-column: 3;
216
+ }
217
+ }
218
+
219
+ transition:
220
+ background-color var(--m3-util-easing-fast),
221
+ color var(--m3-util-easing-fast);
222
+
223
+ position: relative;
224
+ cursor: pointer;
225
+ }
226
+ </style>
@@ -0,0 +1,16 @@
1
+ import type { IconifyIcon } from "@iconify/types";
2
+ import type { HTMLOptionAttributes, HTMLSelectAttributes } from "svelte/elements";
3
+ type Option = {
4
+ icon?: IconifyIcon;
5
+ text: string;
6
+ value: string;
7
+ } & HTMLOptionAttributes;
8
+ type $$ComponentProps = {
9
+ label: string;
10
+ options: Option[];
11
+ width?: string;
12
+ value: string;
13
+ } & HTMLSelectAttributes;
14
+ declare const SelectOutlined: import("svelte").Component<$$ComponentProps, {}, "value">;
15
+ type SelectOutlined = ReturnType<typeof SelectOutlined>;
16
+ export default SelectOutlined;
@@ -197,7 +197,7 @@
197
197
  top: 50%;
198
198
  inset-inline-end: 4px;
199
199
  translate: 0 -50%;
200
- background-color: rgb(var(--m3-scheme-primary));
200
+ background-color: rgb(var(--m3-scheme-on-secondary-container));
201
201
  pointer-events: none;
202
202
  &.hidden {
203
203
  display: none;
@@ -213,7 +213,6 @@
213
213
  opacity: 0;
214
214
  appearance: none;
215
215
  margin: 0;
216
- -webkit-tap-highlight-color: transparent;
217
216
  cursor: pointer;
218
217
  }
219
218
 
@@ -262,7 +261,7 @@
262
261
  &:dir(rtl) {
263
262
  translate: 50% -50%;
264
263
  }
265
- background-color: rgb(var(--m3-scheme-secondary-container));
264
+ background-color: rgb(var(--m3-scheme-on-primary));
266
265
  pointer-events: none;
267
266
  }
268
267
 
@@ -271,7 +270,7 @@
271
270
  }
272
271
 
273
272
  .tick.inactive {
274
- background-color: rgb(var(--m3-scheme-primary));
273
+ background-color: rgb(var(--m3-scheme-on-secondary-container));
275
274
  }
276
275
 
277
276
  :global(.leading) ~ .tick:nth-child(1 of div.tick) {
@@ -353,11 +352,11 @@
353
352
  background-color: rgb(var(--m3-scheme-on-surface) / 0.38);
354
353
  }
355
354
  input:disabled ~ .tick {
356
- background-color: rgb(var(--m3-scheme-inverse-on-surface) / 0.66);
355
+ background-color: rgb(var(--m3-scheme-inverse-on-surface));
357
356
  }
358
357
  input:disabled ~ .tick.inactive,
359
358
  input:disabled ~ .endstop {
360
- background-color: rgb(var(--m3-scheme-on-surface) / 0.38);
359
+ background-color: rgb(var(--m3-scheme-on-surface));
361
360
  }
362
361
 
363
362
  @media screen and (forced-colors: active) {
@@ -1,16 +1,24 @@
1
1
  <script lang="ts">
2
2
  import Icon from "../misc/_icon.svelte";
3
+ import type { IconifyIcon } from "@iconify/types";
3
4
  import iconCheck from "@ktibow/iconset-material-symbols/check";
5
+ import iconX from "@ktibow/iconset-material-symbols/close";
4
6
  import type { HTMLInputAttributes } from "svelte/elements";
5
7
 
6
8
  // MUST BE WRAPPED IN A <label>
7
9
  let {
8
10
  checked = $bindable(false),
9
11
  disabled = false,
12
+ uncheckedIcon = iconX,
13
+ checkedIcon = iconCheck,
14
+ icons = "checked",
10
15
  ...extra
11
16
  }: {
12
17
  checked?: boolean;
13
18
  disabled?: boolean;
19
+ uncheckedIcon?: IconifyIcon;
20
+ checkedIcon?: IconifyIcon;
21
+ icons?: "checked" | "both" | "none";
14
22
  } & HTMLInputAttributes = $props();
15
23
 
16
24
  let startX: number | undefined = $state();
@@ -49,7 +57,12 @@
49
57
  }}
50
58
  />
51
59
  <div class="handle">
52
- <Icon icon={iconCheck} />
60
+ {#if icons != "none"}
61
+ <Icon icon={checkedIcon} />
62
+ {#if icons == "both"}
63
+ <Icon icon={uncheckedIcon} />
64
+ {/if}
65
+ {/if}
53
66
  </div>
54
67
  <div class="hover"></div>
55
68
  </div>
@@ -75,7 +88,6 @@
75
88
  background-color: rgb(var(--m3-scheme-surface-container-highest));
76
89
  border: solid 0.125rem rgb(var(--m3-scheme-outline));
77
90
  cursor: pointer;
78
- -webkit-tap-highlight-color: transparent;
79
91
  transition: var(--m3-util-easing);
80
92
  }
81
93
  .handle {
@@ -88,7 +100,6 @@
88
100
  /* Fallback for those without on on primary */
89
101
  color: rgb(var(--m3-scheme-on-on-primary, var(--m3-scheme-on-primary-container)));
90
102
  cursor: pointer;
91
- -webkit-tap-highlight-color: transparent;
92
103
  transition: var(--m3-util-easing-fast-spatial);
93
104
 
94
105
  left: 0.5rem;
@@ -106,6 +117,20 @@
106
117
  opacity var(--m3-util-easing-fast-spatial),
107
118
  scale var(--m3-util-easing-fast-spatial);
108
119
  }
120
+ input:not(:checked) + :global(.handle:has(:nth-child(2))) {
121
+ scale: 1.5;
122
+ > :global(svg) {
123
+ color: rgb(var(--m3-scheme-surface-container-highest));
124
+ scale: 0.667;
125
+ opacity: 1;
126
+ }
127
+ }
128
+
129
+ input:checked + :global(.handle) > :global(svg:nth-child(2)),
130
+ input:not(:checked) + :global(.handle) > :global(svg:first-child) {
131
+ display: none;
132
+ }
133
+
109
134
  .hover {
110
135
  position: absolute;
111
136
  width: 3rem;
@@ -113,7 +138,6 @@
113
138
  border-radius: var(--m3-util-rounding-full);
114
139
 
115
140
  cursor: pointer;
116
- -webkit-tap-highlight-color: transparent;
117
141
  transition: var(--m3-util-easing-fast);
118
142
 
119
143
  left: 1rem;
@@ -124,8 +148,8 @@
124
148
  justify-content: center;
125
149
  }
126
150
 
127
- .m3-container:hover > input:enabled + .handle,
128
- .m3-container > input:enabled:is(:global(:active, :focus-visible)) + .handle {
151
+ .m3-container:hover > input:not(:checked):not(:disabled) + .handle,
152
+ .m3-container:active > input:not(:checked):not(:disabled) + .handle {
129
153
  background-color: rgb(var(--m3-scheme-on-surface-variant));
130
154
  }
131
155
  .m3-container:hover > input:enabled:checked + .handle,
@@ -1,7 +1,11 @@
1
+ import type { IconifyIcon } from "@iconify/types";
1
2
  import type { HTMLInputAttributes } from "svelte/elements";
2
3
  type $$ComponentProps = {
3
4
  checked?: boolean;
4
5
  disabled?: boolean;
6
+ uncheckedIcon?: IconifyIcon;
7
+ checkedIcon?: IconifyIcon;
8
+ icons?: "checked" | "both" | "none";
5
9
  } & HTMLInputAttributes;
6
10
  declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
7
11
  type Switch = ReturnType<typeof Switch>;
@@ -160,7 +160,6 @@
160
160
  border-start-end-radius: 0.25rem;
161
161
  border-end-end-radius: 0.25rem;
162
162
 
163
- -webkit-tap-highlight-color: transparent;
164
163
  cursor: pointer;
165
164
  }
166
165
 
@@ -157,7 +157,6 @@
157
157
  border-start-end-radius: 0.25rem;
158
158
  border-end-end-radius: 0.25rem;
159
159
 
160
- -webkit-tap-highlight-color: transparent;
161
160
  cursor: pointer;
162
161
  }
163
162
 
@@ -49,7 +49,6 @@
49
49
  background-color: transparent;
50
50
  color: rgb(var(--m3-scheme-on-surface));
51
51
  border: none;
52
- -webkit-tap-highlight-color: transparent;
53
52
  cursor: pointer;
54
53
  position: relative;
55
54
  }
@@ -103,7 +103,6 @@
103
103
  color: rgb(var(--m3-scheme-on-surface-variant));
104
104
  border: none;
105
105
  padding: 0;
106
- -webkit-tap-highlight-color: transparent;
107
106
  cursor: pointer;
108
107
  position: relative;
109
108
  }
@@ -40,7 +40,6 @@
40
40
  background-color: transparent;
41
41
  color: rgb(var(--m3-scheme-on-surface));
42
42
  border: none;
43
- -webkit-tap-highlight-color: transparent;
44
43
  cursor: pointer;
45
44
  transition: var(--m3-util-easing-fast);
46
45
  position: relative;
@@ -18,29 +18,31 @@ export { default as MenuItem } from "./containers/MenuItem.svelte";
18
18
  export { default as Snackbar } from "./containers/Snackbar.svelte";
19
19
  export type { SnackbarIn } from "./containers/Snackbar.svelte";
20
20
  export { default as SnackbarItem } from "./containers/SnackbarItem.svelte";
21
- export { default as LinearProgress } from "./forms/LinearProgress.svelte";
22
- export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
23
- export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
24
- export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
25
- export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
21
+ export { default as Checkbox } from "./forms/Checkbox.svelte";
22
+ export { default as Chip } from "./forms/Chip.svelte";
26
23
  export { default as CircularProgress } from "./forms/CircularProgress.svelte";
27
24
  export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
28
25
  export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
29
- export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
30
26
  export { default as DateField } from "./forms/DateField.svelte";
31
27
  export { default as DateFieldOutlined } from "./forms/DateFieldOutlined.svelte";
28
+ export { default as DatePickerDocked } from "./forms/DatePickerDocked.svelte";
29
+ export { default as LinearProgress } from "./forms/LinearProgress.svelte";
30
+ export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
31
+ export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
32
+ export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
32
33
  export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
33
34
  export { default as RadioAnim2 } from "./forms/RadioAnim2.svelte";
34
35
  export { default as RadioAnim3 } from "./forms/RadioAnim3.svelte";
35
- export { default as Checkbox } from "./forms/Checkbox.svelte";
36
- export { default as Switch } from "./forms/Switch.svelte";
36
+ export { default as Select } from "./forms/Select.svelte";
37
+ export { default as SelectOutlined } from "./forms/SelectOutlined.svelte";
37
38
  export { default as Slider } from "./forms/Slider.svelte";
39
+ export { default as Switch } from "./forms/Switch.svelte";
38
40
  export { default as TextField } from "./forms/TextField.svelte";
39
41
  export { default as TextFieldMultiline } from "./forms/TextFieldMultiline.svelte";
40
42
  export { default as TextFieldOutlined } from "./forms/TextFieldOutlined.svelte";
41
43
  export { default as TextFieldOutlinedMultiline } from "./forms/TextFieldOutlinedMultiline.svelte";
42
- export { default as DatePickerDocked } from "./forms/DatePickerDocked.svelte";
43
- export { default as Chip } from "./forms/Chip.svelte";
44
+ export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
45
+ export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
44
46
  export { default as NavCMLX } from "./nav/NavCMLX.svelte";
45
47
  export { default as NavCMLXItem } from "./nav/NavCMLXItem.svelte";
46
48
  export { default as Tabs } from "./nav/Tabs.svelte";
package/package/index.js CHANGED
@@ -17,29 +17,31 @@ export { default as Menu } from "./containers/Menu.svelte";
17
17
  export { default as MenuItem } from "./containers/MenuItem.svelte";
18
18
  export { default as Snackbar } from "./containers/Snackbar.svelte";
19
19
  export { default as SnackbarItem } from "./containers/SnackbarItem.svelte";
20
- export { default as LinearProgress } from "./forms/LinearProgress.svelte";
21
- export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
22
- export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
23
- export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
24
- export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
20
+ export { default as Checkbox } from "./forms/Checkbox.svelte";
21
+ export { default as Chip } from "./forms/Chip.svelte";
25
22
  export { default as CircularProgress } from "./forms/CircularProgress.svelte";
26
23
  export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
27
24
  export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
28
- export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
29
25
  export { default as DateField } from "./forms/DateField.svelte";
30
26
  export { default as DateFieldOutlined } from "./forms/DateFieldOutlined.svelte";
27
+ export { default as DatePickerDocked } from "./forms/DatePickerDocked.svelte";
28
+ export { default as LinearProgress } from "./forms/LinearProgress.svelte";
29
+ export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
30
+ export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
31
+ export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
31
32
  export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
32
33
  export { default as RadioAnim2 } from "./forms/RadioAnim2.svelte";
33
34
  export { default as RadioAnim3 } from "./forms/RadioAnim3.svelte";
34
- export { default as Checkbox } from "./forms/Checkbox.svelte";
35
- export { default as Switch } from "./forms/Switch.svelte";
35
+ export { default as Select } from "./forms/Select.svelte";
36
+ export { default as SelectOutlined } from "./forms/SelectOutlined.svelte";
36
37
  export { default as Slider } from "./forms/Slider.svelte";
38
+ export { default as Switch } from "./forms/Switch.svelte";
37
39
  export { default as TextField } from "./forms/TextField.svelte";
38
40
  export { default as TextFieldMultiline } from "./forms/TextFieldMultiline.svelte";
39
41
  export { default as TextFieldOutlined } from "./forms/TextFieldOutlined.svelte";
40
42
  export { default as TextFieldOutlinedMultiline } from "./forms/TextFieldOutlinedMultiline.svelte";
41
- export { default as DatePickerDocked } from "./forms/DatePickerDocked.svelte";
42
- export { default as Chip } from "./forms/Chip.svelte";
43
+ export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
44
+ export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
43
45
  export { default as NavCMLX } from "./nav/NavCMLX.svelte";
44
46
  export { default as NavCMLXItem } from "./nav/NavCMLXItem.svelte";
45
47
  export { default as Tabs } from "./nav/Tabs.svelte";
@@ -83,7 +83,7 @@
83
83
  --m3-util-timing-function-emphasized-accel: cubic-bezier(0.3, 0, 0.8, 0.15);
84
84
  --m3-util-timing-function-emphasized-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
85
85
 
86
- /* deprecated / todo next release remove */
86
+ /* deprecated */
87
87
  --m3-util-curve: var(--m3-util-timing-function-emphasized);
88
88
  --m3-util-curve-accel: var(--m3-util-timing-function-emphasized-accel);
89
89
  --m3-util-curve-decel: var(--m3-util-timing-function-emphasized-decel);
@@ -220,6 +220,7 @@ or for very small text in the content body, such as captions. */
220
220
  }
221
221
  .m3-container {
222
222
  box-sizing: border-box;
223
+ -webkit-tap-highlight-color: transparent;
223
224
  }
224
225
  .m3-container a,
225
226
  a.m3-container {
@@ -5,7 +5,7 @@
5
5
  variant,
6
6
  children,
7
7
  }: {
8
- variant: "compact" | "medium" | "large" | "expanded" | "auto";
8
+ variant: "compact" | "medium" | "large" | "expanded" | "auto"; // next release / "deprecated": rename expanded to extra-large
9
9
  children: Snippet;
10
10
  } = $props();
11
11
  </script>
@@ -8,7 +8,7 @@
8
8
  | ({ click: () => void } & HTMLButtonAttributes)
9
9
  | ({ href: string } & HTMLAnchorAttributes);
10
10
  let props: {
11
- variant: "compact" | "medium" | "large" | "expanded" | "auto";
11
+ variant: "compact" | "medium" | "large" | "expanded" | "auto"; // next release / "deprecated": rename expanded to extra-large
12
12
  icon: IconifyIcon;
13
13
  text: string;
14
14
  selected: boolean;
@@ -81,13 +81,13 @@
81
81
  }
82
82
  &:hover {
83
83
  > .icon {
84
- background-color: color-mix(in srgb-linear, currentColor 8%, transparent);
84
+ background-color: color-mix(in oklab, currentColor 8%, transparent);
85
85
  }
86
86
  }
87
87
  &:focus-visible,
88
88
  &:active {
89
89
  > .icon {
90
- background-color: color-mix(in srgb-linear, currentColor 12%, transparent);
90
+ background-color: color-mix(in oklab, currentColor 12%, transparent);
91
91
  }
92
92
  }
93
93
  > .icon {
@@ -188,14 +188,14 @@
188
188
 
189
189
  &:hover {
190
190
  > .icon {
191
- background-color: color-mix(in srgb-linear, currentColor 8%, transparent);
191
+ background-color: color-mix(in oklab, currentColor 8%, transparent);
192
192
  }
193
193
  }
194
194
 
195
195
  &:focus-visible,
196
196
  &:active {
197
197
  > .icon {
198
- background-color: color-mix(in srgb-linear, currentColor 12%, transparent);
198
+ background-color: color-mix(in oklab, currentColor 12%, transparent);
199
199
  }
200
200
  }
201
201
 
@@ -251,14 +251,14 @@
251
251
 
252
252
  &:hover {
253
253
  > .icon {
254
- background-color: color-mix(in srgb-linear, currentColor 8%, transparent);
254
+ background-color: color-mix(in oklab, currentColor 8%, transparent);
255
255
  }
256
256
  }
257
257
 
258
258
  &:focus-visible,
259
259
  &:active {
260
260
  > .icon {
261
- background-color: color-mix(in srgb-linear, currentColor 12%, transparent);
261
+ background-color: color-mix(in oklab, currentColor 12%, transparent);
262
262
  }
263
263
  }
264
264
 
@@ -69,7 +69,6 @@
69
69
 
70
70
  color: rgb(var(--m3-scheme-on-surface-variant));
71
71
  user-select: none;
72
- -webkit-tap-highlight-color: transparent;
73
72
  cursor: pointer;
74
73
  transition: color var(--m3-util-easing-fast);
75
74
  }
@@ -67,7 +67,6 @@
67
67
 
68
68
  color: rgb(var(--m3-scheme-on-surface-variant));
69
69
  user-select: none;
70
- -webkit-tap-highlight-color: transparent;
71
70
  cursor: pointer;
72
71
  transition: color var(--m3-util-easing-fast);
73
72
  }
@@ -130,7 +130,6 @@
130
130
 
131
131
  color: rgb(var(--m3-scheme-on-surface-variant));
132
132
  user-select: none;
133
- -webkit-tap-highlight-color: transparent;
134
133
  cursor: pointer;
135
134
  transition: color var(--m3-util-easing-fast);
136
135
  }
@@ -128,7 +128,6 @@
128
128
 
129
129
  color: rgb(var(--m3-scheme-on-surface-variant));
130
130
  user-select: none;
131
- -webkit-tap-highlight-color: transparent;
132
131
  cursor: pointer;
133
132
  transition: color var(--m3-util-easing-fast);
134
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-svelte",
3
- "version": "5.3.6",
3
+ "version": "5.4.0",
4
4
  "license": "Apache-2.0 OR GPL-3.0-only",
5
5
  "repository": "KTibow/m3-svelte",
6
6
  "author": {
@@ -35,17 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@iconify/types": "^2.0.0",
38
- "@ktibow/iconset-material-symbols": "^0.0.1754804347",
39
- "@ktibow/material-color-utilities-nightly": "^0.3.11754876552597",
40
- "svelte": "^5.38.0"
38
+ "@ktibow/iconset-material-symbols": "^0.0.1755063979",
39
+ "@ktibow/material-color-utilities-nightly": "^0.3.11755481233385",
40
+ "svelte": "^5.38.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@eslint/compat": "^1.3.2",
44
44
  "@eslint/js": "^9.33.0",
45
45
  "@sveltejs/adapter-static": "^3.0.9",
46
- "@sveltejs/kit": "^2.27.3",
46
+ "@sveltejs/kit": "^2.32.0",
47
47
  "@sveltejs/package": "^2.4.1",
48
- "@sveltejs/vite-plugin-svelte": "^6.1.1",
48
+ "@sveltejs/vite-plugin-svelte": "^6.1.2",
49
49
  "eslint": "^9.27.0",
50
50
  "eslint-config-prettier": "^10.1.8",
51
51
  "eslint-plugin-svelte": "^3.11.0",
@@ -57,8 +57,8 @@
57
57
  "svelte-check": "^4.3.1",
58
58
  "svelte-highlight": "^7.8.3",
59
59
  "typescript": "^5.9.2",
60
- "typescript-eslint": "^8.39.1",
61
- "vite": "^7.1.1"
60
+ "typescript-eslint": "^8.40.0",
61
+ "vite": "^7.1.2"
62
62
  },
63
63
  "keywords": [
64
64
  "svelte",