m3-svelte 6.0.3 → 7.0.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.
- package/package/buttons/Button.svelte +39 -33
- package/package/buttons/Button.svelte.d.ts +7 -5
- package/package/buttons/ConnectedButtons.svelte +0 -6
- package/package/buttons/FAB.svelte +1 -4
- package/package/buttons/SplitButton.svelte +3 -6
- package/package/containers/Card.svelte +4 -6
- package/package/containers/ListItem.svelte +25 -20
- package/package/containers/ListItem.svelte.d.ts +7 -6
- package/package/containers/MenuItem.svelte +3 -4
- package/package/containers/Snackbar.svelte +2 -5
- package/package/etc/colors.d.ts +13 -0
- package/package/{misc → etc}/colors.js +36 -23
- package/package/etc/layer.css +38 -0
- package/package/etc/layer.d.ts +1 -0
- package/package/etc/layer.js +142 -0
- package/package/etc/recommended-styles.css +8 -0
- package/package/{misc → etc}/styles.css +75 -47
- package/package/{misc → etc}/tailwind-styles.css +0 -2
- package/package/etc/unocss-preset.d.ts +3 -0
- package/package/etc/unocss-preset.js +85 -0
- package/package/forms/Checkbox.svelte +1 -3
- package/package/forms/Chip.svelte +22 -14
- package/package/forms/Chip.svelte.d.ts +5 -2
- package/package/forms/DateField.svelte +9 -13
- package/package/forms/DateFieldOutlined.svelte +9 -13
- package/package/forms/RadioAnim1.svelte +1 -3
- package/package/forms/RadioAnim2.svelte +1 -3
- package/package/forms/RadioAnim3.svelte +1 -3
- package/package/forms/Select.svelte +4 -7
- package/package/forms/SelectOutlined.svelte +2 -5
- package/package/forms/Slider.svelte +1 -1
- package/package/forms/TextField.svelte +2 -5
- package/package/forms/TextFieldMultiline.svelte +2 -3
- package/package/forms/TextFieldOutlined.svelte +2 -5
- package/package/forms/TextFieldOutlinedMultiline.svelte +2 -3
- package/package/forms/_picker/FocusPicker.svelte +1 -4
- package/package/forms/_picker/Header.svelte +28 -33
- package/package/forms/_picker/Item.svelte +1 -12
- package/package/index.d.ts +3 -7
- package/package/index.js +3 -7
- package/package/misc/animation.js +5 -1
- package/package/misc/badge.js +1 -1
- package/package/misc/easing.js +4 -3
- package/package/misc/typing-utils.d.ts +14 -5
- package/package/nav/NavCMLXItem.svelte +7 -10
- package/package/nav/NavCMLXItem.svelte.d.ts +2 -2
- package/package/nav/Tabs.svelte +1 -4
- package/package/nav/TabsLink.svelte +7 -4
- package/package/nav/VariableTabs.svelte +1 -4
- package/package/nav/VariableTabsLink.svelte +1 -3
- package/package.json +38 -19
- package/package/buttons/TogglePrimitive.svelte +0 -22
- package/package/buttons/TogglePrimitive.svelte.d.ts +0 -11
- package/package/misc/Layer.svelte +0 -213
- package/package/misc/Layer.svelte.d.ts +0 -3
- package/package/misc/colors.d.ts +0 -4
- package/package/misc/recommended-styles.css +0 -41
- package/package/misc/utils.d.ts +0 -6
- package/package/misc/utils.js +0 -39
|
@@ -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,19 +65,16 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
66
65
|
use:clickOutside
|
|
67
66
|
style:--anchor-name="--{id}"
|
|
68
67
|
>
|
|
69
|
-
<input
|
|
70
|
-
type="date"
|
|
71
|
-
class="focus-none"
|
|
72
|
-
{disabled}
|
|
73
|
-
{required}
|
|
74
|
-
{id}
|
|
75
|
-
bind:value
|
|
76
|
-
{...extra}
|
|
77
|
-
/>
|
|
68
|
+
<input type="date" {disabled} {required} {id} bind:value {...extra} />
|
|
78
69
|
<div class="layer"></div>
|
|
79
70
|
<label for={id}>{label}</label>
|
|
80
|
-
<button
|
|
81
|
-
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
class="m3-layer"
|
|
74
|
+
{disabled}
|
|
75
|
+
title={datePickerTitle}
|
|
76
|
+
onclick={() => (picker = !picker)}
|
|
77
|
+
>
|
|
82
78
|
<Icon icon={iconCalendar} size={24} />
|
|
83
79
|
</button>
|
|
84
80
|
{#if picker}
|
|
@@ -128,12 +124,12 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
128
124
|
}
|
|
129
125
|
input {
|
|
130
126
|
@apply --m3-body-large;
|
|
127
|
+
@apply --m3-focus-none;
|
|
131
128
|
position: absolute;
|
|
132
129
|
inset: 0;
|
|
133
130
|
width: 100%;
|
|
134
131
|
height: 100%;
|
|
135
132
|
border: none;
|
|
136
|
-
outline: none;
|
|
137
133
|
|
|
138
134
|
padding: 1rem;
|
|
139
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="
|
|
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 {
|
|
@@ -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,8 +29,7 @@
|
|
|
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="
|
|
34
|
-
<Layer />
|
|
32
|
+
<option {...extra} class="m3-layer">
|
|
35
33
|
{#if icon}
|
|
36
34
|
<Icon {icon} size={24} />
|
|
37
35
|
{/if}
|
|
@@ -118,8 +116,6 @@
|
|
|
118
116
|
color: var(--m3c-on-surface);
|
|
119
117
|
|
|
120
118
|
border: none;
|
|
121
|
-
outline: none;
|
|
122
|
-
position: relative;
|
|
123
119
|
|
|
124
120
|
&:enabled {
|
|
125
121
|
cursor: pointer;
|
|
@@ -173,6 +169,7 @@
|
|
|
173
169
|
}
|
|
174
170
|
|
|
175
171
|
option {
|
|
172
|
+
@apply --m3-focus-inward;
|
|
176
173
|
display: grid;
|
|
177
174
|
grid-template-columns: auto 1fr;
|
|
178
175
|
padding-inline: 1rem;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
4
|
import Icon from "../misc/Icon.svelte";
|
|
5
|
-
import Layer from "../misc/Layer.svelte";
|
|
6
5
|
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
7
6
|
|
|
8
7
|
let {
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
class:error
|
|
36
35
|
>
|
|
37
36
|
<input
|
|
38
|
-
class="focus-none"
|
|
39
37
|
placeholder=" "
|
|
40
38
|
bind:value
|
|
41
39
|
onkeydown={(e) => e.key == "Enter" && enter?.()}
|
|
@@ -51,8 +49,7 @@
|
|
|
51
49
|
{/if}
|
|
52
50
|
{#if trailing}
|
|
53
51
|
{@const { icon, ...extra } = trailing}
|
|
54
|
-
<button type="button" class="trailing" {...extra}>
|
|
55
|
-
<Layer />
|
|
52
|
+
<button type="button" class="trailing m3-layer" {...extra}>
|
|
56
53
|
<Icon {icon} />
|
|
57
54
|
</button>
|
|
58
55
|
{/if}
|
|
@@ -74,12 +71,12 @@
|
|
|
74
71
|
}
|
|
75
72
|
input {
|
|
76
73
|
@apply --m3-body-large;
|
|
74
|
+
@apply --m3-focus-none;
|
|
77
75
|
position: absolute;
|
|
78
76
|
inset: 0;
|
|
79
77
|
width: 100%;
|
|
80
78
|
height: 100%;
|
|
81
79
|
border: none;
|
|
82
|
-
outline: none;
|
|
83
80
|
padding: 1.5rem 1rem 0.5rem 1rem;
|
|
84
81
|
border-radius: var(--m3-field-filled-shape) var(--m3-field-filled-shape) 0 0;
|
|
85
82
|
background-color: var(--m3c-surface-container-highest);
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<div class="m3-container" class:leading-icon={leadingIcon} class:error use:resize>
|
|
40
|
-
<textarea
|
|
41
|
-
></textarea>
|
|
40
|
+
<textarea placeholder=" " bind:value {id} {disabled} {required} {...extra}></textarea>
|
|
42
41
|
<label for={id}>{label}</label>
|
|
43
42
|
<div class="layer"></div>
|
|
44
43
|
{#if leadingIcon}
|
|
@@ -61,12 +60,12 @@
|
|
|
61
60
|
}
|
|
62
61
|
textarea {
|
|
63
62
|
@apply --m3-body-large;
|
|
63
|
+
@apply --m3-focus-none;
|
|
64
64
|
position: absolute;
|
|
65
65
|
inset: 0;
|
|
66
66
|
width: 100%;
|
|
67
67
|
height: 100%;
|
|
68
68
|
border: none;
|
|
69
|
-
outline: none;
|
|
70
69
|
padding: 1.5rem 1rem 0.5rem 1rem;
|
|
71
70
|
border-radius: var(--m3-field-filled-shape) var(--m3-field-filled-shape) 0 0;
|
|
72
71
|
background-color: var(--m3c-surface-container-highest);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
4
|
import Icon from "../misc/Icon.svelte";
|
|
5
|
-
import Layer from "../misc/Layer.svelte";
|
|
6
5
|
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
7
6
|
|
|
8
7
|
let {
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
class:error
|
|
36
35
|
>
|
|
37
36
|
<input
|
|
38
|
-
class="focus-none"
|
|
39
37
|
placeholder=" "
|
|
40
38
|
bind:value
|
|
41
39
|
onkeydown={(e) => e.key == "Enter" && enter?.()}
|
|
@@ -51,8 +49,7 @@
|
|
|
51
49
|
{/if}
|
|
52
50
|
{#if trailing}
|
|
53
51
|
{@const { icon, ...extra } = trailing}
|
|
54
|
-
<button type="button" class="trailing" {...extra}>
|
|
55
|
-
<Layer />
|
|
52
|
+
<button type="button" class="trailing m3-layer" {...extra}>
|
|
56
53
|
<Icon {icon} />
|
|
57
54
|
</button>
|
|
58
55
|
{/if}
|
|
@@ -77,12 +74,12 @@
|
|
|
77
74
|
}
|
|
78
75
|
input {
|
|
79
76
|
@apply --m3-body-large;
|
|
77
|
+
@apply --m3-focus-none;
|
|
80
78
|
position: absolute;
|
|
81
79
|
inset: 0;
|
|
82
80
|
width: 100%;
|
|
83
81
|
height: 100%;
|
|
84
82
|
border: none;
|
|
85
|
-
outline: none;
|
|
86
83
|
padding: 1rem;
|
|
87
84
|
border-radius: var(--m3-field-outlined-shape);
|
|
88
85
|
background-color: transparent;
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<div class="m3-container" class:leading-icon={leadingIcon} class:error use:resize>
|
|
40
|
-
<textarea
|
|
41
|
-
></textarea>
|
|
40
|
+
<textarea placeholder=" " bind:value {id} {disabled} {required} {...extra}></textarea>
|
|
42
41
|
<div class="layer"></div>
|
|
43
42
|
<label for={id}>{label}</label>
|
|
44
43
|
{#if leadingIcon}
|
|
@@ -65,12 +64,12 @@
|
|
|
65
64
|
}
|
|
66
65
|
textarea {
|
|
67
66
|
@apply --m3-body-large;
|
|
67
|
+
@apply --m3-focus-none;
|
|
68
68
|
position: absolute;
|
|
69
69
|
inset: 0;
|
|
70
70
|
width: 100%;
|
|
71
71
|
height: 100%;
|
|
72
72
|
border: none;
|
|
73
|
-
outline: none;
|
|
74
73
|
padding: 1rem;
|
|
75
74
|
border-radius: var(--m3-field-outlined-shape);
|
|
76
75
|
background-color: transparent;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Icon from "../../misc/Icon.svelte";
|
|
3
|
-
import Layer from "../../misc/Layer.svelte";
|
|
4
3
|
import iconCheck from "@ktibow/iconset-material-symbols/check";
|
|
5
4
|
|
|
6
5
|
const conditionalScroll = (node: Element, shouldScroll: boolean) => {
|
|
@@ -16,8 +15,7 @@
|
|
|
16
15
|
|
|
17
16
|
<div class="m3-container">
|
|
18
17
|
{#each options as { name, selected, activate }}
|
|
19
|
-
<button type="button" onclick={activate} use:conditionalScroll={selected}>
|
|
20
|
-
<Layer />
|
|
18
|
+
<button type="button" class="m3-layer" onclick={activate} use:conditionalScroll={selected}>
|
|
21
19
|
{#if selected}
|
|
22
20
|
<Icon icon={iconCheck} />
|
|
23
21
|
{/if}
|
|
@@ -46,7 +44,6 @@
|
|
|
46
44
|
color: var(--m3c-on-surface);
|
|
47
45
|
border: none;
|
|
48
46
|
cursor: pointer;
|
|
49
|
-
position: relative;
|
|
50
47
|
}
|
|
51
48
|
button > :global(svg) {
|
|
52
49
|
width: 1.5rem;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import iconLeft from "@ktibow/iconset-material-symbols/chevron-left";
|
|
4
4
|
import iconRight from "@ktibow/iconset-material-symbols/chevron-right";
|
|
5
5
|
import iconDown from "@ktibow/iconset-material-symbols/arrow-drop-down";
|
|
6
|
-
import Layer from "../../misc/Layer.svelte";
|
|
7
6
|
|
|
8
7
|
let {
|
|
9
8
|
currentView = $bindable(),
|
|
@@ -23,61 +22,68 @@
|
|
|
23
22
|
const monthClick = () => (currentView = currentView == "calendar" ? "month" : "calendar");
|
|
24
23
|
const getShortMonth = (month: number) =>
|
|
25
24
|
new Date(0, month).toLocaleDateString(undefined, { month: "short" });
|
|
25
|
+
|
|
26
|
+
let prevMonth = $derived((focusedMonth - 1 + 12) % 12);
|
|
27
|
+
let nextMonth = $derived((focusedMonth + 1) % 12);
|
|
28
|
+
let prevYear = $derived(focusedYear - 1);
|
|
29
|
+
let nextYear = $derived(focusedYear + 1);
|
|
26
30
|
</script>
|
|
27
31
|
|
|
28
32
|
<div class="m3-container" class:choosing={currentView != "calendar"}>
|
|
29
33
|
<div>
|
|
30
34
|
<button
|
|
31
35
|
type="button"
|
|
32
|
-
class="arrow"
|
|
33
|
-
onclick={() => (focusedMonth =
|
|
36
|
+
class="arrow m3-layer"
|
|
37
|
+
onclick={() => (focusedMonth = prevMonth)}
|
|
38
|
+
title={getShortMonth(prevMonth)}
|
|
34
39
|
>
|
|
35
|
-
<
|
|
36
|
-
<Icon icon={iconLeft} />
|
|
40
|
+
<Icon icon={iconLeft} size={24} />
|
|
37
41
|
</button>
|
|
38
42
|
<button
|
|
39
43
|
type="button"
|
|
40
|
-
class="chooser"
|
|
44
|
+
class="chooser m3-layer"
|
|
41
45
|
onclick={monthClick}
|
|
42
46
|
disabled={currentView == "year"}
|
|
43
47
|
>
|
|
44
|
-
<Layer />
|
|
45
48
|
{getShortMonth(focusedMonth)}
|
|
46
|
-
<Icon icon={iconDown} />
|
|
49
|
+
<Icon icon={iconDown} size={18} style="margin-inline: 0.5rem -0.25rem" />
|
|
47
50
|
</button>
|
|
48
|
-
<button
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
class="arrow m3-layer"
|
|
54
|
+
onclick={() => (focusedMonth = nextMonth)}
|
|
55
|
+
title={getShortMonth(nextMonth)}
|
|
56
|
+
>
|
|
57
|
+
<Icon icon={iconRight} size={24} />
|
|
51
58
|
</button>
|
|
52
59
|
</div>
|
|
53
60
|
<div>
|
|
54
61
|
<button
|
|
55
62
|
type="button"
|
|
56
|
-
class="arrow"
|
|
63
|
+
class="arrow m3-layer"
|
|
57
64
|
disabled={focusedYear <= startYear}
|
|
58
|
-
onclick={() => focusedYear
|
|
65
|
+
onclick={() => (focusedYear = prevYear)}
|
|
66
|
+
title={prevYear.toString()}
|
|
59
67
|
>
|
|
60
|
-
<
|
|
61
|
-
<Icon icon={iconLeft} />
|
|
68
|
+
<Icon icon={iconLeft} size={24} />
|
|
62
69
|
</button>
|
|
63
70
|
<button
|
|
64
71
|
type="button"
|
|
65
|
-
class="chooser"
|
|
72
|
+
class="chooser m3-layer"
|
|
66
73
|
onclick={yearClick}
|
|
67
74
|
disabled={currentView == "month"}
|
|
68
75
|
>
|
|
69
|
-
<Layer />
|
|
70
76
|
{focusedYear}
|
|
71
|
-
<Icon icon={iconDown} />
|
|
77
|
+
<Icon icon={iconDown} size={18} style="margin-inline: 0.5rem -0.25rem" />
|
|
72
78
|
</button>
|
|
73
79
|
<button
|
|
74
80
|
type="button"
|
|
75
|
-
class="arrow"
|
|
81
|
+
class="arrow m3-layer"
|
|
76
82
|
disabled={focusedYear >= endYear}
|
|
77
|
-
|
|
83
|
+
title={nextYear.toString()}
|
|
84
|
+
onclick={() => (focusedYear = nextYear)}
|
|
78
85
|
>
|
|
79
|
-
<
|
|
80
|
-
<Icon icon={iconRight} />
|
|
86
|
+
<Icon icon={iconRight} size={24} />
|
|
81
87
|
</button>
|
|
82
88
|
</div>
|
|
83
89
|
</div>
|
|
@@ -104,7 +110,6 @@
|
|
|
104
110
|
border: none;
|
|
105
111
|
padding: 0;
|
|
106
112
|
cursor: pointer;
|
|
107
|
-
position: relative;
|
|
108
113
|
}
|
|
109
114
|
button:disabled {
|
|
110
115
|
cursor: auto;
|
|
@@ -115,19 +120,9 @@
|
|
|
115
120
|
@apply --m3-label-large;
|
|
116
121
|
flex-grow: 1;
|
|
117
122
|
}
|
|
118
|
-
.chooser :global(svg) {
|
|
119
|
-
width: 1.125rem;
|
|
120
|
-
height: 1.125rem;
|
|
121
|
-
margin-right: -0.25rem;
|
|
122
|
-
margin-left: 0.5rem;
|
|
123
|
-
}
|
|
124
123
|
.arrow {
|
|
125
124
|
width: 3rem;
|
|
126
125
|
}
|
|
127
|
-
.arrow :global(svg) {
|
|
128
|
-
width: 1.5rem;
|
|
129
|
-
height: 1.5rem;
|
|
130
|
-
}
|
|
131
126
|
|
|
132
127
|
.choosing {
|
|
133
128
|
border-color: var(--m3c-outline-variant);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import Layer from "../../misc/Layer.svelte";
|
|
3
|
-
|
|
4
2
|
let {
|
|
5
3
|
disabled,
|
|
6
4
|
today,
|
|
@@ -16,15 +14,7 @@
|
|
|
16
14
|
} = $props();
|
|
17
15
|
</script>
|
|
18
16
|
|
|
19
|
-
<button
|
|
20
|
-
type="button"
|
|
21
|
-
class="item"
|
|
22
|
-
{disabled}
|
|
23
|
-
class:today
|
|
24
|
-
class:selected
|
|
25
|
-
{onclick}
|
|
26
|
-
>
|
|
27
|
-
<Layer />
|
|
17
|
+
<button type="button" class="item m3-layer" {disabled} class:today class:selected {onclick}>
|
|
28
18
|
{label}
|
|
29
19
|
</button>
|
|
30
20
|
|
|
@@ -43,7 +33,6 @@
|
|
|
43
33
|
border: none;
|
|
44
34
|
cursor: pointer;
|
|
45
35
|
transition: var(--m3-easing-fast);
|
|
46
|
-
position: relative;
|
|
47
36
|
}
|
|
48
37
|
button:disabled {
|
|
49
38
|
cursor: auto;
|
package/package/index.d.ts
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
export * from "./misc/animation.js";
|
|
2
|
+
export * from "./misc/badge.js";
|
|
1
3
|
export { default as ChipChooser } from "./misc/ChipChooser.svelte";
|
|
2
4
|
export { default as Divider } from "./misc/Divider.svelte";
|
|
5
|
+
export * from "./misc/easing.js";
|
|
3
6
|
export { default as Icon } from "./misc/Icon.svelte";
|
|
4
|
-
export { default as Layer } from "./misc/Layer.svelte";
|
|
5
|
-
export * from "./misc/animation.js";
|
|
6
|
-
export * from "./misc/colors.js";
|
|
7
7
|
export * from "./misc/shapes.js";
|
|
8
8
|
export * from "./misc/shapesAnimatable.js";
|
|
9
|
-
export * from "./misc/utils.js";
|
|
10
|
-
export * from "./misc/easing.js";
|
|
11
|
-
export * from "./misc/badge.js";
|
|
12
9
|
export { default as Button } from "./buttons/Button.svelte";
|
|
13
10
|
export { default as ConnectedButtons } from "./buttons/ConnectedButtons.svelte";
|
|
14
11
|
export { default as FAB } from "./buttons/FAB.svelte";
|
|
15
12
|
export { default as SplitButton } from "./buttons/SplitButton.svelte";
|
|
16
|
-
export { default as TogglePrimitive } from "./buttons/TogglePrimitive.svelte";
|
|
17
13
|
export { default as BottomSheet } from "./containers/BottomSheet.svelte";
|
|
18
14
|
export { default as Card } from "./containers/Card.svelte";
|
|
19
15
|
export { default as Dialog } from "./containers/Dialog.svelte";
|
package/package/index.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
export * from "./misc/animation.js";
|
|
2
|
+
export * from "./misc/badge.js";
|
|
1
3
|
export { default as ChipChooser } from "./misc/ChipChooser.svelte";
|
|
2
4
|
export { default as Divider } from "./misc/Divider.svelte";
|
|
5
|
+
export * from "./misc/easing.js";
|
|
3
6
|
export { default as Icon } from "./misc/Icon.svelte";
|
|
4
|
-
export { default as Layer } from "./misc/Layer.svelte";
|
|
5
|
-
export * from "./misc/animation.js";
|
|
6
|
-
export * from "./misc/colors.js";
|
|
7
7
|
export * from "./misc/shapes.js";
|
|
8
8
|
export * from "./misc/shapesAnimatable.js";
|
|
9
|
-
export * from "./misc/utils.js";
|
|
10
|
-
export * from "./misc/easing.js";
|
|
11
|
-
export * from "./misc/badge.js";
|
|
12
9
|
export { default as Button } from "./buttons/Button.svelte";
|
|
13
10
|
export { default as ConnectedButtons } from "./buttons/ConnectedButtons.svelte";
|
|
14
11
|
export { default as FAB } from "./buttons/FAB.svelte";
|
|
15
12
|
export { default as SplitButton } from "./buttons/SplitButton.svelte";
|
|
16
|
-
export { default as TogglePrimitive } from "./buttons/TogglePrimitive.svelte";
|
|
17
13
|
export { default as BottomSheet } from "./containers/BottomSheet.svelte";
|
|
18
14
|
export { default as Card } from "./containers/Card.svelte";
|
|
19
15
|
export { default as Dialog } from "./containers/Dialog.svelte";
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { easeEmphasized } from "./easing";
|
|
2
|
-
|
|
2
|
+
const parseSize = (size) => (size.endsWith("px")
|
|
3
|
+
? +size.slice(0, -2)
|
|
4
|
+
: size.endsWith("rem")
|
|
5
|
+
? +size.slice(0, -3) * 16
|
|
6
|
+
: null) || 0;
|
|
3
7
|
const getBackgroundColor = (node, defaultColor) => {
|
|
4
8
|
if (!defaultColor) {
|
|
5
9
|
const tmp = document.createElement("div");
|
package/package/misc/badge.js
CHANGED
|
@@ -12,7 +12,7 @@ export const addBadge = (icon, n) => {
|
|
|
12
12
|
`<!--badge--><foreignObject x="${x}" y="${y}" width="40" height="16">` +
|
|
13
13
|
`<div style="${[
|
|
14
14
|
"font-size:0.688rem",
|
|
15
|
-
"letter-spacing:0.031rem",
|
|
15
|
+
// "letter-spacing:0.031rem",
|
|
16
16
|
"font-weight:500",
|
|
17
17
|
"background-color:var(--m3c-error)",
|
|
18
18
|
"color:var(--m3c-on-error)",
|
package/package/misc/easing.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// TODO: update for Expressive
|
|
2
2
|
const createBezierLUT = (points, pointCount = 100) => {
|
|
3
3
|
const lut = [];
|
|
4
|
-
for (let
|
|
4
|
+
for (let n = 0; n <= pointCount; n++) {
|
|
5
|
+
const t = n / pointCount;
|
|
5
6
|
const a = (1 - t) * (1 - t) * (1 - t);
|
|
6
7
|
const b = (1 - t) * (1 - t) * t;
|
|
7
8
|
const c = (1 - t) * t * t;
|
|
@@ -16,9 +17,9 @@ const createEase = (lutOptions) => {
|
|
|
16
17
|
let lut;
|
|
17
18
|
return (t) => {
|
|
18
19
|
if (!lut)
|
|
19
|
-
lut = lutOptions.
|
|
20
|
+
lut = lutOptions.flatMap((args) => createBezierLUT(args));
|
|
20
21
|
const closestPoint = lut.find((p) => p[0] >= t);
|
|
21
|
-
const closestY = closestPoint
|
|
22
|
+
const closestY = closestPoint[1];
|
|
22
23
|
return closestY;
|
|
23
24
|
};
|
|
24
25
|
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { HTMLLabelAttributes, HTMLAnchorAttributes, HTMLButtonAttributes, HTMLAttributes } from "svelte/elements";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type
|
|
6
|
-
|
|
2
|
+
type MakeRequired<T, K extends keyof T> = Omit<T, K> & {
|
|
3
|
+
[P in K]-?: NonNullable<T[P]>;
|
|
4
|
+
};
|
|
5
|
+
export type NotButton<T> = Omit<T, "onclick"> & {
|
|
6
|
+
onclick?: undefined;
|
|
7
|
+
};
|
|
8
|
+
export type NotLink<T> = T & {
|
|
9
|
+
href?: undefined;
|
|
10
|
+
};
|
|
11
|
+
export type ButtonAttrs = MakeRequired<NotLink<HTMLButtonAttributes>, "onclick">;
|
|
12
|
+
export type LabelAttrs = MakeRequired<NotLink<NotButton<HTMLLabelAttributes>>, "for">;
|
|
13
|
+
export type AnchorAttrs = MakeRequired<NotButton<HTMLAnchorAttributes>, "href">;
|
|
14
|
+
export type DivAttrs = NotLink<NotButton<HTMLAttributes<HTMLDivElement>>>;
|
|
15
|
+
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
|
-
import type { AnchorAttrs } from "../misc/typing-utils";
|
|
4
|
+
import type { AnchorAttrs, NotLink } from "../misc/typing-utils";
|
|
5
5
|
import Icon from "../misc/Icon.svelte";
|
|
6
|
-
import Layer from "../misc/Layer.svelte";
|
|
7
6
|
|
|
8
|
-
type ActionProps = AnchorAttrs | HTMLButtonAttributes
|
|
7
|
+
type ActionProps = AnchorAttrs | NotLink<HTMLButtonAttributes>;
|
|
9
8
|
let {
|
|
10
9
|
variant,
|
|
11
10
|
icon,
|
|
@@ -20,10 +19,9 @@
|
|
|
20
19
|
} & ActionProps = $props();
|
|
21
20
|
</script>
|
|
22
21
|
|
|
23
|
-
{#if
|
|
22
|
+
{#if props.href != undefined}
|
|
24
23
|
<a class="m3-container {variant}" {...props}>
|
|
25
|
-
<div class="content" class:selected>
|
|
26
|
-
<Layer />
|
|
24
|
+
<div class="content m3-layer" class:selected>
|
|
27
25
|
<div class="icon">
|
|
28
26
|
<Icon {icon} size={24} />
|
|
29
27
|
</div>
|
|
@@ -32,8 +30,7 @@
|
|
|
32
30
|
</a>
|
|
33
31
|
{:else}
|
|
34
32
|
<button type="button" class="m3-container {variant}" disabled={selected} {...props}>
|
|
35
|
-
<div class="content" class:selected>
|
|
36
|
-
<Layer />
|
|
33
|
+
<div class="content m3-layer" class:selected>
|
|
37
34
|
<div class="icon">
|
|
38
35
|
<Icon {icon} size={24} />
|
|
39
36
|
</div>
|
|
@@ -83,7 +80,8 @@
|
|
|
83
80
|
height: 2rem;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
|
-
|
|
83
|
+
&::after,
|
|
84
|
+
> :global(.active-ripple) {
|
|
87
85
|
display: none;
|
|
88
86
|
}
|
|
89
87
|
}
|
|
@@ -141,7 +139,6 @@
|
|
|
141
139
|
display: flex;
|
|
142
140
|
gap: 0.25rem;
|
|
143
141
|
align-items: center;
|
|
144
|
-
position: relative;
|
|
145
142
|
color: var(--m3c-on-surface-variant);
|
|
146
143
|
transition: var(--m3-easing);
|
|
147
144
|
}
|