m3-svelte 5.15.5 → 6.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 +137 -131
- package/package/buttons/ConnectedButtons.svelte +1 -1
- package/package/buttons/FAB.svelte +27 -20
- package/package/buttons/SplitButton.svelte +26 -19
- package/package/containers/BottomSheet.svelte +7 -7
- package/package/containers/Card.svelte +12 -12
- package/package/containers/Dialog.svelte +33 -44
- package/package/containers/Dialog.svelte.d.ts +0 -8
- package/package/containers/ListItem.svelte +43 -11
- package/package/containers/Menu.svelte +3 -3
- package/package/containers/MenuItem.svelte +13 -6
- package/package/containers/Snackbar.svelte +49 -45
- package/package/containers/Snackbar.svelte.d.ts +4 -17
- package/package/containers/SnackbarItem.svelte +6 -6
- package/package/containers/StandardSideSheet.svelte +11 -2
- package/package/forms/Checkbox.svelte +12 -12
- package/package/forms/Chip.svelte +28 -18
- package/package/forms/CircularProgress.svelte +3 -3
- package/package/forms/CircularProgressEstimate.svelte +2 -2
- package/package/forms/DateField.svelte +30 -18
- package/package/forms/DateFieldOutlined.svelte +39 -27
- package/package/forms/DatePickerDocked.svelte +2 -2
- package/package/forms/LinearProgress.svelte +5 -5
- package/package/forms/LinearProgressEstimate.svelte +4 -4
- package/package/forms/LoadingIndicator.svelte +4 -4
- package/package/forms/RadioAnim1.svelte +9 -9
- package/package/forms/RadioAnim2.svelte +9 -9
- package/package/forms/RadioAnim3.svelte +9 -9
- package/package/forms/Select.svelte +43 -35
- package/package/forms/SelectOutlined.svelte +44 -36
- package/package/forms/Slider.svelte +35 -30
- package/package/forms/Switch.svelte +27 -28
- package/package/forms/TextField.svelte +41 -29
- package/package/forms/TextFieldMultiline.svelte +41 -29
- package/package/forms/TextFieldOutlined.svelte +41 -29
- package/package/forms/TextFieldOutlinedMultiline.svelte +41 -29
- package/package/forms/WavyLinearProgress.svelte +2 -7
- package/package/forms/WavyLinearProgressEstimate.svelte +2 -7
- package/package/forms/_picker/CalendarPicker.svelte +9 -2
- package/package/forms/_picker/FocusPicker.svelte +9 -7
- package/package/forms/_picker/Header.svelte +12 -5
- package/package/forms/_picker/Item.svelte +15 -8
- package/package/index.d.ts +4 -8
- package/package/index.js +4 -7
- package/package/{utils → misc}/Divider.svelte +1 -1
- package/package/misc/Icon.svelte +0 -4
- package/package/misc/Layer.svelte +1 -1
- package/package/{utils → misc}/badge.js +8 -5
- package/package/misc/recommended-styles.css +9 -9
- package/package/misc/styles.css +160 -227
- package/package/misc/tailwind-styles.css +199 -107
- package/package/misc/utils.js +2 -4
- package/package/nav/NavCMLX.svelte +65 -29
- package/package/nav/NavCMLX.svelte.d.ts +1 -1
- package/package/nav/NavCMLXItem.svelte +359 -188
- package/package/nav/NavCMLXItem.svelte.d.ts +4 -7
- package/package/nav/Tabs.svelte +19 -10
- package/package/nav/TabsLink.svelte +19 -10
- package/package/nav/VariableTabs.svelte +18 -9
- package/package/nav/VariableTabsLink.svelte +18 -9
- package/package.json +16 -13
- package/package/containers/NewSnackbar.svelte +0 -113
- package/package/containers/NewSnackbar.svelte.d.ts +0 -7
- package/package/forms/CircularProgressIndeterminate.svelte +0 -62
- package/package/forms/CircularProgressIndeterminate.svelte.d.ts +0 -5
- package/package/forms/LinearProgressIndeterminate.svelte +0 -57
- package/package/forms/LinearProgressIndeterminate.svelte.d.ts +0 -5
- package/package/forms/SliderTicks.svelte +0 -12
- package/package/forms/SliderTicks.svelte.d.ts +0 -18
- /package/package/{utils → misc}/ChipChooser.svelte +0 -0
- /package/package/{utils → misc}/ChipChooser.svelte.d.ts +0 -0
- /package/package/{utils → misc}/Divider.svelte.d.ts +0 -0
- /package/package/{utils → misc}/badge.d.ts +0 -0
|
@@ -18,14 +18,6 @@
|
|
|
18
18
|
buttons: Snippet;
|
|
19
19
|
children: Snippet;
|
|
20
20
|
open: boolean;
|
|
21
|
-
/** @deprecated use closedby instead */
|
|
22
|
-
closeOnEsc?: boolean;
|
|
23
|
-
/** @deprecated use closedby instead */
|
|
24
|
-
closeOnClick?: boolean;
|
|
25
|
-
/** @deprecated listen to `open` state changes instead of onEsc */
|
|
26
|
-
onEsc?: () => void;
|
|
27
|
-
/** @deprecated listen to `open` state changes instead of onClick */
|
|
28
|
-
onClick?: () => void;
|
|
29
21
|
} & HTMLDialogAttributes = $props();
|
|
30
22
|
|
|
31
23
|
let dialog: HTMLDialogElement | undefined = $state();
|
|
@@ -41,33 +33,16 @@
|
|
|
41
33
|
ontoggle={(e) => {
|
|
42
34
|
open = e.newState == "open";
|
|
43
35
|
}}
|
|
44
|
-
oncancel={(e) => {
|
|
45
|
-
if (e.target != e.currentTarget) return;
|
|
46
|
-
if (extra.closeOnEsc && extra.onEsc) {
|
|
47
|
-
extra.onEsc();
|
|
48
|
-
}
|
|
49
|
-
}}
|
|
50
|
-
onclick={(e) => {
|
|
51
|
-
if (e.target != e.currentTarget) return;
|
|
52
|
-
if (extra.closeOnClick && extra.onClick) {
|
|
53
|
-
extra.onClick();
|
|
54
|
-
}
|
|
55
|
-
}}
|
|
56
36
|
bind:this={dialog}
|
|
57
|
-
|
|
58
|
-
(extra.closeOnClick == false && extra.closeOnEsc == false
|
|
59
|
-
? "none"
|
|
60
|
-
: extra.closeOnClick == false
|
|
61
|
-
? "closerequest"
|
|
62
|
-
: "any")}
|
|
37
|
+
{closedby}
|
|
63
38
|
role="alertdialog"
|
|
64
39
|
{...extra}
|
|
65
40
|
>
|
|
66
41
|
{#if icon}
|
|
67
42
|
<Icon {icon} size={24} />
|
|
68
43
|
{/if}
|
|
69
|
-
<p class="headline
|
|
70
|
-
<div class="content
|
|
44
|
+
<p class="headline" class:center={icon}>{headline}</p>
|
|
45
|
+
<div class="content">
|
|
71
46
|
{@render children()}
|
|
72
47
|
</div>
|
|
73
48
|
<form method="dialog" class="buttons">
|
|
@@ -78,14 +53,14 @@
|
|
|
78
53
|
<style>
|
|
79
54
|
@layer tokens {
|
|
80
55
|
:root {
|
|
81
|
-
--m3-dialog-shape: var(--m3-
|
|
56
|
+
--m3-dialog-shape: var(--m3-shape-extra-large);
|
|
82
57
|
}
|
|
83
58
|
}
|
|
84
59
|
dialog {
|
|
85
60
|
display: flex;
|
|
86
61
|
flex-direction: column;
|
|
87
|
-
background-color:
|
|
88
|
-
--
|
|
62
|
+
background-color: var(--m3c-surface-container-high);
|
|
63
|
+
--m3v-background: var(--m3c-surface-container-high);
|
|
89
64
|
border: none;
|
|
90
65
|
border-radius: var(--m3-dialog-shape);
|
|
91
66
|
min-width: 17.5rem;
|
|
@@ -93,7 +68,7 @@
|
|
|
93
68
|
padding: 1.5rem;
|
|
94
69
|
overflow: auto;
|
|
95
70
|
> :global(svg) {
|
|
96
|
-
color:
|
|
71
|
+
color: var(--m3c-secondary);
|
|
97
72
|
|
|
98
73
|
flex-shrink: 0;
|
|
99
74
|
align-self: center;
|
|
@@ -101,7 +76,14 @@
|
|
|
101
76
|
}
|
|
102
77
|
}
|
|
103
78
|
.headline {
|
|
104
|
-
|
|
79
|
+
|
|
80
|
+
font-family: var(--m3-font);
|
|
81
|
+
font-size: 1.5rem;
|
|
82
|
+
line-height: 1.333;
|
|
83
|
+
letter-spacing: 0;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
|
|
86
|
+
color: var(--m3c-on-surface);
|
|
105
87
|
margin-top: 0;
|
|
106
88
|
margin-bottom: 1rem;
|
|
107
89
|
}
|
|
@@ -109,7 +91,14 @@
|
|
|
109
91
|
text-align: center;
|
|
110
92
|
}
|
|
111
93
|
.content {
|
|
112
|
-
|
|
94
|
+
|
|
95
|
+
font-family: var(--m3-font);
|
|
96
|
+
font-size: 0.875rem;
|
|
97
|
+
line-height: 1.429;
|
|
98
|
+
letter-spacing: 0.016rem;
|
|
99
|
+
font-weight: 400;
|
|
100
|
+
|
|
101
|
+
color: var(--m3c-on-surface-variant);
|
|
113
102
|
margin-bottom: 1.5rem;
|
|
114
103
|
}
|
|
115
104
|
.buttons {
|
|
@@ -125,31 +114,31 @@
|
|
|
125
114
|
visibility: hidden;
|
|
126
115
|
pointer-events: none;
|
|
127
116
|
transition:
|
|
128
|
-
opacity var(--m3-
|
|
129
|
-
visibility var(--m3-
|
|
117
|
+
opacity var(--m3-easing-fast),
|
|
118
|
+
visibility var(--m3-easing-fast);
|
|
130
119
|
}
|
|
131
120
|
dialog[open] {
|
|
132
121
|
opacity: 1;
|
|
133
122
|
visibility: visible;
|
|
134
123
|
pointer-events: auto;
|
|
135
124
|
animation:
|
|
136
|
-
dialogIn var(--m3-
|
|
137
|
-
opacity var(--m3-
|
|
125
|
+
dialogIn var(--m3-timing-function-emphasized-decel) 500ms,
|
|
126
|
+
opacity var(--m3-timing-function-emphasized-decel) 100ms backwards;
|
|
138
127
|
}
|
|
139
128
|
dialog[open] .headline {
|
|
140
|
-
animation: opacity var(--m3-
|
|
129
|
+
animation: opacity var(--m3-easing-fast);
|
|
141
130
|
}
|
|
142
131
|
dialog[open] .content {
|
|
143
|
-
animation: opacity var(--m3-
|
|
132
|
+
animation: opacity var(--m3-easing-fast) 50ms backwards;
|
|
144
133
|
}
|
|
145
134
|
dialog[open] .buttons {
|
|
146
135
|
animation:
|
|
147
|
-
buttonsIn var(--m3-
|
|
148
|
-
opacity var(--m3-
|
|
136
|
+
buttonsIn var(--m3-timing-function-emphasized-decel) 500ms,
|
|
137
|
+
opacity var(--m3-easing-fast) 100ms backwards;
|
|
149
138
|
}
|
|
150
139
|
dialog::backdrop {
|
|
151
|
-
background-color:
|
|
152
|
-
animation: opacity var(--m3-
|
|
140
|
+
background-color: oklab(from var(--m3c-scrim) l a b / 0.3);
|
|
141
|
+
animation: opacity var(--m3-timing-function-emphasized-decel) 500ms;
|
|
153
142
|
}
|
|
154
143
|
@keyframes dialogIn {
|
|
155
144
|
0% {
|
|
@@ -7,14 +7,6 @@ type $$ComponentProps = {
|
|
|
7
7
|
buttons: Snippet;
|
|
8
8
|
children: Snippet;
|
|
9
9
|
open: boolean;
|
|
10
|
-
/** @deprecated use closedby instead */
|
|
11
|
-
closeOnEsc?: boolean;
|
|
12
|
-
/** @deprecated use closedby instead */
|
|
13
|
-
closeOnClick?: boolean;
|
|
14
|
-
/** @deprecated listen to `open` state changes instead of onEsc */
|
|
15
|
-
onEsc?: () => void;
|
|
16
|
-
/** @deprecated listen to `open` state changes instead of onClick */
|
|
17
|
-
onClick?: () => void;
|
|
18
10
|
} & HTMLDialogAttributes;
|
|
19
11
|
declare const Dialog: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
20
12
|
type Dialog = ReturnType<typeof Dialog>;
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
<div class="body">
|
|
38
38
|
{#if overline}
|
|
39
39
|
<!-- Renamed to not conflict with Tailwind -->
|
|
40
|
-
<p class="overline-
|
|
40
|
+
<p class="overline-">{overline}</p>
|
|
41
41
|
{/if}
|
|
42
|
-
<p class="headline
|
|
42
|
+
<p class="headline">{headline}</p>
|
|
43
43
|
{#if supporting}
|
|
44
|
-
<p class="supporting
|
|
44
|
+
<p class="supporting">{supporting}</p>
|
|
45
45
|
{/if}
|
|
46
46
|
</div>
|
|
47
47
|
{#if trailing}
|
|
48
|
-
<div class="trailing
|
|
48
|
+
<div class="trailing">
|
|
49
49
|
{@render trailing()}
|
|
50
50
|
</div>
|
|
51
51
|
{/if}
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
cursor: pointer;
|
|
94
94
|
}
|
|
95
95
|
.lines-1 {
|
|
96
|
-
height: calc(3.5rem + var(--
|
|
96
|
+
height: calc(3.5rem + (var(--m3v-density) * 0.25rem));
|
|
97
97
|
}
|
|
98
98
|
.lines-2 {
|
|
99
|
-
height: calc(4.5rem + var(--
|
|
99
|
+
height: calc(4.5rem + (var(--m3v-density) * 0.25rem));
|
|
100
100
|
}
|
|
101
101
|
.lines-3 {
|
|
102
|
-
height: calc(5.5rem + var(--
|
|
102
|
+
height: calc(5.5rem + (var(--m3v-density) * 0.25rem));
|
|
103
103
|
padding-top: 0.75rem;
|
|
104
104
|
padding-bottom: 0.75rem;
|
|
105
105
|
align-items: flex-start;
|
|
@@ -110,7 +110,16 @@
|
|
|
110
110
|
.leading,
|
|
111
111
|
.trailing {
|
|
112
112
|
display: contents;
|
|
113
|
-
color:
|
|
113
|
+
color: var(--m3c-on-surface-variant);
|
|
114
|
+
}
|
|
115
|
+
.trailing {
|
|
116
|
+
|
|
117
|
+
font-family: var(--m3-font);
|
|
118
|
+
font-size: 0.688rem;
|
|
119
|
+
line-height: 1.455;
|
|
120
|
+
letter-spacing: 0.031rem;
|
|
121
|
+
font-weight: 500;
|
|
122
|
+
|
|
114
123
|
}
|
|
115
124
|
.leading > :global(svg),
|
|
116
125
|
.trailing > :global(svg) {
|
|
@@ -122,11 +131,34 @@
|
|
|
122
131
|
p {
|
|
123
132
|
margin: 0;
|
|
124
133
|
}
|
|
125
|
-
.supporting
|
|
134
|
+
.supporting {
|
|
135
|
+
|
|
136
|
+
font-family: var(--m3-font);
|
|
137
|
+
font-size: 0.875rem;
|
|
138
|
+
line-height: 1.429;
|
|
139
|
+
letter-spacing: 0.016rem;
|
|
140
|
+
font-weight: 400;
|
|
141
|
+
|
|
142
|
+
color: var(--m3c-on-surface-variant);
|
|
143
|
+
}
|
|
126
144
|
.overline- {
|
|
127
|
-
|
|
145
|
+
|
|
146
|
+
font-family: var(--m3-font);
|
|
147
|
+
font-size: 0.688rem;
|
|
148
|
+
line-height: 1.455;
|
|
149
|
+
letter-spacing: 0.031rem;
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
|
|
152
|
+
color: var(--m3c-on-surface-variant);
|
|
128
153
|
}
|
|
129
154
|
.headline {
|
|
130
|
-
|
|
155
|
+
|
|
156
|
+
font-family: var(--m3-font);
|
|
157
|
+
font-size: 1rem;
|
|
158
|
+
line-height: 1.5;
|
|
159
|
+
letter-spacing: 0;
|
|
160
|
+
font-weight: 400;
|
|
161
|
+
|
|
162
|
+
color: var(--m3c-on-surface);
|
|
131
163
|
}
|
|
132
164
|
</style>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<style>
|
|
12
12
|
@layer tokens {
|
|
13
13
|
:root {
|
|
14
|
-
--m3-menu-shape: var(--m3-
|
|
14
|
+
--m3-menu-shape: var(--m3-shape-extra-small);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
.m3-container {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
border-radius: var(--m3-menu-shape);
|
|
23
23
|
min-width: 7rem;
|
|
24
24
|
max-width: 17.5rem;
|
|
25
|
-
background-color:
|
|
25
|
+
background-color: var(--m3c-surface-container);
|
|
26
26
|
z-index: 2;
|
|
27
|
-
box-shadow: var(--m3-
|
|
27
|
+
box-shadow: var(--m3-elevation-2);
|
|
28
28
|
}
|
|
29
29
|
</style>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
} = $props();
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<button type="button" class="item focus-inset
|
|
20
|
+
<button type="button" class="item focus-inset" {disabled} {onclick}>
|
|
21
21
|
<Layer />
|
|
22
22
|
{#if icon == "space"}
|
|
23
23
|
<span class="icon"></span>
|
|
@@ -31,9 +31,16 @@
|
|
|
31
31
|
|
|
32
32
|
<style>
|
|
33
33
|
.item {
|
|
34
|
+
|
|
35
|
+
font-family: var(--m3-font);
|
|
36
|
+
font-size: 0.875rem;
|
|
37
|
+
line-height: 1.429;
|
|
38
|
+
letter-spacing: 0.006rem;
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
|
|
34
41
|
display: flex;
|
|
35
42
|
align-items: center;
|
|
36
|
-
height: calc(3rem + var(--
|
|
43
|
+
height: calc(3rem + (var(--m3v-density) * 0.25rem));
|
|
37
44
|
padding: 0 0.75rem;
|
|
38
45
|
gap: 0.75rem;
|
|
39
46
|
white-space: nowrap;
|
|
@@ -41,7 +48,7 @@
|
|
|
41
48
|
border: none;
|
|
42
49
|
position: relative;
|
|
43
50
|
background-color: transparent;
|
|
44
|
-
color:
|
|
51
|
+
color: var(--m3c-on-surface);
|
|
45
52
|
|
|
46
53
|
cursor: pointer;
|
|
47
54
|
}
|
|
@@ -52,14 +59,14 @@
|
|
|
52
59
|
.icon > :global(svg) {
|
|
53
60
|
width: 1.5rem;
|
|
54
61
|
height: 1.5rem;
|
|
55
|
-
color:
|
|
62
|
+
color: var(--m3c-on-surface-variant);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
.item:disabled {
|
|
59
|
-
color:
|
|
66
|
+
color: oklab(from var(--m3c-on-surface) l a b / 0.38);
|
|
60
67
|
cursor: auto;
|
|
61
68
|
}
|
|
62
69
|
.item:disabled > .icon > :global(svg) {
|
|
63
|
-
color:
|
|
70
|
+
color: oklab(from var(--m3c-on-surface) l a b / 0.38);
|
|
64
71
|
}
|
|
65
72
|
</style>
|
|
@@ -1,80 +1,70 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@deprecated use NewSnackbar instead
|
|
4
|
-
-->
|
|
5
1
|
<script module lang="ts">
|
|
6
|
-
export
|
|
7
|
-
message: string
|
|
8
|
-
actions?: Record<string, () => void
|
|
9
|
-
closable?: boolean
|
|
2
|
+
export const snackbar = (
|
|
3
|
+
message: string,
|
|
4
|
+
actions?: Record<string, () => void>,
|
|
5
|
+
closable?: boolean,
|
|
10
6
|
/*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
undefined/unset -> 4s timeout
|
|
8
|
+
2000 -> 2s timeout
|
|
9
|
+
-1 -> no timeout
|
|
14
10
|
*/
|
|
15
|
-
timeout?: number
|
|
11
|
+
timeout?: number,
|
|
12
|
+
) => {
|
|
13
|
+
_show(message, actions, closable, timeout);
|
|
16
14
|
};
|
|
15
|
+
let _show: typeof snackbar;
|
|
17
16
|
</script>
|
|
18
17
|
|
|
19
18
|
<script lang="ts">
|
|
20
|
-
import { onDestroy
|
|
19
|
+
import { onDestroy } from "svelte";
|
|
21
20
|
import { fade } from "svelte/transition";
|
|
22
21
|
import iconX from "@ktibow/iconset-material-symbols/close";
|
|
23
22
|
import Icon from "../misc/Icon.svelte";
|
|
24
23
|
import SnackbarItem from "./SnackbarItem.svelte";
|
|
25
24
|
import Layer from "../misc/Layer.svelte";
|
|
26
|
-
import type { DivAttrs } from "../misc/typing-utils";
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}: {
|
|
35
|
-
config?: SnackbarConfig;
|
|
36
|
-
closeButtonTitle?: string;
|
|
37
|
-
} & DivAttrs = $props();
|
|
38
|
-
export const show = ({ message, actions = {}, closable = false, timeout = 4000 }: SnackbarIn) => {
|
|
39
|
-
snackbar = { message, actions, closable, timeout };
|
|
26
|
+
let { closeTitle = "Close" }: { closeTitle?: string } = $props();
|
|
27
|
+
let shown:
|
|
28
|
+
| { message: string; actions: Record<string, () => void>; closable: boolean }
|
|
29
|
+
| undefined = $state();
|
|
30
|
+
let timeoutId: number;
|
|
31
|
+
_show = (message, actions = {}, closable = false, timeout = 4000) => {
|
|
40
32
|
clearTimeout(timeoutId);
|
|
41
|
-
|
|
33
|
+
shown = { message, actions, closable };
|
|
34
|
+
if (timeout && timeout > 0)
|
|
42
35
|
timeoutId = setTimeout(() => {
|
|
43
|
-
|
|
36
|
+
shown = undefined;
|
|
44
37
|
}, timeout);
|
|
45
38
|
};
|
|
46
|
-
|
|
47
|
-
let snackbar: Required<SnackbarIn> | undefined = $state();
|
|
48
|
-
let timeoutId: number;
|
|
49
39
|
onDestroy(() => {
|
|
50
40
|
clearTimeout(timeoutId);
|
|
51
41
|
});
|
|
52
42
|
</script>
|
|
53
43
|
|
|
54
|
-
{#if
|
|
55
|
-
<div class="holder" out:fade={{ duration: 200 }}
|
|
56
|
-
{#key
|
|
57
|
-
<SnackbarItem
|
|
58
|
-
<p
|
|
59
|
-
{#each Object.entries(
|
|
44
|
+
{#if shown}
|
|
45
|
+
<div class="holder" out:fade={{ duration: 200 }}>
|
|
46
|
+
{#key shown}
|
|
47
|
+
<SnackbarItem>
|
|
48
|
+
<p>{shown.message}</p>
|
|
49
|
+
{#each Object.entries(shown.actions) as [key, action]}
|
|
60
50
|
<button
|
|
61
51
|
type="button"
|
|
62
|
-
class="action
|
|
52
|
+
class="action"
|
|
63
53
|
onclick={() => {
|
|
64
|
-
|
|
54
|
+
shown = undefined;
|
|
65
55
|
action();
|
|
66
56
|
}}
|
|
67
57
|
>
|
|
68
58
|
{key}
|
|
69
59
|
</button>
|
|
70
60
|
{/each}
|
|
71
|
-
{#if
|
|
61
|
+
{#if shown.closable}
|
|
72
62
|
<button
|
|
73
63
|
type="button"
|
|
74
64
|
class="close"
|
|
75
|
-
title={
|
|
65
|
+
title={closeTitle}
|
|
76
66
|
onclick={() => {
|
|
77
|
-
|
|
67
|
+
shown = undefined;
|
|
78
68
|
}}
|
|
79
69
|
>
|
|
80
70
|
<Layer />
|
|
@@ -90,12 +80,19 @@
|
|
|
90
80
|
.holder {
|
|
91
81
|
position: fixed;
|
|
92
82
|
padding-bottom: 1rem;
|
|
93
|
-
bottom: var(--
|
|
83
|
+
bottom: var(--m3v-bottom-offset);
|
|
94
84
|
left: 50%;
|
|
95
85
|
transform: translate(-50%, 0);
|
|
96
86
|
z-index: 3;
|
|
97
87
|
}
|
|
98
88
|
p {
|
|
89
|
+
|
|
90
|
+
font-family: var(--m3-font);
|
|
91
|
+
font-size: 0.875rem;
|
|
92
|
+
line-height: 1.429;
|
|
93
|
+
letter-spacing: 0.016rem;
|
|
94
|
+
font-weight: 400;
|
|
95
|
+
|
|
99
96
|
margin-right: auto;
|
|
100
97
|
}
|
|
101
98
|
button {
|
|
@@ -107,6 +104,7 @@
|
|
|
107
104
|
border: none;
|
|
108
105
|
|
|
109
106
|
background-color: transparent;
|
|
107
|
+
color: unset;
|
|
110
108
|
cursor: pointer;
|
|
111
109
|
position: relative;
|
|
112
110
|
}
|
|
@@ -116,11 +114,17 @@
|
|
|
116
114
|
}
|
|
117
115
|
|
|
118
116
|
.action {
|
|
119
|
-
|
|
117
|
+
|
|
118
|
+
font-family: var(--m3-font);
|
|
119
|
+
font-size: 0.875rem;
|
|
120
|
+
line-height: 1.429;
|
|
121
|
+
letter-spacing: 0.006rem;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
|
|
124
|
+
color: var(--m3c-inverse-primary);
|
|
120
125
|
padding: 0 0.5rem;
|
|
121
126
|
}
|
|
122
127
|
.close {
|
|
123
|
-
color: var(--m3-scheme-inverse-on-surface);
|
|
124
128
|
padding: 0 0.75rem;
|
|
125
129
|
margin-right: -1rem;
|
|
126
130
|
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
message: string;
|
|
3
|
-
actions?: Record<string, () => void>;
|
|
4
|
-
closable?: boolean;
|
|
5
|
-
timeout?: number | null;
|
|
6
|
-
};
|
|
7
|
-
import { type ComponentProps } from "svelte";
|
|
8
|
-
import SnackbarItem from "./SnackbarItem.svelte";
|
|
9
|
-
import type { DivAttrs } from "../misc/typing-utils";
|
|
10
|
-
type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
|
|
1
|
+
export declare const snackbar: (message: string, actions?: Record<string, () => void>, closable?: boolean, timeout?: number) => void;
|
|
11
2
|
type $$ComponentProps = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
/** @deprecated use NewSnackbar instead */
|
|
16
|
-
declare const Snackbar: import("svelte").Component<$$ComponentProps, {
|
|
17
|
-
show: ({ message, actions, closable, timeout }: SnackbarIn) => void;
|
|
18
|
-
}, "">;
|
|
3
|
+
closeTitle?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const Snackbar: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
19
6
|
type Snackbar = ReturnType<typeof Snackbar>;
|
|
20
7
|
export default Snackbar;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<style>
|
|
13
13
|
@layer tokens {
|
|
14
14
|
:root {
|
|
15
|
-
--m3-snackbar-shape: var(--m3-
|
|
15
|
+
--m3-snackbar-shape: var(--m3-shape-extra-small);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
.m3-container {
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
max-width: 60rem;
|
|
24
24
|
min-height: 3rem;
|
|
25
25
|
border-radius: var(--m3-snackbar-shape);
|
|
26
|
-
box-shadow: var(--m3-
|
|
27
|
-
background-color:
|
|
28
|
-
color:
|
|
26
|
+
box-shadow: var(--m3-elevation-3);
|
|
27
|
+
background-color: var(--m3c-inverse-surface);
|
|
28
|
+
color: var(--m3c-inverse-on-surface);
|
|
29
29
|
animation:
|
|
30
|
-
snackbarIn var(--m3-
|
|
31
|
-
opacity var(--m3-
|
|
30
|
+
snackbarIn var(--m3-timing-function-emphasized-decel) 500ms,
|
|
31
|
+
opacity var(--m3-timing-function-emphasized-decel) 100ms;
|
|
32
32
|
}
|
|
33
33
|
/*@TODO: Fix animation with different shaping or something*/
|
|
34
34
|
@keyframes snackbarIn {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<div class="m3-container">
|
|
19
19
|
<div class="header">
|
|
20
|
-
<span
|
|
20
|
+
<span>{headline}</span>
|
|
21
21
|
<Button variant="text" iconType="full" onclick={close}>
|
|
22
22
|
<Icon icon={iconX} />
|
|
23
23
|
</Button>
|
|
@@ -36,8 +36,17 @@
|
|
|
36
36
|
justify-content: space-between;
|
|
37
37
|
|
|
38
38
|
padding: 1.5rem;
|
|
39
|
+
}
|
|
40
|
+
.header > span {
|
|
41
|
+
|
|
42
|
+
font-family: var(--m3-font);
|
|
43
|
+
font-size: 1.375rem;
|
|
44
|
+
line-height: 1.273;
|
|
45
|
+
letter-spacing: 0;
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
|
|
39
48
|
}
|
|
40
49
|
.header > :global(button.m3-container) {
|
|
41
|
-
color:
|
|
50
|
+
color: var(--m3c-on-surface-variant);
|
|
42
51
|
}
|
|
43
52
|
</style>
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
inset: -0.6875rem;
|
|
47
47
|
width: 2.5rem;
|
|
48
48
|
height: 2.5rem;
|
|
49
|
-
border-radius: var(--m3-
|
|
50
|
-
color:
|
|
49
|
+
border-radius: var(--m3-shape-full);
|
|
50
|
+
color: var(--m3c-on-surface-variant);
|
|
51
51
|
cursor: pointer;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
inset: 0.6875rem;
|
|
57
57
|
border-radius: 0.125rem;
|
|
58
58
|
border: solid 0.125rem currentColor;
|
|
59
|
-
transition: var(--m3-
|
|
59
|
+
transition: var(--m3-easing-fast);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
svg {
|
|
63
63
|
position: absolute;
|
|
64
64
|
inset: 0;
|
|
65
|
-
color:
|
|
65
|
+
color: var(--m3c-on-primary);
|
|
66
66
|
opacity: 0;
|
|
67
67
|
pointer-events: none;
|
|
68
|
-
transition: var(--m3-
|
|
68
|
+
transition: var(--m3-easing-fast);
|
|
69
69
|
path {
|
|
70
70
|
stroke-dasharray: 20.874 20.874;
|
|
71
71
|
stroke-dashoffset: 20.874;
|
|
@@ -74,26 +74,26 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
:global(input:focus-visible) + .layer-container {
|
|
77
|
-
color:
|
|
77
|
+
color: var(--m3c-on-surface);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
:global(input:checked) + .layer-container {
|
|
81
|
-
color:
|
|
81
|
+
color: var(--m3c-primary);
|
|
82
82
|
}
|
|
83
83
|
:global(input:checked) + .layer-container .checkbox-box {
|
|
84
|
-
background-color:
|
|
84
|
+
background-color: var(--m3c-primary);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
:global(input:checked) ~ svg {
|
|
88
88
|
opacity: 1;
|
|
89
89
|
path {
|
|
90
90
|
stroke-dashoffset: 0;
|
|
91
|
-
transition: stroke-dashoffset var(--m3-
|
|
91
|
+
transition: stroke-dashoffset var(--m3-easing-slow);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
:global(input:disabled) + .layer-container {
|
|
96
|
-
color:
|
|
96
|
+
color: oklab(from var(--m3c-on-surface) l a b / 0.38);
|
|
97
97
|
cursor: not-allowed;
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
color: transparent;
|
|
102
102
|
}
|
|
103
103
|
:global(input:disabled:checked) + .layer-container .checkbox-box {
|
|
104
|
-
background-color:
|
|
104
|
+
background-color: oklab(from var(--m3c-on-surface) l a b / 0.38);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
:global(input:disabled) ~ svg {
|
|
108
|
-
color:
|
|
108
|
+
color: var(--m3c-surface);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.m3-container {
|