m3-svelte 6.0.4 → 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/{misc → etc}/colors.d.ts +2 -2
- package/package/{misc → etc}/colors.js +28 -17
- 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/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 -5
- package/package/forms/DateFieldOutlined.svelte +9 -5
- 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/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 +22 -30
- package/package/forms/_picker/Item.svelte +1 -5
- 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/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 +35 -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/recommended-styles.css +0 -41
- package/package/misc/utils.d.ts +0 -3
- package/package/misc/utils.js +0 -37
- /package/package/{misc → etc}/unocss-preset.d.ts +0 -0
- /package/package/{misc → etc}/unocss-preset.js +0 -0
|
@@ -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(),
|
|
@@ -34,53 +33,57 @@
|
|
|
34
33
|
<div>
|
|
35
34
|
<button
|
|
36
35
|
type="button"
|
|
37
|
-
class="arrow"
|
|
36
|
+
class="arrow m3-layer"
|
|
38
37
|
onclick={() => (focusedMonth = prevMonth)}
|
|
39
38
|
title={getShortMonth(prevMonth)}
|
|
40
39
|
>
|
|
41
|
-
<
|
|
42
|
-
<Icon icon={iconLeft} />
|
|
40
|
+
<Icon icon={iconLeft} size={24} />
|
|
43
41
|
</button>
|
|
44
|
-
<button
|
|
45
|
-
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
class="chooser m3-layer"
|
|
45
|
+
onclick={monthClick}
|
|
46
|
+
disabled={currentView == "year"}
|
|
47
|
+
>
|
|
46
48
|
{getShortMonth(focusedMonth)}
|
|
47
|
-
<Icon icon={iconDown} />
|
|
49
|
+
<Icon icon={iconDown} size={18} style="margin-inline: 0.5rem -0.25rem" />
|
|
48
50
|
</button>
|
|
49
51
|
<button
|
|
50
52
|
type="button"
|
|
51
|
-
class="arrow"
|
|
53
|
+
class="arrow m3-layer"
|
|
52
54
|
onclick={() => (focusedMonth = nextMonth)}
|
|
53
55
|
title={getShortMonth(nextMonth)}
|
|
54
56
|
>
|
|
55
|
-
<
|
|
56
|
-
<Icon icon={iconRight} />
|
|
57
|
+
<Icon icon={iconRight} size={24} />
|
|
57
58
|
</button>
|
|
58
59
|
</div>
|
|
59
60
|
<div>
|
|
60
61
|
<button
|
|
61
62
|
type="button"
|
|
62
|
-
class="arrow"
|
|
63
|
+
class="arrow m3-layer"
|
|
63
64
|
disabled={focusedYear <= startYear}
|
|
64
65
|
onclick={() => (focusedYear = prevYear)}
|
|
65
66
|
title={prevYear.toString()}
|
|
66
67
|
>
|
|
67
|
-
<
|
|
68
|
-
<Icon icon={iconLeft} />
|
|
68
|
+
<Icon icon={iconLeft} size={24} />
|
|
69
69
|
</button>
|
|
70
|
-
<button
|
|
71
|
-
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
class="chooser m3-layer"
|
|
73
|
+
onclick={yearClick}
|
|
74
|
+
disabled={currentView == "month"}
|
|
75
|
+
>
|
|
72
76
|
{focusedYear}
|
|
73
|
-
<Icon icon={iconDown} />
|
|
77
|
+
<Icon icon={iconDown} size={18} style="margin-inline: 0.5rem -0.25rem" />
|
|
74
78
|
</button>
|
|
75
79
|
<button
|
|
76
80
|
type="button"
|
|
77
|
-
class="arrow"
|
|
81
|
+
class="arrow m3-layer"
|
|
78
82
|
disabled={focusedYear >= endYear}
|
|
79
83
|
title={nextYear.toString()}
|
|
80
84
|
onclick={() => (focusedYear = nextYear)}
|
|
81
85
|
>
|
|
82
|
-
<
|
|
83
|
-
<Icon icon={iconRight} />
|
|
86
|
+
<Icon icon={iconRight} size={24} />
|
|
84
87
|
</button>
|
|
85
88
|
</div>
|
|
86
89
|
</div>
|
|
@@ -107,7 +110,6 @@
|
|
|
107
110
|
border: none;
|
|
108
111
|
padding: 0;
|
|
109
112
|
cursor: pointer;
|
|
110
|
-
position: relative;
|
|
111
113
|
}
|
|
112
114
|
button:disabled {
|
|
113
115
|
cursor: auto;
|
|
@@ -118,19 +120,9 @@
|
|
|
118
120
|
@apply --m3-label-large;
|
|
119
121
|
flex-grow: 1;
|
|
120
122
|
}
|
|
121
|
-
.chooser :global(svg) {
|
|
122
|
-
width: 1.125rem;
|
|
123
|
-
height: 1.125rem;
|
|
124
|
-
margin-right: -0.25rem;
|
|
125
|
-
margin-left: 0.5rem;
|
|
126
|
-
}
|
|
127
123
|
.arrow {
|
|
128
124
|
width: 3rem;
|
|
129
125
|
}
|
|
130
|
-
.arrow :global(svg) {
|
|
131
|
-
width: 1.5rem;
|
|
132
|
-
height: 1.5rem;
|
|
133
|
-
}
|
|
134
126
|
|
|
135
127
|
.choosing {
|
|
136
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,8 +14,7 @@
|
|
|
16
14
|
} = $props();
|
|
17
15
|
</script>
|
|
18
16
|
|
|
19
|
-
<button type="button" class="item" {disabled} class:today class:selected {onclick}>
|
|
20
|
-
<Layer />
|
|
17
|
+
<button type="button" class="item m3-layer" {disabled} class:today class:selected {onclick}>
|
|
21
18
|
{label}
|
|
22
19
|
</button>
|
|
23
20
|
|
|
@@ -36,7 +33,6 @@
|
|
|
36
33
|
border: none;
|
|
37
34
|
cursor: pointer;
|
|
38
35
|
transition: var(--m3-easing-fast);
|
|
39
|
-
position: relative;
|
|
40
36
|
}
|
|
41
37
|
button:disabled {
|
|
42
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)",
|
|
@@ -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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
2
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
-
import type { AnchorAttrs } from "../misc/typing-utils";
|
|
4
|
-
type ActionProps = AnchorAttrs | HTMLButtonAttributes
|
|
3
|
+
import type { AnchorAttrs, NotLink } from "../misc/typing-utils";
|
|
4
|
+
type ActionProps = AnchorAttrs | NotLink<HTMLButtonAttributes>;
|
|
5
5
|
type $$ComponentProps = {
|
|
6
6
|
variant: "compact" | "medium" | "large" | "extra-large" | "auto";
|
|
7
7
|
icon: IconifyIcon;
|
package/package/nav/Tabs.svelte
CHANGED
|
@@ -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
|
|
|
7
6
|
let {
|
|
8
7
|
secondary = false,
|
|
@@ -26,8 +25,7 @@
|
|
|
26
25
|
{#each items as item}
|
|
27
26
|
{@const id = name + item.value}
|
|
28
27
|
<input type="radio" {name} {id} value={item.value} bind:group={tab} {...extra} />
|
|
29
|
-
<label for={id} class:tall={item.icon}>
|
|
30
|
-
<Layer />
|
|
28
|
+
<label for={id} class:tall={item.icon} class="m3-layer">
|
|
31
29
|
{#if item.icon}
|
|
32
30
|
<Icon icon={item.icon} />
|
|
33
31
|
{/if}
|
|
@@ -61,7 +59,6 @@
|
|
|
61
59
|
white-space: nowrap;
|
|
62
60
|
padding: 0 1rem;
|
|
63
61
|
|
|
64
|
-
position: relative;
|
|
65
62
|
display: flex;
|
|
66
63
|
gap: 0.5rem;
|
|
67
64
|
align-items: center;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
4
|
import Icon from "../misc/Icon.svelte";
|
|
5
|
-
import Layer from "../misc/Layer.svelte";
|
|
6
5
|
|
|
7
6
|
let {
|
|
8
7
|
secondary = false,
|
|
@@ -29,8 +28,13 @@
|
|
|
29
28
|
>
|
|
30
29
|
<div class="divider"></div>
|
|
31
30
|
{#each items as item}
|
|
32
|
-
<a
|
|
33
|
-
|
|
31
|
+
<a
|
|
32
|
+
href={item.href}
|
|
33
|
+
class:tall={item.icon}
|
|
34
|
+
class:selected={item.value == tab}
|
|
35
|
+
class="m3-layer"
|
|
36
|
+
{...extra}
|
|
37
|
+
>
|
|
34
38
|
{#if item.icon}
|
|
35
39
|
<Icon icon={item.icon} />
|
|
36
40
|
{/if}
|
|
@@ -59,7 +63,6 @@
|
|
|
59
63
|
white-space: nowrap;
|
|
60
64
|
padding: 0 1rem;
|
|
61
65
|
|
|
62
|
-
position: relative;
|
|
63
66
|
display: flex;
|
|
64
67
|
gap: 0.5rem;
|
|
65
68
|
align-items: center;
|
|
@@ -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
|
|
|
7
6
|
let {
|
|
8
7
|
secondary = false,
|
|
@@ -85,8 +84,7 @@
|
|
|
85
84
|
oninput={handleInput}
|
|
86
85
|
{...extra}
|
|
87
86
|
/>
|
|
88
|
-
<label for={id} class:tall={item.icon}>
|
|
89
|
-
<Layer />
|
|
87
|
+
<label for={id} class:tall={item.icon} class="m3-layer">
|
|
90
88
|
{#if item.icon}
|
|
91
89
|
<Icon icon={item.icon} />
|
|
92
90
|
{/if}
|
|
@@ -122,7 +120,6 @@
|
|
|
122
120
|
white-space: nowrap;
|
|
123
121
|
padding: 0 1rem;
|
|
124
122
|
|
|
125
|
-
position: relative;
|
|
126
123
|
display: flex;
|
|
127
124
|
gap: 0.5rem;
|
|
128
125
|
align-items: center;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
4
|
import Icon from "../misc/Icon.svelte";
|
|
5
|
-
import Layer from "../misc/Layer.svelte";
|
|
6
5
|
|
|
7
6
|
let {
|
|
8
7
|
secondary = false,
|
|
@@ -87,10 +86,10 @@
|
|
|
87
86
|
href={item.href}
|
|
88
87
|
class:tall={item.icon}
|
|
89
88
|
class:selected={item.value == tab}
|
|
89
|
+
class="m3-layer"
|
|
90
90
|
style:grid-column={i + 1}
|
|
91
91
|
{...extra}
|
|
92
92
|
>
|
|
93
|
-
<Layer />
|
|
94
93
|
{#if item.icon}
|
|
95
94
|
<Icon icon={item.icon} />
|
|
96
95
|
{/if}
|
|
@@ -121,7 +120,6 @@
|
|
|
121
120
|
white-space: nowrap;
|
|
122
121
|
padding: 0 1rem;
|
|
123
122
|
|
|
124
|
-
position: relative;
|
|
125
123
|
display: flex;
|
|
126
124
|
gap: 0.5rem;
|
|
127
125
|
align-items: center;
|