cisse-vue-ui 0.7.2 → 0.7.3
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/dist/{PageHero.vue_vue_type_script_setup_true_lang-C-YXGDTY.js → PageHero.vue_vue_type_script_setup_true_lang-BYx595-2.js} +87 -47
- package/dist/{PageHero.vue_vue_type_script_setup_true_lang-C-YXGDTY.js.map → PageHero.vue_vue_type_script_setup_true_lang-BYx595-2.js.map} +1 -1
- package/dist/{TagsInput-D0O6z6le.js → TagsInput-DtoJKN3L.js} +17 -5
- package/dist/TagsInput-DtoJKN3L.js.map +1 -0
- package/dist/components/form/index.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/layout/index.js +1 -1
- package/dist/{index-D9_zMCpN.js → index-F9yanU6_.js} +3 -3
- package/dist/index-F9yanU6_.js.map +1 -0
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-zs0NXN4g.cjs +0 -145
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-zs0NXN4g.cjs.map +0 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang-CXRj7LEP.cjs +0 -98
- package/dist/Button.vue_vue_type_script_setup_true_lang-CXRj7LEP.cjs.map +0 -1
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-Bine-xfp.cjs +0 -928
- package/dist/ConfirmDialog.vue_vue_type_script_setup_true_lang-Bine-xfp.cjs.map +0 -1
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-BNOHbbm5.cjs +0 -228
- package/dist/Dropdown.vue_vue_type_script_setup_true_lang-BNOHbbm5.cjs.map +0 -1
- package/dist/FilterTabs.vue_vue_type_script_setup_true_lang-HwjuvIJX.cjs +0 -2242
- package/dist/FilterTabs.vue_vue_type_script_setup_true_lang-HwjuvIJX.cjs.map +0 -1
- package/dist/ListSkeleton.vue_vue_type_script_setup_true_lang-DtwwmfWr.cjs +0 -149
- package/dist/ListSkeleton.vue_vue_type_script_setup_true_lang-DtwwmfWr.cjs.map +0 -1
- package/dist/PageHero.vue_vue_type_script_setup_true_lang-CKCmOxOa.cjs +0 -724
- package/dist/PageHero.vue_vue_type_script_setup_true_lang-CKCmOxOa.cjs.map +0 -1
- package/dist/TagsInput-BF3zRMcU.cjs +0 -3682
- package/dist/TagsInput-BF3zRMcU.cjs.map +0 -1
- package/dist/TagsInput-D0O6z6le.js.map +0 -1
- package/dist/_plugin-vue_export-helper-DM9IkUGy.cjs +0 -10
- package/dist/_plugin-vue_export-helper-DM9IkUGy.cjs.map +0 -1
- package/dist/components/core/Accordion.stories.d.ts +0 -11
- package/dist/components/core/Accordion.test.d.ts +0 -1
- package/dist/components/core/Accordion.vue.d.ts +0 -27
- package/dist/components/core/AccordionItem.stories.d.ts +0 -10
- package/dist/components/core/AccordionItem.vue.d.ts +0 -29
- package/dist/components/core/AutocompleteComponent.stories.d.ts +0 -14
- package/dist/components/core/AutocompleteComponent.test.d.ts +0 -1
- package/dist/components/core/AutocompleteComponent.vue.d.ts +0 -25
- package/dist/components/core/Avatar.stories.d.ts +0 -12
- package/dist/components/core/Avatar.test.d.ts +0 -1
- package/dist/components/core/Avatar.vue.d.ts +0 -20
- package/dist/components/core/Breadcrumb.stories.d.ts +0 -11
- package/dist/components/core/Breadcrumb.test.d.ts +0 -1
- package/dist/components/core/Breadcrumb.vue.d.ts +0 -26
- package/dist/components/core/Button.stories.d.ts +0 -18
- package/dist/components/core/Button.test.d.ts +0 -1
- package/dist/components/core/Button.vue.d.ts +0 -49
- package/dist/components/core/CardComponent.stories.d.ts +0 -13
- package/dist/components/core/CardComponent.test.d.ts +0 -1
- package/dist/components/core/CardComponent.vue.d.ts +0 -40
- package/dist/components/core/CollapsibleCard.stories.d.ts +0 -10
- package/dist/components/core/CollapsibleCard.test.d.ts +0 -1
- package/dist/components/core/CollapsibleCard.vue.d.ts +0 -38
- package/dist/components/core/DarkModeToggle.stories.d.ts +0 -15
- package/dist/components/core/DarkModeToggle.test.d.ts +0 -1
- package/dist/components/core/DarkModeToggle.vue.d.ts +0 -21
- package/dist/components/core/Drawer.stories.d.ts +0 -12
- package/dist/components/core/Drawer.test.d.ts +0 -1
- package/dist/components/core/Drawer.vue.d.ts +0 -50
- package/dist/components/core/Dropdown.stories.d.ts +0 -11
- package/dist/components/core/Dropdown.test.d.ts +0 -1
- package/dist/components/core/Dropdown.vue.d.ts +0 -56
- package/dist/components/core/FilterTabs.stories.d.ts +0 -14
- package/dist/components/core/FilterTabs.test.d.ts +0 -1
- package/dist/components/core/FilterTabs.vue.d.ts +0 -29
- package/dist/components/core/MenuItem.stories.d.ts +0 -13
- package/dist/components/core/MenuItem.test.d.ts +0 -1
- package/dist/components/core/MenuItem.vue.d.ts +0 -16
- package/dist/components/core/MobileList.stories.d.ts +0 -13
- package/dist/components/core/MobileList.test.d.ts +0 -1
- package/dist/components/core/MobileList.vue.d.ts +0 -86
- package/dist/components/core/Popover.stories.d.ts +0 -10
- package/dist/components/core/Popover.test.d.ts +0 -1
- package/dist/components/core/Popover.vue.d.ts +0 -44
- package/dist/components/core/ResponsiveList.stories.d.ts +0 -15
- package/dist/components/core/ResponsiveList.test.d.ts +0 -1
- package/dist/components/core/ResponsiveList.vue.d.ts +0 -128
- package/dist/components/core/StatsCard.stories.d.ts +0 -15
- package/dist/components/core/StatsCard.test.d.ts +0 -1
- package/dist/components/core/StatsCard.vue.d.ts +0 -44
- package/dist/components/core/StatsGrid.stories.d.ts +0 -12
- package/dist/components/core/StatsGrid.test.d.ts +0 -1
- package/dist/components/core/StatsGrid.vue.d.ts +0 -16
- package/dist/components/core/StatusBadge.stories.d.ts +0 -13
- package/dist/components/core/StatusBadge.test.d.ts +0 -1
- package/dist/components/core/StatusBadge.vue.d.ts +0 -21
- package/dist/components/core/Stepper.stories.d.ts +0 -12
- package/dist/components/core/Stepper.test.d.ts +0 -1
- package/dist/components/core/Stepper.vue.d.ts +0 -22
- package/dist/components/core/TabPanel.stories.d.ts +0 -8
- package/dist/components/core/TabPanel.test.d.ts +0 -1
- package/dist/components/core/TabPanel.vue.d.ts +0 -21
- package/dist/components/core/TableAction.stories.d.ts +0 -14
- package/dist/components/core/TableAction.test.d.ts +0 -1
- package/dist/components/core/TableAction.vue.d.ts +0 -8
- package/dist/components/core/TableComponent.stories.d.ts +0 -16
- package/dist/components/core/TableComponent.test.d.ts +0 -1
- package/dist/components/core/TableComponent.vue.d.ts +0 -67
- package/dist/components/core/Tabs.stories.d.ts +0 -10
- package/dist/components/core/Tabs.test.d.ts +0 -1
- package/dist/components/core/Tabs.vue.d.ts +0 -39
- package/dist/components/core/Timeline.stories.d.ts +0 -11
- package/dist/components/core/Timeline.test.d.ts +0 -1
- package/dist/components/core/Timeline.vue.d.ts +0 -34
- package/dist/components/core/Tooltip.stories.d.ts +0 -10
- package/dist/components/core/Tooltip.test.d.ts +0 -1
- package/dist/components/core/Tooltip.vue.d.ts +0 -34
- package/dist/components/core/index.cjs +0 -33
- package/dist/components/core/index.cjs.map +0 -1
- package/dist/components/core/index.test.d.ts +0 -1
- package/dist/components/feedback/Alert.stories.d.ts +0 -13
- package/dist/components/feedback/Alert.test.d.ts +0 -1
- package/dist/components/feedback/Alert.vue.d.ts +0 -34
- package/dist/components/feedback/CardSkeleton.stories.d.ts +0 -11
- package/dist/components/feedback/CardSkeleton.test.d.ts +0 -1
- package/dist/components/feedback/CardSkeleton.vue.d.ts +0 -14
- package/dist/components/feedback/ConfirmDialog.stories.d.ts +0 -12
- package/dist/components/feedback/ConfirmDialog.test.d.ts +0 -1
- package/dist/components/feedback/ConfirmDialog.vue.d.ts +0 -53
- package/dist/components/feedback/EmptyState.stories.d.ts +0 -13
- package/dist/components/feedback/EmptyState.test.d.ts +0 -1
- package/dist/components/feedback/EmptyState.vue.d.ts +0 -29
- package/dist/components/feedback/ListSkeleton.stories.d.ts +0 -12
- package/dist/components/feedback/ListSkeleton.test.d.ts +0 -1
- package/dist/components/feedback/ListSkeleton.vue.d.ts +0 -17
- package/dist/components/feedback/LoadingSpinner.stories.d.ts +0 -11
- package/dist/components/feedback/LoadingSpinner.test.d.ts +0 -1
- package/dist/components/feedback/LoadingSpinner.vue.d.ts +0 -12
- package/dist/components/feedback/Modal.stories.d.ts +0 -11
- package/dist/components/feedback/Modal.test.d.ts +0 -1
- package/dist/components/feedback/Modal.vue.d.ts +0 -47
- package/dist/components/feedback/NotificationComponent.stories.d.ts +0 -14
- package/dist/components/feedback/NotificationComponent.test.d.ts +0 -1
- package/dist/components/feedback/NotificationComponent.vue.d.ts +0 -12
- package/dist/components/feedback/NotificationList.stories.d.ts +0 -11
- package/dist/components/feedback/NotificationList.test.d.ts +0 -1
- package/dist/components/feedback/NotificationList.vue.d.ts +0 -18
- package/dist/components/feedback/PaginationControls.stories.d.ts +0 -12
- package/dist/components/feedback/PaginationControls.test.d.ts +0 -1
- package/dist/components/feedback/PaginationControls.vue.d.ts +0 -21
- package/dist/components/feedback/Progress.stories.d.ts +0 -14
- package/dist/components/feedback/Progress.test.d.ts +0 -1
- package/dist/components/feedback/Progress.vue.d.ts +0 -30
- package/dist/components/feedback/Skeleton.stories.d.ts +0 -15
- package/dist/components/feedback/Skeleton.test.d.ts +0 -1
- package/dist/components/feedback/Skeleton.vue.d.ts +0 -19
- package/dist/components/feedback/TableSkeleton.stories.d.ts +0 -12
- package/dist/components/feedback/TableSkeleton.test.d.ts +0 -1
- package/dist/components/feedback/TableSkeleton.vue.d.ts +0 -14
- package/dist/components/feedback/Toast.stories.d.ts +0 -12
- package/dist/components/feedback/Toast.test.d.ts +0 -1
- package/dist/components/feedback/Toast.vue.d.ts +0 -23
- package/dist/components/feedback/ToastContainer.stories.d.ts +0 -15
- package/dist/components/feedback/ToastContainer.test.d.ts +0 -1
- package/dist/components/feedback/ToastContainer.vue.d.ts +0 -24
- package/dist/components/feedback/index.cjs +0 -20
- package/dist/components/feedback/index.cjs.map +0 -1
- package/dist/components/feedback/index.test.d.ts +0 -1
- package/dist/components/form/Checkbox.stories.d.ts +0 -13
- package/dist/components/form/Checkbox.test.d.ts +0 -1
- package/dist/components/form/Checkbox.vue.d.ts +0 -22
- package/dist/components/form/ColorPicker.stories.d.ts +0 -12
- package/dist/components/form/ColorPicker.test.d.ts +0 -1
- package/dist/components/form/ColorPicker.vue.d.ts +0 -26
- package/dist/components/form/Combobox.stories.d.ts +0 -15
- package/dist/components/form/Combobox.test.d.ts +0 -1
- package/dist/components/form/Combobox.vue.d.ts +0 -46
- package/dist/components/form/DatePicker.stories.d.ts +0 -15
- package/dist/components/form/DatePicker.test.d.ts +0 -1
- package/dist/components/form/DatePicker.vue.d.ts +0 -36
- package/dist/components/form/EmailInput.stories.d.ts +0 -13
- package/dist/components/form/EmailInput.test.d.ts +0 -1
- package/dist/components/form/EmailInput.vue.d.ts +0 -32
- package/dist/components/form/FileUpload.stories.d.ts +0 -12
- package/dist/components/form/FileUpload.test.d.ts +0 -1
- package/dist/components/form/FileUpload.vue.d.ts +0 -40
- package/dist/components/form/FormActions.stories.d.ts +0 -18
- package/dist/components/form/FormActions.test.d.ts +0 -1
- package/dist/components/form/FormActions.vue.d.ts +0 -56
- package/dist/components/form/FormGroup.stories.d.ts +0 -10
- package/dist/components/form/FormGroup.test.d.ts +0 -1
- package/dist/components/form/FormGroup.vue.d.ts +0 -30
- package/dist/components/form/FormHelp.stories.d.ts +0 -11
- package/dist/components/form/FormHelp.test.d.ts +0 -1
- package/dist/components/form/FormHelp.vue.d.ts +0 -23
- package/dist/components/form/FormInput.stories.d.ts +0 -12
- package/dist/components/form/FormInput.test.d.ts +0 -1
- package/dist/components/form/FormInput.vue.d.ts +0 -13
- package/dist/components/form/FormLabel.stories.d.ts +0 -12
- package/dist/components/form/FormLabel.test.d.ts +0 -1
- package/dist/components/form/FormLabel.vue.d.ts +0 -21
- package/dist/components/form/FormSection.stories.d.ts +0 -13
- package/dist/components/form/FormSection.test.d.ts +0 -1
- package/dist/components/form/FormSection.vue.d.ts +0 -49
- package/dist/components/form/FormSelect.stories.d.ts +0 -13
- package/dist/components/form/FormSelect.test.d.ts +0 -1
- package/dist/components/form/FormSelect.vue.d.ts +0 -55
- package/dist/components/form/IconPicker.vue.d.ts +0 -33
- package/dist/components/form/InputWrapper.stories.d.ts +0 -16
- package/dist/components/form/InputWrapper.test.d.ts +0 -1
- package/dist/components/form/InputWrapper.vue.d.ts +0 -40
- package/dist/components/form/MoneyInput.stories.d.ts +0 -16
- package/dist/components/form/MoneyInput.test.d.ts +0 -1
- package/dist/components/form/MoneyInput.vue.d.ts +0 -40
- package/dist/components/form/NumberInput.stories.d.ts +0 -14
- package/dist/components/form/NumberInput.test.d.ts +0 -1
- package/dist/components/form/NumberInput.vue.d.ts +0 -39
- package/dist/components/form/OTPInput.stories.d.ts +0 -13
- package/dist/components/form/OTPInput.test.d.ts +0 -1
- package/dist/components/form/OTPInput.vue.d.ts +0 -33
- package/dist/components/form/PasswordInput.stories.d.ts +0 -15
- package/dist/components/form/PasswordInput.test.d.ts +0 -1
- package/dist/components/form/PasswordInput.vue.d.ts +0 -36
- package/dist/components/form/PercentInput.stories.d.ts +0 -12
- package/dist/components/form/PercentInput.test.d.ts +0 -1
- package/dist/components/form/PercentInput.vue.d.ts +0 -38
- package/dist/components/form/PhoneInput.stories.d.ts +0 -13
- package/dist/components/form/PhoneInput.test.d.ts +0 -1
- package/dist/components/form/PhoneInput.vue.d.ts +0 -89
- package/dist/components/form/QuantityInput.stories.d.ts +0 -12
- package/dist/components/form/QuantityInput.test.d.ts +0 -1
- package/dist/components/form/QuantityInput.vue.d.ts +0 -32
- package/dist/components/form/RangeSlider.stories.d.ts +0 -13
- package/dist/components/form/RangeSlider.test.d.ts +0 -1
- package/dist/components/form/RangeSlider.vue.d.ts +0 -35
- package/dist/components/form/Rating.stories.d.ts +0 -16
- package/dist/components/form/Rating.test.d.ts +0 -1
- package/dist/components/form/Rating.vue.d.ts +0 -43
- package/dist/components/form/SearchInput.stories.d.ts +0 -13
- package/dist/components/form/SearchInput.test.d.ts +0 -1
- package/dist/components/form/SearchInput.vue.d.ts +0 -26
- package/dist/components/form/Slider.stories.d.ts +0 -13
- package/dist/components/form/Slider.test.d.ts +0 -1
- package/dist/components/form/Slider.vue.d.ts +0 -29
- package/dist/components/form/Switch.stories.d.ts +0 -11
- package/dist/components/form/Switch.test.d.ts +0 -1
- package/dist/components/form/Switch.vue.d.ts +0 -23
- package/dist/components/form/TagsInput.stories.d.ts +0 -13
- package/dist/components/form/TagsInput.test.d.ts +0 -1
- package/dist/components/form/TagsInput.vue.d.ts +0 -37
- package/dist/components/form/URLInput.stories.d.ts +0 -11
- package/dist/components/form/URLInput.test.d.ts +0 -1
- package/dist/components/form/URLInput.vue.d.ts +0 -32
- package/dist/components/form/index.cjs +0 -34
- package/dist/components/form/index.cjs.map +0 -1
- package/dist/components/form/index.test.d.ts +0 -1
- package/dist/components/index.cjs +0 -91
- package/dist/components/index.cjs.map +0 -1
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.test.d.ts +0 -1
- package/dist/components/layout/AuthLayout.stories.d.ts +0 -10
- package/dist/components/layout/AuthLayout.test.d.ts +0 -1
- package/dist/components/layout/AuthLayout.vue.d.ts +0 -88
- package/dist/components/layout/BaseLayout.stories.d.ts +0 -11
- package/dist/components/layout/BaseLayout.test.d.ts +0 -1
- package/dist/components/layout/BaseLayout.vue.d.ts +0 -77
- package/dist/components/layout/PageHero.stories.d.ts +0 -11
- package/dist/components/layout/PageHero.test.d.ts +0 -1
- package/dist/components/layout/PageHero.vue.d.ts +0 -51
- package/dist/components/layout/PageLayout.stories.d.ts +0 -10
- package/dist/components/layout/PageLayout.test.d.ts +0 -1
- package/dist/components/layout/PageLayout.vue.d.ts +0 -37
- package/dist/components/layout/index.cjs +0 -8
- package/dist/components/layout/index.cjs.map +0 -1
- package/dist/components/layout/index.test.d.ts +0 -1
- package/dist/components/type/BadgeType.stories.d.ts +0 -13
- package/dist/components/type/BadgeType.test.d.ts +0 -1
- package/dist/components/type/BooleanType.stories.d.ts +0 -12
- package/dist/components/type/BooleanType.test.d.ts +0 -1
- package/dist/components/type/DateType.stories.d.ts +0 -12
- package/dist/components/type/DateType.test.d.ts +0 -1
- package/dist/components/type/NumberType.stories.d.ts +0 -11
- package/dist/components/type/NumberType.test.d.ts +0 -1
- package/dist/components/type/TextType.stories.d.ts +0 -10
- package/dist/components/type/TextType.test.d.ts +0 -1
- package/dist/components/type/index.cjs +0 -9
- package/dist/components/type/index.cjs.map +0 -1
- package/dist/components/type/index.test.d.ts +0 -1
- package/dist/composables/index.cjs +0 -19
- package/dist/composables/index.cjs.map +0 -1
- package/dist/composables/index.d.ts +0 -8
- package/dist/composables/index.test.d.ts +0 -1
- package/dist/composables/useDarkMode.d.ts +0 -14
- package/dist/composables/useDarkMode.test.d.ts +0 -1
- package/dist/composables/useDropdown.d.ts +0 -51
- package/dist/composables/useDropdown.test.d.ts +0 -1
- package/dist/composables/useExportCSV.d.ts +0 -10
- package/dist/composables/useExportCSV.test.d.ts +0 -1
- package/dist/composables/useFocusTrap.d.ts +0 -41
- package/dist/composables/useFocusTrap.test.d.ts +0 -1
- package/dist/composables/useId.d.ts +0 -42
- package/dist/composables/useId.test.d.ts +0 -1
- package/dist/composables/useModal.d.ts +0 -60
- package/dist/composables/useModal.test.d.ts +0 -1
- package/dist/composables/useNotifications.d.ts +0 -27
- package/dist/composables/useNotifications.test.d.ts +0 -1
- package/dist/composables/useToast.d.ts +0 -30
- package/dist/composables/useToast.test.d.ts +0 -1
- package/dist/index-D1x3TH9k.cjs +0 -401
- package/dist/index-D1x3TH9k.cjs.map +0 -1
- package/dist/index-D9_zMCpN.js.map +0 -1
- package/dist/index-PehFvNFG.cjs +0 -94
- package/dist/index-PehFvNFG.cjs.map +0 -1
- package/dist/index.cjs +0 -123
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin.d.ts +0 -24
- package/dist/style.css +0 -2
- package/dist/types/components.d.ts +0 -27
- package/dist/types/form.d.ts +0 -37
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.test.d.ts +0 -1
- package/dist/types/notification.d.ts +0 -12
- package/dist/types/property.d.ts +0 -34
- package/dist/useDarkMode-DLZcJEUQ.cjs +0 -52
- package/dist/useDarkMode-DLZcJEUQ.cjs.map +0 -1
- package/dist/useDropdown-DHFnd259.cjs +0 -130
- package/dist/useDropdown-DHFnd259.cjs.map +0 -1
- package/dist/useFocusTrap-kcxO8AeU.cjs +0 -119
- package/dist/useFocusTrap-kcxO8AeU.cjs.map +0 -1
- package/dist/useId-nxrBaIC9.cjs +0 -25
- package/dist/useId-nxrBaIC9.cjs.map +0 -1
- package/dist/useToast-Bk60GArg.cjs +0 -176
- package/dist/useToast-Bk60GArg.cjs.map +0 -1
|
@@ -1,3682 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const vue = require("vue");
|
|
3
|
-
const useId = require("./useId-nxrBaIC9.cjs");
|
|
4
|
-
const vue$1 = require("@iconify/vue");
|
|
5
|
-
const useDropdown = require("./useDropdown-DHFnd259.cjs");
|
|
6
|
-
const _pluginVue_exportHelper = require("./_plugin-vue_export-helper-DM9IkUGy.cjs");
|
|
7
|
-
const index = require("./index-D1x3TH9k.cjs");
|
|
8
|
-
const Button_vue_vue_type_script_setup_true_lang = require("./Button.vue_vue_type_script_setup_true_lang-CXRj7LEP.cjs");
|
|
9
|
-
const _hoisted_1$r = ["data-error", "for"];
|
|
10
|
-
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
11
|
-
__name: "FormLabel",
|
|
12
|
-
props: {
|
|
13
|
-
error: { type: [String, Boolean] },
|
|
14
|
-
htmlFor: {}
|
|
15
|
-
},
|
|
16
|
-
setup(__props) {
|
|
17
|
-
return (_ctx, _cache) => {
|
|
18
|
-
return vue.openBlock(), vue.createElementBlock("label", {
|
|
19
|
-
"data-error": !!__props.error,
|
|
20
|
-
for: __props.htmlFor ?? "",
|
|
21
|
-
class: "block text-sm font-medium text-gray-700 data-[error=true]:text-red-500 dark:text-gray-300"
|
|
22
|
-
}, [
|
|
23
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
24
|
-
], 8, _hoisted_1$r);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const _hoisted_1$q = ["id", "data-error", "role", "aria-live"];
|
|
29
|
-
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
30
|
-
__name: "FormHelp",
|
|
31
|
-
props: {
|
|
32
|
-
id: {},
|
|
33
|
-
error: { type: Boolean },
|
|
34
|
-
text: {}
|
|
35
|
-
},
|
|
36
|
-
setup(__props) {
|
|
37
|
-
return (_ctx, _cache) => {
|
|
38
|
-
return vue.openBlock(), vue.createElementBlock("p", {
|
|
39
|
-
id: __props.id,
|
|
40
|
-
"data-error": __props.error,
|
|
41
|
-
role: __props.error ? "alert" : void 0,
|
|
42
|
-
"aria-live": __props.error ? "polite" : void 0,
|
|
43
|
-
class: "mt-2 text-sm text-gray-400 peer-user-invalid:visible data-[error=true]:text-red-500 dark:text-gray-500"
|
|
44
|
-
}, [
|
|
45
|
-
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
46
|
-
vue.createTextVNode(vue.toDisplayString(__props.text ?? ""), 1)
|
|
47
|
-
])
|
|
48
|
-
], 8, _hoisted_1$q);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const _hoisted_1$p = {
|
|
53
|
-
key: 0,
|
|
54
|
-
class: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-gray-400"
|
|
55
|
-
};
|
|
56
|
-
const _hoisted_2$h = {
|
|
57
|
-
key: 1,
|
|
58
|
-
class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1"
|
|
59
|
-
};
|
|
60
|
-
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
61
|
-
__name: "InputWrapper",
|
|
62
|
-
props: {
|
|
63
|
-
icon: {},
|
|
64
|
-
iconRight: {},
|
|
65
|
-
size: { default: "md" },
|
|
66
|
-
invalid: { type: Boolean },
|
|
67
|
-
disabled: { type: Boolean },
|
|
68
|
-
wrapperClass: {}
|
|
69
|
-
},
|
|
70
|
-
setup(__props, { expose: __expose }) {
|
|
71
|
-
const props = __props;
|
|
72
|
-
const slots = vue.useSlots();
|
|
73
|
-
const hasLeftIcon = vue.computed(() => props.icon || slots.icon);
|
|
74
|
-
const hasRightContent = vue.computed(() => props.iconRight || slots.actions);
|
|
75
|
-
const inputClass = vue.computed(() => [
|
|
76
|
-
// Base styles
|
|
77
|
-
"block w-full rounded-xl border text-sm transition-all",
|
|
78
|
-
"border-gray-200 bg-gray-50 text-gray-900 placeholder-gray-400",
|
|
79
|
-
"focus:border-primary-500 focus:ring-2 focus:ring-primary-500 focus:bg-white focus:outline-hidden",
|
|
80
|
-
"disabled:border-gray-200 disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed",
|
|
81
|
-
// Dark mode
|
|
82
|
-
"dark:border-slate-600 dark:bg-slate-700 dark:text-white dark:placeholder-gray-500",
|
|
83
|
-
"dark:focus:border-primary-500 dark:focus:ring-primary-500 dark:focus:bg-slate-600",
|
|
84
|
-
"dark:disabled:bg-slate-800 dark:disabled:text-gray-500",
|
|
85
|
-
// Padding based on icons/actions
|
|
86
|
-
hasLeftIcon.value ? "pl-10" : "pl-4",
|
|
87
|
-
hasRightContent.value ? "pr-10" : "pr-4",
|
|
88
|
-
// Size
|
|
89
|
-
props.size === "sm" && "py-2 text-xs",
|
|
90
|
-
props.size === "md" && "py-3 text-sm",
|
|
91
|
-
props.size === "lg" && "py-4 text-base",
|
|
92
|
-
// Invalid state
|
|
93
|
-
props.invalid && "border-red-500 focus:border-red-500 focus:ring-red-500 dark:border-red-500"
|
|
94
|
-
]);
|
|
95
|
-
__expose({ inputClass });
|
|
96
|
-
return (_ctx, _cache) => {
|
|
97
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
98
|
-
class: vue.normalizeClass(["relative", __props.wrapperClass])
|
|
99
|
-
}, [
|
|
100
|
-
hasLeftIcon.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
|
|
101
|
-
vue.renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
102
|
-
__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
103
|
-
key: 0,
|
|
104
|
-
icon: __props.icon,
|
|
105
|
-
class: "size-5"
|
|
106
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
107
|
-
])
|
|
108
|
-
])) : vue.createCommentVNode("", true),
|
|
109
|
-
vue.renderSlot(_ctx.$slots, "default", { inputClass: inputClass.value }),
|
|
110
|
-
hasRightContent.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$h, [
|
|
111
|
-
vue.renderSlot(_ctx.$slots, "actions", {}, () => [
|
|
112
|
-
__props.iconRight ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
113
|
-
key: 0,
|
|
114
|
-
icon: __props.iconRight,
|
|
115
|
-
class: "size-5 text-gray-400 pointer-events-none"
|
|
116
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
117
|
-
])
|
|
118
|
-
])) : vue.createCommentVNode("", true)
|
|
119
|
-
], 2);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
const _hoisted_1$o = ["id", "disabled", "name", "placeholder", "type", "required", "aria-invalid", "aria-required", "aria-describedby"];
|
|
124
|
-
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
125
|
-
...{
|
|
126
|
-
inheritAttrs: false
|
|
127
|
-
},
|
|
128
|
-
__name: "FormInput",
|
|
129
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
130
|
-
type: { default: "text" },
|
|
131
|
-
value: {},
|
|
132
|
-
placeholder: {},
|
|
133
|
-
disabled: { type: Boolean },
|
|
134
|
-
invalid: { type: Boolean },
|
|
135
|
-
id: {},
|
|
136
|
-
name: {},
|
|
137
|
-
required: { type: Boolean },
|
|
138
|
-
describedBy: {},
|
|
139
|
-
icon: {},
|
|
140
|
-
iconRight: {}
|
|
141
|
-
}, {
|
|
142
|
-
"modelValue": {},
|
|
143
|
-
"modelModifiers": {}
|
|
144
|
-
}),
|
|
145
|
-
emits: ["update:modelValue"],
|
|
146
|
-
setup(__props) {
|
|
147
|
-
const props = __props;
|
|
148
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
149
|
-
return (_ctx, _cache) => {
|
|
150
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
151
|
-
icon: props.icon,
|
|
152
|
-
"icon-right": props.iconRight,
|
|
153
|
-
disabled: props.disabled,
|
|
154
|
-
invalid: props.invalid
|
|
155
|
-
}, {
|
|
156
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
157
|
-
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
158
|
-
id: props.id ?? props.name ?? "",
|
|
159
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
160
|
-
disabled: props.disabled,
|
|
161
|
-
name: props.name ?? "",
|
|
162
|
-
placeholder: props.placeholder,
|
|
163
|
-
type: props.type,
|
|
164
|
-
required: props.required,
|
|
165
|
-
"aria-invalid": props.invalid || void 0,
|
|
166
|
-
"aria-required": props.required || void 0,
|
|
167
|
-
"aria-describedby": props.describedBy || void 0,
|
|
168
|
-
class: inputClass
|
|
169
|
-
}, _ctx.$attrs), null, 16, _hoisted_1$o), [
|
|
170
|
-
[vue.vModelDynamic, modelValue.value]
|
|
171
|
-
])
|
|
172
|
-
]),
|
|
173
|
-
_: 1
|
|
174
|
-
}, 8, ["icon", "icon-right", "disabled", "invalid"]);
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
const _hoisted_1$n = { class: "relative" };
|
|
179
|
-
const _hoisted_2$g = ["id", "disabled", "aria-expanded", "aria-controls", "aria-invalid", "aria-describedby"];
|
|
180
|
-
const _hoisted_3$f = { class: "flex-1 truncate" };
|
|
181
|
-
const _hoisted_4$b = ["id", "aria-label"];
|
|
182
|
-
const _hoisted_5$8 = {
|
|
183
|
-
key: 0,
|
|
184
|
-
class: "sticky top-0 border-b border-gray-200 bg-white p-2 dark:border-gray-700 dark:bg-gray-800"
|
|
185
|
-
};
|
|
186
|
-
const _hoisted_6$8 = { class: "flex items-center gap-2 rounded-md border border-gray-300 bg-gray-50 px-2 py-1.5 dark:border-gray-600 dark:bg-gray-900" };
|
|
187
|
-
const _hoisted_7$7 = {
|
|
188
|
-
key: 1,
|
|
189
|
-
class: "px-4 py-3 text-sm text-gray-500 dark:text-gray-400",
|
|
190
|
-
role: "status"
|
|
191
|
-
};
|
|
192
|
-
const _hoisted_8$6 = { class: "py-1" };
|
|
193
|
-
const _hoisted_9$4 = ["aria-selected", "data-index", "onClick", "onMouseenter"];
|
|
194
|
-
const _hoisted_10$4 = {
|
|
195
|
-
key: 1,
|
|
196
|
-
class: "size-4 shrink-0",
|
|
197
|
-
"aria-hidden": "true"
|
|
198
|
-
};
|
|
199
|
-
const _hoisted_11$4 = { class: "flex-1" };
|
|
200
|
-
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
201
|
-
__name: "FormSelect",
|
|
202
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
203
|
-
options: {},
|
|
204
|
-
type: {},
|
|
205
|
-
value: {},
|
|
206
|
-
placeholder: {},
|
|
207
|
-
disabled: { type: Boolean },
|
|
208
|
-
invalid: { type: Boolean },
|
|
209
|
-
id: {},
|
|
210
|
-
name: {},
|
|
211
|
-
required: { type: Boolean },
|
|
212
|
-
describedBy: {},
|
|
213
|
-
icon: {},
|
|
214
|
-
iconRight: {},
|
|
215
|
-
teleport: { type: Boolean, default: true },
|
|
216
|
-
searchable: { type: Boolean, default: false },
|
|
217
|
-
noResultsText: { default: "No results found" },
|
|
218
|
-
triggerClass: {}
|
|
219
|
-
}, {
|
|
220
|
-
"modelValue": { type: [String, Number, Boolean, null] },
|
|
221
|
-
"modelModifiers": {}
|
|
222
|
-
}),
|
|
223
|
-
emits: ["update:modelValue"],
|
|
224
|
-
setup(__props) {
|
|
225
|
-
const props = __props;
|
|
226
|
-
const { id: generatedId, related } = useId.useId({ prefix: "select", id: props.id });
|
|
227
|
-
const triggerId = vue.computed(() => props.id ?? props.name ?? generatedId.value);
|
|
228
|
-
const listboxId = vue.computed(() => related("listbox"));
|
|
229
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
230
|
-
const searchQuery = vue.ref("");
|
|
231
|
-
const triggerRef = vue.ref();
|
|
232
|
-
const dropdownRef = vue.ref();
|
|
233
|
-
const searchInputRef = vue.ref();
|
|
234
|
-
const {
|
|
235
|
-
isOpen,
|
|
236
|
-
highlightedIndex,
|
|
237
|
-
dropdownStyle,
|
|
238
|
-
open: openDropdown,
|
|
239
|
-
close,
|
|
240
|
-
handleKeydown: baseHandleKeydown,
|
|
241
|
-
scrollToHighlighted
|
|
242
|
-
} = useDropdown.useDropdown(triggerRef, dropdownRef, {
|
|
243
|
-
teleport: props.teleport,
|
|
244
|
-
gap: 4,
|
|
245
|
-
onClose: () => {
|
|
246
|
-
searchQuery.value = "";
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
const visibleOptions = vue.computed(() => {
|
|
250
|
-
return (props.options ?? []).filter((opt) => !opt.hidden);
|
|
251
|
-
});
|
|
252
|
-
const filteredOptions = vue.computed(() => {
|
|
253
|
-
if (!props.searchable || !searchQuery.value) {
|
|
254
|
-
return visibleOptions.value;
|
|
255
|
-
}
|
|
256
|
-
const query = searchQuery.value.toLowerCase();
|
|
257
|
-
return visibleOptions.value.filter(
|
|
258
|
-
(opt) => opt.label.toLowerCase().includes(query) || String(opt.value).toLowerCase().includes(query)
|
|
259
|
-
);
|
|
260
|
-
});
|
|
261
|
-
const selectedOption = vue.computed(() => {
|
|
262
|
-
return visibleOptions.value.find((opt) => opt.value === modelValue.value);
|
|
263
|
-
});
|
|
264
|
-
const displayValue = vue.computed(() => {
|
|
265
|
-
if (selectedOption.value) {
|
|
266
|
-
return selectedOption.value.label;
|
|
267
|
-
}
|
|
268
|
-
return props.placeholder || "Select...";
|
|
269
|
-
});
|
|
270
|
-
const open = () => {
|
|
271
|
-
if (props.disabled) return;
|
|
272
|
-
searchQuery.value = "";
|
|
273
|
-
highlightedIndex.value = filteredOptions.value.findIndex(
|
|
274
|
-
(opt) => opt.value === modelValue.value
|
|
275
|
-
);
|
|
276
|
-
openDropdown();
|
|
277
|
-
vue.nextTick(() => {
|
|
278
|
-
var _a;
|
|
279
|
-
if (props.searchable) {
|
|
280
|
-
(_a = searchInputRef.value) == null ? void 0 : _a.focus();
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
const toggle = () => {
|
|
285
|
-
if (isOpen.value) {
|
|
286
|
-
close();
|
|
287
|
-
} else {
|
|
288
|
-
open();
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
const selectOption = (option) => {
|
|
292
|
-
modelValue.value = option.value;
|
|
293
|
-
close();
|
|
294
|
-
};
|
|
295
|
-
const handleKeydown = (event) => {
|
|
296
|
-
baseHandleKeydown(event, {
|
|
297
|
-
itemCount: filteredOptions.value.length,
|
|
298
|
-
onSelect: (index2) => {
|
|
299
|
-
if (filteredOptions.value[index2]) {
|
|
300
|
-
selectOption(filteredOptions.value[index2]);
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
onOpen: open,
|
|
304
|
-
handleOpenKeys: true
|
|
305
|
-
});
|
|
306
|
-
if (isOpen.value) {
|
|
307
|
-
scrollToHighlighted(dropdownRef.value ?? null);
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
vue.watch(searchQuery, () => {
|
|
311
|
-
highlightedIndex.value = 0;
|
|
312
|
-
});
|
|
313
|
-
const triggerClasses = vue.computed(() => {
|
|
314
|
-
const base = "flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm text-left transition";
|
|
315
|
-
const state = props.disabled ? "cursor-not-allowed border-gray-200 bg-gray-50 text-gray-500 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-500" : isOpen.value ? "border-primary ring-2 ring-primary/20 bg-white dark:bg-gray-900" : "border-gray-300 bg-white hover:border-gray-400 dark:border-gray-700 dark:bg-gray-900 dark:hover:border-gray-600";
|
|
316
|
-
const text = selectedOption.value ? "text-gray-800 dark:text-gray-200" : "text-gray-400 dark:text-gray-500";
|
|
317
|
-
return [base, state, text, props.triggerClass];
|
|
318
|
-
});
|
|
319
|
-
return (_ctx, _cache) => {
|
|
320
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
|
|
321
|
-
vue.createElementVNode("button", {
|
|
322
|
-
id: triggerId.value,
|
|
323
|
-
ref_key: "triggerRef",
|
|
324
|
-
ref: triggerRef,
|
|
325
|
-
type: "button",
|
|
326
|
-
disabled: __props.disabled,
|
|
327
|
-
class: vue.normalizeClass(triggerClasses.value),
|
|
328
|
-
"aria-haspopup": "listbox",
|
|
329
|
-
"aria-expanded": vue.unref(isOpen),
|
|
330
|
-
"aria-controls": listboxId.value,
|
|
331
|
-
"aria-invalid": __props.invalid || void 0,
|
|
332
|
-
"aria-describedby": __props.describedBy || void 0,
|
|
333
|
-
onClick: toggle,
|
|
334
|
-
onKeydown: handleKeydown
|
|
335
|
-
}, [
|
|
336
|
-
vue.renderSlot(_ctx.$slots, "selected", {
|
|
337
|
-
option: selectedOption.value,
|
|
338
|
-
placeholder: __props.placeholder
|
|
339
|
-
}, () => [
|
|
340
|
-
vue.createElementVNode("span", _hoisted_3$f, vue.toDisplayString(displayValue.value), 1)
|
|
341
|
-
]),
|
|
342
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
343
|
-
icon: "lucide:chevron-down",
|
|
344
|
-
class: vue.normalizeClass(["size-4 shrink-0 text-gray-400 transition-transform", vue.unref(isOpen) && "rotate-180"]),
|
|
345
|
-
"aria-hidden": "true"
|
|
346
|
-
}, null, 8, ["class"])
|
|
347
|
-
], 42, _hoisted_2$g),
|
|
348
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
349
|
-
to: "body",
|
|
350
|
-
disabled: !__props.teleport
|
|
351
|
-
}, [
|
|
352
|
-
vue.createVNode(vue.Transition, {
|
|
353
|
-
"enter-active-class": "transition duration-100 ease-out",
|
|
354
|
-
"enter-from-class": "opacity-0 scale-95",
|
|
355
|
-
"enter-to-class": "opacity-100 scale-100",
|
|
356
|
-
"leave-active-class": "transition duration-75 ease-in",
|
|
357
|
-
"leave-from-class": "opacity-100 scale-100",
|
|
358
|
-
"leave-to-class": "opacity-0 scale-95"
|
|
359
|
-
}, {
|
|
360
|
-
default: vue.withCtx(() => [
|
|
361
|
-
vue.unref(isOpen) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
362
|
-
key: 0,
|
|
363
|
-
id: listboxId.value,
|
|
364
|
-
ref_key: "dropdownRef",
|
|
365
|
-
ref: dropdownRef,
|
|
366
|
-
role: "listbox",
|
|
367
|
-
"aria-label": __props.placeholder || "Select an option",
|
|
368
|
-
style: vue.normalizeStyle(vue.unref(dropdownStyle)),
|
|
369
|
-
class: vue.normalizeClass([
|
|
370
|
-
"z-9999 max-h-60 overflow-auto rounded-lg border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",
|
|
371
|
-
!__props.teleport && "absolute mt-1 w-full"
|
|
372
|
-
])
|
|
373
|
-
}, [
|
|
374
|
-
__props.searchable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$8, [
|
|
375
|
-
vue.createElementVNode("div", _hoisted_6$8, [
|
|
376
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
377
|
-
icon: "lucide:search",
|
|
378
|
-
class: "size-4 text-gray-400",
|
|
379
|
-
"aria-hidden": "true"
|
|
380
|
-
}),
|
|
381
|
-
vue.withDirectives(vue.createElementVNode("input", {
|
|
382
|
-
ref_key: "searchInputRef",
|
|
383
|
-
ref: searchInputRef,
|
|
384
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
385
|
-
type: "text",
|
|
386
|
-
class: "flex-1 bg-transparent text-sm outline-hidden dark:text-white",
|
|
387
|
-
placeholder: "Search...",
|
|
388
|
-
"aria-label": "Search options",
|
|
389
|
-
onKeydown: handleKeydown
|
|
390
|
-
}, null, 544), [
|
|
391
|
-
[vue.vModelText, searchQuery.value]
|
|
392
|
-
])
|
|
393
|
-
])
|
|
394
|
-
])) : vue.createCommentVNode("", true),
|
|
395
|
-
filteredOptions.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$7, vue.toDisplayString(__props.noResultsText), 1)) : vue.createCommentVNode("", true),
|
|
396
|
-
vue.createElementVNode("div", _hoisted_8$6, [
|
|
397
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredOptions.value, (option, index2) => {
|
|
398
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
399
|
-
key: String(option.value),
|
|
400
|
-
type: "button",
|
|
401
|
-
role: "option",
|
|
402
|
-
"aria-selected": modelValue.value === option.value,
|
|
403
|
-
"data-index": index2,
|
|
404
|
-
class: vue.normalizeClass([
|
|
405
|
-
"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors",
|
|
406
|
-
vue.unref(highlightedIndex) === index2 && "bg-gray-100 dark:bg-gray-700",
|
|
407
|
-
modelValue.value === option.value && "bg-primary/10 text-primary",
|
|
408
|
-
modelValue.value !== option.value && "text-gray-700 dark:text-gray-200"
|
|
409
|
-
]),
|
|
410
|
-
onClick: ($event) => selectOption(option),
|
|
411
|
-
onMouseenter: ($event) => highlightedIndex.value = index2
|
|
412
|
-
}, [
|
|
413
|
-
vue.renderSlot(_ctx.$slots, "option", {
|
|
414
|
-
option,
|
|
415
|
-
selected: modelValue.value === option.value,
|
|
416
|
-
index: index2
|
|
417
|
-
}, () => [
|
|
418
|
-
modelValue.value === option.value ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
419
|
-
key: 0,
|
|
420
|
-
icon: "lucide:check",
|
|
421
|
-
class: "size-4 shrink-0 text-primary",
|
|
422
|
-
"aria-hidden": "true"
|
|
423
|
-
})) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_10$4)),
|
|
424
|
-
vue.createElementVNode("span", _hoisted_11$4, vue.toDisplayString(option.label), 1)
|
|
425
|
-
])
|
|
426
|
-
], 42, _hoisted_9$4);
|
|
427
|
-
}), 128))
|
|
428
|
-
])
|
|
429
|
-
], 14, _hoisted_4$b)) : vue.createCommentVNode("", true)
|
|
430
|
-
]),
|
|
431
|
-
_: 3
|
|
432
|
-
})
|
|
433
|
-
], 8, ["disabled"]))
|
|
434
|
-
]);
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
const _hoisted_1$m = ["hidden"];
|
|
439
|
-
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
440
|
-
__name: "FormGroup",
|
|
441
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
442
|
-
label: {},
|
|
443
|
-
cols: { default: 6 },
|
|
444
|
-
hidden: { type: Boolean },
|
|
445
|
-
error: { type: [String, Boolean] },
|
|
446
|
-
select: { type: Boolean },
|
|
447
|
-
type: {},
|
|
448
|
-
value: {},
|
|
449
|
-
placeholder: {},
|
|
450
|
-
disabled: { type: Boolean },
|
|
451
|
-
invalid: { type: Boolean },
|
|
452
|
-
id: {},
|
|
453
|
-
name: {},
|
|
454
|
-
required: { type: Boolean },
|
|
455
|
-
describedBy: {},
|
|
456
|
-
icon: {},
|
|
457
|
-
iconRight: {},
|
|
458
|
-
options: {}
|
|
459
|
-
}, {
|
|
460
|
-
"modelValue": {},
|
|
461
|
-
"modelModifiers": {}
|
|
462
|
-
}),
|
|
463
|
-
emits: ["update:modelValue"],
|
|
464
|
-
setup(__props) {
|
|
465
|
-
const props = __props;
|
|
466
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
467
|
-
const { id: generatedId, related } = useId.useId({ prefix: "field", id: props.id });
|
|
468
|
-
const inputId = vue.computed(() => props.id ?? props.name ?? generatedId.value);
|
|
469
|
-
const helpId = vue.computed(() => related("help"));
|
|
470
|
-
const computedCols = vue.computed(() => `span ${props.cols} / span ${props.cols}`);
|
|
471
|
-
const isSelect = vue.computed(() => props.select === true);
|
|
472
|
-
const hasError = vue.computed(() => props.error && typeof props.error === "string");
|
|
473
|
-
return (_ctx, _cache) => {
|
|
474
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
475
|
-
style: vue.normalizeStyle({ gridColumn: computedCols.value }),
|
|
476
|
-
hidden: __props.hidden
|
|
477
|
-
}, [
|
|
478
|
-
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
479
|
-
vue.renderSlot(_ctx.$slots, "label", {}, () => [
|
|
480
|
-
__props.label ? (vue.openBlock(), vue.createBlock(_sfc_main$r, {
|
|
481
|
-
key: 0,
|
|
482
|
-
"html-for": inputId.value,
|
|
483
|
-
error: __props.error
|
|
484
|
-
}, {
|
|
485
|
-
default: vue.withCtx(() => [
|
|
486
|
-
vue.createTextVNode(vue.toDisplayString(__props.label), 1)
|
|
487
|
-
]),
|
|
488
|
-
_: 1
|
|
489
|
-
}, 8, ["html-for", "error"])) : vue.createCommentVNode("", true)
|
|
490
|
-
]),
|
|
491
|
-
vue.renderSlot(_ctx.$slots, "input", {}, () => [
|
|
492
|
-
isSelect.value ? (vue.openBlock(), vue.createBlock(_sfc_main$n, vue.mergeProps({
|
|
493
|
-
key: 0,
|
|
494
|
-
modelValue: modelValue.value,
|
|
495
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
|
|
496
|
-
}, { ..._ctx.$attrs, ..._ctx.$props }, {
|
|
497
|
-
id: inputId.value,
|
|
498
|
-
invalid: Boolean(__props.error),
|
|
499
|
-
"described-by": hasError.value ? helpId.value : void 0
|
|
500
|
-
}), null, 16, ["modelValue", "id", "invalid", "described-by"])) : (vue.openBlock(), vue.createBlock(_sfc_main$o, vue.mergeProps({
|
|
501
|
-
key: 1,
|
|
502
|
-
modelValue: modelValue.value,
|
|
503
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue.value = $event)
|
|
504
|
-
}, { ..._ctx.$attrs, ..._ctx.$props }, {
|
|
505
|
-
id: inputId.value,
|
|
506
|
-
invalid: Boolean(__props.error),
|
|
507
|
-
"described-by": hasError.value ? helpId.value : void 0
|
|
508
|
-
}), null, 16, ["modelValue", "id", "invalid", "described-by"]))
|
|
509
|
-
]),
|
|
510
|
-
hasError.value ? (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
511
|
-
key: 0,
|
|
512
|
-
id: helpId.value,
|
|
513
|
-
error: true
|
|
514
|
-
}, {
|
|
515
|
-
default: vue.withCtx(() => [
|
|
516
|
-
vue.createTextVNode(vue.toDisplayString(__props.error), 1)
|
|
517
|
-
]),
|
|
518
|
-
_: 1
|
|
519
|
-
}, 8, ["id"])) : vue.createCommentVNode("", true)
|
|
520
|
-
])
|
|
521
|
-
], 12, _hoisted_1$m);
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
const _hoisted_1$l = ["name", "placeholder", "disabled"];
|
|
526
|
-
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
527
|
-
...{
|
|
528
|
-
inheritAttrs: false
|
|
529
|
-
},
|
|
530
|
-
__name: "SearchInput",
|
|
531
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
532
|
-
placeholder: { default: "Search..." },
|
|
533
|
-
icon: { default: "lucide:search" },
|
|
534
|
-
disabled: { type: Boolean },
|
|
535
|
-
size: { default: "md" },
|
|
536
|
-
name: {}
|
|
537
|
-
}, {
|
|
538
|
-
"modelValue": { default: "" },
|
|
539
|
-
"modelModifiers": {}
|
|
540
|
-
}),
|
|
541
|
-
emits: ["update:modelValue"],
|
|
542
|
-
setup(__props) {
|
|
543
|
-
const props = __props;
|
|
544
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
545
|
-
return (_ctx, _cache) => {
|
|
546
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
547
|
-
icon: props.icon,
|
|
548
|
-
size: props.size,
|
|
549
|
-
disabled: props.disabled
|
|
550
|
-
}, {
|
|
551
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
552
|
-
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
553
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
554
|
-
type: "text",
|
|
555
|
-
name: props.name,
|
|
556
|
-
placeholder: props.placeholder,
|
|
557
|
-
disabled: props.disabled,
|
|
558
|
-
class: inputClass
|
|
559
|
-
}, _ctx.$attrs), null, 16, _hoisted_1$l), [
|
|
560
|
-
[vue.vModelText, modelValue.value]
|
|
561
|
-
])
|
|
562
|
-
]),
|
|
563
|
-
_: 1
|
|
564
|
-
}, 8, ["icon", "size", "disabled"]);
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
const _hoisted_1$k = ["id", "aria-checked", "aria-labelledby", "aria-describedby", "disabled"];
|
|
569
|
-
const _hoisted_2$f = {
|
|
570
|
-
key: 0,
|
|
571
|
-
class: "flex flex-col"
|
|
572
|
-
};
|
|
573
|
-
const _hoisted_3$e = ["id"];
|
|
574
|
-
const _hoisted_4$a = ["id"];
|
|
575
|
-
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
576
|
-
__name: "Switch",
|
|
577
|
-
props: {
|
|
578
|
-
modelValue: { type: Boolean, default: false },
|
|
579
|
-
label: {},
|
|
580
|
-
description: {},
|
|
581
|
-
disabled: { type: Boolean },
|
|
582
|
-
size: { default: "md" },
|
|
583
|
-
id: {}
|
|
584
|
-
},
|
|
585
|
-
emits: ["update:modelValue"],
|
|
586
|
-
setup(__props, { emit: __emit }) {
|
|
587
|
-
const props = __props;
|
|
588
|
-
const emit = __emit;
|
|
589
|
-
const { id: generatedId, related } = useId.useId({ prefix: "switch", id: props.id });
|
|
590
|
-
const switchId = vue.computed(() => props.id ?? generatedId.value);
|
|
591
|
-
const labelId = vue.computed(() => related("label"));
|
|
592
|
-
const descriptionId = vue.computed(() => related("description"));
|
|
593
|
-
const toggle = () => {
|
|
594
|
-
if (props.disabled) return;
|
|
595
|
-
emit("update:modelValue", !props.modelValue);
|
|
596
|
-
};
|
|
597
|
-
const switchSizes = {
|
|
598
|
-
sm: "h-5 w-9",
|
|
599
|
-
md: "h-6 w-11",
|
|
600
|
-
lg: "h-7 w-14"
|
|
601
|
-
};
|
|
602
|
-
const dotSizes = {
|
|
603
|
-
sm: "size-3",
|
|
604
|
-
md: "size-4",
|
|
605
|
-
lg: "size-5"
|
|
606
|
-
};
|
|
607
|
-
const translateSizes = {
|
|
608
|
-
sm: "translate-x-5",
|
|
609
|
-
md: "translate-x-6",
|
|
610
|
-
lg: "translate-x-8"
|
|
611
|
-
};
|
|
612
|
-
return (_ctx, _cache) => {
|
|
613
|
-
return vue.openBlock(), vue.createElementBlock("label", {
|
|
614
|
-
class: vue.normalizeClass(["inline-flex items-start gap-3", __props.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"])
|
|
615
|
-
}, [
|
|
616
|
-
vue.createElementVNode("button", {
|
|
617
|
-
id: switchId.value,
|
|
618
|
-
type: "button",
|
|
619
|
-
role: "switch",
|
|
620
|
-
"aria-checked": __props.modelValue,
|
|
621
|
-
"aria-labelledby": __props.label ? labelId.value : void 0,
|
|
622
|
-
"aria-describedby": __props.description ? descriptionId.value : void 0,
|
|
623
|
-
disabled: __props.disabled,
|
|
624
|
-
class: vue.normalizeClass([
|
|
625
|
-
"relative inline-flex shrink-0 items-center rounded-full transition-colors focus:outline-hidden focus:ring-2 focus:ring-primary focus:ring-offset-2",
|
|
626
|
-
switchSizes[__props.size],
|
|
627
|
-
__props.modelValue ? "bg-primary" : "bg-gray-300 dark:bg-gray-600"
|
|
628
|
-
]),
|
|
629
|
-
onClick: toggle
|
|
630
|
-
}, [
|
|
631
|
-
vue.createElementVNode("span", {
|
|
632
|
-
class: vue.normalizeClass([
|
|
633
|
-
"inline-block transform rounded-full bg-white shadow-sm transition-transform",
|
|
634
|
-
dotSizes[__props.size],
|
|
635
|
-
__props.modelValue ? translateSizes[__props.size] : "translate-x-1"
|
|
636
|
-
]),
|
|
637
|
-
"aria-hidden": "true"
|
|
638
|
-
}, null, 2)
|
|
639
|
-
], 10, _hoisted_1$k),
|
|
640
|
-
__props.label || __props.description ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$f, [
|
|
641
|
-
__props.label ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
642
|
-
key: 0,
|
|
643
|
-
id: labelId.value,
|
|
644
|
-
class: "text-sm font-medium text-gray-900 dark:text-white"
|
|
645
|
-
}, vue.toDisplayString(__props.label), 9, _hoisted_3$e)) : vue.createCommentVNode("", true),
|
|
646
|
-
__props.description ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
647
|
-
key: 1,
|
|
648
|
-
id: descriptionId.value,
|
|
649
|
-
class: "text-sm text-gray-500 dark:text-gray-400"
|
|
650
|
-
}, vue.toDisplayString(__props.description), 9, _hoisted_4$a)) : vue.createCommentVNode("", true)
|
|
651
|
-
])) : vue.createCommentVNode("", true)
|
|
652
|
-
], 2);
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
const _hoisted_1$j = { class: "w-full" };
|
|
657
|
-
const _hoisted_2$e = {
|
|
658
|
-
key: 0,
|
|
659
|
-
class: "mb-2 flex justify-between text-sm"
|
|
660
|
-
};
|
|
661
|
-
const _hoisted_3$d = { class: "text-gray-600 dark:text-gray-400" };
|
|
662
|
-
const _hoisted_4$9 = { class: "font-medium text-gray-900 dark:text-white" };
|
|
663
|
-
const _hoisted_5$7 = { class: "text-gray-600 dark:text-gray-400" };
|
|
664
|
-
const _hoisted_6$7 = { class: "relative" };
|
|
665
|
-
const _hoisted_7$6 = ["value", "min", "max", "step", "disabled"];
|
|
666
|
-
const _hoisted_8$5 = { class: "pointer-events-none absolute inset-y-0 left-0 flex items-center" };
|
|
667
|
-
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
668
|
-
__name: "Slider",
|
|
669
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
670
|
-
min: { default: 0 },
|
|
671
|
-
max: { default: 100 },
|
|
672
|
-
step: { default: 1 },
|
|
673
|
-
disabled: { type: Boolean, default: false },
|
|
674
|
-
showValue: { type: Boolean, default: false },
|
|
675
|
-
formatValue: {}
|
|
676
|
-
}, {
|
|
677
|
-
"modelValue": { default: 0 },
|
|
678
|
-
"modelModifiers": {}
|
|
679
|
-
}),
|
|
680
|
-
emits: ["update:modelValue"],
|
|
681
|
-
setup(__props) {
|
|
682
|
-
const props = __props;
|
|
683
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
684
|
-
const percentage = vue.computed(() => {
|
|
685
|
-
return (modelValue.value - props.min) / (props.max - props.min) * 100;
|
|
686
|
-
});
|
|
687
|
-
const displayValue = vue.computed(() => {
|
|
688
|
-
if (props.formatValue) {
|
|
689
|
-
return props.formatValue(modelValue.value);
|
|
690
|
-
}
|
|
691
|
-
return modelValue.value.toString();
|
|
692
|
-
});
|
|
693
|
-
const handleInput = (event) => {
|
|
694
|
-
const target = event.target;
|
|
695
|
-
modelValue.value = Number(target.value);
|
|
696
|
-
};
|
|
697
|
-
return (_ctx, _cache) => {
|
|
698
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
699
|
-
__props.showValue ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$e, [
|
|
700
|
-
vue.createElementVNode("span", _hoisted_3$d, vue.toDisplayString(__props.min), 1),
|
|
701
|
-
vue.createElementVNode("span", _hoisted_4$9, vue.toDisplayString(displayValue.value), 1),
|
|
702
|
-
vue.createElementVNode("span", _hoisted_5$7, vue.toDisplayString(__props.max), 1)
|
|
703
|
-
])) : vue.createCommentVNode("", true),
|
|
704
|
-
vue.createElementVNode("div", _hoisted_6$7, [
|
|
705
|
-
vue.createElementVNode("input", {
|
|
706
|
-
type: "range",
|
|
707
|
-
value: modelValue.value,
|
|
708
|
-
min: __props.min,
|
|
709
|
-
max: __props.max,
|
|
710
|
-
step: __props.step,
|
|
711
|
-
disabled: __props.disabled,
|
|
712
|
-
class: "slider-input w-full cursor-pointer appearance-none bg-transparent disabled:cursor-not-allowed disabled:opacity-50",
|
|
713
|
-
onInput: handleInput
|
|
714
|
-
}, null, 40, _hoisted_7$6),
|
|
715
|
-
vue.createElementVNode("div", _hoisted_8$5, [
|
|
716
|
-
vue.createElementVNode("div", {
|
|
717
|
-
class: "h-2 rounded-full bg-primary",
|
|
718
|
-
style: vue.normalizeStyle({ width: `${percentage.value}%` })
|
|
719
|
-
}, null, 4)
|
|
720
|
-
])
|
|
721
|
-
])
|
|
722
|
-
]);
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
const Slider = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$j, [["__scopeId", "data-v-c25e2c2a"]]);
|
|
727
|
-
const _hoisted_1$i = { class: "relative" };
|
|
728
|
-
const _hoisted_2$d = ["id", "disabled", "aria-expanded", "aria-controls"];
|
|
729
|
-
const _hoisted_3$c = { class: "flex-1 truncate" };
|
|
730
|
-
const _hoisted_4$8 = { class: "flex items-center gap-1" };
|
|
731
|
-
const _hoisted_5$6 = ["id", "aria-label"];
|
|
732
|
-
const _hoisted_6$6 = { class: "mb-4 flex items-center justify-between" };
|
|
733
|
-
const _hoisted_7$5 = {
|
|
734
|
-
class: "font-medium text-gray-900 dark:text-white",
|
|
735
|
-
"aria-live": "polite",
|
|
736
|
-
"aria-atomic": "true"
|
|
737
|
-
};
|
|
738
|
-
const _hoisted_8$4 = {
|
|
739
|
-
class: "mb-2 grid grid-cols-7 gap-1",
|
|
740
|
-
role: "row"
|
|
741
|
-
};
|
|
742
|
-
const _hoisted_9$3 = ["abbr"];
|
|
743
|
-
const _hoisted_10$3 = ["id", "aria-label"];
|
|
744
|
-
const _hoisted_11$3 = ["aria-label", "aria-selected", "aria-disabled", "disabled", "onClick"];
|
|
745
|
-
const _hoisted_12$2 = { class: "mt-4 border-t border-gray-200 pt-3 dark:border-gray-700" };
|
|
746
|
-
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
747
|
-
__name: "DatePicker",
|
|
748
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
749
|
-
placeholder: { default: "Select date" },
|
|
750
|
-
format: { default: "short" },
|
|
751
|
-
locale: { default: "en-US" },
|
|
752
|
-
disabled: { type: Boolean, default: false },
|
|
753
|
-
minDate: {},
|
|
754
|
-
maxDate: {},
|
|
755
|
-
teleport: { type: Boolean, default: true },
|
|
756
|
-
id: {}
|
|
757
|
-
}, {
|
|
758
|
-
"modelValue": { default: null },
|
|
759
|
-
"modelModifiers": {}
|
|
760
|
-
}),
|
|
761
|
-
emits: ["update:modelValue"],
|
|
762
|
-
setup(__props) {
|
|
763
|
-
const props = __props;
|
|
764
|
-
const { related } = useId.useId({ prefix: "datepicker", id: props.id });
|
|
765
|
-
const triggerId = vue.computed(() => related("trigger"));
|
|
766
|
-
const calendarId = vue.computed(() => related("calendar"));
|
|
767
|
-
const gridId = vue.computed(() => related("grid"));
|
|
768
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
769
|
-
const triggerRef = vue.ref();
|
|
770
|
-
const calendarRef = vue.ref();
|
|
771
|
-
const { isOpen, dropdownStyle, toggle, close } = useDropdown.useDropdown(triggerRef, calendarRef, {
|
|
772
|
-
teleport: props.teleport,
|
|
773
|
-
gap: 4
|
|
774
|
-
});
|
|
775
|
-
const currentMonth = vue.ref(modelValue.value ? new Date(modelValue.value) : /* @__PURE__ */ new Date());
|
|
776
|
-
const weekDays = vue.computed(() => {
|
|
777
|
-
const days = [];
|
|
778
|
-
const formatter = new Intl.DateTimeFormat(props.locale, { weekday: "short" });
|
|
779
|
-
for (let i = 0; i < 7; i++) {
|
|
780
|
-
const date = new Date(2024, 0, i);
|
|
781
|
-
days.push(formatter.format(date));
|
|
782
|
-
}
|
|
783
|
-
return days;
|
|
784
|
-
});
|
|
785
|
-
const monthYear = vue.computed(() => {
|
|
786
|
-
const formatter = new Intl.DateTimeFormat(props.locale, { month: "long", year: "numeric" });
|
|
787
|
-
return formatter.format(currentMonth.value);
|
|
788
|
-
});
|
|
789
|
-
const calendarDays = vue.computed(() => {
|
|
790
|
-
const year = currentMonth.value.getFullYear();
|
|
791
|
-
const month = currentMonth.value.getMonth();
|
|
792
|
-
const firstDay = new Date(year, month, 1);
|
|
793
|
-
const lastDay = new Date(year, month + 1, 0);
|
|
794
|
-
const days = [];
|
|
795
|
-
let startDay = firstDay.getDay();
|
|
796
|
-
startDay = startDay === 0 ? 6 : startDay - 1;
|
|
797
|
-
for (let i = startDay - 1; i >= 0; i--) {
|
|
798
|
-
const date = new Date(year, month, -i);
|
|
799
|
-
days.push({
|
|
800
|
-
date,
|
|
801
|
-
isCurrentMonth: false,
|
|
802
|
-
isToday: false,
|
|
803
|
-
isSelected: false,
|
|
804
|
-
isDisabled: isDateDisabled(date)
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
const today = /* @__PURE__ */ new Date();
|
|
808
|
-
for (let i = 1; i <= lastDay.getDate(); i++) {
|
|
809
|
-
const date = new Date(year, month, i);
|
|
810
|
-
days.push({
|
|
811
|
-
date,
|
|
812
|
-
isCurrentMonth: true,
|
|
813
|
-
isToday: isSameDay(date, today),
|
|
814
|
-
isSelected: modelValue.value ? isSameDay(date, modelValue.value) : false,
|
|
815
|
-
isDisabled: isDateDisabled(date)
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
const remainingDays = 42 - days.length;
|
|
819
|
-
for (let i = 1; i <= remainingDays; i++) {
|
|
820
|
-
const date = new Date(year, month + 1, i);
|
|
821
|
-
days.push({
|
|
822
|
-
date,
|
|
823
|
-
isCurrentMonth: false,
|
|
824
|
-
isToday: false,
|
|
825
|
-
isSelected: false,
|
|
826
|
-
isDisabled: isDateDisabled(date)
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
return days;
|
|
830
|
-
});
|
|
831
|
-
const displayValue = vue.computed(() => {
|
|
832
|
-
if (!modelValue.value) return "";
|
|
833
|
-
const formatter = new Intl.DateTimeFormat(props.locale, {
|
|
834
|
-
dateStyle: props.format
|
|
835
|
-
});
|
|
836
|
-
return formatter.format(modelValue.value);
|
|
837
|
-
});
|
|
838
|
-
const isSameDay = (a, b) => {
|
|
839
|
-
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
840
|
-
};
|
|
841
|
-
const isDateDisabled = (date) => {
|
|
842
|
-
if (props.minDate && date < props.minDate) return true;
|
|
843
|
-
if (props.maxDate && date > props.maxDate) return true;
|
|
844
|
-
return false;
|
|
845
|
-
};
|
|
846
|
-
const prevMonth = () => {
|
|
847
|
-
currentMonth.value = new Date(currentMonth.value.getFullYear(), currentMonth.value.getMonth() - 1, 1);
|
|
848
|
-
};
|
|
849
|
-
const nextMonth = () => {
|
|
850
|
-
currentMonth.value = new Date(currentMonth.value.getFullYear(), currentMonth.value.getMonth() + 1, 1);
|
|
851
|
-
};
|
|
852
|
-
const selectDate = (day) => {
|
|
853
|
-
if (day.isDisabled) return;
|
|
854
|
-
modelValue.value = day.date;
|
|
855
|
-
close();
|
|
856
|
-
};
|
|
857
|
-
const clear = () => {
|
|
858
|
-
modelValue.value = null;
|
|
859
|
-
};
|
|
860
|
-
const getDateLabel = (date) => {
|
|
861
|
-
const formatter = new Intl.DateTimeFormat(props.locale, {
|
|
862
|
-
weekday: "long",
|
|
863
|
-
year: "numeric",
|
|
864
|
-
month: "long",
|
|
865
|
-
day: "numeric"
|
|
866
|
-
});
|
|
867
|
-
return formatter.format(date);
|
|
868
|
-
};
|
|
869
|
-
return (_ctx, _cache) => {
|
|
870
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
871
|
-
vue.createElementVNode("button", {
|
|
872
|
-
id: triggerId.value,
|
|
873
|
-
ref_key: "triggerRef",
|
|
874
|
-
ref: triggerRef,
|
|
875
|
-
type: "button",
|
|
876
|
-
disabled: __props.disabled,
|
|
877
|
-
"aria-expanded": vue.unref(isOpen),
|
|
878
|
-
"aria-haspopup": "dialog",
|
|
879
|
-
"aria-controls": calendarId.value,
|
|
880
|
-
class: vue.normalizeClass([
|
|
881
|
-
"flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm text-left transition",
|
|
882
|
-
__props.disabled ? "cursor-not-allowed border-gray-200 bg-gray-50 text-gray-500 dark:border-gray-800 dark:bg-gray-950" : vue.unref(isOpen) ? "border-primary ring-2 ring-primary/20 bg-white dark:bg-gray-900" : "border-gray-300 bg-white hover:border-gray-400 dark:border-gray-700 dark:bg-gray-900",
|
|
883
|
-
modelValue.value ? "text-gray-900 dark:text-white" : "text-gray-400 dark:text-gray-500"
|
|
884
|
-
]),
|
|
885
|
-
onClick: _cache[0] || (_cache[0] = //@ts-ignore
|
|
886
|
-
(...args) => vue.unref(toggle) && vue.unref(toggle)(...args))
|
|
887
|
-
}, [
|
|
888
|
-
vue.createElementVNode("span", _hoisted_3$c, vue.toDisplayString(displayValue.value || __props.placeholder), 1),
|
|
889
|
-
vue.createElementVNode("div", _hoisted_4$8, [
|
|
890
|
-
modelValue.value ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
891
|
-
key: 0,
|
|
892
|
-
type: "button",
|
|
893
|
-
class: "rounded p-0.5 hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
894
|
-
"aria-label": "Clear date",
|
|
895
|
-
onClick: vue.withModifiers(clear, ["stop"])
|
|
896
|
-
}, [
|
|
897
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
898
|
-
icon: "lucide:x",
|
|
899
|
-
class: "size-4 text-gray-400",
|
|
900
|
-
"aria-hidden": "true"
|
|
901
|
-
})
|
|
902
|
-
])) : vue.createCommentVNode("", true),
|
|
903
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
904
|
-
icon: "lucide:calendar",
|
|
905
|
-
class: "size-4 text-gray-400",
|
|
906
|
-
"aria-hidden": "true"
|
|
907
|
-
})
|
|
908
|
-
])
|
|
909
|
-
], 10, _hoisted_2$d),
|
|
910
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
911
|
-
to: "body",
|
|
912
|
-
disabled: !__props.teleport
|
|
913
|
-
}, [
|
|
914
|
-
vue.createVNode(vue.Transition, {
|
|
915
|
-
"enter-active-class": "transition duration-100 ease-out",
|
|
916
|
-
"enter-from-class": "opacity-0 scale-95",
|
|
917
|
-
"enter-to-class": "opacity-100 scale-100",
|
|
918
|
-
"leave-active-class": "transition duration-75 ease-in",
|
|
919
|
-
"leave-from-class": "opacity-100 scale-100",
|
|
920
|
-
"leave-to-class": "opacity-0 scale-95"
|
|
921
|
-
}, {
|
|
922
|
-
default: vue.withCtx(() => [
|
|
923
|
-
vue.unref(isOpen) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
924
|
-
key: 0,
|
|
925
|
-
id: calendarId.value,
|
|
926
|
-
ref_key: "calendarRef",
|
|
927
|
-
ref: calendarRef,
|
|
928
|
-
role: "dialog",
|
|
929
|
-
"aria-modal": "true",
|
|
930
|
-
"aria-label": `Choose date, ${monthYear.value}`,
|
|
931
|
-
style: vue.normalizeStyle(vue.unref(dropdownStyle)),
|
|
932
|
-
class: "z-9999 w-72 rounded-lg border border-gray-200 bg-white p-4 shadow-lg dark:border-gray-700 dark:bg-gray-800"
|
|
933
|
-
}, [
|
|
934
|
-
vue.createElementVNode("div", _hoisted_6$6, [
|
|
935
|
-
vue.createElementVNode("button", {
|
|
936
|
-
type: "button",
|
|
937
|
-
class: "rounded p-1 hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
938
|
-
"aria-label": "Previous month",
|
|
939
|
-
onClick: prevMonth
|
|
940
|
-
}, [
|
|
941
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
942
|
-
icon: "lucide:chevron-left",
|
|
943
|
-
class: "size-5 text-gray-600 dark:text-gray-400",
|
|
944
|
-
"aria-hidden": "true"
|
|
945
|
-
})
|
|
946
|
-
]),
|
|
947
|
-
vue.createElementVNode("span", _hoisted_7$5, vue.toDisplayString(monthYear.value), 1),
|
|
948
|
-
vue.createElementVNode("button", {
|
|
949
|
-
type: "button",
|
|
950
|
-
class: "rounded p-1 hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
951
|
-
"aria-label": "Next month",
|
|
952
|
-
onClick: nextMonth
|
|
953
|
-
}, [
|
|
954
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
955
|
-
icon: "lucide:chevron-right",
|
|
956
|
-
class: "size-5 text-gray-600 dark:text-gray-400",
|
|
957
|
-
"aria-hidden": "true"
|
|
958
|
-
})
|
|
959
|
-
])
|
|
960
|
-
]),
|
|
961
|
-
vue.createElementVNode("div", _hoisted_8$4, [
|
|
962
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(weekDays.value, (day) => {
|
|
963
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
964
|
-
key: day,
|
|
965
|
-
class: "text-center text-xs font-medium text-gray-500 dark:text-gray-400",
|
|
966
|
-
role: "columnheader",
|
|
967
|
-
abbr: day
|
|
968
|
-
}, vue.toDisplayString(day), 9, _hoisted_9$3);
|
|
969
|
-
}), 128))
|
|
970
|
-
]),
|
|
971
|
-
vue.createElementVNode("div", {
|
|
972
|
-
id: gridId.value,
|
|
973
|
-
class: "grid grid-cols-7 gap-1",
|
|
974
|
-
role: "grid",
|
|
975
|
-
"aria-label": monthYear.value
|
|
976
|
-
}, [
|
|
977
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(calendarDays.value, (day, index2) => {
|
|
978
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
979
|
-
key: index2,
|
|
980
|
-
type: "button",
|
|
981
|
-
role: "gridcell",
|
|
982
|
-
"aria-label": getDateLabel(day.date),
|
|
983
|
-
"aria-selected": day.isSelected,
|
|
984
|
-
"aria-disabled": day.isDisabled || void 0,
|
|
985
|
-
disabled: day.isDisabled,
|
|
986
|
-
class: vue.normalizeClass([
|
|
987
|
-
"size-8 rounded text-sm transition",
|
|
988
|
-
day.isDisabled && "cursor-not-allowed opacity-30",
|
|
989
|
-
!day.isCurrentMonth && "text-gray-400 dark:text-gray-600",
|
|
990
|
-
day.isCurrentMonth && !day.isSelected && !day.isToday && "text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
|
|
991
|
-
day.isToday && !day.isSelected && "bg-gray-100 font-semibold text-gray-900 dark:bg-gray-700 dark:text-white",
|
|
992
|
-
day.isSelected && "bg-primary text-white font-semibold"
|
|
993
|
-
]),
|
|
994
|
-
onClick: ($event) => selectDate(day)
|
|
995
|
-
}, vue.toDisplayString(day.date.getDate()), 11, _hoisted_11$3);
|
|
996
|
-
}), 128))
|
|
997
|
-
], 8, _hoisted_10$3),
|
|
998
|
-
vue.createElementVNode("div", _hoisted_12$2, [
|
|
999
|
-
vue.createElementVNode("button", {
|
|
1000
|
-
type: "button",
|
|
1001
|
-
class: "w-full rounded py-1.5 text-sm font-medium text-primary hover:bg-primary/10",
|
|
1002
|
-
onClick: _cache[1] || (_cache[1] = ($event) => selectDate({ date: /* @__PURE__ */ new Date(), isDisabled: false }))
|
|
1003
|
-
}, " Today ")
|
|
1004
|
-
])
|
|
1005
|
-
], 12, _hoisted_5$6)) : vue.createCommentVNode("", true)
|
|
1006
|
-
]),
|
|
1007
|
-
_: 1
|
|
1008
|
-
})
|
|
1009
|
-
], 8, ["disabled"]))
|
|
1010
|
-
]);
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
});
|
|
1014
|
-
const _hoisted_1$h = { class: "space-y-4" };
|
|
1015
|
-
const _hoisted_2$c = ["accept", "multiple", "disabled"];
|
|
1016
|
-
const _hoisted_3$b = { class: "space-y-2" };
|
|
1017
|
-
const _hoisted_4$7 = { class: "text-sm font-medium text-gray-700 dark:text-gray-300" };
|
|
1018
|
-
const _hoisted_5$5 = {
|
|
1019
|
-
key: 0,
|
|
1020
|
-
class: "text-xs text-gray-500 dark:text-gray-400"
|
|
1021
|
-
};
|
|
1022
|
-
const _hoisted_6$5 = {
|
|
1023
|
-
key: 1,
|
|
1024
|
-
class: "text-xs text-gray-500 dark:text-gray-400"
|
|
1025
|
-
};
|
|
1026
|
-
const _hoisted_7$4 = {
|
|
1027
|
-
key: 0,
|
|
1028
|
-
class: "space-y-2"
|
|
1029
|
-
};
|
|
1030
|
-
const _hoisted_8$3 = { class: "flex-1 min-w-0" };
|
|
1031
|
-
const _hoisted_9$2 = { class: "text-sm font-medium text-gray-700 dark:text-gray-300 truncate" };
|
|
1032
|
-
const _hoisted_10$2 = { class: "text-xs text-gray-500 dark:text-gray-400" };
|
|
1033
|
-
const _hoisted_11$2 = ["onClick"];
|
|
1034
|
-
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
1035
|
-
__name: "FileUpload",
|
|
1036
|
-
props: {
|
|
1037
|
-
accept: {},
|
|
1038
|
-
multiple: { type: Boolean, default: false },
|
|
1039
|
-
maxSize: {},
|
|
1040
|
-
maxFiles: {},
|
|
1041
|
-
disabled: { type: Boolean, default: false },
|
|
1042
|
-
label: { default: "Drop files here or click to upload" },
|
|
1043
|
-
description: { default: "" }
|
|
1044
|
-
},
|
|
1045
|
-
emits: ["files-selected", "file-removed", "error"],
|
|
1046
|
-
setup(__props, { emit: __emit }) {
|
|
1047
|
-
const props = __props;
|
|
1048
|
-
const emit = __emit;
|
|
1049
|
-
const isDragging = vue.ref(false);
|
|
1050
|
-
const files = vue.ref([]);
|
|
1051
|
-
const inputRef = vue.ref();
|
|
1052
|
-
const formatSize = (bytes) => {
|
|
1053
|
-
if (bytes === 0) return "0 B";
|
|
1054
|
-
const k = 1024;
|
|
1055
|
-
const sizes = ["B", "KB", "MB", "GB"];
|
|
1056
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1057
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
1058
|
-
};
|
|
1059
|
-
const validateFile = (file) => {
|
|
1060
|
-
var _a;
|
|
1061
|
-
if (props.maxSize && file.size > props.maxSize) {
|
|
1062
|
-
return `File too large. Max size: ${formatSize(props.maxSize)}`;
|
|
1063
|
-
}
|
|
1064
|
-
if (props.accept) {
|
|
1065
|
-
const acceptedTypes = props.accept.split(",").map((t) => t.trim());
|
|
1066
|
-
const fileType = file.type;
|
|
1067
|
-
const fileExt = "." + ((_a = file.name.split(".").pop()) == null ? void 0 : _a.toLowerCase());
|
|
1068
|
-
const isAccepted = acceptedTypes.some((type) => {
|
|
1069
|
-
if (type.startsWith(".")) {
|
|
1070
|
-
return fileExt === type.toLowerCase();
|
|
1071
|
-
}
|
|
1072
|
-
if (type.endsWith("/*")) {
|
|
1073
|
-
return fileType.startsWith(type.replace("/*", "/"));
|
|
1074
|
-
}
|
|
1075
|
-
return fileType === type;
|
|
1076
|
-
});
|
|
1077
|
-
if (!isAccepted) {
|
|
1078
|
-
return `File type not accepted`;
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
return null;
|
|
1082
|
-
};
|
|
1083
|
-
const addFiles = (newFiles) => {
|
|
1084
|
-
const fileArray = Array.from(newFiles);
|
|
1085
|
-
const validFiles = [];
|
|
1086
|
-
for (const file of fileArray) {
|
|
1087
|
-
if (props.maxFiles && files.value.length + validFiles.length >= props.maxFiles) {
|
|
1088
|
-
emit("error", `Maximum ${props.maxFiles} files allowed`);
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
const error = validateFile(file);
|
|
1092
|
-
if (error) {
|
|
1093
|
-
emit("error", `${file.name}: ${error}`);
|
|
1094
|
-
continue;
|
|
1095
|
-
}
|
|
1096
|
-
validFiles.push(file);
|
|
1097
|
-
files.value.push({
|
|
1098
|
-
file,
|
|
1099
|
-
id: Math.random().toString(36).substring(2),
|
|
1100
|
-
progress: 0,
|
|
1101
|
-
status: "pending"
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
if (validFiles.length > 0) {
|
|
1105
|
-
emit("files-selected", validFiles);
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
const removeFile = (id) => {
|
|
1109
|
-
const index2 = files.value.findIndex((f) => f.id === id);
|
|
1110
|
-
if (index2 > -1) {
|
|
1111
|
-
const removed = files.value.splice(index2, 1)[0];
|
|
1112
|
-
emit("file-removed", removed.file);
|
|
1113
|
-
}
|
|
1114
|
-
};
|
|
1115
|
-
const handleDrop = (e) => {
|
|
1116
|
-
var _a;
|
|
1117
|
-
isDragging.value = false;
|
|
1118
|
-
if (props.disabled || !((_a = e.dataTransfer) == null ? void 0 : _a.files)) return;
|
|
1119
|
-
addFiles(e.dataTransfer.files);
|
|
1120
|
-
};
|
|
1121
|
-
const handleDragOver = (e) => {
|
|
1122
|
-
e.preventDefault();
|
|
1123
|
-
if (!props.disabled) {
|
|
1124
|
-
isDragging.value = true;
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
const handleDragLeave = () => {
|
|
1128
|
-
isDragging.value = false;
|
|
1129
|
-
};
|
|
1130
|
-
const handleClick = () => {
|
|
1131
|
-
var _a;
|
|
1132
|
-
if (!props.disabled) {
|
|
1133
|
-
(_a = inputRef.value) == null ? void 0 : _a.click();
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
const handleInputChange = (e) => {
|
|
1137
|
-
const target = e.target;
|
|
1138
|
-
if (target.files) {
|
|
1139
|
-
addFiles(target.files);
|
|
1140
|
-
target.value = "";
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
const dropzoneClasses = vue.computed(() => {
|
|
1144
|
-
const base = "relative border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors";
|
|
1145
|
-
if (props.disabled) {
|
|
1146
|
-
return `${base} border-gray-200 bg-gray-50 cursor-not-allowed dark:border-gray-700 dark:bg-gray-800`;
|
|
1147
|
-
}
|
|
1148
|
-
if (isDragging.value) {
|
|
1149
|
-
return `${base} border-primary-500 bg-primary-50 dark:bg-primary-900/20`;
|
|
1150
|
-
}
|
|
1151
|
-
return `${base} border-gray-300 hover:border-primary-400 hover:bg-gray-50 dark:border-gray-600 dark:hover:border-primary-500 dark:hover:bg-gray-800`;
|
|
1152
|
-
});
|
|
1153
|
-
const getFileIcon = (file) => {
|
|
1154
|
-
if (file.type.startsWith("image/")) return "heroicons:photo";
|
|
1155
|
-
if (file.type.startsWith("video/")) return "heroicons:video-camera";
|
|
1156
|
-
if (file.type.startsWith("audio/")) return "heroicons:musical-note";
|
|
1157
|
-
if (file.type.includes("pdf")) return "heroicons:document-text";
|
|
1158
|
-
if (file.type.includes("zip") || file.type.includes("rar")) return "heroicons:archive-box";
|
|
1159
|
-
return "heroicons:document";
|
|
1160
|
-
};
|
|
1161
|
-
return (_ctx, _cache) => {
|
|
1162
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
1163
|
-
vue.createElementVNode("div", {
|
|
1164
|
-
class: vue.normalizeClass(dropzoneClasses.value),
|
|
1165
|
-
onDrop: vue.withModifiers(handleDrop, ["prevent"]),
|
|
1166
|
-
onDragover: handleDragOver,
|
|
1167
|
-
onDragleave: handleDragLeave,
|
|
1168
|
-
onClick: handleClick
|
|
1169
|
-
}, [
|
|
1170
|
-
vue.createElementVNode("input", {
|
|
1171
|
-
ref_key: "inputRef",
|
|
1172
|
-
ref: inputRef,
|
|
1173
|
-
type: "file",
|
|
1174
|
-
class: "hidden",
|
|
1175
|
-
accept: __props.accept,
|
|
1176
|
-
multiple: __props.multiple,
|
|
1177
|
-
disabled: __props.disabled,
|
|
1178
|
-
onChange: handleInputChange
|
|
1179
|
-
}, null, 40, _hoisted_2$c),
|
|
1180
|
-
vue.createElementVNode("div", _hoisted_3$b, [
|
|
1181
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1182
|
-
icon: "heroicons:cloud-arrow-up",
|
|
1183
|
-
class: vue.normalizeClass(["size-12 mx-auto text-gray-400", { "text-primary-500": isDragging.value }])
|
|
1184
|
-
}, null, 8, ["class"]),
|
|
1185
|
-
vue.createElementVNode("p", _hoisted_4$7, vue.toDisplayString(__props.label), 1),
|
|
1186
|
-
__props.description ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_5$5, vue.toDisplayString(__props.description), 1)) : vue.createCommentVNode("", true),
|
|
1187
|
-
__props.maxSize ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_6$5, " Max size: " + vue.toDisplayString(formatSize(__props.maxSize)), 1)) : vue.createCommentVNode("", true)
|
|
1188
|
-
])
|
|
1189
|
-
], 34),
|
|
1190
|
-
files.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("ul", _hoisted_7$4, [
|
|
1191
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(files.value, (uploadedFile) => {
|
|
1192
|
-
return vue.openBlock(), vue.createElementBlock("li", {
|
|
1193
|
-
key: uploadedFile.id,
|
|
1194
|
-
class: "flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg"
|
|
1195
|
-
}, [
|
|
1196
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1197
|
-
icon: getFileIcon(uploadedFile.file),
|
|
1198
|
-
class: "size-8 text-gray-400"
|
|
1199
|
-
}, null, 8, ["icon"]),
|
|
1200
|
-
vue.createElementVNode("div", _hoisted_8$3, [
|
|
1201
|
-
vue.createElementVNode("p", _hoisted_9$2, vue.toDisplayString(uploadedFile.file.name), 1),
|
|
1202
|
-
vue.createElementVNode("p", _hoisted_10$2, vue.toDisplayString(formatSize(uploadedFile.file.size)), 1)
|
|
1203
|
-
]),
|
|
1204
|
-
vue.createElementVNode("button", {
|
|
1205
|
-
type: "button",
|
|
1206
|
-
class: "p-1 text-gray-400 hover:text-red-500 rounded",
|
|
1207
|
-
onClick: vue.withModifiers(($event) => removeFile(uploadedFile.id), ["stop"])
|
|
1208
|
-
}, [
|
|
1209
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1210
|
-
icon: "heroicons:x-mark",
|
|
1211
|
-
class: "size-5"
|
|
1212
|
-
})
|
|
1213
|
-
], 8, _hoisted_11$2)
|
|
1214
|
-
]);
|
|
1215
|
-
}), 128))
|
|
1216
|
-
])) : vue.createCommentVNode("", true)
|
|
1217
|
-
]);
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
const _hoisted_1$g = { class: "flex items-center gap-1" };
|
|
1222
|
-
const _hoisted_2$b = ["disabled", "onClick", "onMousemove"];
|
|
1223
|
-
const _hoisted_3$a = {
|
|
1224
|
-
key: 0,
|
|
1225
|
-
class: "ml-2 text-sm font-medium text-gray-700 dark:text-gray-300"
|
|
1226
|
-
};
|
|
1227
|
-
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
1228
|
-
__name: "Rating",
|
|
1229
|
-
props: {
|
|
1230
|
-
modelValue: { default: 0 },
|
|
1231
|
-
max: { default: 5 },
|
|
1232
|
-
allowHalf: { type: Boolean, default: false },
|
|
1233
|
-
readonly: { type: Boolean, default: false },
|
|
1234
|
-
disabled: { type: Boolean, default: false },
|
|
1235
|
-
size: { default: "md" },
|
|
1236
|
-
filledIcon: { default: "heroicons:star-solid" },
|
|
1237
|
-
emptyIcon: { default: "heroicons:star" },
|
|
1238
|
-
halfIcon: { default: "heroicons:star-solid" },
|
|
1239
|
-
color: { default: "text-yellow-400" },
|
|
1240
|
-
showValue: { type: Boolean, default: false }
|
|
1241
|
-
},
|
|
1242
|
-
emits: ["update:modelValue"],
|
|
1243
|
-
setup(__props, { emit: __emit }) {
|
|
1244
|
-
const props = __props;
|
|
1245
|
-
const emit = __emit;
|
|
1246
|
-
const hoverValue = vue.ref(null);
|
|
1247
|
-
const displayValue = vue.computed(() => {
|
|
1248
|
-
return hoverValue.value !== null ? hoverValue.value : props.modelValue;
|
|
1249
|
-
});
|
|
1250
|
-
const sizeClasses = vue.computed(() => {
|
|
1251
|
-
switch (props.size) {
|
|
1252
|
-
case "sm":
|
|
1253
|
-
return "size-4";
|
|
1254
|
-
case "lg":
|
|
1255
|
-
return "size-8";
|
|
1256
|
-
default:
|
|
1257
|
-
return "size-6";
|
|
1258
|
-
}
|
|
1259
|
-
});
|
|
1260
|
-
const getStarState = (index2) => {
|
|
1261
|
-
const value = displayValue.value;
|
|
1262
|
-
if (value >= index2) return "full";
|
|
1263
|
-
if (props.allowHalf && value >= index2 - 0.5) return "half";
|
|
1264
|
-
return "empty";
|
|
1265
|
-
};
|
|
1266
|
-
const handleClick = (index2, event) => {
|
|
1267
|
-
if (props.readonly || props.disabled) return;
|
|
1268
|
-
let value = index2;
|
|
1269
|
-
if (props.allowHalf) {
|
|
1270
|
-
const rect = event.target.getBoundingClientRect();
|
|
1271
|
-
const isLeftHalf = event.clientX - rect.left < rect.width / 2;
|
|
1272
|
-
value = isLeftHalf ? index2 - 0.5 : index2;
|
|
1273
|
-
}
|
|
1274
|
-
emit("update:modelValue", value);
|
|
1275
|
-
};
|
|
1276
|
-
const handleMouseMove = (index2, event) => {
|
|
1277
|
-
if (props.readonly || props.disabled) return;
|
|
1278
|
-
let value = index2;
|
|
1279
|
-
if (props.allowHalf) {
|
|
1280
|
-
const rect = event.target.getBoundingClientRect();
|
|
1281
|
-
const isLeftHalf = event.clientX - rect.left < rect.width / 2;
|
|
1282
|
-
value = isLeftHalf ? index2 - 0.5 : index2;
|
|
1283
|
-
}
|
|
1284
|
-
hoverValue.value = value;
|
|
1285
|
-
};
|
|
1286
|
-
const handleMouseLeave = () => {
|
|
1287
|
-
hoverValue.value = null;
|
|
1288
|
-
};
|
|
1289
|
-
return (_ctx, _cache) => {
|
|
1290
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
1291
|
-
vue.createElementVNode("div", {
|
|
1292
|
-
class: "flex items-center",
|
|
1293
|
-
onMouseleave: handleMouseLeave
|
|
1294
|
-
}, [
|
|
1295
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.max, (index2) => {
|
|
1296
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
1297
|
-
key: index2,
|
|
1298
|
-
type: "button",
|
|
1299
|
-
class: vue.normalizeClass(["relative focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-1 rounded", [
|
|
1300
|
-
__props.readonly || __props.disabled ? "cursor-default" : "cursor-pointer",
|
|
1301
|
-
__props.disabled && "opacity-50"
|
|
1302
|
-
]]),
|
|
1303
|
-
disabled: __props.readonly || __props.disabled,
|
|
1304
|
-
onClick: ($event) => handleClick(index2, $event),
|
|
1305
|
-
onMousemove: ($event) => handleMouseMove(index2, $event)
|
|
1306
|
-
}, [
|
|
1307
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1308
|
-
icon: __props.emptyIcon,
|
|
1309
|
-
class: vue.normalizeClass([sizeClasses.value, "text-gray-300 dark:text-gray-600"])
|
|
1310
|
-
}, null, 8, ["icon", "class"]),
|
|
1311
|
-
vue.createElementVNode("div", {
|
|
1312
|
-
class: "absolute inset-0 overflow-hidden",
|
|
1313
|
-
style: vue.normalizeStyle({
|
|
1314
|
-
width: getStarState(index2) === "full" ? "100%" : getStarState(index2) === "half" ? "50%" : "0%"
|
|
1315
|
-
})
|
|
1316
|
-
}, [
|
|
1317
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1318
|
-
icon: __props.filledIcon,
|
|
1319
|
-
class: vue.normalizeClass([sizeClasses.value, __props.color])
|
|
1320
|
-
}, null, 8, ["icon", "class"])
|
|
1321
|
-
], 4)
|
|
1322
|
-
], 42, _hoisted_2$b);
|
|
1323
|
-
}), 128))
|
|
1324
|
-
], 32),
|
|
1325
|
-
__props.showValue ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$a, vue.toDisplayString(__props.modelValue.toFixed(__props.allowHalf ? 1 : 0)), 1)) : vue.createCommentVNode("", true)
|
|
1326
|
-
]);
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
const _hoisted_1$f = { class: "relative inline-block" };
|
|
1331
|
-
const _hoisted_2$a = {
|
|
1332
|
-
key: 0,
|
|
1333
|
-
class: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1"
|
|
1334
|
-
};
|
|
1335
|
-
const _hoisted_3$9 = ["disabled"];
|
|
1336
|
-
const _hoisted_4$6 = { class: "text-sm font-mono text-gray-700 dark:text-gray-300" };
|
|
1337
|
-
const _hoisted_5$4 = { class: "grid grid-cols-5 gap-2 mb-3" };
|
|
1338
|
-
const _hoisted_6$4 = ["title", "onClick"];
|
|
1339
|
-
const _hoisted_7$3 = {
|
|
1340
|
-
key: 0,
|
|
1341
|
-
class: "flex items-center gap-2 pt-3 border-t border-gray-200 dark:border-gray-700"
|
|
1342
|
-
};
|
|
1343
|
-
const _hoisted_8$2 = ["value"];
|
|
1344
|
-
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
1345
|
-
__name: "ColorPicker",
|
|
1346
|
-
props: {
|
|
1347
|
-
modelValue: { default: "#3b82f6" },
|
|
1348
|
-
swatches: { default: () => [
|
|
1349
|
-
"#ef4444",
|
|
1350
|
-
"#f97316",
|
|
1351
|
-
"#f59e0b",
|
|
1352
|
-
"#eab308",
|
|
1353
|
-
"#84cc16",
|
|
1354
|
-
"#22c55e",
|
|
1355
|
-
"#10b981",
|
|
1356
|
-
"#14b8a6",
|
|
1357
|
-
"#06b6d4",
|
|
1358
|
-
"#0ea5e9",
|
|
1359
|
-
"#3b82f6",
|
|
1360
|
-
"#6366f1",
|
|
1361
|
-
"#8b5cf6",
|
|
1362
|
-
"#a855f7",
|
|
1363
|
-
"#d946ef",
|
|
1364
|
-
"#ec4899",
|
|
1365
|
-
"#f43f5e",
|
|
1366
|
-
"#78716c",
|
|
1367
|
-
"#737373",
|
|
1368
|
-
"#000000"
|
|
1369
|
-
] },
|
|
1370
|
-
showInput: { type: Boolean, default: true },
|
|
1371
|
-
disabled: { type: Boolean, default: false },
|
|
1372
|
-
label: {},
|
|
1373
|
-
teleport: { type: [String, Boolean], default: false }
|
|
1374
|
-
},
|
|
1375
|
-
emits: ["update:modelValue"],
|
|
1376
|
-
setup(__props, { emit: __emit }) {
|
|
1377
|
-
const props = __props;
|
|
1378
|
-
const teleportDisabled = vue.computed(() => props.teleport === false);
|
|
1379
|
-
const teleportTarget = vue.computed(() => props.teleport === false ? "body" : props.teleport);
|
|
1380
|
-
const emit = __emit;
|
|
1381
|
-
const isOpen = vue.ref(false);
|
|
1382
|
-
const inputValue = vue.ref(props.modelValue);
|
|
1383
|
-
vue.watch(
|
|
1384
|
-
() => props.modelValue,
|
|
1385
|
-
(newValue) => {
|
|
1386
|
-
inputValue.value = newValue;
|
|
1387
|
-
}
|
|
1388
|
-
);
|
|
1389
|
-
const selectColor = (color) => {
|
|
1390
|
-
emit("update:modelValue", color);
|
|
1391
|
-
inputValue.value = color;
|
|
1392
|
-
};
|
|
1393
|
-
const handleInputChange = () => {
|
|
1394
|
-
const color = inputValue.value;
|
|
1395
|
-
if (/^#([0-9A-Fa-f]{3}){1,2}$/.test(color)) {
|
|
1396
|
-
emit("update:modelValue", color);
|
|
1397
|
-
}
|
|
1398
|
-
};
|
|
1399
|
-
const handleNativeInput = (event) => {
|
|
1400
|
-
const color = event.target.value;
|
|
1401
|
-
emit("update:modelValue", color);
|
|
1402
|
-
inputValue.value = color;
|
|
1403
|
-
};
|
|
1404
|
-
const togglePicker = () => {
|
|
1405
|
-
if (!props.disabled) {
|
|
1406
|
-
isOpen.value = !isOpen.value;
|
|
1407
|
-
}
|
|
1408
|
-
};
|
|
1409
|
-
const closePicker = () => {
|
|
1410
|
-
isOpen.value = false;
|
|
1411
|
-
};
|
|
1412
|
-
return (_ctx, _cache) => {
|
|
1413
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
1414
|
-
__props.label ? (vue.openBlock(), vue.createElementBlock("label", _hoisted_2$a, vue.toDisplayString(__props.label), 1)) : vue.createCommentVNode("", true),
|
|
1415
|
-
vue.createElementVNode("button", {
|
|
1416
|
-
type: "button",
|
|
1417
|
-
class: vue.normalizeClass(["flex items-center gap-2 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors", { "opacity-50 cursor-not-allowed": __props.disabled }]),
|
|
1418
|
-
disabled: __props.disabled,
|
|
1419
|
-
onClick: togglePicker
|
|
1420
|
-
}, [
|
|
1421
|
-
vue.createElementVNode("span", {
|
|
1422
|
-
class: "size-6 rounded border border-gray-200 dark:border-gray-600",
|
|
1423
|
-
style: vue.normalizeStyle({ backgroundColor: __props.modelValue })
|
|
1424
|
-
}, null, 4),
|
|
1425
|
-
vue.createElementVNode("span", _hoisted_4$6, vue.toDisplayString(__props.modelValue), 1),
|
|
1426
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1427
|
-
icon: "heroicons:chevron-down",
|
|
1428
|
-
class: vue.normalizeClass(["size-4 text-gray-400", { "rotate-180": isOpen.value }])
|
|
1429
|
-
}, null, 8, ["class"])
|
|
1430
|
-
], 10, _hoisted_3$9),
|
|
1431
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
1432
|
-
to: teleportTarget.value,
|
|
1433
|
-
disabled: teleportDisabled.value
|
|
1434
|
-
}, [
|
|
1435
|
-
vue.createVNode(vue.Transition, {
|
|
1436
|
-
"enter-active-class": "transition duration-100 ease-out",
|
|
1437
|
-
"enter-from-class": "opacity-0 scale-95",
|
|
1438
|
-
"enter-to-class": "opacity-100 scale-100",
|
|
1439
|
-
"leave-active-class": "transition duration-75 ease-in",
|
|
1440
|
-
"leave-from-class": "opacity-100 scale-100",
|
|
1441
|
-
"leave-to-class": "opacity-0 scale-95"
|
|
1442
|
-
}, {
|
|
1443
|
-
default: vue.withCtx(() => [
|
|
1444
|
-
isOpen.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1445
|
-
key: 0,
|
|
1446
|
-
class: "absolute z-50 mt-2 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",
|
|
1447
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
1448
|
-
}, ["stop"]))
|
|
1449
|
-
}, [
|
|
1450
|
-
vue.createElementVNode("div", _hoisted_5$4, [
|
|
1451
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.swatches, (color) => {
|
|
1452
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
1453
|
-
key: color,
|
|
1454
|
-
type: "button",
|
|
1455
|
-
class: vue.normalizeClass(["size-8 rounded-lg border-2 transition-transform hover:scale-110 focus:outline-hidden focus:ring-2 focus:ring-primary-500 focus:ring-offset-1", [
|
|
1456
|
-
__props.modelValue === color ? "border-primary-500 ring-2 ring-primary-500 ring-offset-1" : "border-transparent"
|
|
1457
|
-
]]),
|
|
1458
|
-
style: vue.normalizeStyle({ backgroundColor: color }),
|
|
1459
|
-
title: color,
|
|
1460
|
-
onClick: ($event) => selectColor(color)
|
|
1461
|
-
}, [
|
|
1462
|
-
__props.modelValue === color ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
1463
|
-
key: 0,
|
|
1464
|
-
icon: "heroicons:check",
|
|
1465
|
-
class: vue.normalizeClass(["size-4 mx-auto", [
|
|
1466
|
-
["#ffffff", "#f9fafb", "#f3f4f6", "#e5e7eb", "#eab308", "#f59e0b"].includes(color) ? "text-gray-800" : "text-white"
|
|
1467
|
-
]])
|
|
1468
|
-
}, null, 8, ["class"])) : vue.createCommentVNode("", true)
|
|
1469
|
-
], 14, _hoisted_6$4);
|
|
1470
|
-
}), 128))
|
|
1471
|
-
]),
|
|
1472
|
-
__props.showInput ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
|
|
1473
|
-
vue.createElementVNode("input", {
|
|
1474
|
-
type: "color",
|
|
1475
|
-
value: __props.modelValue,
|
|
1476
|
-
class: "size-8 rounded cursor-pointer border-0 p-0",
|
|
1477
|
-
onInput: handleNativeInput
|
|
1478
|
-
}, null, 40, _hoisted_8$2),
|
|
1479
|
-
vue.withDirectives(vue.createElementVNode("input", {
|
|
1480
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
1481
|
-
type: "text",
|
|
1482
|
-
class: "flex-1 px-2 py-1 text-sm font-mono border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white",
|
|
1483
|
-
placeholder: "#000000",
|
|
1484
|
-
onChange: handleInputChange,
|
|
1485
|
-
onKeyup: vue.withKeys(handleInputChange, ["enter"])
|
|
1486
|
-
}, null, 544), [
|
|
1487
|
-
[vue.vModelText, inputValue.value]
|
|
1488
|
-
])
|
|
1489
|
-
])) : vue.createCommentVNode("", true)
|
|
1490
|
-
])) : vue.createCommentVNode("", true)
|
|
1491
|
-
]),
|
|
1492
|
-
_: 1
|
|
1493
|
-
}),
|
|
1494
|
-
isOpen.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1495
|
-
key: 0,
|
|
1496
|
-
class: "fixed inset-0 z-40",
|
|
1497
|
-
onClick: closePicker
|
|
1498
|
-
})) : vue.createCommentVNode("", true)
|
|
1499
|
-
], 8, ["to", "disabled"]))
|
|
1500
|
-
]);
|
|
1501
|
-
};
|
|
1502
|
-
}
|
|
1503
|
-
});
|
|
1504
|
-
const _hoisted_1$e = { class: "space-y-2" };
|
|
1505
|
-
const _hoisted_2$9 = {
|
|
1506
|
-
key: 0,
|
|
1507
|
-
class: "flex justify-between text-sm font-medium text-gray-700 dark:text-gray-300"
|
|
1508
|
-
};
|
|
1509
|
-
const _hoisted_3$8 = {
|
|
1510
|
-
key: 1,
|
|
1511
|
-
class: "flex justify-between text-xs text-gray-500 dark:text-gray-400"
|
|
1512
|
-
};
|
|
1513
|
-
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
1514
|
-
__name: "RangeSlider",
|
|
1515
|
-
props: {
|
|
1516
|
-
modelValue: { default: () => [25, 75] },
|
|
1517
|
-
min: { default: 0 },
|
|
1518
|
-
max: { default: 100 },
|
|
1519
|
-
step: { default: 1 },
|
|
1520
|
-
disabled: { type: Boolean, default: false },
|
|
1521
|
-
showLabels: { type: Boolean, default: true },
|
|
1522
|
-
showMinMax: { type: Boolean, default: true },
|
|
1523
|
-
formatLabel: { type: Function, default: (v) => v.toString() }
|
|
1524
|
-
},
|
|
1525
|
-
emits: ["update:modelValue"],
|
|
1526
|
-
setup(__props, { emit: __emit }) {
|
|
1527
|
-
const props = __props;
|
|
1528
|
-
const emit = __emit;
|
|
1529
|
-
const sliderRef = vue.ref();
|
|
1530
|
-
const dragging = vue.ref(null);
|
|
1531
|
-
const minValue = vue.computed(() => props.modelValue[0]);
|
|
1532
|
-
const maxValue = vue.computed(() => props.modelValue[1]);
|
|
1533
|
-
const minPercent = vue.computed(() => {
|
|
1534
|
-
return (minValue.value - props.min) / (props.max - props.min) * 100;
|
|
1535
|
-
});
|
|
1536
|
-
const maxPercent = vue.computed(() => {
|
|
1537
|
-
return (maxValue.value - props.min) / (props.max - props.min) * 100;
|
|
1538
|
-
});
|
|
1539
|
-
const rangeStyle = vue.computed(() => ({
|
|
1540
|
-
left: `${minPercent.value}%`,
|
|
1541
|
-
width: `${maxPercent.value - minPercent.value}%`
|
|
1542
|
-
}));
|
|
1543
|
-
const getValueFromPosition = (clientX) => {
|
|
1544
|
-
if (!sliderRef.value) return props.min;
|
|
1545
|
-
const rect = sliderRef.value.getBoundingClientRect();
|
|
1546
|
-
const percent = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
|
|
1547
|
-
const rawValue = props.min + percent * (props.max - props.min);
|
|
1548
|
-
const steppedValue = Math.round(rawValue / props.step) * props.step;
|
|
1549
|
-
return Math.max(props.min, Math.min(props.max, steppedValue));
|
|
1550
|
-
};
|
|
1551
|
-
const updateValue = (handle, newValue) => {
|
|
1552
|
-
const [currentMin, currentMax] = props.modelValue;
|
|
1553
|
-
if (handle === "min") {
|
|
1554
|
-
const clampedValue = Math.min(newValue, currentMax);
|
|
1555
|
-
emit("update:modelValue", [clampedValue, currentMax]);
|
|
1556
|
-
} else {
|
|
1557
|
-
const clampedValue = Math.max(newValue, currentMin);
|
|
1558
|
-
emit("update:modelValue", [currentMin, clampedValue]);
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
const handleMouseDown = (handle) => (event) => {
|
|
1562
|
-
if (props.disabled) return;
|
|
1563
|
-
event.preventDefault();
|
|
1564
|
-
dragging.value = handle;
|
|
1565
|
-
const handleMouseMove = (e) => {
|
|
1566
|
-
if (dragging.value) {
|
|
1567
|
-
const value = getValueFromPosition(e.clientX);
|
|
1568
|
-
updateValue(dragging.value, value);
|
|
1569
|
-
}
|
|
1570
|
-
};
|
|
1571
|
-
const handleMouseUp = () => {
|
|
1572
|
-
dragging.value = null;
|
|
1573
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
1574
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
1575
|
-
};
|
|
1576
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
1577
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
1578
|
-
};
|
|
1579
|
-
const handleTrackClick = (event) => {
|
|
1580
|
-
if (props.disabled) return;
|
|
1581
|
-
const value = getValueFromPosition(event.clientX);
|
|
1582
|
-
const distToMin = Math.abs(value - minValue.value);
|
|
1583
|
-
const distToMax = Math.abs(value - maxValue.value);
|
|
1584
|
-
if (distToMin <= distToMax) {
|
|
1585
|
-
updateValue("min", value);
|
|
1586
|
-
} else {
|
|
1587
|
-
updateValue("max", value);
|
|
1588
|
-
}
|
|
1589
|
-
};
|
|
1590
|
-
return (_ctx, _cache) => {
|
|
1591
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
1592
|
-
__props.showLabels ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, [
|
|
1593
|
-
vue.createElementVNode("span", null, vue.toDisplayString(__props.formatLabel(minValue.value)), 1),
|
|
1594
|
-
vue.createElementVNode("span", null, vue.toDisplayString(__props.formatLabel(maxValue.value)), 1)
|
|
1595
|
-
])) : vue.createCommentVNode("", true),
|
|
1596
|
-
vue.createElementVNode("div", {
|
|
1597
|
-
ref_key: "sliderRef",
|
|
1598
|
-
ref: sliderRef,
|
|
1599
|
-
class: vue.normalizeClass(["relative h-2 rounded-full cursor-pointer", [
|
|
1600
|
-
__props.disabled ? "bg-gray-200 dark:bg-gray-700 cursor-not-allowed" : "bg-gray-200 dark:bg-gray-700"
|
|
1601
|
-
]]),
|
|
1602
|
-
onClick: handleTrackClick
|
|
1603
|
-
}, [
|
|
1604
|
-
vue.createElementVNode("div", {
|
|
1605
|
-
class: vue.normalizeClass(["absolute h-full rounded-full", [__props.disabled ? "bg-gray-400" : "bg-primary-500"]]),
|
|
1606
|
-
style: vue.normalizeStyle(rangeStyle.value)
|
|
1607
|
-
}, null, 6),
|
|
1608
|
-
vue.createElementVNode("div", {
|
|
1609
|
-
class: vue.normalizeClass(["absolute top-1/2 -translate-y-1/2 -translate-x-1/2 size-5 rounded-full border-2 shadow transition-shadow", [
|
|
1610
|
-
__props.disabled ? "bg-gray-300 border-gray-400 cursor-not-allowed" : "bg-white border-primary-500 cursor-grab hover:shadow-md active:cursor-grabbing",
|
|
1611
|
-
dragging.value === "min" && "ring-4 ring-primary-200 dark:ring-primary-800"
|
|
1612
|
-
]]),
|
|
1613
|
-
style: vue.normalizeStyle({ left: `${minPercent.value}%` }),
|
|
1614
|
-
onMousedown: _cache[0] || (_cache[0] = ($event) => handleMouseDown("min"))
|
|
1615
|
-
}, null, 38),
|
|
1616
|
-
vue.createElementVNode("div", {
|
|
1617
|
-
class: vue.normalizeClass(["absolute top-1/2 -translate-y-1/2 -translate-x-1/2 size-5 rounded-full border-2 shadow transition-shadow", [
|
|
1618
|
-
__props.disabled ? "bg-gray-300 border-gray-400 cursor-not-allowed" : "bg-white border-primary-500 cursor-grab hover:shadow-md active:cursor-grabbing",
|
|
1619
|
-
dragging.value === "max" && "ring-4 ring-primary-200 dark:ring-primary-800"
|
|
1620
|
-
]]),
|
|
1621
|
-
style: vue.normalizeStyle({ left: `${maxPercent.value}%` }),
|
|
1622
|
-
onMousedown: _cache[1] || (_cache[1] = ($event) => handleMouseDown("max"))
|
|
1623
|
-
}, null, 38)
|
|
1624
|
-
], 2),
|
|
1625
|
-
__props.showMinMax ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$8, [
|
|
1626
|
-
vue.createElementVNode("span", null, vue.toDisplayString(__props.formatLabel(__props.min)), 1),
|
|
1627
|
-
vue.createElementVNode("span", null, vue.toDisplayString(__props.formatLabel(__props.max)), 1)
|
|
1628
|
-
])) : vue.createCommentVNode("", true)
|
|
1629
|
-
]);
|
|
1630
|
-
};
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
const _hoisted_1$d = ["aria-expanded", "aria-controls"];
|
|
1634
|
-
const _hoisted_2$8 = ["id", "name", "placeholder", "disabled", "aria-controls"];
|
|
1635
|
-
const _hoisted_3$7 = { class: "flex items-center gap-1" };
|
|
1636
|
-
const _hoisted_4$5 = ["id", "aria-label", "aria-multiselectable"];
|
|
1637
|
-
const _hoisted_5$3 = ["aria-selected", "aria-disabled", "disabled", "onClick"];
|
|
1638
|
-
const _hoisted_6$3 = { class: "flex-1" };
|
|
1639
|
-
const _hoisted_7$2 = {
|
|
1640
|
-
key: 1,
|
|
1641
|
-
class: "px-3 py-2 text-center text-sm text-gray-500 dark:text-gray-400",
|
|
1642
|
-
role: "status"
|
|
1643
|
-
};
|
|
1644
|
-
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
1645
|
-
__name: "Combobox",
|
|
1646
|
-
props: {
|
|
1647
|
-
modelValue: {},
|
|
1648
|
-
options: {},
|
|
1649
|
-
placeholder: { default: "Select..." },
|
|
1650
|
-
searchPlaceholder: { default: "Search..." },
|
|
1651
|
-
multiple: { type: Boolean, default: false },
|
|
1652
|
-
disabled: { type: Boolean, default: false },
|
|
1653
|
-
clearable: { type: Boolean, default: false },
|
|
1654
|
-
noResultsText: { default: "No results found" },
|
|
1655
|
-
name: {},
|
|
1656
|
-
id: {},
|
|
1657
|
-
teleport: { type: [String, Boolean], default: false }
|
|
1658
|
-
},
|
|
1659
|
-
emits: ["update:modelValue"],
|
|
1660
|
-
setup(__props, { emit: __emit }) {
|
|
1661
|
-
const props = __props;
|
|
1662
|
-
const { id: generatedId, related } = useId.useId({ prefix: "combobox", id: props.id });
|
|
1663
|
-
const inputId = vue.computed(() => props.id ?? generatedId.value);
|
|
1664
|
-
const listboxId = vue.computed(() => related("listbox"));
|
|
1665
|
-
const teleportDisabled = vue.computed(() => props.teleport === false);
|
|
1666
|
-
const teleportTarget = vue.computed(() => props.teleport === false ? "body" : props.teleport);
|
|
1667
|
-
const emit = __emit;
|
|
1668
|
-
const containerRef = vue.ref();
|
|
1669
|
-
const inputRef = vue.ref();
|
|
1670
|
-
const isOpen = vue.ref(false);
|
|
1671
|
-
const search = vue.ref("");
|
|
1672
|
-
index.onClickOutside(containerRef, () => {
|
|
1673
|
-
isOpen.value = false;
|
|
1674
|
-
});
|
|
1675
|
-
const filteredOptions = vue.computed(() => {
|
|
1676
|
-
if (!search.value) return props.options;
|
|
1677
|
-
const query = search.value.toLowerCase();
|
|
1678
|
-
return props.options.filter(
|
|
1679
|
-
(opt) => opt.label.toLowerCase().includes(query)
|
|
1680
|
-
);
|
|
1681
|
-
});
|
|
1682
|
-
const selectedOptions = vue.computed(() => {
|
|
1683
|
-
if (props.modelValue === null || props.modelValue === void 0) return [];
|
|
1684
|
-
const values = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
1685
|
-
return props.options.filter((opt) => values.includes(opt.value));
|
|
1686
|
-
});
|
|
1687
|
-
const displayValue = vue.computed(() => {
|
|
1688
|
-
var _a;
|
|
1689
|
-
if (selectedOptions.value.length === 0) return "";
|
|
1690
|
-
if (props.multiple) {
|
|
1691
|
-
return selectedOptions.value.map((o) => o.label).join(", ");
|
|
1692
|
-
}
|
|
1693
|
-
return ((_a = selectedOptions.value[0]) == null ? void 0 : _a.label) || "";
|
|
1694
|
-
});
|
|
1695
|
-
const isSelected = (option) => {
|
|
1696
|
-
if (props.modelValue === null || props.modelValue === void 0) return false;
|
|
1697
|
-
if (Array.isArray(props.modelValue)) {
|
|
1698
|
-
return props.modelValue.includes(option.value);
|
|
1699
|
-
}
|
|
1700
|
-
return props.modelValue === option.value;
|
|
1701
|
-
};
|
|
1702
|
-
const toggleOption = (option) => {
|
|
1703
|
-
if (option.disabled) return;
|
|
1704
|
-
if (props.multiple) {
|
|
1705
|
-
const currentValues = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
|
|
1706
|
-
const index2 = currentValues.indexOf(option.value);
|
|
1707
|
-
if (index2 === -1) {
|
|
1708
|
-
currentValues.push(option.value);
|
|
1709
|
-
} else {
|
|
1710
|
-
currentValues.splice(index2, 1);
|
|
1711
|
-
}
|
|
1712
|
-
emit("update:modelValue", currentValues);
|
|
1713
|
-
} else {
|
|
1714
|
-
emit("update:modelValue", option.value);
|
|
1715
|
-
isOpen.value = false;
|
|
1716
|
-
search.value = "";
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1719
|
-
const clear = () => {
|
|
1720
|
-
emit("update:modelValue", props.multiple ? [] : null);
|
|
1721
|
-
search.value = "";
|
|
1722
|
-
};
|
|
1723
|
-
const openDropdown = () => {
|
|
1724
|
-
if (props.disabled) return;
|
|
1725
|
-
isOpen.value = true;
|
|
1726
|
-
vue.nextTick(() => {
|
|
1727
|
-
var _a;
|
|
1728
|
-
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
1729
|
-
});
|
|
1730
|
-
};
|
|
1731
|
-
vue.watch(isOpen, (open) => {
|
|
1732
|
-
if (!open) {
|
|
1733
|
-
search.value = "";
|
|
1734
|
-
}
|
|
1735
|
-
});
|
|
1736
|
-
return (_ctx, _cache) => {
|
|
1737
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1738
|
-
ref_key: "containerRef",
|
|
1739
|
-
ref: containerRef,
|
|
1740
|
-
class: "relative"
|
|
1741
|
-
}, [
|
|
1742
|
-
vue.createElementVNode("div", {
|
|
1743
|
-
role: "combobox",
|
|
1744
|
-
"aria-expanded": isOpen.value,
|
|
1745
|
-
"aria-haspopup": "listbox",
|
|
1746
|
-
"aria-controls": listboxId.value,
|
|
1747
|
-
class: vue.normalizeClass([
|
|
1748
|
-
"flex min-h-[42px] w-full cursor-pointer items-center rounded-lg border bg-white px-3 py-2 transition-colors",
|
|
1749
|
-
"dark:bg-gray-900",
|
|
1750
|
-
__props.disabled ? "cursor-not-allowed border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800" : isOpen.value ? "border-primary ring-2 ring-primary/20" : "border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"
|
|
1751
|
-
]),
|
|
1752
|
-
onClick: openDropdown
|
|
1753
|
-
}, [
|
|
1754
|
-
!isOpen.value ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1755
|
-
key: 0,
|
|
1756
|
-
class: vue.normalizeClass([
|
|
1757
|
-
"flex-1 truncate text-sm",
|
|
1758
|
-
selectedOptions.value.length ? "text-gray-900 dark:text-gray-100" : "text-gray-400 dark:text-gray-500"
|
|
1759
|
-
])
|
|
1760
|
-
}, vue.toDisplayString(displayValue.value || __props.placeholder), 3)) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
1761
|
-
key: 1,
|
|
1762
|
-
id: inputId.value,
|
|
1763
|
-
ref_key: "inputRef",
|
|
1764
|
-
ref: inputRef,
|
|
1765
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
|
|
1766
|
-
type: "text",
|
|
1767
|
-
name: __props.name,
|
|
1768
|
-
placeholder: __props.searchPlaceholder,
|
|
1769
|
-
disabled: __props.disabled,
|
|
1770
|
-
"aria-autocomplete": "list",
|
|
1771
|
-
"aria-controls": listboxId.value,
|
|
1772
|
-
class: "flex-1 border-none bg-transparent text-sm text-gray-900 outline-hidden placeholder:text-gray-400 dark:text-gray-100 dark:placeholder:text-gray-500",
|
|
1773
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
1774
|
-
}, ["stop"]))
|
|
1775
|
-
}, null, 8, _hoisted_2$8)), [
|
|
1776
|
-
[vue.vModelText, search.value]
|
|
1777
|
-
]),
|
|
1778
|
-
vue.createElementVNode("div", _hoisted_3$7, [
|
|
1779
|
-
__props.clearable && selectedOptions.value.length > 0 && !__props.disabled ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
1780
|
-
key: 0,
|
|
1781
|
-
type: "button",
|
|
1782
|
-
class: "rounded p-0.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
1783
|
-
"aria-label": "Clear selection",
|
|
1784
|
-
onClick: vue.withModifiers(clear, ["stop"])
|
|
1785
|
-
}, [
|
|
1786
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1787
|
-
icon: "lucide:x",
|
|
1788
|
-
class: "size-4",
|
|
1789
|
-
"aria-hidden": "true"
|
|
1790
|
-
})
|
|
1791
|
-
])) : vue.createCommentVNode("", true),
|
|
1792
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
1793
|
-
icon: "lucide:chevron-down",
|
|
1794
|
-
class: vue.normalizeClass([
|
|
1795
|
-
"size-4 text-gray-400 transition-transform",
|
|
1796
|
-
isOpen.value && "rotate-180"
|
|
1797
|
-
]),
|
|
1798
|
-
"aria-hidden": "true"
|
|
1799
|
-
}, null, 8, ["class"])
|
|
1800
|
-
])
|
|
1801
|
-
], 10, _hoisted_1$d),
|
|
1802
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
1803
|
-
to: teleportTarget.value,
|
|
1804
|
-
disabled: teleportDisabled.value
|
|
1805
|
-
}, [
|
|
1806
|
-
vue.createVNode(vue.Transition, {
|
|
1807
|
-
"enter-active-class": "transition duration-100 ease-out",
|
|
1808
|
-
"enter-from-class": "transform scale-95 opacity-0",
|
|
1809
|
-
"enter-to-class": "transform scale-100 opacity-100",
|
|
1810
|
-
"leave-active-class": "transition duration-75 ease-in",
|
|
1811
|
-
"leave-from-class": "transform scale-100 opacity-100",
|
|
1812
|
-
"leave-to-class": "transform scale-95 opacity-0"
|
|
1813
|
-
}, {
|
|
1814
|
-
default: vue.withCtx(() => [
|
|
1815
|
-
isOpen.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1816
|
-
key: 0,
|
|
1817
|
-
id: listboxId.value,
|
|
1818
|
-
role: "listbox",
|
|
1819
|
-
"aria-label": __props.placeholder,
|
|
1820
|
-
"aria-multiselectable": __props.multiple || void 0,
|
|
1821
|
-
class: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900"
|
|
1822
|
-
}, [
|
|
1823
|
-
filteredOptions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(filteredOptions.value, (option) => {
|
|
1824
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
1825
|
-
key: option.value,
|
|
1826
|
-
type: "button",
|
|
1827
|
-
role: "option",
|
|
1828
|
-
"aria-selected": isSelected(option),
|
|
1829
|
-
"aria-disabled": option.disabled || void 0,
|
|
1830
|
-
disabled: option.disabled,
|
|
1831
|
-
class: vue.normalizeClass([
|
|
1832
|
-
"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors",
|
|
1833
|
-
option.disabled ? "cursor-not-allowed text-gray-400 dark:text-gray-500" : isSelected(option) ? "bg-primary/10 text-primary dark:bg-primary/20" : "text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"
|
|
1834
|
-
]),
|
|
1835
|
-
onClick: ($event) => toggleOption(option)
|
|
1836
|
-
}, [
|
|
1837
|
-
__props.multiple ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1838
|
-
key: 0,
|
|
1839
|
-
class: vue.normalizeClass([
|
|
1840
|
-
"flex size-4 items-center justify-center rounded border",
|
|
1841
|
-
isSelected(option) ? "border-primary bg-primary text-white" : "border-gray-300 dark:border-gray-600"
|
|
1842
|
-
]),
|
|
1843
|
-
"aria-hidden": "true"
|
|
1844
|
-
}, [
|
|
1845
|
-
isSelected(option) ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
1846
|
-
key: 0,
|
|
1847
|
-
icon: "lucide:check",
|
|
1848
|
-
class: "size-3"
|
|
1849
|
-
})) : vue.createCommentVNode("", true)
|
|
1850
|
-
], 2)) : vue.createCommentVNode("", true),
|
|
1851
|
-
vue.createElementVNode("span", _hoisted_6$3, vue.toDisplayString(option.label), 1),
|
|
1852
|
-
!__props.multiple && isSelected(option) ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
1853
|
-
key: 1,
|
|
1854
|
-
icon: "lucide:check",
|
|
1855
|
-
class: "size-4 text-primary",
|
|
1856
|
-
"aria-hidden": "true"
|
|
1857
|
-
})) : vue.createCommentVNode("", true)
|
|
1858
|
-
], 10, _hoisted_5$3);
|
|
1859
|
-
}), 128)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2, vue.toDisplayString(__props.noResultsText), 1))
|
|
1860
|
-
], 8, _hoisted_4$5)) : vue.createCommentVNode("", true)
|
|
1861
|
-
]),
|
|
1862
|
-
_: 1
|
|
1863
|
-
})
|
|
1864
|
-
], 8, ["to", "disabled"]))
|
|
1865
|
-
], 512);
|
|
1866
|
-
};
|
|
1867
|
-
}
|
|
1868
|
-
});
|
|
1869
|
-
const _hoisted_1$c = { class: "relative" };
|
|
1870
|
-
const _hoisted_2$7 = {
|
|
1871
|
-
key: 0,
|
|
1872
|
-
class: "text-red-500 ml-0.5"
|
|
1873
|
-
};
|
|
1874
|
-
const _hoisted_3$6 = ["id", "disabled", "aria-invalid", "aria-describedby"];
|
|
1875
|
-
const _hoisted_4$4 = {
|
|
1876
|
-
key: 0,
|
|
1877
|
-
class: "flex items-center gap-2 flex-1"
|
|
1878
|
-
};
|
|
1879
|
-
const _hoisted_5$2 = { class: "flex size-8 items-center justify-center rounded bg-gray-100 dark:bg-gray-800" };
|
|
1880
|
-
const _hoisted_6$2 = { class: "text-gray-700 dark:text-gray-300 font-mono text-xs truncate" };
|
|
1881
|
-
const _hoisted_7$1 = {
|
|
1882
|
-
key: 1,
|
|
1883
|
-
class: "flex-1 text-gray-400 dark:text-gray-500"
|
|
1884
|
-
};
|
|
1885
|
-
const _hoisted_8$1 = { class: "relative mb-4" };
|
|
1886
|
-
const _hoisted_9$1 = ["placeholder"];
|
|
1887
|
-
const _hoisted_10$1 = {
|
|
1888
|
-
key: 0,
|
|
1889
|
-
class: "absolute right-3 top-1/2 -translate-y-1/2"
|
|
1890
|
-
};
|
|
1891
|
-
const _hoisted_11$1 = { class: "max-h-64 overflow-y-auto" };
|
|
1892
|
-
const _hoisted_12$1 = {
|
|
1893
|
-
key: 0,
|
|
1894
|
-
class: "py-8 text-center text-sm text-gray-500"
|
|
1895
|
-
};
|
|
1896
|
-
const _hoisted_13 = {
|
|
1897
|
-
key: 1,
|
|
1898
|
-
class: "grid grid-cols-8 gap-1"
|
|
1899
|
-
};
|
|
1900
|
-
const _hoisted_14 = ["title", "onClick"];
|
|
1901
|
-
const _hoisted_15 = { class: "mt-4 flex items-center justify-between border-t border-gray-200 pt-4 dark:border-gray-700" };
|
|
1902
|
-
const _hoisted_16 = { class: "text-xs text-gray-500" };
|
|
1903
|
-
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
1904
|
-
__name: "IconPicker",
|
|
1905
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
1906
|
-
label: {},
|
|
1907
|
-
placeholder: { default: "Rechercher une icône..." },
|
|
1908
|
-
help: {},
|
|
1909
|
-
error: {},
|
|
1910
|
-
required: { type: Boolean },
|
|
1911
|
-
disabled: { type: Boolean },
|
|
1912
|
-
id: {},
|
|
1913
|
-
collections: { default: () => ["mdi", "heroicons", "lucide"] },
|
|
1914
|
-
limit: { default: 48 }
|
|
1915
|
-
}, {
|
|
1916
|
-
"modelValue": { default: "" },
|
|
1917
|
-
"modelModifiers": {}
|
|
1918
|
-
}),
|
|
1919
|
-
emits: ["update:modelValue"],
|
|
1920
|
-
setup(__props) {
|
|
1921
|
-
const props = __props;
|
|
1922
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
1923
|
-
const { id: generatedId, related } = useId.useId({ prefix: "iconpicker", id: props.id });
|
|
1924
|
-
const inputId = vue.computed(() => props.id ?? generatedId.value);
|
|
1925
|
-
const helpId = vue.computed(() => related("help"));
|
|
1926
|
-
const searchQuery = vue.ref("");
|
|
1927
|
-
const isOpen = vue.ref(false);
|
|
1928
|
-
const isLoading = vue.ref(false);
|
|
1929
|
-
const searchResults = vue.ref([]);
|
|
1930
|
-
const popularIcons = [
|
|
1931
|
-
"mdi:heart",
|
|
1932
|
-
"mdi:star",
|
|
1933
|
-
"mdi:home",
|
|
1934
|
-
"mdi:account",
|
|
1935
|
-
"mdi:email",
|
|
1936
|
-
"mdi:phone",
|
|
1937
|
-
"mdi:calendar",
|
|
1938
|
-
"mdi:clock",
|
|
1939
|
-
"mdi:check",
|
|
1940
|
-
"mdi:close",
|
|
1941
|
-
"mdi:plus",
|
|
1942
|
-
"mdi:minus",
|
|
1943
|
-
"mdi:stethoscope",
|
|
1944
|
-
"mdi:hospital",
|
|
1945
|
-
"mdi:medical-bag",
|
|
1946
|
-
"mdi:pill",
|
|
1947
|
-
"mdi:heart-pulse",
|
|
1948
|
-
"mdi:tooth",
|
|
1949
|
-
"mdi:eye",
|
|
1950
|
-
"mdi:brain",
|
|
1951
|
-
"mdi:lungs",
|
|
1952
|
-
"mdi:bone",
|
|
1953
|
-
"heroicons:heart",
|
|
1954
|
-
"heroicons:star",
|
|
1955
|
-
"heroicons:home",
|
|
1956
|
-
"heroicons:user",
|
|
1957
|
-
"heroicons:envelope",
|
|
1958
|
-
"heroicons:phone",
|
|
1959
|
-
"heroicons:calendar",
|
|
1960
|
-
"heroicons:clock",
|
|
1961
|
-
"heroicons:check",
|
|
1962
|
-
"heroicons:x-mark",
|
|
1963
|
-
"heroicons:plus",
|
|
1964
|
-
"heroicons:minus",
|
|
1965
|
-
"lucide:heart",
|
|
1966
|
-
"lucide:star",
|
|
1967
|
-
"lucide:home",
|
|
1968
|
-
"lucide:user",
|
|
1969
|
-
"lucide:mail",
|
|
1970
|
-
"lucide:phone",
|
|
1971
|
-
"lucide:calendar",
|
|
1972
|
-
"lucide:clock",
|
|
1973
|
-
"lucide:check",
|
|
1974
|
-
"lucide:x",
|
|
1975
|
-
"lucide:plus",
|
|
1976
|
-
"lucide:minus"
|
|
1977
|
-
];
|
|
1978
|
-
const displayedIcons = vue.computed(() => {
|
|
1979
|
-
if (searchQuery.value && searchResults.value.length > 0) {
|
|
1980
|
-
return searchResults.value;
|
|
1981
|
-
}
|
|
1982
|
-
return popularIcons;
|
|
1983
|
-
});
|
|
1984
|
-
const hasError = vue.computed(() => props.error && typeof props.error === "string");
|
|
1985
|
-
async function searchIcons(query) {
|
|
1986
|
-
if (!query || query.length < 2) {
|
|
1987
|
-
searchResults.value = [];
|
|
1988
|
-
return;
|
|
1989
|
-
}
|
|
1990
|
-
isLoading.value = true;
|
|
1991
|
-
try {
|
|
1992
|
-
const collectionsParam = props.collections.join(",");
|
|
1993
|
-
const response = await fetch(
|
|
1994
|
-
`https://api.iconify.design/search?query=${encodeURIComponent(query)}&limit=${props.limit}&prefixes=${collectionsParam}`
|
|
1995
|
-
);
|
|
1996
|
-
const data = await response.json();
|
|
1997
|
-
searchResults.value = data.icons || [];
|
|
1998
|
-
} catch (error) {
|
|
1999
|
-
console.error("Failed to search icons:", error);
|
|
2000
|
-
searchResults.value = [];
|
|
2001
|
-
} finally {
|
|
2002
|
-
isLoading.value = false;
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
const debouncedSearch = index.useDebounceFn(searchIcons, 300);
|
|
2006
|
-
vue.watch(searchQuery, (query) => {
|
|
2007
|
-
debouncedSearch(query);
|
|
2008
|
-
});
|
|
2009
|
-
function selectIcon(icon) {
|
|
2010
|
-
modelValue.value = icon;
|
|
2011
|
-
isOpen.value = false;
|
|
2012
|
-
searchQuery.value = "";
|
|
2013
|
-
}
|
|
2014
|
-
function clearSelection() {
|
|
2015
|
-
modelValue.value = "";
|
|
2016
|
-
}
|
|
2017
|
-
function openPicker() {
|
|
2018
|
-
if (!props.disabled) {
|
|
2019
|
-
isOpen.value = true;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
function closePicker() {
|
|
2023
|
-
isOpen.value = false;
|
|
2024
|
-
searchQuery.value = "";
|
|
2025
|
-
}
|
|
2026
|
-
return (_ctx, _cache) => {
|
|
2027
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2028
|
-
__props.label ? (vue.openBlock(), vue.createBlock(_sfc_main$r, {
|
|
2029
|
-
key: 0,
|
|
2030
|
-
"html-for": inputId.value,
|
|
2031
|
-
error: __props.error
|
|
2032
|
-
}, {
|
|
2033
|
-
default: vue.withCtx(() => [
|
|
2034
|
-
vue.createTextVNode(vue.toDisplayString(__props.label) + " ", 1),
|
|
2035
|
-
__props.required ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$7, "*")) : vue.createCommentVNode("", true)
|
|
2036
|
-
]),
|
|
2037
|
-
_: 1
|
|
2038
|
-
}, 8, ["html-for", "error"])) : vue.createCommentVNode("", true),
|
|
2039
|
-
vue.createElementVNode("button", {
|
|
2040
|
-
id: inputId.value,
|
|
2041
|
-
type: "button",
|
|
2042
|
-
disabled: __props.disabled,
|
|
2043
|
-
"aria-invalid": hasError.value || void 0,
|
|
2044
|
-
"aria-describedby": hasError.value ? helpId.value : void 0,
|
|
2045
|
-
class: vue.normalizeClass(["mt-1 flex w-full items-center gap-3 rounded-md border bg-white px-3 py-2 text-left text-sm shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-primary dark:bg-gray-900", [
|
|
2046
|
-
hasError.value ? "border-red-500 focus:border-red-500 focus:ring-red-500" : "border-gray-300 focus:border-primary dark:border-gray-700",
|
|
2047
|
-
__props.disabled ? "cursor-not-allowed bg-gray-50 dark:bg-gray-950" : "cursor-pointer hover:border-gray-400 dark:hover:border-gray-600"
|
|
2048
|
-
]]),
|
|
2049
|
-
onClick: openPicker
|
|
2050
|
-
}, [
|
|
2051
|
-
modelValue.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
|
|
2052
|
-
vue.createElementVNode("div", _hoisted_5$2, [
|
|
2053
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2054
|
-
icon: modelValue.value,
|
|
2055
|
-
class: "size-5 text-gray-700 dark:text-gray-300"
|
|
2056
|
-
}, null, 8, ["icon"])
|
|
2057
|
-
]),
|
|
2058
|
-
vue.createElementVNode("span", _hoisted_6$2, vue.toDisplayString(modelValue.value), 1)
|
|
2059
|
-
])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$1, vue.toDisplayString(__props.placeholder), 1)),
|
|
2060
|
-
modelValue.value && !__props.disabled ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
2061
|
-
key: 2,
|
|
2062
|
-
type: "button",
|
|
2063
|
-
class: "p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
2064
|
-
onClick: vue.withModifiers(clearSelection, ["stop"])
|
|
2065
|
-
}, [
|
|
2066
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2067
|
-
icon: "lucide:x",
|
|
2068
|
-
class: "size-4"
|
|
2069
|
-
})
|
|
2070
|
-
])) : vue.createCommentVNode("", true),
|
|
2071
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2072
|
-
icon: "lucide:chevron-down",
|
|
2073
|
-
class: "size-4 text-gray-400"
|
|
2074
|
-
})
|
|
2075
|
-
], 10, _hoisted_3$6),
|
|
2076
|
-
__props.help && !hasError.value ? (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
2077
|
-
key: 1,
|
|
2078
|
-
id: helpId.value
|
|
2079
|
-
}, {
|
|
2080
|
-
default: vue.withCtx(() => [
|
|
2081
|
-
vue.createTextVNode(vue.toDisplayString(__props.help), 1)
|
|
2082
|
-
]),
|
|
2083
|
-
_: 1
|
|
2084
|
-
}, 8, ["id"])) : vue.createCommentVNode("", true),
|
|
2085
|
-
hasError.value ? (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
2086
|
-
key: 2,
|
|
2087
|
-
id: helpId.value,
|
|
2088
|
-
error: true
|
|
2089
|
-
}, {
|
|
2090
|
-
default: vue.withCtx(() => [
|
|
2091
|
-
vue.createTextVNode(vue.toDisplayString(__props.error), 1)
|
|
2092
|
-
]),
|
|
2093
|
-
_: 1
|
|
2094
|
-
}, 8, ["id"])) : vue.createCommentVNode("", true),
|
|
2095
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
2096
|
-
isOpen.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2097
|
-
key: 0,
|
|
2098
|
-
class: "fixed inset-0 z-50",
|
|
2099
|
-
onClick: closePicker
|
|
2100
|
-
}, [
|
|
2101
|
-
vue.createElementVNode("div", {
|
|
2102
|
-
class: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-md rounded-lg border border-gray-200 bg-white p-4 shadow-xl dark:border-gray-700 dark:bg-gray-900",
|
|
2103
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
2104
|
-
}, ["stop"]))
|
|
2105
|
-
}, [
|
|
2106
|
-
vue.createElementVNode("div", _hoisted_8$1, [
|
|
2107
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2108
|
-
icon: "lucide:search",
|
|
2109
|
-
class: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-gray-400"
|
|
2110
|
-
}),
|
|
2111
|
-
vue.withDirectives(vue.createElementVNode("input", {
|
|
2112
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
2113
|
-
type: "text",
|
|
2114
|
-
placeholder: __props.placeholder,
|
|
2115
|
-
class: "w-full rounded-md border border-gray-300 bg-white py-2 pl-10 pr-4 text-sm text-gray-800 placeholder-gray-400 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:placeholder-gray-500",
|
|
2116
|
-
autofocus: ""
|
|
2117
|
-
}, null, 8, _hoisted_9$1), [
|
|
2118
|
-
[vue.vModelText, searchQuery.value]
|
|
2119
|
-
]),
|
|
2120
|
-
isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$1, [
|
|
2121
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2122
|
-
icon: "lucide:loader-2",
|
|
2123
|
-
class: "size-4 animate-spin text-gray-400"
|
|
2124
|
-
})
|
|
2125
|
-
])) : vue.createCommentVNode("", true)
|
|
2126
|
-
]),
|
|
2127
|
-
vue.createElementVNode("div", _hoisted_11$1, [
|
|
2128
|
-
displayedIcons.value.length === 0 && searchQuery.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, ' Aucune icône trouvée pour "' + vue.toDisplayString(searchQuery.value) + '" ', 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
|
|
2129
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayedIcons.value, (icon) => {
|
|
2130
|
-
return vue.openBlock(), vue.createElementBlock("button", {
|
|
2131
|
-
key: icon,
|
|
2132
|
-
type: "button",
|
|
2133
|
-
class: vue.normalizeClass(["flex size-9 items-center justify-center rounded transition-colors", [
|
|
2134
|
-
modelValue.value === icon ? "bg-primary text-white" : "hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300"
|
|
2135
|
-
]]),
|
|
2136
|
-
title: icon,
|
|
2137
|
-
onClick: ($event) => selectIcon(icon)
|
|
2138
|
-
}, [
|
|
2139
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2140
|
-
icon,
|
|
2141
|
-
class: "size-5"
|
|
2142
|
-
}, null, 8, ["icon"])
|
|
2143
|
-
], 10, _hoisted_14);
|
|
2144
|
-
}), 128))
|
|
2145
|
-
]))
|
|
2146
|
-
]),
|
|
2147
|
-
vue.createElementVNode("div", _hoisted_15, [
|
|
2148
|
-
vue.createElementVNode("p", _hoisted_16, vue.toDisplayString(searchQuery.value ? `${displayedIcons.value.length} résultats` : "Icônes populaires"), 1),
|
|
2149
|
-
vue.createElementVNode("button", {
|
|
2150
|
-
type: "button",
|
|
2151
|
-
class: "text-sm text-gray-500 hover:text-gray-700 dark:hover:text-gray-300",
|
|
2152
|
-
onClick: closePicker
|
|
2153
|
-
}, " Fermer ")
|
|
2154
|
-
])
|
|
2155
|
-
])
|
|
2156
|
-
])) : vue.createCommentVNode("", true)
|
|
2157
|
-
]))
|
|
2158
|
-
]);
|
|
2159
|
-
};
|
|
2160
|
-
}
|
|
2161
|
-
});
|
|
2162
|
-
const _hoisted_1$b = { class: "flex items-center justify-between" };
|
|
2163
|
-
const _hoisted_2$6 = { class: "flex items-center gap-3" };
|
|
2164
|
-
const _hoisted_3$5 = { class: "text-lg font-semibold text-gray-900 dark:text-white" };
|
|
2165
|
-
const _hoisted_4$3 = {
|
|
2166
|
-
key: 0,
|
|
2167
|
-
class: "text-sm text-gray-500 dark:text-gray-400"
|
|
2168
|
-
};
|
|
2169
|
-
const _hoisted_5$1 = { class: "p-5 sm:p-6" };
|
|
2170
|
-
const _hoisted_6$1 = {
|
|
2171
|
-
key: 0,
|
|
2172
|
-
class: "px-5 py-4 bg-gray-50 dark:bg-slate-800/50 border-t border-gray-100 dark:border-slate-700"
|
|
2173
|
-
};
|
|
2174
|
-
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
2175
|
-
__name: "FormSection",
|
|
2176
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2177
|
-
title: {},
|
|
2178
|
-
subtitle: {},
|
|
2179
|
-
icon: {},
|
|
2180
|
-
iconColor: { default: "primary" },
|
|
2181
|
-
bordered: { type: Boolean, default: true },
|
|
2182
|
-
collapsible: { type: Boolean, default: false },
|
|
2183
|
-
collapsed: { type: Boolean, default: false }
|
|
2184
|
-
}, {
|
|
2185
|
-
"collapsed": { type: Boolean, ...{ default: false } },
|
|
2186
|
-
"collapsedModifiers": {}
|
|
2187
|
-
}),
|
|
2188
|
-
emits: ["update:collapsed"],
|
|
2189
|
-
setup(__props) {
|
|
2190
|
-
const isCollapsed = vue.useModel(__props, "collapsed");
|
|
2191
|
-
function toggleCollapse() {
|
|
2192
|
-
isCollapsed.value = !isCollapsed.value;
|
|
2193
|
-
}
|
|
2194
|
-
return (_ctx, _cache) => {
|
|
2195
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2196
|
-
class: vue.normalizeClass([
|
|
2197
|
-
"bg-white dark:bg-slate-800 rounded-2xl overflow-hidden",
|
|
2198
|
-
__props.bordered && "border border-gray-100 dark:border-slate-700 shadow-sm"
|
|
2199
|
-
])
|
|
2200
|
-
}, [
|
|
2201
|
-
vue.createElementVNode("div", {
|
|
2202
|
-
class: vue.normalizeClass([
|
|
2203
|
-
"p-5 border-b border-gray-100 dark:border-slate-700 bg-linear-to-r from-gray-50 to-white dark:from-slate-800 dark:to-slate-800",
|
|
2204
|
-
__props.collapsible && "cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-700/50 transition-colors"
|
|
2205
|
-
]),
|
|
2206
|
-
onClick: _cache[0] || (_cache[0] = ($event) => __props.collapsible && toggleCollapse())
|
|
2207
|
-
}, [
|
|
2208
|
-
vue.createElementVNode("div", _hoisted_1$b, [
|
|
2209
|
-
vue.createElementVNode("div", _hoisted_2$6, [
|
|
2210
|
-
__props.icon ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2211
|
-
key: 0,
|
|
2212
|
-
class: vue.normalizeClass([
|
|
2213
|
-
"size-10 rounded-xl flex items-center justify-center",
|
|
2214
|
-
__props.iconColor === "primary" && "bg-primary-100 dark:bg-primary-900/30",
|
|
2215
|
-
__props.iconColor === "gray" && "bg-gray-100 dark:bg-slate-700",
|
|
2216
|
-
__props.iconColor === "success" && "bg-emerald-100 dark:bg-emerald-900/30",
|
|
2217
|
-
__props.iconColor === "warning" && "bg-amber-100 dark:bg-amber-900/30",
|
|
2218
|
-
__props.iconColor === "danger" && "bg-red-100 dark:bg-red-900/30"
|
|
2219
|
-
])
|
|
2220
|
-
}, [
|
|
2221
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2222
|
-
icon: __props.icon,
|
|
2223
|
-
class: vue.normalizeClass([
|
|
2224
|
-
"size-5",
|
|
2225
|
-
__props.iconColor === "primary" && "text-primary-600 dark:text-primary-400",
|
|
2226
|
-
__props.iconColor === "gray" && "text-gray-600 dark:text-gray-400",
|
|
2227
|
-
__props.iconColor === "success" && "text-emerald-600 dark:text-emerald-400",
|
|
2228
|
-
__props.iconColor === "warning" && "text-amber-600 dark:text-amber-400",
|
|
2229
|
-
__props.iconColor === "danger" && "text-red-600 dark:text-red-400"
|
|
2230
|
-
])
|
|
2231
|
-
}, null, 8, ["icon", "class"])
|
|
2232
|
-
], 2)) : vue.createCommentVNode("", true),
|
|
2233
|
-
vue.createElementVNode("div", null, [
|
|
2234
|
-
vue.createElementVNode("h2", _hoisted_3$5, [
|
|
2235
|
-
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
2236
|
-
vue.createTextVNode(vue.toDisplayString(__props.title), 1)
|
|
2237
|
-
])
|
|
2238
|
-
]),
|
|
2239
|
-
__props.subtitle ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_4$3, [
|
|
2240
|
-
vue.renderSlot(_ctx.$slots, "subtitle", {}, () => [
|
|
2241
|
-
vue.createTextVNode(vue.toDisplayString(__props.subtitle), 1)
|
|
2242
|
-
])
|
|
2243
|
-
])) : vue.createCommentVNode("", true)
|
|
2244
|
-
])
|
|
2245
|
-
]),
|
|
2246
|
-
__props.collapsible ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
2247
|
-
key: 0,
|
|
2248
|
-
type: "button",
|
|
2249
|
-
class: "p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",
|
|
2250
|
-
onClick: vue.withModifiers(toggleCollapse, ["stop"])
|
|
2251
|
-
}, [
|
|
2252
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2253
|
-
icon: "heroicons:chevron-down",
|
|
2254
|
-
class: vue.normalizeClass([
|
|
2255
|
-
"w-5 h-5 text-gray-400 transition-transform duration-200",
|
|
2256
|
-
isCollapsed.value && "-rotate-90"
|
|
2257
|
-
])
|
|
2258
|
-
}, null, 8, ["class"])
|
|
2259
|
-
])) : vue.createCommentVNode("", true),
|
|
2260
|
-
vue.renderSlot(_ctx.$slots, "header-actions")
|
|
2261
|
-
])
|
|
2262
|
-
], 2),
|
|
2263
|
-
vue.withDirectives(vue.createElementVNode("div", _hoisted_5$1, [
|
|
2264
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2265
|
-
], 512), [
|
|
2266
|
-
[vue.vShow, !isCollapsed.value]
|
|
2267
|
-
]),
|
|
2268
|
-
_ctx.$slots.footer ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
|
|
2269
|
-
vue.renderSlot(_ctx.$slots, "footer")
|
|
2270
|
-
], 512)), [
|
|
2271
|
-
[vue.vShow, !isCollapsed.value]
|
|
2272
|
-
]) : vue.createCommentVNode("", true)
|
|
2273
|
-
], 2);
|
|
2274
|
-
};
|
|
2275
|
-
}
|
|
2276
|
-
});
|
|
2277
|
-
const _hoisted_1$a = { key: 1 };
|
|
2278
|
-
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
2279
|
-
__name: "FormActions",
|
|
2280
|
-
props: {
|
|
2281
|
-
submitLabel: { default: "Enregistrer" },
|
|
2282
|
-
cancelLabel: { default: "Annuler" },
|
|
2283
|
-
submitIcon: { default: "heroicons:check" },
|
|
2284
|
-
cancelIcon: { default: "heroicons:x-mark" },
|
|
2285
|
-
loading: { type: Boolean },
|
|
2286
|
-
loadingLabel: {},
|
|
2287
|
-
disabled: { type: Boolean },
|
|
2288
|
-
showCancel: { type: Boolean, default: true },
|
|
2289
|
-
align: { default: "right" },
|
|
2290
|
-
stackOnMobile: { type: Boolean, default: false },
|
|
2291
|
-
submitVariant: { default: "primary" }
|
|
2292
|
-
},
|
|
2293
|
-
emits: ["submit", "cancel"],
|
|
2294
|
-
setup(__props, { emit: __emit }) {
|
|
2295
|
-
const emit = __emit;
|
|
2296
|
-
return (_ctx, _cache) => {
|
|
2297
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2298
|
-
class: vue.normalizeClass([
|
|
2299
|
-
"flex gap-3 pt-2",
|
|
2300
|
-
__props.align === "left" && "justify-start",
|
|
2301
|
-
__props.align === "center" && "justify-center",
|
|
2302
|
-
__props.align === "right" && "justify-end",
|
|
2303
|
-
__props.align === "stretch" && "[&>*]:flex-1",
|
|
2304
|
-
__props.stackOnMobile && "flex-col sm:flex-row"
|
|
2305
|
-
])
|
|
2306
|
-
}, [
|
|
2307
|
-
__props.showCancel ? (vue.openBlock(), vue.createBlock(Button_vue_vue_type_script_setup_true_lang._sfc_main, {
|
|
2308
|
-
key: 0,
|
|
2309
|
-
type: "button",
|
|
2310
|
-
variant: "outline",
|
|
2311
|
-
disabled: __props.loading,
|
|
2312
|
-
class: vue.normalizeClass([
|
|
2313
|
-
__props.stackOnMobile && "order-2 sm:order-1"
|
|
2314
|
-
]),
|
|
2315
|
-
onClick: _cache[0] || (_cache[0] = ($event) => emit("cancel"))
|
|
2316
|
-
}, {
|
|
2317
|
-
default: vue.withCtx(() => [
|
|
2318
|
-
__props.cancelIcon ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
2319
|
-
key: 0,
|
|
2320
|
-
icon: __props.cancelIcon,
|
|
2321
|
-
class: "w-5 h-5"
|
|
2322
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
2323
|
-
vue.createTextVNode(" " + vue.toDisplayString(__props.cancelLabel), 1)
|
|
2324
|
-
]),
|
|
2325
|
-
_: 1
|
|
2326
|
-
}, 8, ["disabled", "class"])) : vue.createCommentVNode("", true),
|
|
2327
|
-
vue.createVNode(Button_vue_vue_type_script_setup_true_lang._sfc_main, {
|
|
2328
|
-
type: "submit",
|
|
2329
|
-
variant: __props.submitVariant,
|
|
2330
|
-
disabled: __props.disabled || __props.loading,
|
|
2331
|
-
loading: __props.loading,
|
|
2332
|
-
class: vue.normalizeClass([
|
|
2333
|
-
__props.stackOnMobile && "order-1 sm:order-2"
|
|
2334
|
-
]),
|
|
2335
|
-
onClick: _cache[1] || (_cache[1] = ($event) => emit("submit"))
|
|
2336
|
-
}, {
|
|
2337
|
-
default: vue.withCtx(() => [
|
|
2338
|
-
!__props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2339
|
-
__props.submitIcon ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
2340
|
-
key: 0,
|
|
2341
|
-
icon: __props.submitIcon,
|
|
2342
|
-
class: "w-5 h-5"
|
|
2343
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
2344
|
-
vue.createTextVNode(" " + vue.toDisplayString(__props.submitLabel), 1)
|
|
2345
|
-
], 64)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$a, vue.toDisplayString(__props.loadingLabel || __props.submitLabel + "..."), 1))
|
|
2346
|
-
]),
|
|
2347
|
-
_: 1
|
|
2348
|
-
}, 8, ["variant", "disabled", "loading", "class"]),
|
|
2349
|
-
vue.renderSlot(_ctx.$slots, "extra")
|
|
2350
|
-
], 2);
|
|
2351
|
-
};
|
|
2352
|
-
}
|
|
2353
|
-
});
|
|
2354
|
-
const _hoisted_1$9 = ["id", "name", "placeholder", "disabled", "required", "aria-invalid", "aria-required", "aria-describedby"];
|
|
2355
|
-
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
2356
|
-
...{
|
|
2357
|
-
inheritAttrs: false
|
|
2358
|
-
},
|
|
2359
|
-
__name: "EmailInput",
|
|
2360
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2361
|
-
placeholder: { default: "Enter email address..." },
|
|
2362
|
-
size: { default: "md" },
|
|
2363
|
-
disabled: { type: Boolean },
|
|
2364
|
-
showValidation: { type: Boolean, default: true },
|
|
2365
|
-
name: {},
|
|
2366
|
-
id: {},
|
|
2367
|
-
required: { type: Boolean },
|
|
2368
|
-
describedBy: {}
|
|
2369
|
-
}, {
|
|
2370
|
-
"modelValue": { default: "" },
|
|
2371
|
-
"modelModifiers": {}
|
|
2372
|
-
}),
|
|
2373
|
-
emits: ["update:modelValue"],
|
|
2374
|
-
setup(__props) {
|
|
2375
|
-
const props = __props;
|
|
2376
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
2377
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2378
|
-
const isValid = vue.computed(() => {
|
|
2379
|
-
if (!modelValue.value) return null;
|
|
2380
|
-
return emailRegex.test(modelValue.value);
|
|
2381
|
-
});
|
|
2382
|
-
const isTouched = vue.ref(false);
|
|
2383
|
-
const showStatus = vue.computed(() => {
|
|
2384
|
-
return props.showValidation && isTouched.value && !!modelValue.value;
|
|
2385
|
-
});
|
|
2386
|
-
function handleBlur() {
|
|
2387
|
-
isTouched.value = true;
|
|
2388
|
-
}
|
|
2389
|
-
return (_ctx, _cache) => {
|
|
2390
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
2391
|
-
icon: "lucide:mail",
|
|
2392
|
-
size: __props.size,
|
|
2393
|
-
disabled: __props.disabled,
|
|
2394
|
-
invalid: showStatus.value && isValid.value === false
|
|
2395
|
-
}, {
|
|
2396
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
2397
|
-
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
2398
|
-
id: __props.id ?? __props.name,
|
|
2399
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
2400
|
-
type: "email",
|
|
2401
|
-
name: __props.name,
|
|
2402
|
-
placeholder: __props.placeholder,
|
|
2403
|
-
disabled: __props.disabled,
|
|
2404
|
-
required: __props.required,
|
|
2405
|
-
"aria-invalid": showStatus.value && isValid.value === false || void 0,
|
|
2406
|
-
"aria-required": __props.required || void 0,
|
|
2407
|
-
"aria-describedby": __props.describedBy,
|
|
2408
|
-
class: inputClass
|
|
2409
|
-
}, _ctx.$attrs, { onBlur: handleBlur }), null, 16, _hoisted_1$9), [
|
|
2410
|
-
[vue.vModelText, modelValue.value]
|
|
2411
|
-
])
|
|
2412
|
-
]),
|
|
2413
|
-
actions: vue.withCtx(() => [
|
|
2414
|
-
showStatus.value && isValid.value ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
2415
|
-
key: 0,
|
|
2416
|
-
icon: "lucide:check-circle",
|
|
2417
|
-
class: "size-5 text-emerald-500"
|
|
2418
|
-
})) : showStatus.value && isValid.value === false ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
2419
|
-
key: 1,
|
|
2420
|
-
icon: "lucide:alert-circle",
|
|
2421
|
-
class: "size-5 text-red-500"
|
|
2422
|
-
})) : vue.createCommentVNode("", true)
|
|
2423
|
-
]),
|
|
2424
|
-
_: 1
|
|
2425
|
-
}, 8, ["size", "disabled", "invalid"]);
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
});
|
|
2429
|
-
const _hoisted_1$8 = ["id", "type", "name", "placeholder", "disabled", "required", "aria-required", "aria-describedby"];
|
|
2430
|
-
const _hoisted_2$5 = ["disabled"];
|
|
2431
|
-
const _hoisted_3$4 = {
|
|
2432
|
-
key: 0,
|
|
2433
|
-
class: "mt-2"
|
|
2434
|
-
};
|
|
2435
|
-
const _hoisted_4$2 = { class: "h-1.5 w-full rounded-full bg-gray-200 dark:bg-slate-700 overflow-hidden" };
|
|
2436
|
-
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
2437
|
-
...{
|
|
2438
|
-
inheritAttrs: false
|
|
2439
|
-
},
|
|
2440
|
-
__name: "PasswordInput",
|
|
2441
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2442
|
-
placeholder: { default: "Enter password..." },
|
|
2443
|
-
size: { default: "md" },
|
|
2444
|
-
disabled: { type: Boolean },
|
|
2445
|
-
showStrength: { type: Boolean, default: false },
|
|
2446
|
-
name: {},
|
|
2447
|
-
id: {},
|
|
2448
|
-
required: { type: Boolean },
|
|
2449
|
-
describedBy: {},
|
|
2450
|
-
minLength: { default: 8 }
|
|
2451
|
-
}, {
|
|
2452
|
-
"modelValue": { default: "" },
|
|
2453
|
-
"modelModifiers": {}
|
|
2454
|
-
}),
|
|
2455
|
-
emits: ["update:modelValue"],
|
|
2456
|
-
setup(__props) {
|
|
2457
|
-
const props = __props;
|
|
2458
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
2459
|
-
const showPassword = vue.ref(false);
|
|
2460
|
-
const strength = vue.computed(() => {
|
|
2461
|
-
const password = modelValue.value;
|
|
2462
|
-
if (!password) return null;
|
|
2463
|
-
let score = 0;
|
|
2464
|
-
if (password.length >= props.minLength) score++;
|
|
2465
|
-
if (password.length >= 12) score++;
|
|
2466
|
-
if (/[a-z]/.test(password)) score++;
|
|
2467
|
-
if (/[A-Z]/.test(password)) score++;
|
|
2468
|
-
if (/[0-9]/.test(password)) score++;
|
|
2469
|
-
if (/[^a-zA-Z0-9]/.test(password)) score++;
|
|
2470
|
-
if (score <= 2) return "weak";
|
|
2471
|
-
if (score <= 3) return "fair";
|
|
2472
|
-
if (score <= 4) return "good";
|
|
2473
|
-
return "strong";
|
|
2474
|
-
});
|
|
2475
|
-
const strengthConfig = vue.computed(() => {
|
|
2476
|
-
const configs = {
|
|
2477
|
-
weak: { label: "Weak", color: "bg-red-500", width: "w-1/4" },
|
|
2478
|
-
fair: { label: "Fair", color: "bg-orange-500", width: "w-2/4" },
|
|
2479
|
-
good: { label: "Good", color: "bg-yellow-500", width: "w-3/4" },
|
|
2480
|
-
strong: { label: "Strong", color: "bg-emerald-500", width: "w-full" }
|
|
2481
|
-
};
|
|
2482
|
-
return strength.value ? configs[strength.value] : null;
|
|
2483
|
-
});
|
|
2484
|
-
function toggleVisibility() {
|
|
2485
|
-
showPassword.value = !showPassword.value;
|
|
2486
|
-
}
|
|
2487
|
-
return (_ctx, _cache) => {
|
|
2488
|
-
var _a, _b;
|
|
2489
|
-
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
2490
|
-
vue.createVNode(_sfc_main$p, {
|
|
2491
|
-
icon: "lucide:lock",
|
|
2492
|
-
size: __props.size,
|
|
2493
|
-
disabled: __props.disabled
|
|
2494
|
-
}, {
|
|
2495
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
2496
|
-
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
2497
|
-
id: __props.id ?? __props.name,
|
|
2498
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
2499
|
-
type: showPassword.value ? "text" : "password",
|
|
2500
|
-
name: __props.name,
|
|
2501
|
-
placeholder: __props.placeholder,
|
|
2502
|
-
disabled: __props.disabled,
|
|
2503
|
-
required: __props.required,
|
|
2504
|
-
"aria-required": __props.required || void 0,
|
|
2505
|
-
"aria-describedby": __props.describedBy,
|
|
2506
|
-
class: inputClass
|
|
2507
|
-
}, _ctx.$attrs, { autocomplete: "new-password" }), null, 16, _hoisted_1$8), [
|
|
2508
|
-
[vue.vModelDynamic, modelValue.value]
|
|
2509
|
-
])
|
|
2510
|
-
]),
|
|
2511
|
-
actions: vue.withCtx(() => [
|
|
2512
|
-
vue.createElementVNode("button", {
|
|
2513
|
-
type: "button",
|
|
2514
|
-
disabled: __props.disabled,
|
|
2515
|
-
class: "p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2516
|
-
onClick: toggleVisibility
|
|
2517
|
-
}, [
|
|
2518
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2519
|
-
icon: showPassword.value ? "lucide:eye-off" : "lucide:eye",
|
|
2520
|
-
class: "size-5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
|
|
2521
|
-
}, null, 8, ["icon"])
|
|
2522
|
-
], 8, _hoisted_2$5)
|
|
2523
|
-
]),
|
|
2524
|
-
_: 1
|
|
2525
|
-
}, 8, ["size", "disabled"]),
|
|
2526
|
-
__props.showStrength && modelValue.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, [
|
|
2527
|
-
vue.createElementVNode("div", _hoisted_4$2, [
|
|
2528
|
-
vue.createElementVNode("div", {
|
|
2529
|
-
class: vue.normalizeClass([
|
|
2530
|
-
"h-full rounded-full transition-all duration-300",
|
|
2531
|
-
(_a = strengthConfig.value) == null ? void 0 : _a.color,
|
|
2532
|
-
(_b = strengthConfig.value) == null ? void 0 : _b.width
|
|
2533
|
-
])
|
|
2534
|
-
}, null, 2)
|
|
2535
|
-
]),
|
|
2536
|
-
strengthConfig.value ? (vue.openBlock(), vue.createElementBlock("p", {
|
|
2537
|
-
key: 0,
|
|
2538
|
-
class: vue.normalizeClass([
|
|
2539
|
-
"mt-1 text-xs font-medium",
|
|
2540
|
-
strength.value === "weak" && "text-red-500",
|
|
2541
|
-
strength.value === "fair" && "text-orange-500",
|
|
2542
|
-
strength.value === "good" && "text-yellow-600 dark:text-yellow-500",
|
|
2543
|
-
strength.value === "strong" && "text-emerald-500"
|
|
2544
|
-
])
|
|
2545
|
-
}, vue.toDisplayString(strengthConfig.value.label), 3)) : vue.createCommentVNode("", true)
|
|
2546
|
-
])) : vue.createCommentVNode("", true)
|
|
2547
|
-
]);
|
|
2548
|
-
};
|
|
2549
|
-
}
|
|
2550
|
-
});
|
|
2551
|
-
const _hoisted_1$7 = ["disabled"];
|
|
2552
|
-
const _hoisted_2$4 = { class: "text-lg leading-none" };
|
|
2553
|
-
const _hoisted_3$3 = ["id", "value", "name", "placeholder", "disabled", "required", "aria-required", "aria-describedby"];
|
|
2554
|
-
const _hoisted_4$1 = { class: "text-xs text-gray-400 font-medium" };
|
|
2555
|
-
const _hoisted_5 = {
|
|
2556
|
-
key: 0,
|
|
2557
|
-
class: "absolute z-50 mt-1 w-full bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-700 rounded-xl shadow-lg overflow-hidden"
|
|
2558
|
-
};
|
|
2559
|
-
const _hoisted_6 = { class: "p-2 border-b border-gray-100 dark:border-slate-700" };
|
|
2560
|
-
const _hoisted_7 = { class: "max-h-48 overflow-y-auto" };
|
|
2561
|
-
const _hoisted_8 = ["onClick"];
|
|
2562
|
-
const _hoisted_9 = { class: "text-lg" };
|
|
2563
|
-
const _hoisted_10 = { class: "flex-1 text-sm text-gray-700 dark:text-gray-300" };
|
|
2564
|
-
const _hoisted_11 = { class: "text-sm text-gray-400" };
|
|
2565
|
-
const _hoisted_12 = {
|
|
2566
|
-
key: 0,
|
|
2567
|
-
class: "px-3 py-4 text-center text-sm text-gray-500"
|
|
2568
|
-
};
|
|
2569
|
-
const defaultCountries = [
|
|
2570
|
-
{ code: "FR", name: "France", dialCode: "+33", flag: "🇫🇷", format: "# ## ## ## ##" },
|
|
2571
|
-
{ code: "US", name: "United States", dialCode: "+1", flag: "🇺🇸", format: "(###) ###-####" },
|
|
2572
|
-
{ code: "GB", name: "United Kingdom", dialCode: "+44", flag: "🇬🇧", format: "#### ######" },
|
|
2573
|
-
{ code: "DE", name: "Germany", dialCode: "+49", flag: "🇩🇪", format: "### #######" },
|
|
2574
|
-
{ code: "ES", name: "Spain", dialCode: "+34", flag: "🇪🇸", format: "### ### ###" },
|
|
2575
|
-
{ code: "IT", name: "Italy", dialCode: "+39", flag: "🇮🇹", format: "### ### ####" },
|
|
2576
|
-
{ code: "BE", name: "Belgium", dialCode: "+32", flag: "🇧🇪", format: "### ## ## ##" },
|
|
2577
|
-
{ code: "CH", name: "Switzerland", dialCode: "+41", flag: "🇨🇭", format: "## ### ## ##" },
|
|
2578
|
-
{ code: "CA", name: "Canada", dialCode: "+1", flag: "🇨🇦", format: "(###) ###-####" },
|
|
2579
|
-
{ code: "AU", name: "Australia", dialCode: "+61", flag: "🇦🇺", format: "### ### ###" },
|
|
2580
|
-
{ code: "ML", name: "Mali", dialCode: "+223", flag: "🇲🇱", format: "## ## ## ##" },
|
|
2581
|
-
{ code: "SN", name: "Senegal", dialCode: "+221", flag: "🇸🇳", format: "## ### ## ##" },
|
|
2582
|
-
{ code: "CI", name: "Côte d'Ivoire", dialCode: "+225", flag: "🇨🇮", format: "## ## ## ## ##" },
|
|
2583
|
-
{ code: "MA", name: "Morocco", dialCode: "+212", flag: "🇲🇦", format: "## ## ## ## ##" },
|
|
2584
|
-
{ code: "TN", name: "Tunisia", dialCode: "+216", flag: "🇹🇳", format: "## ### ###" },
|
|
2585
|
-
{ code: "DZ", name: "Algeria", dialCode: "+213", flag: "🇩🇿", format: "### ## ## ##" }
|
|
2586
|
-
];
|
|
2587
|
-
function formatPhoneWithPattern(value, pattern) {
|
|
2588
|
-
if (!pattern) return value;
|
|
2589
|
-
const digits = value.replace(/\D/g, "");
|
|
2590
|
-
let result = "";
|
|
2591
|
-
let digitIndex = 0;
|
|
2592
|
-
for (const char of pattern) {
|
|
2593
|
-
if (digitIndex >= digits.length) break;
|
|
2594
|
-
if (char === "#") {
|
|
2595
|
-
result += digits[digitIndex];
|
|
2596
|
-
digitIndex++;
|
|
2597
|
-
} else {
|
|
2598
|
-
result += char;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
return result;
|
|
2602
|
-
}
|
|
2603
|
-
function getPhoneDigits(value) {
|
|
2604
|
-
return value.replace(/\D/g, "");
|
|
2605
|
-
}
|
|
2606
|
-
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
2607
|
-
...{
|
|
2608
|
-
inheritAttrs: false
|
|
2609
|
-
},
|
|
2610
|
-
__name: "PhoneInput",
|
|
2611
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2612
|
-
placeholder: { default: "Phone number" },
|
|
2613
|
-
size: { default: "md" },
|
|
2614
|
-
disabled: { type: Boolean },
|
|
2615
|
-
showDialCode: { type: Boolean, default: false },
|
|
2616
|
-
name: {},
|
|
2617
|
-
id: {},
|
|
2618
|
-
required: { type: Boolean },
|
|
2619
|
-
describedBy: {},
|
|
2620
|
-
defaultCountry: { default: "FR" },
|
|
2621
|
-
countries: { default: () => defaultCountries }
|
|
2622
|
-
}, {
|
|
2623
|
-
"modelValue": { default: "" },
|
|
2624
|
-
"modelModifiers": {}
|
|
2625
|
-
}),
|
|
2626
|
-
emits: ["update:modelValue"],
|
|
2627
|
-
setup(__props, { expose: __expose }) {
|
|
2628
|
-
const props = __props;
|
|
2629
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
2630
|
-
const selectedCountry = vue.ref(
|
|
2631
|
-
props.countries.find((c) => c.code === props.defaultCountry) || props.countries[0]
|
|
2632
|
-
);
|
|
2633
|
-
const showDropdown = vue.ref(false);
|
|
2634
|
-
const searchQuery = vue.ref("");
|
|
2635
|
-
const dropdownRef = vue.ref(null);
|
|
2636
|
-
const rawDialCodeInput = vue.ref("");
|
|
2637
|
-
const filteredCountries = vue.computed(() => {
|
|
2638
|
-
if (!searchQuery.value) return props.countries;
|
|
2639
|
-
const query = searchQuery.value.toLowerCase();
|
|
2640
|
-
return props.countries.filter(
|
|
2641
|
-
(c) => c.name.toLowerCase().includes(query) || c.dialCode.includes(query) || c.code.toLowerCase().includes(query)
|
|
2642
|
-
);
|
|
2643
|
-
});
|
|
2644
|
-
const fullNumber = vue.computed(() => {
|
|
2645
|
-
if (!modelValue.value) return "";
|
|
2646
|
-
return `${selectedCountry.value.dialCode}${modelValue.value}`;
|
|
2647
|
-
});
|
|
2648
|
-
const displayValue = vue.computed(() => {
|
|
2649
|
-
if (rawDialCodeInput.value) {
|
|
2650
|
-
return rawDialCodeInput.value;
|
|
2651
|
-
}
|
|
2652
|
-
const formatted = formatPhoneWithPattern(modelValue.value, selectedCountry.value.format);
|
|
2653
|
-
if (props.showDialCode && modelValue.value) {
|
|
2654
|
-
return `${selectedCountry.value.dialCode} ${formatted}`;
|
|
2655
|
-
}
|
|
2656
|
-
return formatted;
|
|
2657
|
-
});
|
|
2658
|
-
function selectCountry(country) {
|
|
2659
|
-
selectedCountry.value = country;
|
|
2660
|
-
showDropdown.value = false;
|
|
2661
|
-
searchQuery.value = "";
|
|
2662
|
-
}
|
|
2663
|
-
function parsePhoneWithDialCode(value) {
|
|
2664
|
-
const cleaned = value.replace(/\s/g, "");
|
|
2665
|
-
if (cleaned.startsWith("+") || cleaned.startsWith("00")) {
|
|
2666
|
-
const withPlus = cleaned.startsWith("00") ? "+" + cleaned.slice(2) : cleaned;
|
|
2667
|
-
for (const country of props.countries) {
|
|
2668
|
-
if (withPlus.startsWith(country.dialCode)) {
|
|
2669
|
-
const digits = withPlus.slice(country.dialCode.length).replace(/\D/g, "");
|
|
2670
|
-
return { digits, country };
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
return { digits: getPhoneDigits(value) };
|
|
2675
|
-
}
|
|
2676
|
-
function handleInput(event) {
|
|
2677
|
-
const target = event.target;
|
|
2678
|
-
const inputValue = target.value;
|
|
2679
|
-
if (inputValue.startsWith("+") || inputValue.startsWith("00")) {
|
|
2680
|
-
const { digits, country } = parsePhoneWithDialCode(inputValue);
|
|
2681
|
-
if (country) {
|
|
2682
|
-
selectedCountry.value = country;
|
|
2683
|
-
modelValue.value = digits;
|
|
2684
|
-
rawDialCodeInput.value = "";
|
|
2685
|
-
} else {
|
|
2686
|
-
rawDialCodeInput.value = inputValue;
|
|
2687
|
-
modelValue.value = "";
|
|
2688
|
-
}
|
|
2689
|
-
} else {
|
|
2690
|
-
rawDialCodeInput.value = "";
|
|
2691
|
-
modelValue.value = getPhoneDigits(inputValue);
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
function handlePaste(event) {
|
|
2695
|
-
var _a;
|
|
2696
|
-
const pastedData = (_a = event.clipboardData) == null ? void 0 : _a.getData("text");
|
|
2697
|
-
if (!pastedData) return;
|
|
2698
|
-
const { digits, country } = parsePhoneWithDialCode(pastedData);
|
|
2699
|
-
if (country) {
|
|
2700
|
-
event.preventDefault();
|
|
2701
|
-
selectedCountry.value = country;
|
|
2702
|
-
modelValue.value = digits;
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
function handleClickOutside(event) {
|
|
2706
|
-
if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
|
|
2707
|
-
showDropdown.value = false;
|
|
2708
|
-
searchQuery.value = "";
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
vue.watch(showDropdown, (isOpen) => {
|
|
2712
|
-
if (isOpen) {
|
|
2713
|
-
document.addEventListener("click", handleClickOutside);
|
|
2714
|
-
} else {
|
|
2715
|
-
document.removeEventListener("click", handleClickOutside);
|
|
2716
|
-
}
|
|
2717
|
-
});
|
|
2718
|
-
__expose({ selectedCountry, fullNumber });
|
|
2719
|
-
return (_ctx, _cache) => {
|
|
2720
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2721
|
-
class: "relative",
|
|
2722
|
-
ref_key: "dropdownRef",
|
|
2723
|
-
ref: dropdownRef
|
|
2724
|
-
}, [
|
|
2725
|
-
vue.createVNode(_sfc_main$p, {
|
|
2726
|
-
size: __props.size,
|
|
2727
|
-
disabled: __props.disabled
|
|
2728
|
-
}, {
|
|
2729
|
-
icon: vue.withCtx(() => [
|
|
2730
|
-
vue.createElementVNode("button", {
|
|
2731
|
-
type: "button",
|
|
2732
|
-
disabled: __props.disabled,
|
|
2733
|
-
class: "flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-slate-600 hover:bg-gray-50 dark:hover:bg-slate-600 -ml-1 pl-1 py-1 rounded-l transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2734
|
-
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => showDropdown.value = !showDropdown.value, ["stop"]))
|
|
2735
|
-
}, [
|
|
2736
|
-
vue.createElementVNode("span", _hoisted_2$4, vue.toDisplayString(selectedCountry.value.flag), 1),
|
|
2737
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2738
|
-
icon: "lucide:chevron-down",
|
|
2739
|
-
class: vue.normalizeClass([
|
|
2740
|
-
"size-3 text-gray-400 transition-transform",
|
|
2741
|
-
showDropdown.value && "rotate-180"
|
|
2742
|
-
])
|
|
2743
|
-
}, null, 8, ["class"])
|
|
2744
|
-
], 8, _hoisted_1$7)
|
|
2745
|
-
]),
|
|
2746
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
2747
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
2748
|
-
id: __props.id ?? __props.name,
|
|
2749
|
-
value: displayValue.value,
|
|
2750
|
-
type: "tel",
|
|
2751
|
-
name: __props.name,
|
|
2752
|
-
placeholder: __props.placeholder,
|
|
2753
|
-
disabled: __props.disabled,
|
|
2754
|
-
required: __props.required,
|
|
2755
|
-
"aria-required": __props.required || void 0,
|
|
2756
|
-
"aria-describedby": __props.describedBy,
|
|
2757
|
-
class: [inputClass, "pl-20"]
|
|
2758
|
-
}, _ctx.$attrs, {
|
|
2759
|
-
onInput: handleInput,
|
|
2760
|
-
onPaste: handlePaste
|
|
2761
|
-
}), null, 16, _hoisted_3$3)
|
|
2762
|
-
]),
|
|
2763
|
-
actions: vue.withCtx(() => [
|
|
2764
|
-
vue.createElementVNode("span", _hoisted_4$1, vue.toDisplayString(selectedCountry.value.dialCode), 1)
|
|
2765
|
-
]),
|
|
2766
|
-
_: 1
|
|
2767
|
-
}, 8, ["size", "disabled"]),
|
|
2768
|
-
vue.createVNode(vue.Transition, {
|
|
2769
|
-
"enter-active-class": "transition-all duration-200 ease-out",
|
|
2770
|
-
"enter-from-class": "opacity-0 -translate-y-2",
|
|
2771
|
-
"enter-to-class": "opacity-100 translate-y-0",
|
|
2772
|
-
"leave-active-class": "transition-all duration-150 ease-in",
|
|
2773
|
-
"leave-from-class": "opacity-100 translate-y-0",
|
|
2774
|
-
"leave-to-class": "opacity-0 -translate-y-2"
|
|
2775
|
-
}, {
|
|
2776
|
-
default: vue.withCtx(() => [
|
|
2777
|
-
showDropdown.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
2778
|
-
vue.createElementVNode("div", _hoisted_6, [
|
|
2779
|
-
vue.withDirectives(vue.createElementVNode("input", {
|
|
2780
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchQuery.value = $event),
|
|
2781
|
-
type: "text",
|
|
2782
|
-
placeholder: "Search countries...",
|
|
2783
|
-
class: "w-full px-3 py-2 text-sm border border-gray-200 dark:border-slate-600 rounded-lg bg-gray-50 dark:bg-slate-700 text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
|
|
2784
|
-
}, null, 512), [
|
|
2785
|
-
[vue.vModelText, searchQuery.value]
|
|
2786
|
-
])
|
|
2787
|
-
]),
|
|
2788
|
-
vue.createElementVNode("ul", _hoisted_7, [
|
|
2789
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredCountries.value, (country) => {
|
|
2790
|
-
return vue.openBlock(), vue.createElementBlock("li", {
|
|
2791
|
-
key: country.code,
|
|
2792
|
-
class: vue.normalizeClass(["flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors", selectedCountry.value.code === country.code && "bg-primary-50 dark:bg-primary-900/20"]),
|
|
2793
|
-
onClick: ($event) => selectCountry(country)
|
|
2794
|
-
}, [
|
|
2795
|
-
vue.createElementVNode("span", _hoisted_9, vue.toDisplayString(country.flag), 1),
|
|
2796
|
-
vue.createElementVNode("span", _hoisted_10, vue.toDisplayString(country.name), 1),
|
|
2797
|
-
vue.createElementVNode("span", _hoisted_11, vue.toDisplayString(country.dialCode), 1)
|
|
2798
|
-
], 10, _hoisted_8);
|
|
2799
|
-
}), 128)),
|
|
2800
|
-
filteredCountries.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_12, " No countries found ")) : vue.createCommentVNode("", true)
|
|
2801
|
-
])
|
|
2802
|
-
])) : vue.createCommentVNode("", true)
|
|
2803
|
-
]),
|
|
2804
|
-
_: 1
|
|
2805
|
-
})
|
|
2806
|
-
], 512);
|
|
2807
|
-
};
|
|
2808
|
-
}
|
|
2809
|
-
});
|
|
2810
|
-
const _hoisted_1$6 = ["disabled"];
|
|
2811
|
-
const _hoisted_2$3 = ["id", "value", "name", "placeholder", "disabled", "required", "min", "max", "step", "aria-required", "aria-describedby"];
|
|
2812
|
-
const _hoisted_3$2 = ["disabled"];
|
|
2813
|
-
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
2814
|
-
...{
|
|
2815
|
-
inheritAttrs: false
|
|
2816
|
-
},
|
|
2817
|
-
__name: "NumberInput",
|
|
2818
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2819
|
-
placeholder: { default: "0" },
|
|
2820
|
-
size: { default: "md" },
|
|
2821
|
-
disabled: { type: Boolean },
|
|
2822
|
-
min: {},
|
|
2823
|
-
max: {},
|
|
2824
|
-
step: { default: 1 },
|
|
2825
|
-
name: {},
|
|
2826
|
-
id: {},
|
|
2827
|
-
required: { type: Boolean },
|
|
2828
|
-
describedBy: {},
|
|
2829
|
-
showStepper: { type: Boolean, default: true }
|
|
2830
|
-
}, {
|
|
2831
|
-
"modelValue": { default: null },
|
|
2832
|
-
"modelModifiers": {}
|
|
2833
|
-
}),
|
|
2834
|
-
emits: ["update:modelValue"],
|
|
2835
|
-
setup(__props) {
|
|
2836
|
-
const props = __props;
|
|
2837
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
2838
|
-
const canDecrement = vue.computed(() => {
|
|
2839
|
-
if (props.disabled) return false;
|
|
2840
|
-
if (modelValue.value === null) return true;
|
|
2841
|
-
if (props.min !== void 0) return modelValue.value > props.min;
|
|
2842
|
-
return true;
|
|
2843
|
-
});
|
|
2844
|
-
const canIncrement = vue.computed(() => {
|
|
2845
|
-
if (props.disabled) return false;
|
|
2846
|
-
if (modelValue.value === null) return true;
|
|
2847
|
-
if (props.max !== void 0) return modelValue.value < props.max;
|
|
2848
|
-
return true;
|
|
2849
|
-
});
|
|
2850
|
-
function increment() {
|
|
2851
|
-
if (!canIncrement.value) return;
|
|
2852
|
-
const current = modelValue.value ?? 0;
|
|
2853
|
-
const newValue = current + props.step;
|
|
2854
|
-
modelValue.value = props.max !== void 0 ? Math.min(newValue, props.max) : newValue;
|
|
2855
|
-
}
|
|
2856
|
-
function decrement() {
|
|
2857
|
-
if (!canDecrement.value) return;
|
|
2858
|
-
const current = modelValue.value ?? 0;
|
|
2859
|
-
const newValue = current - props.step;
|
|
2860
|
-
modelValue.value = props.min !== void 0 ? Math.max(newValue, props.min) : newValue;
|
|
2861
|
-
}
|
|
2862
|
-
function handleInput(event) {
|
|
2863
|
-
const target = event.target;
|
|
2864
|
-
const value = target.value === "" ? null : parseFloat(target.value);
|
|
2865
|
-
if (value !== null && !isNaN(value)) {
|
|
2866
|
-
let clampedValue = value;
|
|
2867
|
-
if (props.min !== void 0) clampedValue = Math.max(clampedValue, props.min);
|
|
2868
|
-
if (props.max !== void 0) clampedValue = Math.min(clampedValue, props.max);
|
|
2869
|
-
modelValue.value = clampedValue;
|
|
2870
|
-
} else {
|
|
2871
|
-
modelValue.value = null;
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
return (_ctx, _cache) => {
|
|
2875
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
2876
|
-
size: __props.size,
|
|
2877
|
-
disabled: __props.disabled
|
|
2878
|
-
}, vue.createSlots({
|
|
2879
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
2880
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
2881
|
-
id: __props.id ?? __props.name,
|
|
2882
|
-
value: modelValue.value,
|
|
2883
|
-
type: "number",
|
|
2884
|
-
name: __props.name,
|
|
2885
|
-
placeholder: __props.placeholder,
|
|
2886
|
-
disabled: __props.disabled,
|
|
2887
|
-
required: __props.required,
|
|
2888
|
-
min: __props.min,
|
|
2889
|
-
max: __props.max,
|
|
2890
|
-
step: __props.step,
|
|
2891
|
-
"aria-required": __props.required || void 0,
|
|
2892
|
-
"aria-describedby": __props.describedBy,
|
|
2893
|
-
class: [inputClass, "text-center", __props.showStepper && "pl-12 pr-12"]
|
|
2894
|
-
}, _ctx.$attrs, { onInput: handleInput }), null, 16, _hoisted_2$3)
|
|
2895
|
-
]),
|
|
2896
|
-
_: 2
|
|
2897
|
-
}, [
|
|
2898
|
-
__props.showStepper ? {
|
|
2899
|
-
name: "icon",
|
|
2900
|
-
fn: vue.withCtx(() => [
|
|
2901
|
-
vue.createElementVNode("button", {
|
|
2902
|
-
type: "button",
|
|
2903
|
-
disabled: !canDecrement.value,
|
|
2904
|
-
class: "p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-600 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
2905
|
-
onClick: decrement
|
|
2906
|
-
}, [
|
|
2907
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2908
|
-
icon: "lucide:minus",
|
|
2909
|
-
class: "size-4 text-gray-500"
|
|
2910
|
-
})
|
|
2911
|
-
], 8, _hoisted_1$6)
|
|
2912
|
-
]),
|
|
2913
|
-
key: "0"
|
|
2914
|
-
} : void 0,
|
|
2915
|
-
__props.showStepper ? {
|
|
2916
|
-
name: "actions",
|
|
2917
|
-
fn: vue.withCtx(() => [
|
|
2918
|
-
vue.createElementVNode("button", {
|
|
2919
|
-
type: "button",
|
|
2920
|
-
disabled: !canIncrement.value,
|
|
2921
|
-
class: "p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-600 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
|
|
2922
|
-
onClick: increment
|
|
2923
|
-
}, [
|
|
2924
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
2925
|
-
icon: "lucide:plus",
|
|
2926
|
-
class: "size-4 text-gray-500"
|
|
2927
|
-
})
|
|
2928
|
-
], 8, _hoisted_3$2)
|
|
2929
|
-
]),
|
|
2930
|
-
key: "1"
|
|
2931
|
-
} : void 0
|
|
2932
|
-
]), 1032, ["size", "disabled"]);
|
|
2933
|
-
};
|
|
2934
|
-
}
|
|
2935
|
-
});
|
|
2936
|
-
const _hoisted_1$5 = { class: "text-sm font-medium text-gray-500 dark:text-gray-400" };
|
|
2937
|
-
const _hoisted_2$2 = ["id", "value", "name", "placeholder", "disabled", "required", "aria-required", "aria-describedby"];
|
|
2938
|
-
const _hoisted_3$1 = { class: "text-sm font-medium text-gray-500 dark:text-gray-400" };
|
|
2939
|
-
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
2940
|
-
...{
|
|
2941
|
-
inheritAttrs: false
|
|
2942
|
-
},
|
|
2943
|
-
__name: "MoneyInput",
|
|
2944
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
2945
|
-
placeholder: { default: "0.00" },
|
|
2946
|
-
size: { default: "md" },
|
|
2947
|
-
disabled: { type: Boolean },
|
|
2948
|
-
currency: { default: "EUR" },
|
|
2949
|
-
min: {},
|
|
2950
|
-
max: {},
|
|
2951
|
-
decimals: { default: 2 },
|
|
2952
|
-
name: {},
|
|
2953
|
-
id: {},
|
|
2954
|
-
required: { type: Boolean },
|
|
2955
|
-
describedBy: {}
|
|
2956
|
-
}, {
|
|
2957
|
-
"modelValue": { default: null },
|
|
2958
|
-
"modelModifiers": {}
|
|
2959
|
-
}),
|
|
2960
|
-
emits: ["update:modelValue"],
|
|
2961
|
-
setup(__props) {
|
|
2962
|
-
const currencyConfig = {
|
|
2963
|
-
EUR: { symbol: "€", locale: "fr-FR", position: "suffix" },
|
|
2964
|
-
USD: { symbol: "$", locale: "en-US", position: "prefix" },
|
|
2965
|
-
GBP: { symbol: "£", locale: "en-GB", position: "prefix" },
|
|
2966
|
-
XOF: { symbol: "CFA", locale: "fr-FR", position: "suffix" },
|
|
2967
|
-
MAD: { symbol: "DH", locale: "fr-MA", position: "suffix" },
|
|
2968
|
-
CHF: { symbol: "CHF", locale: "fr-CH", position: "suffix" },
|
|
2969
|
-
CAD: { symbol: "CA$", locale: "en-CA", position: "prefix" }
|
|
2970
|
-
};
|
|
2971
|
-
const props = __props;
|
|
2972
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
2973
|
-
const config = vue.computed(() => currencyConfig[props.currency]);
|
|
2974
|
-
const displayValue = vue.ref("");
|
|
2975
|
-
function formatForDisplay(value) {
|
|
2976
|
-
if (value === null) return "";
|
|
2977
|
-
return value.toLocaleString(config.value.locale, {
|
|
2978
|
-
minimumFractionDigits: props.decimals,
|
|
2979
|
-
maximumFractionDigits: props.decimals
|
|
2980
|
-
});
|
|
2981
|
-
}
|
|
2982
|
-
function parseDisplayValue(value) {
|
|
2983
|
-
if (!value) return null;
|
|
2984
|
-
const cleaned = value.replace(/\s/g, "").replace(/,/g, ".");
|
|
2985
|
-
const parsed = parseFloat(cleaned);
|
|
2986
|
-
return isNaN(parsed) ? null : parsed;
|
|
2987
|
-
}
|
|
2988
|
-
vue.watch(
|
|
2989
|
-
() => modelValue.value,
|
|
2990
|
-
(newValue) => {
|
|
2991
|
-
displayValue.value = formatForDisplay(newValue);
|
|
2992
|
-
},
|
|
2993
|
-
{ immediate: true }
|
|
2994
|
-
);
|
|
2995
|
-
function handleInput(event) {
|
|
2996
|
-
const target = event.target;
|
|
2997
|
-
displayValue.value = target.value;
|
|
2998
|
-
}
|
|
2999
|
-
function handleBlur() {
|
|
3000
|
-
const parsed = parseDisplayValue(displayValue.value);
|
|
3001
|
-
if (parsed !== null) {
|
|
3002
|
-
let clampedValue = parsed;
|
|
3003
|
-
if (props.min !== void 0) clampedValue = Math.max(clampedValue, props.min);
|
|
3004
|
-
if (props.max !== void 0) clampedValue = Math.min(clampedValue, props.max);
|
|
3005
|
-
modelValue.value = clampedValue;
|
|
3006
|
-
displayValue.value = formatForDisplay(clampedValue);
|
|
3007
|
-
} else {
|
|
3008
|
-
modelValue.value = null;
|
|
3009
|
-
displayValue.value = "";
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
return (_ctx, _cache) => {
|
|
3013
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3014
|
-
size: __props.size,
|
|
3015
|
-
disabled: __props.disabled
|
|
3016
|
-
}, vue.createSlots({
|
|
3017
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
3018
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
3019
|
-
id: __props.id ?? __props.name,
|
|
3020
|
-
value: displayValue.value,
|
|
3021
|
-
type: "text",
|
|
3022
|
-
inputmode: "decimal",
|
|
3023
|
-
name: __props.name,
|
|
3024
|
-
placeholder: __props.placeholder,
|
|
3025
|
-
disabled: __props.disabled,
|
|
3026
|
-
required: __props.required,
|
|
3027
|
-
"aria-required": __props.required || void 0,
|
|
3028
|
-
"aria-describedby": __props.describedBy,
|
|
3029
|
-
class: [inputClass, "text-right"]
|
|
3030
|
-
}, _ctx.$attrs, {
|
|
3031
|
-
onInput: handleInput,
|
|
3032
|
-
onBlur: handleBlur
|
|
3033
|
-
}), null, 16, _hoisted_2$2)
|
|
3034
|
-
]),
|
|
3035
|
-
_: 2
|
|
3036
|
-
}, [
|
|
3037
|
-
config.value.position === "prefix" ? {
|
|
3038
|
-
name: "icon",
|
|
3039
|
-
fn: vue.withCtx(() => [
|
|
3040
|
-
vue.createElementVNode("span", _hoisted_1$5, vue.toDisplayString(config.value.symbol), 1)
|
|
3041
|
-
]),
|
|
3042
|
-
key: "0"
|
|
3043
|
-
} : void 0,
|
|
3044
|
-
config.value.position === "suffix" ? {
|
|
3045
|
-
name: "actions",
|
|
3046
|
-
fn: vue.withCtx(() => [
|
|
3047
|
-
vue.createElementVNode("span", _hoisted_3$1, vue.toDisplayString(config.value.symbol), 1)
|
|
3048
|
-
]),
|
|
3049
|
-
key: "1"
|
|
3050
|
-
} : void 0
|
|
3051
|
-
]), 1032, ["size", "disabled"]);
|
|
3052
|
-
};
|
|
3053
|
-
}
|
|
3054
|
-
});
|
|
3055
|
-
const _hoisted_1$4 = ["id", "value", "name", "placeholder", "disabled", "required", "min", "max", "step", "aria-required", "aria-describedby"];
|
|
3056
|
-
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
3057
|
-
...{
|
|
3058
|
-
inheritAttrs: false
|
|
3059
|
-
},
|
|
3060
|
-
__name: "PercentInput",
|
|
3061
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
3062
|
-
placeholder: { default: "0" },
|
|
3063
|
-
size: { default: "md" },
|
|
3064
|
-
disabled: { type: Boolean },
|
|
3065
|
-
min: { default: 0 },
|
|
3066
|
-
max: { default: 100 },
|
|
3067
|
-
decimals: { default: 0 },
|
|
3068
|
-
name: {},
|
|
3069
|
-
id: {},
|
|
3070
|
-
required: { type: Boolean },
|
|
3071
|
-
describedBy: {}
|
|
3072
|
-
}, {
|
|
3073
|
-
"modelValue": { default: null },
|
|
3074
|
-
"modelModifiers": {}
|
|
3075
|
-
}),
|
|
3076
|
-
emits: ["update:modelValue"],
|
|
3077
|
-
setup(__props) {
|
|
3078
|
-
const props = __props;
|
|
3079
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
3080
|
-
const displayValue = vue.computed({
|
|
3081
|
-
get: () => modelValue.value !== null ? modelValue.value.toString() : "",
|
|
3082
|
-
set: (val) => {
|
|
3083
|
-
if (val === "") {
|
|
3084
|
-
modelValue.value = null;
|
|
3085
|
-
return;
|
|
3086
|
-
}
|
|
3087
|
-
const parsed = parseFloat(val);
|
|
3088
|
-
if (!isNaN(parsed)) {
|
|
3089
|
-
let clamped = parsed;
|
|
3090
|
-
if (props.min !== void 0) clamped = Math.max(clamped, props.min);
|
|
3091
|
-
if (props.max !== void 0) clamped = Math.min(clamped, props.max);
|
|
3092
|
-
modelValue.value = clamped;
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
});
|
|
3096
|
-
function handleInput(event) {
|
|
3097
|
-
const target = event.target;
|
|
3098
|
-
displayValue.value = target.value;
|
|
3099
|
-
}
|
|
3100
|
-
return (_ctx, _cache) => {
|
|
3101
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3102
|
-
size: __props.size,
|
|
3103
|
-
disabled: __props.disabled
|
|
3104
|
-
}, {
|
|
3105
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
3106
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
3107
|
-
id: __props.id ?? __props.name,
|
|
3108
|
-
value: displayValue.value,
|
|
3109
|
-
type: "number",
|
|
3110
|
-
inputmode: "decimal",
|
|
3111
|
-
name: __props.name,
|
|
3112
|
-
placeholder: __props.placeholder,
|
|
3113
|
-
disabled: __props.disabled,
|
|
3114
|
-
required: __props.required,
|
|
3115
|
-
min: __props.min,
|
|
3116
|
-
max: __props.max,
|
|
3117
|
-
step: __props.decimals > 0 ? Math.pow(10, -__props.decimals) : 1,
|
|
3118
|
-
"aria-required": __props.required || void 0,
|
|
3119
|
-
"aria-describedby": __props.describedBy,
|
|
3120
|
-
class: [inputClass, "text-right pr-10"]
|
|
3121
|
-
}, _ctx.$attrs, { onInput: handleInput }), null, 16, _hoisted_1$4)
|
|
3122
|
-
]),
|
|
3123
|
-
actions: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
3124
|
-
vue.createElementVNode("span", { class: "text-sm font-medium text-gray-500 dark:text-gray-400" }, "%", -1)
|
|
3125
|
-
])]),
|
|
3126
|
-
_: 1
|
|
3127
|
-
}, 8, ["size", "disabled"]);
|
|
3128
|
-
};
|
|
3129
|
-
}
|
|
3130
|
-
});
|
|
3131
|
-
const _hoisted_1$3 = { class: "inline-flex items-center gap-2 bg-gray-50 dark:bg-slate-700 rounded-xl p-1 border border-gray-200 dark:border-slate-600" };
|
|
3132
|
-
const _hoisted_2$1 = ["disabled"];
|
|
3133
|
-
const _hoisted_3 = ["id", "value", "name", "disabled", "required", "min", "max"];
|
|
3134
|
-
const _hoisted_4 = ["disabled"];
|
|
3135
|
-
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
3136
|
-
...{
|
|
3137
|
-
inheritAttrs: false
|
|
3138
|
-
},
|
|
3139
|
-
__name: "QuantityInput",
|
|
3140
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
3141
|
-
size: { default: "md" },
|
|
3142
|
-
disabled: { type: Boolean },
|
|
3143
|
-
min: { default: 1 },
|
|
3144
|
-
max: {},
|
|
3145
|
-
step: { default: 1 },
|
|
3146
|
-
name: {},
|
|
3147
|
-
id: {},
|
|
3148
|
-
required: { type: Boolean }
|
|
3149
|
-
}, {
|
|
3150
|
-
"modelValue": { default: 1 },
|
|
3151
|
-
"modelModifiers": {}
|
|
3152
|
-
}),
|
|
3153
|
-
emits: ["update:modelValue"],
|
|
3154
|
-
setup(__props) {
|
|
3155
|
-
const props = __props;
|
|
3156
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
3157
|
-
const canDecrement = vue.computed(() => {
|
|
3158
|
-
if (props.disabled) return false;
|
|
3159
|
-
if (props.min !== void 0) return modelValue.value > props.min;
|
|
3160
|
-
return true;
|
|
3161
|
-
});
|
|
3162
|
-
const canIncrement = vue.computed(() => {
|
|
3163
|
-
if (props.disabled) return false;
|
|
3164
|
-
if (props.max !== void 0) return modelValue.value < props.max;
|
|
3165
|
-
return true;
|
|
3166
|
-
});
|
|
3167
|
-
function increment() {
|
|
3168
|
-
if (!canIncrement.value) return;
|
|
3169
|
-
const newValue = modelValue.value + props.step;
|
|
3170
|
-
modelValue.value = props.max !== void 0 ? Math.min(newValue, props.max) : newValue;
|
|
3171
|
-
}
|
|
3172
|
-
function decrement() {
|
|
3173
|
-
if (!canDecrement.value) return;
|
|
3174
|
-
const newValue = modelValue.value - props.step;
|
|
3175
|
-
modelValue.value = props.min !== void 0 ? Math.max(newValue, props.min) : newValue;
|
|
3176
|
-
}
|
|
3177
|
-
function handleInput(event) {
|
|
3178
|
-
const target = event.target;
|
|
3179
|
-
const value = parseInt(target.value, 10);
|
|
3180
|
-
if (!isNaN(value)) {
|
|
3181
|
-
let clampedValue = value;
|
|
3182
|
-
if (props.min !== void 0) clampedValue = Math.max(clampedValue, props.min);
|
|
3183
|
-
if (props.max !== void 0) clampedValue = Math.min(clampedValue, props.max);
|
|
3184
|
-
modelValue.value = clampedValue;
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
const sizeClasses = vue.computed(() => ({
|
|
3188
|
-
button: {
|
|
3189
|
-
sm: "size-7",
|
|
3190
|
-
md: "size-9",
|
|
3191
|
-
lg: "size-11"
|
|
3192
|
-
}[props.size],
|
|
3193
|
-
icon: {
|
|
3194
|
-
sm: "size-3",
|
|
3195
|
-
md: "size-4",
|
|
3196
|
-
lg: "size-5"
|
|
3197
|
-
}[props.size],
|
|
3198
|
-
input: {
|
|
3199
|
-
sm: "text-sm w-10",
|
|
3200
|
-
md: "text-base w-12",
|
|
3201
|
-
lg: "text-lg w-14"
|
|
3202
|
-
}[props.size]
|
|
3203
|
-
}));
|
|
3204
|
-
return (_ctx, _cache) => {
|
|
3205
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
3206
|
-
vue.createElementVNode("button", {
|
|
3207
|
-
type: "button",
|
|
3208
|
-
disabled: !canDecrement.value,
|
|
3209
|
-
class: vue.normalizeClass([
|
|
3210
|
-
"flex items-center justify-center rounded-lg bg-white dark:bg-slate-600 border border-gray-200 dark:border-slate-500 transition-all",
|
|
3211
|
-
"hover:bg-gray-50 dark:hover:bg-slate-500 hover:border-gray-300 dark:hover:border-slate-400",
|
|
3212
|
-
"disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-white dark:disabled:hover:bg-slate-600",
|
|
3213
|
-
"shadow-sm",
|
|
3214
|
-
sizeClasses.value.button
|
|
3215
|
-
]),
|
|
3216
|
-
onClick: decrement
|
|
3217
|
-
}, [
|
|
3218
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
3219
|
-
icon: "lucide:minus",
|
|
3220
|
-
class: vue.normalizeClass(["text-gray-600 dark:text-gray-300", sizeClasses.value.icon])
|
|
3221
|
-
}, null, 8, ["class"])
|
|
3222
|
-
], 10, _hoisted_2$1),
|
|
3223
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
3224
|
-
id: __props.id ?? __props.name,
|
|
3225
|
-
value: modelValue.value,
|
|
3226
|
-
type: "number",
|
|
3227
|
-
name: __props.name,
|
|
3228
|
-
disabled: __props.disabled,
|
|
3229
|
-
required: __props.required,
|
|
3230
|
-
min: __props.min,
|
|
3231
|
-
max: __props.max,
|
|
3232
|
-
class: [
|
|
3233
|
-
"bg-transparent text-center font-semibold text-gray-900 dark:text-white",
|
|
3234
|
-
"focus:outline-none appearance-none",
|
|
3235
|
-
"[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
3236
|
-
"disabled:opacity-50",
|
|
3237
|
-
sizeClasses.value.input
|
|
3238
|
-
]
|
|
3239
|
-
}, _ctx.$attrs, { onInput: handleInput }), null, 16, _hoisted_3),
|
|
3240
|
-
vue.createElementVNode("button", {
|
|
3241
|
-
type: "button",
|
|
3242
|
-
disabled: !canIncrement.value,
|
|
3243
|
-
class: vue.normalizeClass([
|
|
3244
|
-
"flex items-center justify-center rounded-lg bg-white dark:bg-slate-600 border border-gray-200 dark:border-slate-500 transition-all",
|
|
3245
|
-
"hover:bg-gray-50 dark:hover:bg-slate-500 hover:border-gray-300 dark:hover:border-slate-400",
|
|
3246
|
-
"disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-white dark:disabled:hover:bg-slate-600",
|
|
3247
|
-
"shadow-sm",
|
|
3248
|
-
sizeClasses.value.button
|
|
3249
|
-
]),
|
|
3250
|
-
onClick: increment
|
|
3251
|
-
}, [
|
|
3252
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
3253
|
-
icon: "lucide:plus",
|
|
3254
|
-
class: vue.normalizeClass(["text-gray-600 dark:text-gray-300", sizeClasses.value.icon])
|
|
3255
|
-
}, null, 8, ["class"])
|
|
3256
|
-
], 10, _hoisted_4)
|
|
3257
|
-
]);
|
|
3258
|
-
};
|
|
3259
|
-
}
|
|
3260
|
-
});
|
|
3261
|
-
const _hoisted_1$2 = ["id", "name", "placeholder", "disabled", "required", "aria-invalid", "aria-required", "aria-describedby"];
|
|
3262
|
-
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
3263
|
-
...{
|
|
3264
|
-
inheritAttrs: false
|
|
3265
|
-
},
|
|
3266
|
-
__name: "URLInput",
|
|
3267
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
3268
|
-
placeholder: { default: "https://example.com" },
|
|
3269
|
-
size: { default: "md" },
|
|
3270
|
-
disabled: { type: Boolean },
|
|
3271
|
-
showValidation: { type: Boolean, default: true },
|
|
3272
|
-
name: {},
|
|
3273
|
-
id: {},
|
|
3274
|
-
required: { type: Boolean },
|
|
3275
|
-
describedBy: {}
|
|
3276
|
-
}, {
|
|
3277
|
-
"modelValue": { default: "" },
|
|
3278
|
-
"modelModifiers": {}
|
|
3279
|
-
}),
|
|
3280
|
-
emits: ["update:modelValue"],
|
|
3281
|
-
setup(__props) {
|
|
3282
|
-
const props = __props;
|
|
3283
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
3284
|
-
const urlRegex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/;
|
|
3285
|
-
const isValid = vue.computed(() => {
|
|
3286
|
-
if (!modelValue.value) return null;
|
|
3287
|
-
return urlRegex.test(modelValue.value);
|
|
3288
|
-
});
|
|
3289
|
-
const isTouched = vue.ref(false);
|
|
3290
|
-
const showStatus = vue.computed(() => {
|
|
3291
|
-
return props.showValidation && isTouched.value && !!modelValue.value;
|
|
3292
|
-
});
|
|
3293
|
-
function handleBlur() {
|
|
3294
|
-
isTouched.value = true;
|
|
3295
|
-
}
|
|
3296
|
-
function openUrl() {
|
|
3297
|
-
if (isValid.value && modelValue.value) {
|
|
3298
|
-
const url = modelValue.value.startsWith("http") ? modelValue.value : `https://${modelValue.value}`;
|
|
3299
|
-
window.open(url, "_blank");
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
return (_ctx, _cache) => {
|
|
3303
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3304
|
-
icon: "lucide:link",
|
|
3305
|
-
size: __props.size,
|
|
3306
|
-
disabled: __props.disabled,
|
|
3307
|
-
invalid: showStatus.value && isValid.value === false
|
|
3308
|
-
}, {
|
|
3309
|
-
default: vue.withCtx(({ inputClass }) => [
|
|
3310
|
-
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
3311
|
-
id: __props.id ?? __props.name,
|
|
3312
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
3313
|
-
type: "url",
|
|
3314
|
-
name: __props.name,
|
|
3315
|
-
placeholder: __props.placeholder,
|
|
3316
|
-
disabled: __props.disabled,
|
|
3317
|
-
required: __props.required,
|
|
3318
|
-
"aria-invalid": showStatus.value && isValid.value === false || void 0,
|
|
3319
|
-
"aria-required": __props.required || void 0,
|
|
3320
|
-
"aria-describedby": __props.describedBy,
|
|
3321
|
-
class: inputClass
|
|
3322
|
-
}, _ctx.$attrs, { onBlur: handleBlur }), null, 16, _hoisted_1$2), [
|
|
3323
|
-
[vue.vModelText, modelValue.value]
|
|
3324
|
-
])
|
|
3325
|
-
]),
|
|
3326
|
-
actions: vue.withCtx(() => [
|
|
3327
|
-
showStatus.value && isValid.value && modelValue.value ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
3328
|
-
key: 0,
|
|
3329
|
-
type: "button",
|
|
3330
|
-
class: "p-1 rounded hover:bg-gray-100 dark:hover:bg-slate-600 transition-colors",
|
|
3331
|
-
title: "Open URL",
|
|
3332
|
-
onClick: openUrl
|
|
3333
|
-
}, [
|
|
3334
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
3335
|
-
icon: "lucide:external-link",
|
|
3336
|
-
class: "size-4 text-gray-400 hover:text-primary-500"
|
|
3337
|
-
})
|
|
3338
|
-
])) : showStatus.value && isValid.value === false ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), {
|
|
3339
|
-
key: 1,
|
|
3340
|
-
icon: "lucide:alert-circle",
|
|
3341
|
-
class: "size-5 text-red-500"
|
|
3342
|
-
})) : vue.createCommentVNode("", true)
|
|
3343
|
-
]),
|
|
3344
|
-
_: 1
|
|
3345
|
-
}, 8, ["size", "disabled", "invalid"]);
|
|
3346
|
-
};
|
|
3347
|
-
}
|
|
3348
|
-
});
|
|
3349
|
-
const _hoisted_1$1 = ["value", "type", "name", "disabled", "onInput", "onKeydown"];
|
|
3350
|
-
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
3351
|
-
...{
|
|
3352
|
-
inheritAttrs: false
|
|
3353
|
-
},
|
|
3354
|
-
__name: "OTPInput",
|
|
3355
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
3356
|
-
length: { default: 6 },
|
|
3357
|
-
size: { default: "md" },
|
|
3358
|
-
disabled: { type: Boolean },
|
|
3359
|
-
autoFocus: { type: Boolean, default: true },
|
|
3360
|
-
name: {},
|
|
3361
|
-
masked: { type: Boolean, default: false }
|
|
3362
|
-
}, {
|
|
3363
|
-
"modelValue": { default: "" },
|
|
3364
|
-
"modelModifiers": {}
|
|
3365
|
-
}),
|
|
3366
|
-
emits: /* @__PURE__ */ vue.mergeModels(["complete"], ["update:modelValue"]),
|
|
3367
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3368
|
-
const props = __props;
|
|
3369
|
-
const emit = __emit;
|
|
3370
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
3371
|
-
const inputRefs = vue.ref([]);
|
|
3372
|
-
const digits = vue.computed(() => {
|
|
3373
|
-
const arr = modelValue.value.split("");
|
|
3374
|
-
while (arr.length < props.length) {
|
|
3375
|
-
arr.push("");
|
|
3376
|
-
}
|
|
3377
|
-
return arr.slice(0, props.length);
|
|
3378
|
-
});
|
|
3379
|
-
const sizeClasses = vue.computed(() => ({
|
|
3380
|
-
input: {
|
|
3381
|
-
sm: "size-10 text-lg",
|
|
3382
|
-
md: "size-12 text-xl",
|
|
3383
|
-
lg: "size-14 text-2xl"
|
|
3384
|
-
}[props.size],
|
|
3385
|
-
gap: {
|
|
3386
|
-
sm: "gap-2",
|
|
3387
|
-
md: "gap-3",
|
|
3388
|
-
lg: "gap-4"
|
|
3389
|
-
}[props.size]
|
|
3390
|
-
}));
|
|
3391
|
-
function updateValue(index2, value) {
|
|
3392
|
-
const newDigits = [...digits.value];
|
|
3393
|
-
newDigits[index2] = value.slice(-1);
|
|
3394
|
-
modelValue.value = newDigits.join("");
|
|
3395
|
-
if (modelValue.value.length === props.length && !modelValue.value.includes("")) {
|
|
3396
|
-
emit("complete", modelValue.value);
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
function handleInput(event, index2) {
|
|
3400
|
-
const target = event.target;
|
|
3401
|
-
const value = target.value.replace(/\D/g, "");
|
|
3402
|
-
if (value) {
|
|
3403
|
-
updateValue(index2, value);
|
|
3404
|
-
if (index2 < props.length - 1) {
|
|
3405
|
-
vue.nextTick(() => {
|
|
3406
|
-
var _a;
|
|
3407
|
-
(_a = inputRefs.value[index2 + 1]) == null ? void 0 : _a.focus();
|
|
3408
|
-
});
|
|
3409
|
-
}
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
function handleKeydown(event, index2) {
|
|
3413
|
-
var _a, _b, _c;
|
|
3414
|
-
const target = event.target;
|
|
3415
|
-
if (event.key === "Backspace") {
|
|
3416
|
-
if (!target.value && index2 > 0) {
|
|
3417
|
-
(_a = inputRefs.value[index2 - 1]) == null ? void 0 : _a.focus();
|
|
3418
|
-
}
|
|
3419
|
-
updateValue(index2, "");
|
|
3420
|
-
} else if (event.key === "ArrowLeft" && index2 > 0) {
|
|
3421
|
-
(_b = inputRefs.value[index2 - 1]) == null ? void 0 : _b.focus();
|
|
3422
|
-
} else if (event.key === "ArrowRight" && index2 < props.length - 1) {
|
|
3423
|
-
(_c = inputRefs.value[index2 + 1]) == null ? void 0 : _c.focus();
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
function handlePaste(event) {
|
|
3427
|
-
var _a;
|
|
3428
|
-
event.preventDefault();
|
|
3429
|
-
const pastedData = (_a = event.clipboardData) == null ? void 0 : _a.getData("text").replace(/\D/g, "").slice(0, props.length);
|
|
3430
|
-
if (pastedData) {
|
|
3431
|
-
modelValue.value = pastedData;
|
|
3432
|
-
const focusIndex = Math.min(pastedData.length, props.length - 1);
|
|
3433
|
-
vue.nextTick(() => {
|
|
3434
|
-
var _a2;
|
|
3435
|
-
(_a2 = inputRefs.value[focusIndex]) == null ? void 0 : _a2.focus();
|
|
3436
|
-
});
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
function handleFocus(event) {
|
|
3440
|
-
const target = event.target;
|
|
3441
|
-
target.select();
|
|
3442
|
-
}
|
|
3443
|
-
vue.watch(
|
|
3444
|
-
() => modelValue.value,
|
|
3445
|
-
(newValue) => {
|
|
3446
|
-
if (newValue.length === props.length) {
|
|
3447
|
-
emit("complete", newValue);
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3450
|
-
);
|
|
3451
|
-
vue.onMounted(() => {
|
|
3452
|
-
var _a;
|
|
3453
|
-
if (props.autoFocus) {
|
|
3454
|
-
(_a = inputRefs.value[0]) == null ? void 0 : _a.focus();
|
|
3455
|
-
}
|
|
3456
|
-
});
|
|
3457
|
-
function setInputRef(el, index2) {
|
|
3458
|
-
if (el) {
|
|
3459
|
-
inputRefs.value[index2] = el;
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
__expose({ focus: () => {
|
|
3463
|
-
var _a;
|
|
3464
|
-
return (_a = inputRefs.value[0]) == null ? void 0 : _a.focus();
|
|
3465
|
-
} });
|
|
3466
|
-
return (_ctx, _cache) => {
|
|
3467
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3468
|
-
class: vue.normalizeClass(["inline-flex", sizeClasses.value.gap])
|
|
3469
|
-
}, [
|
|
3470
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(digits.value, (digit, index2) => {
|
|
3471
|
-
return vue.openBlock(), vue.createElementBlock("input", {
|
|
3472
|
-
key: index2,
|
|
3473
|
-
ref_for: true,
|
|
3474
|
-
ref: (el) => setInputRef(el, index2),
|
|
3475
|
-
value: digit,
|
|
3476
|
-
type: __props.masked ? "password" : "text",
|
|
3477
|
-
inputmode: "numeric",
|
|
3478
|
-
name: __props.name ? `${__props.name}-${index2}` : void 0,
|
|
3479
|
-
disabled: __props.disabled,
|
|
3480
|
-
maxlength: "1",
|
|
3481
|
-
autocomplete: "one-time-code",
|
|
3482
|
-
class: vue.normalizeClass([
|
|
3483
|
-
"text-center font-semibold rounded-xl border-2 transition-all",
|
|
3484
|
-
"bg-gray-50 dark:bg-slate-700 text-gray-900 dark:text-white",
|
|
3485
|
-
"border-gray-200 dark:border-slate-600",
|
|
3486
|
-
"focus:border-primary-500 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:outline-none",
|
|
3487
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3488
|
-
digit ? "border-primary-300 dark:border-primary-500/50" : "",
|
|
3489
|
-
sizeClasses.value.input
|
|
3490
|
-
]),
|
|
3491
|
-
onInput: ($event) => handleInput($event, index2),
|
|
3492
|
-
onKeydown: ($event) => handleKeydown($event, index2),
|
|
3493
|
-
onPaste: handlePaste,
|
|
3494
|
-
onFocus: handleFocus
|
|
3495
|
-
}, null, 42, _hoisted_1$1);
|
|
3496
|
-
}), 128))
|
|
3497
|
-
], 2);
|
|
3498
|
-
};
|
|
3499
|
-
}
|
|
3500
|
-
});
|
|
3501
|
-
const _hoisted_1 = ["onClick"];
|
|
3502
|
-
const _hoisted_2 = ["id", "name", "placeholder", "disabled", "required"];
|
|
3503
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
3504
|
-
...{
|
|
3505
|
-
inheritAttrs: false
|
|
3506
|
-
},
|
|
3507
|
-
__name: "TagsInput",
|
|
3508
|
-
props: /* @__PURE__ */ vue.mergeModels({
|
|
3509
|
-
placeholder: { default: "Add tag..." },
|
|
3510
|
-
size: { default: "md" },
|
|
3511
|
-
disabled: { type: Boolean },
|
|
3512
|
-
max: {},
|
|
3513
|
-
allowDuplicates: { type: Boolean, default: false },
|
|
3514
|
-
name: {},
|
|
3515
|
-
id: {},
|
|
3516
|
-
required: { type: Boolean }
|
|
3517
|
-
}, {
|
|
3518
|
-
"modelValue": { default: () => [] },
|
|
3519
|
-
"modelModifiers": {}
|
|
3520
|
-
}),
|
|
3521
|
-
emits: ["update:modelValue"],
|
|
3522
|
-
setup(__props, { expose: __expose }) {
|
|
3523
|
-
const props = __props;
|
|
3524
|
-
const modelValue = vue.useModel(__props, "modelValue");
|
|
3525
|
-
const inputValue = vue.ref("");
|
|
3526
|
-
const inputRef = vue.ref(null);
|
|
3527
|
-
const canAddMore = vue.computed(() => {
|
|
3528
|
-
if (props.max !== void 0) return modelValue.value.length < props.max;
|
|
3529
|
-
return true;
|
|
3530
|
-
});
|
|
3531
|
-
const sizeClasses = vue.computed(() => ({
|
|
3532
|
-
wrapper: {
|
|
3533
|
-
sm: "min-h-9 py-1.5 px-2 gap-1",
|
|
3534
|
-
md: "min-h-11 py-2 px-3 gap-1.5",
|
|
3535
|
-
lg: "min-h-13 py-2.5 px-4 gap-2"
|
|
3536
|
-
}[props.size],
|
|
3537
|
-
tag: {
|
|
3538
|
-
sm: "text-xs px-2 py-0.5",
|
|
3539
|
-
md: "text-sm px-2.5 py-1",
|
|
3540
|
-
lg: "text-base px-3 py-1.5"
|
|
3541
|
-
}[props.size],
|
|
3542
|
-
input: {
|
|
3543
|
-
sm: "text-xs",
|
|
3544
|
-
md: "text-sm",
|
|
3545
|
-
lg: "text-base"
|
|
3546
|
-
}[props.size],
|
|
3547
|
-
icon: {
|
|
3548
|
-
sm: "size-3",
|
|
3549
|
-
md: "size-3.5",
|
|
3550
|
-
lg: "size-4"
|
|
3551
|
-
}[props.size]
|
|
3552
|
-
}));
|
|
3553
|
-
function addTag(value) {
|
|
3554
|
-
const trimmed = value.trim();
|
|
3555
|
-
if (!trimmed) return;
|
|
3556
|
-
if (!canAddMore.value) return;
|
|
3557
|
-
if (!props.allowDuplicates && modelValue.value.includes(trimmed)) return;
|
|
3558
|
-
modelValue.value = [...modelValue.value, trimmed];
|
|
3559
|
-
inputValue.value = "";
|
|
3560
|
-
}
|
|
3561
|
-
function removeTag(index2) {
|
|
3562
|
-
if (props.disabled) return;
|
|
3563
|
-
modelValue.value = modelValue.value.filter((_, i) => i !== index2);
|
|
3564
|
-
}
|
|
3565
|
-
function handleKeydown(event) {
|
|
3566
|
-
if (event.key === "Enter" || event.key === ",") {
|
|
3567
|
-
event.preventDefault();
|
|
3568
|
-
addTag(inputValue.value);
|
|
3569
|
-
} else if (event.key === "Backspace" && !inputValue.value && modelValue.value.length > 0) {
|
|
3570
|
-
removeTag(modelValue.value.length - 1);
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
function handleBlur() {
|
|
3574
|
-
if (inputValue.value) {
|
|
3575
|
-
addTag(inputValue.value);
|
|
3576
|
-
}
|
|
3577
|
-
}
|
|
3578
|
-
function focusInput() {
|
|
3579
|
-
var _a;
|
|
3580
|
-
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
3581
|
-
}
|
|
3582
|
-
__expose({ focus: focusInput });
|
|
3583
|
-
return (_ctx, _cache) => {
|
|
3584
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3585
|
-
class: vue.normalizeClass([
|
|
3586
|
-
"flex flex-wrap items-center rounded-xl border transition-all cursor-text",
|
|
3587
|
-
"bg-gray-50 dark:bg-slate-700",
|
|
3588
|
-
"border-gray-200 dark:border-slate-600",
|
|
3589
|
-
"focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500 focus-within:bg-white dark:focus-within:bg-slate-600",
|
|
3590
|
-
__props.disabled && "opacity-50 cursor-not-allowed",
|
|
3591
|
-
sizeClasses.value.wrapper
|
|
3592
|
-
]),
|
|
3593
|
-
onClick: focusInput
|
|
3594
|
-
}, [
|
|
3595
|
-
vue.createVNode(vue.TransitionGroup, {
|
|
3596
|
-
name: "tag",
|
|
3597
|
-
tag: "div",
|
|
3598
|
-
class: "flex flex-wrap gap-1.5"
|
|
3599
|
-
}, {
|
|
3600
|
-
default: vue.withCtx(() => [
|
|
3601
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modelValue.value, (tag, index2) => {
|
|
3602
|
-
return vue.openBlock(), vue.createElementBlock("span", {
|
|
3603
|
-
key: tag + index2,
|
|
3604
|
-
class: vue.normalizeClass([
|
|
3605
|
-
"inline-flex items-center gap-1 rounded-lg font-medium",
|
|
3606
|
-
"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300",
|
|
3607
|
-
sizeClasses.value.tag
|
|
3608
|
-
])
|
|
3609
|
-
}, [
|
|
3610
|
-
vue.createTextVNode(vue.toDisplayString(tag) + " ", 1),
|
|
3611
|
-
!__props.disabled ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
3612
|
-
key: 0,
|
|
3613
|
-
type: "button",
|
|
3614
|
-
class: "rounded-full hover:bg-primary-200 dark:hover:bg-primary-800/50 transition-colors p-0.5",
|
|
3615
|
-
onClick: vue.withModifiers(($event) => removeTag(index2), ["stop"])
|
|
3616
|
-
}, [
|
|
3617
|
-
vue.createVNode(vue.unref(vue$1.Icon), {
|
|
3618
|
-
icon: "lucide:x",
|
|
3619
|
-
class: vue.normalizeClass(["text-primary-500", sizeClasses.value.icon])
|
|
3620
|
-
}, null, 8, ["class"])
|
|
3621
|
-
], 8, _hoisted_1)) : vue.createCommentVNode("", true)
|
|
3622
|
-
], 2);
|
|
3623
|
-
}), 128))
|
|
3624
|
-
]),
|
|
3625
|
-
_: 1
|
|
3626
|
-
}),
|
|
3627
|
-
canAddMore.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", vue.mergeProps({
|
|
3628
|
-
key: 0,
|
|
3629
|
-
id: __props.id ?? __props.name,
|
|
3630
|
-
ref_key: "inputRef",
|
|
3631
|
-
ref: inputRef,
|
|
3632
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
3633
|
-
type: "text",
|
|
3634
|
-
name: __props.name,
|
|
3635
|
-
placeholder: modelValue.value.length === 0 ? __props.placeholder : "",
|
|
3636
|
-
disabled: __props.disabled,
|
|
3637
|
-
required: __props.required && modelValue.value.length === 0,
|
|
3638
|
-
class: [
|
|
3639
|
-
"flex-1 min-w-20 bg-transparent border-none focus:outline-none",
|
|
3640
|
-
"text-gray-900 dark:text-white placeholder-gray-400",
|
|
3641
|
-
sizeClasses.value.input
|
|
3642
|
-
]
|
|
3643
|
-
}, _ctx.$attrs, {
|
|
3644
|
-
onKeydown: handleKeydown,
|
|
3645
|
-
onBlur: handleBlur
|
|
3646
|
-
}), null, 16, _hoisted_2)), [
|
|
3647
|
-
[vue.vModelText, inputValue.value]
|
|
3648
|
-
]) : vue.createCommentVNode("", true)
|
|
3649
|
-
], 2);
|
|
3650
|
-
};
|
|
3651
|
-
}
|
|
3652
|
-
});
|
|
3653
|
-
const TagsInput = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-fcace07c"]]);
|
|
3654
|
-
exports.Slider = Slider;
|
|
3655
|
-
exports.TagsInput = TagsInput;
|
|
3656
|
-
exports._sfc_main = _sfc_main$r;
|
|
3657
|
-
exports._sfc_main$1 = _sfc_main$q;
|
|
3658
|
-
exports._sfc_main$10 = _sfc_main$f;
|
|
3659
|
-
exports._sfc_main$11 = _sfc_main$e;
|
|
3660
|
-
exports._sfc_main$12 = _sfc_main$d;
|
|
3661
|
-
exports._sfc_main$13 = _sfc_main$c;
|
|
3662
|
-
exports._sfc_main$14 = _sfc_main$b;
|
|
3663
|
-
exports._sfc_main$15 = _sfc_main$a;
|
|
3664
|
-
exports._sfc_main$16 = _sfc_main$p;
|
|
3665
|
-
exports._sfc_main$17 = _sfc_main$9;
|
|
3666
|
-
exports._sfc_main$18 = _sfc_main$8;
|
|
3667
|
-
exports._sfc_main$19 = _sfc_main$7;
|
|
3668
|
-
exports._sfc_main$2 = _sfc_main$o;
|
|
3669
|
-
exports._sfc_main$20 = _sfc_main$6;
|
|
3670
|
-
exports._sfc_main$21 = _sfc_main$5;
|
|
3671
|
-
exports._sfc_main$22 = _sfc_main$4;
|
|
3672
|
-
exports._sfc_main$23 = _sfc_main$3;
|
|
3673
|
-
exports._sfc_main$24 = _sfc_main$2;
|
|
3674
|
-
exports._sfc_main$25 = _sfc_main$1;
|
|
3675
|
-
exports._sfc_main$3 = _sfc_main$n;
|
|
3676
|
-
exports._sfc_main$4 = _sfc_main$m;
|
|
3677
|
-
exports._sfc_main$5 = _sfc_main$l;
|
|
3678
|
-
exports._sfc_main$6 = _sfc_main$k;
|
|
3679
|
-
exports._sfc_main$7 = _sfc_main$i;
|
|
3680
|
-
exports._sfc_main$8 = _sfc_main$h;
|
|
3681
|
-
exports._sfc_main$9 = _sfc_main$g;
|
|
3682
|
-
//# sourceMappingURL=TagsInput-BF3zRMcU.cjs.map
|