bits-ui 2.4.0 → 2.5.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/dist/bits/alert-dialog/components/alert-dialog-content.svelte +1 -0
- package/dist/bits/calendar/calendar.svelte.d.ts +77 -1
- package/dist/bits/calendar/calendar.svelte.js +169 -9
- package/dist/bits/calendar/components/calendar-month-select.svelte +54 -0
- package/dist/bits/calendar/components/calendar-month-select.svelte.d.ts +4 -0
- package/dist/bits/calendar/components/calendar-year-select.svelte +51 -0
- package/dist/bits/calendar/components/calendar-year-select.svelte.d.ts +4 -0
- package/dist/bits/calendar/components/calendar.svelte +6 -0
- package/dist/bits/calendar/exports.d.ts +3 -1
- package/dist/bits/calendar/exports.js +2 -0
- package/dist/bits/calendar/types.d.ts +94 -12
- package/dist/bits/combobox/types.d.ts +1 -1
- package/dist/bits/date-field/date-field.svelte.js +5 -1
- package/dist/bits/date-picker/components/date-picker-calendar.svelte +3 -0
- package/dist/bits/date-picker/components/date-picker.svelte +4 -0
- package/dist/bits/date-picker/date-picker.svelte.d.ts +2 -0
- package/dist/bits/date-picker/exports.d.ts +3 -1
- package/dist/bits/date-picker/exports.js +2 -0
- package/dist/bits/date-picker/types.d.ts +13 -1
- package/dist/bits/date-range-field/date-range-field.svelte.js +5 -1
- package/dist/bits/date-range-picker/components/date-range-picker-calendar.svelte +5 -0
- package/dist/bits/date-range-picker/components/date-range-picker.svelte +10 -0
- package/dist/bits/date-range-picker/date-range-picker.svelte.d.ts +5 -0
- package/dist/bits/date-range-picker/exports.d.ts +3 -1
- package/dist/bits/date-range-picker/exports.js +2 -0
- package/dist/bits/date-range-picker/types.d.ts +33 -1
- package/dist/bits/dialog/components/dialog-content.svelte +1 -0
- package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +1 -0
- package/dist/bits/range-calendar/components/range-calendar.svelte +10 -0
- package/dist/bits/range-calendar/exports.d.ts +3 -1
- package/dist/bits/range-calendar/exports.js +2 -0
- package/dist/bits/range-calendar/range-calendar.svelte.d.ts +20 -0
- package/dist/bits/range-calendar/range-calendar.svelte.js +120 -6
- package/dist/bits/range-calendar/types.d.ts +44 -12
- package/dist/bits/scroll-area/scroll-area.svelte.js +1 -1
- package/dist/bits/select/components/select-hidden-input.svelte +6 -2
- package/dist/bits/select/components/select-hidden-input.svelte.d.ts +2 -1
- package/dist/bits/select/components/select.svelte +3 -2
- package/dist/bits/select/types.d.ts +5 -0
- package/dist/bits/slider/slider.svelte.d.ts +2 -1
- package/dist/bits/slider/slider.svelte.js +7 -5
- package/dist/bits/utilities/escape-layer/escape-layer.svelte +2 -0
- package/dist/bits/utilities/escape-layer/types.d.ts +2 -0
- package/dist/bits/utilities/escape-layer/use-escape-layer.svelte.d.ts +5 -1
- package/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js +4 -1
- package/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js +2 -0
- package/dist/bits/utilities/popper-layer/popper-layer-inner.svelte +1 -1
- package/dist/internal/date-time/calendar-helpers.svelte.d.ts +8 -2
- package/dist/internal/date-time/calendar-helpers.svelte.js +47 -15
- package/dist/internal/date-time/formatter.d.ts +8 -1
- package/dist/internal/date-time/formatter.js +16 -3
- package/dist/internal/floating-svelte/types.d.ts +12 -0
- package/dist/internal/floating-svelte/use-floating.svelte.js +18 -12
- package/dist/internal/use-grace-area.svelte.js +5 -2
- package/dist/shared/attributes.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DateValue } from "@internationalized/date";
|
|
2
2
|
import type { OnChangeFn, WithChild, Without } from "../../internal/types.js";
|
|
3
|
-
import type { BitsPrimitiveButtonAttributes, BitsPrimitiveDivAttributes, BitsPrimitiveHeaderAttributes, BitsPrimitiveTableAttributes, BitsPrimitiveTbodyAttributes, BitsPrimitiveTdAttributes, BitsPrimitiveThAttributes, BitsPrimitiveTheadAttributes, BitsPrimitiveTrAttributes } from "../../shared/attributes.js";
|
|
3
|
+
import type { BitsPrimitiveButtonAttributes, BitsPrimitiveDivAttributes, BitsPrimitiveHeaderAttributes, BitsPrimitiveSelectAttributes, BitsPrimitiveTableAttributes, BitsPrimitiveTbodyAttributes, BitsPrimitiveTdAttributes, BitsPrimitiveThAttributes, BitsPrimitiveTheadAttributes, BitsPrimitiveTrAttributes } from "../../shared/attributes.js";
|
|
4
4
|
import type { DateMatcher, Month, WeekStartsOn } from "../../shared/date/types.js";
|
|
5
5
|
export type CalendarRootSnippetProps = {
|
|
6
6
|
months: Month<DateValue>[];
|
|
@@ -11,7 +11,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
11
11
|
* The placeholder date, used to control the view of the
|
|
12
12
|
* calendar when no value is present.
|
|
13
13
|
*
|
|
14
|
-
* @
|
|
14
|
+
* @default the current date
|
|
15
15
|
*/
|
|
16
16
|
placeholder?: DateValue;
|
|
17
17
|
/**
|
|
@@ -23,7 +23,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
23
23
|
* Whether or not users can deselect a date once selected
|
|
24
24
|
* without selecting another date.
|
|
25
25
|
*
|
|
26
|
-
* @
|
|
26
|
+
* @default false
|
|
27
27
|
*/
|
|
28
28
|
preventDeselect?: boolean;
|
|
29
29
|
/**
|
|
@@ -37,7 +37,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
37
37
|
/**
|
|
38
38
|
* Whether or not the calendar is disabled.
|
|
39
39
|
*
|
|
40
|
-
* @
|
|
40
|
+
* @default false
|
|
41
41
|
*/
|
|
42
42
|
disabled?: boolean;
|
|
43
43
|
/**
|
|
@@ -51,7 +51,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
51
51
|
* February), clicking the next button changes the view to March and April. If `pagedNavigation`
|
|
52
52
|
* is `false`, the view shifts to February and March.
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
54
|
+
* @default false
|
|
55
55
|
*/
|
|
56
56
|
pagedNavigation?: boolean;
|
|
57
57
|
/**
|
|
@@ -59,7 +59,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
59
59
|
* be a number between 0 and 6, where 0 is Sunday and 6 is
|
|
60
60
|
* Saturday.
|
|
61
61
|
*
|
|
62
|
-
* @
|
|
62
|
+
* @default 0 (Sunday)
|
|
63
63
|
*/
|
|
64
64
|
weekStartsOn?: WeekStartsOn;
|
|
65
65
|
/**
|
|
@@ -72,7 +72,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
72
72
|
* - "narrow": "S", "M", "T", etc.
|
|
73
73
|
*```
|
|
74
74
|
*
|
|
75
|
-
* @
|
|
75
|
+
* @default "narrow"
|
|
76
76
|
*
|
|
77
77
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#weekday
|
|
78
78
|
*/
|
|
@@ -110,14 +110,14 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
110
110
|
* To display 6 weeks per month, you will need to render out the previous
|
|
111
111
|
* and next month's dates in the calendar as well.
|
|
112
112
|
*
|
|
113
|
-
* @
|
|
113
|
+
* @default false
|
|
114
114
|
*/
|
|
115
115
|
fixedWeeks?: boolean;
|
|
116
116
|
/**
|
|
117
117
|
* Determines the number of months to display on the calendar simultaneously.
|
|
118
118
|
* For navigation between months, refer to the `pagedNavigation` prop.
|
|
119
119
|
*
|
|
120
|
-
* @
|
|
120
|
+
* @default 1
|
|
121
121
|
*/
|
|
122
122
|
numberOfMonths?: number;
|
|
123
123
|
/**
|
|
@@ -134,7 +134,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
134
134
|
/**
|
|
135
135
|
* The default locale setting.
|
|
136
136
|
*
|
|
137
|
-
* @
|
|
137
|
+
* @default 'en'
|
|
138
138
|
*/
|
|
139
139
|
locale?: string;
|
|
140
140
|
/**
|
|
@@ -143,7 +143,7 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
143
143
|
* dates. @see disabled for a similar prop that prevents focusing
|
|
144
144
|
* and selecting dates.
|
|
145
145
|
*
|
|
146
|
-
* @
|
|
146
|
+
* @default false
|
|
147
147
|
*/
|
|
148
148
|
readonly?: boolean;
|
|
149
149
|
/**
|
|
@@ -156,9 +156,28 @@ type CalendarBaseRootPropsWithoutHTML = {
|
|
|
156
156
|
* days outside the current month are rendered to fill the calendar grid, but they
|
|
157
157
|
* are not selectable. Setting this prop to `true` will disable this behavior.
|
|
158
158
|
*
|
|
159
|
-
* @
|
|
159
|
+
* @default false
|
|
160
160
|
*/
|
|
161
161
|
disableDaysOutsideMonth?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* The maximum number of days that can be selected in multiple mode.
|
|
164
|
+
* When set, users cannot select more dates than this number.
|
|
165
|
+
*
|
|
166
|
+
* @default undefined
|
|
167
|
+
*/
|
|
168
|
+
maxDays?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The format of the month names in the calendar.
|
|
171
|
+
*
|
|
172
|
+
* @default "long"
|
|
173
|
+
*/
|
|
174
|
+
monthFormat?: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
175
|
+
/**
|
|
176
|
+
* The format of the year names in the calendar.
|
|
177
|
+
*
|
|
178
|
+
* @default "numeric"
|
|
179
|
+
*/
|
|
180
|
+
yearFormat?: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
162
181
|
};
|
|
163
182
|
export type CalendarSingleRootPropsWithoutHTML = {
|
|
164
183
|
/**
|
|
@@ -245,4 +264,67 @@ export type CalendarNextButtonPropsWithoutHTML = WithChild;
|
|
|
245
264
|
export type CalendarNextButtonProps = CalendarNextButtonPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, CalendarNextButtonPropsWithoutHTML>;
|
|
246
265
|
export type CalendarPrevButtonPropsWithoutHTML = WithChild;
|
|
247
266
|
export type CalendarPrevButtonProps = CalendarPrevButtonPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, CalendarPrevButtonPropsWithoutHTML>;
|
|
267
|
+
export type CalendarMonthSelectSnippetProps = {
|
|
268
|
+
monthItems: Array<{
|
|
269
|
+
value: number;
|
|
270
|
+
label: string;
|
|
271
|
+
}>;
|
|
272
|
+
selectedMonthItem: {
|
|
273
|
+
value: number;
|
|
274
|
+
label: string;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export type CalendarMonthSelectPropsWithoutHTML = WithChild<{
|
|
278
|
+
/**
|
|
279
|
+
* An array of month numbers (1-12) to display in the select.
|
|
280
|
+
* This allows for flexible month selection, such as showing only
|
|
281
|
+
* specific months or seasons.
|
|
282
|
+
*
|
|
283
|
+
* @default [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] (all months)
|
|
284
|
+
*/
|
|
285
|
+
months?: number[];
|
|
286
|
+
/**
|
|
287
|
+
* How the month names should be formatted in the select options.
|
|
288
|
+
*
|
|
289
|
+
* - "long": "January", "February", etc.
|
|
290
|
+
* - "short": "Jan", "Feb", etc.
|
|
291
|
+
* - "narrow": "J", "F", etc.
|
|
292
|
+
* - "numeric": "1", "2", etc.
|
|
293
|
+
* - "2-digit": "01", "02", etc.
|
|
294
|
+
*
|
|
295
|
+
* @default "long"
|
|
296
|
+
*/
|
|
297
|
+
monthFormat?: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
298
|
+
}, CalendarMonthSelectSnippetProps>;
|
|
299
|
+
export type CalendarMonthSelectProps = CalendarMonthSelectPropsWithoutHTML & Without<BitsPrimitiveSelectAttributes, CalendarMonthSelectPropsWithoutHTML>;
|
|
300
|
+
export type CalendarYearSelectSnippetProps = {
|
|
301
|
+
yearItems: Array<{
|
|
302
|
+
value: number;
|
|
303
|
+
label: string;
|
|
304
|
+
}>;
|
|
305
|
+
selectedYearItem: {
|
|
306
|
+
value: number;
|
|
307
|
+
label: string;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
export type CalendarYearSelectPropsWithoutHTML = WithChild<{
|
|
311
|
+
/**
|
|
312
|
+
* An array of years to display in the select.
|
|
313
|
+
* This allows for complete control over which years appear,
|
|
314
|
+
* such as showing only years with data or excluding certain periods.
|
|
315
|
+
*
|
|
316
|
+
* @default Array from currentYear - 100 to currentYear
|
|
317
|
+
*/
|
|
318
|
+
years?: number[];
|
|
319
|
+
/**
|
|
320
|
+
* How the year should be formatted in the select options.
|
|
321
|
+
*
|
|
322
|
+
* - "numeric": "2024", "2023", etc.
|
|
323
|
+
* - "2-digit": "24", "23", etc.
|
|
324
|
+
*
|
|
325
|
+
* @default "numeric"
|
|
326
|
+
*/
|
|
327
|
+
yearFormat?: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
328
|
+
}, CalendarYearSelectSnippetProps>;
|
|
329
|
+
export type CalendarYearSelectProps = CalendarYearSelectPropsWithoutHTML & Without<BitsPrimitiveSelectAttributes, CalendarYearSelectPropsWithoutHTML>;
|
|
248
330
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BitsPrimitiveInputAttributes } from "../../shared/attributes.js";
|
|
2
2
|
import type { SelectBaseRootPropsWithoutHTML, SelectMultipleRootPropsWithoutHTML, SelectSingleRootPropsWithoutHTML } from "../select/types.js";
|
|
3
3
|
import type { WithChild, Without } from "../../internal/types.js";
|
|
4
|
-
export type ComboboxBaseRootPropsWithoutHTML = SelectBaseRootPropsWithoutHTML & {
|
|
4
|
+
export type ComboboxBaseRootPropsWithoutHTML = Omit<SelectBaseRootPropsWithoutHTML, "autocomplete"> & {
|
|
5
5
|
/**
|
|
6
6
|
* A read-only value that can be used to programmatically
|
|
7
7
|
* update the input value.
|
|
@@ -127,7 +127,11 @@ export class DateFieldRootState {
|
|
|
127
127
|
this.onInvalid = rangeRoot ? rangeRoot.opts.onInvalid : props.onInvalid;
|
|
128
128
|
this.errorMessageId = rangeRoot ? rangeRoot.opts.errorMessageId : props.errorMessageId;
|
|
129
129
|
this.isInvalidProp = props.isInvalidProp;
|
|
130
|
-
this.formatter = createFormatter(
|
|
130
|
+
this.formatter = createFormatter({
|
|
131
|
+
initialLocale: this.locale.current,
|
|
132
|
+
monthFormat: box.with(() => "long"),
|
|
133
|
+
yearFormat: box.with(() => "numeric"),
|
|
134
|
+
});
|
|
131
135
|
this.initialSegments = initializeSegmentValues(this.inferredGranularity);
|
|
132
136
|
this.segmentValues = this.initialSegments;
|
|
133
137
|
this.announcer = getAnnouncer(null);
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
onDateSelect: datePickerRootState.opts.onDateSelect,
|
|
45
45
|
initialFocus: datePickerRootState.opts.initialFocus,
|
|
46
46
|
defaultPlaceholder: datePickerRootState.opts.defaultPlaceholder,
|
|
47
|
+
maxDays: box.with(() => undefined),
|
|
48
|
+
monthFormat: datePickerRootState.opts.monthFormat,
|
|
49
|
+
yearFormat: datePickerRootState.opts.yearFormat,
|
|
47
50
|
});
|
|
48
51
|
|
|
49
52
|
const mergedProps = $derived(mergeProps(restProps, calendarState.props));
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
initialFocus = false,
|
|
46
46
|
errorMessageId,
|
|
47
47
|
children,
|
|
48
|
+
monthFormat = "long",
|
|
49
|
+
yearFormat = "numeric",
|
|
48
50
|
}: DatePickerRootProps = $props();
|
|
49
51
|
|
|
50
52
|
const defaultPlaceholder = getDefaultDate({
|
|
@@ -123,6 +125,8 @@
|
|
|
123
125
|
initialFocus: box.with(() => initialFocus),
|
|
124
126
|
onDateSelect: box.with(() => onDateSelect),
|
|
125
127
|
defaultPlaceholder,
|
|
128
|
+
monthFormat: box.with(() => monthFormat),
|
|
129
|
+
yearFormat: box.with(() => yearFormat),
|
|
126
130
|
});
|
|
127
131
|
|
|
128
132
|
usePopoverRoot({
|
|
@@ -30,6 +30,8 @@ type DatePickerRootStateProps = WritableBoxedValues<{
|
|
|
30
30
|
disableDaysOutsideMonth: boolean;
|
|
31
31
|
initialFocus: boolean;
|
|
32
32
|
onDateSelect?: () => void;
|
|
33
|
+
monthFormat: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
34
|
+
yearFormat: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
33
35
|
}> & {
|
|
34
36
|
defaultPlaceholder: DateValue;
|
|
35
37
|
};
|
|
@@ -17,7 +17,9 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
17
17
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
18
18
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
19
19
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
20
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
21
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
20
22
|
export { default as Cell } from "../calendar/components/calendar-cell.svelte";
|
|
21
23
|
export { default as Day } from "../calendar/components/calendar-day.svelte";
|
|
22
24
|
export { default as Portal } from "../utilities/portal/portal.svelte";
|
|
23
|
-
export type { DatePickerRootProps as RootProps, DatePickerLabelProps as LabelProps, DatePickerInputProps as InputProps, DatePickerSegmentProps as SegmentProps, DatePickerArrowProps as ArrowProps, DatePickerCloseProps as CloseProps, DatePickerContentProps as ContentProps, DatePickerContentStaticProps as ContentStaticProps, DatePickerTriggerProps as TriggerProps, DatePickerCalendarProps as CalendarProps, DatePickerCellProps as CellProps, DatePickerDayProps as DayProps, DatePickerGridBodyProps as GridBodyProps, DatePickerGridHeadProps as GridHeadProps, DatePickerGridProps as GridProps, DatePickerGridRowProps as GridRowProps, DatePickerHeadCellProps as HeadCellProps, DatePickerHeaderProps as HeaderProps, DatePickerHeadingProps as HeadingProps, DatePickerNextButtonProps as NextButtonProps, DatePickerPrevButtonProps as PrevButtonProps, DatePickerPortalProps as PortalProps, } from "./types.js";
|
|
25
|
+
export type { DatePickerRootProps as RootProps, DatePickerLabelProps as LabelProps, DatePickerInputProps as InputProps, DatePickerSegmentProps as SegmentProps, DatePickerArrowProps as ArrowProps, DatePickerCloseProps as CloseProps, DatePickerContentProps as ContentProps, DatePickerContentStaticProps as ContentStaticProps, DatePickerTriggerProps as TriggerProps, DatePickerCalendarProps as CalendarProps, DatePickerCellProps as CellProps, DatePickerDayProps as DayProps, DatePickerGridBodyProps as GridBodyProps, DatePickerGridHeadProps as GridHeadProps, DatePickerGridProps as GridProps, DatePickerGridRowProps as GridRowProps, DatePickerHeadCellProps as HeadCellProps, DatePickerHeaderProps as HeaderProps, DatePickerHeadingProps as HeadingProps, DatePickerNextButtonProps as NextButtonProps, DatePickerPrevButtonProps as PrevButtonProps, DatePickerPortalProps as PortalProps, DatePickerMonthSelectProps as MonthSelectProps, DatePickerYearSelectProps as YearSelectProps, } from "./types.js";
|
|
@@ -17,6 +17,8 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
17
17
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
18
18
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
19
19
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
20
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
21
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
20
22
|
export { default as Cell } from "../calendar/components/calendar-cell.svelte";
|
|
21
23
|
export { default as Day } from "../calendar/components/calendar-day.svelte";
|
|
22
24
|
export { default as Portal } from "../utilities/portal/portal.svelte";
|
|
@@ -226,6 +226,18 @@ export type DatePickerRootPropsWithoutHTML = WithChildren<{
|
|
|
226
226
|
* date is invalid.
|
|
227
227
|
*/
|
|
228
228
|
errorMessageId?: string;
|
|
229
|
+
/**
|
|
230
|
+
* The format of the month names in the calendar.
|
|
231
|
+
*
|
|
232
|
+
* @default "long"
|
|
233
|
+
*/
|
|
234
|
+
monthFormat?: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
235
|
+
/**
|
|
236
|
+
* The format of the year names in the calendar.
|
|
237
|
+
*
|
|
238
|
+
* @default "numeric"
|
|
239
|
+
*/
|
|
240
|
+
yearFormat?: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
229
241
|
}>;
|
|
230
242
|
export type DatePickerRootProps = DatePickerRootPropsWithoutHTML;
|
|
231
243
|
export type { PopoverTriggerPropsWithoutHTML as DatePickerTriggerPropsWithoutHTML, PopoverTriggerProps as DatePickerTriggerProps, PopoverContentPropsWithoutHTML as DatePickerContentPropsWithoutHTML, PopoverContentProps as DatePickerContentProps, PopoverContentStaticPropsWithoutHTML as DatePickerContentStaticPropsWithoutHTML, PopoverContentStaticProps as DatePickerContentStaticProps, PopoverArrowPropsWithoutHTML as DatePickerArrowPropsWithoutHTML, PopoverArrowProps as DatePickerArrowProps, PopoverClosePropsWithoutHTML as DatePickerClosePropsWithoutHTML, PopoverCloseProps as DatePickerCloseProps, } from "../popover/types.js";
|
|
@@ -234,4 +246,4 @@ export type DatePickerCalendarPropsWithoutHTML = WithChild<{}, CalendarRootSnipp
|
|
|
234
246
|
export type DatePickerCalendarProps = DatePickerCalendarPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, DatePickerCalendarPropsWithoutHTML>;
|
|
235
247
|
export type DatePickerPortalPropsWithoutHTML = PortalProps;
|
|
236
248
|
export type DatePickerPortalProps = DatePickerPortalPropsWithoutHTML;
|
|
237
|
-
export type { CalendarCellPropsWithoutHTML as DatePickerCellPropsWithoutHTML, CalendarCellProps as DatePickerCellProps, CalendarDayPropsWithoutHTML as DatePickerDayPropsWithoutHTML, CalendarDayProps as DatePickerDayProps, CalendarGridPropsWithoutHTML as DatePickerGridPropsWithoutHTML, CalendarGridProps as DatePickerGridProps, CalendarGridBodyPropsWithoutHTML as DatePickerGridBodyPropsWithoutHTML, CalendarGridBodyProps as DatePickerGridBodyProps, CalendarGridHeadPropsWithoutHTML as DatePickerGridHeadPropsWithoutHTML, CalendarGridHeadProps as DatePickerGridHeadProps, CalendarGridRowPropsWithoutHTML as DatePickerGridRowPropsWithoutHTML, CalendarGridRowProps as DatePickerGridRowProps, CalendarHeadCellPropsWithoutHTML as DatePickerHeadCellPropsWithoutHTML, CalendarHeadCellProps as DatePickerHeadCellProps, CalendarHeaderPropsWithoutHTML as DatePickerHeaderPropsWithoutHTML, CalendarHeaderProps as DatePickerHeaderProps, CalendarHeadingPropsWithoutHTML as DatePickerHeadingPropsWithoutHTML, CalendarHeadingProps as DatePickerHeadingProps, CalendarNextButtonPropsWithoutHTML as DatePickerNextButtonPropsWithoutHTML, CalendarNextButtonProps as DatePickerNextButtonProps, CalendarPrevButtonPropsWithoutHTML as DatePickerPrevButtonPropsWithoutHTML, CalendarPrevButtonProps as DatePickerPrevButtonProps, } from "../calendar/types.js";
|
|
249
|
+
export type { CalendarCellPropsWithoutHTML as DatePickerCellPropsWithoutHTML, CalendarCellProps as DatePickerCellProps, CalendarDayPropsWithoutHTML as DatePickerDayPropsWithoutHTML, CalendarDayProps as DatePickerDayProps, CalendarGridPropsWithoutHTML as DatePickerGridPropsWithoutHTML, CalendarGridProps as DatePickerGridProps, CalendarGridBodyPropsWithoutHTML as DatePickerGridBodyPropsWithoutHTML, CalendarGridBodyProps as DatePickerGridBodyProps, CalendarGridHeadPropsWithoutHTML as DatePickerGridHeadPropsWithoutHTML, CalendarGridHeadProps as DatePickerGridHeadProps, CalendarGridRowPropsWithoutHTML as DatePickerGridRowPropsWithoutHTML, CalendarGridRowProps as DatePickerGridRowProps, CalendarHeadCellPropsWithoutHTML as DatePickerHeadCellPropsWithoutHTML, CalendarHeadCellProps as DatePickerHeadCellProps, CalendarHeaderPropsWithoutHTML as DatePickerHeaderPropsWithoutHTML, CalendarHeaderProps as DatePickerHeaderProps, CalendarHeadingPropsWithoutHTML as DatePickerHeadingPropsWithoutHTML, CalendarHeadingProps as DatePickerHeadingProps, CalendarNextButtonPropsWithoutHTML as DatePickerNextButtonPropsWithoutHTML, CalendarNextButtonProps as DatePickerNextButtonProps, CalendarPrevButtonPropsWithoutHTML as DatePickerPrevButtonPropsWithoutHTML, CalendarPrevButtonProps as DatePickerPrevButtonProps, CalendarMonthSelectProps as DatePickerMonthSelectProps, CalendarMonthSelectPropsWithoutHTML as DatePickerMonthSelectPropsWithoutHTML, CalendarYearSelectProps as DatePickerYearSelectProps, CalendarYearSelectPropsWithoutHTML as DatePickerYearSelectPropsWithoutHTML, } from "../calendar/types.js";
|
|
@@ -26,7 +26,11 @@ export class DateRangeFieldRootState {
|
|
|
26
26
|
domContext;
|
|
27
27
|
constructor(opts) {
|
|
28
28
|
this.opts = opts;
|
|
29
|
-
this.formatter = createFormatter(
|
|
29
|
+
this.formatter = createFormatter({
|
|
30
|
+
initialLocale: this.opts.locale.current,
|
|
31
|
+
monthFormat: box.with(() => "long"),
|
|
32
|
+
yearFormat: box.with(() => "numeric"),
|
|
33
|
+
});
|
|
30
34
|
this.domContext = new DOMContext(this.opts.ref);
|
|
31
35
|
onDestroyEffect(() => {
|
|
32
36
|
removeDescriptionElement(this.descriptionId, this.domContext.getDocument());
|
|
@@ -40,10 +40,15 @@
|
|
|
40
40
|
minValue: dateRangePickerRootState.opts.minValue,
|
|
41
41
|
placeholder: dateRangePickerRootState.opts.placeholder,
|
|
42
42
|
value: dateRangePickerRootState.opts.value,
|
|
43
|
+
excludeDisabled: dateRangePickerRootState.opts.excludeDisabled,
|
|
43
44
|
onRangeSelect: dateRangePickerRootState.opts.onRangeSelect,
|
|
44
45
|
startValue: dateRangePickerRootState.opts.startValue,
|
|
45
46
|
endValue: dateRangePickerRootState.opts.endValue,
|
|
46
47
|
defaultPlaceholder: dateRangePickerRootState.opts.defaultPlaceholder,
|
|
48
|
+
minDays: dateRangePickerRootState.opts.minDays,
|
|
49
|
+
maxDays: dateRangePickerRootState.opts.maxDays,
|
|
50
|
+
monthFormat: dateRangePickerRootState.opts.monthFormat,
|
|
51
|
+
yearFormat: dateRangePickerRootState.opts.yearFormat,
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
const mergedProps = $derived(mergeProps(restProps, rangeCalendarState.props));
|
|
@@ -48,8 +48,13 @@
|
|
|
48
48
|
onEndValueChange = noop,
|
|
49
49
|
validate = noop,
|
|
50
50
|
errorMessageId,
|
|
51
|
+
minDays,
|
|
52
|
+
maxDays,
|
|
53
|
+
excludeDisabled = false,
|
|
51
54
|
child,
|
|
52
55
|
children,
|
|
56
|
+
monthFormat = "long",
|
|
57
|
+
yearFormat = "numeric",
|
|
53
58
|
...restProps
|
|
54
59
|
}: DateRangePickerRootProps = $props();
|
|
55
60
|
|
|
@@ -132,6 +137,8 @@
|
|
|
132
137
|
isDateUnavailable: box.with(() => isDateUnavailable),
|
|
133
138
|
minValue: box.with(() => minValue),
|
|
134
139
|
maxValue: box.with(() => maxValue),
|
|
140
|
+
minDays: box.with(() => minDays),
|
|
141
|
+
maxDays: box.with(() => maxDays),
|
|
135
142
|
disabled: box.with(() => disabled),
|
|
136
143
|
readonly: box.with(() => readonly),
|
|
137
144
|
granularity: box.with(() => granularity),
|
|
@@ -149,6 +156,7 @@
|
|
|
149
156
|
isDateDisabled: box.with(() => isDateDisabled),
|
|
150
157
|
fixedWeeks: box.with(() => fixedWeeks),
|
|
151
158
|
numberOfMonths: box.with(() => numberOfMonths),
|
|
159
|
+
excludeDisabled: box.with(() => excludeDisabled),
|
|
152
160
|
onRangeSelect: box.with(() => onRangeSelect),
|
|
153
161
|
startValue: box.with(
|
|
154
162
|
() => startValue,
|
|
@@ -164,6 +172,8 @@
|
|
|
164
172
|
onEndValueChange(v);
|
|
165
173
|
}
|
|
166
174
|
),
|
|
175
|
+
monthFormat: box.with(() => monthFormat),
|
|
176
|
+
yearFormat: box.with(() => yearFormat),
|
|
167
177
|
defaultPlaceholder,
|
|
168
178
|
});
|
|
169
179
|
|
|
@@ -15,6 +15,8 @@ type DateRangePickerRootStateProps = WritableBoxedValues<{
|
|
|
15
15
|
isDateDisabled: DateMatcher;
|
|
16
16
|
minValue: DateValue | undefined;
|
|
17
17
|
maxValue: DateValue | undefined;
|
|
18
|
+
minDays: number | undefined;
|
|
19
|
+
maxDays: number | undefined;
|
|
18
20
|
disabled: boolean;
|
|
19
21
|
readonly: boolean;
|
|
20
22
|
granularity: Granularity | undefined;
|
|
@@ -30,7 +32,10 @@ type DateRangePickerRootStateProps = WritableBoxedValues<{
|
|
|
30
32
|
numberOfMonths: number;
|
|
31
33
|
calendarLabel: string;
|
|
32
34
|
disableDaysOutsideMonth: boolean;
|
|
35
|
+
excludeDisabled: boolean;
|
|
33
36
|
onRangeSelect?: () => void;
|
|
37
|
+
monthFormat: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
38
|
+
yearFormat: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
34
39
|
}> & {
|
|
35
40
|
defaultPlaceholder: DateValue;
|
|
36
41
|
};
|
|
@@ -16,6 +16,8 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
16
16
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
17
17
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
18
18
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
19
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
20
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
19
21
|
export { default as Cell } from "../range-calendar/components/range-calendar-cell.svelte";
|
|
20
22
|
export { default as Day } from "../range-calendar/components/range-calendar-day.svelte";
|
|
21
|
-
export type { DateRangePickerRootProps as RootProps, DateRangePickerLabelProps as LabelProps, DateRangePickerInputProps as InputProps, DateRangePickerSegmentProps as SegmentProps, DateRangePickerArrowProps as ArrowProps, DateRangePickerCloseProps as CloseProps, DateRangePickerContentProps as ContentProps, DateRangePickerTriggerProps as TriggerProps, DateRangePickerCalendarProps as CalendarProps, DateRangePickerCellProps as CellProps, DateRangePickerDayProps as DayProps, DateRangePickerGridBodyProps as GridBodyProps, DateRangePickerGridHeadProps as GridHeadProps, DateRangePickerGridProps as GridProps, DateRangePickerGridRowProps as GridRowProps, DateRangePickerHeadCellProps as HeadCellProps, DateRangePickerHeaderProps as HeaderProps, DateRangePickerHeadingProps as HeadingProps, DateRangePickerNextButtonProps as NextButtonProps, DateRangePickerPrevButtonProps as PrevButtonProps, } from "./types.js";
|
|
23
|
+
export type { DateRangePickerRootProps as RootProps, DateRangePickerLabelProps as LabelProps, DateRangePickerInputProps as InputProps, DateRangePickerSegmentProps as SegmentProps, DateRangePickerArrowProps as ArrowProps, DateRangePickerCloseProps as CloseProps, DateRangePickerContentProps as ContentProps, DateRangePickerTriggerProps as TriggerProps, DateRangePickerCalendarProps as CalendarProps, DateRangePickerCellProps as CellProps, DateRangePickerDayProps as DayProps, DateRangePickerGridBodyProps as GridBodyProps, DateRangePickerGridHeadProps as GridHeadProps, DateRangePickerGridProps as GridProps, DateRangePickerGridRowProps as GridRowProps, DateRangePickerHeadCellProps as HeadCellProps, DateRangePickerHeaderProps as HeaderProps, DateRangePickerHeadingProps as HeadingProps, DateRangePickerNextButtonProps as NextButtonProps, DateRangePickerPrevButtonProps as PrevButtonProps, DateRangePickerMonthSelectProps as MonthSelectProps, DateRangePickerYearSelectProps as YearSelectProps, } from "./types.js";
|
|
@@ -16,5 +16,7 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
16
16
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
17
17
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
18
18
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
19
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
20
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
19
21
|
export { default as Cell } from "../range-calendar/components/range-calendar-cell.svelte";
|
|
20
22
|
export { default as Day } from "../range-calendar/components/range-calendar-day.svelte";
|
|
@@ -233,10 +233,42 @@ export type DateRangePickerRootPropsWithoutHTML = WithChild<{
|
|
|
233
233
|
* date is invalid.
|
|
234
234
|
*/
|
|
235
235
|
errorMessageId?: string;
|
|
236
|
+
/**
|
|
237
|
+
* The minimum number of days that can be selected in a range.
|
|
238
|
+
*
|
|
239
|
+
* @default undefined
|
|
240
|
+
*/
|
|
241
|
+
minDays?: number;
|
|
242
|
+
/**
|
|
243
|
+
* The maximum number of days that can be selected in a range.
|
|
244
|
+
*
|
|
245
|
+
* @default undefined
|
|
246
|
+
*/
|
|
247
|
+
maxDays?: number;
|
|
248
|
+
/**
|
|
249
|
+
* Whether to automatically reset the range if any date within the selected range
|
|
250
|
+
* becomes disabled. When true, the entire range will be cleared if a disabled
|
|
251
|
+
* date is found between the start and end dates.
|
|
252
|
+
*
|
|
253
|
+
* @default false
|
|
254
|
+
*/
|
|
255
|
+
excludeDisabled?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The format of the month names in the calendar.
|
|
258
|
+
*
|
|
259
|
+
* @default "long"
|
|
260
|
+
*/
|
|
261
|
+
monthFormat?: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
262
|
+
/**
|
|
263
|
+
* The format of the year names in the calendar.
|
|
264
|
+
*
|
|
265
|
+
* @default "numeric"
|
|
266
|
+
*/
|
|
267
|
+
yearFormat?: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
236
268
|
}>;
|
|
237
269
|
export type DateRangePickerRootProps = DateRangePickerRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, DateRangePickerRootPropsWithoutHTML>;
|
|
238
270
|
export type { PopoverTriggerPropsWithoutHTML as DateRangePickerTriggerPropsWithoutHTML, PopoverTriggerProps as DateRangePickerTriggerProps, PopoverContentPropsWithoutHTML as DateRangePickerContentPropsWithoutHTML, PopoverContentProps as DateRangePickerContentProps, PopoverArrowPropsWithoutHTML as DateRangePickerArrowPropsWithoutHTML, PopoverArrowProps as DateRangePickerArrowProps, PopoverClosePropsWithoutHTML as DateRangePickerClosePropsWithoutHTML, PopoverCloseProps as DateRangePickerCloseProps, } from "../popover/types.js";
|
|
239
271
|
export type { DateRangeFieldInputPropsWithoutHTML as DateRangePickerInputPropsWithoutHTML, DateRangeFieldInputProps as DateRangePickerInputProps, DateRangeFieldLabelPropsWithoutHTML as DateRangePickerLabelPropsWithoutHTML, DateRangeFieldLabelProps as DateRangePickerLabelProps, DateRangeFieldSegmentPropsWithoutHTML as DateRangePickerSegmentPropsWithoutHTML, DateRangeFieldSegmentProps as DateRangePickerSegmentProps, } from "../date-range-field/types.js";
|
|
240
272
|
export type DateRangePickerCalendarPropsWithoutHTML = WithChild<{}, CalendarRootSnippetProps>;
|
|
241
273
|
export type DateRangePickerCalendarProps = DateRangePickerCalendarPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, DateRangePickerCalendarPropsWithoutHTML>;
|
|
242
|
-
export type { RangeCalendarCellPropsWithoutHTML as DateRangePickerCellPropsWithoutHTML, RangeCalendarCellProps as DateRangePickerCellProps, RangeCalendarDayPropsWithoutHTML as DateRangePickerDayPropsWithoutHTML, RangeCalendarDayProps as DateRangePickerDayProps, RangeCalendarGridPropsWithoutHTML as DateRangePickerGridPropsWithoutHTML, RangeCalendarGridProps as DateRangePickerGridProps, RangeCalendarGridBodyPropsWithoutHTML as DateRangePickerGridBodyPropsWithoutHTML, RangeCalendarGridBodyProps as DateRangePickerGridBodyProps, RangeCalendarGridHeadPropsWithoutHTML as DateRangePickerGridHeadPropsWithoutHTML, RangeCalendarGridHeadProps as DateRangePickerGridHeadProps, RangeCalendarGridRowPropsWithoutHTML as DateRangePickerGridRowPropsWithoutHTML, RangeCalendarGridRowProps as DateRangePickerGridRowProps, RangeCalendarHeadCellPropsWithoutHTML as DateRangePickerHeadCellPropsWithoutHTML, RangeCalendarHeadCellProps as DateRangePickerHeadCellProps, RangeCalendarHeaderPropsWithoutHTML as DateRangePickerHeaderPropsWithoutHTML, RangeCalendarHeaderProps as DateRangePickerHeaderProps, RangeCalendarHeadingPropsWithoutHTML as DateRangePickerHeadingPropsWithoutHTML, RangeCalendarHeadingProps as DateRangePickerHeadingProps, RangeCalendarNextButtonPropsWithoutHTML as DateRangePickerNextButtonPropsWithoutHTML, RangeCalendarNextButtonProps as DateRangePickerNextButtonProps, RangeCalendarPrevButtonPropsWithoutHTML as DateRangePickerPrevButtonPropsWithoutHTML, RangeCalendarPrevButtonProps as DateRangePickerPrevButtonProps, } from "../range-calendar/types.js";
|
|
274
|
+
export type { RangeCalendarCellPropsWithoutHTML as DateRangePickerCellPropsWithoutHTML, RangeCalendarCellProps as DateRangePickerCellProps, RangeCalendarDayPropsWithoutHTML as DateRangePickerDayPropsWithoutHTML, RangeCalendarDayProps as DateRangePickerDayProps, RangeCalendarGridPropsWithoutHTML as DateRangePickerGridPropsWithoutHTML, RangeCalendarGridProps as DateRangePickerGridProps, RangeCalendarGridBodyPropsWithoutHTML as DateRangePickerGridBodyPropsWithoutHTML, RangeCalendarGridBodyProps as DateRangePickerGridBodyProps, RangeCalendarGridHeadPropsWithoutHTML as DateRangePickerGridHeadPropsWithoutHTML, RangeCalendarGridHeadProps as DateRangePickerGridHeadProps, RangeCalendarGridRowPropsWithoutHTML as DateRangePickerGridRowPropsWithoutHTML, RangeCalendarGridRowProps as DateRangePickerGridRowProps, RangeCalendarHeadCellPropsWithoutHTML as DateRangePickerHeadCellPropsWithoutHTML, RangeCalendarHeadCellProps as DateRangePickerHeadCellProps, RangeCalendarHeaderPropsWithoutHTML as DateRangePickerHeaderPropsWithoutHTML, RangeCalendarHeaderProps as DateRangePickerHeaderProps, RangeCalendarHeadingPropsWithoutHTML as DateRangePickerHeadingPropsWithoutHTML, RangeCalendarHeadingProps as DateRangePickerHeadingProps, RangeCalendarNextButtonPropsWithoutHTML as DateRangePickerNextButtonPropsWithoutHTML, RangeCalendarNextButtonProps as DateRangePickerNextButtonProps, RangeCalendarPrevButtonPropsWithoutHTML as DateRangePickerPrevButtonPropsWithoutHTML, RangeCalendarPrevButtonProps as DateRangePickerPrevButtonProps, RangeCalendarMonthSelectProps as DateRangePickerMonthSelectProps, RangeCalendarMonthSelectPropsWithoutHTML as DateRangePickerMonthSelectPropsWithoutHTML, RangeCalendarYearSelectProps as DateRangePickerYearSelectProps, RangeCalendarYearSelectPropsWithoutHTML as DateRangePickerYearSelectPropsWithoutHTML, } from "../range-calendar/types.js";
|
|
@@ -35,8 +35,13 @@
|
|
|
35
35
|
maxValue = undefined,
|
|
36
36
|
preventDeselect = false,
|
|
37
37
|
disableDaysOutsideMonth = true,
|
|
38
|
+
minDays,
|
|
39
|
+
maxDays,
|
|
38
40
|
onStartValueChange = noop,
|
|
39
41
|
onEndValueChange = noop,
|
|
42
|
+
excludeDisabled = false,
|
|
43
|
+
monthFormat = "long",
|
|
44
|
+
yearFormat = "numeric",
|
|
40
45
|
...restProps
|
|
41
46
|
}: RangeCalendarRootProps = $props();
|
|
42
47
|
|
|
@@ -112,6 +117,9 @@
|
|
|
112
117
|
calendarLabel: box.with(() => calendarLabel),
|
|
113
118
|
fixedWeeks: box.with(() => fixedWeeks),
|
|
114
119
|
disableDaysOutsideMonth: box.with(() => disableDaysOutsideMonth),
|
|
120
|
+
minDays: box.with(() => minDays),
|
|
121
|
+
maxDays: box.with(() => maxDays),
|
|
122
|
+
excludeDisabled: box.with(() => excludeDisabled),
|
|
115
123
|
startValue: box.with(
|
|
116
124
|
() => startValue,
|
|
117
125
|
(v) => {
|
|
@@ -126,6 +134,8 @@
|
|
|
126
134
|
onEndValueChange(v);
|
|
127
135
|
}
|
|
128
136
|
),
|
|
137
|
+
monthFormat: box.with(() => monthFormat),
|
|
138
|
+
yearFormat: box.with(() => yearFormat),
|
|
129
139
|
defaultPlaceholder,
|
|
130
140
|
});
|
|
131
141
|
|
|
@@ -10,4 +10,6 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
10
10
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
11
11
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
12
12
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
13
|
-
export
|
|
13
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
14
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
15
|
+
export type { RangeCalendarRootProps as RootProps, RangeCalendarPrevButtonProps as PrevButtonProps, RangeCalendarNextButtonProps as NextButtonProps, RangeCalendarHeadingProps as HeadingProps, RangeCalendarHeaderProps as HeaderProps, RangeCalendarGridProps as GridProps, RangeCalendarGridHeadProps as GridHeadProps, RangeCalendarHeadCellProps as HeadCellProps, RangeCalendarGridBodyProps as GridBodyProps, RangeCalendarCellProps as CellProps, RangeCalendarGridRowProps as GridRowProps, RangeCalendarDayProps as DayProps, RangeCalendarMonthSelectProps as MonthSelectProps, RangeCalendarYearSelectProps as YearSelectProps, } from "./types.js";
|
|
@@ -10,3 +10,5 @@ export { default as Header } from "../calendar/components/calendar-header.svelte
|
|
|
10
10
|
export { default as Heading } from "../calendar/components/calendar-heading.svelte";
|
|
11
11
|
export { default as NextButton } from "../calendar/components/calendar-next-button.svelte";
|
|
12
12
|
export { default as PrevButton } from "../calendar/components/calendar-prev-button.svelte";
|
|
13
|
+
export { default as MonthSelect } from "../calendar/components/calendar-month-select.svelte";
|
|
14
|
+
export { default as YearSelect } from "../calendar/components/calendar-year-select.svelte";
|
|
@@ -28,11 +28,16 @@ type RangeCalendarRootStateProps = WithRefProps<WritableBoxedValues<{
|
|
|
28
28
|
calendarLabel: string;
|
|
29
29
|
readonly: boolean;
|
|
30
30
|
disableDaysOutsideMonth: boolean;
|
|
31
|
+
excludeDisabled: boolean;
|
|
32
|
+
minDays: number | undefined;
|
|
33
|
+
maxDays: number | undefined;
|
|
31
34
|
/**
|
|
32
35
|
* This is strictly used by the `DateRangePicker` component to close the popover when a date range
|
|
33
36
|
* is selected. It is not intended to be used by the user.
|
|
34
37
|
*/
|
|
35
38
|
onRangeSelect?: () => void;
|
|
39
|
+
monthFormat: Intl.DateTimeFormatOptions["month"] | ((month: number) => string);
|
|
40
|
+
yearFormat: Intl.DateTimeFormatOptions["year"] | ((year: number) => string);
|
|
36
41
|
}> & {
|
|
37
42
|
defaultPlaceholder: DateValue;
|
|
38
43
|
}>;
|
|
@@ -66,6 +71,8 @@ export declare class RangeCalendarRootState {
|
|
|
66
71
|
start: DateValue;
|
|
67
72
|
end: DateValue;
|
|
68
73
|
} | null;
|
|
74
|
+
readonly initialPlaceholderYear: number;
|
|
75
|
+
readonly defaultYears: number[];
|
|
69
76
|
constructor(opts: RangeCalendarRootStateProps);
|
|
70
77
|
setMonths: (months: Month<DateValue>[]) => void;
|
|
71
78
|
isOutsideVisibleMonths(date: DateValue): boolean;
|
|
@@ -120,6 +127,10 @@ export declare class RangeCalendarCellState {
|
|
|
120
127
|
readonly isFocusedDate: boolean;
|
|
121
128
|
readonly isSelectedDate: boolean;
|
|
122
129
|
readonly isSelectionStart: boolean;
|
|
130
|
+
readonly isRangeStart: boolean;
|
|
131
|
+
readonly isRangeEnd: boolean;
|
|
132
|
+
readonly isRangeMiddle: boolean;
|
|
133
|
+
readonly isSelectionMiddle: boolean;
|
|
123
134
|
readonly isSelectionEnd: boolean;
|
|
124
135
|
readonly isHighlighted: boolean;
|
|
125
136
|
readonly labelText: string;
|
|
@@ -138,6 +149,9 @@ export declare class RangeCalendarCellState {
|
|
|
138
149
|
readonly "data-focused": "" | undefined;
|
|
139
150
|
readonly "data-selection-start": "" | undefined;
|
|
140
151
|
readonly "data-selection-end": "" | undefined;
|
|
152
|
+
readonly "data-range-start": "" | undefined;
|
|
153
|
+
readonly "data-range-end": "" | undefined;
|
|
154
|
+
readonly "data-range-middle": "" | undefined;
|
|
141
155
|
readonly "data-highlighted": "" | undefined;
|
|
142
156
|
readonly "data-selected": "" | undefined;
|
|
143
157
|
readonly "data-value": string;
|
|
@@ -152,6 +166,9 @@ export declare class RangeCalendarCellState {
|
|
|
152
166
|
readonly "data-focused": "" | undefined;
|
|
153
167
|
readonly "data-selection-start": "" | undefined;
|
|
154
168
|
readonly "data-selection-end": "" | undefined;
|
|
169
|
+
readonly "data-range-start": "" | undefined;
|
|
170
|
+
readonly "data-range-end": "" | undefined;
|
|
171
|
+
readonly "data-range-middle": "" | undefined;
|
|
155
172
|
readonly "data-highlighted": "" | undefined;
|
|
156
173
|
readonly "data-selected": "" | undefined;
|
|
157
174
|
readonly "data-value": string;
|
|
@@ -191,6 +208,9 @@ declare class RangeCalendarDayState {
|
|
|
191
208
|
readonly "data-focused": "" | undefined;
|
|
192
209
|
readonly "data-selection-start": "" | undefined;
|
|
193
210
|
readonly "data-selection-end": "" | undefined;
|
|
211
|
+
readonly "data-range-start": "" | undefined;
|
|
212
|
+
readonly "data-range-end": "" | undefined;
|
|
213
|
+
readonly "data-range-middle": "" | undefined;
|
|
194
214
|
readonly "data-highlighted": "" | undefined;
|
|
195
215
|
readonly "data-selected": "" | undefined;
|
|
196
216
|
readonly "data-value": string;
|