m3-svelte 5.3.6 → 5.6.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 (48) hide show
  1. package/package/buttons/Button.svelte +4 -11
  2. package/package/buttons/Button.svelte.d.ts +3 -6
  3. package/package/buttons/FAB.svelte +0 -3
  4. package/package/containers/Card.svelte +0 -1
  5. package/package/containers/Dialog.svelte +35 -37
  6. package/package/containers/Dialog.svelte.d.ts +4 -0
  7. package/package/containers/ListItem.svelte +0 -1
  8. package/package/containers/MenuItem.svelte +0 -1
  9. package/package/containers/Snackbar.svelte +0 -1
  10. package/package/forms/Checkbox.svelte +1 -1
  11. package/package/forms/Chip.svelte +20 -14
  12. package/package/forms/Chip.svelte.d.ts +3 -3
  13. package/package/forms/DateField.svelte +0 -1
  14. package/package/forms/DateFieldOutlined.svelte +0 -1
  15. package/package/forms/RadioAnim1.svelte +1 -2
  16. package/package/forms/RadioAnim2.svelte +1 -2
  17. package/package/forms/RadioAnim3.svelte +1 -2
  18. package/package/forms/Select.svelte +228 -0
  19. package/package/forms/Select.svelte.d.ts +16 -0
  20. package/package/forms/SelectOutlined.svelte +226 -0
  21. package/package/forms/SelectOutlined.svelte.d.ts +16 -0
  22. package/package/forms/Slider.svelte +127 -148
  23. package/package/forms/Slider.svelte.d.ts +1 -1
  24. package/package/forms/SliderTicks.svelte +2 -2
  25. package/package/forms/SliderTicks.svelte.d.ts +2 -2
  26. package/package/forms/Switch.svelte +30 -6
  27. package/package/forms/Switch.svelte.d.ts +4 -0
  28. package/package/forms/TextField.svelte +4 -4
  29. package/package/forms/TextFieldMultiline.svelte +4 -3
  30. package/package/forms/TextFieldOutlined.svelte +7 -4
  31. package/package/forms/TextFieldOutlinedMultiline.svelte +7 -3
  32. package/package/forms/_picker/FocusPicker.svelte +0 -1
  33. package/package/forms/_picker/Header.svelte +0 -1
  34. package/package/forms/_picker/Item.svelte +0 -1
  35. package/package/index.d.ts +13 -10
  36. package/package/index.js +13 -10
  37. package/package/misc/_icon.svelte +14 -1
  38. package/package/misc/styles.css +2 -1
  39. package/package/misc/typing-utils.d.ts +3 -1
  40. package/package/nav/NavCMLX.svelte +1 -1
  41. package/package/nav/NavCMLXItem.svelte +7 -7
  42. package/package/nav/Tabs.svelte +0 -1
  43. package/package/nav/TabsLink.svelte +0 -1
  44. package/package/nav/VariableTabs.svelte +0 -1
  45. package/package/nav/VariableTabsLink.svelte +0 -1
  46. package/package/utils/badge.d.ts +11 -0
  47. package/package/utils/badge.js +30 -0
  48. package/package.json +10 -10
@@ -1,17 +1,11 @@
1
1
  <script lang="ts">
2
- import type {
3
- HTMLButtonAttributes,
4
- HTMLAnchorAttributes,
5
- HTMLLabelAttributes,
6
- } from "svelte/elements";
2
+ import type { HTMLButtonAttributes } from "svelte/elements";
7
3
  import type { Snippet } from "svelte";
4
+ import type { LabelAttrs, AnchorAttrs } from "../misc/typing-utils";
8
5
  import Layer from "../misc/Layer.svelte";
9
6
 
10
7
  // If you want a toggle button, use `for` with a checkbox input.
