@noxlovette/material 0.4.8 → 0.5.1
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/dist/animation/Shapes.stories.svelte +56 -0
- package/dist/animation/Shapes.stories.svelte.d.ts +3 -0
- package/dist/animation/TransitionPatterns.stories.svelte +359 -0
- package/dist/animation/TransitionPatterns.stories.svelte.d.ts +3 -0
- package/dist/animation/containerTransform.d.ts +35 -12
- package/dist/animation/containerTransform.js +31 -138
- package/dist/animation/enterExit.d.ts +30 -3
- package/dist/animation/enterExit.js +69 -22
- package/dist/animation/index.d.ts +2 -1
- package/dist/animation/index.js +2 -1
- package/dist/animation/presence.svelte.d.ts +47 -0
- package/dist/animation/presence.svelte.js +84 -0
- package/dist/animation/shapeMorph.svelte.d.ts +52 -0
- package/dist/animation/shapeMorph.svelte.js +112 -0
- package/dist/animation/shapesAnimatableSmall.d.ts +28 -22
- package/dist/animation/shapesAnimatableSmall.js +32 -23
- package/dist/animation/sharedAxisTransition.d.ts +57 -37
- package/dist/animation/sharedAxisTransition.js +74 -22
- package/dist/animation/skeleton.d.ts +16 -0
- package/dist/animation/skeleton.js +28 -0
- package/dist/animation/spring.d.ts +61 -0
- package/dist/animation/spring.js +53 -0
- package/dist/animation/springValue.svelte.d.ts +22 -0
- package/dist/animation/springValue.svelte.js +42 -0
- package/dist/animation/transition.d.ts +3 -1
- package/dist/animation/transition.js +3 -1
- package/dist/attachments/clickOutside.d.ts +13 -0
- package/dist/attachments/clickOutside.js +18 -0
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.js +1 -0
- package/dist/components/buttons/FAB.svelte +23 -16
- package/dist/components/buttons/FABMenu.svelte +24 -29
- package/dist/components/buttons/FABMenu.svelte.d.ts +2 -1
- package/dist/components/buttons/FABMenuItem.svelte +23 -20
- package/dist/components/buttons/FABMenuItem.svelte.d.ts +5 -1
- package/dist/components/buttons/split-button/SplitButton.svelte +10 -17
- package/dist/components/buttons/split-button/theme.js +1 -1
- package/dist/components/buttons/types.d.ts +3 -3
- package/dist/components/cards/theme.js +1 -1
- package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +8 -12
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte +67 -55
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +1 -1
- package/dist/components/containers/bottom-sheet/types.d.ts +8 -2
- package/dist/components/containers/context-menu/ContextMenu.svelte +23 -36
- package/dist/components/containers/context-menu/theme.js +2 -2
- package/dist/components/containers/dialogue/Dialogue.svelte +49 -65
- package/dist/components/containers/link-preview/LinkPreview.svelte +12 -23
- package/dist/components/containers/link-preview/theme.d.ts +3 -3
- package/dist/components/containers/menu/Menu.svelte +14 -21
- package/dist/components/containers/menu/MenuSub.svelte +10 -17
- package/dist/components/containers/pane/DraggablePane.svelte +90 -5
- package/dist/components/containers/pane/DraggablePane.svelte.d.ts +1 -1
- package/dist/components/containers/pane/theme.js +2 -2
- package/dist/components/containers/popover/Popover.svelte +31 -42
- package/dist/components/containers/popover/theme.d.ts +3 -3
- package/dist/components/containers/scroll-area/theme.js +2 -2
- package/dist/components/containers/side-sheet/SideSheet.stories.svelte +10 -15
- package/dist/components/containers/side-sheet/SideSheet.svelte +44 -44
- package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +4 -3
- package/dist/components/containers/side-sheet/types.d.ts +8 -2
- package/dist/components/date/DateField.svelte +99 -92
- package/dist/components/date/DateField.svelte.d.ts +4 -5
- package/dist/components/date/DateRangeField.svelte +127 -155
- package/dist/components/date/DateRangeField.svelte.d.ts +4 -5
- package/dist/components/date/calendarMotion.d.ts +9 -0
- package/dist/components/date/calendarMotion.js +23 -0
- package/dist/components/date/theme.d.ts +95 -0
- package/dist/components/date/theme.js +103 -14
- package/dist/components/date/types.d.ts +13 -0
- package/dist/components/forms/checkbox/theme.js +2 -2
- package/dist/components/forms/command/theme.d.ts +3 -3
- package/dist/components/forms/command/theme.js +1 -1
- package/dist/components/forms/pin/theme.js +2 -2
- package/dist/components/forms/radio-group/theme.js +2 -2
- package/dist/components/forms/select/Select.svelte +42 -54
- package/dist/components/forms/select/theme.js +4 -4
- package/dist/components/forms/slider/Slider.svelte +144 -126
- package/dist/components/forms/slider/Slider.svelte.d.ts +3 -0
- package/dist/components/forms/slider/theme.d.ts +154 -48
- package/dist/components/forms/slider/theme.js +60 -20
- package/dist/components/forms/slider/types.d.ts +1 -1
- package/dist/components/forms/switch/theme.js +4 -4
- package/dist/components/forms/textfield/Textfield.svelte +1 -1
- package/dist/components/forms/textfield/theme.d.ts +12 -0
- package/dist/components/forms/textfield/theme.js +30 -10
- package/dist/components/forms/toggle-group/theme.js +1 -1
- package/dist/components/forms/tooltip/Tooltip.svelte +24 -35
- package/dist/components/nav/breadcrumb/theme.js +1 -1
- package/dist/components/nav/navbar/theme.js +2 -2
- package/dist/components/nav/rail/Rail.svelte +4 -5
- package/dist/components/nav/rail/theme.js +7 -7
- package/dist/components/nav/tabs/TabHolder.svelte +29 -3
- package/dist/components/nav/tabs/TabHolder.svelte.d.ts +3 -1
- package/dist/components/nav/tabs/theme.js +1 -1
- package/dist/components/progress/CircularProgress.svelte +78 -4
- package/dist/components/progress/CircularProgress.svelte.d.ts +5 -0
- package/dist/components/progress/LinearProgress.svelte +70 -7
- package/dist/components/progress/LinearProgress.svelte.d.ts +5 -0
- package/dist/components/progress/WavyLinearProgress.svelte +27 -3
- package/dist/components/progress/WavyLinearProgress.svelte.d.ts +3 -0
- package/dist/components/progress/_wavy.d.ts +2 -0
- package/dist/components/progress/_wavy.js +3 -1
- package/dist/components/snackbar/Snackbar.svelte +13 -17
- package/dist/components/table/TableBody.svelte +3 -16
- package/dist/components/table/TableBody.svelte.d.ts +1 -5
- package/dist/components/table/TableHeader.svelte +1 -1
- package/dist/components/table/theme.js +1 -1
- package/dist/components/table/types.d.ts +0 -7
- package/dist/components/time/TimeField.stories.svelte +41 -0
- package/dist/components/time/TimeField.stories.svelte.d.ts +19 -0
- package/dist/components/time/TimeField.svelte +69 -62
- package/dist/components/time/TimeField.svelte.d.ts +6 -0
- package/dist/components/time/TimepickerInput.svelte +8 -4
- package/dist/components/time/types.d.ts +11 -1
- package/dist/components/toolbar/theme.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/component.css +21 -22
- package/dist/styles/motion.css +317 -38
- package/dist/utils/Layer.svelte +16 -29
- package/dist/utils/icon/LoadingIndicator.svelte +61 -22
- package/dist/utils/icon/loadingShapes.d.ts +1 -0
- package/dist/utils/icon/loadingShapes.js +16 -0
- package/package.json +5 -2
- package/dist/actions/clickOutside.d.ts +0 -3
- package/dist/actions/clickOutside.js +0 -13
- package/dist/actions/floating.d.ts +0 -20
- package/dist/actions/floating.js +0 -87
- package/dist/actions/index.d.ts +0 -6
- package/dist/actions/index.js +0 -6
- package/dist/actions/keyboard.d.ts +0 -3
- package/dist/actions/keyboard.js +0 -14
- package/dist/actions/portal.d.ts +0 -3
- package/dist/actions/portal.js +0 -8
- package/dist/actions/positionFloating.d.ts +0 -10
- package/dist/actions/positionFloating.js +0 -59
- package/dist/actions/rovingFocusGroup.d.ts +0 -20
- package/dist/actions/rovingFocusGroup.js +0 -82
- package/dist/animation/easing.d.ts +0 -6
- package/dist/animation/easing.js +0 -78
- package/dist/animation/outroClass.d.ts +0 -3
- package/dist/animation/outroClass.js +0 -20
- package/dist/animation/transitionTypes.d.ts +0 -8
- package/dist/animation/transitionTypes.js +0 -1
|
@@ -4,69 +4,69 @@ Side sheets are supplementary surfaces which are anchored to the edge of the scr
|
|
|
4
4
|
|
|
5
5
|
Like BottomSheet, SideSheet owns its own overlay: it renders as a native `<dialog>` pinned to
|
|
6
6
|
the right edge of the screen, dims the rest of the app behind a backdrop, and slides in/out.
|
|
7
|
-
|
|
8
|
-
rendering
|
|
7
|
+
Visibility is controlled by `bind:open`; the sheet stays mounted until its exit animation
|
|
8
|
+
finishes. Conditionally rendering it ({#if open}<SideSheet close={…} />{/if}) still works, but
|
|
9
|
+
skips the exit animation.
|
|
9
10
|
|
|
10
11
|
@see https://m3.material.io/components/side-sheets/guidelines
|
|
11
12
|
-->
|
|
12
13
|
<script lang="ts">
|
|
13
14
|
import type { SideSheetProps } from './types.js';
|
|
14
|
-
import type { TransitionConfig } from 'svelte/transition';
|
|
15
15
|
import ButtonIcon from '../../buttons/ButtonIcon.svelte';
|
|
16
|
-
import {
|
|
17
|
-
import { outroClass } from '../../../animation/outroClass.js';
|
|
16
|
+
import { enterExit, Presence } from '../../../animation/index.js';
|
|
18
17
|
|
|
19
|
-
let { headline, children, close }: SideSheetProps = $props();
|
|
18
|
+
let { headline, children, open = $bindable(true), close }: SideSheetProps = $props();
|
|
20
19
|
|
|
21
|
-
const
|
|
20
|
+
const sheet = new Presence(() => open);
|
|
22
21
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
duration: options.duration,
|
|
30
|
-
easing: options.easing,
|
|
31
|
-
css: (t) => `transform: translateX(${(1 - t) * width}px)`
|
|
32
|
-
};
|
|
22
|
+
const showModal = (node: HTMLDialogElement) => node.showModal();
|
|
23
|
+
|
|
24
|
+
const dismiss = () => {
|
|
25
|
+
open = false;
|
|
26
|
+
close?.();
|
|
33
27
|
};
|
|
34
28
|
</script>
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
30
|
+
{#if sheet.mounted}
|
|
31
|
+
<dialog
|
|
32
|
+
class="bg-md-sys-color-surface-container-low text-md-sys-color-on-surface fixed inset-y-0 right-0 left-auto m-0 h-full w-full max-w-sm rounded-l-md"
|
|
33
|
+
data-state={open ? 'open' : 'closed'}
|
|
34
|
+
{@attach showModal}
|
|
35
|
+
{@attach sheet.attach(enterExit.sideSheet)}
|
|
36
|
+
oncancel={(e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
dismiss();
|
|
39
|
+
}}
|
|
40
|
+
onmousedown={(e) => {
|
|
41
|
+
if (e.target != e.currentTarget) return;
|
|
42
|
+
dismiss();
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<div class="flex h-full flex-col">
|
|
46
|
+
<div class="flex items-center justify-between p-6">
|
|
47
|
+
<span class="md-sys-typescale-title-large text-md-sys-color-on-surface-variant"
|
|
48
|
+
>{headline}</span
|
|
49
|
+
>
|
|
50
|
+
<ButtonIcon type="button" variant="text" iconProps={{ name: 'close' }} onclick={dismiss} />
|
|
51
|
+
</div>
|
|
52
|
+
{@render children()}
|
|
57
53
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</dialog>
|
|
54
|
+
</dialog>
|
|
55
|
+
{/if}
|
|
61
56
|
|
|
62
57
|
<style>
|
|
63
58
|
dialog::backdrop {
|
|
64
59
|
background-color: rgba(0, 0, 0, 0.5);
|
|
65
|
-
animation: backdrop
|
|
60
|
+
animation: backdrop var(--md-sys-motion-duration-effects-spring)
|
|
61
|
+
var(--md-sys-motion-timing-function-effects-spring);
|
|
62
|
+
}
|
|
63
|
+
dialog[data-state='closed'] {
|
|
64
|
+
pointer-events: none;
|
|
66
65
|
}
|
|
67
|
-
dialog
|
|
66
|
+
dialog[data-state='closed']::backdrop {
|
|
68
67
|
background-color: transparent;
|
|
69
|
-
animation: backdropReverse
|
|
68
|
+
animation: backdropReverse var(--md-sys-motion-duration-fast-effects-spring)
|
|
69
|
+
var(--md-sys-motion-timing-function-fast-effects-spring);
|
|
70
70
|
}
|
|
71
71
|
@keyframes backdrop {
|
|
72
72
|
from {
|
|
@@ -4,11 +4,12 @@ import type { SideSheetProps } from './types.js';
|
|
|
4
4
|
*
|
|
5
5
|
* Like BottomSheet, SideSheet owns its own overlay: it renders as a native `<dialog>` pinned to
|
|
6
6
|
* the right edge of the screen, dims the rest of the app behind a backdrop, and slides in/out.
|
|
7
|
-
*
|
|
8
|
-
* rendering
|
|
7
|
+
* Visibility is controlled by `bind:open`; the sheet stays mounted until its exit animation
|
|
8
|
+
* finishes. Conditionally rendering it ({#if open}<SideSheet close={…} />{/if}) still works, but
|
|
9
|
+
* skips the exit animation.
|
|
9
10
|
*
|
|
10
11
|
* @see https://m3.material.io/components/side-sheets/guidelines
|
|
11
12
|
*/
|
|
12
|
-
declare const SideSheet: import("svelte").Component<SideSheetProps, {}, "">;
|
|
13
|
+
declare const SideSheet: import("svelte").Component<SideSheetProps, {}, "open">;
|
|
13
14
|
type SideSheet = ReturnType<typeof SideSheet>;
|
|
14
15
|
export default SideSheet;
|
|
@@ -12,7 +12,13 @@ export interface SideSheetProps {
|
|
|
12
12
|
*/
|
|
13
13
|
children: Snippet;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Whether the sheet is shown. Bind it (`bind:open`) so the sheet can play its exit animation
|
|
16
|
+
* before unmounting.
|
|
17
|
+
* @default true
|
|
16
18
|
*/
|
|
17
|
-
|
|
19
|
+
open?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the user dismisses the sheet (close button, Esc, backdrop click).
|
|
22
|
+
*/
|
|
23
|
+
close?: () => void;
|
|
18
24
|
}
|
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
DateField is a text field that allows users to enter a date or pick it from a calendar.
|
|
3
|
+
DateField is a text field that allows users to enter a date or pick it from a docked calendar.
|
|
4
|
+
|
|
5
|
+
Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
|
|
4
6
|
|
|
5
7
|
@see https://m3.material.io/components/date-pickers/guidelines
|
|
6
8
|
-->
|
|
7
9
|
<script lang="ts">
|
|
8
|
-
import { DatePicker } from 'bits-ui';
|
|
10
|
+
import { DatePicker, useId } from 'bits-ui';
|
|
11
|
+
import type { DateValue } from '@internationalized/date';
|
|
12
|
+
import { enterExit, presence } from '../../animation/index.js';
|
|
9
13
|
import ButtonIcon from '../buttons/ButtonIcon.svelte';
|
|
10
14
|
import Icon from '../../utils/icon/Icon.svelte';
|
|
11
15
|
import Layer from '../../utils/Layer.svelte';
|
|
12
16
|
import type { DateFieldProps } from './types';
|
|
13
|
-
import {
|
|
17
|
+
import { slideMonth } from './calendarMotion.js';
|
|
18
|
+
import { dateCalendar, dateField, dateSegment } from './theme';
|
|
14
19
|
|
|
15
20
|
let {
|
|
16
21
|
value = $bindable(),
|
|
17
22
|
label,
|
|
18
|
-
id,
|
|
23
|
+
id = useId(),
|
|
19
24
|
required = false,
|
|
20
25
|
disabled = false,
|
|
21
26
|
error = false,
|
|
22
27
|
variant = 'outlined',
|
|
23
28
|
supportingText,
|
|
24
29
|
name,
|
|
30
|
+
locale,
|
|
31
|
+
weekStartsOn,
|
|
25
32
|
leadingIconProps
|
|
26
|
-
}: DateFieldProps
|
|
33
|
+
}: DateFieldProps = $props();
|
|
27
34
|
|
|
28
35
|
const cls = $derived(dateField({ disabled, error, variant }));
|
|
36
|
+
const calendar = dateCalendar();
|
|
37
|
+
|
|
38
|
+
// Starts undefined on purpose: bits-ui writes its own default (from value, else today) through
|
|
39
|
+
// the setter on mount, which is why the getter below can assert.
|
|
40
|
+
let placeholder = $state<DateValue>();
|
|
41
|
+
let grids = $state<HTMLElement | null>(null);
|
|
42
|
+
const setPlaceholder = (next: DateValue) =>
|
|
43
|
+
slideMonth(placeholder, next, grids, (date) => (placeholder = date));
|
|
29
44
|
</script>
|
|
30
45
|
|
|
31
46
|
<DatePicker.Root
|
|
32
47
|
bind:value
|
|
33
|
-
|
|
48
|
+
bind:placeholder={() => placeholder as DateValue, setPlaceholder}
|
|
49
|
+
{weekStartsOn}
|
|
34
50
|
{required}
|
|
35
51
|
{disabled}
|
|
36
|
-
locale
|
|
37
|
-
weekdayFormat="
|
|
52
|
+
{locale}
|
|
53
|
+
weekdayFormat="narrow"
|
|
38
54
|
fixedWeeks
|
|
39
55
|
>
|
|
40
56
|
<div class="relative w-full">
|
|
@@ -47,45 +63,34 @@ DateField is a text field that allows users to enter a date or pick it from a ca
|
|
|
47
63
|
<DatePicker.Input class={cls.input()} {name} id={id ?? undefined}>
|
|
48
64
|
{#snippet children({ segments })}
|
|
49
65
|
<div class={cls.segments()}>
|
|
50
|
-
<div class="flex
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</DatePicker.Segment>
|
|
60
|
-
{:else}
|
|
61
|
-
<DatePicker.Segment
|
|
62
|
-
{part}
|
|
63
|
-
class="text-md-sys-color-on-surface hover:bg-md-sys-color-on-surface/8 focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container focus:outline-md-sys-color-primary
|
|
64
|
-
aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant cursor-default
|
|
65
|
-
rounded-xs
|
|
66
|
-
px-1
|
|
67
|
-
py-0.5
|
|
68
|
-
transition-colors
|
|
69
|
-
duration-100 select-none focus:outline-2
|
|
70
|
-
focus-visible:ring-0! focus-visible:ring-offset-0!"
|
|
71
|
-
>
|
|
72
|
-
{value}
|
|
73
|
-
</DatePicker.Segment>
|
|
74
|
-
{/if}
|
|
75
|
-
{/each}
|
|
76
|
-
</div>
|
|
66
|
+
<div class="flex">
|
|
67
|
+
{#each segments as { part, value: segment }}
|
|
68
|
+
<DatePicker.Segment
|
|
69
|
+
{part}
|
|
70
|
+
class={dateSegment({ part: part === 'literal' ? 'literal' : 'value' })}
|
|
71
|
+
>
|
|
72
|
+
{segment}
|
|
73
|
+
</DatePicker.Segment>
|
|
74
|
+
{/each}
|
|
77
75
|
</div>
|
|
78
76
|
</div>
|
|
79
77
|
{/snippet}
|
|
80
78
|
</DatePicker.Input>
|
|
81
79
|
|
|
82
|
-
<
|
|
80
|
+
<DatePicker.Label class={cls.label()}>
|
|
83
81
|
{label}{#if required}<span class={cls.requiredAsterisk()} aria-hidden="true">*</span>{/if}
|
|
84
|
-
</
|
|
82
|
+
</DatePicker.Label>
|
|
85
83
|
</div>
|
|
86
84
|
|
|
87
|
-
<DatePicker.Trigger
|
|
88
|
-
|
|
85
|
+
<DatePicker.Trigger>
|
|
86
|
+
{#snippet child({ props })}
|
|
87
|
+
<ButtonIcon
|
|
88
|
+
{...props}
|
|
89
|
+
{disabled}
|
|
90
|
+
class={cls.trailingIcon()}
|
|
91
|
+
iconProps={{ name: 'calendar_month' }}
|
|
92
|
+
/>
|
|
93
|
+
{/snippet}
|
|
89
94
|
</DatePicker.Trigger>
|
|
90
95
|
|
|
91
96
|
{#if variant === 'outlined'}
|
|
@@ -103,62 +108,64 @@ DateField is a text field that allows users to enter a date or pick it from a ca
|
|
|
103
108
|
</div>
|
|
104
109
|
{/if}
|
|
105
110
|
</div>
|
|
111
|
+
|
|
106
112
|
<DatePicker.Portal>
|
|
107
|
-
<DatePicker.Content sideOffset={
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
<DatePicker.Content sideOffset={4} align="start">
|
|
114
|
+
{#snippet child({ wrapperProps, props, open })}
|
|
115
|
+
<div {...wrapperProps}>
|
|
116
|
+
<div {...props} {@attach presence(() => open, enterExit.scale)}>
|
|
117
|
+
<DatePicker.Calendar class={calendar.surface()}>
|
|
118
|
+
{#snippet children({ months, weekdays })}
|
|
119
|
+
<DatePicker.Header class={calendar.header()}>
|
|
120
|
+
<DatePicker.Heading class={calendar.heading()} />
|
|
121
|
+
<div class={calendar.nav()}>
|
|
122
|
+
<DatePicker.PrevButton>
|
|
123
|
+
{#snippet child({ props })}
|
|
124
|
+
<ButtonIcon {...props} iconProps={{ name: 'chevron_left' }} />
|
|
125
|
+
{/snippet}
|
|
126
|
+
</DatePicker.PrevButton>
|
|
127
|
+
<DatePicker.NextButton>
|
|
128
|
+
{#snippet child({ props })}
|
|
129
|
+
<ButtonIcon {...props} iconProps={{ name: 'chevron_right' }} />
|
|
130
|
+
{/snippet}
|
|
131
|
+
</DatePicker.NextButton>
|
|
132
|
+
</div>
|
|
133
|
+
</DatePicker.Header>
|
|
123
134
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
<div bind:this={grids}>
|
|
136
|
+
{#each months as month (month.value.toString())}
|
|
137
|
+
<DatePicker.Grid class={calendar.grid()}>
|
|
138
|
+
<DatePicker.GridHead>
|
|
139
|
+
<DatePicker.GridRow class={calendar.row()}>
|
|
140
|
+
{#each weekdays as day, i (i)}
|
|
141
|
+
<DatePicker.HeadCell class={calendar.weekday()}>
|
|
142
|
+
{day}
|
|
143
|
+
</DatePicker.HeadCell>
|
|
144
|
+
{/each}
|
|
145
|
+
</DatePicker.GridRow>
|
|
146
|
+
</DatePicker.GridHead>
|
|
147
|
+
<DatePicker.GridBody>
|
|
148
|
+
{#each month.weeks as weekDates, i (i)}
|
|
149
|
+
<DatePicker.GridRow class={calendar.row()}>
|
|
150
|
+
{#each weekDates as date (date.toString())}
|
|
151
|
+
<DatePicker.Cell {date} month={month.value} class={calendar.cell()}>
|
|
152
|
+
<DatePicker.Day class={calendar.day()}>
|
|
153
|
+
<Layer />
|
|
154
|
+
{date.day}
|
|
155
|
+
</DatePicker.Day>
|
|
156
|
+
</DatePicker.Cell>
|
|
157
|
+
{/each}
|
|
158
|
+
</DatePicker.GridRow>
|
|
159
|
+
{/each}
|
|
160
|
+
</DatePicker.GridBody>
|
|
161
|
+
</DatePicker.Grid>
|
|
134
162
|
{/each}
|
|
135
|
-
</
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<DatePicker.Cell
|
|
142
|
-
{date}
|
|
143
|
-
month={month.value}
|
|
144
|
-
class="md-sys-typescale-body-large text-center"
|
|
145
|
-
>
|
|
146
|
-
<DatePicker.Day
|
|
147
|
-
class="group data-disabled:text-md-sys-color-on-surface/38 data-selected:bg-md-sys-color-primary data-selected:text-md-sys-color-on-primary data-unavailable:text-md-sys-color-on-surface/38 relative flex size-10 items-center justify-center rounded-full bg-transparent p-0 data-disabled:cursor-not-allowed data-outside-month:pointer-events-none data-unavailable:line-through"
|
|
148
|
-
>
|
|
149
|
-
<Layer />
|
|
150
|
-
|
|
151
|
-
{date.day}
|
|
152
|
-
</DatePicker.Day>
|
|
153
|
-
</DatePicker.Cell>
|
|
154
|
-
{/each}
|
|
155
|
-
</DatePicker.GridRow>
|
|
156
|
-
{/each}
|
|
157
|
-
</DatePicker.GridBody>
|
|
158
|
-
</DatePicker.Grid>
|
|
159
|
-
{/each}
|
|
160
|
-
{/snippet}
|
|
161
|
-
</DatePicker.Calendar>
|
|
163
|
+
</div>
|
|
164
|
+
{/snippet}
|
|
165
|
+
</DatePicker.Calendar>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
{/snippet}
|
|
162
169
|
</DatePicker.Content>
|
|
163
170
|
</DatePicker.Portal>
|
|
164
171
|
</DatePicker.Root>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { DateFieldProps } from './types';
|
|
2
|
-
type $$ComponentProps = DateFieldProps & {
|
|
3
|
-
leadingIconProps?: any;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
|
-
* DateField is a text field that allows users to enter a date or pick it from a calendar.
|
|
3
|
+
* DateField is a text field that allows users to enter a date or pick it from a docked calendar.
|
|
4
|
+
*
|
|
5
|
+
* Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
|
|
7
6
|
*
|
|
8
7
|
* @see https://m3.material.io/components/date-pickers/guidelines
|
|
9
8
|
*/
|
|
10
|
-
declare const DateField: import("svelte").Component
|
|
9
|
+
declare const DateField: import("svelte").Component<DateFieldProps, {}, "value">;
|
|
11
10
|
type DateField = ReturnType<typeof DateField>;
|
|
12
11
|
export default DateField;
|