vectis-ui 0.1.0 → 0.8.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/README.md +40 -6
- package/dist/components/VAccordion/VAccordion.css +1 -1
- package/dist/components/VAccordion/VAccordion.d.ts +9 -16
- package/dist/components/VAccordion/VAccordion.js.map +1 -1
- package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.css +1 -1
- package/dist/components/VAccordion/VAccordionItem.d.ts +33 -19
- package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js +50 -38
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAccordion/context.d.ts +1 -8
- package/dist/components/VAccordion/context.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.css +1 -1
- package/dist/components/VAvatar/VAvatar.d.ts +44 -29
- package/dist/components/VAvatar/VAvatar.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js +38 -35
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.d.ts +5 -16
- package/dist/components/VAvatar/VAvatarGroup.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/context.d.ts +6 -10
- package/dist/components/VAvatar/context.js.map +1 -1
- package/dist/components/VBadge/VBadge.css +1 -1
- package/dist/components/VBadge/VBadge.d.ts +31 -10
- package/dist/components/VBadge/VBadge.js.map +1 -1
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js +39 -24
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.css +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.d.ts +4 -17
- package/dist/components/VBreadcrumb/VBreadcrumb.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js +23 -25
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/VButton.css +1 -1
- package/dist/components/VButton/VButton.d.ts +30 -10
- package/dist/components/VButton/VButton.js.map +1 -1
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js +39 -30
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.css +1 -1
- package/dist/components/VButton/VButtonGroup.d.ts +76 -13
- package/dist/components/VButton/VButtonGroup.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js +74 -8
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/context.d.ts +30 -0
- package/dist/components/VButton/context.js +6 -0
- package/dist/components/VButton/context.js.map +1 -0
- package/dist/components/VCalendar/VCalendar.css +1 -1
- package/dist/components/VCalendar/VCalendar.d.ts +50 -36
- package/dist/components/VCalendar/VCalendar.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js +99 -85
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.css +1 -1
- package/dist/components/VCalendar/VCalendarEvent.d.ts +5 -11
- package/dist/components/VCalendar/VCalendarEvent.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js +7 -1
- package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.css +1 -1
- package/dist/components/VCalendar/VCalendarMonth.d.ts +10 -13
- package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js +183 -244
- package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.css +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.d.ts +15 -20
- package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js +385 -448
- package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarYear.css +1 -1
- package/dist/components/VCalendar/VCalendarYear.js.map +1 -1
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js +53 -49
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/gesture.d.ts +158 -0
- package/dist/components/VCalendar/gesture.js +170 -0
- package/dist/components/VCalendar/gesture.js.map +1 -0
- package/dist/components/VCalendar/keyboard.d.ts +9 -3
- package/dist/components/VCalendar/keyboard.js +2 -6
- package/dist/components/VCalendar/keyboard.js.map +1 -1
- package/dist/components/VCalendar/layout.d.ts +67 -54
- package/dist/components/VCalendar/layout.js +77 -69
- package/dist/components/VCalendar/layout.js.map +1 -1
- package/dist/components/VCalendar/timeGrid.d.ts +55 -0
- package/dist/components/VCalendar/timeGrid.js +71 -0
- package/dist/components/VCalendar/timeGrid.js.map +1 -0
- package/dist/components/VCalendar/types.d.ts +41 -16
- package/dist/components/VCarousel/VCarousel.css +1 -1
- package/dist/components/VCarousel/VCarousel.d.ts +21 -41
- package/dist/components/VCarousel/VCarousel.js.map +1 -1
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js +157 -129
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCarousel/VCarouselItem.d.ts +0 -17
- package/dist/components/VCarousel/VCarouselItem.js.map +1 -1
- package/dist/components/VCarousel/VCarouselItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCarousel/context.d.ts +0 -12
- package/dist/components/VCarousel/context.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.css +1 -1
- package/dist/components/VCheckbox/VCheckbox.d.ts +31 -16
- package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js +62 -29
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VChip/VChip.css +1 -1
- package/dist/components/VChip/VChip.d.ts +36 -26
- package/dist/components/VChip/VChip.js.map +1 -1
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +57 -48
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.css +1 -1
- package/dist/components/VCombobox/VCombobox.d.ts +127 -31
- package/dist/components/VCombobox/VCombobox.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +336 -247
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxGroup.css +1 -1
- package/dist/components/VCombobox/VComboboxGroup.d.ts +0 -9
- package/dist/components/VCombobox/VComboboxGroup.js.map +1 -1
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxOption.css +1 -1
- package/dist/components/VCombobox/VComboboxOption.d.ts +0 -15
- package/dist/components/VCombobox/VComboboxOption.js.map +1 -1
- package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxSeparator.js.map +1 -1
- package/dist/components/VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/infiniteScroll.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.css +1 -1
- package/dist/components/VDataTable/VDataTable.d.ts +50 -28
- package/dist/components/VDataTable/VDataTable.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +183 -194
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.css +1 -1
- package/dist/components/VDateInput/VDateInput.d.ts +90 -42
- package/dist/components/VDateInput/VDateInput.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +159 -191
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.css +1 -1
- package/dist/components/VDatePicker/VDatePicker.d.ts +61 -30
- package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +243 -221
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDialog/VDialog.css +1 -1
- package/dist/components/VDialog/VDialog.d.ts +45 -33
- package/dist/components/VDialog/VDialog.js.map +1 -1
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +65 -64
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDialog/VDialogAlert.d.ts +24 -20
- package/dist/components/VDialog/VDialogAlert.js.map +1 -1
- package/dist/components/VDialog/VDialogAlert.vue_vue_type_script_setup_true_lang.js +36 -25
- package/dist/components/VDialog/VDialogAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.css +1 -1
- package/dist/components/VFileInput/VFileInput.d.ts +78 -26
- package/dist/components/VFileInput/VFileInput.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +144 -132
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.css +1 -1
- package/dist/components/VFilePicker/VFilePicker.d.ts +47 -30
- package/dist/components/VFilePicker/VFilePicker.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js +166 -163
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/fileKind.d.ts +2 -27
- package/dist/components/VFilePicker/fileKind.js +9 -8
- package/dist/components/VFilePicker/fileKind.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.css +1 -1
- package/dist/components/VHotkeys/VHotkeys.d.ts +8 -30
- package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VHotkeys/platform.js.map +1 -1
- package/dist/components/VIcon/VIcon.css +1 -1
- package/dist/components/VIcon/VIcon.d.ts +15 -6
- package/dist/components/VIcon/VIcon.js.map +1 -1
- package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js +45 -37
- package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VIcon/iconProps.js.map +1 -1
- package/dist/components/VIcon/icons/index.d.ts +1 -1
- package/dist/components/VIcon/icons/index.js.map +1 -1
- package/dist/components/VIcon/icons/names.d.ts +1 -1
- package/dist/components/VIcon/icons/names.js.map +1 -1
- package/dist/components/VIcon/resolver.d.ts +3 -3
- package/dist/components/VIcon/resolver.js.map +1 -1
- package/dist/components/VIcon/types.d.ts +12 -12
- package/dist/components/VIconButton/VIconButton.css +1 -1
- package/dist/components/VIconButton/VIconButton.d.ts +28 -11
- package/dist/components/VIconButton/VIconButton.js.map +1 -1
- package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js +26 -20
- package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInput.css +1 -1
- package/dist/components/VInput/VInput.d.ts +26 -7
- package/dist/components/VInput/VInput.js.map +1 -1
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +86 -75
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInputGroup.css +2 -0
- package/dist/components/VInput/VInputGroup.d.ts +47 -0
- package/dist/components/VInput/VInputGroup.js +9 -0
- package/dist/components/VInput/VInputGroup.js.map +1 -0
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +80 -0
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VInput/context.d.ts +11 -0
- package/dist/components/VInput/context.js +6 -0
- package/dist/components/VInput/context.js.map +1 -0
- package/dist/components/VInputOTP/VInputOTP.css +1 -1
- package/dist/components/VInputOTP/VInputOTP.d.ts +37 -22
- package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +98 -61
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenu.d.ts +23 -30
- package/dist/components/VMenu/VMenu.js.map +1 -1
- package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js +31 -27
- package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuGroup.css +1 -1
- package/dist/components/VMenu/VMenuGroup.d.ts +12 -8
- package/dist/components/VMenu/VMenuGroup.js.map +1 -1
- package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuItem.css +1 -1
- package/dist/components/VMenu/VMenuItem.d.ts +11 -19
- package/dist/components/VMenu/VMenuItem.js.map +1 -1
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +65 -57
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.d.ts +14 -30
- package/dist/components/VMenu/VMenuPanel.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +43 -44
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/context.d.ts +2 -6
- package/dist/components/VMenu/context.js.map +1 -1
- package/dist/components/VPagination/VPagination.css +1 -1
- package/dist/components/VPagination/VPagination.d.ts +60 -22
- package/dist/components/VPagination/VPagination.js.map +1 -1
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +113 -161
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VPopover/VPopover.css +1 -1
- package/dist/components/VPopover/VPopover.d.ts +26 -7
- package/dist/components/VPopover/VPopover.js.map +1 -1
- package/dist/components/VPopover/VPopover.vue_vue_type_script_setup_true_lang.js +43 -37
- package/dist/components/VPopover/VPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.css +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.d.ts +15 -4
- package/dist/components/VProgressCircular/VProgressCircular.js.map +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.vue_vue_type_script_setup_true_lang.js +32 -30
- package/dist/components/VProgressCircular/VProgressCircular.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.css +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.d.ts +23 -8
- package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js +34 -32
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VRadio/VRadio.css +1 -1
- package/dist/components/VRadio/VRadio.d.ts +36 -18
- package/dist/components/VRadio/VRadio.js.map +1 -1
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js +55 -26
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSeparator/VSeparator.d.ts +4 -2
- package/dist/components/VSeparator/VSeparator.js.map +1 -1
- package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.d.ts +5 -19
- package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.d.ts +9 -17
- package/dist/components/VSideNavigation/VSideNavigationGroup.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.d.ts +22 -30
- package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +77 -87
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/context.d.ts +0 -14
- package/dist/components/VSideNavigation/context.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.css +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +9 -9
- package/dist/components/VSkeletonLoader/VSkeletonLoader.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSlider/VSlider.css +1 -1
- package/dist/components/VSlider/VSlider.d.ts +52 -27
- package/dist/components/VSlider/VSlider.js.map +1 -1
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +202 -118
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.css +1 -1
- package/dist/components/VSnackbar/VSnackbar.d.ts +0 -23
- package/dist/components/VSnackbar/VSnackbar.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js +38 -38
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/state.d.ts +0 -27
- package/dist/components/VSnackbar/state.js.map +1 -1
- package/dist/components/VSpinner/VSpinner.css +1 -1
- package/dist/components/VSpinner/VSpinner.d.ts +6 -6
- package/dist/components/VSpinner/VSpinner.js.map +1 -1
- package/dist/components/VSpinner/VSpinner.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/components/VSpinner/VSpinner.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.css +1 -1
- package/dist/components/VSwitch/VSwitch.d.ts +35 -13
- package/dist/components/VSwitch/VSwitch.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js +62 -21
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTab.css +1 -1
- package/dist/components/VTabs/VTab.d.ts +12 -12
- package/dist/components/VTabs/VTab.js.map +1 -1
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js +36 -24
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTabPanel.d.ts +2 -10
- package/dist/components/VTabs/VTabPanel.js.map +1 -1
- package/dist/components/VTabs/VTabPanel.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VTabs/VTabPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTabs.css +1 -1
- package/dist/components/VTabs/VTabs.d.ts +27 -18
- package/dist/components/VTabs/VTabs.js.map +1 -1
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +92 -81
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/context.d.ts +9 -19
- package/dist/components/VTabs/context.js +1 -1
- package/dist/components/VTabs/context.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.css +1 -1
- package/dist/components/VTextarea/VTextarea.d.ts +34 -6
- package/dist/components/VTextarea/VTextarea.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +91 -74
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.css +1 -1
- package/dist/components/VTimeInput/VTimeInput.d.ts +123 -33
- package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +294 -291
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/search.d.ts +24 -0
- package/dist/components/VTimeInput/search.js +22 -0
- package/dist/components/VTimeInput/search.js.map +1 -0
- package/dist/components/VTimePicker/VTimePicker.css +1 -1
- package/dist/components/VTimePicker/VTimePicker.d.ts +51 -30
- package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +216 -151
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimePicker/limits.d.ts +88 -0
- package/dist/components/VTimePicker/limits.js +70 -0
- package/dist/components/VTimePicker/limits.js.map +1 -0
- package/dist/components/VToast/VToast.css +1 -1
- package/dist/components/VToast/VToast.d.ts +0 -10
- package/dist/components/VToast/VToast.js.map +1 -1
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js +10 -10
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/VToaster.css +1 -1
- package/dist/components/VToast/VToaster.d.ts +0 -17
- package/dist/components/VToast/VToaster.js.map +1 -1
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +29 -28
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/state.d.ts +10 -19
- package/dist/components/VToast/state.js +1 -1
- package/dist/components/VToast/state.js.map +1 -1
- package/dist/components/VToggle/VToggle.css +1 -1
- package/dist/components/VToggle/VToggle.d.ts +56 -11
- package/dist/components/VToggle/VToggle.js.map +1 -1
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +80 -46
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.d.ts +16 -2
- package/dist/components/VToggle/VToggleItem.js +0 -2
- package/dist/components/VToggle/VToggleItem.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js +23 -15
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToggle/context.d.ts +4 -24
- package/dist/components/VToggle/context.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.css +1 -1
- package/dist/components/VTooltip/VTooltip.d.ts +9 -33
- package/dist/components/VTooltip/VTooltip.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js +28 -24
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTypography/VTypography.js.map +1 -1
- package/dist/components/VTypography/VTypography.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useAriaLabel.d.ts +0 -17
- package/dist/composables/useAriaLabel.js.map +1 -1
- package/dist/composables/useClearable.d.ts +42 -0
- package/dist/composables/useClearable.js +19 -0
- package/dist/composables/useClearable.js.map +1 -0
- package/dist/composables/useControlShape.d.ts +22 -0
- package/dist/composables/useControlShape.js +13 -0
- package/dist/composables/useControlShape.js.map +1 -0
- package/dist/composables/useDetailsOpen.d.ts +22 -0
- package/dist/composables/useDetailsOpen.js +21 -0
- package/dist/composables/useDetailsOpen.js.map +1 -0
- package/dist/composables/useFieldIds.d.ts +0 -15
- package/dist/composables/useFieldIds.js +8 -7
- package/dist/composables/useFieldIds.js.map +1 -1
- package/dist/composables/useFieldPanel.d.ts +21 -18
- package/dist/composables/useFieldPanel.js +43 -23
- package/dist/composables/useFieldPanel.js.map +1 -1
- package/dist/composables/useFileDrop.d.ts +0 -22
- package/dist/composables/useFileDrop.js.map +1 -1
- package/dist/composables/useFileField.d.ts +45 -17
- package/dist/composables/useFileField.js +40 -20
- package/dist/composables/useFileField.js.map +1 -1
- package/dist/composables/useFocusoutDismiss.d.ts +0 -15
- package/dist/composables/useFocusoutDismiss.js.map +1 -1
- package/dist/composables/useIconClickHandlers.d.ts +29 -14
- package/dist/composables/useIconClickHandlers.js +15 -5
- package/dist/composables/useIconClickHandlers.js.map +1 -1
- package/dist/composables/useInertLink.d.ts +20 -0
- package/dist/composables/useInertLink.js +23 -0
- package/dist/composables/useInertLink.js.map +1 -0
- package/dist/composables/useMaskedField.d.ts +33 -10
- package/dist/composables/useMaskedField.js +45 -1
- package/dist/composables/useMaskedField.js.map +1 -1
- package/dist/composables/usePopover.d.ts +15 -1
- package/dist/composables/usePopover.js +23 -8
- package/dist/composables/usePopover.js.map +1 -1
- package/dist/composables/useProgressValue.d.ts +5 -8
- package/dist/composables/useProgressValue.js +6 -3
- package/dist/composables/useProgressValue.js.map +1 -1
- package/dist/composables/useRootAttrs.d.ts +12 -19
- package/dist/composables/useRootAttrs.js.map +1 -1
- package/dist/composables/useTimer.d.ts +8 -10
- package/dist/composables/useTimer.js.map +1 -1
- package/dist/i18n/en.d.ts +2 -10
- package/dist/i18n/en.js +18 -19
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/fr.d.ts +2 -18
- package/dist/i18n/fr.js +18 -19
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/state.d.ts +44 -47
- package/dist/i18n/state.js +20 -17
- package/dist/i18n/state.js.map +1 -1
- package/dist/i18n/types.d.ts +53 -44
- package/dist/icons.d.ts +3 -3
- package/dist/index.d.ts +43 -17
- package/dist/index.js +45 -44
- package/dist/styles.css +1 -1
- package/dist/tokens/css.js.map +1 -1
- package/dist/tokens/index.d.ts +5 -1
- package/dist/tokens/primitives.js.map +1 -1
- package/dist/tokens/semantic.d.ts +5 -1
- package/dist/tokens/semantic.js +6 -2
- package/dist/tokens/semantic.js.map +1 -1
- package/dist/tokens/themes/dark.js.map +1 -1
- package/dist/tokens/types.d.ts +7 -15
- package/dist/tokens/types.js.map +1 -1
- package/dist/tokens.json +25 -5
- package/dist/types.d.ts +24 -0
- package/dist/utils/array.d.ts +3 -6
- package/dist/utils/array.js.map +1 -1
- package/dist/utils/arrowNav.d.ts +17 -17
- package/dist/utils/arrowNav.js +5 -3
- package/dist/utils/arrowNav.js.map +1 -1
- package/dist/utils/chip.d.ts +11 -15
- package/dist/utils/chip.js.map +1 -1
- package/dist/utils/css.d.ts +22 -11
- package/dist/utils/css.js +5 -2
- package/dist/utils/css.js.map +1 -1
- package/dist/utils/date.d.ts +42 -19
- package/dist/utils/date.js +97 -98
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/direction.d.ts +6 -12
- package/dist/utils/direction.js.map +1 -1
- package/dist/utils/env.d.ts +5 -6
- package/dist/utils/file.d.ts +46 -58
- package/dist/utils/file.js +43 -36
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/focus.d.ts +8 -17
- package/dist/utils/focus.js.map +1 -1
- package/dist/utils/hostWarns.d.ts +12 -0
- package/dist/utils/hostWarns.js +6 -0
- package/dist/utils/hostWarns.js.map +1 -0
- package/dist/utils/ids.d.ts +10 -0
- package/dist/utils/ids.js +8 -0
- package/dist/utils/ids.js.map +1 -0
- package/dist/utils/matcher.d.ts +5 -9
- package/dist/utils/matcher.js.map +1 -1
- package/dist/utils/memo.d.ts +12 -0
- package/dist/utils/memo.js +9 -0
- package/dist/utils/memo.js.map +1 -0
- package/dist/utils/number.d.ts +3 -4
- package/dist/utils/number.js.map +1 -1
- package/dist/utils/text.d.ts +20 -9
- package/dist/utils/text.js +17 -3
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/time.d.ts +53 -61
- package/dist/utils/time.js +49 -45
- package/dist/utils/time.js.map +1 -1
- package/dist/utils/vnode.d.ts +8 -15
- package/dist/utils/vnode.js.map +1 -1
- package/package.json +6 -6
- package/dist/components/VToggle/VToggleItem.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VDateInput.js","names":[],"sources":["../../../src/components/VDateInput/VDateInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, useId, watchEffect } from 'vue'\n\nimport VDatePicker from '../VDatePicker/VDatePicker.vue'\nimport type {\n DatePickerEvent,\n DatePickerSelection,\n DatePickerValue,\n DateMatcher,\n DateRange,\n} from '../VDatePicker/VDatePicker.vue'\nimport {\n caretAfterDigits,\n dateMaskFor,\n formatDateMask,\n formatDisplay,\n formatDisplayRange,\n isValidISO,\n isWithin,\n isoToMask,\n maskPlaceholder,\n parseDateMask,\n} from '../../utils/date'\nimport { digitsOf } from '../../utils/text'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { isDev } from '../../utils/env'\nimport { calendar_today as calendarTodayIcon } from '../VIcon/icons/calendar_today'\nimport type { IconSource } from '../VIcon/types'\nimport VInput from '../VInput/VInput.vue'\nimport VPopover from '../VPopover/VPopover.vue'\n\nimport { useRootAttrs } from '../../composables/useRootAttrs'\n\nimport { useFieldPanel } from '../../composables/useFieldPanel'\nimport { useMaskedField } from '../../composables/useMaskedField'\nimport { useLocale, useMessages } from '../../i18n/state'\n\n// @a11y @core\n/**\n * A field for choosing a date: a text field, and a calendar in a panel below it.\n *\n * The panel is opened from code rather than by the browser, and that is not a detail: a\n * text input cannot be declared as the thing that opens a popover, and opening it\n * ourselves is also what lets the focus be moved INTO the calendar's grid, so the\n * keyboard lands where the dates are. Closing is ours too — the focus leaving the\n * component, or Escape.\n *\n * The field itself comes in two forms. It can be TYPED into, which is the default: the\n * reader types digits only and the separators appear as they go, in the order and with\n * the punctuation their language uses. Or it can be read-only, in which case the calendar\n * is the only way in.\n *\n * That is a different question from WHAT is being chosen — one date, a period, or several\n * dates — which is passed straight through to the calendar.\n */\ntype Placement = 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end'\n\n/** Whether the field can be typed into, or only filled from the calendar. */\nexport type DateInputMode = 'readonly' | 'input'\n\nconst MODES: DateInputMode[] = ['readonly', 'input']\n\n/**\n * The century a two-digit year is expanded into — \"10/06/26\" becomes 2026 — applied only\n * when the reader leaves the field.\n *\n * It is FIXED and never derived from the current year. A sliding rule would make the\n * component's behaviour depend on when it runs, which is the same objection that keeps\n * today's date out of VDatePicker's setup, and it would give the tests a shelf life.\n */\nconst YEAR_PIVOT = 2000\n\nconst DEFAULT_DISPLAY_FORMAT: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n}\n\ninterface DateInputProps {\n // Everything from here to `events` is handed straight to the calendar.\n /** What is being chosen: one date, a period between two, or several separate dates. */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names, the first day of the week and\n * the order the field is typed in. It TAKES PRECEDENCE over the design system's global\n * locale and falls back to it — which is why it has no literal default: `undefined` has\n * to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /** Forces the day the weeks start on, from 0 for Sunday to 6 for Saturday. */\n firstDayOfWeek?: number\n /** The earliest date that can be chosen, as an ISO string. */\n min?: string\n /** The latest date that can be chosen, as an ISO string. */\n max?: string\n /** Dates that cannot be chosen, as a list or as a function. */\n disabledDates?: DateMatcher\n /** Fills the corners of the grid with the greyed days of the neighbouring months. */\n showAdjacentDays?: boolean\n /** Lets those neighbouring days be clicked, which implies showing them. */\n selectAdjacentDays?: boolean\n /** Events to mark under the days they fall on. */\n events?: DatePickerEvent[]\n // From here on: the field.\n /**\n * Whether the field can be TYPED into — the default, using the numeric form of the\n * reader's language — or is read-only, the calendar then being the only way in.\n *\n * Typing is reserved for choosing a SINGLE date: a period or a list falls back to\n * read-only, there being no sensible way to type either.\n */\n mode?: DateInputMode\n /**\n * Offers the date picker alongside a field that can be typed into: an icon at the end of\n * the field, and a panel that opens on focus. It means nothing in read-only mode, where\n * the picker is already the only way to choose.\n */\n showPicker?: boolean\n /** The label above the field. */\n label?: string\n /** A line of help under the field. */\n hint?: string\n /** What the field says while empty. */\n placeholder?: string\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: 'sm' | 'md' | 'lg'\n /** Takes 4px off the height. */\n compact?: boolean\n /** Makes the field unusable, greyed out through the colour tokens. */\n disabled?: boolean\n /** Marks the field as invalid — for a rule of your own. */\n invalid?: boolean\n /** Offers a cross that empties the value, shown before the end icon. */\n clearable?: boolean\n /**\n * The icon that opens the date picker, at the end of the field. The clear cross appears\n * to its left rather than in its place, and no icon is rendered at all when there is no\n * panel to open.\n */\n pickerIcon?: IconSource\n /**\n * How the date is WRITTEN OUT in the field. It has no effect on a field being typed\n * into, which necessarily shows the numeric form one types — so it concerns the\n * read-only mode, and the period and list selections, which fall back to it.\n */\n displayFormat?: Intl.DateTimeFormatOptions\n /** Where the panel opens relative to the field. */\n placement?: Placement\n}\n\nconst props = withDefaults(defineProps<DateInputProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n // Deliberately left undefined rather than defaulted to the typed mode: that is what\n // distinguishes \"the prop was not given\" from \"the prop was given this value\", and\n // therefore what allows warning ONLY the consumer who explicitly asked for something\n // that cannot work.\n mode: undefined,\n showPicker: false,\n label: undefined,\n hint: undefined,\n placeholder: undefined,\n size: 'md',\n compact: false,\n disabled: false,\n invalid: false,\n clearable: true,\n pickerIcon: () => calendarTodayIcon,\n // Left undefined rather than defaulted to the format object, for the same reason: it is\n // what lets the component notice that a consumer has asked for a display format in a\n // mode where it has no effect, and say so.\n displayFormat: undefined,\n placement: 'bottom-start',\n})\n\nconst model = defineModel<DatePickerValue>({ default: null })\n\ndefineSlots<{\n /** What a day cell shows, handed straight to the calendar. */\n day?(props: {\n iso: string\n day: number\n inMonth: boolean\n disabled: boolean\n selected: boolean\n today: boolean\n inRange: boolean\n events: DatePickerEvent[]\n }): unknown\n /**\n * The strip at the foot of the panel — actions, or preset dates such as \"today\". It\n * receives `close`, which is what lets one of those buttons dismiss the panel.\n */\n footer?(props: { close: () => void }): unknown\n}>()\n\n// `class` and `style` stay on the wrapper; everything else goes down to the text field,\n// which is what a consumer's label points at and what assistive technology deals with.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst panelRef = ref<InstanceType<typeof VPopover> | null>(null)\nconst inputRef = ref<InstanceType<typeof VInput> | null>(null)\nconst pickerRef = ref<InstanceType<typeof VDatePicker> | null>(null)\nconst panelId = useId()\n\n/** The real input inside the field, which the mask and the caret work on. */\nconst fieldEl = computed<HTMLInputElement | null>(() => inputRef.value?.el ?? null)\n\n/** What was asked for, falling back to the default when nothing or nonsense was given. */\nconst requestedMode = computed<DateInputMode>(() =>\n props.mode !== undefined && MODES.includes(props.mode) ? props.mode : 'input',\n)\n/**\n * What is actually used. Typing is only possible for a single date: a period or a list\n * has no form one could type into a single field.\n */\nconst resolvedMode = computed<DateInputMode>(() =>\n requestedMode.value === 'input' && props.selection === 'single' ? 'input' : 'readonly',\n)\nconst typing = computed(() => resolvedMode.value === 'input')\n\n/**\n * Whether there is a panel at all. The calendar is only optional beside a field one can\n * type into: read-only, it is the only way to choose anything.\n */\nconst hasPanel = computed(() => !typing.value || props.showPicker)\n\n// @devwarn\nif (isDev) {\n watchEffect(() => {\n if (props.mode !== undefined && !MODES.includes(props.mode))\n console.warn(\n `[VDateInput] unknown mode \"${props.mode}\": use \"input\" (the default) or \"readonly\".`,\n )\n // Tested on the PROP and not on what was resolved from it: typing being the default,\n // a period or a list falls back on its own with nobody having asked for anything.\n // Only a consumer who explicitly asked to type deserves to be told it cannot work.\n if (props.mode === 'input' && props.selection !== 'single')\n console.warn(\n `[VDateInput] mode=\"input\" ignored in \"${props.selection}\" selection: a range or a list of dates cannot be typed on the keyboard.`,\n )\n // Here it is the RESOLVED mode that matters: the format really was supplied, and it\n // really will have no effect, whichever route led to a typed field. The warning stays\n // something the consumer can act on.\n if (props.displayFormat && typing.value)\n console.warn(\n '[VDateInput] displayFormat is ignored in \"input\" mode (the default): the field displays the locale\\'s numeric mask, the only typeable format. Pass mode=\"readonly\" for a formatted display.',\n )\n })\n}\n\n// The whole \"field plus panel\" shell, shared with VTimeInput: opening and closing, the\n// focus leaving the component, a click on the field, and the Escape, ArrowDown and Enter\n// keys.\nconst { open, openPanel, closePanel, onControlClick, onFocusout, onKeydown, onPanelMousedown } =\n useFieldPanel({\n rootEl,\n panelRef,\n fieldEl: inputRef,\n // With no panel there is nothing to open. This is the composable's SINGLE cut-off\n // point, and every way in passes through it — clicking the field, focusing it, the\n // down arrow, Enter, the icon — so the condition never has to be repeated in a\n // handler.\n disabled: () => props.disabled || !hasPanel.value,\n focusInPanel: () => pickerRef.value?.focus(),\n // Beside a field one types into, the panel opens WITHOUT taking the focus: typing\n // carries on in the field, and the down arrow remains the way into the grid.\n focusOnOpen: () => !typing.value,\n })\n\nconst hasValue = computed(() => {\n if (props.selection === 'multiple') return Array.isArray(model.value) && model.value.length > 0\n if (props.selection === 'range') {\n const r = model.value as DateRange | null\n return !!(r && (r.start || r.end))\n }\n return typeof model.value === 'string' && !!model.value\n})\n\nconst vectisLocale = useLocale()\n/* The prop wins, and the design system's global locale is what it falls back to.\n\n TRAP — this component is the SINGLE place that resolution happens: what flows down to\n the calendar is the RESULT, never the prop, which would usually be undefined and would\n have the calendar resolve the language a second time — with every chance of the two\n disagreeing after a later change. */\nconst resolvedLocale = computed(() => props.locale ?? vectisLocale.value)\n\nconst displayText = computed(() => {\n const locale = resolvedLocale.value\n const displayFormat = props.displayFormat ?? DEFAULT_DISPLAY_FORMAT\n if (props.selection === 'single') {\n return typeof model.value === 'string' && isValidISO(model.value)\n ? formatDisplay(model.value, locale, displayFormat)\n : ''\n }\n if (props.selection === 'range') {\n const r = model.value as DateRange | null\n if (!r?.start) return ''\n if (!r.end) return formatDisplay(r.start, locale, displayFormat)\n return formatDisplayRange(r.start, r.end, locale, displayFormat)\n }\n const list = Array.isArray(model.value) ? model.value : []\n return list.map((iso) => formatDisplay(iso, locale, displayFormat)).join(', ')\n})\n\n/* From here on: everything the typed field needs. */\n\nconst mask = computed(() => dateMaskFor(resolvedLocale.value))\nconst maskHint = computed(() => maskPlaceholder(resolvedLocale.value, mask.value))\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\n/**\n * Whether a date the reader has finished typing may actually be taken: it has to fall\n * within the allowed bounds and not be one of the excluded days.\n */\nconst acceptable = (iso: string) =>\n isWithin(iso, props.min, props.max) && !isDisabledDate.value(iso)\n\n/*\n * The mask machinery — the text being typed, the bridge to the value, the reformatting\n * that preserves the caret, the commit as soon as the date is complete and the silent\n * revert when it is not — is shared with VTimeInput and lives in `useMaskedField`.\n *\n * What is injected here is the date VOCABULARY alone: the order of the fields, the\n * separator between them and their widths, all derived from the reader's language.\n */\nconst { draft, fieldModel, writeField, commitLive, commitOrRevert, onFieldInput } = useMaskedField({\n fieldEl,\n typing: () => typing.value,\n displayText: () => displayText.value,\n readValue: () =>\n typeof model.value === 'string' && isValidISO(model.value) ? model.value : null,\n writeValue: (iso) => {\n model.value = iso\n },\n maxDigits: () => mask.value.size,\n format: (digits) => formatDateMask(digits, mask.value),\n caret: (text, digitsBefore, inserting) =>\n caretAfterDigits(text, digitsBefore, inserting ? mask.value.separator : undefined),\n // A two-digit year is only expanded on the FINAL commit, when the reader leaves the\n // field — never while they are still typing, where \"26\" may well be on its way to\n // becoming \"2026\".\n parse: (text, final) =>\n parseDateMask(text, mask.value, final ? { yearPivot: YEAR_PIVOT } : undefined),\n toMask: (iso) => (iso ? isoToMask(iso, mask.value) : ''),\n acceptable,\n})\n\n/**\n * Typing anything that is not a digit — a slash, a dot, a space — completes the field\n * being typed with a leading zero and moves on to the next. It is what lets someone type\n * \"5/6/2026\" and get the same result as typing all eight digits.\n *\n * It applies to the day and the month only: a year cut short has no such convention, \"26\"\n * being neither 0026 nor 2026 until the reader has finished.\n */\nfunction padCurrentField(el: HTMLInputElement) {\n const start = el.selectionStart ?? el.value.length\n const before = digitsOf(el.value.slice(0, start)).length\n const digits = digitsOf(el.value)\n let offset = 0\n for (let k = 0; k < mask.value.order.length; k++) {\n const len = mask.value.lengths[k] as number\n if (before < offset + len) {\n const filled = before - offset\n if (mask.value.order[k] === 'year' || filled !== len - 1) return\n const next = digits.slice(0, offset) + '0'.repeat(len - filled) + digits.slice(offset)\n const text = formatDateMask(next.slice(0, mask.value.size), mask.value)\n writeField(text, caretAfterDigits(text, offset + len, mask.value.separator))\n return\n }\n offset += len\n }\n}\n\n// @keyboard @core — the keys the mask itself needs: completing a field with a separator,\n// erasing across one, and the down arrow, which is the one explicit way from the field\n// into the calendar.\nfunction onFieldKeydown(event: KeyboardEvent) {\n if (!typing.value) return\n const el = fieldEl.value\n if (!el) return\n\n if (event.key === 'Enter') {\n // Cancelling the default does two things at once: it stops the surrounding form from\n // being submitted, and it stops the panel this keystroke has just closed from being\n // reopened as the event travels up to the root.\n event.preventDefault()\n commitOrRevert()\n if (open.value) closeAndFocus()\n return\n }\n if (event.key === 'ArrowDown' && open.value) {\n // The one explicit route from the field into the grid of days.\n event.preventDefault()\n pickerRef.value?.focus()\n return\n }\n if (event.key === 'Backspace') {\n const start = el.selectionStart\n if (\n start !== null &&\n start === el.selectionEnd &&\n start > 0 &&\n !/\\d/.test(el.value[start - 1] ?? '')\n ) {\n // TRAP — a separator is PLACED by the mask and never typed, so erasing one has to\n // erase the DIGIT before it, which is what the reader believes they are erasing.\n // Left alone, the mask would write the separator straight back and the key would\n // look dead.\n event.preventDefault()\n const n = digitsOf(el.value.slice(0, start)).length\n const digits = digitsOf(el.value)\n const text = formatDateMask(digits.slice(0, n - 1) + digits.slice(n), mask.value)\n writeField(text, caretAfterDigits(text, n - 1))\n commitLive()\n }\n return\n }\n if (\n event.key.length === 1 &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !/\\d/.test(event.key)\n ) {\n event.preventDefault()\n padCurrentField(el)\n }\n}\n\n/**\n * Pasting. A date recognizable as a whole — in the ISO form, or already written the way\n * this field writes them — is adopted as it stands; anything else contributes its digits\n * alone.\n *\n * Without this, pasting \"2026-06-10\" into a field expecting day, month, year would\n * produce \"20/26/0610\": the digits would be taken in order and the separators ignored.\n */\nfunction onFieldPaste(event: ClipboardEvent) {\n if (!typing.value) return\n const el = fieldEl.value\n if (!el) return\n event.preventDefault()\n const pasted = (event.clipboardData?.getData('text') ?? '').trim()\n const iso = isValidISO(pasted)\n ? pasted\n : parseDateMask(pasted, mask.value, { yearPivot: YEAR_PIVOT })\n if (iso) {\n const text = isoToMask(iso, mask.value)\n writeField(text, text.length)\n commitLive()\n return\n }\n const start = el.selectionStart ?? el.value.length\n const end = el.selectionEnd ?? start\n const digits = digitsOf(el.value)\n const from = digitsOf(el.value.slice(0, start)).length\n const to = digitsOf(el.value.slice(0, end)).length\n const inserted = digitsOf(pasted)\n const next = (digits.slice(0, from) + inserted + digits.slice(to)).slice(0, mask.value.size)\n const text = formatDateMask(next, mask.value)\n writeField(text, caretAfterDigits(text, Math.min(from + inserted.length, next.length)))\n commitLive()\n}\n\n// @a11y\n/**\n * TRAP — closing the panel hands the focus back to the field, and beside a field one\n * types into the panel opens ON FOCUS: the two would chase each other and the panel would\n * never close.\n *\n * This lock covers the focus call, which is synchronous. EVERY close that returns the\n * focus must go through here; closing directly brings the loop straight back.\n */\nlet refocusing = false\nfunction closeAndFocus() {\n refocusing = true\n closePanel(true)\n refocusing = false\n}\n\nfunction onFieldFocus() {\n if (!typing.value || refocusing) return\n openPanel(false)\n}\n\n// @keyboard @a11y\nfunction onRootKeydown(event: KeyboardEvent) {\n if (typing.value && event.key === 'Escape' && open.value) {\n event.preventDefault()\n closeAndFocus()\n return\n }\n onKeydown(event)\n}\n\n/*\n * The clear cross is the field's own, which renders it BEFORE the end icon rather than in\n * its place — the convention every field in the design system follows, so the two live\n * side by side.\n *\n * Whether it is shown has to be answered explicitly here: outside the typed mode the field\n * is read-only, and a read-only field hides its cross by default, rightly so — but here\n * the value comes from the panel, so there is something to clear all the same.\n */\nconst canClear = computed(\n () => props.clearable && !props.disabled && (hasValue.value || (typing.value && !!draft.value)),\n)\nconst endIcon = computed<IconSource | undefined>(() =>\n hasPanel.value ? props.pickerIcon : undefined,\n)\n// @a11y @devwarn\n/*\n * TRAP — the LABEL is defined at all times, even when no icon is rendered at all.\n *\n * The helper detecting a click handler on an icon warns AT SETUP if one is attached\n * without a label, and it has no way of knowing whether an icon exists. Since the\n * listener here is attached permanently and that detection is static, making the label\n * conditional would produce a false warning every time a field without a calendar is\n * mounted.\n *\n * The wording itself has no prop: the dictionary is where it is changed — see `src/i18n/`.\n */\nconst m = useMessages()\n\nconst endIconLabel = computed(() => m.value.dateInput.open)\n\nfunction onEndIcon() {\n if (open.value) closeAndFocus()\n // Clicking the icon is an explicit request for the calendar, and the focus has already\n // left the field for the button — so carrying it into the grid is right in both modes.\n else openPanel(true)\n}\n// @a11y\n/*\n * Emptying the value, called by the field as it emits its clear event.\n *\n * TRAP — the focus is taken here, under the lock, on purpose: the field focuses itself\n * immediately afterwards, and focusing an element that ALREADY has the focus emits no\n * event at all. That is what stops the panel reopening. Taking the lock away from this\n * function brings the reopening straight back.\n */\nfunction clearValue() {\n model.value =\n props.selection === 'multiple'\n ? []\n : props.selection === 'range'\n ? { start: null, end: null }\n : null\n // The typed text is emptied EXPLICITLY: when the value was already empty, nothing\n // changes, and the guard that keeps the field and the value from chasing each other\n // would leave the text where it was.\n if (typing.value) writeField('')\n refocusing = true\n inputRef.value?.focus()\n refocusing = false\n}\n\n/**\n * A date was chosen in the calendar. Choosing ONE date finishes the job, so the panel\n * closes; a period or a list is still being built and it stays open.\n */\nfunction onSelect() {\n if (props.selection === 'single') closeAndFocus()\n}\n\nconst close = () => closeAndFocus()\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-date-input\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-open=\"open ? '' : undefined\"\n :data-mode=\"resolvedMode\"\n @focusout=\"onFocusout\"\n @keydown=\"onRootKeydown\"\n >\n <div class=\"v-date-input-control\" @click=\"onControlClick\">\n <!-- The field is declared a combobox rather than left as the plain text box it\n implicitly is, because a text box may not carry the attribute saying whether\n something is expanded — and a text field with a panel attached IS the combobox\n pattern, the same role VCombobox gives its own field.\n\n The role and the three attributes are all conditioned on the SAME thing, so the\n role never appears without the expanded state it requires, and nothing ever\n points at a panel that was not rendered. -->\n <VInput\n ref=\"inputRef\"\n v-model=\"fieldModel\"\n :inputmode=\"typing ? 'numeric' : undefined\"\n :autocomplete=\"typing ? 'off' : undefined\"\n v-bind=\"forwardedAttrs\"\n :readonly=\"!typing\"\n :label=\"label\"\n :hint=\"hint\"\n :placeholder=\"placeholder ?? (typing ? maskHint : undefined)\"\n :size=\"size\"\n :compact=\"compact\"\n :disabled=\"disabled\"\n :invalid=\"invalid\"\n :clearable=\"clearable\"\n :clear-visible=\"canClear\"\n :clear-label=\"m.dateInput.clear\"\n :icon-end=\"endIcon\"\n :icon-end-label=\"endIconLabel\"\n :role=\"hasPanel ? 'combobox' : undefined\"\n :aria-haspopup=\"hasPanel ? 'dialog' : undefined\"\n :aria-expanded=\"hasPanel ? open : undefined\"\n :aria-controls=\"hasPanel ? panelId : undefined\"\n @click:icon-end=\"onEndIcon\"\n @clear=\"clearValue\"\n @focus=\"onFieldFocus\"\n @input=\"onFieldInput\"\n @change=\"commitOrRevert\"\n @blur=\"commitOrRevert\"\n @keydown=\"onFieldKeydown\"\n @paste=\"onFieldPaste\"\n />\n </div>\n\n <!-- With no panel rendered there is nothing to hold a reference to, and the open state\n — which is fed by the panel's own events — can no longer become true. The absence\n of a panel is therefore self-enforcing. -->\n <VPopover\n v-if=\"hasPanel\"\n :id=\"panelId\"\n ref=\"panelRef\"\n v-model:open=\"open\"\n mode=\"manual\"\n anchor=\"--date-input-anchor\"\n :placement=\"placement\"\n surface\n role=\"dialog\"\n :aria-label=\"label ?? m.dateInput.label\"\n class=\"v-date-input-panel\"\n @mousedown=\"onPanelMousedown\"\n >\n <VDatePicker\n ref=\"pickerRef\"\n v-model=\"model\"\n :selection=\"selection\"\n :locale=\"resolvedLocale\"\n :first-day-of-week=\"firstDayOfWeek\"\n :min=\"min\"\n :max=\"max\"\n :disabled-dates=\"disabledDates\"\n :show-adjacent-days=\"showAdjacentDays\"\n :select-adjacent-days=\"selectAdjacentDays\"\n :events=\"events\"\n @select=\"onSelect\"\n >\n <template v-if=\"$slots.day\" #day=\"slotProps\">\n <slot name=\"day\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"$slots.footer\" #footer>\n <slot name=\"footer\" :close=\"close\" />\n </template>\n </VDatePicker>\n </VPopover>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-input {\n /* Confines the anchor to this instance (the root = the common ancestor of the\n control and the panel) */\n anchor-scope: --date-input-anchor;\n display: block;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-date-input-control {\n anchor-name: --date-input-anchor;\n display: block;\n cursor: pointer;\n }\n\n /* Input mode: the field is editable, and the <input>'s text caret takes over from the\n control's `pointer` (which signals \"this opens a panel\"). The mask has a fixed width:\n tabular figures, otherwise the caret jitters from one digit to the next. */\n .v-date-input[data-mode='input'] .v-date-input-control {\n cursor: text;\n }\n\n .v-date-input[data-mode='input'] .v-input-control {\n font-variant-numeric: tabular-nums;\n }\n\n /* `position-anchor` and the chrome come from VPopover (the `anchor` and `surface`\n props, the latter setting `.v-panel`): only the dimensions are left here, which\n `panel.css` deliberately does not carry. The padding is cancelled — VDatePicker handles\n its own breathing room; compounded with `.v-popover-panel` (VPopover puts both\n classes on the same element) because `.v-panel` declares `padding` too, and at\n equal specificity the winner would depend on the order in which the consumer's\n bundler concatenates the CSS. */\n .v-popover-panel.v-date-input-panel {\n width: max-content;\n padding: 0;\n }\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"VDateInput.js","names":[],"sources":["../../../src/components/VDateInput/VDateInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @a11y @core\n/**\n * A field for choosing a date: a VInput, and a VDatePicker in a panel below it.\n *\n * The panel is `mode=\"manual\"` and driven imperatively, which is not a detail — `popovertarget`\n * is invalid on a text `<input>`, and opening it ourselves is also what lets focus be moved\n * INTO the grid so the keyboard lands on the dates. Closing is ours too: `focusout`, or Escape.\n *\n * Two FIELD modes, `mode`: `input` (the default) types digits only, the separators appearing\n * as they go in the order and punctuation of the reader's locale; `picker` makes the calendar\n * the only way in. What the field is FOR is a different question from the `readonly` prop,\n * which freezes whatever it holds by every route at once.\n *\n * That is a different question from WHAT is chosen — one date, a range, or several — which is\n * `selection`, passed straight through to the picker.\n */\n\nimport { computed, inject, provide, ref, watchEffect } from 'vue'\n\nimport { inputGroupKey } from '../VInput/context'\n\nimport VDatePicker from '../VDatePicker/VDatePicker.vue'\nimport type {\n DatePickerDaySlotProps,\n DatePickerEvent,\n DatePickerSelection,\n DatePickerValue,\n DatePickerMatcher,\n DatePickerRange,\n} from '../VDatePicker/VDatePicker.vue'\nimport {\n caretAfterDigits,\n compareISO,\n dateMaskFor,\n formatDateDisplay,\n formatDateMask,\n formatDisplayRange,\n isDateAllowed,\n isValidISO,\n isoToMask,\n maskPlaceholder,\n parseDateMask,\n} from '../../utils/date'\nimport { digitsOf } from '../../utils/text'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { isDev } from '../../utils/env'\nimport { hostWarnsKey } from '../../utils/hostWarns'\nimport { calendar_today as calendarTodayIcon } from '../VIcon/icons/calendar_today'\nimport type { IconSource } from '../VIcon/types'\nimport VInput from '../VInput/VInput.vue'\nimport VPopover from '../VPopover/VPopover.vue'\n\nimport { useControlShape } from '../../composables/useControlShape'\nimport { useRootAttrs } from '../../composables/useRootAttrs'\n\nimport { useFieldPanel } from '../../composables/useFieldPanel'\nimport { canClear } from '../../composables/useClearable'\nimport { iconStartListener } from '../../composables/useIconClickHandlers'\nimport { useMaskedField } from '../../composables/useMaskedField'\nimport { useMessages, useResolvedLocale } from '../../i18n/state'\n\n/** Where the calendar opens relative to the field. */\nexport type DateInputPlacement =\n 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end'\n\n/** Whether the field can be typed into, or only filled from the calendar. */\nexport type DateInputMode = 'picker' | 'input'\n\nconst MODES: DateInputMode[] = ['picker', 'input']\n\n/**\n * The century a two-digit year is expanded into — \"10/06/26\" becomes 2026 — applied only\n * when the reader leaves the field.\n *\n * It is FIXED and never derived from the current year. A sliding rule would make the\n * component's behaviour depend on when it runs, which is the same objection that keeps\n * today's date out of VDatePicker's setup, and it would give the tests a shelf life.\n */\nconst YEAR_PIVOT = 2000\n\nconst DEFAULT_DISPLAY_FORMAT: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n}\n\n/** The height of the field: 32, 40 or 48 pixels. */\nexport type DateInputSize = 'sm' | 'md' | 'lg'\n\ninterface DateInputProps {\n // Everything from here to `events` is handed straight to the calendar.\n /** What is being chosen: one date, a period between two, or several separate dates. */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names, the first day of the week and\n * the order the field is typed in. It TAKES PRECEDENCE over the design system's global\n * locale and falls back to it — which is why it has no literal default: `undefined` has\n * to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /** Forces the day the weeks start on, from 0 for Sunday to 6 for Saturday. */\n firstDayOfWeek?: number\n /** The earliest date that can be chosen, as an ISO string. */\n min?: string\n /** The latest date that can be chosen, as an ISO string. */\n max?: string\n /** Dates that cannot be chosen, as a list or as a function. */\n disabledDates?: DatePickerMatcher\n /** Fills the corners of the grid with the greyed days of the neighbouring months. */\n showAdjacentDays?: boolean\n /** Lets those neighbouring days be clicked, which implies showing them. */\n selectAdjacentDays?: boolean\n /** Events to mark under the days they fall on. */\n events?: DatePickerEvent[]\n // From here on: the field.\n /**\n * Whether the field can be TYPED into — the default, using the numeric form of the\n * reader's language — or is filled from the calendar alone, which is `picker`.\n *\n * Typing is reserved for choosing a SINGLE date: a period or a list falls back to\n * `picker`, there being no sensible way to type either.\n */\n mode?: DateInputMode\n /**\n * Offers the date picker alongside a field that can be typed into: an icon at the end of\n * the field, and a panel that opens on focus. It means nothing in `picker` mode, where\n * the calendar is already the only way to choose.\n */\n showPicker?: boolean\n /** The label above the field. */\n label?: string\n /** A line of help under the field. */\n hint?: string\n /** What the field says while empty. */\n placeholder?: string\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: DateInputSize\n /** Takes 4px off the height. */\n compact?: boolean\n /** Makes the field unusable, greyed out through the colour tokens. */\n disabled?: boolean\n /**\n * Shows the date without letting it be changed: nothing can be typed, there is no\n * calendar and no clear cross. The field stays focusable and can be copied from,\n * which is what separates it from `disabled`, and it is a different question from\n * `mode`, which says how a field that CAN be changed is filled in.\n */\n readonly?: boolean\n /** Marks the field as invalid — for a rule of your own. */\n invalid?: boolean\n /**\n * An icon inside the field, at the start. It is decorative by default and becomes a\n * real button as soon as a `@click:icon-start` listener is attached, in which case it\n * needs `iconStartLabel`.\n */\n iconStart?: IconSource\n /** What the start icon does, in words, once it is clickable. */\n iconStartLabel?: string\n /**\n * What the calendar button does, in words. It names the button `pickerIcon` renders,\n * and falls back to the design system dictionary.\n */\n pickerIconLabel?: string\n /**\n * Shows a spinner at the end of the field, in place of the calendar icon. It says\n * that something is being loaded and changes nothing else: the field can still be\n * typed into and the panel still opens.\n */\n loading?: boolean\n /**\n * What screen readers announce while the spinner turns. It falls back to the design\n * system dictionary.\n */\n loadingLabel?: string\n /** Offers a cross that empties the value, shown before the end icon. */\n clearable?: boolean\n /** What that cross does, in words. It falls back to the design system dictionary. */\n clearLabel?: string\n /**\n * The icon that opens the date picker, at the end of the field. The clear cross appears\n * to its left rather than in its place, and no icon is rendered at all when there is no\n * panel to open.\n */\n pickerIcon?: IconSource\n /**\n * How the date is WRITTEN OUT in the field. It has no effect on a field being typed\n * into, which necessarily shows the numeric form one types — so it concerns the\n * `picker` mode, and the period and list selections, which fall back to it.\n */\n displayFormat?: Intl.DateTimeFormatOptions\n /** Where the panel opens relative to the field. */\n placement?: DateInputPlacement\n}\n\nconst props = withDefaults(defineProps<DateInputProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n // Deliberately left undefined rather than defaulted to the typed mode: that is what\n // distinguishes \"the prop was not given\" from \"the prop was given this value\", and\n // therefore what allows warning ONLY the consumer who explicitly asked for something\n // that cannot work.\n mode: undefined,\n showPicker: false,\n label: undefined,\n hint: undefined,\n placeholder: undefined,\n size: 'md',\n compact: false,\n disabled: false,\n readonly: false,\n invalid: false,\n iconStart: undefined,\n iconStartLabel: undefined,\n pickerIconLabel: undefined,\n loading: false,\n loadingLabel: undefined,\n clearable: false,\n clearLabel: undefined,\n pickerIcon: () => calendarTodayIcon,\n // Left undefined rather than defaulted to the format object, for the same reason: it is\n // what lets the component notice that a consumer has asked for a display format in a\n // mode where it has no effect, and say so.\n displayFormat: undefined,\n placement: 'bottom-start',\n})\n\n/**\n * The date or dates chosen, in the shape `selection` calls for: an ISO `YYYY-MM-DD` string\n * for `single`, a `{ start, end }` pair for `range`, an array for `multiple`. Nothing is\n * selected to begin with.\n *\n * While the reader types, it is only written once what they have entered is a complete and\n * acceptable date; an unfinished or refused entry leaves it untouched and is reverted when\n * they leave the field.\n */\nconst model = defineModel<DatePickerValue>({ default: null })\n\nconst emit = defineEmits<{\n /** The clear cross emptied the field. The value has already been reset. */\n clear: []\n /** The start icon was clicked. Attaching this listener is what makes it a button. */\n 'click:icon-start': [event: MouseEvent]\n}>()\n\ndefineSlots<{\n /**\n * Content at the start of the field, rendered after `iconStart` rather than in its place,\n * as in VInput.\n */\n start?(): unknown\n /**\n * Controls of your own inside the field, placed before the ones the field owns — the clear\n * cross and the icon that opens the panel. Those two are this component's own affordance,\n * which is why there is no `#end` here: it would replace them.\n */\n 'value-end'?(): unknown\n /** What a day cell shows, handed straight to the calendar. */\n day?(props: DatePickerDaySlotProps): unknown\n /**\n * The strip at the foot of the panel — actions, or preset dates such as \"today\". It\n * receives `close`, which is what lets one of those buttons dismiss the panel.\n */\n footer?(props: { close: () => void }): unknown\n}>()\n\n// `class` and `style` stay on the wrapper; everything else goes down to the text field,\n// which is what a consumer's label points at and what assistive technology deals with.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\n// Declared as this component's own event, `click:icon-start` is out of `$attrs`, so the\n// listener is relayed to the field by hand — and only when the consumer wrote one.\nconst iconStartClick = iconStartListener((event) => emit('click:icon-start', event))\n\n/** What reaches the field: the consumer's own attributes, plus that listener. */\nconst fieldAttrs = computed(() => ({ ...forwardedAttrs.value, ...iconStartClick }))\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst panelRef = ref<InstanceType<typeof VPopover> | null>(null)\nconst inputRef = ref<InstanceType<typeof VInput> | null>(null)\nconst pickerRef = ref<InstanceType<typeof VDatePicker> | null>(null)\n\n/** The real input inside the field, which the mask and the caret work on. */\nconst fieldEl = computed<HTMLInputElement | null>(() => inputRef.value?.el ?? null)\n\n/** What was asked for, falling back to the default when nothing or nonsense was given. */\nconst requestedMode = computed<DateInputMode>(() =>\n props.mode !== undefined && MODES.includes(props.mode) ? props.mode : 'input',\n)\n/**\n * What is actually used. Typing is only possible for a single date: a period or a list\n * has no form one could type into a single field.\n */\nconst resolvedMode = computed<DateInputMode>(() =>\n requestedMode.value === 'input' && props.selection === 'single' ? 'input' : 'picker',\n)\nconst typing = computed(() => resolvedMode.value === 'input')\n\n/**\n * Whether there is a panel at all. The calendar is only optional beside a field one can\n * type into: in `picker` mode it is the only way to choose anything, and a frozen field\n * has none at all.\n */\nconst hasPanel = computed(() => !props.readonly && (!typing.value || props.showPicker))\n\n// @devwarn\nif (isDev) {\n // The calendar receives `min` and `max` as they stand, so what it would say about them is\n // said here, under the name the consumer wrote (utils/hostWarns).\n provide(hostWarnsKey, true)\n watchEffect(() => {\n if (props.min && props.max && compareISO(props.min, props.max) > 0)\n console.warn(\n `[VDateInput] min \"${props.min}\" falls after max \"${props.max}\", so no date can be chosen.`,\n )\n // Without a panel there is no icon to draw and no button to name. A read-only field is\n // left out: it is a state that comes and goes, not a configuration to correct.\n if (typing.value && !props.showPicker) {\n const inert = ([] as string[]).concat(\n props.pickerIcon !== calendarTodayIcon ? 'pickerIcon' : [],\n props.pickerIconLabel ? 'pickerIconLabel' : [],\n )\n if (inert.length > 0)\n console.warn(\n `[VDateInput] ${inert.join(', ')} ${inert.length > 1 ? 'are' : 'is'} ignored without showPicker: a field one types into has no calendar icon unless it offers the calendar.`,\n )\n }\n if (props.mode !== undefined && !MODES.includes(props.mode))\n console.warn(\n `[VDateInput] unknown mode \"${props.mode}\": use \"input\" (the default) or \"picker\".`,\n )\n // Tested on the PROP and not on what was resolved from it: typing being the default,\n // a period or a list falls back on its own with nobody having asked for anything.\n // Only a consumer who explicitly asked to type deserves to be told it cannot work.\n if (props.mode === 'input' && props.selection !== 'single')\n console.warn(\n `[VDateInput] mode=\"input\" ignored in \"${props.selection}\" selection: a range or a list of dates cannot be typed on the keyboard.`,\n )\n // Here it is the RESOLVED mode that matters: the format really was supplied, and it\n // really will have no effect, whichever route led to a typed field. The warning stays\n // something the consumer can act on.\n if (props.displayFormat && typing.value)\n console.warn(\n '[VDateInput] displayFormat is ignored in \"input\" mode (the default): the field displays the locale\\'s numeric mask, the only typeable format. Pass mode=\"picker\" for a formatted display.',\n )\n })\n}\n\n// A VInputGroup joins several controls into one object, so the shape of this field is the\n// row's decision rather than its own (VInput/context.ts).\nconst group = inject(inputGroupKey, null)\nconst {\n size: resolvedSize,\n compact: resolvedCompact,\n disabled: resolvedDisabled,\n} = useControlShape(props, group)\n\n// The whole \"field plus panel\" shell, shared with VTimeInput: opening and closing, the\n// focus leaving the component and coming back to the field, a click on the field or its\n// icon, and the Escape, ArrowDown and Enter keys.\nconst {\n open,\n panelId,\n closeAndFocus,\n focusField,\n onFieldFocus,\n toggleFromIcon,\n onControlClick,\n onFocusout,\n onKeydown,\n onPanelMousedown,\n} = useFieldPanel({\n rootEl,\n panelRef,\n field: inputRef,\n // With no panel there is nothing to open. This is the composable's SINGLE cut-off\n // point, and every way in passes through it — clicking the field, focusing it, the\n // down arrow, Enter, the icon — so the condition never has to be repeated in a\n // handler.\n disabled: () => resolvedDisabled.value || !hasPanel.value,\n focusInPanel: () => pickerRef.value?.focus(),\n // The calendar stays mounted while the panel is closed, so it is put back on the days\n // view both ways: a field that opens on focus never goes through `focus()`.\n onOpen: () => pickerRef.value?.reset(),\n onClose: () => pickerRef.value?.reset(),\n // Beside a field one types into, the panel opens on focus WITHOUT taking it: typing\n // carries on in the field, and the down arrow remains the way into the grid.\n openOnFocus: () => typing.value,\n})\n\nconst hasValue = computed(() => {\n if (props.selection === 'multiple') return Array.isArray(model.value) && model.value.length > 0\n if (props.selection === 'range') {\n const r = model.value as DatePickerRange | null\n return !!(r && (r.start || r.end))\n }\n return typeof model.value === 'string' && !!model.value\n})\n\n/* TRAP — this component is the SINGLE place the locale is resolved: what flows down to the\n calendar is the RESULT, never the prop, which would usually be undefined and would have\n the calendar resolve the language a second time — with every chance of the two\n disagreeing after a later change. */\nconst resolvedLocale = useResolvedLocale(() => props.locale)\n\nconst displayText = computed(() => {\n const locale = resolvedLocale.value\n const displayFormat = props.displayFormat ?? DEFAULT_DISPLAY_FORMAT\n if (props.selection === 'single') {\n return typeof model.value === 'string' && isValidISO(model.value)\n ? formatDateDisplay(model.value, locale, displayFormat)\n : ''\n }\n if (props.selection === 'range') {\n const r = model.value as DatePickerRange | null\n if (!r?.start) return ''\n if (!r.end) return formatDateDisplay(r.start, locale, displayFormat)\n return formatDisplayRange(r.start, r.end, locale, displayFormat)\n }\n const list = Array.isArray(model.value) ? model.value : []\n return list.map((iso) => formatDateDisplay(iso, locale, displayFormat)).join(', ')\n})\n\n/* From here on: everything the typed field needs. */\n\nconst mask = computed(() => dateMaskFor(resolvedLocale.value))\nconst maskHint = computed(() => maskPlaceholder(resolvedLocale.value, mask.value))\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\n/**\n * Whether a date the reader has finished typing may actually be taken: it has to fall\n * within the allowed bounds and not be one of the excluded days.\n */\nconst acceptable = (iso: string) => isDateAllowed(iso, props.min, props.max, isDisabledDate.value)\n\n/*\n * The mask machinery — the text being typed, the bridge to the value, the reformatting\n * that preserves the caret, the commit as soon as the date is complete and the silent\n * revert when it is not — is shared with VTimeInput and lives in `useMaskedField`.\n *\n * What is injected here is the date VOCABULARY alone: the order of the fields, the\n * separator between them and their widths, all derived from the reader's language.\n */\nconst {\n draft,\n fieldModel,\n writeField,\n commitOrRevert,\n onFieldInput,\n onKeydown: onMaskKeydown,\n onPaste,\n} = useMaskedField({\n fieldEl,\n typing: () => typing.value,\n displayText: () => displayText.value,\n readValue: () =>\n typeof model.value === 'string' && isValidISO(model.value) ? model.value : null,\n writeValue: (iso) => {\n model.value = iso\n },\n maxDigits: () => mask.value.size,\n format: (digits) => formatDateMask(digits, mask.value),\n caret: (text, digitsBefore, inserting) =>\n caretAfterDigits(text, digitsBefore, inserting ? mask.value.separator : undefined),\n // A two-digit year is only expanded on the FINAL commit, when the reader leaves the\n // field — never while they are still typing, where \"26\" may well be on its way to\n // becoming \"2026\".\n parse: (text, final) =>\n parseDateMask(text, mask.value, final ? { yearPivot: YEAR_PIVOT } : undefined),\n toMask: (iso) => (iso ? isoToMask(iso, mask.value) : ''),\n acceptable,\n})\n\n/**\n * Typing anything that is not a digit — a slash, a dot, a space — completes the field\n * being typed with a leading zero and moves on to the next. It is what lets someone type\n * \"5/6/2026\" and get the same result as typing all eight digits.\n *\n * It applies to the day and the month only: a year cut short has no such convention, \"26\"\n * being neither 0026 nor 2026 until the reader has finished.\n */\nfunction padCurrentField(el: HTMLInputElement) {\n const start = el.selectionStart ?? el.value.length\n const before = digitsOf(el.value.slice(0, start)).length\n const digits = digitsOf(el.value)\n let offset = 0\n for (let k = 0; k < mask.value.order.length; k++) {\n const len = mask.value.lengths[k] as number\n if (before < offset + len) {\n const filled = before - offset\n if (mask.value.order[k] === 'year' || filled !== len - 1) return\n const next = digits.slice(0, offset) + '0'.repeat(len - filled) + digits.slice(offset)\n const text = formatDateMask(next.slice(0, mask.value.size), mask.value)\n writeField(text, caretAfterDigits(text, offset + len, mask.value.separator))\n return\n }\n offset += len\n }\n}\n\n// @keyboard — what the mask's keys mean for a date: a separator completes the field being\n// typed, and the down arrow is the one explicit way from the field into the calendar.\nfunction onFieldKeydown(event: KeyboardEvent) {\n onMaskKeydown(event, {\n onSeparator: padCurrentField,\n onArrowDown: () => {\n if (!open.value) return false\n pickerRef.value?.focus()\n return true\n },\n onEnter: closeAndFocus,\n })\n}\n\n/**\n * Pasting. A date recognizable as a whole — in the ISO form, or already written the way\n * this field writes them — is adopted as it stands; anything else contributes its digits\n * alone.\n */\nfunction onFieldPaste(event: ClipboardEvent) {\n onPaste(event, (pasted) =>\n isValidISO(pasted) ? pasted : parseDateMask(pasted, mask.value, { yearPivot: YEAR_PIVOT }),\n )\n}\n\n/*\n * The clear cross is the field's own, which renders it BEFORE the end icon rather than in\n * its place — the convention every field in the design system follows, so the two live\n * side by side.\n *\n * Whether it is shown has to be answered explicitly here: outside the typed mode the field\n * is read-only, and a read-only field hides its cross by default, rightly so — but here\n * the value comes from the panel, so there is something to clear all the same. The\n * `readonly` PROP is the one case where the default answer was right: frozen, the field\n * offers no route to a new value, so it offers no route to none either.\n */\nconst clearVisible = computed(() =>\n canClear(props, resolvedDisabled.value, hasValue.value || (typing.value && !!draft.value)),\n)\nconst endIcon = computed<IconSource | undefined>(() =>\n hasPanel.value ? props.pickerIcon : undefined,\n)\n// @a11y @devwarn\n/*\n * TRAP — the LABEL is defined at all times, even when no icon is rendered at all.\n *\n * The helper detecting a click handler on an icon warns AT SETUP if one is attached\n * without a label, and it has no way of knowing whether an icon exists. Since the\n * listener here is attached permanently and that detection is static, making the label\n * conditional would produce a false warning every time a field without a calendar is\n * mounted.\n *\n * The wording itself has no prop: the dictionary is where it is changed — see `src/i18n/`.\n */\nconst m = useMessages()\n\nconst endIconLabel = computed(() => props.pickerIconLabel ?? m.value.dateInput.openPicker)\nconst resolvedClearLabel = computed(() => props.clearLabel ?? m.value.dateInput.clear)\n\n/*\n * Emptying the value, called by the field as it emits its clear event. The focus is taken\n * through `focusField`, whose note says why that stops the panel reopening.\n */\nfunction clearValue() {\n model.value =\n props.selection === 'multiple'\n ? []\n : props.selection === 'range'\n ? { start: null, end: null }\n : null\n // The typed text is emptied EXPLICITLY: when the value was already empty, nothing\n // changes, and the guard that keeps the field and the value from chasing each other\n // would leave the text where it was.\n if (typing.value) writeField('')\n focusField()\n emit('clear')\n}\n\n/**\n * A date was chosen in the calendar. Choosing ONE date finishes the job, so the panel\n * closes; a period or a list is still being built and it stays open.\n */\nfunction onSelect() {\n if (props.selection === 'single') closeAndFocus()\n}\n\ndefineExpose({\n /** Moves the focus to the text field. */\n focus: (options?: FocusOptions) => inputRef.value?.focus(options),\n /** Selects what the field is showing. */\n select: () => inputRef.value?.select(),\n /** The real `<input>` behind the field, for what neither of the two above covers. */\n el: computed(() => inputRef.value?.el ?? null),\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-date-input\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-open=\"open ? '' : undefined\"\n :data-mode=\"resolvedMode\"\n @focusout=\"onFocusout\"\n @keydown=\"onKeydown\"\n >\n <div class=\"v-date-input-control\" @click=\"onControlClick\">\n <!-- The field is declared a combobox rather than left as the plain text box it\n implicitly is, because a text box may not carry the attribute saying whether\n something is expanded — and a text field with a panel attached IS the combobox\n pattern, the same role VCombobox gives its own field.\n\n The role and the three attributes are all conditioned on the SAME thing, so the\n role never appears without the expanded state it requires, and nothing ever\n points at a panel that was not rendered. -->\n <VInput\n ref=\"inputRef\"\n v-model=\"fieldModel\"\n :inputmode=\"typing ? 'numeric' : undefined\"\n :autocomplete=\"typing ? 'off' : undefined\"\n v-bind=\"fieldAttrs\"\n :readonly=\"!typing || readonly\"\n :label=\"label\"\n :hint=\"hint\"\n :placeholder=\"placeholder ?? (typing ? maskHint : undefined)\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :disabled=\"resolvedDisabled\"\n :invalid=\"invalid\"\n :clearable=\"clearable\"\n :clear-visible=\"clearVisible\"\n :clear-label=\"resolvedClearLabel\"\n :icon-start=\"iconStart\"\n :icon-start-label=\"iconStartLabel\"\n :loading=\"loading\"\n :loading-label=\"loadingLabel\"\n :icon-end=\"endIcon\"\n :icon-end-label=\"endIconLabel\"\n :role=\"hasPanel ? 'combobox' : undefined\"\n :aria-haspopup=\"hasPanel ? 'dialog' : undefined\"\n :aria-expanded=\"hasPanel ? open : undefined\"\n :aria-controls=\"hasPanel ? panelId : undefined\"\n @click:icon-end=\"toggleFromIcon\"\n @clear=\"clearValue\"\n @focus=\"onFieldFocus\"\n @input=\"onFieldInput\"\n @change=\"commitOrRevert\"\n @blur=\"commitOrRevert\"\n @keydown=\"onFieldKeydown\"\n @paste=\"onFieldPaste\"\n >\n <template v-if=\"$slots.start\" #start><slot name=\"start\" /></template>\n <template v-if=\"$slots['value-end']\" #value-end><slot name=\"value-end\" /></template>\n </VInput>\n </div>\n\n <!-- With no panel rendered there is nothing to hold a reference to, and the open state\n — which is fed by the panel's own events — can no longer become true. The absence\n of a panel is therefore self-enforcing. -->\n <VPopover\n v-if=\"hasPanel\"\n :id=\"panelId\"\n ref=\"panelRef\"\n v-model:open=\"open\"\n mode=\"manual\"\n anchor=\"--date-input-anchor\"\n :placement=\"placement\"\n role=\"dialog\"\n :aria-label=\"label ?? m.dateInput.pickerLabel\"\n class=\"v-date-input-panel\"\n @mousedown=\"onPanelMousedown\"\n >\n <VDatePicker\n ref=\"pickerRef\"\n v-model=\"model\"\n :selection=\"selection\"\n :locale=\"resolvedLocale\"\n :first-day-of-week=\"firstDayOfWeek\"\n :min=\"min\"\n :max=\"max\"\n :disabled-dates=\"disabledDates\"\n :show-adjacent-days=\"showAdjacentDays\"\n :select-adjacent-days=\"selectAdjacentDays\"\n :events=\"events\"\n @select=\"onSelect\"\n >\n <template v-if=\"$slots.day\" #day=\"slotProps\">\n <slot name=\"day\" v-bind=\"slotProps\" />\n </template>\n <template v-if=\"$slots.footer\" #footer>\n <slot name=\"footer\" :close=\"closeAndFocus\" />\n </template>\n </VDatePicker>\n </VPopover>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-input {\n /* Confines the anchor to this instance (the root = the common ancestor of the\n control and the panel) */\n anchor-scope: --date-input-anchor;\n display: block;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-date-input-control {\n display: block;\n cursor: pointer;\n }\n\n /* The anchor is the FIELD's box and not this wrapper's, which also holds the label and\n the hint: anchored to the wrapper, the calendar opens a hint's height below the field,\n and a label's height above it once there is no room below and `flip-block` turns it\n over. Against the field it covers whichever of the two it lands on, which is what a\n panel belonging to a control is supposed to do. */\n .v-date-input-control .v-input-field {\n anchor-name: --date-input-anchor;\n }\n\n /* Input mode: the field is editable, and the <input>'s text caret takes over from the\n control's `pointer` (which signals \"this opens a panel\"). The mask has a fixed width:\n tabular figures, otherwise the caret jitters from one digit to the next. */\n .v-date-input[data-mode='input'] .v-date-input-control {\n cursor: text;\n }\n\n .v-date-input[data-mode='input'] .v-input-control {\n font-variant-numeric: tabular-nums;\n }\n\n /* `position-anchor` and the chrome come from VPopover (the `anchor` prop, and the\n `.v-panel` it sets on any panel that is not `bare`): only the dimensions are left here,\n which `panel.css` deliberately does not carry. The panel's OWN padding is cancelled,\n VDatePicker padding itself as VTimePicker does, so both pickers keep the same room\n on a page and in a panel. Compounded with `.v-popover-panel` (VPopover puts both\n classes on the same element) because `.v-panel` declares `padding` too, and at\n equal specificity the winner would depend on the order in which the consumer's\n bundler concatenates the CSS. */\n .v-popover-panel.v-date-input-panel {\n width: max-content;\n padding: 0;\n }\n}\n</style>\n"],"mappings":""}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMessages as e, useResolvedLocale as t } from "../../i18n/state.js";
|
|
2
2
|
import n from "../VPopover/VPopover.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import a from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
3
|
+
import { useControlShape as r } from "../../composables/useControlShape.js";
|
|
4
|
+
import { resolveMatcher as i } from "../../utils/matcher.js";
|
|
5
|
+
import { useRootAttrs as a } from "../../composables/useRootAttrs.js";
|
|
6
|
+
import { iconStartListener as o } from "../../composables/useIconClickHandlers.js";
|
|
7
|
+
import { canClear as ee } from "../../composables/useClearable.js";
|
|
8
|
+
import { inputGroupKey as s } from "../VInput/context.js";
|
|
9
|
+
import te from "../VInput/VInput.js";
|
|
10
|
+
import { digitsOf as c } from "../../utils/text.js";
|
|
11
|
+
import { caretAfterDigits as l, dateMaskFor as ne, formatDateDisplay as u, formatDateMask as d, formatDisplayRange as re, isDateAllowed as ie, isValidISO as f, isoToMask as ae, maskPlaceholder as oe, parseDateMask as p } from "../../utils/date.js";
|
|
12
|
+
import "../../utils/hostWarns.js";
|
|
13
|
+
import se from "../VDatePicker/VDatePicker.js";
|
|
14
|
+
import { calendar_today as m } from "../VIcon/icons/calendar_today.js";
|
|
15
|
+
import { useFieldPanel as h } from "../../composables/useFieldPanel.js";
|
|
16
|
+
import { useMaskedField as ce } from "../../composables/useMaskedField.js";
|
|
17
|
+
import { computed as g, createBlock as le, createCommentVNode as ue, createElementBlock as de, createElementVNode as fe, createSlots as _, createVNode as v, defineComponent as y, guardReactiveProps as pe, inject as me, isRef as b, mergeModels as x, mergeProps as he, normalizeClass as ge, normalizeProps as S, normalizeStyle as _e, openBlock as C, ref as w, renderSlot as T, unref as E, useModel as ve, withCtx as D } from "vue";
|
|
13
18
|
//#region src/components/VDateInput/VDateInput.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var
|
|
19
|
+
var ye = ["data-open", "data-mode"], O = 2e3, k = /*@__PURE__*/ y({
|
|
15
20
|
inheritAttrs: !1,
|
|
16
21
|
__name: "VDateInput",
|
|
17
|
-
props: /*@__PURE__*/
|
|
22
|
+
props: /*@__PURE__*/ x({
|
|
18
23
|
selection: { default: "single" },
|
|
19
24
|
locale: { default: void 0 },
|
|
20
25
|
firstDayOfWeek: { default: void 0 },
|
|
@@ -50,251 +55,214 @@ var me = ["data-open", "data-mode"], k = 2e3, A = /*@__PURE__*/ x({
|
|
|
50
55
|
type: Boolean,
|
|
51
56
|
default: !1
|
|
52
57
|
},
|
|
58
|
+
readonly: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !1
|
|
61
|
+
},
|
|
53
62
|
invalid: {
|
|
54
63
|
type: Boolean,
|
|
55
64
|
default: !1
|
|
56
65
|
},
|
|
66
|
+
iconStart: { default: void 0 },
|
|
67
|
+
iconStartLabel: { default: void 0 },
|
|
68
|
+
pickerIconLabel: { default: void 0 },
|
|
69
|
+
loading: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: !1
|
|
72
|
+
},
|
|
73
|
+
loadingLabel: { default: void 0 },
|
|
57
74
|
clearable: {
|
|
58
75
|
type: Boolean,
|
|
59
|
-
default: !
|
|
76
|
+
default: !1
|
|
60
77
|
},
|
|
61
|
-
|
|
78
|
+
clearLabel: { default: void 0 },
|
|
79
|
+
pickerIcon: { default: () => m },
|
|
62
80
|
displayFormat: { default: void 0 },
|
|
63
81
|
placement: { default: "bottom-start" }
|
|
64
82
|
}, {
|
|
65
83
|
modelValue: { default: null },
|
|
66
84
|
modelModifiers: {}
|
|
67
85
|
}),
|
|
68
|
-
emits: ["update:modelValue"],
|
|
69
|
-
setup(
|
|
70
|
-
let
|
|
86
|
+
emits: /*@__PURE__*/ x(["clear", "click:icon-start"], ["update:modelValue"]),
|
|
87
|
+
setup(m, { expose: y, emit: x }) {
|
|
88
|
+
let k = ["picker", "input"], be = {
|
|
71
89
|
day: "numeric",
|
|
72
90
|
month: "short",
|
|
73
91
|
year: "numeric"
|
|
74
|
-
}, A =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
}, A = m, j = ve(m, "modelValue"), M = x, { rootClass: N, rootStyle: xe, forwardedAttrs: Se } = a(), Ce = o((e) => M("click:icon-start", e)), we = g(() => ({
|
|
93
|
+
...Se.value,
|
|
94
|
+
...Ce
|
|
95
|
+
})), P = w(null), F = w(null), I = w(null), L = w(null), Te = g(() => I.value?.el ?? null), Ee = g(() => A.mode !== void 0 && k.includes(A.mode) ? A.mode : "input"), R = g(() => Ee.value === "input" && A.selection === "single" ? "input" : "picker"), z = g(() => R.value === "input"), B = g(() => !A.readonly && (!z.value || A.showPicker)), { size: De, compact: Oe, disabled: V } = r(A, me(s, null)), { open: H, panelId: U, closeAndFocus: W, focusField: ke, onFieldFocus: Ae, toggleFromIcon: je, onControlClick: G, onFocusout: K, onKeydown: q, onPanelMousedown: Me } = h({
|
|
96
|
+
rootEl: P,
|
|
97
|
+
panelRef: F,
|
|
98
|
+
field: I,
|
|
99
|
+
disabled: () => V.value || !B.value,
|
|
100
|
+
focusInPanel: () => L.value?.focus(),
|
|
101
|
+
onOpen: () => L.value?.reset(),
|
|
102
|
+
onClose: () => L.value?.reset(),
|
|
103
|
+
openOnFocus: () => z.value
|
|
104
|
+
}), Ne = g(() => {
|
|
82
105
|
if (A.selection === "multiple") return Array.isArray(j.value) && j.value.length > 0;
|
|
83
106
|
if (A.selection === "range") {
|
|
84
107
|
let e = j.value;
|
|
85
108
|
return !!(e && (e.start || e.end));
|
|
86
109
|
}
|
|
87
110
|
return typeof j.value == "string" && !!j.value;
|
|
88
|
-
}),
|
|
89
|
-
let e =
|
|
111
|
+
}), J = t(() => A.locale), Pe = g(() => {
|
|
112
|
+
let e = J.value, t = A.displayFormat ?? be;
|
|
90
113
|
if (A.selection === "single") return typeof j.value == "string" && f(j.value) ? u(j.value, e, t) : "";
|
|
91
114
|
if (A.selection === "range") {
|
|
92
115
|
let n = j.value;
|
|
93
|
-
return n?.start ? n.end ?
|
|
116
|
+
return n?.start ? n.end ? re(n.start, n.end, e, t) : u(n.start, e, t) : "";
|
|
94
117
|
}
|
|
95
118
|
return (Array.isArray(j.value) ? j.value : []).map((n) => u(n, e, t)).join(", ");
|
|
96
|
-
}),
|
|
97
|
-
fieldEl:
|
|
119
|
+
}), Y = g(() => ne(J.value)), Fe = g(() => oe(J.value, Y.value)), Ie = g(() => i(A.disabledDates)), { draft: Le, fieldModel: X, writeField: Z, commitOrRevert: Q, onFieldInput: Re, onKeydown: ze, onPaste: Be } = ce({
|
|
120
|
+
fieldEl: Te,
|
|
98
121
|
typing: () => z.value,
|
|
99
|
-
displayText: () =>
|
|
122
|
+
displayText: () => Pe.value,
|
|
100
123
|
readValue: () => typeof j.value == "string" && f(j.value) ? j.value : null,
|
|
101
124
|
writeValue: (e) => {
|
|
102
125
|
j.value = e;
|
|
103
126
|
},
|
|
104
|
-
maxDigits: () =>
|
|
105
|
-
format: (e) =>
|
|
106
|
-
caret: (e, t, n) =>
|
|
107
|
-
parse: (e, t) =>
|
|
108
|
-
toMask: (e) => e ?
|
|
109
|
-
acceptable: (e) =>
|
|
127
|
+
maxDigits: () => Y.value.size,
|
|
128
|
+
format: (e) => d(e, Y.value),
|
|
129
|
+
caret: (e, t, n) => l(e, t, n ? Y.value.separator : void 0),
|
|
130
|
+
parse: (e, t) => p(e, Y.value, t ? { yearPivot: O } : void 0),
|
|
131
|
+
toMask: (e) => e ? ae(e, Y.value) : "",
|
|
132
|
+
acceptable: (e) => ie(e, A.min, A.max, Ie.value)
|
|
110
133
|
});
|
|
111
|
-
function
|
|
112
|
-
let t = e.selectionStart ?? e.value.length, n =
|
|
113
|
-
for (let e = 0; e <
|
|
114
|
-
let t =
|
|
134
|
+
function Ve(e) {
|
|
135
|
+
let t = e.selectionStart ?? e.value.length, n = c(e.value.slice(0, t)).length, r = c(e.value), i = 0;
|
|
136
|
+
for (let e = 0; e < Y.value.order.length; e++) {
|
|
137
|
+
let t = Y.value.lengths[e];
|
|
115
138
|
if (n < i + t) {
|
|
116
139
|
let a = n - i;
|
|
117
|
-
if (
|
|
118
|
-
let o =
|
|
119
|
-
|
|
140
|
+
if (Y.value.order[e] === "year" || a !== t - 1) return;
|
|
141
|
+
let o = d((r.slice(0, i) + "0".repeat(t - a) + r.slice(i)).slice(0, Y.value.size), Y.value);
|
|
142
|
+
Z(o, l(o, i + t, Y.value.separator));
|
|
120
143
|
return;
|
|
121
144
|
}
|
|
122
145
|
i += t;
|
|
123
146
|
}
|
|
124
147
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (e.key === "ArrowDown" && V.value) {
|
|
134
|
-
e.preventDefault(), F.value?.focus();
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (e.key === "Backspace") {
|
|
138
|
-
let n = t.selectionStart;
|
|
139
|
-
if (n !== null && n === t.selectionEnd && n > 0 && !/\d/.test(t.value[n - 1] ?? "")) {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
let r = o(t.value.slice(0, n)).length, i = o(t.value), a = l(i.slice(0, r - 1) + i.slice(r), K.value);
|
|
142
|
-
J(a, s(a, r - 1)), Y();
|
|
143
|
-
}
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && !/\d/.test(e.key) && (e.preventDefault(), ke(t));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function je(e) {
|
|
150
|
-
if (!z.value) return;
|
|
151
|
-
let t = L.value;
|
|
152
|
-
if (!t) return;
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
let n = (e.clipboardData?.getData("text") ?? "").trim(), r = f(n) ? n : g(n, K.value, { yearPivot: k });
|
|
155
|
-
if (r) {
|
|
156
|
-
let e = m(r, K.value);
|
|
157
|
-
J(e, e.length), Y();
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
let i = t.selectionStart ?? t.value.length, a = t.selectionEnd ?? i, c = o(t.value), u = o(t.value.slice(0, i)).length, d = o(t.value.slice(0, a)).length, p = o(n), h = (c.slice(0, u) + p + c.slice(d)).slice(0, K.value.size), _ = l(h, K.value);
|
|
161
|
-
J(_, s(_, Math.min(u + p.length, h.length))), Y();
|
|
162
|
-
}
|
|
163
|
-
let Z = !1;
|
|
164
|
-
function Q() {
|
|
165
|
-
Z = !0, ye(!0), Z = !1;
|
|
148
|
+
function He(e) {
|
|
149
|
+
ze(e, {
|
|
150
|
+
onSeparator: Ve,
|
|
151
|
+
onArrowDown: () => H.value ? (L.value?.focus(), !0) : !1,
|
|
152
|
+
onEnter: W
|
|
153
|
+
});
|
|
166
154
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
155
|
+
function Ue(e) {
|
|
156
|
+
Be(e, (e) => f(e) ? e : p(e, Y.value, { yearPivot: O }));
|
|
169
157
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
e.preventDefault(), Q();
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
be(e);
|
|
176
|
-
}
|
|
177
|
-
let Pe = y(() => A.clearable && !A.disabled && (Se.value || z.value && !!De.value)), Fe = y(() => B.value ? A.pickerIcon : void 0), $ = t(), Ie = y(() => $.value.dateInput.open);
|
|
178
|
-
function Le() {
|
|
179
|
-
V.value ? Q() : H(!0);
|
|
180
|
-
}
|
|
181
|
-
function Re() {
|
|
158
|
+
let We = g(() => ee(A, V.value, Ne.value || z.value && !!Le.value)), Ge = g(() => B.value ? A.pickerIcon : void 0), $ = e(), Ke = g(() => A.pickerIconLabel ?? $.value.dateInput.openPicker), qe = g(() => A.clearLabel ?? $.value.dateInput.clear);
|
|
159
|
+
function Je() {
|
|
182
160
|
j.value = A.selection === "multiple" ? [] : A.selection === "range" ? {
|
|
183
161
|
start: null,
|
|
184
162
|
end: null
|
|
185
|
-
} : null, z.value &&
|
|
163
|
+
} : null, z.value && Z(""), ke(), M("clear");
|
|
186
164
|
}
|
|
187
|
-
function
|
|
188
|
-
A.selection === "single" &&
|
|
165
|
+
function Ye() {
|
|
166
|
+
A.selection === "single" && W();
|
|
189
167
|
}
|
|
190
|
-
|
|
191
|
-
|
|
168
|
+
return y({
|
|
169
|
+
focus: (e) => I.value?.focus(e),
|
|
170
|
+
select: () => I.value?.select(),
|
|
171
|
+
el: g(() => I.value?.el ?? null)
|
|
172
|
+
}), (e, t) => (C(), de("div", {
|
|
192
173
|
ref_key: "rootEl",
|
|
193
|
-
ref:
|
|
194
|
-
class:
|
|
195
|
-
style:
|
|
196
|
-
"data-open":
|
|
174
|
+
ref: P,
|
|
175
|
+
class: ge(["v-date-input", E(N)]),
|
|
176
|
+
style: _e(E(xe)),
|
|
177
|
+
"data-open": E(H) ? "" : void 0,
|
|
197
178
|
"data-mode": R.value,
|
|
198
|
-
onFocusout: t[4] ||= (...e) =>
|
|
199
|
-
onKeydown:
|
|
200
|
-
}, [
|
|
179
|
+
onFocusout: t[4] ||= (...e) => E(K) && E(K)(...e),
|
|
180
|
+
onKeydown: t[5] ||= (...e) => E(q) && E(q)(...e)
|
|
181
|
+
}, [fe("div", {
|
|
201
182
|
class: "v-date-input-control",
|
|
202
|
-
onClick: t[1] ||= (...e) =>
|
|
203
|
-
}, [
|
|
183
|
+
onClick: t[1] ||= (...e) => E(G) && E(G)(...e)
|
|
184
|
+
}, [v(te, he({
|
|
204
185
|
ref_key: "inputRef",
|
|
205
|
-
ref:
|
|
206
|
-
modelValue:
|
|
207
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
186
|
+
ref: I,
|
|
187
|
+
modelValue: E(X),
|
|
188
|
+
"onUpdate:modelValue": t[0] ||= (e) => b(X) ? X.value = e : null,
|
|
208
189
|
inputmode: z.value ? "numeric" : void 0,
|
|
209
190
|
autocomplete: z.value ? "off" : void 0
|
|
210
|
-
},
|
|
211
|
-
readonly: !z.value,
|
|
212
|
-
label:
|
|
213
|
-
hint:
|
|
214
|
-
placeholder:
|
|
215
|
-
size:
|
|
216
|
-
compact:
|
|
217
|
-
disabled:
|
|
218
|
-
invalid:
|
|
219
|
-
clearable:
|
|
220
|
-
"clear-visible":
|
|
221
|
-
"clear-label":
|
|
222
|
-
"icon-
|
|
223
|
-
"icon-
|
|
191
|
+
}, we.value, {
|
|
192
|
+
readonly: !z.value || m.readonly,
|
|
193
|
+
label: m.label,
|
|
194
|
+
hint: m.hint,
|
|
195
|
+
placeholder: m.placeholder ?? (z.value ? Fe.value : void 0),
|
|
196
|
+
size: E(De),
|
|
197
|
+
compact: E(Oe),
|
|
198
|
+
disabled: E(V),
|
|
199
|
+
invalid: m.invalid,
|
|
200
|
+
clearable: m.clearable,
|
|
201
|
+
"clear-visible": We.value,
|
|
202
|
+
"clear-label": qe.value,
|
|
203
|
+
"icon-start": m.iconStart,
|
|
204
|
+
"icon-start-label": m.iconStartLabel,
|
|
205
|
+
loading: m.loading,
|
|
206
|
+
"loading-label": m.loadingLabel,
|
|
207
|
+
"icon-end": Ge.value,
|
|
208
|
+
"icon-end-label": Ke.value,
|
|
224
209
|
role: B.value ? "combobox" : void 0,
|
|
225
210
|
"aria-haspopup": B.value ? "dialog" : void 0,
|
|
226
|
-
"aria-expanded": B.value ?
|
|
227
|
-
"aria-controls": B.value ?
|
|
228
|
-
"onClick:iconEnd":
|
|
229
|
-
onClear:
|
|
230
|
-
onFocus:
|
|
231
|
-
onInput:
|
|
232
|
-
onChange:
|
|
233
|
-
onBlur:
|
|
234
|
-
onKeydown:
|
|
235
|
-
onPaste:
|
|
236
|
-
}),
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
"
|
|
240
|
-
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
|
|
245
|
-
"compact",
|
|
246
|
-
"disabled",
|
|
247
|
-
"invalid",
|
|
248
|
-
"clearable",
|
|
249
|
-
"clear-visible",
|
|
250
|
-
"clear-label",
|
|
251
|
-
"icon-end",
|
|
252
|
-
"icon-end-label",
|
|
253
|
-
"role",
|
|
254
|
-
"aria-haspopup",
|
|
255
|
-
"aria-expanded",
|
|
256
|
-
"aria-controls",
|
|
257
|
-
"onInput",
|
|
258
|
-
"onChange",
|
|
259
|
-
"onBlur"
|
|
260
|
-
])]), B.value ? (w(), ne(n, {
|
|
211
|
+
"aria-expanded": B.value ? E(H) : void 0,
|
|
212
|
+
"aria-controls": B.value ? E(U) : void 0,
|
|
213
|
+
"onClick:iconEnd": E(je),
|
|
214
|
+
onClear: Je,
|
|
215
|
+
onFocus: E(Ae),
|
|
216
|
+
onInput: E(Re),
|
|
217
|
+
onChange: E(Q),
|
|
218
|
+
onBlur: E(Q),
|
|
219
|
+
onKeydown: He,
|
|
220
|
+
onPaste: Ue
|
|
221
|
+
}), _({ _: 2 }, [e.$slots.start ? {
|
|
222
|
+
name: "start",
|
|
223
|
+
fn: D(() => [T(e.$slots, "start")]),
|
|
224
|
+
key: "0"
|
|
225
|
+
} : void 0, e.$slots["value-end"] ? {
|
|
226
|
+
name: "value-end",
|
|
227
|
+
fn: D(() => [T(e.$slots, "value-end")]),
|
|
228
|
+
key: "1"
|
|
229
|
+
} : void 0]), 1040, /* @__PURE__ */ "modelValue.inputmode.autocomplete.readonly.label.hint.placeholder.size.compact.disabled.invalid.clearable.clear-visible.clear-label.icon-start.icon-start-label.loading.loading-label.icon-end.icon-end-label.role.aria-haspopup.aria-expanded.aria-controls.onClick:iconEnd.onFocus.onInput.onChange.onBlur".split("."))]), B.value ? (C(), le(n, {
|
|
261
230
|
key: 0,
|
|
262
|
-
id:
|
|
231
|
+
id: E(U),
|
|
263
232
|
ref_key: "panelRef",
|
|
264
|
-
ref:
|
|
265
|
-
open:
|
|
266
|
-
"onUpdate:open": t[3] ||= (e) =>
|
|
233
|
+
ref: F,
|
|
234
|
+
open: E(H),
|
|
235
|
+
"onUpdate:open": t[3] ||= (e) => b(H) ? H.value = e : null,
|
|
267
236
|
mode: "manual",
|
|
268
237
|
anchor: "--date-input-anchor",
|
|
269
|
-
placement:
|
|
270
|
-
surface: "",
|
|
238
|
+
placement: m.placement,
|
|
271
239
|
role: "dialog",
|
|
272
|
-
"aria-label":
|
|
240
|
+
"aria-label": m.label ?? E($).dateInput.pickerLabel,
|
|
273
241
|
class: "v-date-input-panel",
|
|
274
|
-
onMousedown:
|
|
242
|
+
onMousedown: E(Me)
|
|
275
243
|
}, {
|
|
276
|
-
default:
|
|
244
|
+
default: D(() => [v(se, {
|
|
277
245
|
ref_key: "pickerRef",
|
|
278
|
-
ref:
|
|
246
|
+
ref: L,
|
|
279
247
|
modelValue: j.value,
|
|
280
248
|
"onUpdate:modelValue": t[2] ||= (e) => j.value = e,
|
|
281
|
-
selection:
|
|
282
|
-
locale:
|
|
283
|
-
"first-day-of-week":
|
|
284
|
-
min:
|
|
285
|
-
max:
|
|
286
|
-
"disabled-dates":
|
|
287
|
-
"show-adjacent-days":
|
|
288
|
-
"select-adjacent-days":
|
|
289
|
-
events:
|
|
290
|
-
onSelect:
|
|
291
|
-
},
|
|
249
|
+
selection: m.selection,
|
|
250
|
+
locale: E(J),
|
|
251
|
+
"first-day-of-week": m.firstDayOfWeek,
|
|
252
|
+
min: m.min,
|
|
253
|
+
max: m.max,
|
|
254
|
+
"disabled-dates": m.disabledDates,
|
|
255
|
+
"show-adjacent-days": m.showAdjacentDays,
|
|
256
|
+
"select-adjacent-days": m.selectAdjacentDays,
|
|
257
|
+
events: m.events,
|
|
258
|
+
onSelect: Ye
|
|
259
|
+
}, _({ _: 2 }, [e.$slots.day ? {
|
|
292
260
|
name: "day",
|
|
293
|
-
fn:
|
|
261
|
+
fn: D((t) => [T(e.$slots, "day", S(pe(t)))]),
|
|
294
262
|
key: "0"
|
|
295
263
|
} : void 0, e.$slots.footer ? {
|
|
296
264
|
name: "footer",
|
|
297
|
-
fn:
|
|
265
|
+
fn: D(() => [T(e.$slots, "footer", { close: E(W) })]),
|
|
298
266
|
key: "1"
|
|
299
267
|
} : void 0]), 1032, [
|
|
300
268
|
"modelValue",
|
|
@@ -315,10 +283,10 @@ var me = ["data-open", "data-mode"], k = 2e3, A = /*@__PURE__*/ x({
|
|
|
315
283
|
"placement",
|
|
316
284
|
"aria-label",
|
|
317
285
|
"onMousedown"
|
|
318
|
-
])) :
|
|
286
|
+
])) : ue("", !0)], 46, ye));
|
|
319
287
|
}
|
|
320
288
|
});
|
|
321
289
|
//#endregion
|
|
322
|
-
export {
|
|
290
|
+
export { k as default };
|
|
323
291
|
|
|
324
292
|
//# sourceMappingURL=VDateInput.vue_vue_type_script_setup_true_lang.js.map
|