@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.
Files changed (144) hide show
  1. package/dist/animation/Shapes.stories.svelte +56 -0
  2. package/dist/animation/Shapes.stories.svelte.d.ts +3 -0
  3. package/dist/animation/TransitionPatterns.stories.svelte +359 -0
  4. package/dist/animation/TransitionPatterns.stories.svelte.d.ts +3 -0
  5. package/dist/animation/containerTransform.d.ts +35 -12
  6. package/dist/animation/containerTransform.js +31 -138
  7. package/dist/animation/enterExit.d.ts +30 -3
  8. package/dist/animation/enterExit.js +69 -22
  9. package/dist/animation/index.d.ts +2 -1
  10. package/dist/animation/index.js +2 -1
  11. package/dist/animation/presence.svelte.d.ts +47 -0
  12. package/dist/animation/presence.svelte.js +84 -0
  13. package/dist/animation/shapeMorph.svelte.d.ts +52 -0
  14. package/dist/animation/shapeMorph.svelte.js +112 -0
  15. package/dist/animation/shapesAnimatableSmall.d.ts +28 -22
  16. package/dist/animation/shapesAnimatableSmall.js +32 -23
  17. package/dist/animation/sharedAxisTransition.d.ts +57 -37
  18. package/dist/animation/sharedAxisTransition.js +74 -22
  19. package/dist/animation/skeleton.d.ts +16 -0
  20. package/dist/animation/skeleton.js +28 -0
  21. package/dist/animation/spring.d.ts +61 -0
  22. package/dist/animation/spring.js +53 -0
  23. package/dist/animation/springValue.svelte.d.ts +22 -0
  24. package/dist/animation/springValue.svelte.js +42 -0
  25. package/dist/animation/transition.d.ts +3 -1
  26. package/dist/animation/transition.js +3 -1
  27. package/dist/attachments/clickOutside.d.ts +13 -0
  28. package/dist/attachments/clickOutside.js +18 -0
  29. package/dist/attachments/index.d.ts +1 -0
  30. package/dist/attachments/index.js +1 -0
  31. package/dist/components/buttons/FAB.svelte +23 -16
  32. package/dist/components/buttons/FABMenu.svelte +24 -29
  33. package/dist/components/buttons/FABMenu.svelte.d.ts +2 -1
  34. package/dist/components/buttons/FABMenuItem.svelte +23 -20
  35. package/dist/components/buttons/FABMenuItem.svelte.d.ts +5 -1
  36. package/dist/components/buttons/split-button/SplitButton.svelte +10 -17
  37. package/dist/components/buttons/split-button/theme.js +1 -1
  38. package/dist/components/buttons/types.d.ts +3 -3
  39. package/dist/components/cards/theme.js +1 -1
  40. package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +8 -12
  41. package/dist/components/containers/bottom-sheet/BottomSheet.svelte +67 -55
  42. package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +1 -1
  43. package/dist/components/containers/bottom-sheet/types.d.ts +8 -2
  44. package/dist/components/containers/context-menu/ContextMenu.svelte +23 -36
  45. package/dist/components/containers/context-menu/theme.js +2 -2
  46. package/dist/components/containers/dialogue/Dialogue.svelte +49 -65
  47. package/dist/components/containers/link-preview/LinkPreview.svelte +12 -23
  48. package/dist/components/containers/link-preview/theme.d.ts +3 -3
  49. package/dist/components/containers/menu/Menu.svelte +14 -21
  50. package/dist/components/containers/menu/MenuSub.svelte +10 -17
  51. package/dist/components/containers/pane/DraggablePane.svelte +90 -5
  52. package/dist/components/containers/pane/DraggablePane.svelte.d.ts +1 -1
  53. package/dist/components/containers/pane/theme.js +2 -2
  54. package/dist/components/containers/popover/Popover.svelte +31 -42
  55. package/dist/components/containers/popover/theme.d.ts +3 -3
  56. package/dist/components/containers/scroll-area/theme.js +2 -2
  57. package/dist/components/containers/side-sheet/SideSheet.stories.svelte +10 -15
  58. package/dist/components/containers/side-sheet/SideSheet.svelte +44 -44
  59. package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +4 -3
  60. package/dist/components/containers/side-sheet/types.d.ts +8 -2
  61. package/dist/components/date/DateField.svelte +99 -92
  62. package/dist/components/date/DateField.svelte.d.ts +4 -5
  63. package/dist/components/date/DateRangeField.svelte +127 -155
  64. package/dist/components/date/DateRangeField.svelte.d.ts +4 -5
  65. package/dist/components/date/calendarMotion.d.ts +9 -0
  66. package/dist/components/date/calendarMotion.js +23 -0
  67. package/dist/components/date/theme.d.ts +95 -0
  68. package/dist/components/date/theme.js +103 -14
  69. package/dist/components/date/types.d.ts +13 -0
  70. package/dist/components/forms/checkbox/theme.js +2 -2
  71. package/dist/components/forms/command/theme.d.ts +3 -3
  72. package/dist/components/forms/command/theme.js +1 -1
  73. package/dist/components/forms/pin/theme.js +2 -2
  74. package/dist/components/forms/radio-group/theme.js +2 -2
  75. package/dist/components/forms/select/Select.svelte +42 -54
  76. package/dist/components/forms/select/theme.js +4 -4
  77. package/dist/components/forms/slider/Slider.svelte +144 -126
  78. package/dist/components/forms/slider/Slider.svelte.d.ts +3 -0
  79. package/dist/components/forms/slider/theme.d.ts +154 -48
  80. package/dist/components/forms/slider/theme.js +60 -20
  81. package/dist/components/forms/slider/types.d.ts +1 -1
  82. package/dist/components/forms/switch/theme.js +4 -4
  83. package/dist/components/forms/textfield/Textfield.svelte +1 -1
  84. package/dist/components/forms/textfield/theme.d.ts +12 -0
  85. package/dist/components/forms/textfield/theme.js +30 -10
  86. package/dist/components/forms/toggle-group/theme.js +1 -1
  87. package/dist/components/forms/tooltip/Tooltip.svelte +24 -35
  88. package/dist/components/nav/breadcrumb/theme.js +1 -1
  89. package/dist/components/nav/navbar/theme.js +2 -2
  90. package/dist/components/nav/rail/Rail.svelte +4 -5
  91. package/dist/components/nav/rail/theme.js +7 -7
  92. package/dist/components/nav/tabs/TabHolder.svelte +29 -3
  93. package/dist/components/nav/tabs/TabHolder.svelte.d.ts +3 -1
  94. package/dist/components/nav/tabs/theme.js +1 -1
  95. package/dist/components/progress/CircularProgress.svelte +78 -4
  96. package/dist/components/progress/CircularProgress.svelte.d.ts +5 -0
  97. package/dist/components/progress/LinearProgress.svelte +70 -7
  98. package/dist/components/progress/LinearProgress.svelte.d.ts +5 -0
  99. package/dist/components/progress/WavyLinearProgress.svelte +27 -3
  100. package/dist/components/progress/WavyLinearProgress.svelte.d.ts +3 -0
  101. package/dist/components/progress/_wavy.d.ts +2 -0
  102. package/dist/components/progress/_wavy.js +3 -1
  103. package/dist/components/snackbar/Snackbar.svelte +13 -17
  104. package/dist/components/table/TableBody.svelte +3 -16
  105. package/dist/components/table/TableBody.svelte.d.ts +1 -5
  106. package/dist/components/table/TableHeader.svelte +1 -1
  107. package/dist/components/table/theme.js +1 -1
  108. package/dist/components/table/types.d.ts +0 -7
  109. package/dist/components/time/TimeField.stories.svelte +41 -0
  110. package/dist/components/time/TimeField.stories.svelte.d.ts +19 -0
  111. package/dist/components/time/TimeField.svelte +69 -62
  112. package/dist/components/time/TimeField.svelte.d.ts +6 -0
  113. package/dist/components/time/TimepickerInput.svelte +8 -4
  114. package/dist/components/time/types.d.ts +11 -1
  115. package/dist/components/toolbar/theme.js +2 -2
  116. package/dist/index.d.ts +1 -1
  117. package/dist/index.js +1 -1
  118. package/dist/styles/component.css +21 -22
  119. package/dist/styles/motion.css +317 -38
  120. package/dist/utils/Layer.svelte +16 -29
  121. package/dist/utils/icon/LoadingIndicator.svelte +61 -22
  122. package/dist/utils/icon/loadingShapes.d.ts +1 -0
  123. package/dist/utils/icon/loadingShapes.js +16 -0
  124. package/package.json +5 -2
  125. package/dist/actions/clickOutside.d.ts +0 -3
  126. package/dist/actions/clickOutside.js +0 -13
  127. package/dist/actions/floating.d.ts +0 -20
  128. package/dist/actions/floating.js +0 -87
  129. package/dist/actions/index.d.ts +0 -6
  130. package/dist/actions/index.js +0 -6
  131. package/dist/actions/keyboard.d.ts +0 -3
  132. package/dist/actions/keyboard.js +0 -14
  133. package/dist/actions/portal.d.ts +0 -3
  134. package/dist/actions/portal.js +0 -8
  135. package/dist/actions/positionFloating.d.ts +0 -10
  136. package/dist/actions/positionFloating.js +0 -59
  137. package/dist/actions/rovingFocusGroup.d.ts +0 -20
  138. package/dist/actions/rovingFocusGroup.js +0 -82
  139. package/dist/animation/easing.d.ts +0 -6
  140. package/dist/animation/easing.js +0 -78
  141. package/dist/animation/outroClass.d.ts +0 -3
  142. package/dist/animation/outroClass.js +0 -20
  143. package/dist/animation/transitionTypes.d.ts +0 -8
  144. 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
