m3-svelte 5.4.0 → 5.7.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 +15 -10
- package/package/buttons/Button.svelte.d.ts +6 -6
- package/package/buttons/SplitButton.svelte +4 -4
- package/package/buttons/SplitButton.svelte.d.ts +2 -2
- package/package/containers/Card.svelte +2 -3
- package/package/containers/Card.svelte.d.ts +2 -3
- package/package/containers/Dialog.svelte +35 -37
- package/package/containers/Dialog.svelte.d.ts +4 -0
- package/package/containers/ListItem.svelte +36 -47
- package/package/containers/ListItem.svelte.d.ts +3 -3
- package/package/containers/Snackbar.svelte +2 -2
- package/package/containers/Snackbar.svelte.d.ts +2 -2
- package/package/containers/SnackbarItem.svelte +2 -2
- package/package/containers/SnackbarItem.svelte.d.ts +2 -2
- package/package/forms/Checkbox.svelte +3 -2
- package/package/forms/Checkbox.svelte.d.ts +2 -2
- package/package/forms/Chip.svelte +20 -13
- package/package/forms/Chip.svelte.d.ts +3 -3
- package/package/forms/DateField.svelte +1 -1
- package/package/forms/DateFieldOutlined.svelte +1 -1
- package/package/forms/LinearProgressIndeterminate.svelte +2 -2
- package/package/forms/LinearProgressIndeterminate.svelte.d.ts +2 -2
- package/package/forms/RadioAnim1.svelte +3 -2
- package/package/forms/RadioAnim1.svelte.d.ts +2 -2
- package/package/forms/RadioAnim2.svelte +3 -2
- package/package/forms/RadioAnim2.svelte.d.ts +2 -2
- package/package/forms/RadioAnim3.svelte +3 -2
- package/package/forms/RadioAnim3.svelte.d.ts +2 -2
- package/package/forms/Select.svelte +2 -1
- package/package/forms/SelectOutlined.svelte +3 -3
- package/package/forms/Slider.svelte +127 -147
- package/package/forms/Slider.svelte.d.ts +1 -1
- package/package/forms/SliderTicks.svelte +2 -2
- package/package/forms/SliderTicks.svelte.d.ts +2 -2
- package/package/forms/TextField.svelte +5 -4
- package/package/forms/TextFieldMultiline.svelte +5 -4
- package/package/forms/TextFieldOutlined.svelte +8 -4
- package/package/forms/TextFieldOutlinedMultiline.svelte +8 -4
- package/package/forms/WavyLinearProgress.svelte +5 -7
- package/package/index.d.ts +1 -0
- package/package/index.js +1 -0
- package/package/misc/_icon.svelte +14 -1
- package/package/misc/typing-utils.d.ts +4 -1
- package/package/nav/NavCMLXItem.svelte +4 -2
- package/package/utils/badge.d.ts +11 -0
- package/package/utils/badge.js +30 -0
- package/package.json +10 -10
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
HTMLButtonAttributes,
|
|
4
|
-
HTMLAnchorAttributes,
|
|
5
|
-
HTMLLabelAttributes,
|
|
6
|
-
} from "svelte/elements";
|
|
2
|
+
import type { HTMLButtonAttributes, HTMLAttributes } 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
|
|
12
|
-
|
|
13
|
-
| ({ href: string } & HTMLAnchorAttributes)
|
|
14
|
-
| HTMLButtonAttributes;
|
|
8
|
+
type SummaryAttrs = HTMLAttributes<HTMLElement> & { summary: true };
|
|
9
|
+
type ActionProps = LabelAttrs | AnchorAttrs | SummaryAttrs | HTMLButtonAttributes;
|
|
15
10
|
type Props = {
|
|
16
11
|
variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
|
|
17
12
|
square?: boolean;
|
|
@@ -58,10 +53,20 @@
|
|
|
58
53
|
<Layer />
|
|
59
54
|
{@render children()}
|
|
60
55
|
</a>
|
|
56
|
+
{:else if "summary" in props}
|
|
57
|
+
{@const { variant = "filled", square = false, iconType = "none", children, ...extra } = props}
|
|
58
|
+
<summary
|
|
59
|
+
class="m3-container m3-font-label-large {variant} icon-{iconType}"
|
|
60
|
+
class:square
|
|
61
|
+
{...extra}
|
|
62
|
+
>
|
|
63
|
+
<Layer />
|
|
64
|
+
{@render children()}
|
|
65
|
+
</summary>
|
|
61
66
|
{:else}
|
|
62
67
|
{@const { variant = "filled", square = false, iconType = "none", children, ...extra } = props}
|
|
63
68
|
<button
|
|
64
|
-
type={"onclick" in extra ? "button" :
|
|
69
|
+
type={"onclick" in extra ? "button" : "submit"}
|
|
65
70
|
class="m3-container m3-font-label-large {variant} icon-{iconType}"
|
|
66
71
|
class:square
|
|
67
72
|
{...extra}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { HTMLButtonAttributes,
|
|
1
|
+
import type { HTMLButtonAttributes, HTMLAttributes } from "svelte/elements";
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { LabelAttrs, AnchorAttrs } from "../misc/typing-utils";
|
|
4
|
+
type SummaryAttrs = HTMLAttributes<HTMLElement> & {
|
|
5
|
+
summary: true;
|
|
6
|
+
};
|
|
7
|
+
type ActionProps = LabelAttrs | AnchorAttrs | SummaryAttrs | HTMLButtonAttributes;
|
|
8
8
|
type Props = {
|
|
9
9
|
variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
|
|
10
10
|
square?: boolean;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
4
|
import Layer from "../misc/Layer.svelte";
|
|
5
5
|
import Icon from "../misc/_icon.svelte";
|
|
6
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
6
7
|
|
|
7
8
|
let {
|
|
8
9
|
variant,
|
|
@@ -10,15 +11,14 @@
|
|
|
10
11
|
y = "down",
|
|
11
12
|
children,
|
|
12
13
|
menu,
|
|
13
|
-
|
|
14
|
+
...extra
|
|
14
15
|
}: {
|
|
15
16
|
variant: "elevated" | "filled" | "tonal" | "outlined";
|
|
16
17
|
x?: "inner" | "right";
|
|
17
18
|
y?: "down" | "up";
|
|
18
19
|
children: Snippet;
|
|
19
20
|
menu: Snippet;
|
|
20
|
-
|
|
21
|
-
} = $props();
|
|
21
|
+
} & ButtonAttrs = $props();
|
|
22
22
|
|
|
23
23
|
const autoclose = (node: HTMLDetailsElement) => {
|
|
24
24
|
const close = (e: Event) => {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<div class="m3-container {variant}">
|
|
39
|
-
<button type="button" class="split m3-font-label-large" {
|
|
39
|
+
<button type="button" class="split m3-font-label-large" {...extra}>
|
|
40
40
|
<Layer />
|
|
41
41
|
{@render children()}
|
|
42
42
|
</button>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
variant: "elevated" | "filled" | "tonal" | "outlined";
|
|
4
5
|
x?: "inner" | "right";
|
|
5
6
|
y?: "down" | "up";
|
|
6
7
|
children: Snippet;
|
|
7
8
|
menu: Snippet;
|
|
8
|
-
|
|
9
|
-
};
|
|
9
|
+
} & ButtonAttrs;
|
|
10
10
|
declare const SplitButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
11
|
type SplitButton = ReturnType<typeof SplitButton>;
|
|
12
12
|
export default SplitButton;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
3
|
import Layer from "../misc/Layer.svelte";
|
|
5
|
-
import type { ButtonAttrs,
|
|
4
|
+
import type { ButtonAttrs, DivAttrs } from "../misc/typing-utils";
|
|
6
5
|
|
|
7
|
-
type ActionProps = ButtonAttrs |
|
|
6
|
+
type ActionProps = ButtonAttrs | DivAttrs;
|
|
8
7
|
|
|
9
8
|
let props: {
|
|
10
9
|
variant: "elevated" | "filled" | "outlined";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type ActionProps = ButtonAttrs | NotButton<HTMLAttributes<HTMLDivElement>>;
|
|
2
|
+
import type { ButtonAttrs, DivAttrs } from "../misc/typing-utils";
|
|
3
|
+
type ActionProps = ButtonAttrs | DivAttrs;
|
|
5
4
|
type $$ComponentProps = {
|
|
6
5
|
variant: "elevated" | "filled" | "outlined";
|
|
7
6
|
children: Snippet;
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
buttons,
|
|
11
11
|
children,
|
|
12
12
|
open = $bindable(),
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
97
|
-
|
|
92
|
+
overflow: auto;
|
|
93
|
+
> :global(svg) {
|
|
94
|
+
color: rgb(var(--m3-scheme-secondary));
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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">;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAnchorAttributes,
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
4
4
|
import Layer from "../misc/Layer.svelte";
|
|
5
|
-
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
5
|
+
import type { ButtonAttrs, DivAttrs, NotButton } from "../misc/typing-utils";
|
|
6
6
|
|
|
7
7
|
type ActionProps =
|
|
8
|
-
|
|
|
8
|
+
| DivAttrs
|
|
9
9
|
| ButtonAttrs
|
|
10
10
|
| ({ label: true } & NotButton<HTMLLabelAttributes>)
|
|
11
11
|
| ({ href: string } & NotButton<HTMLAnchorAttributes>);
|
|
12
12
|
|
|
13
|
-
let
|
|
13
|
+
let {
|
|
14
|
+
leading,
|
|
15
|
+
overline = "",
|
|
16
|
+
headline = "",
|
|
17
|
+
supporting = "",
|
|
18
|
+
trailing,
|
|
19
|
+
lines = overline && supporting ? 3 : overline || supporting ? 2 : 1,
|
|
20
|
+
...props
|
|
21
|
+
}: {
|
|
14
22
|
leading?: Snippet;
|
|
15
23
|
overline?: string;
|
|
16
24
|
headline?: string;
|
|
@@ -18,19 +26,9 @@
|
|
|
18
26
|
trailing?: Snippet;
|
|
19
27
|
lines?: number;
|
|
20
28
|
} & ActionProps = $props();
|
|
21
|
-
let _lines = $derived(
|
|
22
|
-
props.lines ||
|
|
23
|
-
(props.overline && props.supporting ? 3 : props.overline || props.supporting ? 2 : 1),
|
|
24
|
-
);
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
|
-
{#snippet content(
|
|
28
|
-
leading: Snippet | undefined,
|
|
29
|
-
overline: string,
|
|
30
|
-
headline: string,
|
|
31
|
-
supporting: string,
|
|
32
|
-
trailing: Snippet | undefined,
|
|
33
|
-
)}
|
|
31
|
+
{#snippet content()}
|
|
34
32
|
{#if leading}
|
|
35
33
|
<div class="leading">
|
|
36
34
|
{@render leading()}
|
|
@@ -53,38 +51,29 @@
|
|
|
53
51
|
{/if}
|
|
54
52
|
{/snippet}
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
...
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
<Layer />
|
|
80
|
-
{@render content(leading, overline, headline, supporting, trailing)}
|
|
81
|
-
</a>
|
|
82
|
-
{:else}
|
|
83
|
-
{@const { leading, overline = "", headline = "", supporting = "", trailing, ...extra } = props}
|
|
84
|
-
<div class="m3-container lines-{_lines}" {...extra}>
|
|
85
|
-
{@render content(leading, overline, headline, supporting, trailing)}
|
|
86
|
-
</div>
|
|
87
|
-
{/if}
|
|
54
|
+
<li style:display="contents">
|
|
55
|
+
{#if "label" in props}
|
|
56
|
+
{@const { label: _, ...extra } = props}
|
|
57
|
+
<label class="m3-container focus-inset lines-{lines}" {...extra}>
|
|
58
|
+
<Layer />
|
|
59
|
+
{@render content()}
|
|
60
|
+
</label>
|
|
61
|
+
{:else if "onclick" in props}
|
|
62
|
+
<button type="button" class="m3-container focus-inset lines-{lines}" {...props}>
|
|
63
|
+
<Layer />
|
|
64
|
+
{@render content()}
|
|
65
|
+
</button>
|
|
66
|
+
{:else if "href" in props}
|
|
67
|
+
<a class="m3-container focus-inset lines-{lines}" {...props}>
|
|
68
|
+
<Layer />
|
|
69
|
+
{@render content()}
|
|
70
|
+
</a>
|
|
71
|
+
{:else}
|
|
72
|
+
<div class="m3-container lines-{lines}" {...props}>
|
|
73
|
+
{@render content()}
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
76
|
+
</li>
|
|
88
77
|
|
|
89
78
|
<style>
|
|
90
79
|
.m3-container {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { HTMLAnchorAttributes,
|
|
3
|
-
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
4
|
-
type ActionProps =
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
3
|
+
import type { ButtonAttrs, DivAttrs, NotButton } from "../misc/typing-utils";
|
|
4
|
+
type ActionProps = DivAttrs | ButtonAttrs | ({
|
|
5
5
|
label: true;
|
|
6
6
|
} & NotButton<HTMLLabelAttributes>) | ({
|
|
7
7
|
href: string;
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
<script lang="ts">
|
|
16
16
|
import { onDestroy, type ComponentProps } from "svelte";
|
|
17
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
18
17
|
import { fade } from "svelte/transition";
|
|
19
18
|
import iconX from "@ktibow/iconset-material-symbols/close";
|
|
20
19
|
import Icon from "../misc/_icon.svelte";
|
|
21
20
|
import SnackbarItem from "./SnackbarItem.svelte";
|
|
22
21
|
import Layer from "../misc/Layer.svelte";
|
|
22
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
23
23
|
|
|
24
24
|
type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}: {
|
|
31
31
|
config?: SnackbarConfig;
|
|
32
32
|
closeButtonTitle?: string;
|
|
33
|
-
} &
|
|
33
|
+
} & DivAttrs = $props();
|
|
34
34
|
export const show = ({ message, actions = {}, closable = false, timeout = 4000 }: SnackbarIn) => {
|
|
35
35
|
snackbar = { message, actions, closable, timeout };
|
|
36
36
|
clearTimeout(timeoutId);
|
|
@@ -5,13 +5,13 @@ export type SnackbarIn = {
|
|
|
5
5
|
timeout?: number | null;
|
|
6
6
|
};
|
|
7
7
|
import { type ComponentProps } from "svelte";
|
|
8
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
9
8
|
import SnackbarItem from "./SnackbarItem.svelte";
|
|
9
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
10
10
|
type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
|
|
11
11
|
type $$ComponentProps = {
|
|
12
12
|
config?: SnackbarConfig;
|
|
13
13
|
closeButtonTitle?: string;
|
|
14
|
-
} &
|
|
14
|
+
} & DivAttrs;
|
|
15
15
|
declare const Snackbar: import("svelte").Component<$$ComponentProps, {
|
|
16
16
|
show: ({ message, actions, closable, timeout }: SnackbarIn) => void;
|
|
17
17
|
}, "">;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
2
3
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
4
|
|
|
5
|
-
let { children, ...extra }: { children: Snippet } &
|
|
5
|
+
let { children, ...extra }: { children: Snippet } & DivAttrs = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<div class="m3-container" {...extra}>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
1
2
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
children: Snippet;
|
|
5
|
-
} &
|
|
5
|
+
} & DivAttrs;
|
|
6
6
|
declare const SnackbarItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type SnackbarItem = ReturnType<typeof SnackbarItem>;
|
|
8
8
|
export default SnackbarItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
3
|
import Layer from "../misc/Layer.svelte";
|
|
4
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
5
5
|
|
|
6
6
|
// MUST BE WRAPPED IN A <label>
|
|
7
7
|
let {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
...extra
|
|
10
10
|
}: {
|
|
11
11
|
children: Snippet;
|
|
12
|
-
} &
|
|
12
|
+
} & DivAttrs = $props();
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<div class="m3-container" {...extra}>
|
|
@@ -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 {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
children: Snippet;
|
|
5
|
-
} &
|
|
5
|
+
} & DivAttrs;
|
|
6
6
|
declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
8
8
|
export default Checkbox;
|
|
@@ -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
|
-
} &
|
|
34
|
+
} & ActionProps = $props();
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
|
-
|
|
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
|
-
|
|
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 {
|
|
@@ -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
|
-
} &
|
|
21
|
+
} & ActionProps;
|
|
22
22
|
declare const Chip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
23
23
|
type Chip = ReturnType<typeof Chip>;
|
|
24
24
|
export default Chip;
|
|
@@ -69,7 +69,7 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
69
69
|
{...extra}
|
|
70
70
|
defaultValue={extra.defaultValue}
|
|
71
71
|
/>
|
|
72
|
-
<!-- TODO: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
72
|
+
<!-- TODO/deprecated: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
73
73
|
<label class="m3-font-body-small" for={id}>{label}</label>
|
|
74
74
|
<button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
|
|
75
75
|
<Layer />
|
|
@@ -69,7 +69,7 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
69
69
|
{...extra}
|
|
70
70
|
defaultValue={extra.defaultValue}
|
|
71
71
|
/>
|
|
72
|
-
<!-- TODO: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
72
|
+
<!-- TODO/deprecated: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
73
73
|
<div class="layer"></div>
|
|
74
74
|
<label class="m3-font-body-small" for={id}>{label}</label>
|
|
75
75
|
<button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
@deprecated use LoadingIndicator or one of the Estimate components instead
|
|
4
4
|
-->
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import type {
|
|
6
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
7
7
|
|
|
8
|
-
let extra:
|
|
8
|
+
let extra: DivAttrs = $props();
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<div class="m3-container" role="progressbar" {...extra}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
2
2
|
/** @deprecated use LoadingIndicator or one of the Estimate components instead */
|
|
3
|
-
declare const LinearProgressIndeterminate: import("svelte").Component<
|
|
3
|
+
declare const LinearProgressIndeterminate: import("svelte").Component<DivAttrs, {}, "">;
|
|
4
4
|
type LinearProgressIndeterminate = ReturnType<typeof LinearProgressIndeterminate>;
|
|
5
5
|
export default LinearProgressIndeterminate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
3
|
import Layer from "../misc/Layer.svelte";
|
|
4
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
5
5
|
|
|
6
6
|
// MUST BE WRAPPED IN A <label>
|
|
7
7
|
let {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
...extra
|
|
10
10
|
}: {
|
|
11
11
|
children: Snippet;
|
|
12
|
-
} &
|
|
12
|
+
} & DivAttrs = $props();
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<div class="m3-container" {...extra}>
|
|
@@ -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 {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DivAttrs } from "../misc/typing-utils";
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
children: Snippet;
|
|
5
|
-
} &
|
|
5
|
+
} & DivAttrs;
|
|
6
6
|
declare const RadioAnim1: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type RadioAnim1 = ReturnType<typeof RadioAnim1>;
|
|
8
8
|
export default RadioAnim1;
|