m3-svelte 3.6.1 → 4.0.0-beta.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 +142 -78
- package/package/buttons/Button.svelte.d.ts +17 -34
- package/package/buttons/ConnectedButtons.svelte +26 -0
- package/package/buttons/ConnectedButtons.svelte.d.ts +8 -0
- package/package/buttons/FAB.svelte +30 -15
- package/package/buttons/FAB.svelte.d.ts +14 -25
- package/package/containers/BottomSheet.svelte +33 -27
- package/package/containers/BottomSheet.svelte.d.ts +7 -21
- package/package/containers/Card.svelte +45 -14
- package/package/containers/Card.svelte.d.ts +10 -30
- package/package/containers/Dialog.svelte +46 -32
- package/package/containers/Dialog.svelte.d.ts +9 -34
- package/package/containers/ListItem.svelte +78 -14
- package/package/containers/ListItem.svelte.d.ts +14 -25
- package/package/containers/Menu.svelte +6 -3
- package/package/containers/Menu.svelte.d.ts +6 -28
- package/package/containers/MenuItem.svelte +15 -5
- package/package/containers/MenuItem.svelte.d.ts +7 -29
- package/package/containers/Snackbar.svelte +35 -37
- package/package/containers/Snackbar.svelte.d.ts +7 -22
- package/package/containers/SnackbarItem.svelte +6 -6
- package/package/containers/SnackbarItem.svelte.d.ts +6 -29
- package/package/containers/StandardSideSheet.svelte +14 -8
- package/package/containers/StandardSideSheet.svelte.d.ts +7 -30
- package/package/forms/Checkbox.svelte +19 -4
- package/package/forms/Checkbox.svelte.d.ts +6 -29
- package/package/forms/Chip.svelte +41 -29
- package/package/forms/Chip.svelte.d.ts +18 -41
- package/package/forms/CircularProgress.svelte +4 -6
- package/package/forms/CircularProgress.svelte.d.ts +4 -20
- package/package/forms/CircularProgressIndeterminate.svelte +3 -4
- package/package/forms/CircularProgressIndeterminate.svelte.d.ts +2 -20
- package/package/forms/DatePickerDocked.svelte +52 -35
- package/package/forms/DatePickerDocked.svelte.d.ts +6 -22
- package/package/forms/LinearProgress.svelte +10 -5
- package/package/forms/LinearProgress.svelte.d.ts +4 -20
- package/package/forms/LinearProgressIndeterminate.svelte +4 -3
- package/package/forms/LinearProgressIndeterminate.svelte.d.ts +2 -20
- package/package/forms/RadioAnim1.svelte +10 -4
- package/package/forms/RadioAnim1.svelte.d.ts +6 -29
- package/package/forms/RadioAnim2.svelte +10 -4
- package/package/forms/RadioAnim2.svelte.d.ts +6 -29
- package/package/forms/RadioAnim3.svelte +10 -4
- package/package/forms/RadioAnim3.svelte.d.ts +6 -29
- package/package/forms/Slider.svelte +32 -26
- package/package/forms/Slider.svelte.d.ts +5 -21
- package/package/forms/SliderTicks.svelte +40 -33
- package/package/forms/SliderTicks.svelte.d.ts +5 -21
- package/package/forms/Switch.svelte +23 -21
- package/package/forms/Switch.svelte.d.ts +5 -22
- package/package/forms/TextField.svelte +36 -19
- package/package/forms/TextField.svelte.d.ts +14 -27
- package/package/forms/TextFieldMultiline.svelte +21 -21
- package/package/forms/TextFieldMultiline.svelte.d.ts +6 -23
- package/package/forms/TextFieldOutlined.svelte +36 -18
- package/package/forms/TextFieldOutlined.svelte.d.ts +14 -26
- package/package/forms/TextFieldOutlinedMultiline.svelte +21 -21
- package/package/forms/TextFieldOutlinedMultiline.svelte.d.ts +6 -23
- package/package/forms/_picker/Actions.svelte +16 -18
- package/package/forms/_picker/Actions.svelte.d.ts +7 -22
- package/package/forms/_picker/CalendarPicker.svelte +14 -4
- package/package/forms/_picker/CalendarPicker.svelte.d.ts +4 -18
- package/package/forms/_picker/FocusPicker.svelte +8 -9
- package/package/forms/_picker/FocusPicker.svelte.d.ts +5 -21
- package/package/forms/_picker/Header.svelte +20 -9
- package/package/forms/_picker/Header.svelte.d.ts +4 -18
- package/package/forms/_picker/Item.svelte +15 -6
- package/package/forms/_picker/Item.svelte.d.ts +8 -23
- package/package/index.d.ts +3 -9
- package/package/index.js +1 -8
- package/package/misc/Layer.svelte +7 -3
- package/package/misc/Layer.svelte.d.ts +5 -17
- package/package/misc/StyleFromScheme.svelte +6 -2
- package/package/misc/StyleFromScheme.svelte.d.ts +5 -19
- package/package/misc/_icon.svelte +12 -5
- package/package/misc/_icon.svelte.d.ts +5 -19
- package/package/misc/_ripple.svelte +11 -3
- package/package/misc/_ripple.svelte.d.ts +5 -17
- package/package/misc/_ripplesimple.svelte +4 -0
- package/package/misc/_ripplesimple.svelte.d.ts +5 -25
- package/package/misc/_styling.svelte +7 -3
- package/package/misc/_styling.svelte.d.ts +5 -19
- package/package/misc/animation.js +1 -5
- package/package/misc/easing.js +1 -28
- package/package/misc/styles.css +135 -107
- package/package/misc/utils.d.ts +1 -0
- package/package/misc/utils.js +5 -0
- package/package/nav/NavDrawer.svelte +9 -5
- package/package/nav/NavDrawer.svelte.d.ts +6 -30
- package/package/nav/NavDrawerButton.svelte +22 -12
- package/package/nav/NavDrawerButton.svelte.d.ts +8 -31
- package/package/nav/NavDrawerLink.svelte +21 -12
- package/package/nav/NavDrawerLink.svelte.d.ts +8 -30
- package/package/nav/NavList.svelte +13 -9
- package/package/nav/NavList.svelte.d.ts +7 -31
- package/package/nav/NavListButton.svelte +26 -22
- package/package/nav/NavListButton.svelte.d.ts +9 -33
- package/package/nav/NavListLink.svelte +26 -23
- package/package/nav/NavListLink.svelte.d.ts +9 -32
- package/package/nav/Tabs.svelte +20 -19
- package/package/nav/Tabs.svelte.d.ts +5 -22
- package/package/nav/TabsLink.svelte +22 -18
- package/package/nav/TabsLink.svelte.d.ts +5 -22
- package/package/nav/VariableTabs.svelte +25 -20
- package/package/nav/VariableTabs.svelte.d.ts +5 -22
- package/package/nav/VariableTabsLink.svelte +29 -22
- package/package/nav/VariableTabsLink.svelte.d.ts +5 -22
- package/package/utils/ChipChooser.svelte +10 -4
- package/package/utils/ChipChooser.svelte.d.ts +5 -19
- package/package/utils/DateField.svelte +24 -18
- package/package/utils/DateField.svelte.d.ts +4 -19
- package/package/utils/Divider.svelte +5 -1
- package/package/utils/Divider.svelte.d.ts +4 -18
- package/package.json +44 -43
- package/package/buttons/ButtonLink.svelte +0 -116
- package/package/buttons/ButtonLink.svelte.d.ts +0 -34
- package/package/buttons/SegmentedButtonContainer.svelte +0 -27
- package/package/buttons/SegmentedButtonContainer.svelte.d.ts +0 -31
- package/package/buttons/SegmentedButtonItem.svelte +0 -119
- package/package/buttons/SegmentedButtonItem.svelte.d.ts +0 -34
- package/package/containers/CardClickable.svelte +0 -78
- package/package/containers/CardClickable.svelte.d.ts +0 -34
- package/package/containers/ListItemButton.svelte +0 -86
- package/package/containers/ListItemButton.svelte.d.ts +0 -31
- package/package/containers/ListItemLabel.svelte +0 -82
- package/package/containers/ListItemLabel.svelte.d.ts +0 -29
- package/package/containers/SnackbarAnim.svelte +0 -127
- package/package/containers/SnackbarAnim.svelte.d.ts +0 -33
- package/package/forms/CheckboxAnim.svelte +0 -116
- package/package/forms/CheckboxAnim.svelte.d.ts +0 -31
|
@@ -1,57 +1,64 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import { Spring } from "svelte/motion";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable(),
|
|
7
|
+
min = 0,
|
|
8
|
+
max = 100,
|
|
9
|
+
step,
|
|
10
|
+
disabled = false,
|
|
11
|
+
showValue = true,
|
|
12
|
+
format = (n: number) => {
|
|
13
|
+
return n.toFixed(0);
|
|
14
|
+
},
|
|
15
|
+
...extra
|
|
16
|
+
}: {
|
|
17
|
+
value: number;
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
step: number;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
format?: (n: number) => string;
|
|
24
|
+
} & HTMLInputAttributes = $props();
|
|
25
|
+
|
|
26
|
+
const valueDisplayed = new Spring(value, { stiffness: 0.3, damping: 1 });
|
|
18
27
|
const updateValue = (e: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
|
|
19
28
|
const newValue = Number(e.currentTarget.value);
|
|
20
29
|
e.preventDefault();
|
|
21
30
|
value = newValue;
|
|
22
|
-
|
|
31
|
+
valueDisplayed.target = newValue;
|
|
23
32
|
};
|
|
24
33
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
$: {
|
|
31
|
-
ticks = [];
|
|
34
|
+
const range = $derived(max - min);
|
|
35
|
+
const percent = $derived((valueDisplayed.current - min) / range);
|
|
36
|
+
const ticks = $derived.by(() => {
|
|
37
|
+
const ticksList = [];
|
|
32
38
|
for (let i = 0; i <= range; i += step) {
|
|
33
|
-
|
|
39
|
+
ticksList.push((i / range) * 100);
|
|
34
40
|
}
|
|
35
|
-
|
|
41
|
+
return ticksList;
|
|
42
|
+
});
|
|
36
43
|
</script>
|
|
37
44
|
|
|
38
|
-
<div class="m3-container" style="
|
|
45
|
+
<div class="m3-container" style:--percent="{percent * 100}%">
|
|
39
46
|
<input
|
|
40
47
|
type="range"
|
|
41
|
-
|
|
42
|
-
value={
|
|
48
|
+
oninput={updateValue}
|
|
49
|
+
value={valueDisplayed.current}
|
|
43
50
|
{min}
|
|
44
51
|
{max}
|
|
45
52
|
{step}
|
|
46
53
|
{disabled}
|
|
47
|
-
{...
|
|
54
|
+
{...extra}
|
|
48
55
|
/>
|
|
49
56
|
<div class="track"></div>
|
|
50
|
-
{#each ticks as tick
|
|
57
|
+
{#each ticks as tick}
|
|
51
58
|
<div
|
|
52
59
|
class="tick"
|
|
53
|
-
class:hidden={Math.abs(tick / 100 -
|
|
54
|
-
class:inactive={tick / 100 >
|
|
60
|
+
class:hidden={Math.abs(tick / 100 - valueDisplayed.current / range) < 0.01}
|
|
61
|
+
class:inactive={tick / 100 > valueDisplayed.current / range}
|
|
55
62
|
style:--x={tick / 100 - 0.5}
|
|
56
63
|
></div>
|
|
57
64
|
{/each}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const SliderTicks: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
extraWrapperOptions?: HTMLAttributes<HTMLDivElement>;
|
|
17
|
-
extraOptions?: HTMLInputAttributes;
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
type $$ComponentProps = {
|
|
18
3
|
value: number;
|
|
19
4
|
min?: number;
|
|
20
5
|
max?: number;
|
|
@@ -22,8 +7,7 @@ declare const SliderTicks: $$__sveltets_2_IsomorphicComponent<{
|
|
|
22
7
|
disabled?: boolean;
|
|
23
8
|
showValue?: boolean;
|
|
24
9
|
format?: (n: number) => string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
type SliderTicks = InstanceType<typeof SliderTicks>;
|
|
10
|
+
} & HTMLInputAttributes;
|
|
11
|
+
declare const SliderTicks: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
12
|
+
type SliderTicks = ReturnType<typeof SliderTicks>;
|
|
29
13
|
export default SliderTicks;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Icon from "../misc/_icon.svelte";
|
|
3
3
|
import iconCheck from "@ktibow/iconset-material-symbols/check";
|
|
4
|
-
import type {
|
|
4
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
5
5
|
|
|
6
|
-
export let display = "inline-flex";
|
|
7
|
-
export let extraWrapperOptions: HTMLAttributes<HTMLDivElement> = {};
|
|
8
|
-
export let extraOptions: HTMLAttributes<HTMLDivElement> = {};
|
|
9
|
-
export let checked = false;
|
|
10
|
-
export let disabled = false;
|
|
11
6
|
// MUST BE WRAPPED IN A <label>
|
|
7
|
+
let {
|
|
8
|
+
checked = $bindable(false),
|
|
9
|
+
disabled = false,
|
|
10
|
+
...extra
|
|
11
|
+
}: {
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
} & HTMLInputAttributes = $props();
|
|
12
15
|
|
|
13
|
-
let startX: number | undefined;
|
|
16
|
+
let startX: number | undefined = $state();
|
|
14
17
|
const handleMouseUp = (e: MouseEvent) => {
|
|
15
18
|
if (!startX) return;
|
|
16
19
|
const distance = e.clientX - startX;
|
|
@@ -20,18 +23,16 @@
|
|
|
20
23
|
};
|
|
21
24
|
</script>
|
|
22
25
|
|
|
23
|
-
<svelte:window
|
|
24
|
-
<!-- svelte-ignore
|
|
26
|
+
<svelte:window onpointerup={handleMouseUp} />
|
|
27
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
25
28
|
<div
|
|
26
29
|
class="m3-container"
|
|
27
|
-
|
|
28
|
-
{...extraWrapperOptions}
|
|
29
|
-
on:pointerdown={(e) => {
|
|
30
|
+
onpointerdown={(e) => {
|
|
30
31
|
if (!disabled) {
|
|
31
32
|
startX = e.clientX;
|
|
32
33
|
}
|
|
33
34
|
}}
|
|
34
|
-
|
|
35
|
+
ondragstart={(e) => {
|
|
35
36
|
e.preventDefault();
|
|
36
37
|
}}
|
|
37
38
|
>
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
role="switch"
|
|
41
42
|
{disabled}
|
|
42
43
|
bind:checked
|
|
43
|
-
{...
|
|
44
|
-
|
|
44
|
+
{...extra}
|
|
45
|
+
onkeydown={(e) => {
|
|
45
46
|
if (e.code == "Enter") checked = !checked;
|
|
46
47
|
if (e.code == "ArrowLeft") checked = false;
|
|
47
48
|
if (e.code == "ArrowRight") checked = true;
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
--m3-switch-handle-shape: var(--m3-util-rounding-full);
|
|
60
61
|
}
|
|
61
62
|
.m3-container {
|
|
63
|
+
display: inline-flex;
|
|
62
64
|
position: relative;
|
|
63
65
|
width: 3.25rem;
|
|
64
66
|
height: 2rem;
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
background-color: rgb(var(--m3-scheme-outline));
|
|
86
88
|
cursor: pointer;
|
|
87
89
|
-webkit-tap-highlight-color: transparent;
|
|
88
|
-
transition: all
|
|
90
|
+
transition: all var(--m3-util-easing-fast-spatial);
|
|
89
91
|
|
|
90
92
|
left: 0.5rem;
|
|
91
93
|
top: 50%;
|
|
@@ -100,8 +102,8 @@
|
|
|
100
102
|
color: rgb(var(--m3-scheme-on-primary-container));
|
|
101
103
|
opacity: 0;
|
|
102
104
|
transition:
|
|
103
|
-
opacity
|
|
104
|
-
scale
|
|
105
|
+
opacity var(--m3-util-easing-fast-spatial),
|
|
106
|
+
scale var(--m3-util-easing-fast-spatial);
|
|
105
107
|
}
|
|
106
108
|
.hover {
|
|
107
109
|
position: absolute;
|
|
@@ -111,7 +113,7 @@
|
|
|
111
113
|
|
|
112
114
|
cursor: pointer;
|
|
113
115
|
-webkit-tap-highlight-color: transparent;
|
|
114
|
-
transition: all
|
|
116
|
+
transition: all var(--m3-util-easing-fast);
|
|
115
117
|
|
|
116
118
|
left: 1rem;
|
|
117
119
|
top: 50%;
|
|
@@ -122,11 +124,11 @@
|
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
.m3-container:hover > input:enabled + .handle,
|
|
125
|
-
.m3-container > input:enabled:is(:active, :focus-visible) + .handle {
|
|
127
|
+
.m3-container > input:enabled:is(:global(:active, :focus-visible)) + .handle {
|
|
126
128
|
background-color: rgb(var(--m3-scheme-on-surface-variant));
|
|
127
129
|
}
|
|
128
130
|
.m3-container:hover > input:enabled:checked + .handle,
|
|
129
|
-
.m3-container > input:enabled:checked:is(:active, :focus-visible) + .handle {
|
|
131
|
+
.m3-container > input:enabled:checked:is(:global(:active, :focus-visible)) + .handle {
|
|
130
132
|
background-color: rgb(var(--m3-scheme-primary-container));
|
|
131
133
|
}
|
|
132
134
|
.m3-container:hover > input ~ .hover {
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Switch: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
display?: string;
|
|
17
|
-
extraWrapperOptions?: HTMLAttributes<HTMLDivElement>;
|
|
18
|
-
extraOptions?: HTMLAttributes<HTMLDivElement>;
|
|
1
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
+
type $$ComponentProps = {
|
|
19
3
|
checked?: boolean;
|
|
20
4
|
disabled?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type Switch = InstanceType<typeof Switch>;
|
|
5
|
+
} & HTMLInputAttributes;
|
|
6
|
+
declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
7
|
+
type Switch = ReturnType<typeof Switch>;
|
|
25
8
|
export default Switch;
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import Icon from "../misc/_icon.svelte";
|
|
4
|
-
import {
|
|
5
|
-
import type { HTMLAttributes, HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
type TrailingProps =
|
|
7
|
+
| {
|
|
8
|
+
trailingIcon: IconifyIcon;
|
|
9
|
+
trailingClick: () => void;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
trailingIcon?: undefined;
|
|
13
|
+
trailingClick?: undefined;
|
|
14
|
+
};
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let {
|
|
17
|
+
name,
|
|
18
|
+
leadingIcon,
|
|
19
|
+
trailingIcon,
|
|
20
|
+
trailingClick,
|
|
21
|
+
disabled = false,
|
|
22
|
+
required = false,
|
|
23
|
+
error = false,
|
|
24
|
+
value = $bindable(""),
|
|
25
|
+
enter,
|
|
26
|
+
...extra
|
|
27
|
+
}: {
|
|
28
|
+
name: string;
|
|
29
|
+
leadingIcon?: IconifyIcon;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
error?: boolean;
|
|
33
|
+
value?: string;
|
|
34
|
+
enter?: () => void;
|
|
35
|
+
} & TrailingProps &
|
|
36
|
+
HTMLInputAttributes = $props();
|
|
19
37
|
const id = crypto.randomUUID();
|
|
20
38
|
</script>
|
|
21
39
|
|
|
@@ -24,18 +42,16 @@
|
|
|
24
42
|
class:leading-icon={leadingIcon}
|
|
25
43
|
class:trailing-icon={trailingIcon}
|
|
26
44
|
class:error
|
|
27
|
-
style="display: {display}"
|
|
28
|
-
{...extraWrapperOptions}
|
|
29
45
|
>
|
|
30
46
|
<input
|
|
31
47
|
class="focus-none m3-font-body-large"
|
|
32
48
|
placeholder=" "
|
|
33
49
|
bind:value
|
|
34
|
-
|
|
50
|
+
onkeydown={(e) => e.key == "Enter" && enter?.()}
|
|
35
51
|
{id}
|
|
36
52
|
{disabled}
|
|
37
53
|
{required}
|
|
38
|
-
{...
|
|
54
|
+
{...extra}
|
|
39
55
|
/>
|
|
40
56
|
<label class="m3-font-body-large" for={id}>{name}</label>
|
|
41
57
|
<div class="layer"></div>
|
|
@@ -43,7 +59,7 @@
|
|
|
43
59
|
<Icon icon={leadingIcon} class="leading" />
|
|
44
60
|
{/if}
|
|
45
61
|
{#if trailingIcon}
|
|
46
|
-
<button
|
|
62
|
+
<button onclick={trailingClick} class="trailing">
|
|
47
63
|
<Icon icon={trailingIcon} />
|
|
48
64
|
</button>
|
|
49
65
|
{/if}
|
|
@@ -55,6 +71,7 @@
|
|
|
55
71
|
}
|
|
56
72
|
|
|
57
73
|
.m3-container {
|
|
74
|
+
display: inline-flex;
|
|
58
75
|
position: relative;
|
|
59
76
|
align-items: center;
|
|
60
77
|
height: 3.5rem;
|
|
@@ -98,7 +115,7 @@
|
|
|
98
115
|
width: 100%;
|
|
99
116
|
bottom: 0;
|
|
100
117
|
|
|
101
|
-
height:
|
|
118
|
+
height: 1px;
|
|
102
119
|
background-color: rgb(var(--error, var(--m3-scheme-on-surface-variant)));
|
|
103
120
|
transition: all 200ms;
|
|
104
121
|
}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const TextField: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
display?: string;
|
|
18
|
-
extraWrapperOptions?: HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
extraOptions?: HTMLInputAttributes;
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
type TrailingProps = {
|
|
4
|
+
trailingIcon: IconifyIcon;
|
|
5
|
+
trailingClick: () => void;
|
|
6
|
+
} | {
|
|
7
|
+
trailingIcon?: undefined;
|
|
8
|
+
trailingClick?: undefined;
|
|
9
|
+
};
|
|
10
|
+
type $$ComponentProps = {
|
|
20
11
|
name: string;
|
|
21
|
-
leadingIcon?: IconifyIcon
|
|
22
|
-
trailingIcon?: IconifyIcon | undefined;
|
|
12
|
+
leadingIcon?: IconifyIcon;
|
|
23
13
|
disabled?: boolean;
|
|
24
14
|
required?: boolean;
|
|
25
15
|
error?: boolean;
|
|
26
16
|
value?: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
}, {}, {}, string>;
|
|
33
|
-
type TextField = InstanceType<typeof TextField>;
|
|
17
|
+
enter?: () => void;
|
|
18
|
+
} & TrailingProps & HTMLInputAttributes;
|
|
19
|
+
declare const TextField: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
20
|
+
type TextField = ReturnType<typeof TextField>;
|
|
34
21
|
export default TextField;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import Icon from "../misc/_icon.svelte";
|
|
4
|
-
import type {
|
|
4
|
+
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
let {
|
|
7
|
+
name,
|
|
8
|
+
leadingIcon,
|
|
9
|
+
disabled = false,
|
|
10
|
+
required = false,
|
|
11
|
+
error = false,
|
|
12
|
+
value = $bindable(""),
|
|
13
|
+
...extra
|
|
14
|
+
}: {
|
|
15
|
+
name: string;
|
|
16
|
+
leadingIcon?: IconifyIcon;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
error?: boolean;
|
|
20
|
+
value?: string;
|
|
21
|
+
} & HTMLTextareaAttributes = $props();
|
|
16
22
|
const id = crypto.randomUUID();
|
|
17
23
|
const resize = (node: HTMLElement) => {
|
|
18
24
|
const update = () => {
|
|
@@ -30,14 +36,7 @@
|
|
|
30
36
|
};
|
|
31
37
|
</script>
|
|
32
38
|
|
|
33
|
-
<div
|
|
34
|
-
class="m3-container"
|
|
35
|
-
class:leading-icon={leadingIcon}
|
|
36
|
-
class:error
|
|
37
|
-
style="display: {display}"
|
|
38
|
-
use:resize
|
|
39
|
-
{...extraWrapperOptions}
|
|
40
|
-
>
|
|
39
|
+
<div class="m3-container" class:leading-icon={leadingIcon} class:error use:resize>
|
|
41
40
|
<textarea
|
|
42
41
|
class="focus-none m3-font-body-large"
|
|
43
42
|
placeholder=" "
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
{id}
|
|
46
45
|
{disabled}
|
|
47
46
|
{required}
|
|
48
|
-
{...
|
|
47
|
+
{...extra}
|
|
49
48
|
></textarea>
|
|
50
49
|
<label class="m3-font-body-large" for={id}>{name}</label>
|
|
51
50
|
<div class="layer"></div>
|
|
@@ -59,6 +58,7 @@
|
|
|
59
58
|
--m3-textfield-filled-shape: var(--m3-util-rounding-extra-small);
|
|
60
59
|
}
|
|
61
60
|
.m3-container {
|
|
61
|
+
display: inline-flex;
|
|
62
62
|
position: relative;
|
|
63
63
|
align-items: center;
|
|
64
64
|
min-height: 5rem;
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
width: 100%;
|
|
104
104
|
bottom: 0;
|
|
105
105
|
|
|
106
|
-
height:
|
|
106
|
+
height: 1px;
|
|
107
107
|
background-color: rgb(var(--error, var(--m3-scheme-on-surface-variant)));
|
|
108
108
|
transition: all 200ms;
|
|
109
109
|
}
|
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
-
$$bindings?: Bindings;
|
|
6
|
-
} & Exports;
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const TextFieldMultiline: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
display?: string;
|
|
18
|
-
extraWrapperOptions?: HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
extraOptions?: HTMLTextareaAttributes;
|
|
2
|
+
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
3
|
+
type $$ComponentProps = {
|
|
20
4
|
name: string;
|
|
21
|
-
leadingIcon?: IconifyIcon
|
|
5
|
+
leadingIcon?: IconifyIcon;
|
|
22
6
|
disabled?: boolean;
|
|
23
7
|
required?: boolean;
|
|
24
8
|
error?: boolean;
|
|
25
9
|
value?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type TextFieldMultiline = InstanceType<typeof TextFieldMultiline>;
|
|
10
|
+
} & HTMLTextareaAttributes;
|
|
11
|
+
declare const TextFieldMultiline: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
12
|
+
type TextFieldMultiline = ReturnType<typeof TextFieldMultiline>;
|
|
30
13
|
export default TextFieldMultiline;
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
3
|
import Icon from "../misc/_icon.svelte";
|
|
4
|
-
import {
|
|
5
|
-
import type { HTMLAttributes, HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
type TrailingProps =
|
|
7
|
+
| {
|
|
8
|
+
trailingIcon: IconifyIcon;
|
|
9
|
+
trailingClick: () => void;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
trailingIcon?: undefined;
|
|
13
|
+
trailingClick?: undefined;
|
|
14
|
+
};
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let {
|
|
17
|
+
name,
|
|
18
|
+
leadingIcon,
|
|
19
|
+
trailingIcon,
|
|
20
|
+
trailingClick,
|
|
21
|
+
disabled = false,
|
|
22
|
+
required = false,
|
|
23
|
+
error = false,
|
|
24
|
+
value = $bindable(""),
|
|
25
|
+
enter,
|
|
26
|
+
...extra
|
|
27
|
+
}: {
|
|
28
|
+
name: string;
|
|
29
|
+
leadingIcon?: IconifyIcon;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
error?: boolean;
|
|
33
|
+
value?: string;
|
|
34
|
+
enter?: () => void;
|
|
35
|
+
} & TrailingProps &
|
|
36
|
+
HTMLInputAttributes = $props();
|
|
19
37
|
const id = crypto.randomUUID();
|
|
20
38
|
</script>
|
|
21
39
|
|
|
@@ -24,17 +42,16 @@
|
|
|
24
42
|
class:leading-icon={leadingIcon}
|
|
25
43
|
class:trailing-icon={trailingIcon}
|
|
26
44
|
class:error
|
|
27
|
-
style="display: {display}"
|
|
28
|
-
{...extraWrapperOptions}
|
|
29
45
|
>
|
|
30
46
|
<input
|
|
31
47
|
class="focus-none m3-font-body-large"
|
|
32
48
|
placeholder=" "
|
|
33
49
|
bind:value
|
|
50
|
+
onkeydown={(e) => e.key == "Enter" && enter?.()}
|
|
34
51
|
{id}
|
|
35
52
|
{disabled}
|
|
36
53
|
{required}
|
|
37
|
-
{...
|
|
54
|
+
{...extra}
|
|
38
55
|
/>
|
|
39
56
|
<div class="layer"></div>
|
|
40
57
|
<label class="m3-font-body-large" for={id}>{name}</label>
|
|
@@ -42,7 +59,7 @@
|
|
|
42
59
|
<Icon icon={leadingIcon} class="leading" />
|
|
43
60
|
{/if}
|
|
44
61
|
{#if trailingIcon}
|
|
45
|
-
<button
|
|
62
|
+
<button onclick={trailingClick} class="trailing">
|
|
46
63
|
<Icon icon={trailingIcon} />
|
|
47
64
|
</button>
|
|
48
65
|
{/if}
|
|
@@ -57,6 +74,7 @@
|
|
|
57
74
|
--m3-textfield-outlined-shape: var(--m3-util-rounding-extra-small);
|
|
58
75
|
}
|
|
59
76
|
.m3-container {
|
|
77
|
+
display: inline-flex;
|
|
60
78
|
position: relative;
|
|
61
79
|
align-items: center;
|
|
62
80
|
height: 3.5rem;
|
|
@@ -91,7 +109,7 @@
|
|
|
91
109
|
.layer {
|
|
92
110
|
position: absolute;
|
|
93
111
|
inset: 0;
|
|
94
|
-
border:
|
|
112
|
+
border: 1px solid rgb(var(--error, var(--m3-scheme-outline)));
|
|
95
113
|
border-radius: var(--m3-textfield-outlined-shape);
|
|
96
114
|
pointer-events: none;
|
|
97
115
|
transition: all 200ms;
|