vlite3 0.1.0 → 0.1.2
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/components/Accordion/Accordion.vue.d.ts +44 -0
- package/components/Accordion/Accordion.vue.js +95 -0
- package/components/Accordion/Accordion.vue2.js +4 -0
- package/components/Accordion/AccordionContent.vue.d.ts +22 -0
- package/components/Accordion/AccordionContent.vue.js +7 -0
- package/components/Accordion/AccordionContent.vue2.js +47 -0
- package/components/Accordion/AccordionItem.vue.d.ts +56 -0
- package/components/Accordion/AccordionItem.vue.js +115 -0
- package/components/Accordion/AccordionItem.vue2.js +4 -0
- package/components/Accordion/AccordionTrigger.vue.d.ts +43 -0
- package/components/Accordion/AccordionTrigger.vue.js +94 -0
- package/components/Accordion/AccordionTrigger.vue2.js +4 -0
- package/components/Accordion/index.d.ts +5 -0
- package/components/Accordion/types.d.ts +33 -0
- package/components/Alert.vue.d.ts +36 -0
- package/components/Alert.vue.js +84 -0
- package/components/Alert.vue2.js +4 -0
- package/components/Avatar.vue.d.ts +32 -0
- package/components/Avatar.vue.js +78 -0
- package/components/Avatar.vue2.js +4 -0
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +32 -0
- package/components/AvatarUploader/AvatarUploader.vue.js +99 -0
- package/components/AvatarUploader/AvatarUploader.vue2.js +4 -0
- package/{src/components/AvatarUploader/index.ts → components/AvatarUploader/index.d.ts} +2 -2
- package/components/Badge.vue.d.ts +25 -0
- package/components/Badge.vue.js +27 -0
- package/components/Badge.vue2.js +4 -0
- package/components/Button.vue.d.ts +26 -0
- package/components/Button.vue.js +107 -0
- package/components/Button.vue2.js +4 -0
- package/components/ButtonGroup.vue.d.ts +29 -0
- package/components/ButtonGroup.vue.js +7 -0
- package/components/ButtonGroup.vue2.js +30 -0
- package/components/Carousel/Carousel.vue.d.ts +847 -0
- package/components/Carousel/Carousel.vue.js +7 -0
- package/components/Carousel/Carousel.vue2.js +68 -0
- package/components/Carousel/index.d.ts +2 -0
- package/components/Carousel/types.d.ts +24 -0
- package/components/CheckBox.vue.d.ts +27 -0
- package/components/CheckBox.vue.js +115 -0
- package/components/CheckBox.vue2.js +4 -0
- package/components/Chip/Chip.vue.d.ts +33 -0
- package/components/Chip/Chip.vue.js +113 -0
- package/components/Chip/Chip.vue2.js +4 -0
- package/components/Chip/index.d.ts +2 -0
- package/components/Chip/types.d.ts +12 -0
- package/components/ChoiceBox/ChoiceBox.vue.d.ts +32 -0
- package/components/ChoiceBox/ChoiceBox.vue.js +141 -0
- package/components/ChoiceBox/ChoiceBox.vue2.js +4 -0
- package/components/ChoiceBox/index.d.ts +2 -0
- package/components/ColorPicker/ColorIro.vue.d.ts +18 -0
- package/components/ColorPicker/ColorIro.vue.js +142 -0
- package/components/ColorPicker/ColorIro.vue3.js +5 -0
- package/components/ColorPicker/ColorPicker.vue.d.ts +22 -0
- package/components/ColorPicker/ColorPicker.vue.js +56 -0
- package/components/ColorPicker/ColorPicker.vue2.js +4 -0
- package/components/ConfirmationModal.vue.d.ts +39 -0
- package/components/ConfirmationModal.vue.js +55 -0
- package/components/ConfirmationModal.vue2.js +4 -0
- package/components/DataTable/DataTable.vue.d.ts +60 -0
- package/components/DataTable/DataTable.vue.js +7 -0
- package/components/DataTable/DataTable.vue2.js +310 -0
- package/components/DataTable/DataTableHeader.vue.d.ts +14 -0
- package/components/DataTable/DataTableHeader.vue.js +49 -0
- package/components/DataTable/DataTableHeader.vue2.js +4 -0
- package/components/DataTable/DataTableRow.vue.d.ts +51 -0
- package/components/DataTable/DataTableRow.vue.js +114 -0
- package/components/DataTable/DataTableRow.vue2.js +4 -0
- package/components/DataTable/DataTableToolbar.vue.d.ts +31 -0
- package/components/DataTable/DataTableToolbar.vue.js +45 -0
- package/components/DataTable/DataTableToolbar.vue2.js +4 -0
- package/components/DataTable/index.d.ts +4 -0
- package/components/DataTable/types.d.ts +75 -0
- package/components/DatePicker.vue.d.ts +44 -0
- package/components/DatePicker.vue.js +84 -0
- package/components/DatePicker.vue2.js +4 -0
- package/components/Dropdown/Dropdown.vue.d.ts +105 -0
- package/components/Dropdown/Dropdown.vue.js +206 -0
- package/components/Dropdown/Dropdown.vue2.js +4 -0
- package/components/Dropdown/DropdownBooleanItem.vue.d.ts +12 -0
- package/components/Dropdown/DropdownBooleanItem.vue.js +41 -0
- package/components/Dropdown/DropdownBooleanItem.vue2.js +4 -0
- package/components/Dropdown/DropdownGroupedLayout.vue.d.ts +21 -0
- package/components/Dropdown/DropdownGroupedLayout.vue.js +73 -0
- package/components/Dropdown/DropdownGroupedLayout.vue2.js +4 -0
- package/components/Dropdown/DropdownItem.vue.d.ts +35 -0
- package/components/Dropdown/DropdownItem.vue.js +56 -0
- package/components/Dropdown/DropdownItem.vue2.js +4 -0
- package/components/Dropdown/DropdownMenu.vue.d.ts +73 -0
- package/components/Dropdown/DropdownMenu.vue.js +232 -0
- package/components/Dropdown/DropdownMenu.vue2.js +4 -0
- package/components/Dropdown/DropdownTrigger.vue.d.ts +15 -0
- package/components/Dropdown/DropdownTrigger.vue.js +26 -0
- package/components/Dropdown/DropdownTrigger.vue2.js +4 -0
- package/components/Dropdown/composables/useDropdownIds.d.ts +5 -0
- package/components/Dropdown/composables/useDropdownIds.js +20 -0
- package/components/Dropdown/composables/useDropdownNavigation.d.ts +19 -0
- package/components/Dropdown/composables/useDropdownNavigation.js +49 -0
- package/components/Dropdown/composables/useDropdownSelection.d.ts +16 -0
- package/components/Dropdown/composables/useDropdownSelection.js +41 -0
- package/components/Dropdown/index.d.ts +6 -0
- package/components/FilePicker/FilePicker.vue.d.ts +65 -0
- package/components/FilePicker/FilePicker.vue.js +285 -0
- package/components/FilePicker/FilePicker.vue2.js +4 -0
- package/components/FilePicker/index.d.ts +2 -0
- package/components/FileTree/FileTree.vue.d.ts +20 -0
- package/components/FileTree/FileTree.vue.js +139 -0
- package/components/FileTree/FileTree.vue2.js +4 -0
- package/components/FileTree/FileTreeNode.vue.d.ts +28 -0
- package/components/FileTree/FileTreeNode.vue.js +184 -0
- package/components/FileTree/FileTreeNode.vue2.js +4 -0
- package/components/FileTree/index.d.ts +4 -0
- package/components/FileTree/types.d.ts +36 -0
- package/components/FileTree/useTreeSelection.d.ts +12 -0
- package/components/FileTree/useTreeSelection.js +25 -0
- package/components/Form/CustomFields.vue.d.ts +38 -0
- package/components/Form/CustomFields.vue.js +7 -0
- package/components/Form/CustomFields.vue2.js +161 -0
- package/components/Form/Form.vue.d.ts +94 -0
- package/components/Form/Form.vue.js +7 -0
- package/components/Form/Form.vue2.js +238 -0
- package/components/Form/FormField.vue.d.ts +28 -0
- package/components/Form/FormField.vue.js +207 -0
- package/components/Form/FormField.vue2.js +4 -0
- package/components/Form/FormFields.vue.d.ts +29 -0
- package/components/Form/FormFields.vue.js +7 -0
- package/components/Form/FormFields.vue2.js +95 -0
- package/components/Form/composables/useFileUpload.d.ts +24 -0
- package/components/Form/composables/useFileUpload.js +40 -0
- package/components/Form/composables/useForm.d.ts +48 -0
- package/components/Form/composables/useForm.js +109 -0
- package/components/Form/index.d.ts +9 -0
- package/components/Form/types.d.ts +167 -0
- package/components/Form/utils/form.utils.d.ts +44 -0
- package/components/Form/utils/form.utils.js +97 -0
- package/components/Heatmap/Heatmap.vue.d.ts +26 -0
- package/components/Heatmap/Heatmap.vue.js +7 -0
- package/components/Heatmap/Heatmap.vue2.js +326 -0
- package/components/Heatmap/index.d.ts +2 -0
- package/components/Heatmap/types.d.ts +66 -0
- package/components/Icon.vue.d.ts +7 -0
- package/components/Icon.vue.js +25 -0
- package/components/Icon.vue2.js +4 -0
- package/components/IconPicker.vue.d.ts +38 -0
- package/components/IconPicker.vue.js +124 -0
- package/components/IconPicker.vue2.js +4 -0
- package/components/Input.vue.d.ts +54 -0
- package/components/Input.vue.js +267 -0
- package/components/Input.vue2.js +4 -0
- package/components/Label.vue.d.ts +23 -0
- package/components/Label.vue.js +23 -0
- package/components/Label.vue2.js +4 -0
- package/components/Logo.vue.d.ts +2 -0
- package/components/Logo.vue.js +10 -0
- package/components/Logo.vue2.js +4 -0
- package/components/Masonry/Masonry.vue.d.ts +31 -0
- package/components/Masonry/Masonry.vue.js +7 -0
- package/components/Masonry/Masonry.vue2.js +83 -0
- package/components/Masonry/index.d.ts +2 -0
- package/components/Masonry/types.d.ts +33 -0
- package/components/Masonry/types.js +10 -0
- package/components/Modal.vue.d.ts +52 -0
- package/components/Modal.vue.js +116 -0
- package/components/Modal.vue2.js +4 -0
- package/components/MultiSelect/MultiSelect.vue.d.ts +40 -0
- package/components/MultiSelect/MultiSelect.vue.js +126 -0
- package/components/MultiSelect/MultiSelect.vue2.js +4 -0
- package/components/MultiSelect/index.d.ts +1 -0
- package/components/Navbar/Navbar.vue.d.ts +51 -0
- package/components/Navbar/Navbar.vue.js +198 -0
- package/components/Navbar/Navbar.vue2.js +4 -0
- package/components/Navbar/NavbarGroup.vue.d.ts +24 -0
- package/components/Navbar/NavbarGroup.vue.js +23 -0
- package/components/Navbar/NavbarGroup.vue2.js +4 -0
- package/components/Navbar/NavbarItem.vue.d.ts +40 -0
- package/components/Navbar/NavbarItem.vue.js +104 -0
- package/components/Navbar/NavbarItem.vue2.js +4 -0
- package/components/Navbar/index.d.ts +3 -0
- package/components/OTPInput/OTPInput.vue.d.ts +33 -0
- package/components/OTPInput/OTPInput.vue.js +115 -0
- package/components/OTPInput/OTPInput.vue2.js +4 -0
- package/components/OTPInput/index.d.ts +1 -0
- package/components/Pagination/Pagination.vue.d.ts +34 -0
- package/components/Pagination/Pagination.vue.js +196 -0
- package/components/Pagination/Pagination.vue2.js +4 -0
- package/components/Pagination/index.d.ts +1 -0
- package/components/PricingPlan/PricingPlan.vue.d.ts +22 -0
- package/components/PricingPlan/PricingPlan.vue.js +55 -0
- package/components/PricingPlan/PricingPlan.vue2.js +4 -0
- package/components/PricingPlan/PricingPlanItem.vue.d.ts +17 -0
- package/components/PricingPlan/PricingPlanItem.vue.js +94 -0
- package/components/PricingPlan/PricingPlanItem.vue2.js +4 -0
- package/components/PricingPlan/index.d.ts +3 -0
- package/components/PricingPlan/types.d.ts +25 -0
- package/components/SidePanel.vue.d.ts +64 -0
- package/components/SidePanel.vue.js +7 -0
- package/components/SidePanel.vue2.js +131 -0
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +11 -0
- package/components/SidebarMenu/SidebarMenu.vue.js +78 -0
- package/components/SidebarMenu/SidebarMenu.vue2.js +4 -0
- package/components/SidebarMenu/SidebarMenuItem.vue.d.ts +9 -0
- package/components/SidebarMenu/SidebarMenuItem.vue.js +269 -0
- package/components/SidebarMenu/SidebarMenuItem.vue3.js +5 -0
- package/components/SidebarMenu/index.d.ts +3 -0
- package/components/SidebarMenu/types.d.ts +35 -0
- package/components/Slider.vue.d.ts +31 -0
- package/components/Slider.vue.js +157 -0
- package/components/Slider.vue2.js +4 -0
- package/components/Switch.vue.d.ts +16 -0
- package/components/Switch.vue.js +40 -0
- package/components/Switch.vue2.js +4 -0
- package/components/Tabes/Tabes.vue.d.ts +21 -0
- package/components/Tabes/Tabes.vue.js +75 -0
- package/components/Tabes/Tabes.vue2.js +4 -0
- package/components/Tabes/index.d.ts +2 -0
- package/components/Tabes/types.d.ts +8 -0
- package/components/Textarea.vue.d.ts +22 -0
- package/components/Textarea.vue.js +34 -0
- package/components/Textarea.vue2.js +4 -0
- package/components/ThemeToggle.vue.d.ts +2 -0
- package/components/ThemeToggle.vue.js +18 -0
- package/components/ThemeToggle.vue2.js +4 -0
- package/components/Timeline.vue.d.ts +39 -0
- package/components/Timeline.vue.js +174 -0
- package/components/Timeline.vue2.js +4 -0
- package/components/ToastNotification.vue.d.ts +7 -0
- package/components/ToastNotification.vue.js +7 -0
- package/components/ToastNotification.vue2.js +151 -0
- package/components/Tooltip.vue.d.ts +31 -0
- package/components/Tooltip.vue.js +45 -0
- package/components/Tooltip.vue2.js +4 -0
- package/components/Workbook/Sheet.vue.d.ts +38 -0
- package/components/Workbook/Sheet.vue.js +141 -0
- package/components/Workbook/Sheet.vue2.js +4 -0
- package/components/Workbook/Workbook.vue.d.ts +54 -0
- package/components/Workbook/Workbook.vue.js +7 -0
- package/components/Workbook/Workbook.vue2.js +146 -0
- package/components/Workbook/WorkbookAddButton.vue.d.ts +6 -0
- package/components/Workbook/WorkbookAddButton.vue.js +20 -0
- package/components/Workbook/WorkbookAddButton.vue2.js +4 -0
- package/components/Workbook/index.d.ts +3 -0
- package/components/Workbook/types.d.ts +34 -0
- package/composables/useKeyStroke.d.ts +21 -0
- package/composables/useKeyStroke.js +93 -0
- package/composables/useNotifications.d.ts +113 -0
- package/composables/useNotifications.js +99 -0
- package/composables/useTheme.d.ts +6 -0
- package/composables/useTheme.js +32 -0
- package/core/config.d.ts +29 -0
- package/core/config.js +12 -0
- package/core/index.d.ts +31 -0
- package/core/index.js +15 -0
- package/directives/vRipple.d.ts +4 -0
- package/directives/vRipple.js +17 -0
- package/index.d.ts +49 -0
- package/index.js +156 -0
- package/package.json +2 -2
- package/style.css +590 -0
- package/types/alert.type.d.ts +10 -0
- package/{src/types/avatar.type.ts → types/avatar.type.d.ts} +8 -9
- package/types/button.d.ts +15 -0
- package/types/buttongroup.type.d.ts +1 -0
- package/{src/types/config.type.ts → types/config.type.d.ts} +13 -16
- package/types/form.type.d.ts +45 -0
- package/types/index.d.ts +10 -0
- package/types/navbar.type.d.ts +27 -0
- package/types/sidepanel.type.d.ts +13 -0
- package/types/styles.d.ts +28 -0
- package/types/timeline.type.d.ts +9 -0
- package/{src/utils/functions.ts → utils/functions.d.ts} +1 -9
- package/utils/functions.js +11 -0
- package/utils/index.d.ts +2 -0
- package/utils/object.d.ts +6 -0
- package/utils/object.js +14 -0
- package/.vscode/extensions.json +0 -3
- package/LICENSE +0 -21
- package/index.html +0 -16
- package/scripts/bundle-css.js +0 -45
- package/src/App.vue +0 -7
- package/src/components/Accordion/Accordion.vue +0 -139
- package/src/components/Accordion/AccordionContent.vue +0 -63
- package/src/components/Accordion/AccordionItem.vue +0 -163
- package/src/components/Accordion/AccordionTrigger.vue +0 -125
- package/src/components/Accordion/index.ts +0 -5
- package/src/components/Accordion/types.ts +0 -41
- package/src/components/Alert.vue +0 -112
- package/src/components/Avatar.vue +0 -110
- package/src/components/AvatarUploader/AvatarUploader.vue +0 -129
- package/src/components/Badge.vue +0 -45
- package/src/components/Button.vue +0 -122
- package/src/components/ButtonGroup.vue +0 -173
- package/src/components/Carousel/Carousel.vue +0 -84
- package/src/components/Carousel/index.ts +0 -2
- package/src/components/Carousel/types.ts +0 -25
- package/src/components/CheckBox.vue +0 -132
- package/src/components/Chip/Chip.vue +0 -158
- package/src/components/Chip/index.ts +0 -2
- package/src/components/Chip/types.ts +0 -23
- package/src/components/ChoiceBox/ChoiceBox.vue +0 -181
- package/src/components/ChoiceBox/index.ts +0 -2
- package/src/components/ColorPicker/ColorIro.vue +0 -207
- package/src/components/ColorPicker/ColorPicker.vue +0 -61
- package/src/components/ConfirmationModal.vue +0 -46
- package/src/components/DataTable/DataTable.vue +0 -478
- package/src/components/DataTable/DataTableHeader.vue +0 -78
- package/src/components/DataTable/DataTableRow.vue +0 -171
- package/src/components/DataTable/DataTableToolbar.vue +0 -45
- package/src/components/DataTable/index.ts +0 -5
- package/src/components/DataTable/types.ts +0 -85
- package/src/components/DatePicker.vue +0 -102
- package/src/components/Dropdown/Dropdown.vue +0 -348
- package/src/components/Dropdown/DropdownBooleanItem.vue +0 -40
- package/src/components/Dropdown/DropdownGroupedLayout.vue +0 -115
- package/src/components/Dropdown/DropdownItem.vue +0 -56
- package/src/components/Dropdown/DropdownMenu.vue +0 -374
- package/src/components/Dropdown/DropdownTrigger.vue +0 -27
- package/src/components/Dropdown/composables/useDropdownIds.ts +0 -27
- package/src/components/Dropdown/composables/useDropdownNavigation.ts +0 -109
- package/src/components/Dropdown/composables/useDropdownSelection.ts +0 -106
- package/src/components/Dropdown/index.ts +0 -6
- package/src/components/FilePicker/FilePicker.vue +0 -459
- package/src/components/FilePicker/index.ts +0 -2
- package/src/components/FileTree/FileTree.vue +0 -334
- package/src/components/FileTree/FileTreeNode.vue +0 -225
- package/src/components/FileTree/index.ts +0 -2
- package/src/components/FileTree/types.ts +0 -31
- package/src/components/FileTree/useTreeSelection.ts +0 -66
- package/src/components/Form/CustomFields.vue +0 -294
- package/src/components/Form/Form.vue +0 -406
- package/src/components/Form/FormField.vue +0 -404
- package/src/components/Form/FormFields.vue +0 -161
- package/src/components/Form/composables/useFileUpload.ts +0 -112
- package/src/components/Form/composables/useForm.ts +0 -356
- package/src/components/Form/index.ts +0 -16
- package/src/components/Form/types.ts +0 -203
- package/src/components/Form/utils/form.utils.ts +0 -209
- package/src/components/Heatmap/Heatmap.vue +0 -629
- package/src/components/Heatmap/index.ts +0 -2
- package/src/components/Heatmap/types.ts +0 -84
- package/src/components/Icon.vue +0 -47
- package/src/components/IconPicker.vue +0 -138
- package/src/components/Input.vue +0 -366
- package/src/components/Label.vue +0 -25
- package/src/components/Logo.vue +0 -5
- package/src/components/Masonry/Masonry.vue +0 -148
- package/src/components/Masonry/index.ts +0 -2
- package/src/components/Masonry/types.ts +0 -44
- package/src/components/Modal.vue +0 -135
- package/src/components/MultiSelect/MultiSelect.vue +0 -176
- package/src/components/MultiSelect/index.ts +0 -1
- package/src/components/Navbar/Navbar.vue +0 -277
- package/src/components/Navbar/NavbarGroup.vue +0 -27
- package/src/components/Navbar/NavbarItem.vue +0 -124
- package/src/components/Navbar/index.ts +0 -3
- package/src/components/OTPInput/OTPInput.vue +0 -220
- package/src/components/OTPInput/index.ts +0 -1
- package/src/components/Pagination/Pagination.vue +0 -238
- package/src/components/Pagination/index.ts +0 -1
- package/src/components/PricingPlan/PricingPlan.vue +0 -102
- package/src/components/PricingPlan/PricingPlanItem.vue +0 -148
- package/src/components/PricingPlan/index.ts +0 -3
- package/src/components/PricingPlan/types.ts +0 -29
- package/src/components/SidePanel.vue +0 -184
- package/src/components/SidebarMenu/SidebarMenu.vue +0 -146
- package/src/components/SidebarMenu/SidebarMenuItem.vue +0 -333
- package/src/components/SidebarMenu/index.ts +0 -3
- package/src/components/SidebarMenu/types.ts +0 -54
- package/src/components/Slider.vue +0 -181
- package/src/components/Switch.vue +0 -51
- package/src/components/Tabes/Tabes.vue +0 -112
- package/src/components/Tabes/index.ts +0 -2
- package/src/components/Tabes/types.ts +0 -17
- package/src/components/Textarea.vue +0 -48
- package/src/components/ThemeToggle.vue +0 -14
- package/src/components/Timeline.vue +0 -250
- package/src/components/ToastNotification.vue +0 -257
- package/src/components/Tooltip.vue +0 -25
- package/src/components/Workbook/Sheet.vue +0 -185
- package/src/components/Workbook/Workbook.vue +0 -231
- package/src/components/Workbook/WorkbookAddButton.vue +0 -17
- package/src/components/Workbook/index.ts +0 -3
- package/src/components/Workbook/types.ts +0 -43
- package/src/composables/useKeyStroke.ts +0 -291
- package/src/composables/useNotifications.ts +0 -206
- package/src/composables/useTheme.ts +0 -55
- package/src/core/config.ts +0 -37
- package/src/core/index.ts +0 -49
- package/src/css/base.css +0 -148
- package/src/css/input.css +0 -61
- package/src/css/main.css +0 -6
- package/src/css/theme.css +0 -344
- package/src/directives/vRipple.ts +0 -38
- package/src/index.ts +0 -53
- package/src/main.ts +0 -5
- package/src/playground/Playground.vue +0 -429
- package/src/playground/composables/useGetUsers.ts +0 -538
- package/src/playground/demos/AccordionDemo.vue +0 -361
- package/src/playground/demos/AlertDemo.vue +0 -36
- package/src/playground/demos/AvatarDemo.vue +0 -41
- package/src/playground/demos/AvatarUploaderDemo.vue +0 -133
- package/src/playground/demos/BadgeDemo.vue +0 -31
- package/src/playground/demos/BadgesDemo.vue +0 -26
- package/src/playground/demos/ButtonDemo.vue +0 -99
- package/src/playground/demos/ButtonGroupDemo.vue +0 -39
- package/src/playground/demos/ButtonsDemo.vue +0 -111
- package/src/playground/demos/CarouselDemo.vue +0 -135
- package/src/playground/demos/CheckBoxDemo.vue +0 -43
- package/src/playground/demos/ChipDemo.vue +0 -190
- package/src/playground/demos/ChoiceBoxDemo.vue +0 -160
- package/src/playground/demos/ColorPickerDemo.vue +0 -30
- package/src/playground/demos/ColorsDemo.vue +0 -295
- package/src/playground/demos/DataTableDemo.vue +0 -215
- package/src/playground/demos/DatePickerDemo.vue +0 -43
- package/src/playground/demos/DisplayDemo.vue +0 -101
- package/src/playground/demos/DropdownDemo.vue +0 -651
- package/src/playground/demos/FilePickerDemo.vue +0 -175
- package/src/playground/demos/FileTreeDemo.vue +0 -150
- package/src/playground/demos/FormDemo.vue +0 -1144
- package/src/playground/demos/HeatmapDemo.vue +0 -467
- package/src/playground/demos/IconPickerDemo.vue +0 -27
- package/src/playground/demos/InputDemo.vue +0 -80
- package/src/playground/demos/InputsDemo.vue +0 -127
- package/src/playground/demos/LabelDemo.vue +0 -32
- package/src/playground/demos/MasonryDemo.vue +0 -241
- package/src/playground/demos/ModalDemo.vue +0 -67
- package/src/playground/demos/MultiSelectDemo.vue +0 -300
- package/src/playground/demos/NavbarDemo.vue +0 -59
- package/src/playground/demos/NavigationDemo.vue +0 -116
- package/src/playground/demos/OTPInputDemo.vue +0 -170
- package/src/playground/demos/OverlaysDemo.vue +0 -104
- package/src/playground/demos/PaginationDemo.vue +0 -130
- package/src/playground/demos/PricingPlanDemo.vue +0 -110
- package/src/playground/demos/SidePanelDemo.vue +0 -45
- package/src/playground/demos/SidebarMenuDemo.vue +0 -170
- package/src/playground/demos/SliderDemo.vue +0 -48
- package/src/playground/demos/SwitchDemo.vue +0 -40
- package/src/playground/demos/TabesDemo.vue +0 -178
- package/src/playground/demos/TextareaDemo.vue +0 -31
- package/src/playground/demos/ThemeToggleDemo.vue +0 -20
- package/src/playground/demos/TimelineDemo.vue +0 -43
- package/src/playground/demos/ToastDemo.vue +0 -111
- package/src/playground/demos/TooltipDemo.vue +0 -30
- package/src/playground/demos/WorkbookDemo.vue +0 -227
- package/src/types/alert.type.ts +0 -11
- package/src/types/button.ts +0 -36
- package/src/types/buttongroup.type.ts +0 -1
- package/src/types/form.type.ts +0 -75
- package/src/types/index.ts +0 -11
- package/src/types/navbar.type.ts +0 -28
- package/src/types/sidepanel.type.ts +0 -14
- package/src/types/styles.ts +0 -42
- package/src/types/timeline.type.ts +0 -11
- package/src/utils/index.ts +0 -2
- package/src/utils/object.ts +0 -40
- package/tsconfig.app.json +0 -27
- package/tsconfig.json +0 -48
- package/tsconfig.node.json +0 -18
- package/tsconfig.node.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- package/vercel.json +0 -8
- package/vite.config.d.ts +0 -2
- package/vite.config.js +0 -63
- package/vite.config.ts +0 -64
- package/vite.config.vercel.ts +0 -17
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
computed,
|
|
4
|
-
ref,
|
|
5
|
-
watch,
|
|
6
|
-
onMounted,
|
|
7
|
-
onBeforeUnmount,
|
|
8
|
-
defineAsyncComponent,
|
|
9
|
-
nextTick,
|
|
10
|
-
toRef,
|
|
11
|
-
} from 'vue'
|
|
12
|
-
import Icon from '../Icon.vue'
|
|
13
|
-
import type { IDropdownOptions, IDropdownOption } from '@/types'
|
|
14
|
-
import Input from '../Input.vue'
|
|
15
|
-
import DropdownItem from './DropdownItem.vue'
|
|
16
|
-
import DropdownBooleanItem from './DropdownBooleanItem.vue'
|
|
17
|
-
import DropdownGroupedLayout from './DropdownGroupedLayout.vue'
|
|
18
|
-
import { useDropdownNavigation } from './composables/useDropdownNavigation'
|
|
19
|
-
import { useDropdownIds } from './composables/useDropdownIds'
|
|
20
|
-
|
|
21
|
-
// Async import for recursion
|
|
22
|
-
const Dropdown = defineAsyncComponent(() => import('./Dropdown.vue'))
|
|
23
|
-
|
|
24
|
-
interface Props {
|
|
25
|
-
options?: IDropdownOptions
|
|
26
|
-
cachedOptions?: IDropdownOptions
|
|
27
|
-
selected?: any
|
|
28
|
-
selectedIndex?: number | null
|
|
29
|
-
class?: string
|
|
30
|
-
maxHeight?: string
|
|
31
|
-
nestedPosition?: any
|
|
32
|
-
nestedOffset?: [number, number]
|
|
33
|
-
selectable?: boolean
|
|
34
|
-
layout?: 'default' | 'grouped'
|
|
35
|
-
columns?: number | string
|
|
36
|
-
// Pagination & Search
|
|
37
|
-
loading?: boolean
|
|
38
|
-
hasMore?: boolean
|
|
39
|
-
searchable?: boolean
|
|
40
|
-
remote?: boolean
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
44
|
-
options: () => [],
|
|
45
|
-
cachedOptions: () => [],
|
|
46
|
-
class: '',
|
|
47
|
-
maxHeight: '300px',
|
|
48
|
-
selectedIndex: null,
|
|
49
|
-
nestedPosition: 'right-start',
|
|
50
|
-
nestedOffset: () => [0, -5],
|
|
51
|
-
selectable: true,
|
|
52
|
-
layout: 'default',
|
|
53
|
-
columns: 3,
|
|
54
|
-
loading: false,
|
|
55
|
-
hasMore: false,
|
|
56
|
-
searchable: true,
|
|
57
|
-
remote: false,
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const emit = defineEmits<{
|
|
61
|
-
(e: 'select', option: IDropdownOption): void
|
|
62
|
-
(e: 'close'): void
|
|
63
|
-
(e: 'load-more'): void
|
|
64
|
-
(e: 'search', query: string): void
|
|
65
|
-
}>()
|
|
66
|
-
|
|
67
|
-
const containerRef = ref<HTMLElement | null>(null)
|
|
68
|
-
const searchQuery = ref('')
|
|
69
|
-
const { getMenuId, getAllRecursiveIds } = useDropdownIds()
|
|
70
|
-
|
|
71
|
-
// --- Search Logic ---
|
|
72
|
-
const showSearch = computed(() => {
|
|
73
|
-
// If remote, respect searchable prop. If local, use existing > 10 logic or force searchable.
|
|
74
|
-
if (props.remote) return props.searchable
|
|
75
|
-
return props.searchable && (props.options?.length || 0) > 9
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
let debounceTimer: ReturnType<typeof setTimeout> | null = null
|
|
79
|
-
|
|
80
|
-
watch(searchQuery, (newQuery) => {
|
|
81
|
-
if (props.remote) {
|
|
82
|
-
if (debounceTimer) clearTimeout(debounceTimer)
|
|
83
|
-
debounceTimer = setTimeout(() => {
|
|
84
|
-
if (newQuery) {
|
|
85
|
-
emit('search', newQuery)
|
|
86
|
-
}
|
|
87
|
-
}, 100)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
// --- Scroll / Pagination Logic ---
|
|
92
|
-
const handleScroll = (e: Event) => {
|
|
93
|
-
const el = e.target as HTMLElement
|
|
94
|
-
// Threshold: 20px from bottom (or 50px?)
|
|
95
|
-
const threshold = 50
|
|
96
|
-
const isNearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - threshold
|
|
97
|
-
|
|
98
|
-
if (isNearBottom && props.hasMore && !props.loading) {
|
|
99
|
-
emit('load-more')
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const handleSelect = (option: IDropdownOption, index?: number) => {
|
|
104
|
-
if (option.disabled) return
|
|
105
|
-
emit('select', option)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const {
|
|
109
|
-
focusedIndex,
|
|
110
|
-
isKeyboardMode,
|
|
111
|
-
filteredOptions: navFilteredOptions, // rename
|
|
112
|
-
handleKeyDown,
|
|
113
|
-
handleMouseMove,
|
|
114
|
-
onMouseEnterItem,
|
|
115
|
-
scrollToIndex,
|
|
116
|
-
} = useDropdownNavigation({
|
|
117
|
-
options: toRef(props, 'options'),
|
|
118
|
-
searchQuery,
|
|
119
|
-
containerRef,
|
|
120
|
-
emit: (event: string, ...args: any[]) => (emit as any)(event, ...args),
|
|
121
|
-
handleSelect: (opt, idx) => handleSelect(opt, idx),
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// Fix for Remote Filtering:
|
|
125
|
-
// If remote is true:
|
|
126
|
-
// - If Query is empty: Show Cached Options (Full History)
|
|
127
|
-
// - If Query exists: Show Props.Options (Current Search Results)
|
|
128
|
-
const filteredOptions = computed(() => {
|
|
129
|
-
if (props.remote) {
|
|
130
|
-
if (!searchQuery.value) {
|
|
131
|
-
return props.cachedOptions.length ? props.cachedOptions : props.options
|
|
132
|
-
}
|
|
133
|
-
return props.options
|
|
134
|
-
}
|
|
135
|
-
return navFilteredOptions.value
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
// Recursive Helper
|
|
139
|
-
const getChildSelected = (option: IDropdownOption) => {
|
|
140
|
-
if (!props.selected || typeof props.selected !== 'object') return undefined
|
|
141
|
-
if (option.key && option.key in props.selected) {
|
|
142
|
-
return props.selected[option.key]
|
|
143
|
-
}
|
|
144
|
-
return undefined
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const isOptionSelected = (option: IDropdownOption) => {
|
|
148
|
-
if (option.disabled) return false
|
|
149
|
-
|
|
150
|
-
if (Array.isArray(props.selected)) {
|
|
151
|
-
return props.selected.includes(option.value)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (props.selected && typeof props.selected === 'object') {
|
|
155
|
-
if (option.key) {
|
|
156
|
-
return props.selected[option.key] === option.value
|
|
157
|
-
}
|
|
158
|
-
return props.selected === option.value
|
|
159
|
-
}
|
|
160
|
-
return props.selected === option.value
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Boolean option helpers
|
|
164
|
-
const getBooleanValue = (option: IDropdownOption): boolean => {
|
|
165
|
-
if (!option.key || !props.selected || typeof props.selected !== 'object') {
|
|
166
|
-
return false
|
|
167
|
-
}
|
|
168
|
-
return !!props.selected[option.key]
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const handleBooleanChange = (value: boolean, option: IDropdownOption) => {
|
|
172
|
-
if (!option.key) return
|
|
173
|
-
|
|
174
|
-
const virtualOption: IDropdownOption = {
|
|
175
|
-
label: option.label,
|
|
176
|
-
value: value,
|
|
177
|
-
key: option.key,
|
|
178
|
-
data: option.data,
|
|
179
|
-
}
|
|
180
|
-
emit('select', virtualOption)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const handleRecursiveSelect = (
|
|
184
|
-
parentOption: IDropdownOption,
|
|
185
|
-
payload: { value: any; data?: any }
|
|
186
|
-
) => {
|
|
187
|
-
let valueToEmit = payload.value
|
|
188
|
-
|
|
189
|
-
if (parentOption.key) {
|
|
190
|
-
valueToEmit = { [parentOption.key]: valueToEmit }
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const virtualOption: IDropdownOption = {
|
|
194
|
-
label: parentOption.label,
|
|
195
|
-
value: valueToEmit,
|
|
196
|
-
data: payload.data,
|
|
197
|
-
key: parentOption.key,
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
emit('select', virtualOption)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Initial Scroll Logic
|
|
204
|
-
const scrollToSelected = async () => {
|
|
205
|
-
await nextTick()
|
|
206
|
-
let targetIndex = -1
|
|
207
|
-
|
|
208
|
-
// Scroll logic mainly for 'default' linear list.
|
|
209
|
-
// For grouped, we might need different logic, but skip for now as 'scrollToIndex' assumes linear list refs.
|
|
210
|
-
if (props.layout === 'grouped') return
|
|
211
|
-
|
|
212
|
-
if (props.selectedIndex !== null && props.selectedIndex >= 0) {
|
|
213
|
-
targetIndex = props.selectedIndex
|
|
214
|
-
} else if (props.selected !== undefined && typeof props.selected !== 'object') {
|
|
215
|
-
targetIndex = props.options.findIndex((opt) => opt.value === props.selected)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (targetIndex !== -1) {
|
|
219
|
-
scrollToIndex(targetIndex)
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
watch(
|
|
224
|
-
() => filteredOptions.value,
|
|
225
|
-
() => {
|
|
226
|
-
focusedIndex.value = -1
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
onMounted(() => {
|
|
231
|
-
scrollToSelected()
|
|
232
|
-
window.addEventListener('keydown', handleKeyDown)
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
onBeforeUnmount(() => {
|
|
236
|
-
window.removeEventListener('keydown', handleKeyDown)
|
|
237
|
-
})
|
|
238
|
-
</script>
|
|
239
|
-
|
|
240
|
-
<template>
|
|
241
|
-
<div class="dropdown-menu w-full min-w-[150px] flex flex-col">
|
|
242
|
-
<!-- Fixed Search -->
|
|
243
|
-
<div v-if="showSearch" class="bg-body border-b mb-1 z-10 rounded-t-md shrink-0">
|
|
244
|
-
<Input
|
|
245
|
-
v-model="searchQuery"
|
|
246
|
-
placeholder="Search..."
|
|
247
|
-
icon="lucide:search"
|
|
248
|
-
size="sm"
|
|
249
|
-
variant="transparent"
|
|
250
|
-
:show-clear-button="false" />
|
|
251
|
-
</div>
|
|
252
|
-
|
|
253
|
-
<!-- Fixed Header Slot -->
|
|
254
|
-
<div v-if="$slots.header" class="shrink-0">
|
|
255
|
-
<slot name="header" />
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
<!-- Scrollable Options Area -->
|
|
259
|
-
<div
|
|
260
|
-
ref="containerRef"
|
|
261
|
-
tabindex="0"
|
|
262
|
-
role="menu"
|
|
263
|
-
:class="[
|
|
264
|
-
'w-full p-1 space-y-0.5 overflow-y-auto overflow-x-hidden focus:outline-none flex-1',
|
|
265
|
-
props.class,
|
|
266
|
-
]"
|
|
267
|
-
:style="{ maxHeight: props.maxHeight }"
|
|
268
|
-
@mousemove="handleMouseMove"
|
|
269
|
-
@scroll="handleScroll">
|
|
270
|
-
<!-- No header slot here anymore -->
|
|
271
|
-
|
|
272
|
-
<div
|
|
273
|
-
v-if="filteredOptions.length === 0 && options?.length > 0 && !loading"
|
|
274
|
-
class="px-2 py-6 text-center text-sm text-muted-foreground">
|
|
275
|
-
No options found
|
|
276
|
-
</div>
|
|
277
|
-
|
|
278
|
-
<!-- GROUPED MODE -->
|
|
279
|
-
<template v-if="layout === 'grouped'">
|
|
280
|
-
<DropdownGroupedLayout
|
|
281
|
-
:options="filteredOptions"
|
|
282
|
-
:selected="selected"
|
|
283
|
-
:selectable="selectable"
|
|
284
|
-
:columns="columns"
|
|
285
|
-
@select="handleSelect" />
|
|
286
|
-
</template>
|
|
287
|
-
|
|
288
|
-
<!-- DEFAULT RECURSIVE MODE -->
|
|
289
|
-
<template v-else>
|
|
290
|
-
<template v-for="(option, index) in filteredOptions" :key="index">
|
|
291
|
-
<!-- Divider -->
|
|
292
|
-
<div v-if="option.label === '---'" class="h-px bg-border my-1 mx-1" />
|
|
293
|
-
|
|
294
|
-
<!-- Boolean Toggle Item -->
|
|
295
|
-
<DropdownBooleanItem
|
|
296
|
-
v-else-if="option.data?.isBoolean"
|
|
297
|
-
:option="option"
|
|
298
|
-
:value="getBooleanValue(option)"
|
|
299
|
-
:focused="isKeyboardMode && focusedIndex === index"
|
|
300
|
-
@change="handleBooleanChange"
|
|
301
|
-
@mouseenter="onMouseEnterItem(index)" />
|
|
302
|
-
|
|
303
|
-
<!-- Nested Dropdown -->
|
|
304
|
-
<template v-else-if="option.children && option.children.length > 0">
|
|
305
|
-
<Dropdown
|
|
306
|
-
:position="option.position || props.nestedPosition"
|
|
307
|
-
:offset="option.offset || props.nestedOffset"
|
|
308
|
-
class="w-full"
|
|
309
|
-
:options="option.children"
|
|
310
|
-
:selected="getChildSelected(option)"
|
|
311
|
-
:menuId="getMenuId(option)"
|
|
312
|
-
:nestedPosition="props.nestedPosition"
|
|
313
|
-
:nestedOffset="props.nestedOffset"
|
|
314
|
-
:selectable="props.selectable"
|
|
315
|
-
:ignoreClickOutside="getAllRecursiveIds(option.children)"
|
|
316
|
-
@onSelect="(payload: any) => handleRecursiveSelect(option, payload)">
|
|
317
|
-
<template #trigger>
|
|
318
|
-
<div
|
|
319
|
-
data-dropdown-item
|
|
320
|
-
class="relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors justify-between w-full"
|
|
321
|
-
:class="[
|
|
322
|
-
isKeyboardMode && focusedIndex === index
|
|
323
|
-
? 'bg-accent text-accent-foreground'
|
|
324
|
-
: 'hover:bg-accent hover:text-accent-foreground',
|
|
325
|
-
option.disabled ? 'opacity-50 cursor-not-allowed' : '',
|
|
326
|
-
]"
|
|
327
|
-
@mouseenter="onMouseEnterItem(index)">
|
|
328
|
-
<div class="flex items-center gap-2 flex-1 min-w-0">
|
|
329
|
-
<Icon
|
|
330
|
-
v-if="option.icon"
|
|
331
|
-
:icon="option.icon"
|
|
332
|
-
class="h-4 w-4 shrink-0 opacity-70" />
|
|
333
|
-
<span class="truncate">{{ option.label }}</span>
|
|
334
|
-
</div>
|
|
335
|
-
<Icon
|
|
336
|
-
icon="lucide:chevron-right"
|
|
337
|
-
class="h-4 w-4 text-muted-foreground shrink-0 ml-2" />
|
|
338
|
-
</div>
|
|
339
|
-
</template>
|
|
340
|
-
</Dropdown>
|
|
341
|
-
</template>
|
|
342
|
-
|
|
343
|
-
<!-- Standard Item -->
|
|
344
|
-
<DropdownItem
|
|
345
|
-
v-else
|
|
346
|
-
:option="option"
|
|
347
|
-
:index="index"
|
|
348
|
-
:selected="isOptionSelected(option)"
|
|
349
|
-
:focused="isKeyboardMode && focusedIndex === index"
|
|
350
|
-
:selectable="selectable"
|
|
351
|
-
@click="handleSelect(option, index)"
|
|
352
|
-
@mouseenter="onMouseEnterItem(index)">
|
|
353
|
-
<template #default="slotProps">
|
|
354
|
-
<slot name="item" v-bind="slotProps" />
|
|
355
|
-
</template>
|
|
356
|
-
</DropdownItem>
|
|
357
|
-
</template>
|
|
358
|
-
</template>
|
|
359
|
-
|
|
360
|
-
<!-- Loading Spinner -->
|
|
361
|
-
<div v-if="loading" class="flex justify-center py-2">
|
|
362
|
-
<Icon icon="lucide:loader-2" class="w-4 h-4 animate-spin text-muted-foreground" />
|
|
363
|
-
</div>
|
|
364
|
-
|
|
365
|
-
<slot name="menu" />
|
|
366
|
-
<!-- No footer slot here anymore -->
|
|
367
|
-
</div>
|
|
368
|
-
|
|
369
|
-
<!-- Fixed Footer Slot -->
|
|
370
|
-
<div v-if="$slots.footer" class="shrink-0 border-t mt-1 pt-1">
|
|
371
|
-
<slot name="footer" />
|
|
372
|
-
</div>
|
|
373
|
-
</div>
|
|
374
|
-
</template>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Button from '@/components/Button.vue'
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
selectedLabel?: string
|
|
6
|
-
placeholder?: string
|
|
7
|
-
isOpen?: boolean
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
className?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
13
|
-
selectedLabel: '',
|
|
14
|
-
placeholder: 'Select an option',
|
|
15
|
-
disabled: false,
|
|
16
|
-
})
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
<Button
|
|
21
|
-
:text="selectedLabel || placeholder"
|
|
22
|
-
iconRight="iconamoon:arrow-down-2"
|
|
23
|
-
variant="outline"
|
|
24
|
-
:disabled="disabled"
|
|
25
|
-
class="w-full justify-between! font-normal"
|
|
26
|
-
:class="className" />
|
|
27
|
-
</template>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IDropdownOption, IDropdownOptions } from '@/types'
|
|
2
|
-
|
|
3
|
-
export function useDropdownIds() {
|
|
4
|
-
const getMenuId = (option: IDropdownOption) => {
|
|
5
|
-
if (option.key) return `nested-${option.key}`
|
|
6
|
-
const cleanLabel = option.label ? option.label.replace(/\s+/g, '-').toLowerCase() : 'menu'
|
|
7
|
-
return `nested-${cleanLabel}`
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const getAllRecursiveIds = (options: IDropdownOptions = []): string[] => {
|
|
11
|
-
const ids: string[] = []
|
|
12
|
-
options.forEach((opt) => {
|
|
13
|
-
if (opt.children?.length) {
|
|
14
|
-
const id = getMenuId(opt)
|
|
15
|
-
ids.push(`#${id}`)
|
|
16
|
-
const childIds = getAllRecursiveIds(opt.children)
|
|
17
|
-
ids.push(...childIds)
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
return ids
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
getMenuId,
|
|
25
|
-
getAllRecursiveIds,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { ref, computed, nextTick, type Ref } from 'vue'
|
|
2
|
-
import type { IDropdownOption, IDropdownOptions } from '@/types'
|
|
3
|
-
|
|
4
|
-
interface UseDropdownNavigationProps {
|
|
5
|
-
options: Ref<IDropdownOptions>
|
|
6
|
-
searchQuery: Ref<string>
|
|
7
|
-
containerRef: Ref<HTMLElement | null>
|
|
8
|
-
emit: (event: 'select' | 'close', ...args: any[]) => void
|
|
9
|
-
handleSelect: (option: IDropdownOption, index: number) => void
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function useDropdownNavigation(props: UseDropdownNavigationProps) {
|
|
13
|
-
const focusedIndex = ref(-1)
|
|
14
|
-
const isKeyboardMode = ref(false)
|
|
15
|
-
|
|
16
|
-
const filteredOptions = computed(() => {
|
|
17
|
-
const opts = props.options.value
|
|
18
|
-
if (!props.searchQuery.value) return opts
|
|
19
|
-
|
|
20
|
-
const query = props.searchQuery.value.toLowerCase()
|
|
21
|
-
return opts.filter((option) => option.label.toLowerCase().includes(query))
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const scrollToIndex = (index: number) => {
|
|
25
|
-
if (!props.containerRef.value || index < 0) return
|
|
26
|
-
|
|
27
|
-
const items = props.containerRef.value.querySelectorAll('[data-dropdown-item]')
|
|
28
|
-
const targetItem = items[index] as HTMLElement
|
|
29
|
-
|
|
30
|
-
if (targetItem) {
|
|
31
|
-
targetItem.scrollIntoView({ block: 'nearest' })
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
36
|
-
const visibleOptions = filteredOptions.value
|
|
37
|
-
|
|
38
|
-
if (visibleOptions.length === 0) return
|
|
39
|
-
|
|
40
|
-
if (['ArrowDown', 'ArrowUp', 'Enter'].includes(e.key)) {
|
|
41
|
-
isKeyboardMode.value = true
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
switch (e.key) {
|
|
45
|
-
case 'ArrowDown':
|
|
46
|
-
e.preventDefault()
|
|
47
|
-
e.stopPropagation()
|
|
48
|
-
if (focusedIndex.value < visibleOptions.length - 1) {
|
|
49
|
-
focusedIndex.value++
|
|
50
|
-
} else {
|
|
51
|
-
focusedIndex.value = 0
|
|
52
|
-
}
|
|
53
|
-
scrollToIndex(focusedIndex.value)
|
|
54
|
-
break
|
|
55
|
-
|
|
56
|
-
case 'ArrowUp':
|
|
57
|
-
e.preventDefault()
|
|
58
|
-
e.stopPropagation()
|
|
59
|
-
if (focusedIndex.value > 0) {
|
|
60
|
-
focusedIndex.value--
|
|
61
|
-
} else if (focusedIndex.value === -1) {
|
|
62
|
-
focusedIndex.value = visibleOptions.length - 1
|
|
63
|
-
} else {
|
|
64
|
-
focusedIndex.value = visibleOptions.length - 1
|
|
65
|
-
}
|
|
66
|
-
scrollToIndex(focusedIndex.value)
|
|
67
|
-
break
|
|
68
|
-
|
|
69
|
-
case 'Enter':
|
|
70
|
-
e.preventDefault()
|
|
71
|
-
e.stopPropagation()
|
|
72
|
-
if (focusedIndex.value >= 0 && focusedIndex.value < visibleOptions.length) {
|
|
73
|
-
const option = visibleOptions[focusedIndex.value]
|
|
74
|
-
// If it's a recursive item, Enter might not open it correctly unless we programmatically open the generic Dropdown?
|
|
75
|
-
// For now, strictly handle leaf selection.
|
|
76
|
-
if (!option.children) {
|
|
77
|
-
props.handleSelect(option, focusedIndex.value)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
break
|
|
81
|
-
|
|
82
|
-
case 'Escape':
|
|
83
|
-
e.preventDefault()
|
|
84
|
-
e.stopPropagation()
|
|
85
|
-
props.emit('close')
|
|
86
|
-
break
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const handleMouseMove = () => {
|
|
91
|
-
if (isKeyboardMode.value) {
|
|
92
|
-
isKeyboardMode.value = false
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const onMouseEnterItem = (index: number) => {
|
|
97
|
-
focusedIndex.value = index
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
focusedIndex,
|
|
102
|
-
isKeyboardMode,
|
|
103
|
-
filteredOptions,
|
|
104
|
-
handleKeyDown,
|
|
105
|
-
handleMouseMove,
|
|
106
|
-
onMouseEnterItem,
|
|
107
|
-
scrollToIndex,
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue'
|
|
2
|
-
import { deepMerge } from '@/utils/object'
|
|
3
|
-
import type { IDropdownOption, IDropdownOptions } from '@/types'
|
|
4
|
-
|
|
5
|
-
interface UseDropdownSelectionProps {
|
|
6
|
-
modelValue: any
|
|
7
|
-
selected?: any
|
|
8
|
-
toggleSelection?: boolean
|
|
9
|
-
showSelectedLabel?: boolean
|
|
10
|
-
selectable?: boolean
|
|
11
|
-
options?: IDropdownOptions
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type EmitFn = (event: 'update:modelValue' | 'onSelect', ...args: any[]) => void
|
|
15
|
-
|
|
16
|
-
export function useDropdownSelection(props: UseDropdownSelectionProps, emit: EmitFn) {
|
|
17
|
-
// Unified Value
|
|
18
|
-
const currentValue = computed(() => {
|
|
19
|
-
return props.modelValue !== undefined ? props.modelValue : props.selected
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// Label Resolution
|
|
23
|
-
const getLabelFromValue = (options: IDropdownOptions = [], value: any): string => {
|
|
24
|
-
for (const opt of options) {
|
|
25
|
-
// Exact match
|
|
26
|
-
if (opt.value === value) return opt.label
|
|
27
|
-
|
|
28
|
-
// Key/Object match
|
|
29
|
-
if (opt.key && typeof value === 'object' && value !== null && opt.key in value) {
|
|
30
|
-
if (opt.children) {
|
|
31
|
-
const childLabel = getLabelFromValue(opt.children, value[opt.key])
|
|
32
|
-
if (childLabel) return `${opt.label} / ${childLabel}`
|
|
33
|
-
}
|
|
34
|
-
// If no children but key matched (top level leaf with key)
|
|
35
|
-
if (opt.value === value[opt.key]) return opt.label
|
|
36
|
-
|
|
37
|
-
return opt.label
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return ''
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const selectedLabel = computed(() => {
|
|
44
|
-
if (!props.showSelectedLabel) return ''
|
|
45
|
-
if (!props.selectable) return ''
|
|
46
|
-
if (!props.options?.length) return ''
|
|
47
|
-
return getLabelFromValue(props.options, currentValue.value)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
// Selection Logic
|
|
51
|
-
const selectOption = (option: IDropdownOption) => {
|
|
52
|
-
if (typeof option !== 'string' && option?.disabled) return
|
|
53
|
-
|
|
54
|
-
const currentVal = currentValue.value
|
|
55
|
-
let value = option?.value ?? option?.label
|
|
56
|
-
const data = option.data
|
|
57
|
-
|
|
58
|
-
// Recursive / Partial Update Logic
|
|
59
|
-
if (option.key) {
|
|
60
|
-
const isWrapped = typeof value === 'object' && value !== null && option.key in value
|
|
61
|
-
|
|
62
|
-
if (!isWrapped) {
|
|
63
|
-
value = { [option.key]: value }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Merge Logic: If currentValue is an object (config mode)
|
|
68
|
-
if (currentVal && typeof currentVal === 'object' && !Array.isArray(currentVal) && option.key) {
|
|
69
|
-
// Toggle Logic: Check if already selected
|
|
70
|
-
const key = option.key
|
|
71
|
-
const targetVal = option.value ?? option.label
|
|
72
|
-
|
|
73
|
-
const isSelected = currentVal[key] === targetVal
|
|
74
|
-
|
|
75
|
-
// If toggle enabled and already selected, remove it
|
|
76
|
-
if (props.toggleSelection && isSelected) {
|
|
77
|
-
const clone = { ...currentVal }
|
|
78
|
-
delete clone[key]
|
|
79
|
-
emit('update:modelValue', clone)
|
|
80
|
-
emit('onSelect', { value: clone, data })
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Otherwise Merge
|
|
85
|
-
const merged = deepMerge(currentVal, value)
|
|
86
|
-
emit('update:modelValue', merged)
|
|
87
|
-
emit('onSelect', { value: merged, data })
|
|
88
|
-
} else {
|
|
89
|
-
// Standard replace (Primitive or Single Object)
|
|
90
|
-
// Toggle logic for simple mode
|
|
91
|
-
if (props.toggleSelection && currentVal === (option.value ?? option.label)) {
|
|
92
|
-
emit('update:modelValue', undefined)
|
|
93
|
-
emit('onSelect', { value: undefined, data })
|
|
94
|
-
} else {
|
|
95
|
-
emit('update:modelValue', value)
|
|
96
|
-
emit('onSelect', { value, data })
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
currentValue,
|
|
103
|
-
selectedLabel,
|
|
104
|
-
selectOption,
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as Dropdown } from './Dropdown.vue'
|
|
2
|
-
export { default as DropdownMenu } from './DropdownMenu.vue'
|
|
3
|
-
export { default as DropdownTrigger } from './DropdownTrigger.vue'
|
|
4
|
-
export { default as DropdownItem } from './DropdownItem.vue'
|
|
5
|
-
export * from './composables/useDropdownSelection'
|
|
6
|
-
export * from './composables/useDropdownIds'
|