m3-svelte 4.6.5 → 5.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 +3 -13
- package/package/buttons/Button.svelte.d.ts +3 -6
- package/package/buttons/FAB.svelte +3 -5
- package/package/buttons/FAB.svelte.d.ts +2 -3
- package/package/buttons/SplitButton.svelte +3 -3
- package/package/buttons/SplitButton.svelte.d.ts +1 -1
- package/package/containers/Card.svelte +9 -10
- package/package/containers/Card.svelte.d.ts +3 -4
- package/package/containers/Dialog.svelte +1 -1
- package/package/containers/ListItem.svelte +9 -21
- package/package/containers/ListItem.svelte.d.ts +5 -6
- package/package/containers/MenuItem.svelte +3 -3
- package/package/containers/MenuItem.svelte.d.ts +1 -1
- package/package/containers/Snackbar.svelte +11 -2
- package/package/containers/Snackbar.svelte.d.ts +1 -0
- package/package/containers/StandardSideSheet.svelte +1 -1
- package/package/forms/Chip.svelte +3 -5
- package/package/forms/Chip.svelte.d.ts +2 -3
- package/package/{utils → forms}/DateField.svelte +14 -11
- package/package/{utils → forms}/DateField.svelte.d.ts +3 -2
- package/package/{utils → forms}/DateFieldOutlined.svelte +16 -15
- package/package/{utils → forms}/DateFieldOutlined.svelte.d.ts +3 -2
- package/package/forms/TextField.svelte +17 -35
- package/package/forms/TextField.svelte.d.ts +5 -8
- package/package/forms/TextFieldMultiline.svelte +4 -6
- package/package/forms/TextFieldOutlined.svelte +17 -38
- package/package/forms/TextFieldOutlined.svelte.d.ts +5 -8
- package/package/forms/TextFieldOutlinedMultiline.svelte +5 -9
- package/package/forms/_picker/Actions.svelte +3 -3
- package/package/forms/_picker/CalendarPicker.svelte +1 -1
- package/package/forms/_picker/FocusPicker.svelte +6 -1
- package/package/forms/_picker/Item.svelte +3 -3
- package/package/forms/_picker/Item.svelte.d.ts +1 -1
- package/package/index.d.ts +2 -2
- package/package/index.js +2 -2
- package/package/misc/_ripple.svelte +4 -4
- package/package/misc/_ripplesimple.svelte +4 -4
- package/package/misc/typing-utils.d.ts +3 -0
- package/package/misc/typing-utils.js +1 -0
- package/package/nav/NavCMLXItem.svelte +1 -0
- package/package/utils/ChipChooser.svelte +1 -1
- package/package.json +1 -1
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
// If you want a toggle button, use `for` with a checkbox input.
|
|
11
11
|
type ActionProps =
|
|
12
|
-
| ({
|
|
12
|
+
| ({ for: string } & HTMLLabelAttributes)
|
|
13
13
|
| ({ href: string } & HTMLAnchorAttributes)
|
|
14
|
-
|
|
|
14
|
+
| HTMLButtonAttributes;
|
|
15
15
|
type Props = {
|
|
16
16
|
variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
|
|
17
17
|
square?: boolean;
|
|
@@ -59,18 +59,8 @@
|
|
|
59
59
|
{@render children()}
|
|
60
60
|
</a>
|
|
61
61
|
{:else}
|
|
62
|
-
{@const {
|
|
63
|
-
variant = "filled",
|
|
64
|
-
click,
|
|
65
|
-
disabled,
|
|
66
|
-
square = false,
|
|
67
|
-
iconType = "none",
|
|
68
|
-
children,
|
|
69
|
-
...extra
|
|
70
|
-
} = props}
|
|
62
|
+
{@const { variant = "filled", square = false, iconType = "none", children, ...extra } = props}
|
|
71
63
|
<button
|
|
72
|
-
onclick={click}
|
|
73
|
-
{disabled}
|
|
74
64
|
class="m3-container m3-font-label-large {variant} icon-{iconType}"
|
|
75
65
|
class:square
|
|
76
66
|
{...extra}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { HTMLButtonAttributes, HTMLAnchorAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
type ActionProps = ({
|
|
4
|
-
click?: () => void;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
} & HTMLButtonAttributes) | ({
|
|
7
|
-
href: string;
|
|
8
|
-
} & HTMLAnchorAttributes) | ({
|
|
9
4
|
for: string;
|
|
10
|
-
} & HTMLLabelAttributes)
|
|
5
|
+
} & HTMLLabelAttributes) | ({
|
|
6
|
+
href: string;
|
|
7
|
+
} & HTMLAnchorAttributes) | HTMLButtonAttributes;
|
|
11
8
|
type Props = {
|
|
12
9
|
variant?: "elevated" | "filled" | "tonal" | "outlined" | "text";
|
|
13
10
|
square?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
4
3
|
import Icon from "../misc/_icon.svelte";
|
|
5
4
|
import Layer from "../misc/Layer.svelte";
|
|
5
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
6
6
|
|
|
7
7
|
type ContentProps =
|
|
8
8
|
| {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
let {
|
|
20
20
|
color = "primary",
|
|
21
21
|
elevation = "normal",
|
|
22
|
-
click,
|
|
23
22
|
size = "normal",
|
|
24
23
|
icon,
|
|
25
24
|
text,
|
|
@@ -33,13 +32,12 @@
|
|
|
33
32
|
| "secondary"
|
|
34
33
|
| "tertiary";
|
|
35
34
|
elevation?: "normal" | "lowered" | "none";
|
|
36
|
-
click: () => void;
|
|
37
35
|
} & ContentProps &
|
|
38
|
-
|
|
36
|
+
ButtonAttrs = $props();
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
<button
|
|
42
|
-
|
|
40
|
+
type="button"
|
|
43
41
|
class="m3-container m3-font-label-large color-{color} size-{size} elevation-{elevation}"
|
|
44
42
|
{...extra}
|
|
45
43
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
3
3
|
type ContentProps = {
|
|
4
4
|
size?: "normal";
|
|
5
5
|
icon?: IconifyIcon;
|
|
@@ -12,8 +12,7 @@ type ContentProps = {
|
|
|
12
12
|
type $$ComponentProps = {
|
|
13
13
|
color?: "primary-container" | "secondary-container" | "tertiary-container" | "primary" | "secondary" | "tertiary";
|
|
14
14
|
elevation?: "normal" | "lowered" | "none";
|
|
15
|
-
|
|
16
|
-
} & ContentProps & HTMLButtonAttributes;
|
|
15
|
+
} & ContentProps & ButtonAttrs;
|
|
17
16
|
declare const Fab: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
18
17
|
type Fab = ReturnType<typeof Fab>;
|
|
19
18
|
export default Fab;
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
y = "down",
|
|
11
11
|
children,
|
|
12
12
|
menu,
|
|
13
|
-
|
|
13
|
+
onclick,
|
|
14
14
|
}: {
|
|
15
15
|
variant: "elevated" | "filled" | "tonal" | "outlined";
|
|
16
16
|
x?: "inner" | "right";
|
|
17
17
|
y?: "down" | "up";
|
|
18
18
|
children: Snippet;
|
|
19
19
|
menu: Snippet;
|
|
20
|
-
|
|
20
|
+
onclick: () => void;
|
|
21
21
|
} = $props();
|
|
22
22
|
|
|
23
23
|
const autoclose = (node: HTMLDetailsElement) => {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<div class="m3-container {variant}">
|
|
39
|
-
<button class="split m3-font-label-large" onclick
|
|
39
|
+
<button type="button" class="split m3-font-label-large" {onclick}>
|
|
40
40
|
<Layer />
|
|
41
41
|
{@render children()}
|
|
42
42
|
</button>
|
|
@@ -5,7 +5,7 @@ type $$ComponentProps = {
|
|
|
5
5
|
y?: "down" | "up";
|
|
6
6
|
children: Snippet;
|
|
7
7
|
menu: Snippet;
|
|
8
|
-
|
|
8
|
+
onclick: () => void;
|
|
9
9
|
};
|
|
10
10
|
declare const SplitButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
11
|
type SplitButton = ReturnType<typeof SplitButton>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLAttributes
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
4
|
import Layer from "../misc/Layer.svelte";
|
|
5
|
+
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
5
6
|
|
|
6
|
-
type ActionProps =
|
|
7
|
-
| ({ click: () => void } & HTMLButtonAttributes)
|
|
8
|
-
| HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
type ActionProps = ButtonAttrs | NotButton<HTMLAttributes<HTMLDivElement>>;
|
|
9
8
|
|
|
10
9
|
let props: {
|
|
11
10
|
variant: "elevated" | "filled" | "outlined";
|
|
@@ -13,9 +12,9 @@
|
|
|
13
12
|
} & ActionProps = $props();
|
|
14
13
|
</script>
|
|
15
14
|
|
|
16
|
-
{#if "
|
|
17
|
-
{@const { variant,
|
|
18
|
-
<button class="m3-container {variant}"
|
|
15
|
+
{#if "onclick" in props}
|
|
16
|
+
{@const { variant, children, ...extra } = props}
|
|
17
|
+
<button type="button" class="m3-container {variant}" {...extra}>
|
|
19
18
|
<Layer />
|
|
20
19
|
{@render children()}
|
|
21
20
|
</button>
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
border: none;
|
|
40
39
|
border-radius: var(--m3-card-shape);
|
|
41
40
|
background-color: rgb(var(--m3-scheme-surface));
|
|
42
|
-
--m3-util-background: var(--m3-scheme-surface);
|
|
41
|
+
--m3-util-background: rgb(var(--m3-scheme-surface));
|
|
43
42
|
color: rgb(var(--m3-scheme-on-surface));
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -61,12 +60,12 @@
|
|
|
61
60
|
|
|
62
61
|
.elevated {
|
|
63
62
|
background-color: rgb(var(--m3-scheme-surface-container-low));
|
|
64
|
-
--m3-util-background: var(--m3-scheme-surface-container-low);
|
|
63
|
+
--m3-util-background: rgb(var(--m3-scheme-surface-container-low));
|
|
65
64
|
box-shadow: var(--m3-util-elevation-1);
|
|
66
65
|
}
|
|
67
66
|
.filled {
|
|
68
67
|
background-color: rgb(var(--m3-scheme-surface-container-highest));
|
|
69
|
-
--m3-util-background: var(--m3-scheme-surface-container-highest);
|
|
68
|
+
--m3-util-background: rgb(var(--m3-scheme-surface-container-highest));
|
|
70
69
|
}
|
|
71
70
|
.outlined {
|
|
72
71
|
border: solid 1px rgb(var(--m3-scheme-outline-variant));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { HTMLAttributes
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
} & HTMLButtonAttributes) | HTMLAttributes<HTMLDivElement>;
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
4
|
+
type ActionProps = ButtonAttrs | NotButton<HTMLAttributes<HTMLDivElement>>;
|
|
6
5
|
type $$ComponentProps = {
|
|
7
6
|
variant: "elevated" | "filled" | "outlined";
|
|
8
7
|
children: Snippet;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
display: flex;
|
|
81
81
|
flex-direction: column;
|
|
82
82
|
background-color: rgb(var(--m3-scheme-surface-container-high));
|
|
83
|
-
--m3-util-background: var(--m3-scheme-surface-container-high);
|
|
83
|
+
--m3-util-background: rgb(var(--m3-scheme-surface-container-high));
|
|
84
84
|
border: none;
|
|
85
85
|
border-radius: var(--m3-dialog-shape);
|
|
86
86
|
min-width: 17.5rem;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type {
|
|
4
|
-
HTMLAnchorAttributes,
|
|
5
|
-
HTMLAttributes,
|
|
6
|
-
HTMLButtonAttributes,
|
|
7
|
-
HTMLLabelAttributes,
|
|
8
|
-
} from "svelte/elements";
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
9
4
|
import Layer from "../misc/Layer.svelte";
|
|
5
|
+
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
10
6
|
|
|
11
7
|
type ActionProps =
|
|
12
|
-
| HTMLAttributes<HTMLDivElement
|
|
13
|
-
|
|
|
14
|
-
| ({ label: true } & HTMLLabelAttributes)
|
|
15
|
-
| ({ href: string } & HTMLAnchorAttributes);
|
|
8
|
+
| NotButton<HTMLAttributes<HTMLDivElement>>
|
|
9
|
+
| ButtonAttrs
|
|
10
|
+
| ({ label: true } & NotButton<HTMLLabelAttributes>)
|
|
11
|
+
| ({ href: string } & NotButton<HTMLAnchorAttributes>);
|
|
16
12
|
|
|
17
13
|
let props: {
|
|
18
14
|
leading?: Snippet;
|
|
@@ -70,17 +66,9 @@
|
|
|
70
66
|
<Layer />
|
|
71
67
|
{@render content(leading, overline, headline, supporting, trailing)}
|
|
72
68
|
</label>
|
|
73
|
-
{:else if "
|
|
74
|
-
{@const {
|
|
75
|
-
|
|
76
|
-
overline = "",
|
|
77
|
-
headline = "",
|
|
78
|
-
supporting = "",
|
|
79
|
-
trailing,
|
|
80
|
-
click,
|
|
81
|
-
...extra
|
|
82
|
-
} = props}
|
|
83
|
-
<button class="m3-container lines-{_lines}" onclick={click} {...extra}>
|
|
69
|
+
{:else if "onclick" in props}
|
|
70
|
+
{@const { leading, overline = "", headline = "", supporting = "", trailing, ...extra } = props}
|
|
71
|
+
<button type="button" class="m3-container lines-{_lines}" {...extra}>
|
|
84
72
|
<Layer />
|
|
85
73
|
{@render content(leading, overline, headline, supporting, trailing)}
|
|
86
74
|
</button>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { HTMLAnchorAttributes, HTMLAttributes,
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
} & HTMLButtonAttributes) | ({
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
3
|
+
import type { ButtonAttrs, NotButton } from "../misc/typing-utils";
|
|
4
|
+
type ActionProps = NotButton<HTMLAttributes<HTMLDivElement>> | ButtonAttrs | ({
|
|
6
5
|
label: true;
|
|
7
|
-
} & HTMLLabelAttributes) | ({
|
|
6
|
+
} & NotButton<HTMLLabelAttributes>) | ({
|
|
8
7
|
href: string;
|
|
9
|
-
} & HTMLAnchorAttributes);
|
|
8
|
+
} & NotButton<HTMLAnchorAttributes>);
|
|
10
9
|
type $$ComponentProps = {
|
|
11
10
|
leading?: Snippet;
|
|
12
11
|
overline?: string;
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
let {
|
|
8
8
|
icon,
|
|
9
9
|
disabled = false,
|
|
10
|
-
|
|
10
|
+
onclick,
|
|
11
11
|
children,
|
|
12
12
|
}: {
|
|
13
13
|
icon?: IconifyIcon | "space" | undefined;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
-
|
|
15
|
+
onclick: () => void;
|
|
16
16
|
children: Snippet;
|
|
17
17
|
} = $props();
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<button class="item m3-font-label-large" {disabled} onclick
|
|
20
|
+
<button type="button" class="item m3-font-label-large" {disabled} {onclick}>
|
|
21
21
|
<Layer />
|
|
22
22
|
{#if icon == "space"}
|
|
23
23
|
<span class="icon"></span>
|
|
@@ -3,7 +3,7 @@ import type { IconifyIcon } from "@iconify/types";
|
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
icon?: IconifyIcon | "space" | undefined;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
|
|
6
|
+
onclick: () => void;
|
|
7
7
|
children: Snippet;
|
|
8
8
|
};
|
|
9
9
|
declare const MenuItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -23,8 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
|
|
25
25
|
|
|
26
|
-
let {
|
|
27
|
-
|
|
26
|
+
let {
|
|
27
|
+
config = {},
|
|
28
|
+
closeButtonTitle = "Close",
|
|
29
|
+
...extra
|
|
30
|
+
}: {
|
|
31
|
+
config?: SnackbarConfig;
|
|
32
|
+
closeButtonTitle?: string;
|
|
33
|
+
} & HTMLAttributes<HTMLDivElement> = $props();
|
|
28
34
|
export const show = ({ message, actions = {}, closable = false, timeout = 4000 }: SnackbarIn) => {
|
|
29
35
|
snackbar = { message, actions, closable, timeout };
|
|
30
36
|
clearTimeout(timeoutId);
|
|
@@ -48,6 +54,7 @@
|
|
|
48
54
|
<p class="m3-font-body-medium">{snackbar.message}</p>
|
|
49
55
|
{#each Object.entries(snackbar.actions) as [key, action]}
|
|
50
56
|
<button
|
|
57
|
+
type="button"
|
|
51
58
|
class="action m3-font-label-large"
|
|
52
59
|
onclick={() => {
|
|
53
60
|
snackbar = undefined;
|
|
@@ -59,7 +66,9 @@
|
|
|
59
66
|
{/each}
|
|
60
67
|
{#if snackbar.closable}
|
|
61
68
|
<button
|
|
69
|
+
type="button"
|
|
62
70
|
class="close"
|
|
71
|
+
title={closeButtonTitle}
|
|
63
72
|
onclick={() => {
|
|
64
73
|
snackbar = undefined;
|
|
65
74
|
}}
|
|
@@ -10,6 +10,7 @@ import SnackbarItem from "./SnackbarItem.svelte";
|
|
|
10
10
|
type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
|
|
11
11
|
type $$ComponentProps = {
|
|
12
12
|
config?: SnackbarConfig;
|
|
13
|
+
closeButtonTitle?: string;
|
|
13
14
|
} & HTMLAttributes<HTMLDivElement>;
|
|
14
15
|
declare const Snackbar: import("svelte").Component<$$ComponentProps, {
|
|
15
16
|
show: ({ message, actions, closable, timeout }: SnackbarIn) => void;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<div class="m3-container">
|
|
19
19
|
<div class="header">
|
|
20
20
|
<span class="m3-font-title-large">{headline}</span>
|
|
21
|
-
<Button variant="text" iconType="full"
|
|
21
|
+
<Button variant="text" iconType="full" onclick={close}>
|
|
22
22
|
<Icon icon={iconX} />
|
|
23
23
|
</Button>
|
|
24
24
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
-
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
3
|
import type { IconifyIcon } from "@iconify/types";
|
|
5
4
|
import Icon from "../misc/_icon.svelte";
|
|
6
5
|
import Layer from "../misc/Layer.svelte";
|
|
6
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
variant,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
disabled = false,
|
|
14
14
|
selected = false,
|
|
15
15
|
children,
|
|
16
|
-
click,
|
|
17
16
|
...extra
|
|
18
17
|
}: {
|
|
19
18
|
/**
|
|
@@ -32,16 +31,15 @@
|
|
|
32
31
|
disabled?: boolean;
|
|
33
32
|
selected?: boolean;
|
|
34
33
|
children: Snippet;
|
|
35
|
-
|
|
36
|
-
} & HTMLButtonAttributes = $props();
|
|
34
|
+
} & ButtonAttrs = $props();
|
|
37
35
|
</script>
|
|
38
36
|
|
|
39
37
|
<button
|
|
38
|
+
type="button"
|
|
40
39
|
class="m3-container {variant}"
|
|
41
40
|
class:elevated
|
|
42
41
|
class:selected
|
|
43
42
|
{disabled}
|
|
44
|
-
onclick={click}
|
|
45
43
|
{...extra}
|
|
46
44
|
>
|
|
47
45
|
<Layer />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
4
4
|
type $$ComponentProps = {
|
|
5
5
|
/**
|
|
6
6
|
* general is filter/suggestion since they're the same.
|
|
@@ -18,8 +18,7 @@ type $$ComponentProps = {
|
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
selected?: boolean;
|
|
20
20
|
children: Snippet;
|
|
21
|
-
|
|
22
|
-
} & HTMLButtonAttributes;
|
|
21
|
+
} & ButtonAttrs;
|
|
23
22
|
declare const Chip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
24
23
|
type Chip = ReturnType<typeof Chip>;
|
|
25
24
|
export default Chip;
|
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
import Icon from "../misc/_icon.svelte";
|
|
7
7
|
import Layer from "../misc/Layer.svelte";
|
|
8
8
|
|
|
9
|
-
import DatePickerDocked from "
|
|
9
|
+
import DatePickerDocked from "./DatePickerDocked.svelte";
|
|
10
10
|
import { easeEmphasized } from "../misc/easing";
|
|
11
11
|
|
|
12
12
|
let {
|
|
13
|
-
label
|
|
14
|
-
|
|
13
|
+
label,
|
|
14
|
+
value = $bindable(),
|
|
15
15
|
required = false,
|
|
16
16
|
disabled = false,
|
|
17
17
|
error = false,
|
|
18
|
+
datePickerTitle = "Pick date",
|
|
18
19
|
...extra
|
|
19
20
|
}: {
|
|
20
21
|
label: string;
|
|
21
|
-
|
|
22
|
+
value?: string;
|
|
22
23
|
required?: boolean;
|
|
23
24
|
disabled?: boolean;
|
|
24
25
|
error?: boolean;
|
|
26
|
+
datePickerTitle?: string;
|
|
25
27
|
} & HTMLInputAttributes = $props();
|
|
26
28
|
|
|
27
29
|
const id = $props.id();
|
|
@@ -54,8 +56,6 @@ transform: scaleY(${(t * 0.3 + 0.7) * 100}%);
|
|
|
54
56
|
opacity: ${Math.min(t * 3, 1)};`,
|
|
55
57
|
};
|
|
56
58
|
};
|
|
57
|
-
|
|
58
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<div class="m3-container" class:has-js={hasJs} class:disabled class:error use:clickOutside>
|
|
@@ -65,21 +65,23 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
65
65
|
{disabled}
|
|
66
66
|
{required}
|
|
67
67
|
{id}
|
|
68
|
-
bind:value
|
|
68
|
+
bind:value
|
|
69
69
|
{...extra}
|
|
70
|
+
defaultValue={extra.defaultValue}
|
|
70
71
|
/>
|
|
72
|
+
<!-- TODO: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
71
73
|
<label class="m3-font-body-small" for={id}>{label}</label>
|
|
72
|
-
<button type="button" {disabled} onclick={() => (picker = !picker)}>
|
|
74
|
+
<button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
|
|
73
75
|
<Layer />
|
|
74
76
|
<Icon icon={iconCalendar} width="1.5rem" height="1.5rem" />
|
|
75
77
|
</button>
|
|
76
78
|
{#if picker}
|
|
77
79
|
<div class="picker" transition:enterExit>
|
|
78
80
|
<DatePickerDocked
|
|
79
|
-
{
|
|
81
|
+
date={value}
|
|
80
82
|
clearable={!required}
|
|
81
83
|
close={() => (picker = false)}
|
|
82
|
-
setDate={(d) => (
|
|
84
|
+
setDate={(d) => (value = d)}
|
|
83
85
|
/>
|
|
84
86
|
</div>
|
|
85
87
|
{/if}
|
|
@@ -127,7 +129,8 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
127
129
|
button {
|
|
128
130
|
display: none;
|
|
129
131
|
position: absolute;
|
|
130
|
-
|
|
132
|
+
padding-left: 0.75rem;
|
|
133
|
+
padding-right: 0.75rem;
|
|
131
134
|
height: 100%;
|
|
132
135
|
right: 0;
|
|
133
136
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
label: string;
|
|
4
|
-
|
|
4
|
+
value?: string;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
error?: boolean;
|
|
8
|
+
datePickerTitle?: string;
|
|
8
9
|
} & HTMLInputAttributes;
|
|
9
|
-
declare const DateField: import("svelte").Component<$$ComponentProps, {}, "
|
|
10
|
+
declare const DateField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
10
11
|
type DateField = ReturnType<typeof DateField>;
|
|
11
12
|
export default DateField;
|
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
import Icon from "../misc/_icon.svelte";
|
|
7
7
|
import Layer from "../misc/Layer.svelte";
|
|
8
8
|
|
|
9
|
-
import DatePickerDocked from "
|
|
9
|
+
import DatePickerDocked from "./DatePickerDocked.svelte";
|
|
10
10
|
import { easeEmphasized } from "../misc/easing";
|
|
11
11
|
|
|
12
12
|
let {
|
|
13
|
-
label
|
|
14
|
-
|
|
13
|
+
label,
|
|
14
|
+
value = $bindable(),
|
|
15
15
|
required = false,
|
|
16
16
|
disabled = false,
|
|
17
17
|
error = false,
|
|
18
|
+
datePickerTitle = "Pick date",
|
|
18
19
|
...extra
|
|
19
20
|
}: {
|
|
20
21
|
label: string;
|
|
21
|
-
|
|
22
|
+
value?: string;
|
|
22
23
|
required?: boolean;
|
|
23
24
|
disabled?: boolean;
|
|
24
25
|
error?: boolean;
|
|
26
|
+
datePickerTitle?: string;
|
|
25
27
|
} & HTMLInputAttributes = $props();
|
|
26
28
|
|
|
27
29
|
const id = $props.id();
|
|
@@ -54,8 +56,6 @@ transform: scaleY(${(t * 0.3 + 0.7) * 100}%);
|
|
|
54
56
|
opacity: ${Math.min(t * 3, 1)};`,
|
|
55
57
|
};
|
|
56
58
|
};
|
|
57
|
-
|
|
58
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
59
59
|
</script>
|
|
60
60
|
|
|
61
61
|
<div class="m3-container" class:has-js={hasJs} class:disabled class:error use:clickOutside>
|
|
@@ -65,22 +65,24 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
65
65
|
{disabled}
|
|
66
66
|
{required}
|
|
67
67
|
{id}
|
|
68
|
-
bind:value
|
|
68
|
+
bind:value
|
|
69
69
|
{...extra}
|
|
70
|
+
defaultValue={extra.defaultValue}
|
|
70
71
|
/>
|
|
72
|
+
<!-- TODO: once https://github.com/sveltejs/svelte/pull/16481 is finished, remove the defaultvalue thing -->
|
|
71
73
|
<div class="layer"></div>
|
|
72
74
|
<label class="m3-font-body-small" for={id}>{label}</label>
|
|
73
|
-
<button type="button" {disabled} onclick={() => (picker = !picker)}>
|
|
75
|
+
<button type="button" {disabled} title={datePickerTitle} onclick={() => (picker = !picker)}>
|
|
74
76
|
<Layer />
|
|
75
77
|
<Icon icon={iconCalendar} width="1.5rem" height="1.5rem" />
|
|
76
78
|
</button>
|
|
77
79
|
{#if picker}
|
|
78
80
|
<div class="picker" transition:enterExit>
|
|
79
81
|
<DatePickerDocked
|
|
80
|
-
{
|
|
82
|
+
date={value}
|
|
81
83
|
clearable={!required}
|
|
82
84
|
close={() => (picker = false)}
|
|
83
|
-
setDate={(d) => (
|
|
85
|
+
setDate={(d) => (value = d)}
|
|
84
86
|
/>
|
|
85
87
|
</div>
|
|
86
88
|
{/if}
|
|
@@ -89,7 +91,7 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
89
91
|
<style>
|
|
90
92
|
/*
|
|
91
93
|
want to customize the label's background?
|
|
92
|
-
do this: <DateFieldOutlined --m3-util-background="var(--m3-scheme-surface-container)" />
|
|
94
|
+
do this: <DateFieldOutlined --m3-util-background="rgb(var(--m3-scheme-surface-container))" />
|
|
93
95
|
*/
|
|
94
96
|
:root {
|
|
95
97
|
--m3-datefield-outlined-shape: var(--m3-util-rounding-extra-small);
|
|
@@ -117,9 +119,7 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
117
119
|
left: 0.75rem;
|
|
118
120
|
top: calc(var(--m3-font-body-small-height, 1rem) * -0.5);
|
|
119
121
|
color: rgb(var(--error, var(--m3-scheme-on-surface-variant)));
|
|
120
|
-
background-color: rgb(
|
|
121
|
-
var(--m3-util-background, var(--m3-scheme-surface))
|
|
122
|
-
); /* TODO: next breaking change, make --m3-util-background a full color and update the comment above */
|
|
122
|
+
background-color: var(--m3-util-background, rgb(var(--m3-scheme-surface)));
|
|
123
123
|
padding: 0 0.25rem;
|
|
124
124
|
&:is(input:hover ~ label) {
|
|
125
125
|
color: rgb(var(--error, var(--m3-scheme-on-surface)));
|
|
@@ -155,7 +155,8 @@ opacity: ${Math.min(t * 3, 1)};`,
|
|
|
155
155
|
button {
|
|
156
156
|
display: none;
|
|
157
157
|
position: absolute;
|
|
158
|
-
|
|
158
|
+
padding-left: 0.75rem;
|
|
159
|
+
padding-right: 0.75rem;
|
|
159
160
|
height: 100%;
|
|
160
161
|
right: 0;
|
|
161
162
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
label: string;
|
|
4
|
-
|
|
4
|
+
value?: string;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
error?: boolean;
|
|
8
|
+
datePickerTitle?: string;
|
|
8
9
|
} & HTMLInputAttributes;
|
|
9
|
-
declare const DateFieldOutlined: import("svelte").Component<$$ComponentProps, {}, "
|
|
10
|
+
declare const DateFieldOutlined: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
10
11
|
type DateFieldOutlined = ReturnType<typeof DateFieldOutlined>;
|
|
11
12
|
export default DateFieldOutlined;
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
|
-
import Icon from "../misc/_icon.svelte";
|
|
4
3
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
trailingIcon: IconifyIcon;
|
|
9
|
-
trailingClick: () => void;
|
|
10
|
-
}
|
|
11
|
-
| {
|
|
12
|
-
trailingIcon?: undefined;
|
|
13
|
-
trailingClick?: undefined;
|
|
14
|
-
};
|
|
4
|
+
import Icon from "../misc/_icon.svelte";
|
|
5
|
+
import Layer from "../misc/Layer.svelte";
|
|
6
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
15
7
|
|
|
16
8
|
let {
|
|
17
|
-
label
|
|
9
|
+
label,
|
|
18
10
|
leadingIcon,
|
|
19
|
-
|
|
20
|
-
trailingClick,
|
|
11
|
+
trailing,
|
|
21
12
|
disabled = false,
|
|
22
13
|
required = false,
|
|
23
14
|
error = false,
|
|
@@ -27,22 +18,20 @@
|
|
|
27
18
|
}: {
|
|
28
19
|
label: string;
|
|
29
20
|
leadingIcon?: IconifyIcon;
|
|
21
|
+
trailing?: { icon: IconifyIcon } & ButtonAttrs;
|
|
30
22
|
disabled?: boolean;
|
|
31
23
|
required?: boolean;
|
|
32
24
|
error?: boolean;
|
|
33
25
|
value?: string;
|
|
34
26
|
enter?: () => void;
|
|
35
|
-
} &
|
|
36
|
-
HTMLInputAttributes = $props();
|
|
27
|
+
} & HTMLInputAttributes = $props();
|
|
37
28
|
const id = $props.id();
|
|
38
|
-
|
|
39
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
40
29
|
</script>
|
|
41
30
|
|
|
42
31
|
<div
|
|
43
32
|
class="m3-container"
|
|
44
33
|
class:leading-icon={leadingIcon}
|
|
45
|
-
class:trailing-icon={
|
|
34
|
+
class:trailing-icon={trailing}
|
|
46
35
|
class:error
|
|
47
36
|
>
|
|
48
37
|
<input
|
|
@@ -62,9 +51,11 @@
|
|
|
62
51
|
{#if leadingIcon}
|
|
63
52
|
<Icon icon={leadingIcon} class="leading" />
|
|
64
53
|
{/if}
|
|
65
|
-
{#if
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
{#if trailing}
|
|
55
|
+
{@const { icon, ...extra } = trailing}
|
|
56
|
+
<button type="button" class="trailing" {...extra}>
|
|
57
|
+
<Layer />
|
|
58
|
+
<Icon {icon} />
|
|
68
59
|
</button>
|
|
69
60
|
{/if}
|
|
70
61
|
</div>
|
|
@@ -88,7 +79,7 @@
|
|
|
88
79
|
height: 100%;
|
|
89
80
|
border: none;
|
|
90
81
|
outline: none;
|
|
91
|
-
padding: 1.
|
|
82
|
+
padding: 1.5rem 1rem 0.5rem 1rem;
|
|
92
83
|
border-radius: var(--m3-textfield-filled-shape) var(--m3-textfield-filled-shape) 0 0;
|
|
93
84
|
background-color: rgb(var(--m3-scheme-surface-container-highest));
|
|
94
85
|
color: rgb(var(--m3-scheme-on-surface));
|
|
@@ -108,10 +99,10 @@
|
|
|
108
99
|
color: rgb(var(--m3-scheme-on-surface) / 0.38);
|
|
109
100
|
}
|
|
110
101
|
&:is(input:focus ~ label, input:not(:placeholder-shown) ~ label) {
|
|
111
|
-
top: 0.
|
|
102
|
+
top: 0.5rem;
|
|
112
103
|
font-size: var(--m3-font-body-small-size, 0.75rem);
|
|
113
|
-
line-height: var(--m3-font-body-small-height, 1);
|
|
114
|
-
letter-spacing: var(--m3-font-body-small-tracking, 0.
|
|
104
|
+
line-height: var(--m3-font-body-small-height, 1.333);
|
|
105
|
+
letter-spacing: var(--m3-font-body-small-tracking, 0.025rem);
|
|
115
106
|
}
|
|
116
107
|
pointer-events: none;
|
|
117
108
|
transition:
|
|
@@ -175,15 +166,6 @@
|
|
|
175
166
|
height: 0.125rem;
|
|
176
167
|
background-color: rgb(var(--error, var(--m3-scheme-primary)));
|
|
177
168
|
}
|
|
178
|
-
@media (hover: hover) {
|
|
179
|
-
button:hover {
|
|
180
|
-
background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.08);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
button:focus-visible,
|
|
184
|
-
button:active {
|
|
185
|
-
background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.12);
|
|
186
|
-
}
|
|
187
169
|
|
|
188
170
|
.leading-icon > input {
|
|
189
171
|
padding-left: 3.25rem;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
type
|
|
4
|
-
trailingIcon: IconifyIcon;
|
|
5
|
-
trailingClick: () => void;
|
|
6
|
-
} | {
|
|
7
|
-
trailingIcon?: undefined;
|
|
8
|
-
trailingClick?: undefined;
|
|
9
|
-
};
|
|
3
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
10
4
|
type $$ComponentProps = {
|
|
11
5
|
label: string;
|
|
12
6
|
leadingIcon?: IconifyIcon;
|
|
7
|
+
trailing?: {
|
|
8
|
+
icon: IconifyIcon;
|
|
9
|
+
} & ButtonAttrs;
|
|
13
10
|
disabled?: boolean;
|
|
14
11
|
required?: boolean;
|
|
15
12
|
error?: boolean;
|
|
16
13
|
value?: string;
|
|
17
14
|
enter?: () => void;
|
|
18
|
-
} &
|
|
15
|
+
} & HTMLInputAttributes;
|
|
19
16
|
declare const TextField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
20
17
|
type TextField = ReturnType<typeof TextField>;
|
|
21
18
|
export default TextField;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
|
-
label
|
|
7
|
+
label,
|
|
8
8
|
leadingIcon,
|
|
9
9
|
disabled = false,
|
|
10
10
|
required = false,
|
|
@@ -34,8 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
<div class="m3-container" class:leading-icon={leadingIcon} class:error use:resize>
|
|
@@ -75,7 +73,7 @@
|
|
|
75
73
|
height: 100%;
|
|
76
74
|
border: none;
|
|
77
75
|
outline: none;
|
|
78
|
-
padding: 1.
|
|
76
|
+
padding: 1.5rem 1rem 0.5rem 1rem;
|
|
79
77
|
border-radius: var(--m3-textfield-filled-shape) var(--m3-textfield-filled-shape) 0 0;
|
|
80
78
|
background-color: rgb(var(--m3-scheme-surface-container-highest));
|
|
81
79
|
color: rgb(var(--m3-scheme-on-surface));
|
|
@@ -98,8 +96,8 @@
|
|
|
98
96
|
&:is(textarea:focus ~ label, textarea:not(:placeholder-shown) ~ label) {
|
|
99
97
|
top: 0.5rem;
|
|
100
98
|
font-size: var(--m3-font-body-small-size, 0.75rem);
|
|
101
|
-
line-height: var(--m3-font-body-small-height, 1);
|
|
102
|
-
letter-spacing: var(--m3-font-body-small-tracking, 0.
|
|
99
|
+
line-height: var(--m3-font-body-small-height, 1.333);
|
|
100
|
+
letter-spacing: var(--m3-font-body-small-tracking, 0.025rem);
|
|
103
101
|
}
|
|
104
102
|
pointer-events: none;
|
|
105
103
|
transition:
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
|
-
import Icon from "../misc/_icon.svelte";
|
|
4
3
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
trailingIcon: IconifyIcon;
|
|
9
|
-
trailingClick: () => void;
|
|
10
|
-
}
|
|
11
|
-
| {
|
|
12
|
-
trailingIcon?: undefined;
|
|
13
|
-
trailingClick?: undefined;
|
|
14
|
-
};
|
|
4
|
+
import Icon from "../misc/_icon.svelte";
|
|
5
|
+
import Layer from "../misc/Layer.svelte";
|
|
6
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
15
7
|
|
|
16
8
|
let {
|
|
17
|
-
label
|
|
9
|
+
label,
|
|
18
10
|
leadingIcon,
|
|
19
|
-
|
|
20
|
-
trailingClick,
|
|
11
|
+
trailing,
|
|
21
12
|
disabled = false,
|
|
22
13
|
required = false,
|
|
23
14
|
error = false,
|
|
@@ -27,22 +18,20 @@
|
|
|
27
18
|
}: {
|
|
28
19
|
label: string;
|
|
29
20
|
leadingIcon?: IconifyIcon;
|
|
21
|
+
trailing?: { icon: IconifyIcon } & ButtonAttrs;
|
|
30
22
|
disabled?: boolean;
|
|
31
23
|
required?: boolean;
|
|
32
24
|
error?: boolean;
|
|
33
25
|
value?: string;
|
|
34
26
|
enter?: () => void;
|
|
35
|
-
} &
|
|
36
|
-
HTMLInputAttributes = $props();
|
|
27
|
+
} & HTMLInputAttributes = $props();
|
|
37
28
|
const id = $props.id();
|
|
38
|
-
|
|
39
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
40
29
|
</script>
|
|
41
30
|
|
|
42
31
|
<div
|
|
43
32
|
class="m3-container"
|
|
44
33
|
class:leading-icon={leadingIcon}
|
|
45
|
-
class:trailing-icon={
|
|
34
|
+
class:trailing-icon={trailing}
|
|
46
35
|
class:error
|
|
47
36
|
>
|
|
48
37
|
<input
|
|
@@ -62,9 +51,11 @@
|
|
|
62
51
|
{#if leadingIcon}
|
|
63
52
|
<Icon icon={leadingIcon} class="leading" />
|
|
64
53
|
{/if}
|
|
65
|
-
{#if
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
{#if trailing}
|
|
55
|
+
{@const { icon, ...extra } = trailing}
|
|
56
|
+
<button type="button" class="trailing" {...extra}>
|
|
57
|
+
<Layer />
|
|
58
|
+
<Icon {icon} />
|
|
68
59
|
</button>
|
|
69
60
|
{/if}
|
|
70
61
|
</div>
|
|
@@ -72,7 +63,7 @@
|
|
|
72
63
|
<style>
|
|
73
64
|
/*
|
|
74
65
|
want to customize the label's background?
|
|
75
|
-
do this: <TextFieldOutlined --m3-util-background="var(--m3-scheme-surface-container)" />
|
|
66
|
+
do this: <TextFieldOutlined --m3-util-background="rgb(var(--m3-scheme-surface-container))" />
|
|
76
67
|
*/
|
|
77
68
|
:root {
|
|
78
69
|
--m3-textfield-outlined-shape: var(--m3-util-rounding-extra-small);
|
|
@@ -101,9 +92,7 @@
|
|
|
101
92
|
left: 0.75rem;
|
|
102
93
|
top: 1rem;
|
|
103
94
|
color: rgb(var(--error, var(--m3-scheme-on-surface-variant)));
|
|
104
|
-
background-color: rgb(
|
|
105
|
-
var(--m3-util-background, var(--m3-scheme-surface))
|
|
106
|
-
); /* TODO: next breaking change, make --m3-util-background a full color and update the comment above */
|
|
95
|
+
background-color: var(--m3-util-background, rgb(var(--m3-scheme-surface)));
|
|
107
96
|
padding: 0 0.25rem;
|
|
108
97
|
&:is(input:hover ~ label) {
|
|
109
98
|
color: rgb(var(--error, var(--m3-scheme-on-surface)));
|
|
@@ -117,8 +106,8 @@
|
|
|
117
106
|
&:is(input:focus ~ label, input:not(:placeholder-shown) ~ label) {
|
|
118
107
|
top: calc(var(--m3-font-body-small-height, 1rem) * -0.5);
|
|
119
108
|
font-size: var(--m3-font-body-small-size, 0.75rem);
|
|
120
|
-
line-height: var(--m3-font-body-small-height, 1);
|
|
121
|
-
letter-spacing: var(--m3-font-body-small-tracking, 0.
|
|
109
|
+
line-height: var(--m3-font-body-small-height, 1.333);
|
|
110
|
+
letter-spacing: var(--m3-font-body-small-tracking, 0.025rem);
|
|
122
111
|
}
|
|
123
112
|
pointer-events: none;
|
|
124
113
|
transition:
|
|
@@ -172,16 +161,6 @@
|
|
|
172
161
|
cursor: pointer;
|
|
173
162
|
}
|
|
174
163
|
|
|
175
|
-
@media (hover: hover) {
|
|
176
|
-
button:hover {
|
|
177
|
-
background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.08);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
button:focus-visible,
|
|
181
|
-
button:active {
|
|
182
|
-
background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.12);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
164
|
.leading-icon > input {
|
|
186
165
|
padding-left: 3.25rem;
|
|
187
166
|
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
type
|
|
4
|
-
trailingIcon: IconifyIcon;
|
|
5
|
-
trailingClick: () => void;
|
|
6
|
-
} | {
|
|
7
|
-
trailingIcon?: undefined;
|
|
8
|
-
trailingClick?: undefined;
|
|
9
|
-
};
|
|
3
|
+
import type { ButtonAttrs } from "../misc/typing-utils";
|
|
10
4
|
type $$ComponentProps = {
|
|
11
5
|
label: string;
|
|
12
6
|
leadingIcon?: IconifyIcon;
|
|
7
|
+
trailing?: {
|
|
8
|
+
icon: IconifyIcon;
|
|
9
|
+
} & ButtonAttrs;
|
|
13
10
|
disabled?: boolean;
|
|
14
11
|
required?: boolean;
|
|
15
12
|
error?: boolean;
|
|
16
13
|
value?: string;
|
|
17
14
|
enter?: () => void;
|
|
18
|
-
} &
|
|
15
|
+
} & HTMLInputAttributes;
|
|
19
16
|
declare const TextFieldOutlined: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
20
17
|
type TextFieldOutlined = ReturnType<typeof TextFieldOutlined>;
|
|
21
18
|
export default TextFieldOutlined;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
|
-
label
|
|
7
|
+
label,
|
|
8
8
|
leadingIcon,
|
|
9
9
|
disabled = false,
|
|
10
10
|
required = false,
|
|
@@ -34,8 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
let label = $derived(_label || extra.name); // TODO: next breaking version, drop name backsupport
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
<div class="m3-container" class:leading-icon={leadingIcon} class:error use:resize>
|
|
@@ -60,7 +58,7 @@
|
|
|
60
58
|
<style>
|
|
61
59
|
/*
|
|
62
60
|
want to customize the label's background?
|
|
63
|
-
do this: <TextFieldOutlinedMultiline --m3-util-background="var(--m3-scheme-surface-container)" />
|
|
61
|
+
do this: <TextFieldOutlinedMultiline --m3-util-background="rgb(var(--m3-scheme-surface-container))" />
|
|
64
62
|
*/
|
|
65
63
|
:root {
|
|
66
64
|
--m3-textfield-outlined-shape: var(--m3-util-rounding-extra-small);
|
|
@@ -90,9 +88,7 @@
|
|
|
90
88
|
left: 0.75rem;
|
|
91
89
|
top: 1rem;
|
|
92
90
|
color: rgb(var(--error, var(--m3-scheme-on-surface-variant)));
|
|
93
|
-
background-color: rgb(
|
|
94
|
-
var(--m3-util-background, var(--m3-scheme-surface))
|
|
95
|
-
); /* TODO: next breaking change, make --m3-util-background a full color and update the comment above */
|
|
91
|
+
background-color: var(--m3-util-background, rgb(var(--m3-scheme-surface)));
|
|
96
92
|
padding: 0 0.25rem;
|
|
97
93
|
&:is(textarea:hover ~ label) {
|
|
98
94
|
color: rgb(var(--error, var(--m3-scheme-on-surface)));
|
|
@@ -106,8 +102,8 @@
|
|
|
106
102
|
&:is(textarea:focus ~ label, textarea:not(:placeholder-shown) ~ label) {
|
|
107
103
|
top: calc(var(--m3-font-body-small-height, 1rem) * -0.5);
|
|
108
104
|
font-size: var(--m3-font-body-small-size, 0.75rem);
|
|
109
|
-
line-height: var(--m3-font-body-small-height, 1);
|
|
110
|
-
letter-spacing: var(--m3-font-body-small-tracking, 0.
|
|
105
|
+
line-height: var(--m3-font-body-small-height, 1.333);
|
|
106
|
+
letter-spacing: var(--m3-font-body-small-tracking, 0.025rem);
|
|
111
107
|
}
|
|
112
108
|
pointer-events: none;
|
|
113
109
|
transition:
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
<div class="m3-container">
|
|
20
20
|
{#if clearable}
|
|
21
21
|
<span class="left">
|
|
22
|
-
<Button variant="text"
|
|
22
|
+
<Button variant="text" onclick={clear} type="button">Clear</Button>
|
|
23
23
|
</span>
|
|
24
24
|
{/if}
|
|
25
|
-
<Button variant="text"
|
|
26
|
-
<Button variant="text" disabled={!clearable && !chosenDate}
|
|
25
|
+
<Button variant="text" onclick={cancel} type="button">Cancel</Button>
|
|
26
|
+
<Button variant="text" disabled={!clearable && !chosenDate} onclick={ok} type="button">OK</Button>
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<style>
|
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
<div class="m3-container">
|
|
18
18
|
{#each options as { name, selected, activate }}
|
|
19
|
-
<button
|
|
19
|
+
<button
|
|
20
|
+
type="button"
|
|
21
|
+
class="m3-font-body-large"
|
|
22
|
+
onclick={activate}
|
|
23
|
+
use:conditionalScroll={selected}
|
|
24
|
+
>
|
|
20
25
|
<Layer />
|
|
21
26
|
{#if selected}
|
|
22
27
|
<Icon icon={iconCheck} />
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
today,
|
|
7
7
|
selected,
|
|
8
8
|
label,
|
|
9
|
-
|
|
9
|
+
onclick,
|
|
10
10
|
}: {
|
|
11
11
|
disabled: boolean;
|
|
12
12
|
today: boolean;
|
|
13
13
|
selected: boolean;
|
|
14
14
|
label: string;
|
|
15
|
-
|
|
15
|
+
onclick: () => void;
|
|
16
16
|
} = $props();
|
|
17
17
|
</script>
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
type="button"
|
|
23
23
|
class:today
|
|
24
24
|
class:selected
|
|
25
|
-
onclick
|
|
25
|
+
{onclick}
|
|
26
26
|
>
|
|
27
27
|
<Layer />
|
|
28
28
|
{label}
|
package/package/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export { default as CircularProgress } from "./forms/CircularProgress.svelte";
|
|
|
27
27
|
export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
|
|
28
28
|
export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
|
|
29
29
|
export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
|
|
30
|
+
export { default as DateField } from "./forms/DateField.svelte";
|
|
31
|
+
export { default as DateFieldOutlined } from "./forms/DateFieldOutlined.svelte";
|
|
30
32
|
export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
|
|
31
33
|
export { default as RadioAnim2 } from "./forms/RadioAnim2.svelte";
|
|
32
34
|
export { default as RadioAnim3 } from "./forms/RadioAnim3.svelte";
|
|
@@ -48,5 +50,3 @@ export { default as VariableTabs } from "./nav/VariableTabs.svelte";
|
|
|
48
50
|
export { default as VariableTabsLink } from "./nav/VariableTabsLink.svelte";
|
|
49
51
|
export { default as ChipChooser } from "./utils/ChipChooser.svelte";
|
|
50
52
|
export { default as Divider } from "./utils/Divider.svelte";
|
|
51
|
-
export { default as DateField } from "./utils/DateField.svelte";
|
|
52
|
-
export { default as DateFieldOutlined } from "./utils/DateFieldOutlined.svelte";
|
package/package/index.js
CHANGED
|
@@ -26,6 +26,8 @@ export { default as CircularProgress } from "./forms/CircularProgress.svelte";
|
|
|
26
26
|
export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
|
|
27
27
|
export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
|
|
28
28
|
export { default as LoadingIndicator } from "./forms/LoadingIndicator.svelte";
|
|
29
|
+
export { default as DateField } from "./forms/DateField.svelte";
|
|
30
|
+
export { default as DateFieldOutlined } from "./forms/DateFieldOutlined.svelte";
|
|
29
31
|
export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
|
|
30
32
|
export { default as RadioAnim2 } from "./forms/RadioAnim2.svelte";
|
|
31
33
|
export { default as RadioAnim3 } from "./forms/RadioAnim3.svelte";
|
|
@@ -47,5 +49,3 @@ export { default as VariableTabs } from "./nav/VariableTabs.svelte";
|
|
|
47
49
|
export { default as VariableTabsLink } from "./nav/VariableTabsLink.svelte";
|
|
48
50
|
export { default as ChipChooser } from "./utils/ChipChooser.svelte";
|
|
49
51
|
export { default as Divider } from "./utils/Divider.svelte";
|
|
50
|
-
export { default as DateField } from "./utils/DateField.svelte";
|
|
51
|
-
export { default as DateFieldOutlined } from "./utils/DateFieldOutlined.svelte";
|
|
@@ -160,10 +160,10 @@
|
|
|
160
160
|
transition: opacity var(--m3-util-easing-fast);
|
|
161
161
|
|
|
162
162
|
&:not(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
:global(input:disabled + label) > .tint,
|
|
164
|
+
:global(input:disabled + .layer-container) > .tint,
|
|
165
|
+
:global(:disabled) > .tint
|
|
166
|
+
) {
|
|
167
167
|
@media (hover: hover) {
|
|
168
168
|
&:is(:global(:hover) > .tint) {
|
|
169
169
|
opacity: 0.08;
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
transition: opacity var(--m3-util-easing-fast);
|
|
15
15
|
|
|
16
16
|
&:not(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
:global(input:disabled + label) > .tint,
|
|
18
|
+
:global(input:disabled + .layer-container) > .tint,
|
|
19
|
+
:global(:disabled) > .tint
|
|
20
|
+
) {
|
|
21
21
|
@media (hover: hover) {
|
|
22
22
|
&:is(:global(:hover) > .tint) {
|
|
23
23
|
opacity: 0.08;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
{...option}
|
|
18
18
|
variant="input"
|
|
19
19
|
selected={chosenOptions.includes(option.value)}
|
|
20
|
-
|
|
20
|
+
onclick={() =>
|
|
21
21
|
chosenOptions.includes(option.value)
|
|
22
22
|
? (chosenOptions = chosenOptions.filter((o) => o != option.value))
|
|
23
23
|
: (chosenOptions = [...chosenOptions, option.value])}
|