@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
@@ -1,140 +1,113 @@
1
1
  <!--
2
2
  @component
3
3
  DateRangeField lets users enter or pick a date range (start + end) via two
4
- segment inputs and a shared calendar popover.
4
+ segment inputs and a shared docked calendar.
5
+
6
+ Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
5
7
 
6
8
  @see https://m3.material.io/components/date-pickers/guidelines
7
9
  -->
8
10
  <script lang="ts">
9
- import { DateRangePicker } from 'bits-ui';
11
+ import { DateRangePicker, Portal, useId } from 'bits-ui';
12
+ import type { DateValue } from '@internationalized/date';
13
+ import { enterExit, presence } from '../../animation/index.js';
10
14
  import ButtonIcon from '../buttons/ButtonIcon.svelte';
11
15
  import Icon from '../../utils/icon/Icon.svelte';
12
16
  import Layer from '../../utils/Layer.svelte';
13
17
  import type { DateRangeFieldProps } from './types';
14
- import { dateRangeField } from './theme';
18
+ import { slideMonth } from './calendarMotion.js';
19
+ import { dateCalendar, dateRangeField, dateSegment } from './theme';
15
20
 
16
21
  let {
17
22
  value = $bindable(),
18
23
  label,
19
24
  startLabel = 'Start',
20
25
  endLabel = 'End',
21
- id,
26
+ id = useId(),
22
27
  required = false,
23
28
  disabled = false,
24
29
  error = false,
25
30
  variant = 'outlined',
26
31
  supportingText,
27
32
  name,
33
+ locale,
34
+ weekStartsOn,
28
35
  leadingIconProps
29
- }: DateRangeFieldProps & { leadingIconProps?: any } = $props();
36
+ }: DateRangeFieldProps = $props();
30
37
 
31
38
  const cls = $derived(dateRangeField({ disabled, error, variant }));
39
+ const calendar = dateCalendar();
40
+
41
+ // Starts undefined on purpose: bits-ui writes its own default (from value, else today) through
42
+ // the setter on mount, which is why the getter below can assert.
43
+ let placeholder = $state<DateValue>();
44
+ let grids = $state<HTMLElement | null>(null);
45
+ const setPlaceholder = (next: DateValue) =>
46
+ slideMonth(placeholder, next, grids, (date) => (placeholder = date));
32
47
  </script>
33
48
 
