vectis-ui 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/components/VAccordion/VAccordionItem.d.ts +4 -6
- package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js +21 -19
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAccordion/context.d.ts +6 -1
- package/dist/components/VAccordion/context.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.css +1 -1
- package/dist/components/VAvatar/VAvatar.d.ts +5 -3
- package/dist/components/VAvatar/VAvatar.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js +53 -39
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.d.ts +12 -3
- package/dist/components/VAvatar/VAvatarGroup.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +27 -20
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/context.d.ts +2 -2
- package/dist/components/VAvatar/context.js.map +1 -1
- package/dist/components/VBadge/VBadge.css +1 -1
- package/dist/components/VBadge/VBadge.d.ts +8 -4
- package/dist/components/VBadge/VBadge.js.map +1 -1
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.d.ts +5 -4
- package/dist/components/VBreadcrumb/VBreadcrumb.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js +8 -3
- 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 +4 -1
- package/dist/components/VButton/VButton.js.map +1 -1
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js +8 -7
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.css +1 -1
- package/dist/components/VCalendar/VCalendar.d.ts +15 -6
- package/dist/components/VCalendar/VCalendar.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js +144 -126
- 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 +1 -1
- package/dist/components/VCalendar/VCalendarEvent.js.map +1 -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 +1 -1
- package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js +99 -90
- 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 +3 -3
- package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js +256 -246
- 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.d.ts +8 -1
- package/dist/components/VCalendar/VCalendarYear.js.map +1 -1
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js +39 -32
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/color.d.ts +1 -1
- package/dist/components/VCalendar/color.js.map +1 -1
- package/dist/components/VCalendar/edgeStep.d.ts +3 -3
- package/dist/components/VCalendar/edgeStep.js +5 -0
- package/dist/components/VCalendar/edgeStep.js.map +1 -1
- package/dist/components/VCalendar/gesture.d.ts +10 -9
- package/dist/components/VCalendar/gesture.js +60 -45
- package/dist/components/VCalendar/gesture.js.map +1 -1
- package/dist/components/VCalendar/keyboard.d.ts +22 -5
- package/dist/components/VCalendar/keyboard.js +17 -16
- package/dist/components/VCalendar/keyboard.js.map +1 -1
- package/dist/components/VCalendar/layout.d.ts +47 -37
- package/dist/components/VCalendar/layout.js +47 -37
- package/dist/components/VCalendar/layout.js.map +1 -1
- package/dist/components/VCalendar/timeGrid.d.ts +4 -4
- package/dist/components/VCalendar/timeGrid.js +6 -6
- package/dist/components/VCalendar/timeGrid.js.map +1 -1
- package/dist/components/VCalendar/types.d.ts +5 -5
- package/dist/components/VCarousel/VCarousel.css +1 -1
- package/dist/components/VCarousel/VCarousel.d.ts +59 -38
- package/dist/components/VCarousel/VCarousel.js.map +1 -1
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js +161 -132
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCarousel/VCarouselItem.d.ts +1 -1
- 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 +1 -1
- package/dist/components/VCarousel/context.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.css +1 -1
- package/dist/components/VCheckbox/VCheckbox.d.ts +2 -2
- package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js +10 -8
- 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 +7 -2
- package/dist/components/VChip/VChip.js.map +1 -1
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +69 -55
- 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 +50 -36
- package/dist/components/VCombobox/VCombobox.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +167 -161
- 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.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/infiniteScroll.d.ts +12 -3
- package/dist/components/VCombobox/infiniteScroll.js +18 -12
- package/dist/components/VCombobox/infiniteScroll.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.css +1 -1
- package/dist/components/VDataTable/VDataTable.d.ts +55 -24
- package/dist/components/VDataTable/VDataTable.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +192 -155
- 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 +15 -12
- package/dist/components/VDateInput/VDateInput.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +180 -160
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDateInput/mask.d.ts +95 -0
- package/dist/components/VDateInput/mask.js +118 -0
- package/dist/components/VDateInput/mask.js.map +1 -0
- package/dist/components/VDatePicker/VDatePicker.css +1 -1
- package/dist/components/VDatePicker/VDatePicker.d.ts +6 -5
- package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +204 -173
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDatePicker/keyboard.d.ts +3 -3
- package/dist/components/VDatePicker/keyboard.js.map +1 -1
- package/dist/components/VDatePicker/names.d.ts +34 -0
- package/dist/components/VDatePicker/names.js +42 -0
- package/dist/components/VDatePicker/names.js.map +1 -0
- package/dist/components/VDialog/VDialog.css +1 -1
- package/dist/components/VDialog/VDialog.d.ts +2 -2
- package/dist/components/VDialog/VDialog.js.map +1 -1
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +63 -41
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.d.ts +38 -25
- package/dist/components/VFileInput/VFileInput.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +74 -71
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFileInput/truncate.d.ts +4 -4
- package/dist/components/VFileInput/truncate.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.css +1 -1
- package/dist/components/VFilePicker/VFilePicker.d.ts +54 -37
- package/dist/components/VFilePicker/VFilePicker.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js +152 -135
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/fileKind.d.ts +2 -2
- package/dist/components/VFilePicker/fileKind.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.css +1 -1
- package/dist/components/VHotkeys/VHotkeys.d.ts +10 -8
- package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +22 -20
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VHotkeys/platform.d.ts +9 -7
- package/dist/components/VHotkeys/platform.js +41 -30
- package/dist/components/VHotkeys/platform.js.map +1 -1
- package/dist/components/VIcon/VIcon.css +1 -1
- package/dist/components/VIcon/VIcon.d.ts +6 -6
- package/dist/components/VIcon/VIcon.js.map +1 -1
- package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VIcon/iconProps.d.ts +4 -4
- 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 +23 -20
- package/dist/components/VIcon/resolver.js.map +1 -1
- package/dist/components/VIcon/types.d.ts +4 -4
- package/dist/components/VIconButton/VIconButton.d.ts +4 -4
- package/dist/components/VIconButton/VIconButton.js.map +1 -1
- package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInput.d.ts +16 -8
- package/dist/components/VInput/VInput.js.map +1 -1
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +22 -16
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInputGroup.css +1 -1
- package/dist/components/VInput/VInputGroup.js.map +1 -1
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +43 -28
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.css +1 -1
- package/dist/components/VInputOTP/VInputOTP.d.ts +3 -3
- package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +152 -85
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenu.d.ts +4 -4
- package/dist/components/VMenu/VMenu.js.map +1 -1
- 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.js.map +1 -1
- package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js +18 -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 +6 -6
- package/dist/components/VMenu/VMenuItem.js.map +1 -1
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +83 -69
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.css +1 -1
- package/dist/components/VMenu/VMenuPanel.d.ts +2 -2
- package/dist/components/VMenu/VMenuPanel.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/context.d.ts +2 -2
- package/dist/components/VMenu/context.js.map +1 -1
- package/dist/components/VPagination/VPagination.css +1 -1
- package/dist/components/VPagination/VPagination.d.ts +31 -9
- package/dist/components/VPagination/VPagination.js.map +1 -1
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +82 -52
- 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 +1 -1
- package/dist/components/VPopover/VPopover.js.map +1 -1
- 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 +12 -7
- package/dist/components/VProgressCircular/VProgressCircular.js.map +1 -1
- 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 +15 -10
- package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
- 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.js.map +1 -1
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSeparator/VSeparator.d.ts +1 -1
- 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.d.ts +2 -2
- package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +1 -1
- 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.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- 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 +12 -13
- package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +87 -68
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.css +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +10 -7
- package/dist/components/VSkeletonLoader/VSkeletonLoader.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js +5 -5
- 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 +21 -7
- package/dist/components/VSlider/VSlider.js.map +1 -1
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +159 -140
- 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 +4 -4
- package/dist/components/VSnackbar/VSnackbar.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js +85 -59
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/state.d.ts +7 -7
- package/dist/components/VSnackbar/state.js +13 -11
- package/dist/components/VSnackbar/state.js.map +1 -1
- package/dist/components/VSpinner/VSpinner.css +1 -1
- package/dist/components/VSpinner/VSpinner.js.map +1 -1
- 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 +1 -1
- package/dist/components/VSwitch/VSwitch.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js +4 -4
- 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 +4 -0
- package/dist/components/VTabs/VTab.js.map +1 -1
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js +9 -8
- package/dist/components/VTabs/VTab.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 +17 -7
- package/dist/components/VTabs/VTabs.js.map +1 -1
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +84 -77
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.d.ts +8 -8
- package/dist/components/VTextarea/VTextarea.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +71 -69
- 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 +21 -12
- package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +230 -206
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/search.d.ts +17 -2
- package/dist/components/VTimeInput/search.js +19 -9
- package/dist/components/VTimeInput/search.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.css +1 -1
- package/dist/components/VTimePicker/VTimePicker.d.ts +8 -7
- package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +128 -106
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimePicker/limits.d.ts +11 -4
- package/dist/components/VTimePicker/limits.js +3 -2
- package/dist/components/VTimePicker/limits.js.map +1 -1
- package/dist/components/VToast/VToast.css +1 -1
- package/dist/components/VToast/VToast.js.map +1 -1
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js +33 -37
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/VToaster.js.map +1 -1
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +91 -61
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/state.d.ts +8 -6
- package/dist/components/VToast/state.js +15 -13
- package/dist/components/VToast/state.js.map +1 -1
- package/dist/components/VToggle/VToggle.css +1 -1
- package/dist/components/VToggle/VToggle.d.ts +9 -4
- package/dist/components/VToggle/VToggle.js.map +1 -1
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.d.ts +4 -0
- package/dist/components/VToggle/VToggleItem.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.css +1 -1
- package/dist/components/VTooltip/VTooltip.d.ts +17 -10
- package/dist/components/VTooltip/VTooltip.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js +46 -26
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTypography/VTypography.css +1 -1
- package/dist/components/VTypography/VTypography.d.ts +6 -4
- 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.js +1 -1
- package/dist/composables/useAriaLabel.js.map +1 -1
- package/dist/composables/useClearable.d.ts +2 -2
- package/dist/composables/useClearable.js.map +1 -1
- package/dist/composables/useDetailsOpen.d.ts +3 -3
- package/dist/composables/useDetailsOpen.js +14 -12
- package/dist/composables/useDetailsOpen.js.map +1 -1
- package/dist/composables/useFieldIds.d.ts +2 -1
- package/dist/composables/useFieldIds.js +6 -5
- package/dist/composables/useFieldIds.js.map +1 -1
- package/dist/composables/useFieldPanel.d.ts +2 -2
- package/dist/composables/useFieldPanel.js +47 -37
- package/dist/composables/useFieldPanel.js.map +1 -1
- package/dist/composables/useFileDrop.js +3 -3
- package/dist/composables/useFileDrop.js.map +1 -1
- package/dist/composables/useFileField.d.ts +1 -1
- package/dist/composables/useFileField.js +62 -41
- package/dist/composables/useFileField.js.map +1 -1
- package/dist/composables/useIconClickHandlers.d.ts +3 -3
- package/dist/composables/useIconClickHandlers.js +14 -13
- package/dist/composables/useIconClickHandlers.js.map +1 -1
- package/dist/composables/useInertLink.js +12 -10
- package/dist/composables/useInertLink.js.map +1 -1
- package/dist/composables/useLiveAnnouncer.d.ts +5 -0
- package/dist/composables/useLiveAnnouncer.js +23 -0
- package/dist/composables/useLiveAnnouncer.js.map +1 -0
- package/dist/composables/useMaskedField.d.ts +5 -5
- package/dist/composables/useMaskedField.js.map +1 -1
- package/dist/composables/usePopover.d.ts +3 -3
- package/dist/composables/usePopover.js +6 -4
- package/dist/composables/usePopover.js.map +1 -1
- package/dist/composables/useProgressValue.js +11 -2
- package/dist/composables/useProgressValue.js.map +1 -1
- package/dist/composables/useRootAttrs.d.ts +1 -1
- package/dist/composables/useRootAttrs.js.map +1 -1
- package/dist/composables/useSlotNodes.d.ts +18 -0
- package/dist/composables/useSlotNodes.js +13 -0
- package/dist/composables/useSlotNodes.js.map +1 -0
- package/dist/composables/useTextLimit.d.ts +2 -1
- package/dist/composables/useTextLimit.js +2 -2
- package/dist/composables/useTextLimit.js.map +1 -1
- package/dist/composables/useTimer.d.ts +5 -0
- package/dist/composables/useTimer.js +22 -11
- package/dist/composables/useTimer.js.map +1 -1
- package/dist/i18n/en.js +1 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/fr.js +14 -14
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/state.d.ts +7 -7
- package/dist/i18n/state.js +37 -28
- package/dist/i18n/state.js.map +1 -1
- package/dist/i18n/types.d.ts +12 -12
- package/dist/icons.d.ts +2 -2
- package/dist/index.d.ts +12 -11
- package/dist/styles.css +1 -1
- package/dist/tokens/css.d.ts +1 -1
- package/dist/tokens/css.js.map +1 -1
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/semantic.d.ts +6 -0
- package/dist/tokens/semantic.js +66 -60
- package/dist/tokens/semantic.js.map +1 -1
- package/dist/tokens/themes/dark.js +3 -3
- package/dist/tokens/themes/dark.js.map +1 -1
- package/dist/tokens.json +130 -66
- package/dist/types.d.ts +1 -1
- package/dist/utils/arrowNav.d.ts +4 -1
- package/dist/utils/arrowNav.js +7 -7
- package/dist/utils/arrowNav.js.map +1 -1
- package/dist/utils/chip.d.ts +1 -1
- package/dist/utils/chip.js.map +1 -1
- package/dist/utils/clock.d.ts +113 -0
- package/dist/utils/clock.js +84 -0
- package/dist/utils/clock.js.map +1 -0
- package/dist/utils/css.d.ts +6 -4
- package/dist/utils/css.js +2 -2
- package/dist/utils/css.js.map +1 -1
- package/dist/utils/date.d.ts +7 -102
- package/dist/utils/date.js +33 -160
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/direction.d.ts +1 -1
- package/dist/utils/direction.js.map +1 -1
- package/dist/utils/env.d.ts +12 -3
- package/dist/utils/env.js +6 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/file.d.ts +3 -3
- package/dist/utils/file.js +1 -1
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/focus.d.ts +1 -1
- package/dist/utils/focus.js.map +1 -1
- package/dist/utils/hostWarns.d.ts +1 -1
- package/dist/utils/hostWarns.js.map +1 -1
- package/dist/utils/ids.d.ts +1 -1
- package/dist/utils/ids.js.map +1 -1
- package/dist/utils/matcher.d.ts +2 -2
- package/dist/utils/matcher.js.map +1 -1
- package/dist/utils/memo.d.ts +1 -1
- package/dist/utils/memo.js.map +1 -1
- package/dist/utils/text.d.ts +3 -3
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/time.d.ts +2 -101
- package/dist/utils/time.js +22 -98
- package/dist/utils/time.js.map +1 -1
- package/dist/utils/vnode.d.ts +5 -3
- package/dist/utils/vnode.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { cssSize as e } from "../../utils/css.js";
|
|
2
2
|
import { usePopover as t } from "../../composables/usePopover.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { isRtl as n } from "../../utils/direction.js";
|
|
4
|
+
import { arrowNavigate as r } from "../../utils/arrowNav.js";
|
|
5
|
+
import { menuInvoker as i, menuKey as a } from "./context.js";
|
|
6
|
+
import { computed as o, createElementBlock as s, defineComponent as c, inject as l, normalizeClass as u, normalizeStyle as d, openBlock as f, ref as p, renderSlot as m, unref as h } from "vue";
|
|
6
7
|
//#region src/components/VMenu/VMenuPanel.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
8
|
+
var g = [
|
|
8
9
|
"id",
|
|
9
10
|
"data-placement",
|
|
10
11
|
"data-size",
|
|
11
12
|
"data-compact",
|
|
12
13
|
"data-width",
|
|
13
14
|
"data-match-trigger"
|
|
14
|
-
],
|
|
15
|
+
], _ = /*@__PURE__*/ c({
|
|
15
16
|
__name: "VMenuPanel",
|
|
16
17
|
props: {
|
|
17
18
|
id: {},
|
|
@@ -32,71 +33,71 @@ var h = [
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
emits: ["toggle"],
|
|
35
|
-
setup(
|
|
36
|
-
let
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
function D() {
|
|
41
|
-
let e = b.value;
|
|
42
|
-
return e ? [...e.querySelectorAll("[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])")].filter((t) => t.closest("[role=\"menu\"]") === e) : [];
|
|
36
|
+
setup(c, { expose: _, emit: v }) {
|
|
37
|
+
let y = c, b = v, x = p(null), { shown: S, syncShown: C, show: w, hide: T } = t(x), E = l(a);
|
|
38
|
+
function D(e) {
|
|
39
|
+
C(e), b("toggle", S.value);
|
|
43
40
|
}
|
|
44
41
|
function O() {
|
|
45
|
-
|
|
42
|
+
let e = x.value;
|
|
43
|
+
return e ? [...e.querySelectorAll("[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])")].filter((t) => t.closest("[role=\"menu\"]") === e) : [];
|
|
46
44
|
}
|
|
47
45
|
function k() {
|
|
48
|
-
|
|
46
|
+
O()[0]?.focus();
|
|
49
47
|
}
|
|
50
|
-
function A(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
function A() {
|
|
49
|
+
x.value?.focus();
|
|
50
|
+
}
|
|
51
|
+
function j(e) {
|
|
52
|
+
let t = x.value;
|
|
53
|
+
if (!t || e.target.closest("[role=\"menu\"]") !== t || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
54
|
+
if (e.key === "Tab") {
|
|
55
|
+
E.closeAll();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let a = n(t) ? "ArrowRight" : "ArrowLeft";
|
|
59
|
+
if (e.key === "Escape" || y.submenu && e.key === a) {
|
|
60
|
+
e.preventDefault(), T(), y.submenu && i(y.id)?.focus();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (e.key === "ArrowUp" && document.activeElement === t) {
|
|
64
|
+
let t = O();
|
|
65
|
+
if (t.length > 0) {
|
|
66
|
+
e.preventDefault(), t[t.length - 1]?.focus();
|
|
59
67
|
return;
|
|
60
68
|
}
|
|
61
|
-
if (e.key === "ArrowUp" && document.activeElement === t) {
|
|
62
|
-
let t = D();
|
|
63
|
-
if (t.length > 0) {
|
|
64
|
-
e.preventDefault(), t[t.length - 1]?.focus();
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
n(e, t, D, { vertical: !0 });
|
|
69
69
|
}
|
|
70
|
+
r(e, t, O, { vertical: !0 });
|
|
70
71
|
}
|
|
71
|
-
let
|
|
72
|
-
return
|
|
73
|
-
show:
|
|
74
|
-
close:
|
|
75
|
-
shown:
|
|
76
|
-
focusFirst:
|
|
77
|
-
focusPanel:
|
|
78
|
-
el:
|
|
79
|
-
}), (e, t) => (
|
|
80
|
-
id:
|
|
72
|
+
let M = o(() => e(y.width) || void 0), N = o(() => M.value ? { "--menu-width": M.value } : void 0);
|
|
73
|
+
return _({
|
|
74
|
+
show: w,
|
|
75
|
+
close: T,
|
|
76
|
+
shown: S,
|
|
77
|
+
focusFirst: k,
|
|
78
|
+
focusPanel: A,
|
|
79
|
+
el: x
|
|
80
|
+
}), (e, t) => (f(), s("div", {
|
|
81
|
+
id: c.id,
|
|
81
82
|
ref_key: "panelEl",
|
|
82
|
-
ref:
|
|
83
|
+
ref: x,
|
|
83
84
|
popover: "auto",
|
|
84
85
|
role: "menu",
|
|
85
86
|
tabindex: "-1",
|
|
86
|
-
class:
|
|
87
|
-
"data-placement":
|
|
88
|
-
"data-size":
|
|
89
|
-
"data-compact":
|
|
90
|
-
"data-width":
|
|
91
|
-
"data-match-trigger":
|
|
92
|
-
style:
|
|
93
|
-
onBeforetoggle: t[0] ||= (...e) =>
|
|
94
|
-
onToggle:
|
|
95
|
-
onKeydown:
|
|
96
|
-
}, [
|
|
87
|
+
class: u(["v-overlay v-panel v-menu v-floating", { "v-control": !c.submenu }]),
|
|
88
|
+
"data-placement": c.placement,
|
|
89
|
+
"data-size": c.size,
|
|
90
|
+
"data-compact": c.compact ? "" : void 0,
|
|
91
|
+
"data-width": M.value ? "" : void 0,
|
|
92
|
+
"data-match-trigger": c.matchTrigger ? "" : void 0,
|
|
93
|
+
style: d(N.value),
|
|
94
|
+
onBeforetoggle: t[0] ||= (...e) => h(C) && h(C)(...e),
|
|
95
|
+
onToggle: D,
|
|
96
|
+
onKeydown: j
|
|
97
|
+
}, [m(e.$slots, "default")], 46, g));
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
//#endregion
|
|
100
|
-
export {
|
|
101
|
+
export { _ as default };
|
|
101
102
|
|
|
102
103
|
//# sourceMappingURL=VMenuPanel.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VMenuPanel.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/VMenu/VMenuPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @a11y @keyboard @core\n/**\n * The panel a menu is drawn in. Internal to VMenu, and the same component serves both\n * levels — the root menu and every submenu.\n *\n * It rests on `popover=\"auto\"`, which gives it light dismiss, positioning against its\n * invoker, and — a submenu being rendered inside its parent panel — a native stack the\n * browser closes from the outside in. Its look comes from the shared `.v-panel`.\n *\n * It carries `tabindex=\"-1\"` so it can hold the focus itself, which it does whenever the\n * menu was opened by POINTER: no command is singled out, but the keyboard still has\n * somewhere to arrive, everything below being listened for on this element.\n *\n * The JS is the ARIA menu keyboard, which the platform does not provide:\n *\n * - arrows and Home/End move focus item to item, CONFINED to the panel the focus is in — a\n * keystroke inside a submenu also bubbles through every panel containing it, hence the\n * guard on where the event came from;\n * - Escape closes the CURRENT LEVEL only, as does ArrowLeft in a submenu, handing focus\n * back to the item that opened it;\n * - Tab closes the whole menu, a menu not being something one tabs through.\n */\n\nimport { computed, inject, ref } from 'vue'\n\nimport { usePopover } from '../../composables/usePopover'\nimport { menuInvoker, menuKey } from './context'\nimport type { MenuPanelPlacement, MenuSize } from './context'\nimport { arrowNavigate } from '../../utils/arrowNav'\nimport { cssSize } from '../../utils/css'\n\ninterface MenuPanelProps {\n /** The panel's id, set by whoever owns it. It is what the trigger points at. */\n id: string\n /** Where the panel opens relative to whatever opened it. */\n placement?: MenuPanelPlacement\n /**\n * Marks this panel as a submenu, which enables the left arrow as a way back and keeps\n * the row-height settings off it, so that it inherits its parent's instead.\n */\n submenu?: boolean\n /**\n * The row height, set by the ROOT panel only. Submenus receive no value and inherit\n * it through CSS instead.\n */\n size?: MenuSize\n /** The reduced density, again set by the ROOT panel only and inherited through CSS. */\n compact?: boolean\n /**\n * An explicit width, set by the ROOT panel only. Submenus render no width attribute\n * and keep the default one, so an inherited value cannot reach them.\n */\n width?: number | string\n /**\n * Stops the panel from being narrower than its trigger, set by the ROOT panel only:\n * a submenu's trigger is a menu item, not a control worth matching.\n */\n matchTrigger?: boolean\n}\n\nconst props = withDefaults(defineProps<MenuPanelProps>(), {\n placement: 'bottom-start',\n submenu: false,\n size: undefined,\n compact: false,\n width: undefined,\n matchTrigger: false,\n})\n\nconst emit = defineEmits<{\n /**\n * The panel opened or closed. It is reported by the browser, so it also covers a\n * dismissal nobody asked for in code.\n */\n toggle: [open: boolean]\n}>()\n\ndefineSlots<{\n /** The contents of the panel: VMenuItem, VMenuGroup and VMenuSeparator. */\n default(): unknown\n}>()\n\nconst panelEl = ref<HTMLElement | null>(null)\n// The open state, the guards keeping the calls idempotent, and the option that gives\n// a programmatically opened submenu its anchor, all live in usePopover.\nconst { shown, syncShown, show, hide } = usePopover(panelEl)\n\n// Never absent: this panel is internal, rendered only by VMenu and by the VMenuItems inside\n// one, and VMenu provides the key before either exists.\nconst menu = inject(menuKey)!\n\nfunction onToggle(event: Event) {\n syncShown(event)\n emit('toggle', shown.value)\n}\n\n// @a11y @keyboard\n/**\n * The items the keyboard may move to. Two exclusions matter: `:disabled` only ever\n * matches a `<button>`, so an inert link is recognized by its `aria-disabled`\n * instead; and the final filter keeps only the items of THIS panel, since an open\n * submenu's items are DOM descendants of it and would otherwise join the list.\n */\nfunction items(): HTMLElement[] {\n const panel = panelEl.value\n if (!panel) return []\n return [\n ...panel.querySelectorAll<HTMLElement>(\n '[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])',\n ),\n ].filter((el) => el.closest('[role=\"menu\"]') === panel)\n}\n\n// @a11y\n/** Puts the focus on the first item the keyboard can reach, when the menu opens. */\nfunction focusFirst() {\n items()[0]?.focus()\n}\n\n// @a11y\n/**\n * Puts the focus on the panel itself, singling out no command. This is where a menu\n * opened with a pointer lands: the reader has not asked for a first choice, but the\n * keyboard still has to work from the very next keystroke — and every key below is\n * listened for on this element, so leaving the focus outside would silence all of them.\n */\nfunction focusPanel() {\n panelEl.value?.focus()\n}\n\n// @keyboard @a11y\nfunction onKeydown(event: KeyboardEvent) {\n const panel = panelEl.value\n // A keystroke inside a submenu passes through every panel containing it on its way\n // up, so only the panel the focused item DIRECTLY belongs to acts on it.\n if (!panel || (event.target as Element).closest('[role=\"menu\"]') !== panel) return\n\n if (event.key === 'Tab') {\n menu.closeAll()\n return\n }\n if (event.key === 'Escape' || (props.submenu && event.key === 'ArrowLeft')) {\n // Escape closes THIS level and no more. The `preventDefault` matters: left to\n // itself the browser would close the popover on its own, without handing the\n // focus back to the item that opened it — and our own hide() would already have\n // closed it anyway. At the top level, VMenu is what returns the focus to the\n // trigger.\n event.preventDefault()\n hide()\n if (props.submenu) menuInvoker(props.id)?.focus()\n return\n }\n // Coming from the panel itself — a menu opened with a pointer, where no command is\n // singled out — the up arrow goes to the LAST item, entering the list from its far\n // end the way a menu is expected to. `utils/arrowNav` starts any arrow at the\n // beginning when nothing in the list has the focus, which is the right answer for the\n // tabs, the pages and the toggle group it also serves: it is this menu that has a\n // convention of its own, so it is handled here rather than in the shared helper.\n // The case only exists BECAUSE of the pointer opening: reached from an item, the\n // arrow never lands here.\n if (event.key === 'ArrowUp' && document.activeElement === panel) {\n const list = items()\n if (list.length > 0) {\n event.preventDefault()\n list[list.length - 1]?.focus()\n return\n }\n }\n // The movement itself is the shared one from `utils/arrowNav`, but it is handed OUR\n // list rather than letting it discover the items: ours also drops the disabled\n // links and stays inside this panel, neither of which the generic selector does.\n arrowNavigate(event, panel, items, { vertical: true })\n}\n\n// The only thing set inline is an explicit width, when the prop asks for one.\nconst resolvedWidth = computed(() => cssSize(props.width) || undefined)\nconst panelStyle = computed(() =>\n resolvedWidth.value ? { '--menu-width': resolvedWidth.value } : undefined,\n)\n\n// Internal to VMenu, which drives the panel from outside: opening has to be synchronous,\n// and where the focus lands depends on whether a pointer or the keyboard asked.\ndefineExpose({\n /** Opens the panel. Pass the invoker, or the popover has no anchor to position against. */\n show,\n /** Closes it. */\n close: hide,\n /** Whether it is open, as the browser last reported it. VMenu's model is checked against it. */\n shown,\n /** Puts the focus on the first reachable item — the keyboard's way in. */\n focusFirst,\n /** Puts the focus on the panel itself — the pointer's way in, singling out no command. */\n focusPanel,\n /** The panel element, which is the popover. */\n el: panelEl,\n})\n</script>\n\n<template>\n <div\n :id=\"id\"\n ref=\"panelEl\"\n popover=\"auto\"\n role=\"menu\"\n tabindex=\"-1\"\n class=\"v-overlay v-panel v-menu v-floating\"\n :class=\"{\n /*\n * The size class goes on the ROOT panel only. It sets the whole `--control-*`\n * family — height, paddings, gap, type, icon context — and the submenus, being\n * DOM descendants, inherit every one of them.\n *\n * Adding it to the submenus as well would BREAK them: the class recomputes the\n * height from the base one without knowing about the compact attribute, which\n * submenus do not carry, so a compact menu's submenus would silently snap back\n * to full height.\n */\n 'v-control': !submenu,\n }\"\n :data-placement=\"placement\"\n :data-size=\"size\"\n :data-compact=\"compact ? '' : undefined\"\n :data-width=\"resolvedWidth ? '' : undefined\"\n :data-match-trigger=\"matchTrigger ? '' : undefined\"\n :style=\"panelStyle\"\n @beforetoggle=\"syncShown\"\n @toggle=\"onToggle\"\n @keydown=\"onKeydown\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /* The panel's surface, border, shadow and inner rhythm come from the shared\n `.v-panel` class, and its dimensions from the `v-control` class the template sets\n on the root panel — there is no size table here, the rows reading the inherited\n variables directly. Only what is specific to a dropdown menu stays below. */\n .v-menu {\n min-inline-size: var(--vectis-control-size-menu-min);\n max-inline-size: min(var(--vectis-control-size-menu-max), calc(100vw - var(--vectis-space-8)));\n }\n\n /* The panel is focusable, but only ever from code — its `tabindex` is -1, so the Tab\n key never brings anyone here. It holds the focus when the menu was opened with a\n pointer, and a ring drawn around the whole panel would then read as the reader\n having landed on something, which is the opposite of what that state means: no\n command is singled out. The rows keep their own highlight, `.v-menu-item:focus`. */\n .v-menu:focus {\n outline: none;\n }\n\n /* Pulls a submenu up so that its first item lines up with the item that opened it,\n by exactly the panel's own padding plus its border. */\n .v-menu .v-menu[data-placement='right-start'] {\n margin-block-start: calc(-1 * (var(--vectis-space-1) + 1px));\n }\n\n /* An explicit width, which only the ROOT panel ever renders: a submenu sets no such\n attribute, so the variable it inherits stays inert there. The ceiling that keeps\n a panel inside the viewport is untouched. */\n .v-menu[data-width] {\n min-inline-size: 0;\n inline-size: var(--menu-width);\n }\n\n /* The panel may not be narrower than its trigger. This works with no anchor name of\n any kind, because the button that opened the panel is already its implicit anchor\n — VCombobox and VTimeInput, anchored to a text input, have to name theirs. Like\n the width above, only the ROOT panel renders it.\n\n It is placed AFTER the width rule, at equal specificity, so that when both are\n given the floor wins. A trigger wider than the ceiling therefore widens the panel\n past it, a minimum width beating a maximum one — which is intended. */\n .v-menu[data-match-trigger] {\n min-inline-size: anchor-size(width);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DA,IAAM,IAAQ,GASR,IAAO,GAaP,IAAU,EAAwB,IAAI,GAGtC,EAAE,UAAO,cAAW,SAAM,YAAS,EAAW,CAAO,GAIrD,IAAO,EAAO,CAAO;EAE3B,SAAS,EAAS,GAAc;GAE9B,AADA,EAAU,CAAK,GACf,EAAK,UAAU,EAAM,KAAK;EAC5B;EASA,SAAS,IAAuB;GAC9B,IAAM,IAAQ,EAAQ;GAEtB,OADK,IACE,CACL,GAAG,EAAM,iBACP,kEACF,CACF,CAAC,CAAC,QAAQ,MAAO,EAAG,QAAQ,iBAAe,MAAM,CAAK,IALnC,CAAC;EAMtB;EAIA,SAAS,IAAa;GACpB,EAAM,CAAC,CAAC,EAAE,EAAE,MAAM;EACpB;EASA,SAAS,IAAa;GACpB,EAAQ,OAAO,MAAM;EACvB;EAGA,SAAS,EAAU,GAAsB;GACvC,IAAM,IAAQ,EAAQ;GAGlB,OAAC,KAAU,EAAM,OAAmB,QAAQ,iBAAe,MAAM,IAErE;QAAI,EAAM,QAAQ,OAAO;KACvB,EAAK,SAAS;KACd;IACF;IACA,IAAI,EAAM,QAAQ,YAAa,EAAM,WAAW,EAAM,QAAQ,aAAc;KAQ1E,AAFA,EAAM,eAAe,GACrB,EAAK,GACD,EAAM,WAAS,EAAY,EAAM,EAAE,CAAC,EAAE,MAAM;KAChD;IACF;IASA,IAAI,EAAM,QAAQ,aAAa,SAAS,kBAAkB,GAAO;KAC/D,IAAM,IAAO,EAAM;KACnB,IAAI,EAAK,SAAS,GAAG;MAEnB,AADA,EAAM,eAAe,GACrB,EAAK,EAAK,SAAS,EAAE,EAAE,MAAM;MAC7B;KACF;IACF;IAIA,EAAc,GAAO,GAAO,GAAO,EAAE,UAAU,GAAK,CAAC;GA/BrD;EAgCF;EAGA,IAAM,IAAgB,QAAe,EAAQ,EAAM,KAAK,KAAK,KAAA,CAAS,GAChE,IAAa,QACjB,EAAc,QAAQ,EAAE,gBAAgB,EAAc,MAAM,IAAI,KAAA,CAClE;SAIA,EAAa;GAEX;GAEA,OAAO;GAEP;GAEA;GAEA;GAEA,IAAI;EACN,CAAC,mBAIC,EA+BM,OAAA;GA9BH,IAAI,EAAA;YACD;GAAJ,KAAI;GACJ,SAAQ;GACR,MAAK;GACL,UAAS;GACT,OAAK,EAAA,CAAC,uCAAqC,EAAA,aAAA,CACygB,EAAA,QAAA,CAAA,CAAA;GAanjB,kBAAgB,EAAA;GAChB,aAAW,EAAA;GACX,gBAAc,EAAA,UAAO,KAAQ,KAAA;GAC7B,cAAY,EAAA,QAAa,KAAQ,KAAA;GACjC,sBAAoB,EAAA,eAAY,KAAQ,KAAA;GACxC,OAAK,EAAE,EAAA,KAAU;GACjB,gBAAY,AAAA,EAAA,QAAA,GAAA,MAAE,EAAA,CAAA,KAAA,EAAA,CAAA,CAAA,CAAA,GAAA,CAAA;GACN;GACC;MAEV,EAAQ,EAAA,QAAA,SAAA,CAAA,GAAA,IAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"VMenuPanel.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/VMenu/VMenuPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @a11y @keyboard @core\n/**\n * The panel a menu is drawn in. Internal to VMenu, and the same component serves both\n * levels — the root menu and every submenu.\n *\n * It rests on `popover=\"auto\"`, which gives it light dismiss, positioning against its\n * invoker, and — a submenu being rendered inside its parent panel — a native stack the\n * browser closes from the outside in. Its look comes from the shared `.v-panel`.\n *\n * It carries `tabindex=\"-1\"` so it can hold the focus itself, which it does whenever the\n * menu was opened by POINTER: no command is singled out, but the keyboard still has\n * somewhere to arrive, everything below being listened for on this element.\n *\n * The JS is the ARIA menu keyboard, which the platform does not provide:\n *\n * - arrows and Home/End move focus item to item, CONFINED to the panel the focus is in — a\n * keystroke inside a submenu also bubbles through every panel containing it, hence the\n * guard on where the event came from;\n * - Escape closes the CURRENT LEVEL only, as does ArrowLeft in a submenu, handing focus\n * back to the item that opened it;\n * - Tab closes the whole menu, a menu not being something one tabs through.\n */\n\nimport { computed, inject, ref } from 'vue'\n\nimport { usePopover } from '../../composables/usePopover'\nimport { menuInvoker, menuKey } from './context'\nimport type { MenuPanelPlacement, MenuSize } from './context'\nimport { arrowNavigate } from '../../utils/arrowNav'\nimport { isRtl } from '../../utils/direction'\nimport { cssSize } from '../../utils/css'\n\ninterface MenuPanelProps {\n /** The panel's id, set by whoever owns it. It is what the trigger points at. */\n id: string\n /** Where the panel opens relative to whatever opened it. */\n placement?: MenuPanelPlacement\n /**\n * Marks this panel as a submenu, which enables the left arrow as a way back and keeps\n * the row-height settings off it, so that it inherits its parent's instead.\n */\n submenu?: boolean\n /**\n * The row height, set by the ROOT panel only. Submenus receive no value and inherit\n * it through CSS instead.\n */\n size?: MenuSize\n /** The reduced density, again set by the ROOT panel only and inherited through CSS. */\n compact?: boolean\n /**\n * An explicit width, set by the ROOT panel only. Submenus render no width attribute\n * and keep the default one, so an inherited value cannot reach them.\n */\n width?: number | string\n /**\n * Stops the panel from being narrower than its trigger, set by the ROOT panel only:\n * a submenu's trigger is a menu item, not a control worth matching.\n */\n matchTrigger?: boolean\n}\n\nconst props = withDefaults(defineProps<MenuPanelProps>(), {\n placement: 'bottom-start',\n submenu: false,\n size: undefined,\n compact: false,\n width: undefined,\n matchTrigger: false,\n})\n\nconst emit = defineEmits<{\n /**\n * The panel opened or closed. It is reported by the browser, so it also covers a\n * dismissal nobody asked for in code.\n */\n toggle: [open: boolean]\n}>()\n\ndefineSlots<{\n /** The contents of the panel: VMenuItem, VMenuGroup and VMenuSeparator. */\n default(): unknown\n}>()\n\nconst panelEl = ref<HTMLElement | null>(null)\n// The open state, the guards keeping the calls idempotent, and the option that gives\n// a programmatically opened submenu its anchor, all live in usePopover.\nconst { shown, syncShown, show, hide } = usePopover(panelEl)\n\n// Never absent: this panel is internal, rendered only by VMenu and by the VMenuItems inside\n// one, and VMenu provides the key before either exists.\nconst menu = inject(menuKey)!\n\nfunction onToggle(event: Event) {\n syncShown(event)\n emit('toggle', shown.value)\n}\n\n// @a11y @keyboard\n/**\n * The items the keyboard may move to. Two exclusions matter: `:disabled` only ever\n * matches a `<button>`, so an inert link is recognized by its `aria-disabled`\n * instead; and the final filter keeps only the items of THIS panel, since an open\n * submenu's items are DOM descendants of it and would otherwise join the list.\n */\nfunction items(): HTMLElement[] {\n const panel = panelEl.value\n if (!panel) return []\n return [\n ...panel.querySelectorAll<HTMLElement>(\n '[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])',\n ),\n ].filter((el) => el.closest('[role=\"menu\"]') === panel)\n}\n\n// @a11y\n/** Puts the focus on the first item the keyboard can reach, when the menu opens. */\nfunction focusFirst() {\n items()[0]?.focus()\n}\n\n// @a11y\n/**\n * Puts the focus on the panel itself, singling out no command. This is where a menu\n * opened with a pointer lands: the reader has not asked for a first choice, but the\n * keyboard still has to work from the very next keystroke — and every key below is\n * listened for on this element, so leaving the focus outside would silence all of them.\n */\nfunction focusPanel() {\n panelEl.value?.focus()\n}\n\n// @keyboard @a11y\nfunction onKeydown(event: KeyboardEvent) {\n const panel = panelEl.value\n // A keystroke inside a submenu passes through every panel containing it on its way\n // up, so only the panel the focused item DIRECTLY belongs to acts on it.\n if (!panel || (event.target as Element).closest('[role=\"menu\"]') !== panel) return\n // A key held with a modifier is the browser's: Alt+Left is Back.\n if (event.altKey || event.ctrlKey || event.metaKey) return\n\n if (event.key === 'Tab') {\n menu.closeAll()\n return\n }\n // The arrow pointing BACK at the parent closes a submenu: the right one in a\n // right-to-left page, where the submenu opened on the left.\n const back = isRtl(panel) ? 'ArrowRight' : 'ArrowLeft'\n if (event.key === 'Escape' || (props.submenu && event.key === back)) {\n // Escape closes THIS level and no more. The `preventDefault` matters: left to\n // itself the browser would close the popover on its own, without handing the\n // focus back to the item that opened it — and our own hide() would already have\n // closed it anyway. At the top level, VMenu is what returns the focus to the\n // trigger.\n event.preventDefault()\n hide()\n if (props.submenu) menuInvoker(props.id)?.focus()\n return\n }\n // Coming from the panel itself — a menu opened with a pointer, where no command is\n // singled out — the up arrow goes to the LAST item, entering the list from its far\n // end the way a menu is expected to. `utils/arrowNav` starts any arrow at the\n // beginning when nothing in the list has the focus, which is the right answer for the\n // tabs, the pages and the toggle group it also serves: it is this menu that has a\n // convention of its own, so it is handled here rather than in the shared helper.\n // The case only exists BECAUSE of the pointer opening: reached from an item, the\n // arrow never lands here.\n if (event.key === 'ArrowUp' && document.activeElement === panel) {\n const list = items()\n if (list.length > 0) {\n event.preventDefault()\n list[list.length - 1]?.focus()\n return\n }\n }\n // The movement itself is the shared one from `utils/arrowNav`, but it is handed OUR\n // list rather than letting it discover the items: ours also drops the disabled\n // links and stays inside this panel, neither of which the generic selector does.\n arrowNavigate(event, panel, items, { vertical: true })\n}\n\n// The only thing set inline is an explicit width, when the prop asks for one.\nconst resolvedWidth = computed(() => cssSize(props.width) || undefined)\nconst panelStyle = computed(() =>\n resolvedWidth.value ? { '--menu-width': resolvedWidth.value } : undefined,\n)\n\n// Internal to VMenu, which drives the panel from outside: opening has to be synchronous,\n// and where the focus lands depends on whether a pointer or the keyboard asked.\ndefineExpose({\n /** Opens the panel. Pass the invoker, or the popover has no anchor to position against. */\n show,\n /** Closes it. */\n close: hide,\n /** Whether it is open, as the browser last reported it. VMenu's model is checked against it. */\n shown,\n /** Puts the focus on the first reachable item: the keyboard's way in. */\n focusFirst,\n /** Puts the focus on the panel itself: the pointer's way in, singling out no command. */\n focusPanel,\n /** The panel element, which is the popover. */\n el: panelEl,\n})\n</script>\n\n<template>\n <div\n :id=\"id\"\n ref=\"panelEl\"\n popover=\"auto\"\n role=\"menu\"\n tabindex=\"-1\"\n class=\"v-overlay v-panel v-menu v-floating\"\n :class=\"{\n /*\n * The size class goes on the ROOT panel only. It sets the whole `--control-*`\n * family — height, paddings, gap, type, icon context — and the submenus, being\n * DOM descendants, inherit every one of them.\n *\n * Adding it to the submenus as well would BREAK them: the class recomputes the\n * height from the base one without knowing about the compact attribute, which\n * submenus do not carry, so a compact menu's submenus would silently snap back\n * to full height.\n */\n 'v-control': !submenu,\n }\"\n :data-placement=\"placement\"\n :data-size=\"size\"\n :data-compact=\"compact ? '' : undefined\"\n :data-width=\"resolvedWidth ? '' : undefined\"\n :data-match-trigger=\"matchTrigger ? '' : undefined\"\n :style=\"panelStyle\"\n @beforetoggle=\"syncShown\"\n @toggle=\"onToggle\"\n @keydown=\"onKeydown\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /* The panel's surface, border, shadow and inner rhythm come from the shared\n `.v-panel` class, and its dimensions from the `v-control` class the template sets\n on the root panel — there is no size table here, the rows reading the inherited\n variables directly. Only what is specific to a dropdown menu stays below. */\n .v-menu {\n min-inline-size: var(--vectis-control-size-menu-min);\n max-inline-size: min(var(--vectis-control-size-menu-max), calc(100dvi - var(--vectis-space-8)));\n }\n\n /* The panel is focusable, but only ever from code — its `tabindex` is -1, so the Tab\n key never brings anyone here. It holds the focus when the menu was opened with a\n pointer, and a ring drawn around the whole panel would then read as the reader\n having landed on something, which is the opposite of what that state means: no\n command is singled out. The rows keep their own highlight, `.v-menu-item:focus`. */\n .v-menu:focus {\n outline: none;\n }\n\n /* Pulls a submenu up so that its first item lines up with the item that opened it,\n by exactly the panel's own padding plus its border. */\n .v-menu .v-menu[data-placement='right-start'] {\n margin-block-start: calc(-1 * (var(--vectis-space-1) + 1px));\n }\n\n /* An explicit width, which only the ROOT panel ever renders: a submenu sets no such\n attribute, so the variable it inherits stays inert there. The ceiling that keeps\n a panel inside the viewport is untouched. */\n .v-menu[data-width] {\n min-inline-size: 0;\n inline-size: var(--menu-width);\n }\n\n /* The panel may not be narrower than its trigger. This works with no anchor name of\n any kind, because the button that opened the panel is already its implicit anchor\n — VCombobox and VTimeInput, anchored to a text input, have to name theirs. Like\n the width above, only the ROOT panel renders it.\n\n It is placed AFTER the width rule, at equal specificity, so that when both are\n given the floor wins. A trigger wider than the ceiling therefore widens the panel\n past it, a minimum width beating a maximum one — which is intended. */\n .v-menu[data-match-trigger] {\n min-inline-size: anchor-size(width);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DA,IAAM,IAAQ,GASR,IAAO,GAaP,IAAU,EAAwB,IAAI,GAGtC,EAAE,UAAO,cAAW,SAAM,YAAS,EAAW,CAAO,GAIrD,IAAO,EAAO,CAAO;EAE3B,SAAS,EAAS,GAAc;GAE9B,AADA,EAAU,CAAK,GACf,EAAK,UAAU,EAAM,KAAK;EAC5B;EASA,SAAS,IAAuB;GAC9B,IAAM,IAAQ,EAAQ;GAEtB,OADK,IACE,CACL,GAAG,EAAM,iBACP,kEACF,CACF,CAAC,CAAC,QAAQ,MAAO,EAAG,QAAQ,iBAAe,MAAM,CAAK,IALnC,CAAC;EAMtB;EAIA,SAAS,IAAa;GACpB,EAAM,CAAC,CAAC,EAAE,EAAE,MAAM;EACpB;EASA,SAAS,IAAa;GACpB,EAAQ,OAAO,MAAM;EACvB;EAGA,SAAS,EAAU,GAAsB;GACvC,IAAM,IAAQ,EAAQ;GAKtB,IAFI,CAAC,KAAU,EAAM,OAAmB,QAAQ,iBAAe,MAAM,KAEjE,EAAM,UAAU,EAAM,WAAW,EAAM,SAAS;GAEpD,IAAI,EAAM,QAAQ,OAAO;IACvB,EAAK,SAAS;IACd;GACF;GAGA,IAAM,IAAO,EAAM,CAAK,IAAI,eAAe;GAC3C,IAAI,EAAM,QAAQ,YAAa,EAAM,WAAW,EAAM,QAAQ,GAAO;IAQnE,AAFA,EAAM,eAAe,GACrB,EAAK,GACD,EAAM,WAAS,EAAY,EAAM,EAAE,CAAC,EAAE,MAAM;IAChD;GACF;GASA,IAAI,EAAM,QAAQ,aAAa,SAAS,kBAAkB,GAAO;IAC/D,IAAM,IAAO,EAAM;IACnB,IAAI,EAAK,SAAS,GAAG;KAEnB,AADA,EAAM,eAAe,GACrB,EAAK,EAAK,SAAS,EAAE,EAAE,MAAM;KAC7B;IACF;GACF;GAIA,EAAc,GAAO,GAAO,GAAO,EAAE,UAAU,GAAK,CAAC;EACvD;EAGA,IAAM,IAAgB,QAAe,EAAQ,EAAM,KAAK,KAAK,KAAA,CAAS,GAChE,IAAa,QACjB,EAAc,QAAQ,EAAE,gBAAgB,EAAc,MAAM,IAAI,KAAA,CAClE;SAIA,EAAa;GAEX;GAEA,OAAO;GAEP;GAEA;GAEA;GAEA,IAAI;EACN,CAAC,mBAIC,EA+BM,OAAA;GA9BH,IAAI,EAAA;YACD;GAAJ,KAAI;GACJ,SAAQ;GACR,MAAK;GACL,UAAS;GACT,OAAK,EAAA,CAAC,uCAAqC,EAAA,aAAA,CACygB,EAAA,QAAA,CAAA,CAAA;GAanjB,kBAAgB,EAAA;GAChB,aAAW,EAAA;GACX,gBAAc,EAAA,UAAO,KAAQ,KAAA;GAC7B,cAAY,EAAA,QAAa,KAAQ,KAAA;GACjC,sBAAoB,EAAA,eAAY,KAAQ,KAAA;GACxC,OAAK,EAAE,EAAA,KAAU;GACjB,gBAAY,AAAA,EAAA,QAAA,GAAA,MAAE,EAAA,CAAA,KAAA,EAAA,CAAA,CAAA,CAAA,GAAA,CAAA;GACN;GACC;MAEV,EAAQ,EAAA,QAAA,SAAA,CAAA,GAAA,IAAA,CAAA"}
|
|
@@ -10,7 +10,7 @@ export declare const menuKey: InjectionKey<MenuContext>;
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const SUBMENU_HOVER_DELAY = 150;
|
|
12
12
|
/**
|
|
13
|
-
* Finds the element that opens a given panel
|
|
13
|
+
* Finds the element that opens a given panel. It is both what the panel positions
|
|
14
14
|
* itself against and where the focus must return when it closes.
|
|
15
15
|
*
|
|
16
16
|
* It is found by searching the document rather than kept as a reference, because the
|
|
@@ -21,7 +21,7 @@ export declare function menuInvoker(id: string): HTMLElement | null;
|
|
|
21
21
|
/** The height of the rows: 32, 40 or 48 pixels. This is public API. */
|
|
22
22
|
export type MenuSize = 'sm' | 'md' | 'lg';
|
|
23
23
|
/** Where the menu itself may open, relative to its trigger. This is public API. */
|
|
24
|
-
export type MenuPlacement = '
|
|
24
|
+
export type MenuPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
25
25
|
/**
|
|
26
26
|
* The same list plus the sideways placement submenus use. It is internal: a submenu's
|
|
27
27
|
* position is not the consumer's to choose.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../../src/components/VMenu/context.ts"],"sourcesContent":["/**\n * What the menu passes down to everything inside it. Choosing a command closes the\n * WHOLE menu, however deep in a submenu it was, and closing the outermost panel is\n * all it takes: the submenus are rendered inside it, and the browser closes a stack\n * of popovers from the outside in.\n */\n\nimport type { InjectionKey } from 'vue'\n\nexport interface MenuContext {\n closeAll: () => void\n}\n\nexport const menuKey: InjectionKey<MenuContext> = Symbol('v-menu')\n\n/**\n * How long the pointer must rest on an item before its submenu opens, and how long it\n * must stay away before it closes, in milliseconds. The wait is what stops every\n * panel crossed on the way elsewhere from flashing open.\n */\nexport const SUBMENU_HOVER_DELAY = 150\n\n// @a11y\n/**\n * Finds the element that opens a given panel
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../src/components/VMenu/context.ts"],"sourcesContent":["/**\n * What the menu passes down to everything inside it. Choosing a command closes the\n * WHOLE menu, however deep in a submenu it was, and closing the outermost panel is\n * all it takes: the submenus are rendered inside it, and the browser closes a stack\n * of popovers from the outside in.\n */\n\nimport type { InjectionKey } from 'vue'\n\nexport interface MenuContext {\n closeAll: () => void\n}\n\nexport const menuKey: InjectionKey<MenuContext> = Symbol('v-menu')\n\n/**\n * How long the pointer must rest on an item before its submenu opens, and how long it\n * must stay away before it closes, in milliseconds. The wait is what stops every\n * panel crossed on the way elsewhere from flashing open.\n */\nexport const SUBMENU_HOVER_DELAY = 150\n\n// @a11y\n/**\n * Finds the element that opens a given panel. It is both what the panel positions\n * itself against and where the focus must return when it closes.\n *\n * It is found by searching the document rather than kept as a reference, because the\n * outermost panel's trigger is rendered by the consumer, in a slot the panel has no\n * access to.\n */\nexport function menuInvoker(id: string): HTMLElement | null {\n // @fallback\n /*\n * The id is ESCAPED rather than cleaned up the way VTabs does it. There the id is\n * one we BUILD, so awkward characters can simply be dropped; here it is the panel's\n * real `id` attribute — a generated one, whose prefix the consumer can set through\n * `app.config.idPrefix` — and rewriting it would leave the selector looking for an\n * element that does not exist.\n *\n * Escaping the two characters able to close the quoted string is enough, and it is\n * deliberately NOT done with `CSS.escape`: jsdom provides no `CSS` object at all, so\n * that call would throw in every unit test.\n */\n return document.querySelector(`[popovertarget=\"${id.replace(/[\"\\\\]/g, '\\\\$&')}\"]`)\n}\n\n/** The height of the rows: 32, 40 or 48 pixels. This is public API. */\nexport type MenuSize = 'sm' | 'md' | 'lg'\n\n/** Where the menu itself may open, relative to its trigger. This is public API. */\nexport type MenuPlacement =\n 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'\n\n/**\n * The same list plus the sideways placement submenus use. It is internal: a submenu's\n * position is not the consumer's to choose.\n */\nexport type MenuPanelPlacement = MenuPlacement | 'right-start'\n"],"mappings":";AAaA,IAAa,IAAqC,OAAO,QAAQ;AAkBjE,SAAgB,EAAY,GAAgC;CAa1D,OAAO,SAAS,cAAc,mBAAmB,EAAG,QAAQ,UAAU,MAAM,EAAE,GAAG;AACnF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer vectis.reset, vectis.tokens, vectis.components, vectis.utilities;
|
|
2
|
-
@layer vectis.components{.v-pagination{display:flex}.v-pagination[data-responsive]{container:v-pagination/inline-size}.v-pagination[data-align=center]{justify-content:center}.v-pagination[data-align=end]{justify-content:flex-end}.v-pagination-page[data-size]{min-inline-size:var(--control-height);padding-inline:var(--vectis-space-2);transition:none}.v-pagination-ellipsis{cursor:default}@container v-pagination (
|
|
2
|
+
@layer vectis.components{.v-pagination{display:flex}.v-pagination[data-responsive]{container:v-pagination/inline-size}.v-pagination[data-align=center]{justify-content:center}.v-pagination[data-align=end]{justify-content:flex-end}.v-pagination-page[data-size]{min-inline-size:var(--control-height);padding-inline:var(--vectis-space-2);transition:none}.v-pagination-ellipsis[data-size]{cursor:default}@container v-pagination (inline-size<=36rem){.v-pagination[data-responsive] .v-pagination-page[data-distance="3"]{display:none}}@container v-pagination (inline-size<=31rem){.v-pagination[data-responsive] .v-pagination-page[data-distance="2"],.v-pagination[data-responsive][data-controls=both] .v-pagination-control-label{display:none}}@container v-pagination (inline-size<=25rem){.v-pagination[data-responsive] .v-pagination-page[data-distance="1"]{display:none}}.v-pagination[data-item-variant=outline]{--pagination-frame:var(--vectis-color-border-strong)}.v-pagination[data-item-variant=outline]>*>.v-pagination-page:is(:disabled,[aria-disabled=true]){--pagination-frame:var(--vectis-color-border)}.v-pagination[data-item-variant=outline]>*>.v-pagination-page[aria-current=page]:is([data-variant=soft],[data-variant=ghost]){border-color:var(--pagination-frame)}@media (forced-colors:active){.v-pagination-page.v-pagination-page.v-pagination-page.v-pagination-page[aria-current=page]:not(:disabled,[aria-disabled=true]){forced-color-adjust:none;color:highlighttext;background-color:highlight;border-color:highlight;outline-color:canvastext}}}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IconSource } from '../VIcon/types.js';
|
|
2
2
|
/** How the pages that are not the current one are drawn. */
|
|
3
3
|
export type PaginationItemVariant = 'ghost' | 'outline';
|
|
4
|
+
/** How the current page is drawn. */
|
|
5
|
+
export type PaginationSelectedVariant = 'solid' | 'soft' | 'ghost';
|
|
4
6
|
/** The colour of the current page. */
|
|
5
7
|
export type PaginationTone = 'accent' | 'neutral' | 'danger';
|
|
6
8
|
/** The height of the pills, from the scale every control shares. */
|
|
@@ -21,7 +23,7 @@ interface PaginationProps {
|
|
|
21
23
|
*/
|
|
22
24
|
length?: number;
|
|
23
25
|
/**
|
|
24
|
-
* How many slots to render, ellipses counted among them
|
|
26
|
+
* How many slots to render, ellipses counted among them, so the row keeps exactly
|
|
25
27
|
* the same width whichever page is current. Below five there would be nothing left
|
|
26
28
|
* to show around the current page, so five is the effective minimum. Left out, every
|
|
27
29
|
* page is rendered.
|
|
@@ -39,11 +41,16 @@ interface PaginationProps {
|
|
|
39
41
|
*/
|
|
40
42
|
seamless?: boolean;
|
|
41
43
|
/**
|
|
42
|
-
* How the pages OTHER than the current one, and the controls, are drawn.
|
|
43
|
-
*
|
|
44
|
+
* How the pages OTHER than the current one, and the controls, are drawn. What the current
|
|
45
|
+
* page takes is `selectedVariant`. It is named for the ITEMS because that is what it
|
|
44
46
|
* paints: on VTabs and VDataTable `variant` names the decoration of the frame instead.
|
|
45
47
|
*/
|
|
46
48
|
itemVariant?: PaginationItemVariant;
|
|
49
|
+
/**
|
|
50
|
+
* How the current page is drawn, in the row's tone: filled, tinted, or the colour of its
|
|
51
|
+
* text alone. The same choice as VToggle's `selectedVariant`.
|
|
52
|
+
*/
|
|
53
|
+
selectedVariant?: PaginationSelectedVariant;
|
|
47
54
|
/** The colour the current page takes. The other pages and the controls stay neutral. */
|
|
48
55
|
tone?: PaginationTone;
|
|
49
56
|
/** The height of the buttons, from the scale shared by every control. */
|
|
@@ -75,12 +82,12 @@ interface PaginationProps {
|
|
|
75
82
|
* The wording of the previous control, used both as its visible text and as what
|
|
76
83
|
* screen readers announce. It falls back to the design system dictionary.
|
|
77
84
|
*/
|
|
78
|
-
|
|
85
|
+
prevText?: string;
|
|
79
86
|
/**
|
|
80
87
|
* The wording of the next control, used both as its visible text and as what screen
|
|
81
88
|
* readers announce. It falls back to the design system dictionary.
|
|
82
89
|
*/
|
|
83
|
-
|
|
90
|
+
nextText?: string;
|
|
84
91
|
/** Makes the whole component unusable. */
|
|
85
92
|
disabled?: boolean;
|
|
86
93
|
/**
|
|
@@ -100,10 +107,16 @@ interface PaginationProps {
|
|
|
100
107
|
label?: string;
|
|
101
108
|
/**
|
|
102
109
|
* How a page is announced. A pill shows a bare number, which alone means nothing to
|
|
103
|
-
* a screen reader
|
|
110
|
+
* a screen reader: this is what turns it into "Page 3". It falls back to the design
|
|
104
111
|
* system dictionary.
|
|
105
112
|
*/
|
|
106
113
|
pageLabel?: (page: number) => string;
|
|
114
|
+
/**
|
|
115
|
+
* The address of a page. Given, every pill and both controls render as links, the
|
|
116
|
+
* previous and next ones carrying `rel="prev"` and `rel="next"`; a click still updates
|
|
117
|
+
* the model, then the browser follows the link. Left out, they are buttons.
|
|
118
|
+
*/
|
|
119
|
+
href?: (page: number) => string;
|
|
107
120
|
}
|
|
108
121
|
type __VLS_Props = PaginationProps;
|
|
109
122
|
type __VLS_ModelProps = {
|
|
@@ -111,9 +124,16 @@ type __VLS_ModelProps = {
|
|
|
111
124
|
modelValue?: number;
|
|
112
125
|
};
|
|
113
126
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
114
|
-
declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
127
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
128
|
+
/** Moves the focus to the current page, or to the first control that can take it. */
|
|
129
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
130
|
+
/** The `<nav>` element, which is also where the consumer's attributes land. */
|
|
131
|
+
el: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
132
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
133
|
+
navigate: (page: number, event: MouseEvent) => any;
|
|
115
134
|
"update:modelValue": (value: number) => any;
|
|
116
135
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
136
|
+
onNavigate?: ((page: number, event: MouseEvent) => any) | undefined;
|
|
117
137
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
118
138
|
}>, {
|
|
119
139
|
label: string;
|
|
@@ -122,17 +142,19 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
|
|
|
122
142
|
tone: PaginationTone;
|
|
123
143
|
elevated: boolean;
|
|
124
144
|
compact: boolean;
|
|
145
|
+
href: (page: number) => string;
|
|
125
146
|
disabled: boolean;
|
|
126
147
|
detached: boolean;
|
|
127
148
|
seamless: boolean;
|
|
128
149
|
totalVisible: number;
|
|
129
150
|
itemVariant: PaginationItemVariant;
|
|
151
|
+
selectedVariant: PaginationSelectedVariant;
|
|
130
152
|
align: PaginationAlign;
|
|
131
153
|
controls: PaginationControls;
|
|
132
154
|
prevIcon: IconSource;
|
|
133
155
|
nextIcon: IconSource;
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
prevText: string;
|
|
157
|
+
nextText: string;
|
|
136
158
|
disabledPages: PaginationMatcher;
|
|
137
159
|
responsive: boolean;
|
|
138
160
|
pageLabel: (page: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VPagination.js","names":[],"sources":["../../../src/components/VPagination/VPagination.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @core\n/**\n * The row of page numbers under a long list. Every pill is a VButton and the previous\n * and next controls are buttons too, so nothing about hovering, focusing or disabling\n * is written again here.\n *\n * A long list has more pages than fit on a line, and the row deals with that TWICE,\n * for two different reasons. First logically: `totalVisible` fixes how many slots are\n * rendered at all, and the pages that do not fit are replaced by an ellipsis — pure\n * arithmetic, identical on the server and in the browser. Then visually: as the space\n * actually available narrows, the neighbours of the current page are hidden one step\n * at a time, and that half is entirely CSS, the row asking about its own width rather\n * than being measured from code.\n *\n * The only behavioural JavaScript is the keyboard, explained where it is written.\n */\nimport { computed, h, ref } from 'vue'\nimport type { FunctionalComponent } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VButtonGroup from '../VButton/VButtonGroup.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport { more_horiz as moreHorizIcon } from '../VIcon/icons/more_horiz'\nimport type { IconSource } from '../VIcon/types'\nimport VIconButton from '../VIconButton/VIconButton.vue'\n\nimport { arrowNavigate, navigableItems } from '../../utils/arrowNav'\nimport { clamp } from '../../utils/number'\nimport { resolveMatcher } from '../../utils/matcher'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages } from '../../i18n/state'\n\n/** How the pages that are not the current one are drawn. */\nexport type PaginationItemVariant = 'ghost' | 'outline'\n\n/** The colour of the current page. */\nexport type PaginationTone = 'accent' | 'neutral' | 'danger'\n\n/** The height of the pills, from the scale every control shares. */\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\n/** Where the row sits in the width it is given. */\nexport type PaginationAlign = 'start' | 'center' | 'end'\n\n/** Whether the previous and next controls are rendered, and what they show. */\nexport type PaginationControls = false | 'icon' | 'text' | 'both'\n\n/**\n * Which pages cannot be reached, given either as a list of page numbers or as a function\n * answering that question for a page.\n */\nexport type PaginationMatcher = number[] | ((page: number) => boolean)\n\ninterface PaginationProps {\n /**\n * How many pages there are in all. It is 1 by default, which renders a single page: the\n * real count almost always has to be given.\n */\n length?: number\n /**\n * How many slots to render, ellipses counted among them — so the row keeps exactly\n * the same width whichever page is current. Below five there would be nothing left\n * to show around the current page, so five is the effective minimum. Left out, every\n * page is rendered.\n */\n totalVisible?: number\n\n /**\n * Separates the buttons instead of joining them into one segmented control. It is the\n * word VButtonGroup and VToggle use for the same question, in the same direction.\n */\n detached?: boolean\n /**\n * Takes the lines out from between the joined buttons, so the row reads as one frame rather\n * than as segments, on the terms of VButtonGroup's own `seamless`. It has no effect under\n * `detached`.\n */\n seamless?: boolean\n /**\n * How the pages OTHER than the current one, and the controls, are drawn. The current page\n * is always filled, whatever this says. It is named for the ITEMS because that is what it\n * paints: on VTabs and VDataTable `variant` names the decoration of the frame instead.\n */\n itemVariant?: PaginationItemVariant\n /** The colour the current page takes. The other pages and the controls stay neutral. */\n tone?: PaginationTone\n /** The height of the buttons, from the scale shared by every control. */\n size?: PaginationSize\n /** Takes 4px off the height of every button. */\n compact?: boolean\n /**\n * Raises the row off the page, on the terms of VButton's own `elevated`. Joined, the\n * shadow belongs to the ROW and not to each pill, which is what stops it falling into\n * the joints; detached, every button carries its own.\n */\n elevated?: boolean\n /**\n * Where the row sits in the space it is given. It only matters in responsive mode,\n * where the row takes the whole width available.\n */\n align?: PaginationAlign\n\n /**\n * The previous and next buttons on either side of the pages: what they show, or `false`\n * to leave them out. One prop rather than two, the shape VFilePicker's `preview` and\n * VCarousel's `controls` already use.\n */\n controls?: PaginationControls\n /** The icon of the previous control: an icon name, or an explicit render. */\n prevIcon?: IconSource\n /** The icon of the next control: an icon name, or an explicit render. */\n nextIcon?: IconSource\n /**\n * The wording of the previous control, used both as its visible text and as what\n * screen readers announce. It falls back to the design system dictionary.\n */\n prevLabel?: string\n /**\n * The wording of the next control, used both as its visible text and as what screen\n * readers announce. It falls back to the design system dictionary.\n */\n nextLabel?: string\n\n /** Makes the whole component unusable. */\n disabled?: boolean\n /**\n * Which pages cannot be reached, as a list or as a function. The previous and next\n * controls step OVER them rather than stopping at one.\n */\n disabledPages?: PaginationMatcher\n\n /**\n * Lets the row shed pages as the space narrows, by asking about its own width. It is\n * off by default, because it makes the row take the full width available.\n */\n responsive?: boolean\n\n /**\n * What screen readers announce for the navigation itself. It falls back to the\n * design system dictionary.\n */\n label?: string\n /**\n * How a page is announced. A pill shows a bare number, which alone means nothing to\n * a screen reader — this is what turns it into \"Page 3\". It falls back to the design\n * system dictionary.\n */\n pageLabel?: (page: number) => string\n}\n\nconst props = withDefaults(defineProps<PaginationProps>(), {\n length: 1,\n totalVisible: undefined,\n detached: false,\n seamless: false,\n itemVariant: 'ghost',\n tone: 'accent',\n size: 'md',\n compact: false,\n elevated: false,\n align: 'start',\n controls: 'icon',\n prevIcon: () => chevronLeftIcon,\n nextIcon: () => chevronRightIcon,\n prevLabel: undefined,\n nextLabel: undefined,\n disabled: false,\n disabledPages: undefined,\n responsive: false,\n label: undefined,\n pageLabel: undefined,\n})\n\n// The prop wins over the dictionary, and above both, a consumer's own aria-label or\n// aria-labelledby still wins — that arbitration is what `useAriaLabel` is for.\nconst m = useMessages()\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.pagination.label)\nconst resolvedPrevLabel = computed(() => props.prevLabel ?? m.value.pagination.previous)\nconst resolvedNextLabel = computed(() => props.nextLabel ?? m.value.pagination.next)\n\n/** The page being shown, counted from 1. It starts on the first. */\nconst page = defineModel<number>({ default: 1 })\n\n/** One slot in the row: either a page, or the ellipsis standing for those left out. */\ntype PaginationItem =\n | { kind: 'page'; key: string; page: number; edge: boolean; distance: number }\n | { kind: 'gap'; key: string }\n\nconst total = computed(() => Math.max(Math.trunc(props.length), 1))\nconst currentPage = computed(() => clamp(page.value, 1, total.value))\n\nconst isPageDisabled = computed(() => resolveMatcher(props.disabledPages))\n\n// @a11y — a pill shows nothing but a number, which on its own tells a screen reader\n// nothing at all; this is what has it announced as \"Page 3\".\nfunction pageLabelFor(n: number): string {\n return props.pageLabel ? props.pageLabel(n) : m.value.pagination.page(n)\n}\n\n/**\n * Works out which slots the row holds.\n *\n * The count is CONSTANT: `totalVisible` counts everything rendered, the ellipses\n * included, so the row never changes width as one moves through the pages. The window\n * of pages around the current one is centred on it, and near either end it SHIFTS\n * rather than shrinking — which is what keeps that count constant there too.\n *\n * Each page also carries how far it is from the current one. That distance is what the\n * responsive hiding sorts by, and it is capped at three: past that, the most distant\n * neighbours all disappear together at the first step.\n */\nconst items = computed<PaginationItem[]>(() => {\n const count = total.value\n const current = currentPage.value\n\n const pageItem = (n: number): PaginationItem => ({\n kind: 'page',\n key: `page-${n}`,\n page: n,\n edge: n === 1 || n === count,\n distance: Math.min(Math.abs(n - current), 3),\n })\n const pages = (from: number, to: number): PaginationItem[] => {\n const out: PaginationItem[] = []\n for (let n = from; n <= to; n++) out.push(pageItem(n))\n return out\n }\n // Keyed by the side it stands on, never by the page it follows: there is at most one\n // ellipsis per side, and the left one always comes after the first page while the right\n // one always comes before the last. A key derived from the window would change on every\n // navigation, so the right-hand ellipsis would be destroyed and rebuilt each time the\n // window slid, for a node that never changes.\n const gap = (side: 'start' | 'end'): PaginationItem => ({ kind: 'gap', key: `gap-${side}` })\n\n // With no limit given, nothing is left out. Below five slots there would be no room\n // for the first page, an ellipsis, the current page, another ellipsis and the last,\n // so that is the floor.\n const visible =\n props.totalVisible === undefined ? count : Math.max(Math.trunc(props.totalVisible), 5)\n if (visible >= count) return pages(1, count)\n\n const start = current - Math.floor((visible - 5) / 2)\n const end = start + (visible - 5)\n\n // Close to either end, an ellipsis on that side would stand for no missing page at\n // all. The window is stretched to the bound instead, which both avoids that and\n // keeps the number of slots exactly the same.\n if (start <= 3) return [...pages(1, visible - 2), gap('end'), pageItem(count)]\n if (end >= count - 2) return [pageItem(1), gap('start'), ...pages(count - visible + 3, count)]\n return [pageItem(1), gap('start'), ...pages(start, end), gap('end'), pageItem(count)]\n})\n\n/**\n * Where a control leads: the nearest page in that direction that can actually be\n * reached, disabled ones being stepped over rather than stopped at.\n *\n * Answering `undefined` means there is none left, which disables the control — and\n * that single answer also covers being on the first or the last page, with no separate\n * test for the ends.\n */\nfunction step(direction: -1 | 1): number | undefined {\n for (let n = currentPage.value + direction; n >= 1 && n <= total.value; n += direction) {\n if (!isPageDisabled.value(n)) return n\n }\n return undefined\n}\n\nconst prevTarget = computed(() => step(-1))\nconst nextTarget = computed(() => step(1))\nconst prevDisabled = computed(() => props.disabled || prevTarget.value === undefined)\nconst nextDisabled = computed(() => props.disabled || nextTarget.value === undefined)\n\nfunction goTo(n: number | undefined) {\n if (n === undefined) return\n page.value = clamp(n, 1, total.value)\n}\n\n/*\n * The previous and next controls, written ONCE: the two differ only by their direction, and\n * a pair of template blocks drifting apart on the next change is exactly what this avoids.\n * A functional component because the two sit at either end of the row, with the pages in\n * between, where a `v-for` over two descriptors could not put them.\n *\n * The icon goes on the side the control points to — before the word going back, after it\n * going forward — and every icon mirrors in a right-to-left page, an arrow pointing at a\n * physical direction.\n *\n * The control is named explicitly even though its label is visible: at narrow widths that\n * label is hidden and only the icon remains, and the name a screen reader announces has to\n * survive that.\n */\nconst PageControl: FunctionalComponent<{ side: 'prev' | 'next' }> = ({ side }) => {\n const prev = side === 'prev'\n const label = prev ? resolvedPrevLabel.value : resolvedNextLabel.value\n const icon = prev ? props.prevIcon : props.nextIcon\n const common = {\n class: 'v-pagination-control',\n variant: props.itemVariant,\n disabled: prev ? prevDisabled.value : nextDisabled.value,\n onClick: () => goTo(prev ? prevTarget.value : nextTarget.value),\n }\n const glyph = () => h(VIcon, { ...iconProps(icon), mirrored: true })\n if (props.controls === 'icon') return h(VIconButton, { ...common, label }, glyph)\n return h(\n VButton,\n { ...common, tone: 'neutral', 'aria-label': label },\n {\n ...(props.controls === 'both' ? { [prev ? 'start' : 'end']: glyph } : {}),\n default: () => h('span', { class: 'v-pagination-control-label' }, label),\n },\n )\n}\n\nconst navEl = ref<HTMLElement | null>(null)\n\n// @keyboard @a11y\n/**\n * The arrow keys, through the shared implementation in `utils/arrowNav`. Tab is left\n * alone: every visible pill remains a stop in the tab order, as in any list of links.\n *\n * The pills the responsive rules have hidden are left out by the helper, which skips\n * anything not displayed — so they cannot be focused into.\n */\nfunction onKeydown(event: KeyboardEvent) {\n const nav = navEl.value\n if (!nav) return\n arrowNavigate(event, nav, () => navigableItems(nav, '.v-pagination-page:not(:disabled)'))\n}\n</script>\n\n<template>\n <nav\n ref=\"navEl\"\n class=\"v-pagination\"\n :aria-label=\"ariaLabel\"\n :data-align=\"align\"\n :data-controls=\"controls || undefined\"\n :data-responsive=\"responsive ? '' : undefined\"\n @keydown=\"onKeydown\"\n >\n <!-- The row is a VButtonGroup either way: joined it merges the borders of its DIRECT\n button children, and detached it spaces them, which is all this prop asks of it.\n That is why there is no list markup wrapping the pills, and why the ellipsis is\n itself an inert button rather than a plain span: anything else between two pills\n would break the seam. -->\n <!--\n The size, the density and the elevation are handed to the GROUP, which gives them to\n every button inside, rather than repeated on each child. The elevation has to be there\n in any case, since that is where VButtonGroup draws it: joined, the row takes the shadow\n and the segments give theirs up, or it would fall into every joint.\n\n `|| undefined` keeps the group opinion-free when the row does not ask, `undefined`\n being what means \"no opinion\" there where `false` is an order. The size is always an\n opinion, the pagination having a default of its own.\n -->\n <VButtonGroup\n class=\"v-pagination-items\"\n :detached=\"detached\"\n :seamless=\"seamless\"\n :size=\"size\"\n :compact=\"compact || undefined\"\n :elevated=\"elevated || undefined\"\n >\n <PageControl v-if=\"controls\" side=\"prev\" />\n\n <template v-for=\"item in items\" :key=\"item.key\">\n <VButton\n v-if=\"item.kind === 'page'\"\n class=\"v-pagination-page\"\n :variant=\"item.page === currentPage ? 'solid' : itemVariant\"\n :tone=\"item.page === currentPage ? tone : 'neutral'\"\n :disabled=\"disabled || isPageDisabled(item.page)\"\n :aria-label=\"pageLabelFor(item.page)\"\n :aria-current=\"item.page === currentPage ? 'page' : undefined\"\n :data-edge=\"item.edge ? '' : undefined\"\n :data-distance=\"!item.edge && item.distance > 0 ? item.distance : undefined\"\n @click=\"goTo(item.page)\"\n >\n {{ item.page }}\n </VButton>\n <!-- The ellipsis is a disabled icon-only button rather than a span: being a button,\n it keeps the joined row's seam continuous and follows the size and density like\n everything else. Disabling it takes it out of the tab order, and it is hidden\n from screen readers, which have the page numbers themselves — which is also why\n it is a VButton and not a VIconButton, whose required label would name something\n nobody can reach. -->\n <VButton\n v-else\n class=\"v-pagination-ellipsis\"\n aria-hidden=\"true\"\n data-icon-only\n :variant=\"itemVariant\"\n tone=\"neutral\"\n disabled\n >\n <template #start>\n <VIcon :name=\"moreHorizIcon\" />\n </template>\n </VButton>\n </template>\n\n <PageControl v-if=\"controls\" side=\"next\" />\n </VButtonGroup>\n </nav>\n</template>\n\n<style>\n@layer vectis.components {\n .v-pagination {\n display: flex;\n }\n\n /*\n * Making the row a query container is reserved for responsive mode, since every\n * query below depends on it — and it is not free.\n *\n * A container of this kind computes its width WITHOUT looking at its content, so the\n * row has to be block-level: as an inline box it would measure zero and hide\n * everything at once. It therefore takes its parent's whole width, which is exactly\n * what makes the hiding follow the space the component was actually given, and what\n * obliges a flex parent to grant it one.\n *\n * Outside responsive mode the row keeps a width of its own and sits like any other\n * content. Either way the alignment is asked for explicitly and never inferred.\n */\n .v-pagination[data-responsive] {\n container-type: inline-size;\n container-name: v-pagination;\n }\n\n .v-pagination[data-align='center'] {\n justify-content: center;\n }\n\n .v-pagination[data-align='end'] {\n justify-content: flex-end;\n }\n\n /* Qualified by an attribute VButton always renders, which is what makes both of these\n beat that button's own padding and its own transition whatever order the two sheets\n end up in — the VIconButton idiom. */\n .v-pagination-page[data-size] {\n /* A one-digit pill is square, and widens by itself past that. The height variable\n is set by the shared size class on this very element, so this single rule covers\n all five sizes and their compact forms. */\n min-inline-size: var(--control-height);\n padding-inline: var(--vectis-space-2);\n\n /*\n * TRAP — the highlight changes instantly, and this must not be \"restored for\n * consistency\". VButton fades `background-color` over `--vectis-duration-fast`, which is\n * right for a button that stays put and wrong here: truncation SHIFTS its window, so from\n * one page to the next the highlight keeps its slot but changes ELEMENT, and the outgoing\n * and incoming pills are both half-tinted for a few frames — read as a flicker, with\n * nothing in the console.\n *\n * No duration avoids it: symmetric fades overlap, asymmetric ones leave either no\n * highlight or a trailing one. Keeping the fade for hover alone is not expressible\n * either — a transition resolves from the state being ENTERED, and \"no longer current\"\n * is the same state as \"no longer hovered\". So the hover fade goes too, on the pills\n * only; the controls never change active state and keep theirs.\n */\n transition: none;\n }\n\n /* The ellipsis is a disabled button only as a technical device; to the reader it is\n not a control that has been turned off, so it does not take the forbidden\n cursor. */\n .v-pagination-ellipsis {\n cursor: default;\n }\n\n /*\n * The responsive half of the truncation. The nav queries ITS OWN width, so the steps follow\n * the space the component was given rather than the viewport — a sidebar and a full-width\n * page behave differently, as they should, with nothing measured from code.\n *\n * The thresholds are rem LITERALS, a container query accepting no variables, and are\n * calibrated on `md`: a pill and a control are each 2.5rem plus a 0.25rem gutter, so\n * 2.75rem apiece — thirteen slots need ~35.5rem, eleven ~30, nine ~24.5, hence the three\n * with a little margin. The extremes (the largest size, five-digit page numbers) are what\n * `totalVisible` and `responsive: false` are for.\n *\n * Each threshold is the width NEEDED to show that level, never what remains after hiding:\n * written the other way round the row overflows for the whole interval before the next\n * step takes effect.\n *\n * The most distant neighbours go first. The edges and the current page carry no distance,\n * so no rule here can reach them. `display: none` also takes a hidden pill out of the tab\n * order and the a11y tree, which is intended. No ellipsis replaces one either — it is\n * exactly as wide as the pill it would stand for, so it frees nothing.\n */\n @container v-pagination (max-width: 36rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='3'] {\n display: none;\n }\n }\n\n @container v-pagination (max-width: 31rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='2'] {\n display: none;\n }\n\n /* A control showing both its icon and its label is about four times as wide as a\n pill, so dropping its label frees more room than sacrificing another page —\n which is why it happens before the last step. It is never done when the control\n shows text alone: there would be nothing left to click. */\n .v-pagination[data-responsive][data-controls='both'] .v-pagination-control-label {\n display: none;\n }\n }\n\n @container v-pagination (max-width: 25rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='1'] {\n display: none;\n }\n }\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"VPagination.js","names":[],"sources":["../../../src/components/VPagination/VPagination.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @core\n/**\n * The row of page numbers under a long list. Every pill is a VButton and the previous\n * and next controls are buttons too, so nothing about hovering, focusing or disabling\n * is written again here.\n *\n * A long list has more pages than fit on a line, and the row deals with that TWICE,\n * for two different reasons. First logically: `totalVisible` fixes how many slots are\n * rendered at all, and the pages that do not fit are replaced by an ellipsis — pure\n * arithmetic, identical on the server and in the browser. Then visually: as the space\n * actually available narrows, the neighbours of the current page are hidden one step\n * at a time, and that half is entirely CSS, the row asking about its own width rather\n * than being measured from code.\n *\n * Given `href`, every pill and both controls are links, so a list of products can be\n * paged by address: middle-clicked into a new tab, bookmarked, followed by a crawler.\n *\n * The only behavioural JavaScript is the keyboard, explained where it is written.\n */\nimport { computed, h, nextTick, ref } from 'vue'\nimport type { FunctionalComponent } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VButtonGroup from '../VButton/VButtonGroup.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport { more_horiz as moreHorizIcon } from '../VIcon/icons/more_horiz'\nimport type { IconSource } from '../VIcon/types'\nimport VIconButton from '../VIconButton/VIconButton.vue'\n\nimport { arrowNavigate, navigableItems } from '../../utils/arrowNav'\nimport { clamp } from '../../utils/number'\nimport { resolveMatcher } from '../../utils/matcher'\n\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages } from '../../i18n/state'\n\n/** How the pages that are not the current one are drawn. */\nexport type PaginationItemVariant = 'ghost' | 'outline'\n\n/** How the current page is drawn. */\nexport type PaginationSelectedVariant = 'solid' | 'soft' | 'ghost'\n\n/** The colour of the current page. */\nexport type PaginationTone = 'accent' | 'neutral' | 'danger'\n\n/** The height of the pills, from the scale every control shares. */\nexport type PaginationSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\n/** Where the row sits in the width it is given. */\nexport type PaginationAlign = 'start' | 'center' | 'end'\n\n/** Whether the previous and next controls are rendered, and what they show. */\nexport type PaginationControls = false | 'icon' | 'text' | 'both'\n\n/**\n * Which pages cannot be reached, given either as a list of page numbers or as a function\n * answering that question for a page.\n */\nexport type PaginationMatcher = number[] | ((page: number) => boolean)\n\ninterface PaginationProps {\n /**\n * How many pages there are in all. It is 1 by default, which renders a single page: the\n * real count almost always has to be given.\n */\n length?: number\n /**\n * How many slots to render, ellipses counted among them, so the row keeps exactly\n * the same width whichever page is current. Below five there would be nothing left\n * to show around the current page, so five is the effective minimum. Left out, every\n * page is rendered.\n */\n totalVisible?: number\n\n /**\n * Separates the buttons instead of joining them into one segmented control. It is the\n * word VButtonGroup and VToggle use for the same question, in the same direction.\n */\n detached?: boolean\n /**\n * Takes the lines out from between the joined buttons, so the row reads as one frame rather\n * than as segments, on the terms of VButtonGroup's own `seamless`. It has no effect under\n * `detached`.\n */\n seamless?: boolean\n /**\n * How the pages OTHER than the current one, and the controls, are drawn. What the current\n * page takes is `selectedVariant`. It is named for the ITEMS because that is what it\n * paints: on VTabs and VDataTable `variant` names the decoration of the frame instead.\n */\n itemVariant?: PaginationItemVariant\n /**\n * How the current page is drawn, in the row's tone: filled, tinted, or the colour of its\n * text alone. The same choice as VToggle's `selectedVariant`.\n */\n selectedVariant?: PaginationSelectedVariant\n /** The colour the current page takes. The other pages and the controls stay neutral. */\n tone?: PaginationTone\n /** The height of the buttons, from the scale shared by every control. */\n size?: PaginationSize\n /** Takes 4px off the height of every button. */\n compact?: boolean\n /**\n * Raises the row off the page, on the terms of VButton's own `elevated`. Joined, the\n * shadow belongs to the ROW and not to each pill, which is what stops it falling into\n * the joints; detached, every button carries its own.\n */\n elevated?: boolean\n /**\n * Where the row sits in the space it is given. It only matters in responsive mode,\n * where the row takes the whole width available.\n */\n align?: PaginationAlign\n\n /**\n * The previous and next buttons on either side of the pages: what they show, or `false`\n * to leave them out. One prop rather than two, the shape VFilePicker's `preview` and\n * VCarousel's `controls` already use.\n */\n controls?: PaginationControls\n /** The icon of the previous control: an icon name, or an explicit render. */\n prevIcon?: IconSource\n /** The icon of the next control: an icon name, or an explicit render. */\n nextIcon?: IconSource\n /**\n * The wording of the previous control, used both as its visible text and as what\n * screen readers announce. It falls back to the design system dictionary.\n */\n prevText?: string\n /**\n * The wording of the next control, used both as its visible text and as what screen\n * readers announce. It falls back to the design system dictionary.\n */\n nextText?: string\n\n /** Makes the whole component unusable. */\n disabled?: boolean\n /**\n * Which pages cannot be reached, as a list or as a function. The previous and next\n * controls step OVER them rather than stopping at one.\n */\n disabledPages?: PaginationMatcher\n\n /**\n * Lets the row shed pages as the space narrows, by asking about its own width. It is\n * off by default, because it makes the row take the full width available.\n */\n responsive?: boolean\n\n /**\n * What screen readers announce for the navigation itself. It falls back to the\n * design system dictionary.\n */\n label?: string\n /**\n * How a page is announced. A pill shows a bare number, which alone means nothing to\n * a screen reader: this is what turns it into \"Page 3\". It falls back to the design\n * system dictionary.\n */\n pageLabel?: (page: number) => string\n /**\n * The address of a page. Given, every pill and both controls render as links, the\n * previous and next ones carrying `rel=\"prev\"` and `rel=\"next\"`; a click still updates\n * the model, then the browser follows the link. Left out, they are buttons.\n */\n href?: (page: number) => string\n}\n\nconst props = withDefaults(defineProps<PaginationProps>(), {\n length: 1,\n totalVisible: undefined,\n detached: false,\n seamless: false,\n itemVariant: 'ghost',\n selectedVariant: 'solid',\n tone: 'accent',\n size: 'md',\n compact: false,\n elevated: false,\n align: 'start',\n controls: 'icon',\n prevIcon: () => chevronLeftIcon,\n nextIcon: () => chevronRightIcon,\n prevText: undefined,\n nextText: undefined,\n disabled: false,\n disabledPages: undefined,\n responsive: false,\n label: undefined,\n pageLabel: undefined,\n href: undefined,\n})\n\nconst emit = defineEmits<{\n /**\n * A page was chosen from the row, a pill or a control, with the click that chose it. It\n * comes before the model changes, so under `href` a single-page application calls\n * `preventDefault()` on the event and hands the address to its router instead of letting\n * the browser load it. A click that opens the link elsewhere (a modifier key held) is not\n * a choice made here and emits nothing.\n */\n navigate: [page: number, event: MouseEvent]\n}>()\n\n// The prop wins over the dictionary, and above both, a consumer's own aria-label or\n// aria-labelledby still wins — that arbitration is what `useAriaLabel` is for.\nconst m = useMessages()\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.pagination.label)\nconst resolvedPrevText = computed(() => props.prevText ?? m.value.pagination.previous)\nconst resolvedNextText = computed(() => props.nextText ?? m.value.pagination.next)\n\n/** The page being shown, counted from 1. It starts on the first. */\nconst page = defineModel<number>({ default: 1 })\n\n/** One slot in the row: either a page, or the ellipsis standing for those left out. */\ntype PaginationItem =\n | { kind: 'page'; key: string; page: number; edge: boolean; distance: number }\n | { kind: 'gap'; key: string }\n\n// A length or a model that is not a whole number (`NaN` while a page size is still loading,\n// a computed `2.5`) is brought back to a page that exists, or no pill would ever match it.\nconst total = computed(() => Math.max(Math.trunc(props.length) || 1, 1))\nconst currentPage = computed(() => clamp(Math.round(page.value) || 1, 1, total.value))\n\nconst isPageDisabled = computed(() => resolveMatcher(props.disabledPages))\n\n// @a11y\n// A pill shows nothing but a number, which on its own tells a screen reader\n// nothing at all; this is what has it announced as \"Page 3\".\nfunction pageLabelFor(n: number): string {\n return props.pageLabel ? props.pageLabel(n) : m.value.pagination.page(n)\n}\n\n/**\n * Works out which slots the row holds.\n *\n * The count is CONSTANT: `totalVisible` counts everything rendered, the ellipses\n * included, so the row never changes width as one moves through the pages. The window\n * of pages around the current one is centred on it, and near either end it SHIFTS\n * rather than shrinking — which is what keeps that count constant there too.\n *\n * Each page also carries how far it is from the current one. That distance is what the\n * responsive hiding sorts by, and it is capped at three: past that, the most distant\n * neighbours all disappear together at the first step.\n */\nconst items = computed<PaginationItem[]>(() => {\n const count = total.value\n const current = currentPage.value\n\n const pageItem = (n: number): PaginationItem => ({\n kind: 'page',\n key: `page-${n}`,\n page: n,\n edge: n === 1 || n === count,\n distance: Math.min(Math.abs(n - current), 3),\n })\n const pages = (from: number, to: number): PaginationItem[] => {\n const out: PaginationItem[] = []\n for (let n = from; n <= to; n++) out.push(pageItem(n))\n return out\n }\n // Keyed by the side it stands on, never by the page it follows: there is at most one\n // ellipsis per side, and the left one always comes after the first page while the right\n // one always comes before the last. A key derived from the window would change on every\n // navigation, so the right-hand ellipsis would be destroyed and rebuilt each time the\n // window slid, for a node that never changes.\n const gap = (side: 'start' | 'end'): PaginationItem => ({ kind: 'gap', key: `gap-${side}` })\n\n // With no limit given, nothing is left out. Below five slots there would be no room\n // for the first page, an ellipsis, the current page, another ellipsis and the last,\n // so that is the floor.\n const limit = Math.trunc(props.totalVisible ?? count)\n const visible = Number.isNaN(limit) ? count : Math.max(limit, 5)\n if (visible >= count) return pages(1, count)\n\n const start = current - Math.floor((visible - 5) / 2)\n const end = start + (visible - 5)\n\n // Close to either end, an ellipsis on that side would stand for no missing page at\n // all. The window is stretched to the bound instead, which both avoids that and\n // keeps the number of slots exactly the same.\n if (start <= 3) return [...pages(1, visible - 2), gap('end'), pageItem(count)]\n if (end >= count - 2) return [pageItem(1), gap('start'), ...pages(count - visible + 3, count)]\n return [pageItem(1), gap('start'), ...pages(start, end), gap('end'), pageItem(count)]\n})\n\n/**\n * Where a control leads: the nearest page in that direction that can actually be\n * reached, disabled ones being stepped over rather than stopped at.\n *\n * Answering `undefined` means there is none left, which disables the control — and\n * that single answer also covers being on the first or the last page, with no separate\n * test for the ends.\n */\nfunction step(direction: -1 | 1): number | undefined {\n for (let n = currentPage.value + direction; n >= 1 && n <= total.value; n += direction) {\n if (!isPageDisabled.value(n)) return n\n }\n return undefined\n}\n\nconst prevTarget = computed(() => step(-1))\nconst nextTarget = computed(() => step(1))\nconst prevDisabled = computed(() => props.disabled || prevTarget.value === undefined)\nconst nextDisabled = computed(() => props.disabled || nextTarget.value === undefined)\n\nfunction goTo(n: number | undefined) {\n if (n === undefined) return\n page.value = clamp(n, 1, total.value)\n}\n\n/** The address a pill or a control links to, or `undefined` when the row is made of buttons. */\nfunction hrefFor(n: number): string | undefined {\n return props.href?.(n)\n}\n\n// @core\n/*\n * A link clicked with a modifier held (Ctrl or Cmd for a new tab, Shift for a window, Alt for a\n * download) opens somewhere ELSE: the page on screen stays where it is, so the model must not\n * move. The test the routers themselves make before taking a click over.\n */\nfunction opensElsewhere(event: MouseEvent): boolean {\n return (\n props.href !== undefined &&\n (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)\n )\n}\n\nfunction choose(event: MouseEvent, n: number | undefined) {\n if (n === undefined || opensElsewhere(event)) return\n emit('navigate', n, event)\n goTo(n)\n}\n\n/** Whether a pill or a control can no longer be used: a disabled button, or an inert link. */\nfunction isUnusable(el: HTMLElement): boolean {\n return el.matches(':disabled, [aria-disabled=\"true\"]')\n}\n\n// @a11y\n/*\n * The previous and next controls disable themselves once no page is left in their direction,\n * and a focused button that becomes disabled hands the focus to <body>: a keyboard reader\n * pressing \"Next page\" on the second to last page would be sent back to the top of the\n * document by the next Tab. The focus goes to the page just reached instead, which is always\n * rendered, the current page being the one pill the responsive steps never hide.\n *\n * The focus is read BEFORE the change: a pointer click may not focus a button at all (Safari),\n * and a control that did not hold the focus has nothing to hand on.\n */\nasync function goFromControl(event: MouseEvent, n: number | undefined) {\n const control = event.currentTarget as HTMLElement\n const hadFocus = control === document.activeElement\n choose(event, n)\n if (!hadFocus) return\n await nextTick()\n if (isUnusable(control)) {\n navEl.value?.querySelector<HTMLElement>('[aria-current=\"page\"]')?.focus()\n }\n}\n\n/*\n * The previous and next controls, written ONCE: the two differ only by their direction, and\n * a pair of template blocks drifting apart on the next change is exactly what this avoids.\n * A functional component because the two sit at either end of the row, with the pages in\n * between, where a `v-for` over two descriptors could not put them.\n *\n * The icon goes on the side the control points to — before the word going back, after it\n * going forward — and every icon mirrors in a right-to-left page, an arrow pointing at a\n * physical direction.\n *\n * The control is named explicitly even though its label is visible: at narrow widths that\n * label is hidden and only the icon remains, and the name a screen reader announces has to\n * survive that.\n *\n * As a link it points at the page it leads to. With none left it still receives an address\n * (the current page's), which VButton drops once disabled: the control stays the same `<a>`,\n * turned inert, rather than swapping to a `<button>` under a focus `goFromControl` has to read.\n * The `rel` goes with the address, an inert link leading nowhere.\n */\nconst PageControl: FunctionalComponent<{ side: 'prev' | 'next' }> = ({ side }) => {\n const prev = side === 'prev'\n const label = prev ? resolvedPrevText.value : resolvedNextText.value\n const icon = prev ? props.prevIcon : props.nextIcon\n const target = prev ? prevTarget.value : nextTarget.value\n const disabled = prev ? prevDisabled.value : nextDisabled.value\n const common = {\n class: 'v-pagination-control',\n variant: props.itemVariant,\n disabled,\n href: hrefFor(target ?? currentPage.value),\n rel: props.href && !disabled ? side : undefined,\n onClick: (event: MouseEvent) => goFromControl(event, target),\n }\n const glyph = () => h(VIcon, { ...iconProps(icon), mirrored: true })\n if (props.controls === 'icon') return h(VIconButton, { ...common, label }, glyph)\n return h(\n VButton,\n { ...common, tone: 'neutral', 'aria-label': label },\n {\n ...(props.controls === 'both' ? { [prev ? 'start' : 'end']: glyph } : {}),\n default: () => h('span', { class: 'v-pagination-control-label' }, label),\n },\n )\n}\n\nconst navEl = ref<HTMLElement | null>(null)\n\n// @keyboard @a11y\n/**\n * The arrow keys, through the shared implementation in `utils/arrowNav`. Tab is left\n * alone: every visible pill remains a stop in the tab order, as in any list of links.\n *\n * The pills the responsive rules have hidden are left out by the helper, which skips\n * anything not displayed — so they cannot be focused into.\n */\nfunction onKeydown(event: KeyboardEvent) {\n const nav = navEl.value\n if (!nav) return\n arrowNavigate(event, nav, () =>\n navigableItems(nav, '.v-pagination-page:not(:disabled, [aria-disabled=\"true\"])'),\n )\n}\n\n// The pills are rendered by a VButtonGroup inside the nav, so a template ref reaches none of\n// them. `focus` goes to the current page, which every responsive step keeps on screen.\ndefineExpose({\n // Two queries, not one selector list: a list matches in DOM order, which would hand the\n // focus to the previous control ahead of the current page. `a[href]` because an inert link\n // has lost its address, and with it the ability to take the focus.\n /** Moves the focus to the current page, or to the first control that can take it. */\n focus: (options?: FocusOptions) =>\n (\n navEl.value?.querySelector<HTMLElement>(\n '[aria-current=\"page\"]:is(button, a[href]):not(:disabled)',\n ) ?? navEl.value?.querySelector<HTMLElement>(':is(button, a[href]):not(:disabled)')\n )?.focus(options),\n /** The `<nav>` element, which is also where the consumer's attributes land. */\n el: navEl,\n})\n</script>\n\n<template>\n <nav\n ref=\"navEl\"\n class=\"v-pagination\"\n :aria-label=\"ariaLabel\"\n :data-align=\"align\"\n :data-item-variant=\"itemVariant\"\n :data-controls=\"controls || undefined\"\n :data-responsive=\"responsive ? '' : undefined\"\n @keydown=\"onKeydown\"\n >\n <!-- The row is a VButtonGroup either way: joined it merges the borders of its DIRECT\n button children, and detached it spaces them, which is all this prop asks of it.\n That is why there is no list markup wrapping the pills, and why the ellipsis is\n itself an inert button rather than a plain span: anything else between two pills\n would break the seam. -->\n <!--\n The size, the density and the elevation are handed to the GROUP, which gives them to\n every button inside, rather than repeated on each child. The elevation has to be there\n in any case, since that is where VButtonGroup draws it: joined, the row takes the shadow\n and the segments give theirs up, or it would fall into every joint.\n\n `|| undefined` keeps the group opinion-free when the row does not ask, `undefined`\n being what means \"no opinion\" there where `false` is an order. The size is always an\n opinion, the pagination having a default of its own.\n -->\n <VButtonGroup\n class=\"v-pagination-items\"\n :detached=\"detached\"\n :seamless=\"seamless\"\n :size=\"size\"\n :compact=\"compact || undefined\"\n :elevated=\"elevated || undefined\"\n >\n <PageControl v-if=\"controls\" side=\"prev\" />\n\n <template v-for=\"item in items\" :key=\"item.key\">\n <VButton\n v-if=\"item.kind === 'page'\"\n class=\"v-pagination-page\"\n :variant=\"item.page === currentPage ? selectedVariant : itemVariant\"\n :tone=\"item.page === currentPage ? tone : 'neutral'\"\n :disabled=\"disabled || isPageDisabled(item.page)\"\n :aria-label=\"pageLabelFor(item.page)\"\n :aria-current=\"item.page === currentPage ? 'page' : undefined\"\n :href=\"hrefFor(item.page)\"\n :data-edge=\"item.edge ? '' : undefined\"\n :data-distance=\"!item.edge && item.distance > 0 ? item.distance : undefined\"\n @click=\"choose($event, item.page)\"\n >\n {{ item.page }}\n </VButton>\n <!-- The ellipsis is a disabled icon-only button rather than a span: being a button,\n it keeps the joined row's seam continuous and follows the size and density like\n everything else. Disabling it takes it out of the tab order, and it is hidden\n from screen readers, which have the page numbers themselves — which is also why\n it is a VButton and not a VIconButton, whose required label would name something\n nobody can reach. -->\n <VButton\n v-else\n class=\"v-pagination-ellipsis\"\n aria-hidden=\"true\"\n data-icon-only\n :variant=\"itemVariant\"\n tone=\"neutral\"\n disabled\n >\n <template #start>\n <VIcon :name=\"moreHorizIcon\" />\n </template>\n </VButton>\n </template>\n\n <PageControl v-if=\"controls\" side=\"next\" />\n </VButtonGroup>\n </nav>\n</template>\n\n<style>\n@layer vectis.components {\n .v-pagination {\n display: flex;\n }\n\n /*\n * Making the row a query container is reserved for responsive mode, since every\n * query below depends on it — and it is not free.\n *\n * A container of this kind computes its width WITHOUT looking at its content, so the\n * row has to be block-level: as an inline box it would measure zero and hide\n * everything at once. It therefore takes its parent's whole width, which is exactly\n * what makes the hiding follow the space the component was actually given, and what\n * obliges a flex parent to grant it one.\n *\n * Outside responsive mode the row keeps a width of its own and sits like any other\n * content. Either way the alignment is asked for explicitly and never inferred.\n */\n .v-pagination[data-responsive] {\n container-type: inline-size;\n container-name: v-pagination;\n }\n\n .v-pagination[data-align='center'] {\n justify-content: center;\n }\n\n .v-pagination[data-align='end'] {\n justify-content: flex-end;\n }\n\n /* Qualified by an attribute VButton always renders, which is what makes both of these\n beat that button's own padding and its own transition whatever order the two sheets\n end up in — the VIconButton idiom. */\n .v-pagination-page[data-size] {\n /* A one-digit pill is square, and widens by itself past that. The height variable\n is set by the shared size class on this very element, so this single rule covers\n all five sizes and their compact forms. */\n min-inline-size: var(--control-height);\n padding-inline: var(--vectis-space-2);\n\n /*\n * TRAP — the highlight changes instantly, and this must not be \"restored for\n * consistency\". VButton fades `background-color` over `--vectis-duration-fast`, which is\n * right for a button that stays put and wrong here: truncation SHIFTS its window, so from\n * one page to the next the highlight keeps its slot but changes ELEMENT, and the outgoing\n * and incoming pills are both half-tinted for a few frames — read as a flicker, with\n * nothing in the console.\n *\n * No duration avoids it: symmetric fades overlap, asymmetric ones leave either no\n * highlight or a trailing one. Keeping the fade for hover alone is not expressible\n * either — a transition resolves from the state being ENTERED, and \"no longer current\"\n * is the same state as \"no longer hovered\". So the hover fade goes too, on the pills\n * only; the controls never change active state and keep theirs.\n */\n transition: none;\n }\n\n /* The ellipsis is a disabled button only as a technical device; to the reader it is\n not a control that has been turned off, so it does not take the forbidden\n cursor. Qualified like the pills: VButton's disabled cursor weighs (0,2,0), and a bare\n class loses to it whatever the sheet order. */\n .v-pagination-ellipsis[data-size] {\n cursor: default;\n }\n\n /*\n * The responsive half of the truncation. The nav queries ITS OWN width, so the steps follow\n * the space the component was given rather than the viewport — a sidebar and a full-width\n * page behave differently, as they should, with nothing measured from code.\n *\n * The thresholds are rem LITERALS, a container query accepting no variables, and are\n * calibrated on `md`: a pill and a control are each 2.5rem plus a 0.25rem gutter, so\n * 2.75rem apiece — thirteen slots need ~35.5rem, eleven ~30, nine ~24.5, hence the three\n * with a little margin. The extremes (the largest size, five-digit page numbers) are what\n * `totalVisible` and `responsive: false` are for.\n *\n * Each threshold is the width NEEDED to show that level, never what remains after hiding:\n * written the other way round the row overflows for the whole interval before the next\n * step takes effect.\n *\n * The most distant neighbours go first. The edges and the current page carry no distance,\n * so no rule here can reach them. `display: none` also takes a hidden pill out of the tab\n * order and the a11y tree, which is intended. No ellipsis replaces one either — it is\n * exactly as wide as the pill it would stand for, so it frees nothing.\n */\n @container v-pagination (max-inline-size: 36rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='3'] {\n display: none;\n }\n }\n\n @container v-pagination (max-inline-size: 31rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='2'] {\n display: none;\n }\n\n /* A control showing both its icon and its label is about four times as wide as a\n pill, so dropping its label frees more room than sacrificing another page —\n which is why it happens before the last step. It is never done when the control\n shows text alone: there would be nothing left to click. */\n .v-pagination[data-responsive][data-controls='both'] .v-pagination-control-label {\n display: none;\n }\n }\n\n @container v-pagination (max-inline-size: 25rem) {\n .v-pagination[data-responsive] .v-pagination-page[data-distance='1'] {\n display: none;\n }\n }\n\n /*\n * The frame of an `outline` row: the colour its other pages already paint. They are drawn\n * in the NEUTRAL tone, so this is what their `--tone-border-soft` resolves to; naming that\n * variable here instead would read the CURRENT page's tone and tint one segment of the\n * frame accent or red. A disabled page greys its outline to a different token, hence a\n * variable the second rule changes. VToggle's `--toggle-frame` is the same device.\n *\n * `soft` and `ghost` leave VButton's border transparent, which in an outline row opens a\n * gap in the frame for the whole width of the current page (the `SelectedVariants` play\n * function). Restoring it on all four sides keeps the frame closed wherever the current\n * page sits; seamless, the shared edges are cleared again by VButtonGroup's own (0,6,0)\n * rules, which these (0,5,0) ones stay below.\n */\n .v-pagination[data-item-variant='outline'] {\n --pagination-frame: var(--vectis-color-border-strong);\n }\n\n .v-pagination[data-item-variant='outline']\n > *\n > .v-pagination-page:is(:disabled, [aria-disabled='true']) {\n --pagination-frame: var(--vectis-color-border);\n }\n\n .v-pagination[data-item-variant='outline']\n > *\n > .v-pagination-page[aria-current='page']:is([data-variant='soft'], [data-variant='ghost']) {\n border-color: var(--pagination-frame);\n }\n\n /*\n * Windows forced colors replace every background with the page's, so the current page would look\n * exactly like the others there: the fill is its only cue, the state being in an ARIA\n * attribute a sighted reader never sees. It takes the system's own selection pair\n * instead, and opts out of the forcing for that element alone so the pair is painted.\n *\n * TRAP — the class is repeated to reach (0,6,0). The variant, hover and active rules\n * reach (0,5,0), and with the forcing turned off any of them that still won would paint\n * its tone over the selection, with HighlightText on top of it.\n */\n @media (forced-colors: active) {\n .v-pagination-page.v-pagination-page.v-pagination-page.v-pagination-page[aria-current='page']:not(\n :disabled,\n [aria-disabled='true']\n ) {\n forced-color-adjust: none;\n background-color: Highlight;\n color: HighlightText;\n border-color: Highlight;\n outline-color: CanvasText;\n }\n }\n}\n</style>\n"],"mappings":""}
|