Skip to content

Commit c91f57c

Browse files
authored
feat(DateRangePicker): added maximumDays props (#1971)
* feat: added `maximumDays` to `DateRangePicker` * fix: run `docs:gen`
1 parent 53b4734 commit c91f57c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/content/meta/DateRangePickerRoot.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@
116116
'required': false,
117117
'default': '\'en\''
118118
},
119+
{
120+
'name': 'maximumDays',
121+
'description': '<p>The maximum number of days that can be selected in a range</p>\n',
122+
'type': 'number',
123+
'required': false
124+
},
119125
{
120126
'name': 'maxValue',
121127
'description': '<p>The maximum date that can be selected</p>\n',

packages/core/src/DateRangePicker/DateRangePickerCalendar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const rootContext = injectDateRangePickerRootContext()
2929
maxValue: rootContext.maxValue.value,
3030
dir: rootContext.dir.value,
3131
fixedDate: rootContext.fixedDate.value,
32+
maximumDays: rootContext.maximumDays?.value,
3233
}"
3334
initial-focus
3435
:model-value="rootContext.modelValue.value"

packages/core/src/DateRangePicker/DateRangePickerRoot.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ type DateRangePickerRootContext = {
4444
dir: Ref<Direction>
4545
allowNonContiguousRanges: Ref<boolean>
4646
fixedDate: Ref<'start' | 'end' | undefined>
47+
maximumDays?: Ref<number | undefined>
4748
}
4849
49-
export type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'isDateHighlightable' | 'allowNonContiguousRanges' | 'fixedDate'>
50+
export type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'isDateHighlightable' | 'allowNonContiguousRanges' | 'fixedDate' | 'maximumDays'>
5051
5152
export type DateRangePickerRootEmits = {
5253
/** Event handler called whenever the model value changes */
@@ -88,6 +89,7 @@ const props = withDefaults(defineProps<DateRangePickerRootProps>(), {
8889
isDateUnavailable: undefined,
8990
isDateHighlightable: undefined,
9091
allowNonContiguousRanges: false,
92+
maximumDays: undefined,
9193
})
9294
const emits = defineEmits<DateRangePickerRootEmits & PopoverRootEmits>()
9395
const {
@@ -116,6 +118,7 @@ const {
116118
dir: propsDir,
117119
allowNonContiguousRanges,
118120
fixedDate,
121+
maximumDays,
119122
} = toRefs(props)
120123
121124
const dir = useDirection(propsDir)
@@ -180,6 +183,7 @@ provideDateRangePickerRootContext({
180183
dateFieldRef,
181184
dir,
182185
fixedDate,
186+
maximumDays,
183187
onStartValueChange(date: DateValue | undefined) {
184188
emits('update:startValue', date)
185189
},

0 commit comments

Comments
 (0)