- Mounting it calls `showModal()` immediately, so visibility is controlled by conditionally
8
- rendering the component ({#if open}<SideSheet ...>{/if}).
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 { easeEmphasizedAccel, easeEmphasizedDecel } from '../../../animation/easing.js';
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 open = (node: HTMLDialogElement) => node.showModal();
20
+ const sheet = new Presence(() => open);
22
21
 
23
- const slideAnim = (
24
- node: HTMLDialogElement,
25
- options: { duration: number; easing: typeof easeEmphasizedDecel }
26
- ): TransitionConfig => {
27
- const width = node.getBoundingClientRect().width;
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
- <dialog
37
- 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"
38
- use:open
39
- use:outroClass
40
- oncancel={(e) => {
41
- e.preventDefault();
42
- close();
43
- }}
44
- onmousedown={(e) => {
45
- if (e.target != e.currentTarget) return;
46
- close();
47
- }}
48
- in:slideAnim={{ easing: easeEmphasizedDecel, duration: 400 }}
49
- out:slideAnim={{ easing: easeEmphasizedAccel, duration: 300 }}
50
- >
51
- <div class="flex h-full flex-col">
52
- <div class="flex items-center justify-between p-6">
53
- <span class="md-sys-typescale-title-large text-md-sys-color-on-surface-variant"
54
- >{headline}</span
55
- >
56
- <ButtonIcon type="button" variant="text" iconProps={{ name: 'close' }} onclick={close} />
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
- {@render children()}
59
- </div>
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 400ms;
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:global(.leaving)::backdrop {
66
+ dialog[data-state='closed']::backdrop {
68
67
  background-color: transparent;
69
- animation: backdropReverse 400ms;
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
- * Mounting it calls `showModal()` immediately, so visibility is controlled by conditionally
8
- * rendering the component ({#if open}<SideSheet ...>{/if}).
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
- * Callback function to close the side sheet.
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
- close: () => void;
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 { dateField } from './theme';
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 & { leadingIconProps?: any } = $props();
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
- weekStartsOn={1}
48
+ bind:placeholder={() => placeholder as DateValue, setPlaceholder}
49
+ {weekStartsOn}
34
50
  {required}
35
51
  {disabled}
36
- locale="ru"
37
- weekdayFormat="short"
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 items-center justify-between">
51
- <div class="flex">
52
- {#each segments as { part, value }}
53
- {#if part === 'literal'}
54
- <DatePicker.Segment
55
- {part}
56
- class="text-md-sys-color-on-surface-variant px-0.5 select-none first:pl-0"
57
- >
58
- {value}
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
- <label class={cls.label()} for={id}>
80
+ <DatePicker.Label class={cls.label()}>
83
81
  {label}{#if required}<span class={cls.requiredAsterisk()} aria-hidden="true">*</span>{/if}
84
- </label>
82
+ </DatePicker.Label>
85
83
  </div>
86
84
 
87
- <DatePicker.Trigger class={cls.trailingIcon({ class: 'flex items-center justify-center' })}>
88
- <Icon name="calendar_month" />
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={6} class="z-[100]">
108
- <DatePicker.Calendar
109
- class="bg-md-sys-color-surface-container-high shadow-elevation-3 h-104 w-90 rounded-lg p-6"
110
- >
111
- {#snippet children({ months, weekdays })}
112
- <DatePicker.Header
113
- class="text-md-sys-color-on-surface-variant z-10 flex w-full items-center justify-between pb-7.5"
114
- >
115
- <DatePicker.PrevButton>
116
- <ButtonIcon type="button" iconProps={{ name: 'chevron_left' }} />
117
- </DatePicker.PrevButton>
118
- <DatePicker.Heading class="md-sys-typescale-label-large" />
119
- <DatePicker.NextButton>
120
- <ButtonIcon type="button" iconProps={{ name: 'chevron_right' }} />
121
- </DatePicker.NextButton>
122
- </DatePicker.Header>
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
- {#each months as month}
125
- <DatePicker.Grid class="w-full border-collapse select-none">
126
- <DatePicker.GridHead>
127
- <DatePicker.GridRow class="flex w-full justify-between">
128
- {#each weekdays as day}
129
- <DatePicker.HeadCell
130
- class="md-sys-typescale-label-large text-md-sys-color-on-surface-variant size-10"
131
- >
132
- {day}
133
- </DatePicker.HeadCell>
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
- </DatePicker.GridRow>
136
- </DatePicker.GridHead>
137
- <DatePicker.GridBody>
138
- {#each month.weeks as weekDates}
139
- <DatePicker.GridRow class="flex w-full justify-between">
140
- {#each weekDates as date}
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<$$ComponentProps, {}, "value">;
9
+ declare const DateField: import("svelte").Component<DateFieldProps, {}, "value">;
11
10
  type DateField = ReturnType<typeof DateField>;
12
11
  export default DateField;