49
+ {#snippet rangeInput(type: 'start' | 'end', fieldLabel: string)}
50
+ <div class={cls.inputWrapper()}>
51
+ <DateRangePicker.Input
52
+ {type}
53
+ class={cls.input()}
54
+ name={type === 'start' ? name : undefined}
55
+ id={`${id}-${type}`}
56
+ >
57
+ {#snippet children({ segments })}
58
+ <div class="flex w-full pt-4 tabular-nums">
59
+ {#each segments as { part, value: segment }}
60
+ <DateRangePicker.Segment
61
+ {part}
62
+ class={dateSegment({ part: part === 'literal' ? 'literal' : 'value' })}
63
+ >
64
+ {segment}
65
+ </DateRangePicker.Segment>
66
+ {/each}
67
+ </div>
68
+ {/snippet}
69
+ </DateRangePicker.Input>
70
+
71
+ <span class={cls.label()}>
72
+ {fieldLabel}{#if required}<span class={cls.requiredAsterisk()} aria-hidden="true">*</span
73
+ >{/if}
74
+ </span>
75
+ </div>
76
+ {/snippet}
77
+
34
78
  <DateRangePicker.Root
35
79
  bind:value
36
- weekStartsOn={1}
80
+ bind:placeholder={() => placeholder as DateValue, setPlaceholder}
81
+ {weekStartsOn}
37
82
  {required}
38
83
  {disabled}
39
- locale="ru"
40
- weekdayFormat="short"
84
+ {locale}
85
+ weekdayFormat="narrow"
41
86
  fixedWeeks
42
87
  closeOnRangeSelect
43
88
  >
44
89
  <div class="relative w-full">
90
+ {#if label}
91
+ <DateRangePicker.Label class="sr-only">{label}</DateRangePicker.Label>
92
+ {/if}
45
93
  <div class={cls.base()} data-invalid={error || undefined}>
46
94
  {#if leadingIconProps}
47
95
  <Icon class={cls.leadingIcon()} {...leadingIconProps} />
48
96
  {/if}
49
97
 
50
- <div class={cls.inputWrapper()}>
51
- <!-- Start date input -->
52
- <DateRangePicker.Input type="start" class={cls.input()} {name} id={id ?? undefined}>
53
- {#snippet children({ segments })}
54
- <div class="flex w-full flex-col pt-4 tabular-nums">
55
- <div class="flex">
56
- {#each segments as { part, value: segVal }}
57
- {#if part === 'literal'}
58
- <DateRangePicker.Segment
59
- {part}
60
- class="text-md-sys-color-on-surface-variant px-0.5 select-none first:pl-0"
61
- >
62
- {segVal}
63
- </DateRangePicker.Segment>
64
- {:else}
65
- <DateRangePicker.Segment
66
- {part}
67
- 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
68
- aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant cursor-default rounded-xs
69
- px-1
70
- py-0.5
71
- transition-colors
72
- duration-100 select-none focus:outline-2
73
- focus-visible:ring-0! focus-visible:ring-offset-0!"
74
- >
75
- {segVal}
76
- </DateRangePicker.Segment>
77
- {/if}
78
- {/each}
79
- </div>
80
- </div>
81
- {/snippet}
82
- </DateRangePicker.Input>
83
-
84
- <label class={cls.label()} for={id}>
85
- {startLabel ?? label}{#if required}<span class={cls.requiredAsterisk()} aria-hidden="true"
86
- >*</span
87
- >{/if}
88
- </label>
89
- </div>
90
-
98
+ {@render rangeInput('start', startLabel)}
91
99
  <span class={cls.separator()}>–</span>
100
+ {@render rangeInput('end', endLabel)}
92
101
 
93
- <div class={cls.inputWrapper()}>
94
- <!-- End date input -->
95
- <DateRangePicker.Input type="end" class={cls.input()} id={id ? `${id}-end` : undefined}>
96
- {#snippet children({ segments })}
97
- <div class="flex w-full flex-col pt-4 tabular-nums">
98
- <div class="flex">
99
- {#each segments as { part, value: segVal }}
100
- {#if part === 'literal'}
101
- <DateRangePicker.Segment
102
- {part}
103
- class="text-md-sys-color-on-surface-variant px-0.5 select-none first:pl-0"
104
- >
105
- {segVal}
106
- </DateRangePicker.Segment>
107
- {:else}
108
- <DateRangePicker.Segment
109
- {part}
110
- 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
111
- aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant cursor-default rounded-xs
112
- px-1
113
- py-0.5
114
- transition-colors
115
- duration-100 select-none focus:outline-2
116
- focus-visible:ring-0! focus-visible:ring-offset-0!"
117
- >
118
- {segVal}
119
- </DateRangePicker.Segment>
120
- {/if}
121
- {/each}
122
- </div>
123
- </div>
124
- {/snippet}
125
- </DateRangePicker.Input>
126
-
127
- <label class={cls.label()} for={id ? `${id}-end` : undefined}>
128
- {endLabel ?? label}{#if required}<span class={cls.requiredAsterisk()} aria-hidden="true"
129
- >*</span
130
- >{/if}
131
- </label>
132
- </div>
133
-
134
- <DateRangePicker.Trigger
135
- class={cls.trailingIcon({ class: 'flex items-center justify-center' })}
136
- >
137
- <Icon name="calendar_month" />
102
+ <DateRangePicker.Trigger>
103
+ {#snippet child({ props })}
104
+ <ButtonIcon
105
+ {...props}
106
+ {disabled}
107
+ class={cls.trailingIcon()}
108
+ iconProps={{ name: 'date_range' }}
109
+ />
110
+ {/snippet}
138
111
  </DateRangePicker.Trigger>
139
112
  </div>
140
113
 
@@ -145,68 +118,67 @@ segment inputs and a shared calendar popover.
145
118
  {/if}
146
119
  </div>
147
120
 
148
- <DateRangePicker.Content sideOffset={6} class="z-[100]">
149
- <DateRangePicker.Calendar
150
- class="bg-md-sys-color-surface-container-high shadow-elevation-3 h-104 w-90 rounded-lg p-6"
151
- >
152
- {#snippet children({ months, weekdays })}
153
- <DateRangePicker.Header
154
- class="text-md-sys-color-on-surface-variant z-10 flex w-full items-center justify-between pb-7.5"
155
- >
156
- <DateRangePicker.PrevButton>
157
- <ButtonIcon type="button" iconProps={{ name: 'chevron_left' }} />
158
- </DateRangePicker.PrevButton>
159
- <DateRangePicker.Heading class="md-sys-typescale-label-large" />
160
- <DateRangePicker.NextButton>
161
- <ButtonIcon type="button" iconProps={{ name: 'chevron_right' }} />
162
- </DateRangePicker.NextButton>
163
- </DateRangePicker.Header>
121
+ <Portal>
122
+ <DateRangePicker.Content sideOffset={4} align="start">
123
+ {#snippet child({ wrapperProps, props, open })}
124
+ <div {...wrapperProps}>
125
+ <div {...props} {@attach presence(() => open, enterExit.scale)}>
126
+ <DateRangePicker.Calendar class={calendar.surface()}>
127
+ {#snippet children({ months, weekdays })}
128
+ <DateRangePicker.Header class={calendar.header()}>
129
+ <DateRangePicker.Heading class={calendar.heading()} />
130
+ <div class={calendar.nav()}>
131
+ <DateRangePicker.PrevButton>
132
+ {#snippet child({ props })}
133
+ <ButtonIcon {...props} iconProps={{ name: 'chevron_left' }} />
134
+ {/snippet}
135
+ </DateRangePicker.PrevButton>
136
+ <DateRangePicker.NextButton>
137
+ {#snippet child({ props })}
138
+ <ButtonIcon {...props} iconProps={{ name: 'chevron_right' }} />
139
+ {/snippet}
140
+ </DateRangePicker.NextButton>
141
+ </div>
142
+ </DateRangePicker.Header>
164
143
 
165
- {#each months as month}
166
- <DateRangePicker.Grid class="w-full border-collapse select-none">
167
- <DateRangePicker.GridHead>
168
- <DateRangePicker.GridRow class="flex w-full justify-between">
169
- {#each weekdays as day}
170
- <DateRangePicker.HeadCell
171
- class="md-sys-typescale-label-large text-md-sys-color-on-surface-variant size-10"
172
- >
173
- {day}
174
- </DateRangePicker.HeadCell>
175
- {/each}
176
- </DateRangePicker.GridRow>
177
- </DateRangePicker.GridHead>
178
- <DateRangePicker.GridBody>
179
- {#each month.weeks as weekDates}
180
- <DateRangePicker.GridRow class="flex w-full justify-between">
181
- {#each weekDates as date}
182
- <DateRangePicker.Cell
183
- {date}
184
- month={month.value}
185
- class="md-sys-typescale-body-large text-center"
186
- >
187
- <DateRangePicker.Day
188
- class="group data-disabled:text-md-sys-color-on-surface/38 data-highlighted:bg-md-sys-color-primary-container/20 data-range-end:bg-md-sys-color-primary data-range-end:text-md-sys-color-on-primary data-range-middle:bg-md-sys-color-primary-container/40 data-range-start:bg-md-sys-color-primary
189
- data-range-start:text-md-sys-color-on-primary data-selected:bg-md-sys-color-primary data-selected:text-md-sys-color-on-primary data-unavailable:text-md-sys-color-on-surface/38
190
- relative flex
191
- size-10 items-center
192
- justify-center rounded-full
193
- bg-transparent p-0
194
- transition-colors
195
- duration-100 data-disabled:cursor-not-allowed
196
- data-outside-month:pointer-events-none data-outside-month:opacity-0
197
- data-range-middle:rounded-none data-unavailable:line-through"
198
- >
199
- <Layer />
200
- {date.day}
201
- </DateRangePicker.Day>
202
- </DateRangePicker.Cell>
144
+ <div bind:this={grids}>
145
+ {#each months as month (month.value.toString())}
146
+ <DateRangePicker.Grid class={calendar.grid()}>
147
+ <DateRangePicker.GridHead>
148
+ <DateRangePicker.GridRow class={calendar.row()}>
149
+ {#each weekdays as day, i (i)}
150
+ <DateRangePicker.HeadCell class={calendar.weekday()}>
151
+ {day}
152
+ </DateRangePicker.HeadCell>
153
+ {/each}
154
+ </DateRangePicker.GridRow>
155
+ </DateRangePicker.GridHead>
156
+ <DateRangePicker.GridBody>
157
+ {#each month.weeks as weekDates, i (i)}
158
+ <DateRangePicker.GridRow class={calendar.row()}>
159
+ {#each weekDates as date (date.toString())}
160
+ <DateRangePicker.Cell
161
+ {date}
162
+ month={month.value}
163
+ class={calendar.cell()}
164
+ >
165
+ <DateRangePicker.Day class={calendar.day()}>
166
+ <Layer />
167
+ {date.day}
168
+ </DateRangePicker.Day>
169
+ </DateRangePicker.Cell>
170
+ {/each}
171
+ </DateRangePicker.GridRow>
172
+ {/each}
173
+ </DateRangePicker.GridBody>
174
+ </DateRangePicker.Grid>
203
175
  {/each}
204
- </DateRangePicker.GridRow>
205
- {/each}
206
- </DateRangePicker.GridBody>
207
- </DateRangePicker.Grid>
208
- {/each}
176
+ </div>
177
+ {/snippet}
178
+ </DateRangePicker.Calendar>
179
+ </div>
180
+ </div>
209
181
  {/snippet}
210
- </DateRangePicker.Calendar>
211
- </DateRangePicker.Content>
182
+ </DateRangePicker.Content>
183
+ </Portal>
212
184
  </DateRangePicker.Root>
@@ -1,13 +1,12 @@
1
1
  import type { DateRangeFieldProps } from './types';
2
- type $$ComponentProps = DateRangeFieldProps & {
3
- leadingIconProps?: any;
4
- };
5
2
  /**
6
3
  * DateRangeField lets users enter or pick a date range (start + end) via two
7
- * segment inputs and a shared calendar popover.
4
+ * segment inputs and a shared docked calendar.
5
+ *
6
+ * Changing the visible month slides the grid with the M3 lateral transition (see calendarMotion.ts).
8
7
  *
9
8
  * @see https://m3.material.io/components/date-pickers/guidelines
10
9
  */
11
- declare const DateRangeField: import("svelte").Component<$$ComponentProps, {}, "value">;
10
+ declare const DateRangeField: import("svelte").Component<DateRangeFieldProps, {}, "value">;
12
11
  type DateRangeField = ReturnType<typeof DateRangeField>;
13
12
  export default DateRangeField;
@@ -0,0 +1,9 @@
1
+ import type { DateValue } from '@internationalized/date';
2
+ /**
3
+ * Applies a new calendar placeholder (the month the grid shows). When the visible month changes
4
+ * while the calendar is open, the grid runs the M3 lateral transition — months are peers, so a
5
+ * later month pushes in from the right and an earlier one from the left. Covers every way the
6
+ * month changes: prev/next buttons, arrow keys past the month edge, picking an outside day.
7
+ * https://m3.material.io/styles/motion/transitions/transition-patterns#lateral
8
+ */
9
+ export declare const slideMonth: (current: DateValue | undefined, next: DateValue, target: HTMLElement | null | undefined, apply: (next: DateValue) => void) => undefined;
@@ -0,0 +1,23 @@
1
+ import { lateral } from '../../animation/index.js';
2
+ import { tick } from 'svelte';
3
+ const monthIndex = (date) => date.year * 12 + date.month;
4
+ /**
5
+ * Applies a new calendar placeholder (the month the grid shows). When the visible month changes
6
+ * while the calendar is open, the grid runs the M3 lateral transition — months are peers, so a
7
+ * later month pushes in from the right and an earlier one from the left. Covers every way the
8
+ * month changes: prev/next buttons, arrow keys past the month edge, picking an outside day.
9
+ * https://m3.material.io/styles/motion/transitions/transition-patterns#lateral
10
+ */
11
+ export const slideMonth = (current, next, target, apply) => {
12
+ const update = async () => {
13
+ apply(next);
14
+ await tick();
15
+ };
16
+ if (!current || !target?.isConnected || monthIndex(current) === monthIndex(next)) {
17
+ return void update();
18
+ }
19
+ lateral(update, {
20
+ target,
21
+ direction: monthIndex(next) > monthIndex(current) ? 'forward' : 'backward'
22
+ });
23
+ };
@@ -225,3 +225,98 @@ export declare const dateField: import("tailwind-variants").TVReturnType<{
225
225
  legend: string;
226
226
  legendLabel: string;
227
227
  }>>;
228
+ /** Segments of the typed date (`DatePicker.Segment` / `DateRangePicker.Segment`). */
229
+ export declare const dateSegment: import("tailwind-variants").TVReturnType<{
230
+ part: {
231
+ literal: "text-md-sys-color-on-surface-variant px-0";
232
+ value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
233
+ };
234
+ }, undefined, "\n rounded-xs px-0.5 py-0.5 select-none cursor-default outline-none\n transition-colors md-sys-motion-fast-effects\n ", {
235
+ part: {
236
+ literal: "text-md-sys-color-on-surface-variant px-0";
237
+ value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
238
+ };
239
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
240
+ part: {
241
+ literal: "text-md-sys-color-on-surface-variant px-0";
242
+ value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
243
+ };
244
+ }, undefined>>;
245
+ /**
246
+ * Docked date picker surface, shared by DateField and DateRangeField.
247
+ * @see https://m3.material.io/components/date-pickers/specs#docked-date-picker
248
+ * 360dp wide = 12dp padding + 7 × 48dp targets; each day is a 40dp circle inside its target.
249
+ */
250
+ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
251
+ [key: string]: {
252
+ [key: string]: import("tailwind-variants").ClassValue | {
253
+ grid?: import("tailwind-variants").ClassValue;
254
+ surface?: import("tailwind-variants").ClassValue;
255
+ header?: import("tailwind-variants").ClassValue;
256
+ nav?: import("tailwind-variants").ClassValue;
257
+ cell?: import("tailwind-variants").ClassValue;
258
+ heading?: import("tailwind-variants").ClassValue;
259
+ row?: import("tailwind-variants").ClassValue;
260
+ weekday?: import("tailwind-variants").ClassValue;
261
+ day?: import("tailwind-variants").ClassValue;
262
+ };
263
+ };
264
+ } | {
265
+ [x: string]: {
266
+ [x: string]: import("tailwind-variants").ClassValue | {
267
+ grid?: import("tailwind-variants").ClassValue;
268
+ surface?: import("tailwind-variants").ClassValue;
269
+ header?: import("tailwind-variants").ClassValue;
270
+ nav?: import("tailwind-variants").ClassValue;
271
+ cell?: import("tailwind-variants").ClassValue;
272
+ heading?: import("tailwind-variants").ClassValue;
273
+ row?: import("tailwind-variants").ClassValue;
274
+ weekday?: import("tailwind-variants").ClassValue;
275
+ day?: import("tailwind-variants").ClassValue;
276
+ };
277
+ };
278
+ } | {}, {
279
+ surface: string;
280
+ header: string;
281
+ heading: string;
282
+ nav: string;
283
+ grid: string;
284
+ row: string;
285
+ weekday: string;
286
+ cell: string;
287
+ day: string;
288
+ }, undefined, {
289
+ [key: string]: {
290
+ [key: string]: import("tailwind-variants").ClassValue | {
291
+ grid?: import("tailwind-variants").ClassValue;
292
+ surface?: import("tailwind-variants").ClassValue;
293
+ header?: import("tailwind-variants").ClassValue;
294
+ nav?: import("tailwind-variants").ClassValue;
295
+ cell?: import("tailwind-variants").ClassValue;
296
+ heading?: import("tailwind-variants").ClassValue;
297
+ row?: import("tailwind-variants").ClassValue;
298
+ weekday?: import("tailwind-variants").ClassValue;
299
+ day?: import("tailwind-variants").ClassValue;
300
+ };
301
+ };
302
+ } | {}, {
303
+ surface: string;
304
+ header: string;
305
+ heading: string;
306
+ nav: string;
307
+ grid: string;
308
+ row: string;
309
+ weekday: string;
310
+ cell: string;
311
+ day: string;
312
+ }, import("tailwind-variants").TVReturnTypeLike<unknown, {
313
+ surface: string;
314
+ header: string;
315
+ heading: string;
316
+ nav: string;
317
+ grid: string;
318
+ row: string;
319
+ weekday: string;
320
+ cell: string;
321
+ day: string;
322
+ }>>;