11
- type ActionProps =
12
- | ({ for: string } & HTMLLabelAttributes)
13
- | ({ href: string } & HTMLAnchorAttributes)
14
- | HTMLButtonAttributes;
8
+ type ActionProps = LabelAttrs | AnchorAttrs | HTMLButtonAttributes;
15
9
  type Props = {
16
10
  variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
17
11
  square?: boolean;
@@ -61,7 +55,7 @@
61
55
  {:else}
62
56
  {@const { variant = "filled", square = false, iconType = "none", children, ...extra } = props}
63
57
  <button
64
- type={"onclick" in extra ? "button" : undefined}
58
+ type={"onclick" in extra ? "button" : "submit"}
65
59
  class="m3-container m3-font-label-large {variant} icon-{iconType}"
66
60
  class:square
67
61
  {...extra}
@@ -96,7 +90,6 @@
96
90
  user-select: none;
97
91
  position: relative;
98
92
  overflow: hidden;
99
- -webkit-tap-highlight-color: transparent;
100
93
 
101
94
  &:disabled,
102
95
  &:is(:global(input:disabled) + label) {
@@ -1,10 +1,7 @@
1
- import type { HTMLButtonAttributes, HTMLAnchorAttributes, HTMLLabelAttributes } from "svelte/elements";
1
+ import type { HTMLButtonAttributes } from "svelte/elements";
2
2
  import type { Snippet } from "svelte";
3
- type ActionProps = ({
4
- for: string;
5
- } & HTMLLabelAttributes) | ({
6
- href: string;
7
- } & HTMLAnchorAttributes) | HTMLButtonAttributes;
3
+ import type { LabelAttrs, AnchorAttrs } from "../misc/typing-utils";
4
+ type ActionProps = LabelAttrs | AnchorAttrs | HTMLButtonAttributes;
8
5
  type Props = {
9
6
  variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
10
7
  square?: boolean;
@@ -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 {
@@ -10,10 +10,7 @@
10
10
  buttons,
11
11
  children,
12
12
  open = $bindable(),
13
- closeOnEsc = true,
14
- closeOnClick = true,
15
- onEsc,
16
- onClick,
13
+ closedby = "any",
17
14
  ...extra
18
15
  }: {
19
16
  icon?: IconifyIcon | undefined;
@@ -21,9 +18,13 @@
21
18
  buttons: Snippet;
22
19
  children: Snippet;
23
20
  open: boolean;
21
+ /** @deprecated use closedby instead */
24
22
  closeOnEsc?: boolean;
23
+ /** @deprecated use closedby instead */
25
24
  closeOnClick?: boolean;
25
+ /** @deprecated listen to `open` state changes instead of onEsc */
26
26
  onEsc?: () => void;
27
+ /** @deprecated listen to `open` state changes instead of onClick */
27
28
  onClick?: () => void;
28
29
  } & HTMLDialogAttributes = $props();
29
30
 
@@ -37,39 +38,41 @@
37
38
 
38
39
  <dialog
39
40
  class="m3-container"
41
+ ontoggle={(e) => {
42
+ open = e.newState == "open";
43
+ }}
40
44
  oncancel={(e) => {
41
45
  if (e.target != e.currentTarget) return;
42
-
43
- if (!closeOnEsc) {
44
- e.preventDefault();
45
- return;
46
+ if (extra.closeOnEsc && extra.onEsc) {
47
+ extra.onEsc();
46
48
  }
47
-
48
- onEsc?.();
49
- open = false;
50
49
  }}
51
50
  onclick={(e) => {
52
51
  if (e.target != e.currentTarget) return;
53
- if (closeOnClick) {
54
- onClick?.();
55
- open = false;
52
+ if (extra.closeOnClick && extra.onClick) {
53
+ extra.onClick();
56
54
  }
57
55
  }}
58
56
  bind:this={dialog}
57
+ closedby={closedby ||
58
+ (extra.closeOnClick == false && extra.closeOnEsc == false
59
+ ? "none"
60
+ : extra.closeOnClick == false
61
+ ? "closerequest"
62
+ : "any")}
63
+ role="alertdialog"
59
64
  {...extra}
60
65
  >
61
- <div class="d">
62
- {#if icon}
63
- <Icon {icon} width="1.5rem" height="1.5rem" />
64
- {/if}
65
- <p class="headline m3-font-headline-small" class:center={icon}>{headline}</p>
66
- <div class="content m3-font-body-medium">
67
- {@render children()}
68
- </div>
69
- <div class="buttons">
70
- {@render buttons()}
71
- </div>
66
+ {#if icon}
67
+ <Icon {icon} width="1.5rem" height="1.5rem" />
68
+ {/if}
69
+ <p class="headline m3-font-headline-small" class:center={icon}>{headline}</p>
70
+ <div class="content m3-font-body-medium">
71
+ {@render children()}
72
72
  </div>
73
+ <form method="dialog" class="buttons">
74
+ {@render buttons()}
75
+ </form>
73
76
  </dialog>
74
77
 
75
78
  <style>
@@ -85,20 +88,15 @@
85
88
  border-radius: var(--m3-dialog-shape);
86
89
  min-width: 17.5rem;
87
90
  max-width: 35rem;
88
- padding: 0;
89
- overflow: auto;
90
- }
91
- .d {
92
- display: flex;
93
- flex-direction: column;
94
91
  padding: 1.5rem;
95
- }
96
- .d > :global(svg) {
97
- color: rgb(var(--m3-scheme-secondary));
92
+ overflow: auto;
93
+ > :global(svg) {
94
+ color: rgb(var(--m3-scheme-secondary));
98
95
 
99
- flex-shrink: 0;
100
- align-self: center;
101
- margin-bottom: 1rem;
96
+ flex-shrink: 0;
97
+ align-self: center;
98
+ margin-bottom: 1rem;
99
+ }
102
100
  }
103
101
  .headline {
104
102
  color: rgb(var(--m3-scheme-on-surface));
@@ -7,9 +7,13 @@ type $$ComponentProps = {
7
7
  buttons: Snippet;
8
8
  children: Snippet;
9
9
  open: boolean;
10
+ /** @deprecated use closedby instead */
10
11
  closeOnEsc?: boolean;
12
+ /** @deprecated use closedby instead */
11
13
  closeOnClick?: boolean;
14
+ /** @deprecated listen to `open` state changes instead of onEsc */
12
15
  onEsc?: () => void;
16
+ /** @deprecated listen to `open` state changes instead of onClick */
13
17
  onClick?: () => void;
14
18
  } & HTMLDialogAttributes;
15
19
  declare const Dialog: import("svelte").Component<$$ComponentProps, {}, "open">;
@@ -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
  }
@@ -38,6 +38,7 @@
38
38
  .m3-container :global(input) {
39
39
  position: absolute;
40
40
  opacity: 0;
41
+ pointer-events: none;
41
42
  }
42
43
 
43
44
  .layer-container {
@@ -56,7 +57,6 @@
56
57
  border-radius: 0.125rem;
57
58
  border: solid 0.125rem currentColor;
58
59
  transition: var(--m3-util-easing-fast);
59
- -webkit-tap-highlight-color: transparent;
60
60
  }
61
61
 
62
62
  svg {
@@ -3,14 +3,15 @@
3
3
  import type { IconifyIcon } from "@iconify/types";
4
4
  import Icon from "../misc/_icon.svelte";
5
5
  import Layer from "../misc/Layer.svelte";
6
- import type { ButtonAttrs } from "../misc/typing-utils";
6
+ import type { LabelAttrs, AnchorAttrs, ButtonAttrs } from "../misc/typing-utils";
7
+
8
+ type ActionProps = LabelAttrs | AnchorAttrs | ButtonAttrs;
7
9
 
8
10
  let {
9
11
  variant,
10
12
  icon,
11
13
  trailingIcon,
12
14
  elevated = false,
13
- disabled = false,
14
15
  selected = false,
15
16
  children,
16
17
  ...extra
@@ -28,20 +29,12 @@
28
29
  icon?: IconifyIcon | undefined;
29
30
  trailingIcon?: IconifyIcon | undefined;
30
31
  elevated?: boolean;
31
- disabled?: boolean;
32
32
  selected?: boolean;
33
33
  children: Snippet;
34
- } & ButtonAttrs = $props();
34
+ } & ActionProps = $props();
35
35
  </script>
36
36
 
37
- <button
38
- type="button"
39
- class="m3-container {variant}"
40
- class:elevated
41
- class:selected
42
- {disabled}
43
- {...extra}
44
- >
37
+ {#snippet content()}
45
38
  <Layer />
46
39
  {#if icon}
47
40
  <Icon {icon} class="leading" />
@@ -50,7 +43,21 @@
50
43
  {#if trailingIcon}
51
44
  <Icon icon={trailingIcon} class="trailing" />
52
45
  {/if}
53
- </button>
46
+ {/snippet}
47
+
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}>
54
+ {@render content()}
55
+ </a>
56
+ {:else}
57
+ <button class="m3-container {variant}" class:elevated class:selected {...extra} type="button">
58
+ {@render content()}
59
+ </button>
60
+ {/if}
54
61
 
55
62
  <style>
56
63
  :root {
@@ -69,7 +76,6 @@
69
76
  border: solid 1px rgb(var(--m3-scheme-outline));
70
77
  position: relative;
71
78
  cursor: pointer;
72
- -webkit-tap-highlight-color: transparent;
73
79
  transition: var(--m3-util-easing-fast);
74
80
  }
75
81
 
@@ -1,6 +1,7 @@
1
1
  import type { Snippet } from "svelte";
2
2
  import type { IconifyIcon } from "@iconify/types";
3
- import type { ButtonAttrs } from "../misc/typing-utils";
3
+ import type { LabelAttrs, AnchorAttrs, ButtonAttrs } from "../misc/typing-utils";
4
+ type ActionProps = LabelAttrs | AnchorAttrs | ButtonAttrs;
4
5
  type $$ComponentProps = {
5
6
  /**
6
7
  * general is filter/suggestion since they're the same.
@@ -15,10 +16,9 @@ type $$ComponentProps = {
15
16
  icon?: IconifyIcon | undefined;
16
17
  trailingIcon?: IconifyIcon | undefined;
17
18
  elevated?: boolean;
18
- disabled?: boolean;
19
19
  selected?: boolean;
20
20
  children: Snippet;
21
- } & ButtonAttrs;
21
+ } & ActionProps;
22
22
  declare const Chip: import("svelte").Component<$$ComponentProps, {}, "">;
23
23
  type Chip = ReturnType<typeof Chip>;
24
24
  export default Chip;
@@ -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
 
@@ -32,6 +32,7 @@
32
32
  .m3-container :global(input) {
33
33
  position: absolute;
34
34
  opacity: 0;
35
+ pointer-events: none;
35
36
  }
36
37
 
37
38
  .layer-container {
@@ -52,7 +53,6 @@
52
53
  border-radius: var(--m3-util-rounding-full);
53
54
  border: solid 0.125rem currentColor;
54
55
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
58
58
  .radio-dot {
@@ -64,7 +64,6 @@
64
64
  border-radius: var(--m3-util-rounding-full);
65
65
  background-color: currentColor;
66
66
  transition: scale var(--m3-util-easing-fast-spatial);
67
- -webkit-tap-highlight-color: transparent;
68
67
  }
69
68
 
70
69
  :global(input:focus-visible) + .layer-container {
@@ -32,6 +32,7 @@
32
32
  .m3-container :global(input) {
33
33
  position: absolute;
34
34
  opacity: 0;
35
+ pointer-events: none;
35
36
  }
36
37
 
37
38
  .layer-container {
@@ -52,7 +53,6 @@
52
53
  border-radius: var(--m3-util-rounding-full);
53
54
  border: solid 0.125rem currentColor;
54
55
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
58
58
  .radio-dot {
@@ -63,7 +63,6 @@
63
63
  scale: 0;
64
64
  border-radius: var(--m3-util-rounding-full);
65
65
  background-color: currentColor;
66
- -webkit-tap-highlight-color: transparent;
67
66
  }
68
67
 
69
68
  :global(input:focus-visible) + .layer-container {
@@ -32,6 +32,7 @@
32
32
  .m3-container :global(input) {
33
33
  position: absolute;
34
34
  opacity: 0;
35
+ pointer-events: none;
35
36
  }
36
37
 
37
38
  .layer-container {
@@ -52,7 +53,6 @@
52
53
  border-radius: var(--m3-util-rounding-full);
53
54
  border: solid 0.125rem currentColor;
54
55
  transition: border var(--m3-util-easing-fast);
55
- -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
58
58
  .radio-dot {
@@ -63,7 +63,6 @@
63
63
  border-radius: var(--m3-util-rounding-full);
64
64
  outline: solid 0 currentColor;
65
65
  transition: var(--m3-util-easing);
66
- -webkit-tap-highlight-color: transparent;
67
66
  }
68
67
 
69
68
  :global(input:focus-visible) + .layer-container {
@@ -0,0 +1,228 @@
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
+ --m3-field-filled-shape: var(--m3-util-rounding-extra-small);
51
+ }
52
+
53
+ .m3-container {
54
+ display: flex;
55
+ flex-direction: column;
56
+ position: relative;
57
+ --secondary-color: rgb(var(--m3-scheme-on-surface-variant));
58
+ &.enabled {
59
+ &:hover {
60
+ --secondary-color: rgb(var(--m3-scheme-on-surface));
61
+ }
62
+ &:focus-within {
63
+ --secondary-color: rgb(var(--m3-scheme-primary));
64
+ select {
65
+ box-shadow: inset 0px -2px var(--secondary-color);
66
+ }
67
+ }
68
+ }
69
+ }
70
+ label {
71
+ position: absolute;
72
+ top: 0.5rem;
73
+ inset-inline: 1rem;
74
+ color: var(--secondary-color);
75
+ pointer-events: none;
76
+ transition: color var(--m3-util-easing-fast);
77
+ }
78
+
79
+ select {
80
+ appearance: none;
81
+ }
82
+ select,
83
+ ::picker(select) {
84
+ appearance: base-select;
85
+ }
86
+
87
+ select {
88
+ display: flex;
89
+ align-items: center;
90
+ height: calc(3.5rem + var(--m3-util-density-term));
91
+ padding-top: calc(
92
+ var(--m3-font-body-small-size, 0.75rem) * var(--m3-font-body-small-height, 1.333)
93
+ );
94
+ padding-inline: 1rem;
95
+
96
+ border-radius: var(--m3-field-filled-shape) var(--m3-field-filled-shape) 0 0;
97
+ background-color: rgb(var(--m3-scheme-surface-container-highest));
98
+ transition:
99
+ background-color var(--m3-util-easing-fast),
100
+ box-shadow var(--m3-util-easing-fast);
101
+
102
+ border: none;
103
+ position: relative;
104
+
105
+ &:enabled {
106
+ cursor: pointer;
107
+ &:hover,
108
+ &:open {
109
+ background-color: color-mix(
110
+ in oklab,
111
+ rgb(var(--m3-scheme-surface-container-highest)),
112
+ currentColor 8%
113
+ );
114
+ }
115
+ &:active {
116
+ background-color: color-mix(
117
+ in oklab,
118
+ rgb(var(--m3-scheme-surface-container-highest)),
119
+ currentColor 12%
120
+ );
121
+ }
122
+ }
123
+
124
+ box-shadow: inset 0px -1px var(--secondary-color);
125
+ }
126
+
127
+ select::picker-icon {
128
+ scale: 1 0.6; /* yes we are squashing the arrow, surely you don't have a problem with that */
129
+ color: var(--secondary-color);
130
+ transition:
131
+ color var(--m3-util-easing-fast),
132
+ rotate var(--m3-util-easing-fast);
133
+ }
134
+ select:open::picker-icon {
135
+ rotate: 180deg;
136
+ }
137
+
138
+ ::picker(select) {
139
+ background-color: rgb(var(--m3-scheme-surface-container));
140
+ box-shadow: var(--m3-util-elevation-2);
141
+ border-radius: var(--m3-menu-shape);
142
+
143
+ box-sizing: border-box;
144
+ height: 0;
145
+ min-height: 0;
146
+ interpolate-size: allow-keywords;
147
+ overflow: hidden;
148
+ transition:
149
+ width var(--m3-util-easing-fast),
150
+ height var(--m3-util-easing-fast),
151
+ display var(--m3-util-duration-fast) allow-discrete,
152
+ overlay var(--m3-util-duration-fast) allow-discrete;
153
+
154
+ border: none;
155
+ cursor: auto;
156
+ }
157
+ select:open::picker(select) {
158
+ width: var(--width);
159
+ height: auto;
160
+ transition:
161
+ width 500ms linear,
162
+ height 500ms var(--m3-util-timing-function-emphasized-decel),
163
+ display 500ms allow-discrete,
164
+ overlay 500ms allow-discrete;
165
+ }
166
+ @starting-style {
167
+ select:open::picker(select) {
168
+ width: calc-size(var(--width), size - 0.001px);
169
+ height: 0;
170
+ }
171
+ }
172
+
173
+ option {
174
+ display: grid;
175
+ grid-template-columns: auto 1fr;
176
+ padding-inline: 1rem;
177
+ padding-block: calc(
178
+ (
179
+ 3rem + var(--m3-util-density-term) -
180
+ (var(--m3-font-body-large-size, 1rem) * var(--m3-font-body-large-height, 1.5))
181
+ ) /
182
+ 2
183
+ );
184
+ &:first-child {
185
+ margin-top: 0.5rem;
186
+ }
187
+ &:last-child {
188
+ margin-bottom: 0.5rem;
189
+ }
190
+
191
+ background-color: transparent;
192
+ &:checked {
193
+ background-color: rgb(var(--m3-scheme-primary-container));
194
+ color: rgb(var(--m3-scheme-on-primary-container));
195
+ }
196
+
197
+ > *,
198
+ > :global(svg) {
199
+ grid-row: 1;
200
+ }
201
+ &::checkmark {
202
+ opacity: 0;
203
+ grid-column: 2;
204
+ }
205
+ &:has(> :global(svg)) {
206
+ grid-template-columns: auto auto 1fr;
207
+ > :global(svg) {
208
+ margin-right: 0.5rem;
209
+ }
210
+ &:not(:checked) > :global(svg) {
211
+ color: rgb(var(--m3-scheme-on-surface-variant));
212
+ }
213
+ &:checked > :global(svg) {
214
+ opacity: 0.8;
215
+ }
216
+ &::checkmark {
217
+ grid-column: 3;
218
+ }
219
+ }
220
+
221
+ transition:
222
+ background-color var(--m3-util-easing-fast),
223
+ color var(--m3-util-easing-fast);
224
+
225
+ position: relative;
226
+ cursor: pointer;
227
+ }
228
+ </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;