@hina-ui/vue 1.7.11 → 1.7.13
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 +1 -1
- package/dist/index.js +25614 -10189
- package/dist/index.js.map +1 -1
- package/dist/shared/lib/css-time.ts +6 -0
- package/dist/shared/lib/line-clamp.ts +8 -8
- package/dist/shared/lib/tour.ts +261 -0
- package/dist/shared/locale/en-US.ts +8 -0
- package/dist/shared/locale/index.ts +1 -0
- package/dist/shared/locale/ja-JP.ts +9 -0
- package/dist/shared/locale/types.ts +8 -0
- package/dist/shared/locale/zh-CN.ts +8 -0
- package/dist/shared/primitives/combobox/LICENSE +44 -0
- package/dist/shared/primitives/combobox/index.ts +49 -0
- package/dist/shared/primitives/date/calendar-view.ts +264 -0
- package/dist/shared/primitives/date/calendar.ts +126 -0
- package/dist/shared/primitives/date/comparators.ts +144 -0
- package/dist/shared/primitives/date/field.ts +551 -0
- package/dist/shared/primitives/date/formatter.ts +110 -0
- package/dist/shared/primitives/date/parser.ts +182 -0
- package/dist/shared/primitives/date/parts.ts +16 -0
- package/dist/shared/primitives/date/picker-view.ts +186 -0
- package/dist/shared/primitives/date/placeholders.ts +485 -0
- package/dist/shared/primitives/date/range-calendar-view.ts +181 -0
- package/dist/shared/primitives/date/segment.ts +44 -0
- package/dist/shared/primitives/date/utils.ts +169 -0
- package/dist/shared/primitives/dialog/LICENSE +21 -0
- package/dist/shared/primitives/dialog/index.ts +73 -0
- package/dist/shared/primitives/grace-area/LICENSE +21 -0
- package/dist/shared/primitives/grace-area/index.ts +112 -0
- package/dist/shared/primitives/listbox/LICENSE +21 -0
- package/dist/shared/primitives/listbox/index.ts +213 -0
- package/dist/shared/primitives/menu/LICENSE +21 -0
- package/dist/shared/primitives/menu/index.ts +66 -0
- package/dist/shared/primitives/navigation-menu/LICENSE +44 -0
- package/dist/shared/primitives/navigation-menu/index.ts +125 -0
- package/dist/shared/primitives/pin-input/index.ts +394 -97
- package/dist/shared/primitives/popper/LICENSE +21 -0
- package/dist/shared/primitives/popper/index.ts +246 -0
- package/dist/shared/primitives/select/index.ts +98 -0
- package/dist/shared/primitives/tags-input/LICENSE +21 -0
- package/dist/shared/primitives/tags-input/index.ts +113 -0
- package/dist/shared/primitives/toast/LICENSE +44 -0
- package/dist/shared/primitives/toast/index.ts +106 -0
- package/dist/shared/primitives/tree/LICENSE +21 -0
- package/dist/shared/primitives/tree/index.ts +248 -0
- package/dist/shared/styles/interaction.css +6 -2
- package/dist/shared/styles/line-clamp.css +6 -2
- package/dist/shared/styles/pin-input.css +84 -0
- package/dist/shared/styles/tokens.css +2 -0
- package/dist/shared/styles/tour.css +29 -0
- package/dist/shared/variants/nav-link.ts +6 -2
- package/dist/shared/variants/pin-input.ts +26 -7
- package/dist/shared/variants/tour.ts +29 -0
- package/dist/types/shared/src/lib/css-time.d.ts +2 -0
- package/dist/types/shared/src/lib/css-time.d.ts.map +1 -0
- package/dist/types/shared/src/lib/line-clamp.d.ts.map +1 -1
- package/dist/types/shared/src/lib/tour.d.ts +81 -0
- package/dist/types/shared/src/lib/tour.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/filter.d.ts +6 -0
- package/dist/types/shared/src/lib/virtual/filter.d.ts.map +1 -0
- package/dist/types/shared/src/locale/en-US.d.ts.map +1 -1
- package/dist/types/shared/src/locale/index.d.ts.map +1 -1
- package/dist/types/shared/src/locale/ja-JP.d.ts.map +1 -1
- package/dist/types/shared/src/locale/types.d.ts +8 -0
- package/dist/types/shared/src/locale/types.d.ts.map +1 -1
- package/dist/types/shared/src/locale/zh-CN.d.ts.map +1 -1
- package/dist/types/shared/src/primitives/body-scroll-lock/index.d.ts +10 -0
- package/dist/types/shared/src/primitives/body-scroll-lock/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/collapsible/index.d.ts +1 -1
- package/dist/types/shared/src/primitives/combobox/index.d.ts +9 -0
- package/dist/types/shared/src/primitives/combobox/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/calendar-view.d.ts +53 -0
- package/dist/types/shared/src/primitives/date/calendar-view.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/calendar.d.ts +39 -0
- package/dist/types/shared/src/primitives/date/calendar.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/comparators.d.ts +31 -0
- package/dist/types/shared/src/primitives/date/comparators.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/field.d.ts +46 -0
- package/dist/types/shared/src/primitives/date/field.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/formatter.d.ts +20 -0
- package/dist/types/shared/src/primitives/date/formatter.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/parser.d.ts +49 -0
- package/dist/types/shared/src/primitives/date/parser.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/parts.d.ts +10 -0
- package/dist/types/shared/src/primitives/date/parts.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/picker-view.d.ts +34 -0
- package/dist/types/shared/src/primitives/date/picker-view.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/placeholders.d.ts +2 -0
- package/dist/types/shared/src/primitives/date/placeholders.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/range-calendar-view.d.ts +67 -0
- package/dist/types/shared/src/primitives/date/range-calendar-view.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/segment.d.ts +6 -0
- package/dist/types/shared/src/primitives/date/segment.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/date/utils.d.ts +37 -0
- package/dist/types/shared/src/primitives/date/utils.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/dialog/index.d.ts +32 -0
- package/dist/types/shared/src/primitives/dialog/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/focus-guards/index.d.ts +2 -0
- package/dist/types/shared/src/primitives/focus-guards/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/grace-area/index.d.ts +13 -0
- package/dist/types/shared/src/primitives/grace-area/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/listbox/index.d.ts +55 -0
- package/dist/types/shared/src/primitives/listbox/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/menu/index.d.ts +35 -0
- package/dist/types/shared/src/primitives/menu/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/navigation-menu/index.d.ts +23 -0
- package/dist/types/shared/src/primitives/navigation-menu/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/pin-input/index.d.ts +35 -27
- package/dist/types/shared/src/primitives/pin-input/index.d.ts.map +1 -1
- package/dist/types/shared/src/primitives/popper/index.d.ts +83 -0
- package/dist/types/shared/src/primitives/popper/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/select/index.d.ts +24 -0
- package/dist/types/shared/src/primitives/select/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/tags-input/index.d.ts +36 -0
- package/dist/types/shared/src/primitives/tags-input/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/toast/index.d.ts +42 -0
- package/dist/types/shared/src/primitives/toast/index.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/tree/index.d.ts +72 -0
- package/dist/types/shared/src/primitives/tree/index.d.ts.map +1 -0
- package/dist/types/shared/src/variants/nav-link.d.ts +2 -1
- package/dist/types/shared/src/variants/nav-link.d.ts.map +1 -1
- package/dist/types/shared/src/variants/pin-input.d.ts +30 -10
- package/dist/types/shared/src/variants/pin-input.d.ts.map +1 -1
- package/dist/types/shared/src/variants/tour.d.ts +10 -0
- package/dist/types/shared/src/variants/tour.d.ts.map +1 -0
- package/dist/types/vue/src/components/app-shell/AppShell.vue.d.ts +6 -6
- package/dist/types/vue/src/components/button/Button.vue.d.ts +1 -1
- package/dist/types/vue/src/components/button/Button.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/calendar/Calendar.vue.d.ts +1 -1
- package/dist/types/vue/src/components/calendar/Calendar.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/carousel/composables/useCarousel.d.ts +1 -1
- package/dist/types/vue/src/components/combobox/Combobox.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/CommandPalettePanel.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/config-provider/ConfigProvider.vue.d.ts +20 -0
- package/dist/types/vue/src/components/config-provider/ConfigProvider.vue.d.ts.map +1 -0
- package/dist/types/vue/src/components/config-provider/types.d.ts +10 -0
- package/dist/types/vue/src/components/config-provider/types.d.ts.map +1 -0
- package/dist/types/vue/src/components/config-provider/useConfig.d.ts +2 -0
- package/dist/types/vue/src/components/config-provider/useConfig.d.ts.map +1 -0
- package/dist/types/vue/src/components/date-range-field/DateRangeField.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/date-time-picker/DateTimePicker.vue.d.ts +1 -1
- package/dist/types/vue/src/components/date-time-picker/DateTimePicker.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/dialog/ModalContent.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/dropdown-menu/DropdownMenu.vue.d.ts +20 -8
- package/dist/types/vue/src/components/dropdown-menu/DropdownMenu.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/float-button/FloatButton.vue.d.ts +2 -2
- package/dist/types/vue/src/components/hover-card/HoverCard.vue.d.ts +1 -1
- package/dist/types/vue/src/components/hover-card/HoverCard.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/icon-button/IconButton.vue.d.ts +2 -2
- package/dist/types/vue/src/components/icon-button/IconButton.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/image/Image.vue.d.ts +1 -1
- package/dist/types/vue/src/components/image/Image.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/image/composables/useImage.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/Lightbox.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/menubar/MenubarMenu.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/menubar/MenubarSub.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/month-grid/MonthGrid.vue.d.ts +1 -1
- package/dist/types/vue/src/components/multi-combobox/MultiCombobox.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/nav-link/NavLink.vue.d.ts +5 -10
- package/dist/types/vue/src/components/nav-link/NavLink.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/nav-link/NavLinkChild.d.ts +8 -0
- package/dist/types/vue/src/components/nav-link/NavLinkChild.d.ts.map +1 -1
- package/dist/types/vue/src/components/navigation-menu/NavigationMenu.vue.d.ts +2 -2
- package/dist/types/vue/src/components/navigation-menu/NavigationMenu.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/navigation-menu/NavigationMenuContent.vue.d.ts +6 -6
- package/dist/types/vue/src/components/pagination/composables/usePaginationWindow.d.ts +6 -6
- package/dist/types/vue/src/components/pin-input/PinInput.vue.d.ts +2 -0
- package/dist/types/vue/src/components/pin-input/PinInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/popconfirm/Popconfirm.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/popover/Popover.vue.d.ts +9 -9
- package/dist/types/vue/src/components/popover/Popover.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/popover/PopoverContent.vue.d.ts +9 -9
- package/dist/types/vue/src/components/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-calendar/RangeCalendar.vue.d.ts +1 -1
- package/dist/types/vue/src/components/range-calendar/RangeCalendar.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-slider/RangeSlider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/scroll-area/ScrollArea.vue.d.ts +1 -1
- package/dist/types/vue/src/components/scroll-area/ScrollArea.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/select/Select.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/sheet/Sheet.vue.d.ts +1 -1
- package/dist/types/vue/src/components/sheet/Sheet.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/slider/Slider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/split-button/SplitButton.vue.d.ts +1 -1
- package/dist/types/vue/src/components/tags-input/TagsInput.vue.d.ts +1 -1
- package/dist/types/vue/src/components/tags-input/TagsInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/toolbar/Toolbar.vue.d.ts +1 -1
- package/dist/types/vue/src/components/toolbar/ToolbarControl.vue.d.ts +1 -1
- package/dist/types/vue/src/components/tour/Tour.vue.d.ts +34 -0
- package/dist/types/vue/src/components/tour/Tour.vue.d.ts.map +1 -0
- package/dist/types/vue/src/components/tour/tour.variants.d.ts +2 -0
- package/dist/types/vue/src/components/tour/tour.variants.d.ts.map +1 -0
- package/dist/types/vue/src/components/tour/types.d.ts +33 -0
- package/dist/types/vue/src/components/tour/types.d.ts.map +1 -0
- package/dist/types/vue/src/components/tree/TreeRows.vue.d.ts +1 -1
- package/dist/types/vue/src/components/tree/TreeRows.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/VirtualTreeWindow.vue.d.ts +1 -1
- package/dist/types/vue/src/components/tree/VirtualTreeWindow.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree-select/TreeSelect.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts +7 -7
- package/dist/types/vue/src/index.d.ts +5 -0
- package/dist/types/vue/src/index.d.ts.map +1 -1
- package/dist/types/vue/src/lib/anchored-overlay.d.ts +11 -5
- package/dist/types/vue/src/lib/anchored-overlay.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts +6 -6
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts.map +1 -1
- package/dist/types/vue/src/lib/useDirection.d.ts +1 -1
- package/dist/types/vue/src/primitives/alert-dialog/index.d.ts +133 -0
- package/dist/types/vue/src/primitives/alert-dialog/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/CalendarCellTrigger.d.ts +52 -0
- package/dist/types/vue/src/primitives/calendar/CalendarCellTrigger.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/CalendarGrid.d.ts +227 -0
- package/dist/types/vue/src/primitives/calendar/CalendarGrid.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/CalendarNav.d.ts +140 -0
- package/dist/types/vue/src/primitives/calendar/CalendarNav.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/CalendarRoot.d.ts +313 -0
- package/dist/types/vue/src/primitives/calendar/CalendarRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/context.d.ts +48 -0
- package/dist/types/vue/src/primitives/calendar/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/index.d.ts +6 -0
- package/dist/types/vue/src/primitives/calendar/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/calendar/useCalendar.d.ts +65 -0
- package/dist/types/vue/src/primitives/calendar/useCalendar.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxContent.d.ts +273 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxItem.d.ts +166 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxRoot.d.ts +376 -0
- package/dist/types/vue/src/primitives/combobox/ComboboxRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/combobox/context.d.ts +68 -0
- package/dist/types/vue/src/primitives/combobox/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/combobox/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/combobox/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/context-menu/index.d.ts +949 -0
- package/dist/types/vue/src/primitives/context-menu/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/DateFieldInput.d.ts +40 -0
- package/dist/types/vue/src/primitives/date-field/DateFieldInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/DateFieldRoot.d.ts +233 -0
- package/dist/types/vue/src/primitives/date-field/DateFieldRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/context.d.ts +26 -0
- package/dist/types/vue/src/primitives/date-field/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/index.d.ts +4 -0
- package/dist/types/vue/src/primitives/date-field/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/segmentInput.d.ts +36 -0
- package/dist/types/vue/src/primitives/date-field/segmentInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-field/useDateFieldSegment.d.ts +32 -0
- package/dist/types/vue/src/primitives/date-field/useDateFieldSegment.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-range-field/DateRangeFieldInput.d.ts +51 -0
- package/dist/types/vue/src/primitives/date-range-field/DateRangeFieldInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-range-field/DateRangeFieldRoot.d.ts +221 -0
- package/dist/types/vue/src/primitives/date-range-field/DateRangeFieldRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-range-field/context.d.ts +31 -0
- package/dist/types/vue/src/primitives/date-range-field/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/date-range-field/index.d.ts +4 -0
- package/dist/types/vue/src/primitives/date-range-field/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogContent.d.ts +54 -0
- package/dist/types/vue/src/primitives/dialog/DialogContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogContentImpl.d.ts +65 -0
- package/dist/types/vue/src/primitives/dialog/DialogContentImpl.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogOverlay.d.ts +40 -0
- package/dist/types/vue/src/primitives/dialog/DialogOverlay.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogPortal.d.ts +49 -0
- package/dist/types/vue/src/primitives/dialog/DialogPortal.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogRoot.d.ts +62 -0
- package/dist/types/vue/src/primitives/dialog/DialogRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogText.d.ts +85 -0
- package/dist/types/vue/src/primitives/dialog/DialogText.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/DialogTrigger.d.ts +33 -0
- package/dist/types/vue/src/primitives/dialog/DialogTrigger.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/context.d.ts +16 -0
- package/dist/types/vue/src/primitives/dialog/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dialog/index.d.ts +8 -0
- package/dist/types/vue/src/primitives/dialog/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dismissable-layer/DismissableLayer.d.ts +76 -0
- package/dist/types/vue/src/primitives/dismissable-layer/DismissableLayer.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dismissable-layer/DismissableLayerBranch.d.ts +26 -0
- package/dist/types/vue/src/primitives/dismissable-layer/DismissableLayerBranch.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dismissable-layer/index.d.ts +3 -0
- package/dist/types/vue/src/primitives/dismissable-layer/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/dropdown-menu/index.d.ts +1033 -0
- package/dist/types/vue/src/primitives/dropdown-menu/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/focus-scope/FocusScope.d.ts +72 -0
- package/dist/types/vue/src/primitives/focus-scope/FocusScope.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/focus-scope/index.d.ts +2 -0
- package/dist/types/vue/src/primitives/focus-scope/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/hover-card/index.d.ts +442 -0
- package/dist/types/vue/src/primitives/hover-card/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/ListboxContent.d.ts +30 -0
- package/dist/types/vue/src/primitives/listbox/ListboxContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/ListboxFilter.d.ts +67 -0
- package/dist/types/vue/src/primitives/listbox/ListboxFilter.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/ListboxGroup.d.ts +82 -0
- package/dist/types/vue/src/primitives/listbox/ListboxGroup.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/ListboxItem.d.ts +58 -0
- package/dist/types/vue/src/primitives/listbox/ListboxItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/{pin-input/PinInputRoot.d.ts → listbox/ListboxRoot.d.ts} +60 -53
- package/dist/types/vue/src/primitives/listbox/ListboxRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/context.d.ts +49 -0
- package/dist/types/vue/src/primitives/listbox/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/listbox/index.d.ts +7 -0
- package/dist/types/vue/src/primitives/listbox/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/MenuContentImpl.d.ts +394 -0
- package/dist/types/vue/src/primitives/menu/MenuContentImpl.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/MenuItem.d.ts +396 -0
- package/dist/types/vue/src/primitives/menu/MenuItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/MenuRoot.d.ts +746 -0
- package/dist/types/vue/src/primitives/menu/MenuRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/context.d.ts +74 -0
- package/dist/types/vue/src/primitives/menu/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/menu/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menu/wrap.d.ts +14 -0
- package/dist/types/vue/src/primitives/menu/wrap.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/menubar/index.d.ts +1036 -0
- package/dist/types/vue/src/primitives/menubar/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuContent.d.ts +101 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuParts.d.ts +165 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuParts.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuRoot.d.ts +187 -0
- package/dist/types/vue/src/primitives/navigation-menu/NavigationMenuRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/navigation-menu/context.d.ts +40 -0
- package/dist/types/vue/src/primitives/navigation-menu/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/navigation-menu/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/navigation-menu/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts +1 -1
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/picker/createPicker.d.ts +247 -0
- package/dist/types/vue/src/primitives/picker/createPicker.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/picker/index.d.ts +414 -0
- package/dist/types/vue/src/primitives/picker/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popover/PopoverContent.d.ts +257 -0
- package/dist/types/vue/src/primitives/popover/PopoverContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popover/PopoverParts.d.ts +183 -0
- package/dist/types/vue/src/primitives/popover/PopoverParts.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popover/PopoverRoot.d.ts +50 -0
- package/dist/types/vue/src/primitives/popover/PopoverRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popover/context.d.ts +13 -0
- package/dist/types/vue/src/primitives/popover/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popover/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/popover/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/Arrow.d.ts +67 -0
- package/dist/types/vue/src/primitives/popper/Arrow.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/PopperAnchor.d.ts +40 -0
- package/dist/types/vue/src/primitives/popper/PopperAnchor.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/PopperArrow.d.ts +61 -0
- package/dist/types/vue/src/primitives/popper/PopperArrow.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/PopperContent.d.ts +370 -0
- package/dist/types/vue/src/primitives/popper/PopperContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/PopperRoot.d.ts +4 -0
- package/dist/types/vue/src/primitives/popper/PopperRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/context.d.ts +17 -0
- package/dist/types/vue/src/primitives/popper/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/popper/index.d.ts +7 -0
- package/dist/types/vue/src/primitives/popper/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/radio-group/RadioGroupRoot.d.ts +1 -1
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarCellTrigger.d.ts +52 -0
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarCellTrigger.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarGrid.d.ts +252 -0
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarGrid.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarRoot.d.ts +345 -0
- package/dist/types/vue/src/primitives/range-calendar/RangeCalendarRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/range-calendar/context.d.ts +64 -0
- package/dist/types/vue/src/primitives/range-calendar/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/range-calendar/index.d.ts +6 -0
- package/dist/types/vue/src/primitives/range-calendar/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/rating/RatingRoot.d.ts +1 -1
- package/dist/types/vue/src/primitives/roving-focus/RovingFocusGroup.vue.d.ts +3 -3
- package/dist/types/vue/src/primitives/roving-focus/RovingFocusGroup.vue.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/select/SelectContent.d.ts +265 -0
- package/dist/types/vue/src/primitives/select/SelectContent.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/select/SelectItem.d.ts +107 -0
- package/dist/types/vue/src/primitives/select/SelectItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/select/SelectRoot.d.ts +275 -0
- package/dist/types/vue/src/primitives/select/SelectRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/select/context.d.ts +73 -0
- package/dist/types/vue/src/primitives/select/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/select/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/select/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/slider/SliderRoot.d.ts +1 -1
- package/dist/types/vue/src/primitives/stepper/StepperRoot.d.ts +1 -1
- package/dist/types/vue/src/primitives/{pin-input/PinInputInput.d.ts → tags-input/TagsInputInput.d.ts} +23 -14
- package/dist/types/vue/src/primitives/tags-input/TagsInputInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tags-input/TagsInputItem.d.ts +76 -0
- package/dist/types/vue/src/primitives/tags-input/TagsInputItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tags-input/TagsInputRoot.d.ts +196 -0
- package/dist/types/vue/src/primitives/tags-input/TagsInputRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tags-input/context.d.ts +30 -0
- package/dist/types/vue/src/primitives/tags-input/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tags-input/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/tags-input/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/teleport/Teleport.d.ts +49 -0
- package/dist/types/vue/src/primitives/teleport/Teleport.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/teleport/index.d.ts +2 -0
- package/dist/types/vue/src/primitives/teleport/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/time-field/TimeFieldInput.d.ts +40 -0
- package/dist/types/vue/src/primitives/time-field/TimeFieldInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/time-field/TimeFieldRoot.d.ts +220 -0
- package/dist/types/vue/src/primitives/time-field/TimeFieldRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/time-field/context.d.ts +25 -0
- package/dist/types/vue/src/primitives/time-field/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/time-field/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/time-field/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/toast/ToastProvider.d.ts +177 -0
- package/dist/types/vue/src/primitives/toast/ToastProvider.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/toast/ToastRoot.d.ts +233 -0
- package/dist/types/vue/src/primitives/toast/ToastRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/toast/index.d.ts +3 -0
- package/dist/types/vue/src/primitives/toast/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/toolbar/ToolbarRoot.d.ts +1 -1
- package/dist/types/vue/src/primitives/tooltip/TooltipParts.d.ts +267 -0
- package/dist/types/vue/src/primitives/tooltip/TooltipParts.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tooltip/TooltipRoot.d.ts +162 -0
- package/dist/types/vue/src/primitives/tooltip/TooltipRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tooltip/context.d.ts +32 -0
- package/dist/types/vue/src/primitives/tooltip/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tooltip/index.d.ts +4 -0
- package/dist/types/vue/src/primitives/tooltip/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tree/TreeItem.d.ts +40 -0
- package/dist/types/vue/src/primitives/tree/TreeItem.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tree/TreeRoot.d.ts +50 -0
- package/dist/types/vue/src/primitives/tree/TreeRoot.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tree/context.d.ts +29 -0
- package/dist/types/vue/src/primitives/tree/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/tree/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/tree/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/config.d.ts +14 -1
- package/dist/types/vue/src/primitives/utils/config.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/utils/defu.d.ts +2 -0
- package/dist/types/vue/src/primitives/utils/defu.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/env.d.ts +2 -0
- package/dist/types/vue/src/primitives/utils/env.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/layers.d.ts +5 -0
- package/dist/types/vue/src/primitives/utils/layers.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/propsWithoutDefaults.d.ts +2 -0
- package/dist/types/vue/src/primitives/utils/propsWithoutDefaults.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useBodyScrollLock.d.ts +2 -0
- package/dist/types/vue/src/primitives/utils/useBodyScrollLock.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useDirection.d.ts +1 -1
- package/dist/types/vue/src/primitives/utils/useDirection.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/utils/useFocusGuards.d.ts +2 -0
- package/dist/types/vue/src/primitives/utils/useFocusGuards.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useGraceArea.d.ts +6 -0
- package/dist/types/vue/src/primitives/utils/useGraceArea.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useHideOthers.d.ts +4 -0
- package/dist/types/vue/src/primitives/utils/useHideOthers.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useIsUsingKeyboard.d.ts +4 -0
- package/dist/types/vue/src/primitives/utils/useIsUsingKeyboard.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useLocale.d.ts +3 -0
- package/dist/types/vue/src/primitives/utils/useLocale.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts +1 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts +1 -1
- package/dist/types/vue/src/singletons.d.ts +1 -1
- package/dist/types/vue/src/singletons.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/alert-dialog/AlertDialog.vue +1 -1
- package/src/components/calendar/Calendar.vue +1 -1
- package/src/components/calendar/CalendarLevels.vue +1 -1
- package/src/components/combobox/Combobox.vue +6 -1
- package/src/components/combobox/ComboboxList.vue +1 -1
- package/src/components/command-palette/CommandPalette.vue +2 -2
- package/src/components/command-palette/CommandPaletteInput.vue +1 -1
- package/src/components/command-palette/CommandPaletteItem.vue +1 -1
- package/src/components/command-palette/CommandPalettePanel.vue +6 -1
- package/src/components/config-provider/ConfigProvider.vue +24 -0
- package/src/components/config-provider/types.ts +11 -0
- package/src/components/config-provider/useConfig.ts +5 -0
- package/src/components/context-menu/ContextMenu.vue +1 -1
- package/src/components/context-menu/ContextMenuCheckboxItem.vue +1 -1
- package/src/components/context-menu/ContextMenuGroup.vue +1 -1
- package/src/components/context-menu/ContextMenuItem.vue +1 -1
- package/src/components/context-menu/ContextMenuLabel.vue +1 -1
- package/src/components/context-menu/ContextMenuRadioGroup.vue +1 -1
- package/src/components/context-menu/ContextMenuRadioItem.vue +1 -1
- package/src/components/context-menu/ContextMenuSeparator.vue +1 -1
- package/src/components/context-menu/ContextMenuSub.vue +1 -1
- package/src/components/data-table/DataTableDragPreview.vue +1 -1
- package/src/components/date-field/DateField.vue +1 -1
- package/src/components/date-picker/DatePicker.vue +1 -1
- package/src/components/date-range-field/DateRangeField.vue +5 -1
- package/src/components/date-range-picker/DateRangePicker.vue +1 -1
- package/src/components/date-time-picker/DateTimePicker.vue +1 -1
- package/src/components/dialog/Dialog.vue +1 -1
- package/src/components/dialog/ModalContent.vue +2 -1
- package/src/components/drawer/Drawer.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenu.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuCheckboxItem.vue +4 -1
- package/src/components/dropdown-menu/DropdownMenuGroup.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuLabel.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuRadioGroup.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuSeparator.vue +1 -1
- package/src/components/dropdown-menu/DropdownMenuSub.vue +1 -1
- package/src/components/hover-card/HoverCard.vue +6 -1
- package/src/components/hover-card/composables/useHoverCardAnchor.ts +1 -1
- package/src/components/icon-button/IconButton.vue +1 -1
- package/src/components/image/composables/useImage.ts +2 -1
- package/src/components/lightbox/Lightbox.vue +2 -1
- package/src/components/lightbox/LightboxChrome.vue +1 -1
- package/src/components/listbox/Listbox.vue +1 -1
- package/src/components/listbox/ListboxOptionContent.vue +1 -1
- package/src/components/menubar/Menubar.vue +1 -1
- package/src/components/menubar/MenubarCheckboxItem.vue +1 -1
- package/src/components/menubar/MenubarGroup.vue +1 -1
- package/src/components/menubar/MenubarItem.vue +1 -1
- package/src/components/menubar/MenubarLabel.vue +1 -1
- package/src/components/menubar/MenubarMenu.vue +6 -1
- package/src/components/menubar/MenubarRadioGroup.vue +1 -1
- package/src/components/menubar/MenubarRadioItem.vue +1 -1
- package/src/components/menubar/MenubarSeparator.vue +1 -1
- package/src/components/menubar/MenubarSub.vue +6 -1
- package/src/components/multi-combobox/MultiCombobox.vue +6 -1
- package/src/components/multi-select/MultiSelect.vue +1 -1
- package/src/components/nav-link/NavLink.vue +21 -2
- package/src/components/nav-link/NavLinkChild.ts +2 -0
- package/src/components/navigation-menu/NavigationMenu.vue +5 -1
- package/src/components/navigation-menu/NavigationMenuContent.vue +2 -2
- package/src/components/navigation-menu/NavigationMenuItem.vue +1 -1
- package/src/components/navigation-menu/NavigationMenuLink.vue +1 -1
- package/src/components/navigation-menu/NavigationMenuTrigger.vue +1 -1
- package/src/components/number-input/NumberInput.vue +1 -1
- package/src/components/pagination/PaginationPopup.vue +1 -1
- package/src/components/pin-input/PinInput.vue +103 -33
- package/src/components/popconfirm/Popconfirm.vue +6 -1
- package/src/components/popover/Popover.vue +6 -1
- package/src/components/popover/PopoverContent.vue +2 -2
- package/src/components/popover/composables/usePopoverCloseFocus.ts +1 -1
- package/src/components/range-calendar/RangeCalendar.vue +1 -1
- package/src/components/select/Select.vue +2 -1
- package/src/components/select/SelectList.vue +1 -1
- package/src/components/sheet/Sheet.vue +1 -1
- package/src/components/slider/SliderHandle.vue +1 -1
- package/src/components/tags-input/TagsInput.vue +1 -1
- package/src/components/tags-input/TagsInputChip.vue +1 -1
- package/src/components/time/Time.vue +1 -1
- package/src/components/time-field/TimeField.vue +1 -1
- package/src/components/toast/Toaster.vue +1 -1
- package/src/components/toggle/Toggle.vue +1 -1
- package/src/components/toolbar/ToolbarControl.vue +1 -1
- package/src/components/tooltip/Tooltip.vue +1 -1
- package/src/components/tooltip/TooltipBubble.vue +1 -1
- package/src/components/tooltip/TooltipDirectiveRoot.ts +1 -1
- package/src/components/tooltip/TooltipProvider.vue +1 -1
- package/src/components/tooltip/composables/useTooltipTarget.ts +1 -1
- package/src/components/tour/Tour.vue +447 -0
- package/src/components/tour/tour.variants.ts +1 -0
- package/src/components/tour/types.ts +43 -0
- package/src/components/tree/Tree.vue +1 -1
- package/src/components/tree/TreeRows.vue +1 -1
- package/src/components/tree/VirtualTreeWindow.vue +1 -1
- package/src/components/tree-select/TreeSelect.vue +2 -3
- package/src/components/tree-select/composables/useTreeSelect.ts +2 -2
- package/src/index.ts +15 -0
- package/src/lib/anchored-overlay.ts +2 -1
- package/src/lib/dialog-focus.ts +1 -1
- package/src/lib/reka/useVirtualChoices.ts +7 -8
- package/src/lib/reka/useVirtualTree.ts +1 -1
- package/src/primitives/alert-dialog/index.ts +166 -0
- package/src/primitives/calendar/CalendarCellTrigger.ts +190 -0
- package/src/primitives/calendar/CalendarGrid.ts +101 -0
- package/src/primitives/calendar/CalendarNav.ts +88 -0
- package/src/primitives/calendar/CalendarRoot.ts +324 -0
- package/src/primitives/calendar/LICENSE +44 -0
- package/src/primitives/calendar/context.ts +55 -0
- package/src/primitives/calendar/index.ts +12 -0
- package/src/primitives/calendar/useCalendar.ts +164 -0
- package/src/primitives/combobox/ComboboxContent.ts +199 -0
- package/src/primitives/combobox/ComboboxItem.ts +209 -0
- package/src/primitives/combobox/ComboboxRoot.ts +489 -0
- package/src/primitives/combobox/LICENSE +44 -0
- package/src/primitives/combobox/context.ts +47 -0
- package/src/primitives/combobox/index.ts +23 -0
- package/src/primitives/context-menu/LICENSE +44 -0
- package/src/primitives/context-menu/index.ts +388 -0
- package/src/primitives/date-field/DateFieldInput.ts +29 -0
- package/src/primitives/date-field/DateFieldRoot.ts +343 -0
- package/src/primitives/date-field/LICENSE +44 -0
- package/src/primitives/date-field/context.ts +29 -0
- package/src/primitives/date-field/index.ts +3 -0
- package/src/primitives/date-field/segmentInput.ts +96 -0
- package/src/primitives/date-field/useDateFieldSegment.ts +63 -0
- package/src/primitives/date-range-field/DateRangeFieldInput.ts +42 -0
- package/src/primitives/date-range-field/DateRangeFieldRoot.ts +389 -0
- package/src/primitives/date-range-field/LICENSE +44 -0
- package/src/primitives/date-range-field/context.ts +36 -0
- package/src/primitives/date-range-field/index.ts +12 -0
- package/src/primitives/dialog/DialogContent.ts +193 -0
- package/src/primitives/dialog/DialogContentImpl.ts +114 -0
- package/src/primitives/dialog/DialogOverlay.ts +99 -0
- package/src/primitives/dialog/DialogPortal.ts +33 -0
- package/src/primitives/dialog/DialogRoot.ts +61 -0
- package/src/primitives/dialog/DialogText.ts +59 -0
- package/src/primitives/dialog/DialogTrigger.ts +46 -0
- package/src/primitives/dialog/LICENSE +44 -0
- package/src/primitives/dialog/context.ts +19 -0
- package/src/primitives/dialog/index.ts +7 -0
- package/src/primitives/dismissable-layer/DismissableLayer.ts +212 -0
- package/src/primitives/dismissable-layer/DismissableLayerBranch.ts +36 -0
- package/src/primitives/dismissable-layer/LICENSE +44 -0
- package/src/primitives/dismissable-layer/index.ts +11 -0
- package/src/primitives/dropdown-menu/LICENSE +44 -0
- package/src/primitives/dropdown-menu/index.ts +344 -0
- package/src/primitives/focus-scope/FocusScope.ts +118 -0
- package/src/primitives/focus-scope/LICENSE +44 -0
- package/src/primitives/focus-scope/index.ts +1 -0
- package/src/primitives/hover-card/LICENSE +44 -0
- package/src/primitives/hover-card/index.ts +357 -0
- package/src/primitives/listbox/LICENSE +44 -0
- package/src/primitives/listbox/ListboxContent.ts +80 -0
- package/src/primitives/listbox/ListboxFilter.ts +130 -0
- package/src/primitives/listbox/ListboxGroup.ts +67 -0
- package/src/primitives/listbox/ListboxItem.ts +125 -0
- package/src/primitives/listbox/ListboxRoot.ts +376 -0
- package/src/primitives/listbox/context.ts +62 -0
- package/src/primitives/listbox/index.ts +17 -0
- package/src/primitives/menu/LICENSE +44 -0
- package/src/primitives/menu/MenuContentImpl.ts +304 -0
- package/src/primitives/menu/MenuItem.ts +495 -0
- package/src/primitives/menu/MenuRoot.ts +295 -0
- package/src/primitives/menu/context.ts +72 -0
- package/src/primitives/menu/index.ts +26 -0
- package/src/primitives/menu/wrap.ts +53 -0
- package/src/primitives/menubar/index.ts +494 -0
- package/src/primitives/navigation-menu/LICENSE +44 -0
- package/src/primitives/navigation-menu/NavigationMenuContent.ts +375 -0
- package/src/primitives/navigation-menu/NavigationMenuParts.ts +432 -0
- package/src/primitives/navigation-menu/NavigationMenuRoot.ts +260 -0
- package/src/primitives/navigation-menu/context.ts +50 -0
- package/src/primitives/navigation-menu/index.ts +20 -0
- package/src/primitives/number-field/__snapshots__/NumberField.test.ts.snap +288 -0
- package/src/primitives/picker/LICENSE +44 -0
- package/src/primitives/picker/createPicker.ts +618 -0
- package/src/primitives/picker/index.ts +26 -0
- package/src/primitives/popover/LICENSE +44 -0
- package/src/primitives/popover/PopoverContent.ts +243 -0
- package/src/primitives/popover/PopoverParts.ts +143 -0
- package/src/primitives/popover/PopoverRoot.ts +58 -0
- package/src/primitives/popover/context.ts +16 -0
- package/src/primitives/popover/index.ts +14 -0
- package/src/primitives/popper/Arrow.ts +49 -0
- package/src/primitives/popper/LICENSE +44 -0
- package/src/primitives/popper/PopperAnchor.ts +33 -0
- package/src/primitives/popper/PopperArrow.ts +77 -0
- package/src/primitives/popper/PopperContent.ts +262 -0
- package/src/primitives/popper/PopperRoot.ts +16 -0
- package/src/primitives/popper/context.ts +23 -0
- package/src/primitives/popper/index.ts +11 -0
- package/src/primitives/range-calendar/LICENSE +44 -0
- package/src/primitives/range-calendar/RangeCalendarCellTrigger.ts +241 -0
- package/src/primitives/range-calendar/RangeCalendarGrid.ts +90 -0
- package/src/primitives/range-calendar/RangeCalendarRoot.ts +413 -0
- package/src/primitives/range-calendar/context.ts +71 -0
- package/src/primitives/range-calendar/index.ts +21 -0
- package/src/primitives/select/LICENSE +44 -0
- package/src/primitives/select/SelectContent.ts +330 -0
- package/src/primitives/select/SelectItem.ts +204 -0
- package/src/primitives/select/SelectRoot.ts +408 -0
- package/src/primitives/select/context.ts +74 -0
- package/src/primitives/select/index.ts +17 -0
- package/src/primitives/tags-input/LICENSE +44 -0
- package/src/primitives/tags-input/TagsInputInput.ts +148 -0
- package/src/primitives/tags-input/TagsInputItem.ts +105 -0
- package/src/primitives/tags-input/TagsInputRoot.ts +215 -0
- package/src/primitives/tags-input/context.ts +36 -0
- package/src/primitives/tags-input/index.ts +9 -0
- package/src/primitives/teleport/LICENSE +44 -0
- package/src/primitives/teleport/Teleport.ts +41 -0
- package/src/primitives/teleport/index.ts +1 -0
- package/src/primitives/time-field/LICENSE +44 -0
- package/src/primitives/time-field/TimeFieldInput.ts +29 -0
- package/src/primitives/time-field/TimeFieldRoot.ts +379 -0
- package/src/primitives/time-field/context.ts +28 -0
- package/src/primitives/time-field/index.ts +4 -0
- package/src/primitives/toast/LICENSE +44 -0
- package/src/primitives/toast/ToastProvider.ts +311 -0
- package/src/primitives/toast/ToastRoot.ts +518 -0
- package/src/primitives/toast/index.ts +16 -0
- package/src/primitives/tooltip/LICENSE +44 -0
- package/src/primitives/tooltip/TooltipParts.ts +351 -0
- package/src/primitives/tooltip/TooltipRoot.ts +170 -0
- package/src/primitives/tooltip/context.ts +39 -0
- package/src/primitives/tooltip/index.ts +9 -0
- package/src/primitives/tree/LICENSE +44 -0
- package/src/primitives/tree/TreeItem.ts +256 -0
- package/src/primitives/tree/TreeRoot.ts +273 -0
- package/src/primitives/tree/context.ts +34 -0
- package/src/primitives/tree/index.ts +4 -0
- package/src/primitives/utils/config.ts +19 -1
- package/src/primitives/utils/defu.ts +26 -0
- package/src/primitives/utils/env.ts +5 -0
- package/src/primitives/utils/layers.ts +4 -0
- package/src/primitives/utils/propsWithoutDefaults.ts +8 -0
- package/src/primitives/utils/useBodyScrollLock.ts +29 -0
- package/src/primitives/utils/useFocusGuards.ts +10 -0
- package/src/primitives/utils/useGraceArea.ts +85 -0
- package/src/primitives/utils/useHideOthers.ts +18 -0
- package/src/primitives/utils/useIsUsingKeyboard.ts +25 -0
- package/src/primitives/utils/useLocale.ts +7 -0
- package/src/primitives/utils/useVModel.ts +8 -3
- package/src/singletons.ts +1 -1
- package/dist/types/vue/src/primitives/pin-input/PinInputInput.d.ts.map +0 -1
- package/dist/types/vue/src/primitives/pin-input/PinInputRoot.d.ts.map +0 -1
- package/dist/types/vue/src/primitives/pin-input/context.d.ts +0 -20
- package/dist/types/vue/src/primitives/pin-input/context.d.ts.map +0 -1
- package/dist/types/vue/src/primitives/pin-input/index.d.ts +0 -4
- package/dist/types/vue/src/primitives/pin-input/index.d.ts.map +0 -1
- package/src/primitives/pin-input/PinInputInput.ts +0 -218
- package/src/primitives/pin-input/PinInputRoot.ts +0 -136
- package/src/primitives/pin-input/context.ts +0 -24
- package/src/primitives/pin-input/index.ts +0 -3
- /package/dist/shared/primitives/{pin-input → date}/LICENSE +0 -0
- /package/src/primitives/{pin-input → alert-dialog}/LICENSE +0 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import { DateFormatter, type DateValue } from '@internationalized/date'
|
|
2
|
+
import { getDaysInMonth, toDate, type HourCycle } from './comparators'
|
|
3
|
+
import type { Formatter } from './formatter'
|
|
4
|
+
import type { SegmentValueObj } from './parser'
|
|
5
|
+
import { isAcceptableSegmentKey, isNumberString, isSegmentNavigationKey } from './segment'
|
|
6
|
+
import { getActiveElement, kbd, snapValueToStep, type DateStep } from './utils'
|
|
7
|
+
|
|
8
|
+
const DIGIT_REG = /^\d$/
|
|
9
|
+
|
|
10
|
+
export type DateFieldPart = keyof SegmentValueObj | 'literal' | 'timeZoneName' | 'era'
|
|
11
|
+
export type SegmentAttributes = Record<string, string | number | boolean | undefined>
|
|
12
|
+
|
|
13
|
+
type Values = Record<string, number | string | null | undefined>
|
|
14
|
+
type CyclePart = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'
|
|
15
|
+
interface Cyclable {
|
|
16
|
+
set: (fields: Record<string, number>) => Cyclable
|
|
17
|
+
cycle: (field: CyclePart, amount: number) => Cyclable
|
|
18
|
+
[key: string]: unknown
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SegmentAttributeProps {
|
|
22
|
+
disabled: boolean
|
|
23
|
+
placeholder: DateValue
|
|
24
|
+
hourCycle: HourCycle
|
|
25
|
+
segmentValues: SegmentValueObj
|
|
26
|
+
formatter: Formatter
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SEGMENT_CARET_STYLE = 'caret-color: transparent;'
|
|
30
|
+
|
|
31
|
+
function commonSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
32
|
+
return {
|
|
33
|
+
role: 'spinbutton',
|
|
34
|
+
contenteditable: true,
|
|
35
|
+
tabindex: props.disabled ? undefined : 0,
|
|
36
|
+
spellcheck: false,
|
|
37
|
+
inputmode: 'numeric',
|
|
38
|
+
autocorrect: 'off',
|
|
39
|
+
enterkeyhint: 'next',
|
|
40
|
+
style: SEGMENT_CARET_STYLE,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function daySegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
45
|
+
const { segmentValues, placeholder } = props
|
|
46
|
+
const isEmpty = segmentValues.day === null
|
|
47
|
+
const dateFields: { day?: number; month?: number } = {}
|
|
48
|
+
if (segmentValues.day) dateFields.day = segmentValues.day
|
|
49
|
+
if (segmentValues.month) dateFields.month = segmentValues.month
|
|
50
|
+
const date = Object.keys(dateFields).length > 0 ? placeholder.set(dateFields) : placeholder
|
|
51
|
+
const valueNow = date.day
|
|
52
|
+
return {
|
|
53
|
+
...commonSegmentAttrs(props),
|
|
54
|
+
'aria-label': 'day,',
|
|
55
|
+
'aria-valuemin': 1,
|
|
56
|
+
'aria-valuemax': getDaysInMonth(date),
|
|
57
|
+
'aria-valuenow': valueNow,
|
|
58
|
+
'aria-valuetext': isEmpty ? 'Empty' : `${valueNow}`,
|
|
59
|
+
'data-placeholder': isEmpty ? '' : undefined,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function monthSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
64
|
+
const { segmentValues, placeholder, formatter } = props
|
|
65
|
+
const isEmpty = segmentValues.month === null
|
|
66
|
+
const date = segmentValues.month ? placeholder.set({ month: segmentValues.month }) : placeholder
|
|
67
|
+
const valueNow = date.month
|
|
68
|
+
return {
|
|
69
|
+
...commonSegmentAttrs(props),
|
|
70
|
+
'aria-label': 'month, ',
|
|
71
|
+
contenteditable: true,
|
|
72
|
+
'aria-valuemin': 1,
|
|
73
|
+
'aria-valuemax': 12,
|
|
74
|
+
'aria-valuenow': valueNow,
|
|
75
|
+
'aria-valuetext': isEmpty ? 'Empty' : `${valueNow} - ${formatter.fullMonth(toDate(date))}`,
|
|
76
|
+
'data-placeholder': isEmpty ? '' : undefined,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function yearSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
81
|
+
const { segmentValues, placeholder } = props
|
|
82
|
+
const isEmpty = segmentValues.year === null
|
|
83
|
+
const date = segmentValues.year ? placeholder.set({ year: segmentValues.year }) : placeholder
|
|
84
|
+
const valueNow = date.year
|
|
85
|
+
return {
|
|
86
|
+
...commonSegmentAttrs(props),
|
|
87
|
+
'aria-label': 'year, ',
|
|
88
|
+
'aria-valuemin': 1,
|
|
89
|
+
'aria-valuemax': 9999,
|
|
90
|
+
'aria-valuenow': valueNow,
|
|
91
|
+
'aria-valuetext': isEmpty ? 'Empty' : `${valueNow}`,
|
|
92
|
+
'data-placeholder': isEmpty ? '' : undefined,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function hourSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
97
|
+
const { segmentValues, hourCycle, placeholder } = props
|
|
98
|
+
if (!('hour' in segmentValues) || !('hour' in placeholder)) return {}
|
|
99
|
+
const isEmpty = segmentValues.hour === null
|
|
100
|
+
const date = (
|
|
101
|
+
segmentValues.hour ? placeholder.set({ hour: segmentValues.hour } as never) : placeholder
|
|
102
|
+
) as DateValue & { hour: number }
|
|
103
|
+
const valueNow = date.hour
|
|
104
|
+
return {
|
|
105
|
+
...commonSegmentAttrs(props),
|
|
106
|
+
'aria-label': 'hour, ',
|
|
107
|
+
'aria-valuemin': hourCycle === 12 ? 1 : 0,
|
|
108
|
+
'aria-valuemax': hourCycle === 12 ? 12 : 23,
|
|
109
|
+
'aria-valuenow': valueNow,
|
|
110
|
+
'aria-valuetext': isEmpty ? 'Empty' : `${valueNow} ${segmentValues.dayPeriod ?? ''}`,
|
|
111
|
+
'data-placeholder': isEmpty ? '' : undefined,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function minuteOrSecondAttrs(part: 'minute' | 'second') {
|
|
116
|
+
return (props: SegmentAttributeProps): SegmentAttributes => {
|
|
117
|
+
const { segmentValues, placeholder } = props
|
|
118
|
+
if (!(part in segmentValues) || !(part in placeholder)) return {}
|
|
119
|
+
const isEmpty = segmentValues[part] === null
|
|
120
|
+
const date = (
|
|
121
|
+
segmentValues[part] ? placeholder.set({ [part]: segmentValues[part] } as never) : placeholder
|
|
122
|
+
) as DateValue & Record<'minute' | 'second', number>
|
|
123
|
+
const valueNow = date[part]
|
|
124
|
+
return {
|
|
125
|
+
...commonSegmentAttrs(props),
|
|
126
|
+
'aria-label': `${part}, `,
|
|
127
|
+
'aria-valuemin': 0,
|
|
128
|
+
'aria-valuemax': 59,
|
|
129
|
+
'aria-valuenow': valueNow,
|
|
130
|
+
'aria-valuetext': isEmpty ? 'Empty' : `${valueNow}`,
|
|
131
|
+
'data-placeholder': isEmpty ? '' : undefined,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function dayPeriodSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
137
|
+
const { segmentValues } = props
|
|
138
|
+
if (!('dayPeriod' in segmentValues)) return {}
|
|
139
|
+
const hour = segmentValues.hour
|
|
140
|
+
return {
|
|
141
|
+
...commonSegmentAttrs(props),
|
|
142
|
+
inputmode: 'text',
|
|
143
|
+
'aria-label': 'AM/PM',
|
|
144
|
+
'aria-valuemin': 0,
|
|
145
|
+
'aria-valuemax': 12,
|
|
146
|
+
'aria-valuenow': hour ? (hour > 12 ? hour - 12 : hour) : 0,
|
|
147
|
+
'aria-valuetext': segmentValues.dayPeriod ?? 'AM',
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function literalSegmentAttrs(): SegmentAttributes {
|
|
152
|
+
return { 'aria-hidden': true, 'data-segment': 'literal' }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function timeZoneSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
156
|
+
return {
|
|
157
|
+
role: 'textbox',
|
|
158
|
+
'aria-label': 'timezone, ',
|
|
159
|
+
'data-readonly': true,
|
|
160
|
+
'data-segment': 'timeZoneName',
|
|
161
|
+
tabindex: props.disabled ? undefined : 0,
|
|
162
|
+
style: SEGMENT_CARET_STYLE,
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function eraSegmentAttrs(props: SegmentAttributeProps): SegmentAttributes {
|
|
167
|
+
const { segmentValues, placeholder } = props
|
|
168
|
+
return {
|
|
169
|
+
...commonSegmentAttrs(props),
|
|
170
|
+
'aria-label': 'era',
|
|
171
|
+
'aria-valuemin': 0,
|
|
172
|
+
'aria-valuemax': 0,
|
|
173
|
+
'aria-valuenow': 0,
|
|
174
|
+
'aria-valuetext':
|
|
175
|
+
'era' in segmentValues
|
|
176
|
+
? ((segmentValues as unknown as Values).era as string)
|
|
177
|
+
: (placeholder as DateValue & { era: string }).era,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const segmentBuilders: Record<string, (props: SegmentAttributeProps) => SegmentAttributes> = {
|
|
182
|
+
day: daySegmentAttrs,
|
|
183
|
+
month: monthSegmentAttrs,
|
|
184
|
+
year: yearSegmentAttrs,
|
|
185
|
+
hour: hourSegmentAttrs,
|
|
186
|
+
minute: minuteOrSecondAttrs('minute'),
|
|
187
|
+
second: minuteOrSecondAttrs('second'),
|
|
188
|
+
dayPeriod: dayPeriodSegmentAttrs,
|
|
189
|
+
literal: literalSegmentAttrs,
|
|
190
|
+
timeZoneName: timeZoneSegmentAttrs,
|
|
191
|
+
era: eraSegmentAttrs,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function dateSegmentAttributes(part: string, props: SegmentAttributeProps) {
|
|
195
|
+
return segmentBuilders[part]?.(props) ?? {}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface Box<T> {
|
|
199
|
+
value: T
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface DateFieldSegmentOptions {
|
|
203
|
+
hasLeftFocus: Box<boolean>
|
|
204
|
+
lastKeyZero: Box<boolean>
|
|
205
|
+
placeholder: () => DateValue
|
|
206
|
+
hourCycle: HourCycle
|
|
207
|
+
step: () => DateStep
|
|
208
|
+
stepSnapping: () => boolean
|
|
209
|
+
formatter: Formatter
|
|
210
|
+
segmentValues: () => SegmentValueObj
|
|
211
|
+
assign: (fields: Values) => void
|
|
212
|
+
disabled: () => boolean
|
|
213
|
+
readonly: () => boolean
|
|
214
|
+
part: DateFieldPart
|
|
215
|
+
setModelValue: (value: DateValue | undefined) => void
|
|
216
|
+
focusNext: () => void
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function createDateFieldSegment(props: DateFieldSegmentOptions) {
|
|
220
|
+
const values = () => props.segmentValues() as Values
|
|
221
|
+
const assign = (part: string, value: number | string | null) => props.assign({ [part]: value })
|
|
222
|
+
const placeholder = () => props.placeholder() as unknown as Cyclable
|
|
223
|
+
|
|
224
|
+
function minuteSecondIncrementation(
|
|
225
|
+
event: KeyboardEvent,
|
|
226
|
+
part: 'minute' | 'second',
|
|
227
|
+
dateRef: Cyclable,
|
|
228
|
+
prevValue: number | null,
|
|
229
|
+
) {
|
|
230
|
+
const step = props.step()[part] ?? 1
|
|
231
|
+
const sign = event.key === kbd.ARROW_UP ? step : -step
|
|
232
|
+
if (prevValue === null) return sign > 0 ? 0 : 59
|
|
233
|
+
return dateRef.set({ [part]: prevValue }).cycle(part, sign)[part] as number
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function deleteValue(prevValue: number | null) {
|
|
237
|
+
props.hasLeftFocus.value = false
|
|
238
|
+
if (prevValue === null) return prevValue
|
|
239
|
+
const str = prevValue.toString()
|
|
240
|
+
if (str.length === 1) {
|
|
241
|
+
props.setModelValue(undefined)
|
|
242
|
+
return null
|
|
243
|
+
}
|
|
244
|
+
return Number.parseInt(str.slice(0, -1))
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function dateTimeValueIncrementation(
|
|
248
|
+
event: KeyboardEvent,
|
|
249
|
+
part: 'day' | 'month' | 'year' | 'hour',
|
|
250
|
+
dateRef: Cyclable,
|
|
251
|
+
prevValue: number | null,
|
|
252
|
+
) {
|
|
253
|
+
const step = props.step()[part] ?? 1
|
|
254
|
+
const sign = event.key === kbd.ARROW_UP ? step : -step
|
|
255
|
+
if (prevValue === null) return dateRef[part] as number
|
|
256
|
+
if (part === 'hour' && 'hour' in dateRef)
|
|
257
|
+
return dateRef.set({ [part]: prevValue }).cycle(part, sign)[part] as number
|
|
258
|
+
if (part === 'day')
|
|
259
|
+
return dateRef
|
|
260
|
+
.set({ [part]: prevValue, month: (values().month as number | null) ?? 1 })
|
|
261
|
+
.cycle(part, sign)[part] as number
|
|
262
|
+
return dateRef.set({ [part]: prevValue }).cycle(part, sign)[part] as number
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function startOver(prev: number | null, resetZero: boolean) {
|
|
266
|
+
if (!props.hasLeftFocus.value) return prev
|
|
267
|
+
props.hasLeftFocus.value = false
|
|
268
|
+
if (resetZero) props.lastKeyZero.value = false
|
|
269
|
+
return null
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function updateTwoDigits(
|
|
273
|
+
max: number,
|
|
274
|
+
num: number,
|
|
275
|
+
prevValue: number | null,
|
|
276
|
+
zero: number | null,
|
|
277
|
+
overflowMoves: boolean,
|
|
278
|
+
) {
|
|
279
|
+
const prev = startOver(prevValue, true)
|
|
280
|
+
let moveToNext = false
|
|
281
|
+
const maxStart = Math.floor(max / 10)
|
|
282
|
+
if (prev === null) {
|
|
283
|
+
if (num === 0) {
|
|
284
|
+
props.lastKeyZero.value = true
|
|
285
|
+
return { value: zero, moveToNext }
|
|
286
|
+
}
|
|
287
|
+
if (props.lastKeyZero.value || num > maxStart) moveToNext = true
|
|
288
|
+
props.lastKeyZero.value = false
|
|
289
|
+
return { value: num, moveToNext }
|
|
290
|
+
}
|
|
291
|
+
const digits = prev.toString().length
|
|
292
|
+
const total = Number.parseInt(prev.toString() + num.toString())
|
|
293
|
+
if (digits === 2 || total > max) {
|
|
294
|
+
if (num > maxStart || (overflowMoves && total > max)) moveToNext = true
|
|
295
|
+
return { value: num, moveToNext }
|
|
296
|
+
}
|
|
297
|
+
moveToNext = true
|
|
298
|
+
return { value: total, moveToNext }
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function updateYear(num: number, prevValue: number | null) {
|
|
302
|
+
const prev = startOver(prevValue, false)
|
|
303
|
+
let moveToNext = false
|
|
304
|
+
if (prev === null) return { value: num === 0 ? 1 : num, moveToNext }
|
|
305
|
+
const str = prev.toString() + num.toString()
|
|
306
|
+
if (str.length > 4) return { value: num === 0 ? 1 : num, moveToNext }
|
|
307
|
+
if (str.length === 4) moveToNext = true
|
|
308
|
+
return { value: Number.parseInt(str), moveToNext }
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function handleDateSegmentKeydown(event: KeyboardEvent, part: 'day' | 'month' | 'year') {
|
|
312
|
+
if (!isAcceptableSegmentKey(event.key) || isSegmentNavigationKey(event.key)) return
|
|
313
|
+
const prevValue = values()[part] as number | null
|
|
314
|
+
if (event.key === kbd.ARROW_DOWN || event.key === kbd.ARROW_UP) {
|
|
315
|
+
assign(part, dateTimeValueIncrementation(event, part, placeholder(), prevValue))
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
if (isNumberString(event.key)) {
|
|
319
|
+
const num = Number.parseInt(event.key)
|
|
320
|
+
let result: { value: number | null; moveToNext: boolean }
|
|
321
|
+
if (part === 'day') {
|
|
322
|
+
const month = values().month as number | null
|
|
323
|
+
const daysInMonth = month ? getDaysInMonth(props.placeholder().set({ month })) : 31
|
|
324
|
+
result = updateTwoDigits(daysInMonth, num, prevValue, null, true)
|
|
325
|
+
} else if (part === 'month') result = updateTwoDigits(12, num, prevValue, null, true)
|
|
326
|
+
else result = updateYear(num, prevValue)
|
|
327
|
+
assign(part, result.value)
|
|
328
|
+
if (result.moveToNext) props.focusNext()
|
|
329
|
+
}
|
|
330
|
+
if (event.key === kbd.BACKSPACE) {
|
|
331
|
+
props.hasLeftFocus.value = false
|
|
332
|
+
assign(part, deleteValue(prevValue))
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function uses12HourFormat(locale: string) {
|
|
337
|
+
const hourCycle = new DateFormatter(locale, { hour: 'numeric' }).resolvedOptions().hourCycle
|
|
338
|
+
return hourCycle === 'h11' || hourCycle === 'h12'
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function handleHourSegmentKeydown(event: KeyboardEvent) {
|
|
342
|
+
const dateRef = placeholder()
|
|
343
|
+
if (
|
|
344
|
+
!isAcceptableSegmentKey(event.key) ||
|
|
345
|
+
isSegmentNavigationKey(event.key) ||
|
|
346
|
+
!('hour' in dateRef) ||
|
|
347
|
+
!('hour' in values())
|
|
348
|
+
)
|
|
349
|
+
return
|
|
350
|
+
const prevValue = values().hour as number | null
|
|
351
|
+
if (event.key === kbd.ARROW_UP || event.key === kbd.ARROW_DOWN) {
|
|
352
|
+
const newHour = dateTimeValueIncrementation(event, 'hour', placeholder(), prevValue)
|
|
353
|
+
assign('hour', newHour)
|
|
354
|
+
if ('dayPeriod' in values() && newHour !== null)
|
|
355
|
+
assign('dayPeriod', newHour >= 12 ? 'PM' : 'AM')
|
|
356
|
+
return
|
|
357
|
+
}
|
|
358
|
+
if (isNumberString(event.key)) {
|
|
359
|
+
const num = Number.parseInt(event.key)
|
|
360
|
+
const is12Hour =
|
|
361
|
+
props.hourCycle !== undefined
|
|
362
|
+
? props.hourCycle === 12
|
|
363
|
+
: uses12HourFormat(props.formatter.getLocale())
|
|
364
|
+
const max = is12Hour ? 12 : 24
|
|
365
|
+
let displayPrev = prevValue
|
|
366
|
+
if (is12Hour && prevValue !== null)
|
|
367
|
+
displayPrev = prevValue % 12 === 0 ? 0 : prevValue > 12 ? prevValue - 12 : prevValue
|
|
368
|
+
const { value, moveToNext } = updateTwoDigits(max, num, displayPrev, 0, false)
|
|
369
|
+
let internalValue = value
|
|
370
|
+
if (is12Hour && value !== null) {
|
|
371
|
+
const period = (values().dayPeriod as string | null) || 'AM'
|
|
372
|
+
if (value === 12) internalValue = period === 'AM' ? 0 : 12
|
|
373
|
+
else internalValue = period === 'PM' ? value + 12 : value
|
|
374
|
+
}
|
|
375
|
+
assign('hour', internalValue)
|
|
376
|
+
if (moveToNext) props.focusNext()
|
|
377
|
+
}
|
|
378
|
+
if (event.key === kbd.BACKSPACE) {
|
|
379
|
+
props.hasLeftFocus.value = false
|
|
380
|
+
assign('hour', deleteValue(prevValue))
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function handleMinuteOrSecondKeydown(event: KeyboardEvent, part: 'minute' | 'second') {
|
|
385
|
+
const dateRef = placeholder()
|
|
386
|
+
if (
|
|
387
|
+
!isAcceptableSegmentKey(event.key) ||
|
|
388
|
+
isSegmentNavigationKey(event.key) ||
|
|
389
|
+
!(part in dateRef) ||
|
|
390
|
+
!(part in values())
|
|
391
|
+
)
|
|
392
|
+
return
|
|
393
|
+
const prevValue = values()[part] as number | null
|
|
394
|
+
if (event.key === kbd.ARROW_UP || event.key === kbd.ARROW_DOWN)
|
|
395
|
+
assign(part, minuteSecondIncrementation(event, part, placeholder(), prevValue))
|
|
396
|
+
if (isNumberString(event.key)) {
|
|
397
|
+
const num = Number.parseInt(event.key)
|
|
398
|
+
const { value, moveToNext } = updateTwoDigits(59, num, prevValue, 0, false)
|
|
399
|
+
assign(part, value)
|
|
400
|
+
if (moveToNext) props.focusNext()
|
|
401
|
+
}
|
|
402
|
+
if (event.key === kbd.BACKSPACE) {
|
|
403
|
+
props.hasLeftFocus.value = false
|
|
404
|
+
assign(part, deleteValue(prevValue))
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function handleDayPeriodSegmentKeydown(event: KeyboardEvent) {
|
|
409
|
+
if (
|
|
410
|
+
((!isAcceptableSegmentKey(event.key) || isSegmentNavigationKey(event.key)) &&
|
|
411
|
+
event.key !== 'a' &&
|
|
412
|
+
event.key !== 'p') ||
|
|
413
|
+
!('hour' in placeholder()) ||
|
|
414
|
+
!('dayPeriod' in values())
|
|
415
|
+
)
|
|
416
|
+
return
|
|
417
|
+
const hour = () => values().hour as number
|
|
418
|
+
if (event.key === kbd.ARROW_UP || event.key === kbd.ARROW_DOWN) {
|
|
419
|
+
if (values().dayPeriod === 'AM') {
|
|
420
|
+
props.assign({ dayPeriod: 'PM', hour: hour() + 12 })
|
|
421
|
+
return
|
|
422
|
+
}
|
|
423
|
+
props.assign({ dayPeriod: 'AM', hour: hour() - 12 })
|
|
424
|
+
return
|
|
425
|
+
}
|
|
426
|
+
if (['a', 'A'].includes(event.key) && values().dayPeriod !== 'AM') {
|
|
427
|
+
props.assign({ dayPeriod: 'AM', hour: hour() - 12 })
|
|
428
|
+
return
|
|
429
|
+
}
|
|
430
|
+
if (['p', 'P'].includes(event.key) && values().dayPeriod !== 'PM')
|
|
431
|
+
props.assign({ dayPeriod: 'PM', hour: hour() + 12 })
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function handleSegmentClick(event: MouseEvent) {
|
|
435
|
+
if (props.disabled()) event.preventDefault()
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function commit() {
|
|
439
|
+
if (Object.values(values()).every(item => item !== null)) {
|
|
440
|
+
const dateRef = props.placeholder().set({ ...props.segmentValues() } as never)
|
|
441
|
+
props.setModelValue(dateRef.copy())
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function handleSegmentKeydown(event: KeyboardEvent) {
|
|
446
|
+
if (event.isComposing || event.key === 'Process') return
|
|
447
|
+
if (props.disabled() || props.readonly()) return
|
|
448
|
+
if (event.key !== kbd.TAB) event.preventDefault()
|
|
449
|
+
switch (props.part) {
|
|
450
|
+
case 'day':
|
|
451
|
+
case 'month':
|
|
452
|
+
case 'year':
|
|
453
|
+
handleDateSegmentKeydown(event, props.part)
|
|
454
|
+
break
|
|
455
|
+
case 'hour':
|
|
456
|
+
handleHourSegmentKeydown(event)
|
|
457
|
+
break
|
|
458
|
+
case 'minute':
|
|
459
|
+
case 'second':
|
|
460
|
+
handleMinuteOrSecondKeydown(event, props.part)
|
|
461
|
+
break
|
|
462
|
+
case 'dayPeriod':
|
|
463
|
+
handleDayPeriodSegmentKeydown(event)
|
|
464
|
+
break
|
|
465
|
+
}
|
|
466
|
+
if (
|
|
467
|
+
!([kbd.ARROW_LEFT, kbd.ARROW_RIGHT] as string[]).includes(event.key) &&
|
|
468
|
+
event.key !== kbd.TAB &&
|
|
469
|
+
event.key !== kbd.SHIFT &&
|
|
470
|
+
isAcceptableSegmentKey(event.key)
|
|
471
|
+
)
|
|
472
|
+
commit()
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function handleSegmentFocusOut() {
|
|
476
|
+
if (!props.stepSnapping()) return
|
|
477
|
+
const current = values()
|
|
478
|
+
const step = props.step()
|
|
479
|
+
if (
|
|
480
|
+
props.part === 'hour' &&
|
|
481
|
+
'hour' in current &&
|
|
482
|
+
current.hour !== null &&
|
|
483
|
+
step.hour &&
|
|
484
|
+
step.hour > 1
|
|
485
|
+
) {
|
|
486
|
+
const hour = snapValueToStep(current.hour as number, 0, 23, step.hour)
|
|
487
|
+
const next: Values = { hour }
|
|
488
|
+
if ('dayPeriod' in current) {
|
|
489
|
+
if (hour < 12) next.dayPeriod = 'AM'
|
|
490
|
+
else if (hour) next.dayPeriod = 'PM'
|
|
491
|
+
}
|
|
492
|
+
props.assign(next)
|
|
493
|
+
} else if (
|
|
494
|
+
props.part === 'minute' &&
|
|
495
|
+
'minute' in current &&
|
|
496
|
+
current.minute !== null &&
|
|
497
|
+
step.minute &&
|
|
498
|
+
step.minute > 1
|
|
499
|
+
)
|
|
500
|
+
assign('minute', snapValueToStep(current.minute as number, 0, 59, step.minute))
|
|
501
|
+
else if (
|
|
502
|
+
props.part === 'second' &&
|
|
503
|
+
'second' in current &&
|
|
504
|
+
current.second !== null &&
|
|
505
|
+
step.second &&
|
|
506
|
+
step.second > 1
|
|
507
|
+
)
|
|
508
|
+
assign('second', snapValueToStep(current.second as number, 0, 59, step.second))
|
|
509
|
+
commit()
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
let preCompositionNodes: { node: ChildNode; value: string | null }[] | null = null
|
|
513
|
+
|
|
514
|
+
function handleSegmentBeforeInput(event: InputEvent) {
|
|
515
|
+
if (!event.isComposing) event.preventDefault()
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function handleSegmentCompositionStart(event: CompositionEvent) {
|
|
519
|
+
const element = event.target as HTMLElement
|
|
520
|
+
preCompositionNodes = Array.from(element.childNodes, node => ({ node, value: node.nodeValue }))
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function handleSegmentCompositionEnd(event: CompositionEvent) {
|
|
524
|
+
const element = event.target as HTMLElement
|
|
525
|
+
const original = preCompositionNodes
|
|
526
|
+
preCompositionNodes = null
|
|
527
|
+
if (original) {
|
|
528
|
+
for (const { node, value } of original) node.nodeValue = value
|
|
529
|
+
element.replaceChildren(...original.map(entry => entry.node))
|
|
530
|
+
}
|
|
531
|
+
const data = event.data
|
|
532
|
+
if (!data) return
|
|
533
|
+
for (const char of data) {
|
|
534
|
+
if (!DIGIT_REG.test(char)) continue
|
|
535
|
+
const target = getActiveElement()
|
|
536
|
+
if (!(target instanceof HTMLElement)) break
|
|
537
|
+
target.dispatchEvent(
|
|
538
|
+
new KeyboardEvent('keydown', { key: char, bubbles: true, cancelable: true }),
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return {
|
|
544
|
+
handleSegmentClick,
|
|
545
|
+
handleSegmentKeydown,
|
|
546
|
+
handleSegmentBeforeInput,
|
|
547
|
+
handleSegmentCompositionStart,
|
|
548
|
+
handleSegmentCompositionEnd,
|
|
549
|
+
handleSegmentFocusOut,
|
|
550
|
+
}
|
|
551
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DateFormatter, getLocalTimeZone, today, type DateValue } from '@internationalized/date'
|
|
2
|
+
import { hasTime, isZonedDateTime, toDate } from './comparators'
|
|
3
|
+
|
|
4
|
+
export type Formatter = ReturnType<typeof createDateFormatter>
|
|
5
|
+
|
|
6
|
+
export function createDateFormatter(initialLocale: string, opts: Intl.DateTimeFormatOptions = {}) {
|
|
7
|
+
let locale = initialLocale
|
|
8
|
+
|
|
9
|
+
function getLocale() {
|
|
10
|
+
return locale
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function setLocale(newLocale: string) {
|
|
14
|
+
locale = newLocale
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function custom(date: Date, options: Intl.DateTimeFormatOptions) {
|
|
18
|
+
return new DateFormatter(locale, { ...opts, ...options }).format(date)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function selectedDate(date: DateValue, includeTime = true) {
|
|
22
|
+
if (hasTime(date) && includeTime)
|
|
23
|
+
return custom(toDate(date), { dateStyle: 'long', timeStyle: 'long' })
|
|
24
|
+
return custom(toDate(date), { dateStyle: 'long' })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function fullMonthAndYear(date: Date, options: Intl.DateTimeFormatOptions = {}) {
|
|
28
|
+
return new DateFormatter(locale, {
|
|
29
|
+
...opts,
|
|
30
|
+
month: 'long',
|
|
31
|
+
year: 'numeric',
|
|
32
|
+
...options,
|
|
33
|
+
}).format(date)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function fullMonth(date: Date, options: Intl.DateTimeFormatOptions = {}) {
|
|
37
|
+
return new DateFormatter(locale, { ...opts, month: 'long', ...options }).format(date)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getMonths() {
|
|
41
|
+
const defaultDate = today(getLocalTimeZone())
|
|
42
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map(item => ({
|
|
43
|
+
label: fullMonth(toDate(defaultDate.set({ month: item }))),
|
|
44
|
+
value: item,
|
|
45
|
+
}))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function fullYear(date: Date, options: Intl.DateTimeFormatOptions = {}) {
|
|
49
|
+
return new DateFormatter(locale, { ...opts, year: 'numeric', ...options }).format(date)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function toParts(date: DateValue, options?: Intl.DateTimeFormatOptions) {
|
|
53
|
+
if (isZonedDateTime(date))
|
|
54
|
+
return new DateFormatter(locale, {
|
|
55
|
+
...opts,
|
|
56
|
+
...options,
|
|
57
|
+
timeZone: date.timeZone,
|
|
58
|
+
}).formatToParts(toDate(date))
|
|
59
|
+
return new DateFormatter(locale, { ...opts, ...options }).formatToParts(toDate(date))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function dayOfWeek(date: Date, length: Intl.DateTimeFormatOptions['weekday'] = 'narrow') {
|
|
63
|
+
return new DateFormatter(locale, { ...opts, weekday: length }).format(date)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function dayPeriod(date: Date) {
|
|
67
|
+
const parts = new DateFormatter(locale, {
|
|
68
|
+
...opts,
|
|
69
|
+
hour: 'numeric',
|
|
70
|
+
minute: 'numeric',
|
|
71
|
+
}).formatToParts(date)
|
|
72
|
+
const value = parts.find(p => p.type === 'dayPeriod')?.value
|
|
73
|
+
if (value === 'PM' || value === 'pm' || value === 'p.m.') return 'PM'
|
|
74
|
+
return 'AM'
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const defaultPartOptions: Intl.DateTimeFormatOptions = {
|
|
78
|
+
year: 'numeric',
|
|
79
|
+
month: 'numeric',
|
|
80
|
+
day: 'numeric',
|
|
81
|
+
hour: 'numeric',
|
|
82
|
+
minute: 'numeric',
|
|
83
|
+
second: 'numeric',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function part(
|
|
87
|
+
dateObj: DateValue,
|
|
88
|
+
type: Intl.DateTimeFormatPartTypes,
|
|
89
|
+
options: Intl.DateTimeFormatOptions = {},
|
|
90
|
+
) {
|
|
91
|
+
const parts = toParts(dateObj, { ...defaultPartOptions, ...options })
|
|
92
|
+
const found = parts.find(p => p.type === type)
|
|
93
|
+
return found ? found.value : ''
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
setLocale,
|
|
98
|
+
getLocale,
|
|
99
|
+
fullMonth,
|
|
100
|
+
fullYear,
|
|
101
|
+
fullMonthAndYear,
|
|
102
|
+
toParts,
|
|
103
|
+
custom,
|
|
104
|
+
part,
|
|
105
|
+
dayPeriod,
|
|
106
|
+
selectedDate,
|
|
107
|
+
dayOfWeek,
|
|
108
|
+
getMonths,
|
|
109
|
+
}
|
|
110
|
+
}
|