@antify/ui-module 1.1.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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +131 -0
- package/dist/module.d.ts +131 -0
- package/dist/module.json +5 -0
- package/dist/module.mjs +339 -0
- package/dist/runtime/assets/tailwind.css +1 -0
- package/dist/runtime/components/AntAccordion.vue +59 -0
- package/dist/runtime/components/AntAccordionItem.vue +66 -0
- package/dist/runtime/components/AntAlert.vue +137 -0
- package/dist/runtime/components/AntDropdown.vue +79 -0
- package/dist/runtime/components/AntIcon.vue +51 -0
- package/dist/runtime/components/AntKeycap.vue +24 -0
- package/dist/runtime/components/AntListGroup.vue +24 -0
- package/dist/runtime/components/AntListGroupItem.vue +81 -0
- package/dist/runtime/components/AntModal.vue +87 -0
- package/dist/runtime/components/AntPagination.vue +201 -0
- package/dist/runtime/components/AntPopover.vue +112 -0
- package/dist/runtime/components/AntSkeleton.vue +38 -0
- package/dist/runtime/components/AntSpinner.vue +95 -0
- package/dist/runtime/components/AntTag.vue +79 -0
- package/dist/runtime/components/AntToast.vue +109 -0
- package/dist/runtime/components/AntToaster.vue +46 -0
- package/dist/runtime/components/AntTooltip.vue +165 -0
- package/dist/runtime/components/Main.stories.mdx +10 -0
- package/dist/runtime/components/__stories/AntAccordion.stories.d.ts +9 -0
- package/dist/runtime/components/__stories/AntAccordion.stories.mjs +97 -0
- package/dist/runtime/components/__stories/AntAlert.stories.d.ts +10 -0
- package/dist/runtime/components/__stories/AntAlert.stories.mjs +75 -0
- package/dist/runtime/components/__stories/AntDropdown.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntDropdown.stories.mjs +52 -0
- package/dist/runtime/components/__stories/AntIcon.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntIcon.stories.mjs +90 -0
- package/dist/runtime/components/__stories/AntKeycap.stories.d.ts +9 -0
- package/dist/runtime/components/__stories/AntKeycap.stories.mjs +59 -0
- package/dist/runtime/components/__stories/AntListGroup.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntListGroup.stories.mjs +36 -0
- package/dist/runtime/components/__stories/AntListGroupItem.stories.d.ts +10 -0
- package/dist/runtime/components/__stories/AntListGroupItem.stories.mjs +62 -0
- package/dist/runtime/components/__stories/AntModal.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntModal.stories.mjs +78 -0
- package/dist/runtime/components/__stories/AntPagination.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntPagination.stories.mjs +39 -0
- package/dist/runtime/components/__stories/AntPopover.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntPopover.stories.mjs +47 -0
- package/dist/runtime/components/__stories/AntSkeleton.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntSkeleton.stories.mjs +43 -0
- package/dist/runtime/components/__stories/AntSpinner.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntSpinner.stories.mjs +34 -0
- package/dist/runtime/components/__stories/AntTag.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntTag.stories.mjs +44 -0
- package/dist/runtime/components/__stories/AntToast.stories.d.ts +8 -0
- package/dist/runtime/components/__stories/AntToast.stories.mjs +66 -0
- package/dist/runtime/components/__stories/AntToaster.stories.d.ts +34 -0
- package/dist/runtime/components/__stories/AntToaster.stories.mjs +42 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +6 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.mjs +43 -0
- package/dist/runtime/components/__types/Accordion.types.d.ts +4 -0
- package/dist/runtime/components/__types/Accordion.types.mjs +5 -0
- package/dist/runtime/components/__types/AntIcon.types.d.ts +5 -0
- package/dist/runtime/components/__types/AntIcon.types.mjs +6 -0
- package/dist/runtime/components/__types/AntToaster.types.d.ts +8 -0
- package/dist/runtime/components/__types/AntToaster.types.mjs +0 -0
- package/dist/runtime/components/__types/index.d.ts +2 -0
- package/dist/runtime/components/__types/index.mjs +2 -0
- package/dist/runtime/components/buttons/AntButton.vue +227 -0
- package/dist/runtime/components/buttons/AntCreateButton.vue +32 -0
- package/dist/runtime/components/buttons/AntDeleteButton.vue +32 -0
- package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +32 -0
- package/dist/runtime/components/buttons/AntSaveButton.vue +31 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.d.ts +15 -0
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +272 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.d.ts +10 -0
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +57 -0
- package/dist/runtime/components/buttons/__types/AntButton.type.d.ts +4 -0
- package/dist/runtime/components/buttons/__types/AntButton.type.mjs +5 -0
- package/dist/runtime/components/buttons/__types/index.d.ts +1 -0
- package/dist/runtime/components/buttons/__types/index.mjs +1 -0
- package/dist/runtime/components/crud/AntCrud.vue +42 -0
- package/dist/runtime/components/crud/AntCrudDetail.vue +11 -0
- package/dist/runtime/components/crud/AntCrudDetailActions.vue +51 -0
- package/dist/runtime/components/crud/AntCrudDetailNav.vue +51 -0
- package/dist/runtime/components/crud/AntCrudTableFilter.vue +120 -0
- package/dist/runtime/components/crud/AntCrudTableNav.vue +129 -0
- package/dist/runtime/components/crud/__stories/AntCrud.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrud.stories.mjs +126 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetail.stories.d.ts +7 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetail.stories.mjs +80 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailActions.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailActions.stories.mjs +25 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailNav.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudDetailNav.stories.mjs +41 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableFilter.stories.d.ts +6 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableFilter.stories.mjs +25 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableNav.stories.d.ts +8 -0
- package/dist/runtime/components/crud/__stories/AntCrudTableNav.stories.mjs +56 -0
- package/dist/runtime/components/dialogs/AntDeleteDialog.vue +29 -0
- package/dist/runtime/components/dialogs/AntDialog.vue +147 -0
- package/dist/runtime/components/dialogs/__stories/AndDeleteDialog.stories.d.ts +6 -0
- package/dist/runtime/components/dialogs/__stories/AndDeleteDialog.stories.mjs +30 -0
- package/dist/runtime/components/dialogs/__stories/AntDialog.stories.d.ts +6 -0
- package/dist/runtime/components/dialogs/__stories/AntDialog.stories.mjs +60 -0
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +145 -0
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +91 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.mjs +286 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckboxGroup.stories.d.ts +7 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckboxGroup.stories.mjs +96 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__types/AntCheckbox.d.ts +6 -0
- package/dist/runtime/components/form/AntCheckboxWidget/__types/AntCheckbox.mjs +0 -0
- package/dist/runtime/components/form/AntFormGroup.vue +21 -0
- package/dist/runtime/components/form/AntFormGroupLabel.vue +5 -0
- package/dist/runtime/components/form/AntNumberInput.vue +170 -0
- package/dist/runtime/components/form/AntRadioWidget/AntRadio.vue +139 -0
- package/dist/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +80 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.mjs +79 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadioGroup.stories.d.ts +8 -0
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadioGroup.stories.mjs +125 -0
- package/dist/runtime/components/form/AntRadioWidget/__types/AntRadio.type.d.ts +9 -0
- package/dist/runtime/components/form/AntRadioWidget/__types/AntRadio.type.mjs +0 -0
- package/dist/runtime/components/form/AntRangeSlider.vue +81 -0
- package/dist/runtime/components/form/AntRichTextEditor.vue +237 -0
- package/dist/runtime/components/form/AntSearch.vue +76 -0
- package/dist/runtime/components/form/AntSelect.vue +346 -0
- package/dist/runtime/components/form/AntSwitch.vue +145 -0
- package/dist/runtime/components/form/AntSwitcher.vue +184 -0
- package/dist/runtime/components/form/AntTextInput.vue +73 -0
- package/dist/runtime/components/form/AntTextarea.vue +170 -0
- package/dist/runtime/components/form/AntUnitInput.vue +99 -0
- package/dist/runtime/components/form/Elements/AntBaseInput.vue +216 -0
- package/dist/runtime/components/form/Elements/AntDropDown.vue +160 -0
- package/dist/runtime/components/form/Elements/AntField.vue +102 -0
- package/dist/runtime/components/form/Elements/AntInputDescription.vue +55 -0
- package/dist/runtime/components/form/Elements/AntInputLabel.vue +55 -0
- package/dist/runtime/components/form/Elements/AntInputLimiter.vue +55 -0
- package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.d.ts +9 -0
- package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.mjs +168 -0
- package/dist/runtime/components/form/Elements/__stories/AntField.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntField.stories.mjs +80 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputDescription.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputDescription.stories.mjs +34 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLabel.stories.d.ts +7 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLabel.stories.mjs +46 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLimiter.stories.d.ts +6 -0
- package/dist/runtime/components/form/Elements/__stories/AntInputLimiter.stories.mjs +37 -0
- package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.d.ts +16 -0
- package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.mjs +17 -0
- package/dist/runtime/components/form/Elements/__types/index.d.ts +1 -0
- package/dist/runtime/components/form/Elements/__types/index.mjs +1 -0
- package/dist/runtime/components/form/Elements/index.d.ts +6 -0
- package/dist/runtime/components/form/Elements/index.mjs +12 -0
- package/dist/runtime/components/form/__stories/AntFormGroup.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntFormGroup.stories.mjs +33 -0
- package/dist/runtime/components/form/__stories/AntFormGroupLabel.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntFormGroupLabel.stories.mjs +20 -0
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.d.ts +7 -0
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.mjs +67 -0
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.mjs +40 -0
- package/dist/runtime/components/form/__stories/AntRichTextEditor.stories-old.d.ts +0 -0
- package/dist/runtime/components/form/__stories/AntRichTextEditor.stories-old.mjs +0 -0
- package/dist/runtime/components/form/__stories/AntSearch.stories.d.ts +6 -0
- package/dist/runtime/components/form/__stories/AntSearch.stories.mjs +43 -0
- package/dist/runtime/components/form/__stories/AntSelect.stories.d.ts +13 -0
- package/dist/runtime/components/form/__stories/AntSelect.stories.mjs +220 -0
- package/dist/runtime/components/form/__stories/AntSwitch.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntSwitch.stories.mjs +215 -0
- package/dist/runtime/components/form/__stories/AntSwitcher.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntSwitcher.stories.mjs +225 -0
- package/dist/runtime/components/form/__stories/AntTextInput.stories.d.ts +7 -0
- package/dist/runtime/components/form/__stories/AntTextInput.stories.mjs +68 -0
- package/dist/runtime/components/form/__stories/AntTextarea.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntTextarea.stories.mjs +128 -0
- package/dist/runtime/components/form/__stories/AntUnitInput.stories.d.ts +8 -0
- package/dist/runtime/components/form/__stories/AntUnitInput.stories.mjs +84 -0
- package/dist/runtime/components/form/__types/AntSelect.type.d.ts +4 -0
- package/dist/runtime/components/form/__types/AntSelect.type.mjs +0 -0
- package/dist/runtime/components/form/__types/AntSwitcher.type.d.ts +4 -0
- package/dist/runtime/components/form/__types/AntSwitcher.type.mjs +0 -0
- package/dist/runtime/components/form/__types/AntTextInput.type.d.ts +7 -0
- package/dist/runtime/components/form/__types/AntTextInput.type.mjs +8 -0
- package/dist/runtime/components/form/__types/index.d.ts +3 -0
- package/dist/runtime/components/form/__types/index.mjs +3 -0
- package/dist/runtime/components/form/index.d.ts +11 -0
- package/dist/runtime/components/form/index.mjs +22 -0
- package/dist/runtime/components/index.d.ts +22 -0
- package/dist/runtime/components/index.mjs +41 -0
- package/dist/runtime/components/layouts/AntNavLeftLayout.vue +36 -0
- package/dist/runtime/components/layouts/__stories/AntNavLeftLayout.stories.d.ts +7 -0
- package/dist/runtime/components/layouts/__stories/AntNavLeftLayout.stories.mjs +68 -0
- package/dist/runtime/components/navbar/AntNavbar.vue +25 -0
- package/dist/runtime/components/navbar/AntNavbarItem.vue +78 -0
- package/dist/runtime/components/navbar/__stories/AntNavbar.stories.d.ts +6 -0
- package/dist/runtime/components/navbar/__stories/AntNavbar.stories.mjs +66 -0
- package/dist/runtime/components/navbar/__types/NavbarItem.d.ts +10 -0
- package/dist/runtime/components/navbar/__types/NavbarItem.mjs +0 -0
- package/dist/runtime/components/table/AntTable.vue +192 -0
- package/dist/runtime/components/table/AntTableSortButton.vue +26 -0
- package/dist/runtime/components/table/AntTd.vue +70 -0
- package/dist/runtime/components/table/AntTh.vue +67 -0
- package/dist/runtime/components/table/__stories/AntTable.stories.d.ts +9 -0
- package/dist/runtime/components/table/__stories/AntTable.stories.mjs +274 -0
- package/dist/runtime/components/table/__types/TableHeader.type.d.ts +31 -0
- package/dist/runtime/components/table/__types/TableHeader.type.mjs +19 -0
- package/dist/runtime/components/tabs/AntTabItem.vue +115 -0
- package/dist/runtime/components/tabs/AntTabs.vue +47 -0
- package/dist/runtime/components/tabs/__stories/AntTabItem.stories.d.ts +6 -0
- package/dist/runtime/components/tabs/__stories/AntTabItem.stories.mjs +32 -0
- package/dist/runtime/components/tabs/__stories/AntTabs.stories.d.ts +9 -0
- package/dist/runtime/components/tabs/__stories/AntTabs.stories.mjs +173 -0
- package/dist/runtime/components/tabs/__types/AntTabItem.types.d.ts +17 -0
- package/dist/runtime/components/tabs/__types/AntTabItem.types.mjs +6 -0
- package/dist/runtime/components/transitions/AntTransitionCollapseHeight.vue +92 -0
- package/dist/runtime/composables/useUi.d.ts +20 -0
- package/dist/runtime/composables/useUi.mjs +31 -0
- package/dist/runtime/composables/useUiClient.d.ts +34 -0
- package/dist/runtime/composables/useUiClient.mjs +61 -0
- package/dist/runtime/composables/useValidator.d.ts +1 -0
- package/dist/runtime/composables/useValidator.mjs +1 -0
- package/dist/runtime/enums/ColorType.enum.d.ts +16 -0
- package/dist/runtime/enums/ColorType.enum.mjs +18 -0
- package/dist/runtime/enums/Direction.enum.d.ts +4 -0
- package/dist/runtime/enums/Direction.enum.mjs +5 -0
- package/dist/runtime/enums/Grouped.enum.d.ts +6 -0
- package/dist/runtime/enums/Grouped.enum.mjs +7 -0
- package/dist/runtime/enums/Position.enum.d.ts +12 -0
- package/dist/runtime/enums/Position.enum.mjs +14 -0
- package/dist/runtime/enums/Size.enum.d.ts +4 -0
- package/dist/runtime/enums/Size.enum.mjs +5 -0
- package/dist/runtime/enums/index.d.ts +4 -0
- package/dist/runtime/enums/index.mjs +4 -0
- package/dist/runtime/env.d.ts +8 -0
- package/dist/runtime/handler.d.ts +1 -0
- package/dist/runtime/handler.mjs +5 -0
- package/dist/runtime/plugins/toaster.d.ts +22 -0
- package/dist/runtime/plugins/toaster.mjs +53 -0
- package/dist/runtime/plugins/ui-module.d.ts +2 -0
- package/dist/runtime/plugins/ui-module.mjs +13 -0
- package/dist/runtime/shims/vue.d.ts +5 -0
- package/dist/runtime/tailwind.config.d.ts +182 -0
- package/dist/runtime/tailwind.config.mjs +196 -0
- package/dist/runtime/types/AntListGroupItem.type.d.ts +11 -0
- package/dist/runtime/types/AntListGroupItem.type.mjs +12 -0
- package/dist/runtime/types/AntTag.type.d.ts +8 -0
- package/dist/runtime/types/AntTag.type.mjs +9 -0
- package/dist/runtime/types/Checkbox.type.d.ts +8 -0
- package/dist/runtime/types/Checkbox.type.mjs +0 -0
- package/dist/runtime/types/NavItem.type.d.ts +9 -0
- package/dist/runtime/types/NavItem.type.mjs +0 -0
- package/dist/runtime/types/RadioButton.type.d.ts +5 -0
- package/dist/runtime/types/RadioButton.type.mjs +0 -0
- package/dist/runtime/types/Tabs.type.d.ts +6 -0
- package/dist/runtime/types/Tabs.type.mjs +0 -0
- package/dist/runtime/types/Toaster.type.d.ts +6 -0
- package/dist/runtime/types/Toaster.type.mjs +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.mjs +7 -0
- package/dist/runtime/types.d.ts +7 -0
- package/dist/runtime/types.mjs +7 -0
- package/dist/runtime/utils/helper.d.ts +4 -0
- package/dist/runtime/utils/helper.mjs +12 -0
- package/dist/runtime/utils.d.ts +14 -0
- package/dist/runtime/utils.mjs +20 -0
- package/dist/types.d.mts +8 -0
- package/dist/types.d.ts +8 -0
- package/package.json +81 -0
- package/src/runtime/components/AntAccordion.vue +59 -0
- package/src/runtime/components/AntAccordionItem.vue +104 -0
- package/src/runtime/components/AntAlert.vue +137 -0
- package/src/runtime/components/AntDropdown.vue +100 -0
- package/src/runtime/components/AntIcon.vue +51 -0
- package/src/runtime/components/AntKeycap.vue +24 -0
- package/src/runtime/components/AntListGroup.vue +24 -0
- package/src/runtime/components/AntListGroupItem.vue +81 -0
- package/src/runtime/components/AntModal.vue +129 -0
- package/src/runtime/components/AntPagination.vue +201 -0
- package/src/runtime/components/AntPopover.vue +133 -0
- package/src/runtime/components/AntSkeleton.vue +38 -0
- package/src/runtime/components/AntSpinner.vue +95 -0
- package/src/runtime/components/AntTag.vue +79 -0
- package/src/runtime/components/AntToast.vue +109 -0
- package/src/runtime/components/AntToaster.vue +71 -0
- package/src/runtime/components/AntTooltip.vue +165 -0
- package/src/runtime/components/buttons/AntButton.vue +227 -0
- package/src/runtime/components/buttons/AntCreateButton.vue +32 -0
- package/src/runtime/components/buttons/AntDeleteButton.vue +32 -0
- package/src/runtime/components/buttons/AntSaveAndNewButton.vue +32 -0
- package/src/runtime/components/buttons/AntSaveButton.vue +31 -0
- package/src/runtime/components/crud/AntCrud.vue +66 -0
- package/src/runtime/components/crud/AntCrudDetail.vue +11 -0
- package/src/runtime/components/crud/AntCrudDetailActions.vue +51 -0
- package/src/runtime/components/crud/AntCrudDetailNav.vue +51 -0
- package/src/runtime/components/crud/AntCrudTableFilter.vue +120 -0
- package/src/runtime/components/crud/AntCrudTableNav.vue +129 -0
- package/src/runtime/components/dialogs/AntDeleteDialog.vue +29 -0
- package/src/runtime/components/dialogs/AntDialog.vue +181 -0
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +167 -0
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +91 -0
- package/src/runtime/components/form/AntFormGroup.vue +21 -0
- package/src/runtime/components/form/AntFormGroupLabel.vue +5 -0
- package/src/runtime/components/form/AntNumberInput.vue +170 -0
- package/src/runtime/components/form/AntRadioWidget/AntRadio.vue +164 -0
- package/src/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +80 -0
- package/src/runtime/components/form/AntRangeSlider.vue +101 -0
- package/src/runtime/components/form/AntRichTextEditor.vue +237 -0
- package/src/runtime/components/form/AntSearch.vue +76 -0
- package/src/runtime/components/form/AntSelect.vue +346 -0
- package/src/runtime/components/form/AntSwitch.vue +145 -0
- package/src/runtime/components/form/AntSwitcher.vue +200 -0
- package/src/runtime/components/form/AntTextInput.vue +73 -0
- package/src/runtime/components/form/AntTextarea.vue +170 -0
- package/src/runtime/components/form/AntUnitInput.vue +99 -0
- package/src/runtime/components/form/Elements/AntBaseInput.vue +247 -0
- package/src/runtime/components/form/Elements/AntDropDown.vue +160 -0
- package/src/runtime/components/form/Elements/AntField.vue +102 -0
- package/src/runtime/components/form/Elements/AntInputDescription.vue +55 -0
- package/src/runtime/components/form/Elements/AntInputLabel.vue +55 -0
- package/src/runtime/components/form/Elements/AntInputLimiter.vue +55 -0
- package/src/runtime/components/layouts/AntNavLeftLayout.vue +36 -0
- package/src/runtime/components/navbar/AntNavbar.vue +25 -0
- package/src/runtime/components/navbar/AntNavbarItem.vue +78 -0
- package/src/runtime/components/table/AntTable.vue +192 -0
- package/src/runtime/components/table/AntTableSortButton.vue +26 -0
- package/src/runtime/components/table/AntTd.vue +70 -0
- package/src/runtime/components/table/AntTh.vue +67 -0
- package/src/runtime/components/tabs/AntTabItem.vue +115 -0
- package/src/runtime/components/tabs/AntTabs.vue +47 -0
- package/src/runtime/components/transitions/AntTransitionCollapseHeight.vue +96 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<template></template>
|
|
2
|
+
|
|
3
|
+
<!--<script lang="ts" setup>-->
|
|
4
|
+
<!--defineOptions({ inheritAttrs: false });-->
|
|
5
|
+
<!--// TODO:: fix ts errors-->
|
|
6
|
+
<!--// @ts-nocheck-->
|
|
7
|
+
<!--import {ref, computed, onUnmounted, watch} from 'vue';-->
|
|
8
|
+
<!--import {useEditor, EditorContent} from '@tiptap/vue-3';-->
|
|
9
|
+
<!--import StarterKit from '@tiptap/starter-kit';-->
|
|
10
|
+
<!--import Underline from '@tiptap/extension-underline';-->
|
|
11
|
+
<!--import Heading from '@tiptap/extension-heading';-->
|
|
12
|
+
<!--import AntButton from './AntButton.vue';-->
|
|
13
|
+
<!--import AntSkeleton from '../AntSkeleton.vue';-->
|
|
14
|
+
<!--import {generateId} from '../../utils/helper';-->
|
|
15
|
+
|
|
16
|
+
<!--const emit = defineEmits(['update:data']);-->
|
|
17
|
+
|
|
18
|
+
<!--const props =-->
|
|
19
|
+
<!-- defineProps<{-->
|
|
20
|
+
<!-- id?: string;-->
|
|
21
|
+
<!-- data?: string;-->
|
|
22
|
+
<!-- label?: string;-->
|
|
23
|
+
<!-- description?: string;-->
|
|
24
|
+
<!-- validator?: Function;-->
|
|
25
|
+
<!-- errors?: string[];-->
|
|
26
|
+
<!-- isError?: boolean;-->
|
|
27
|
+
<!-- loading?: boolean;-->
|
|
28
|
+
<!-- disabled?: boolean;-->
|
|
29
|
+
<!-- }>();-->
|
|
30
|
+
|
|
31
|
+
<!--const _data = computed({-->
|
|
32
|
+
<!-- get: () => {-->
|
|
33
|
+
<!-- return props.data || '';-->
|
|
34
|
+
<!-- },-->
|
|
35
|
+
<!-- set: (val) => {-->
|
|
36
|
+
<!-- emit('update:data', val);-->
|
|
37
|
+
<!-- },-->
|
|
38
|
+
<!--});-->
|
|
39
|
+
|
|
40
|
+
<!--const _id = ref(props.id || generateId(40));-->
|
|
41
|
+
<!--const editor = ref(-->
|
|
42
|
+
<!-- useEditor({-->
|
|
43
|
+
<!-- content: _data.value,-->
|
|
44
|
+
<!-- extensions: [-->
|
|
45
|
+
<!-- StarterKit,-->
|
|
46
|
+
<!-- Underline,-->
|
|
47
|
+
<!-- Heading.configure({-->
|
|
48
|
+
<!-- levels: [1, 2, 3],-->
|
|
49
|
+
<!-- }),-->
|
|
50
|
+
<!-- ],-->
|
|
51
|
+
<!-- onUpdate: ({editor}) => {-->
|
|
52
|
+
<!-- const state = editor.getHTML();-->
|
|
53
|
+
<!-- _data.value = state;-->
|
|
54
|
+
|
|
55
|
+
<!-- if (props.validator && typeof props.validator === 'function') {-->
|
|
56
|
+
<!-- props.validator(_data.value);-->
|
|
57
|
+
<!-- }-->
|
|
58
|
+
<!-- },-->
|
|
59
|
+
<!-- editable: !props.disabled,-->
|
|
60
|
+
<!-- })-->
|
|
61
|
+
<!--);-->
|
|
62
|
+
|
|
63
|
+
<!--watch(-->
|
|
64
|
+
<!-- () => props.disabled,-->
|
|
65
|
+
<!-- () => {-->
|
|
66
|
+
<!-- editor.value?.setOptions({editable: !props.disabled});-->
|
|
67
|
+
<!-- }-->
|
|
68
|
+
<!--);-->
|
|
69
|
+
|
|
70
|
+
<!--onUnmounted(() => editor?.value?.destroy());-->
|
|
71
|
+
<!--</script>-->
|
|
72
|
+
|
|
73
|
+
<!--<template>-->
|
|
74
|
+
<!-- <div v-if="!loading">-->
|
|
75
|
+
<!-- <slot>-->
|
|
76
|
+
<!-- <label-->
|
|
77
|
+
<!-- v-if="label"-->
|
|
78
|
+
<!-- :for="_id"-->
|
|
79
|
+
<!-- class="block text-sm font-medium text-gray-700"-->
|
|
80
|
+
<!-- >-->
|
|
81
|
+
<!-- {{ label }}-->
|
|
82
|
+
<!-- </label>-->
|
|
83
|
+
<!-- </slot>-->
|
|
84
|
+
|
|
85
|
+
<!-- <div-->
|
|
86
|
+
<!-- v-if="editor"-->
|
|
87
|
+
<!-- class="border border-gray-200 rounded-md overflow-hidden p-2 bg-gray-50"-->
|
|
88
|
+
<!-- >-->
|
|
89
|
+
<!-- <slot name="buttons" v-bind="editor">-->
|
|
90
|
+
<!-- <div class="space-x-1 mb-2 flex">-->
|
|
91
|
+
<!-- <slot name="headers-buttons" v-bind="editor">-->
|
|
92
|
+
<!-- <AntButton-->
|
|
93
|
+
<!-- @click="-->
|
|
94
|
+
<!-- editor-->
|
|
95
|
+
<!-- ? editor.chain().focus().toggleHeading({ level: 1 }).run()-->
|
|
96
|
+
<!-- : false-->
|
|
97
|
+
<!-- "-->
|
|
98
|
+
<!-- :class="{-->
|
|
99
|
+
<!-- '!bg-gray-200': editor.isActive('heading', { level: 1 }),-->
|
|
100
|
+
<!-- }"-->
|
|
101
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
102
|
+
<!-- :disabled="disabled"-->
|
|
103
|
+
<!-- >-->
|
|
104
|
+
<!-- <span>H1</span>-->
|
|
105
|
+
<!-- </AntButton>-->
|
|
106
|
+
|
|
107
|
+
<!-- <AntButton-->
|
|
108
|
+
<!-- @click="-->
|
|
109
|
+
<!-- editor-->
|
|
110
|
+
<!-- ? editor.chain().focus().toggleHeading({ level: 2 }).run()-->
|
|
111
|
+
<!-- : false-->
|
|
112
|
+
<!-- "-->
|
|
113
|
+
<!-- :class="{-->
|
|
114
|
+
<!-- '!bg-gray-200': editor.isActive('heading', { level: 2 }),-->
|
|
115
|
+
<!-- }"-->
|
|
116
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
117
|
+
<!-- :disabled="disabled"-->
|
|
118
|
+
<!-- >-->
|
|
119
|
+
<!-- <span class="">H2</span>-->
|
|
120
|
+
<!-- </AntButton>-->
|
|
121
|
+
|
|
122
|
+
<!-- <AntButton-->
|
|
123
|
+
<!-- @click="-->
|
|
124
|
+
<!-- editor-->
|
|
125
|
+
<!-- ? editor.chain().focus().toggleHeading({ level: 3 }).run()-->
|
|
126
|
+
<!-- : false-->
|
|
127
|
+
<!-- "-->
|
|
128
|
+
<!-- :class="{-->
|
|
129
|
+
<!-- '!bg-gray-200': editor.isActive('heading', { level: 3 }),-->
|
|
130
|
+
<!-- }"-->
|
|
131
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
132
|
+
<!-- :disabled="disabled"-->
|
|
133
|
+
<!-- >-->
|
|
134
|
+
<!-- <span class="">H3</span>-->
|
|
135
|
+
<!-- </AntButton>-->
|
|
136
|
+
<!-- </slot>-->
|
|
137
|
+
|
|
138
|
+
<!-- <slot name="bold-button" v-bind="editor">-->
|
|
139
|
+
<!-- <AntButton-->
|
|
140
|
+
<!-- @click="-->
|
|
141
|
+
<!-- editor ? editor.chain().focus().toggleBold().run() : false-->
|
|
142
|
+
<!-- "-->
|
|
143
|
+
<!-- :class="{ '!bg-gray-200': editor.isActive('bold') }"-->
|
|
144
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
145
|
+
<!-- :disabled="disabled"-->
|
|
146
|
+
<!-- >-->
|
|
147
|
+
<!-- <span class="font-bold">B</span>-->
|
|
148
|
+
<!-- </AntButton>-->
|
|
149
|
+
<!-- </slot>-->
|
|
150
|
+
|
|
151
|
+
<!-- <slot name="italic-button" v-bind="editor">-->
|
|
152
|
+
<!-- <AntButton-->
|
|
153
|
+
<!-- @click="-->
|
|
154
|
+
<!-- editor ? editor.chain().focus().toggleItalic().run() : false-->
|
|
155
|
+
<!-- "-->
|
|
156
|
+
<!-- :class="{ '!bg-gray-200': editor.isActive('italic') }"-->
|
|
157
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
158
|
+
<!-- :disabled="disabled"-->
|
|
159
|
+
<!-- >-->
|
|
160
|
+
<!-- <span class="italic">I</span>-->
|
|
161
|
+
<!-- </AntButton>-->
|
|
162
|
+
<!-- </slot>-->
|
|
163
|
+
|
|
164
|
+
<!-- <slot name="underline-button" v-bind="editor">-->
|
|
165
|
+
<!-- <AntButton-->
|
|
166
|
+
<!-- @click="-->
|
|
167
|
+
<!-- editor ? editor.chain().focus().toggleUnderline().run() : false-->
|
|
168
|
+
<!-- "-->
|
|
169
|
+
<!-- :class="{ '!bg-gray-200': editor.isActive('underline') }"-->
|
|
170
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
171
|
+
<!-- :disabled="disabled"-->
|
|
172
|
+
<!-- >-->
|
|
173
|
+
<!-- <span class="underline">U</span>-->
|
|
174
|
+
<!-- </AntButton>-->
|
|
175
|
+
<!-- </slot>-->
|
|
176
|
+
|
|
177
|
+
<!-- <slot name="strike-button" v-bind="editor">-->
|
|
178
|
+
<!-- <AntButton-->
|
|
179
|
+
<!-- @click="-->
|
|
180
|
+
<!-- editor ? editor.chain().focus().toggleStrike().run() : false-->
|
|
181
|
+
<!-- "-->
|
|
182
|
+
<!-- :class="{ '!bg-gray-200': editor.isActive('strike') }"-->
|
|
183
|
+
<!-- class="hover:bg-gray-200 border-none"-->
|
|
184
|
+
<!-- :disabled="disabled"-->
|
|
185
|
+
<!-- >-->
|
|
186
|
+
<!-- <span class="line-through">S</span>-->
|
|
187
|
+
<!-- </AntButton>-->
|
|
188
|
+
<!-- </slot>-->
|
|
189
|
+
|
|
190
|
+
<!-- <slot name="custom-buttons" v-bind="editor"></slot>-->
|
|
191
|
+
<!-- </div>-->
|
|
192
|
+
<!-- </slot>-->
|
|
193
|
+
|
|
194
|
+
<!-- <EditorContent-->
|
|
195
|
+
<!-- :id="_id"-->
|
|
196
|
+
<!-- :described-by="`${_id}-description`"-->
|
|
197
|
+
<!-- :editor="editor"-->
|
|
198
|
+
<!-- v-bind="$attrs"-->
|
|
199
|
+
<!-- :class="{-->
|
|
200
|
+
<!-- 'border-red-300 text-red-900 placeholder-red-300 focus:border-red-500':-->
|
|
201
|
+
<!-- (errors && errors.length > 0) || isError,-->
|
|
202
|
+
<!-- }"-->
|
|
203
|
+
<!-- />-->
|
|
204
|
+
|
|
205
|
+
<!-- <slot name="errorList" v-bind="{ errors }">-->
|
|
206
|
+
<!-- <div v-for="error in errors" class="text-red-600">{{ error }}</div>-->
|
|
207
|
+
<!-- </slot>-->
|
|
208
|
+
<!-- </div>-->
|
|
209
|
+
|
|
210
|
+
<!-- <div-->
|
|
211
|
+
<!-- v-if="description"-->
|
|
212
|
+
<!-- class="mt-1 text-sm text-gray-500"-->
|
|
213
|
+
<!-- :id="`${_id}-description`"-->
|
|
214
|
+
<!-- >-->
|
|
215
|
+
<!-- <slot name="description"> {{ description }}</slot>-->
|
|
216
|
+
<!-- </div>-->
|
|
217
|
+
<!-- </div>-->
|
|
218
|
+
|
|
219
|
+
<!-- <div v-else>-->
|
|
220
|
+
<!-- <AntSkeleton-->
|
|
221
|
+
<!-- :model-value="loading"-->
|
|
222
|
+
<!-- v-if="label || $slots['label']"-->
|
|
223
|
+
<!-- class="w-2/6 h-4 rounded-md mb-1"-->
|
|
224
|
+
<!-- />-->
|
|
225
|
+
|
|
226
|
+
<!-- <AntSkeleton-->
|
|
227
|
+
<!-- :model-value="loading"-->
|
|
228
|
+
<!-- class="w-full h-24 rounded-md"-->
|
|
229
|
+
<!-- />-->
|
|
230
|
+
|
|
231
|
+
<!-- <AntSkeleton-->
|
|
232
|
+
<!-- :model-value="loading"-->
|
|
233
|
+
<!-- v-if="description || $slots['description']"-->
|
|
234
|
+
<!-- class="w-4/6 h-4 rounded-md mt-1"-->
|
|
235
|
+
<!-- />-->
|
|
236
|
+
<!-- </div>-->
|
|
237
|
+
<!--</template>-->
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {computed, onMounted, ref} from 'vue';
|
|
3
|
+
import AntBaseInput from './Elements/AntBaseInput.vue'
|
|
4
|
+
import {Size} from '../../enums/Size.enum'
|
|
5
|
+
import {FieldValidator} from '@antify/validate'
|
|
6
|
+
import {handleEnumValidation} from '../../handler';
|
|
7
|
+
import {faSearch} from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import {BaseInputType} from './Elements/__types';
|
|
9
|
+
import AntField from './Elements/AntField.vue';
|
|
10
|
+
|
|
11
|
+
const emits = defineEmits(['update:modelValue']);
|
|
12
|
+
const props = withDefaults(defineProps<{
|
|
13
|
+
modelValue: string | null;
|
|
14
|
+
label?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
size?: Size;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
skeleton?: boolean;
|
|
20
|
+
validator?: FieldValidator;
|
|
21
|
+
inputTimeout?: number;
|
|
22
|
+
query?: string;
|
|
23
|
+
}>(), {
|
|
24
|
+
disabled: false,
|
|
25
|
+
skeleton: false,
|
|
26
|
+
size: Size.md,
|
|
27
|
+
inputTimeout: 300,
|
|
28
|
+
placeholder: 'Search'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const timeout = ref<ReturnType<typeof setTimeout> | null>(null);
|
|
32
|
+
|
|
33
|
+
// TODO:: implement query prop. Find a way to use vue router in Storybook.
|
|
34
|
+
const _value = computed<string | null>({
|
|
35
|
+
get: () => props.modelValue,
|
|
36
|
+
set: (val: string | null) => {
|
|
37
|
+
if (val === null) {
|
|
38
|
+
return emits('update:modelValue', val);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (timeout.value) {
|
|
42
|
+
clearTimeout(timeout.value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
timeout.value = setTimeout(() => {
|
|
46
|
+
emits('update:modelValue', val);
|
|
47
|
+
}, props.inputTimeout);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
onMounted(() => handleEnumValidation(props.size, Size, 'size'));
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<AntField
|
|
56
|
+
:label="label"
|
|
57
|
+
:size="size"
|
|
58
|
+
:skeleton="skeleton"
|
|
59
|
+
:description="description"
|
|
60
|
+
:validator="validator"
|
|
61
|
+
data-e2e="search"
|
|
62
|
+
>
|
|
63
|
+
<AntBaseInput
|
|
64
|
+
v-model:value="_value"
|
|
65
|
+
:type="BaseInputType.search"
|
|
66
|
+
:size="size"
|
|
67
|
+
:skeleton="skeleton"
|
|
68
|
+
:disabled="disabled"
|
|
69
|
+
:placeholder="placeholder"
|
|
70
|
+
:validator="validator"
|
|
71
|
+
:icon-left="faSearch"
|
|
72
|
+
nullable
|
|
73
|
+
v-bind="$attrs"
|
|
74
|
+
/>
|
|
75
|
+
</AntField>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
/**
|
|
3
|
+
* This select is a custom component instead of a native <select> because the dropdown is not good
|
|
4
|
+
* customizable with css.
|
|
5
|
+
*
|
|
6
|
+
* Known problem using a custom select instead of a native one:
|
|
7
|
+
* - Label tags does not trigger the custom select by containing the select input or using the for attribute.
|
|
8
|
+
* This means, this select is not usable in a custom field with multiple elements in there.
|
|
9
|
+
* If the user clicks on the label, this select will not be focused.
|
|
10
|
+
*
|
|
11
|
+
* TODO:: add screen reader support
|
|
12
|
+
* Fix overflow bug (See Ellipsis Text story)
|
|
13
|
+
* TODO:: if the dropdown is open and the user types something, the element with a matching value should be focused.
|
|
14
|
+
*/
|
|
15
|
+
import AntField from './Elements/AntField.vue';
|
|
16
|
+
import {type SelectOption} from './__types/AntSelect.type';
|
|
17
|
+
import {computed, onMounted, ref, watch, nextTick} from 'vue';
|
|
18
|
+
import {Size} from '../../enums/Size.enum';
|
|
19
|
+
import {FieldValidator} from '@antify/validate';
|
|
20
|
+
import {handleEnumValidation} from '../../handler';
|
|
21
|
+
import {Grouped} from '../../enums/Grouped.enum';
|
|
22
|
+
import AntIcon from '../AntIcon.vue';
|
|
23
|
+
import {faChevronDown, faChevronUp, faMultiply} from '@fortawesome/free-solid-svg-icons';
|
|
24
|
+
import AntSkeleton from '../AntSkeleton.vue';
|
|
25
|
+
import {vOnClickOutside} from '@vueuse/components';
|
|
26
|
+
import AntButton from '../buttons/AntButton.vue';
|
|
27
|
+
import {ColorType, InputColorType} from '../../enums';
|
|
28
|
+
import {IconSize} from '../__types';
|
|
29
|
+
import AntDropDown from './Elements/AntDropDown.vue';
|
|
30
|
+
|
|
31
|
+
defineOptions({ inheritAttrs: false });
|
|
32
|
+
const props = withDefaults(
|
|
33
|
+
defineProps<{
|
|
34
|
+
modelValue: string | number | null;
|
|
35
|
+
options: SelectOption[];
|
|
36
|
+
label?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
size?: Size;
|
|
40
|
+
colorType?: InputColorType;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
skeleton?: boolean;
|
|
43
|
+
validator?: FieldValidator;
|
|
44
|
+
nullable?: boolean;
|
|
45
|
+
grouped?: Grouped;
|
|
46
|
+
name?: string;
|
|
47
|
+
wrapperClass?: string | Record<string, boolean>;
|
|
48
|
+
showMessageOnError?: boolean;
|
|
49
|
+
expanded?: boolean;
|
|
50
|
+
}>(), {
|
|
51
|
+
colorType: InputColorType.base,
|
|
52
|
+
grouped: Grouped.none,
|
|
53
|
+
size: Size.md,
|
|
54
|
+
disabled: false,
|
|
55
|
+
skeleton: false,
|
|
56
|
+
nullable: false,
|
|
57
|
+
showMessageOnError: true,
|
|
58
|
+
expanded: true
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const emit = defineEmits(['update:modelValue']);
|
|
62
|
+
const isOpen = ref(false);
|
|
63
|
+
const _modelValue = computed({
|
|
64
|
+
get: () => props.modelValue,
|
|
65
|
+
set: (val: string | number | null) => {
|
|
66
|
+
props.validator?.validate(val);
|
|
67
|
+
emit('update:modelValue', val);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
const valueLabel = computed(() => props.options.find(option => option.value === _modelValue.value)?.label || null);
|
|
71
|
+
const inputClasses = computed(() => {
|
|
72
|
+
const variants: Record<InputColorType, string> = {
|
|
73
|
+
[InputColorType.base]: 'outline-neutral-300 focus:outline-primary-500 bg-neutral-50 focus:ring-primary/25',
|
|
74
|
+
[InputColorType.success]: 'outline-success-500 focus:outline-success-500 bg-success-100 focus:ring-success/25',
|
|
75
|
+
[InputColorType.info]: 'outline-info-500 focus:outline-info-500 bg-info-100 focus:ring-info/25',
|
|
76
|
+
[InputColorType.warning]: 'outline-warning-500 focus:outline-warning-500 bg-warning-100 focus:ring-warning/25',
|
|
77
|
+
[InputColorType.danger]: 'outline-danger-500 focus:outline-danger-500 bg-danger-100 focus:ring-danger/25',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
'flex items-center transition-colors border-none outline relative focus:z-10': true,
|
|
82
|
+
'outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1': true,
|
|
83
|
+
[variants[_colorType.value]]: true,
|
|
84
|
+
// Skeleton
|
|
85
|
+
'invisible': props.skeleton,
|
|
86
|
+
// Disabled
|
|
87
|
+
'disabled:opacity-50 disabled:cursor-not-allowed': true,
|
|
88
|
+
// Size
|
|
89
|
+
'focus:ring-2 p-1.5 gap-1.5 text-xs': props.size === Size.sm,
|
|
90
|
+
'focus:ring-4 p-2.5 gap-2.5 text-sm': props.size === Size.md,
|
|
91
|
+
// Grouped
|
|
92
|
+
'rounded-tl-md rounded-bl-md rounded-tr-none rounded-br-none': props.grouped === Grouped.left,
|
|
93
|
+
'rounded-tl-none rounded-bl-none rounded-tr-md rounded-br-md': props.grouped === Grouped.right,
|
|
94
|
+
'rounded-none': props.grouped === Grouped.center,
|
|
95
|
+
'rounded-md': props.grouped === Grouped.none,
|
|
96
|
+
'rounded-tr-none rounded-br-none': props.nullable && _modelValue.value !== null,
|
|
97
|
+
'rounded-bl-none rounded-br-none': isOpen.value,
|
|
98
|
+
// Open
|
|
99
|
+
'shadow-md': isOpen.value,
|
|
100
|
+
// Disabled
|
|
101
|
+
'opacity-50 cursor-not-allowed': props.disabled,
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
const placeholderClasses = computed(() => {
|
|
105
|
+
const variants: Record<InputColorType, string> = {
|
|
106
|
+
[InputColorType.base]: 'text-neutral-500',
|
|
107
|
+
[InputColorType.success]: 'text-success-700',
|
|
108
|
+
[InputColorType.info]: 'text-info-700',
|
|
109
|
+
[InputColorType.warning]: 'text-warning-700',
|
|
110
|
+
[InputColorType.danger]: 'text-danger-700',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
'select-none text-ellipsis overflow-hidden whitespace-nowrap w-full': true,
|
|
115
|
+
[variants[_colorType.value]]: true,
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
const inputValueClasses = computed(() => {
|
|
119
|
+
const variants: Record<InputColorType, string> = {
|
|
120
|
+
[InputColorType.base]: 'text-neutral-50-font',
|
|
121
|
+
[InputColorType.success]: 'text-success-100-font',
|
|
122
|
+
[InputColorType.info]: 'text-info-100-font',
|
|
123
|
+
[InputColorType.warning]: 'text-warning-100-font',
|
|
124
|
+
[InputColorType.danger]: 'text-danger-100-font',
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
'select-none text-ellipsis overflow-hidden whitespace-nowrap w-full': true,
|
|
128
|
+
[variants[_colorType.value]]: true,
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
const arrowClasses = computed(() => {
|
|
132
|
+
const variants: Record<InputColorType, string> = {
|
|
133
|
+
[InputColorType.base]: 'text-neutral-50-font',
|
|
134
|
+
[InputColorType.success]: 'text-success-100-font',
|
|
135
|
+
[InputColorType.info]: 'text-info-100-font',
|
|
136
|
+
[InputColorType.warning]: 'text-warning-100-font',
|
|
137
|
+
[InputColorType.danger]: 'text-danger-100-font',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return {[variants[_colorType.value]]: true};
|
|
141
|
+
});
|
|
142
|
+
const _colorType = computed(() => props.validator?.hasErrors() ? InputColorType.danger : props.colorType);
|
|
143
|
+
const skeletonGrouped = computed(() => {
|
|
144
|
+
if (!props.nullable || (props.nullable && _modelValue.value === null)) {
|
|
145
|
+
return props.grouped;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (props.grouped === Grouped.right || props.grouped === Grouped.center) {
|
|
149
|
+
return Grouped.center;
|
|
150
|
+
} else {
|
|
151
|
+
return Grouped.left;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const inputRef = ref<HTMLElement | null>(null);
|
|
155
|
+
const dropDownRef = ref<HTMLElement | null>(null);
|
|
156
|
+
const focusedDropDownItem = ref<string | number | null>(null);
|
|
157
|
+
|
|
158
|
+
onMounted(() => {
|
|
159
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
160
|
+
handleEnumValidation(props.colorType, InputColorType, 'colorType');
|
|
161
|
+
handleEnumValidation(props.grouped, Grouped, 'grouped');
|
|
162
|
+
|
|
163
|
+
props.validator?.validate(_modelValue.value);
|
|
164
|
+
|
|
165
|
+
focusedDropDownItem.value = _modelValue.value;
|
|
166
|
+
});
|
|
167
|
+
watch(isOpen, (val) => {
|
|
168
|
+
nextTick(() => {
|
|
169
|
+
if (val) {
|
|
170
|
+
dropDownRef.value?.focus();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
function onClickOutside() {
|
|
176
|
+
if (!isOpen.value) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
isOpen.value = false;
|
|
181
|
+
inputRef.value?.focus();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function onKeyDownInput(e: KeyboardEvent) {
|
|
185
|
+
if (e.key === 'Enter') {
|
|
186
|
+
isOpen.value = true;
|
|
187
|
+
inputRef.value?.blur();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (e.key === 'Escape') {
|
|
191
|
+
isOpen.value = false;
|
|
192
|
+
inputRef.value?.focus();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
|
|
196
|
+
const index = props.options.findIndex(option => option.value === _modelValue.value);
|
|
197
|
+
const option = props.options[index + 1];
|
|
198
|
+
|
|
199
|
+
if (index === -1) {
|
|
200
|
+
_modelValue.value = props.options[0].value;
|
|
201
|
+
} else if (option !== undefined) {
|
|
202
|
+
_modelValue.value = option.value;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
|
|
207
|
+
const index = props.options.findIndex(option => option.value === _modelValue.value);
|
|
208
|
+
const option = props.options[index - 1];
|
|
209
|
+
|
|
210
|
+
if (option !== undefined) {
|
|
211
|
+
_modelValue.value = option.value;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function onFocusInInput() {
|
|
217
|
+
inputRef.value?.addEventListener('keydown', onKeyDownInput);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function onFocusOutInput(e: FocusEvent) {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
inputRef.value?.removeEventListener('keydown', onKeyDownInput);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function onClickSelectInput(e: MouseEvent) {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
|
|
228
|
+
if (props.disabled) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (isOpen.value) {
|
|
233
|
+
inputRef.value?.focus()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
isOpen.value = !isOpen.value;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function onClickRemoveButton() {
|
|
240
|
+
inputRef.value?.focus();
|
|
241
|
+
_modelValue.value = null;
|
|
242
|
+
}
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<template>
|
|
246
|
+
<AntField
|
|
247
|
+
:label="label"
|
|
248
|
+
:size="size"
|
|
249
|
+
:skeleton="skeleton"
|
|
250
|
+
:description="description"
|
|
251
|
+
:color-type="colorType"
|
|
252
|
+
:validator="validator"
|
|
253
|
+
:class="wrapperClass"
|
|
254
|
+
:show-message-on-error="showMessageOnError"
|
|
255
|
+
:expanded="expanded"
|
|
256
|
+
label-for="noop"
|
|
257
|
+
data-e2e="select"
|
|
258
|
+
@clickLabel="() => inputRef?.focus()"
|
|
259
|
+
>
|
|
260
|
+
<div
|
|
261
|
+
class="h-fit flex flex-row w-full"
|
|
262
|
+
>
|
|
263
|
+
<div
|
|
264
|
+
class="relative w-full"
|
|
265
|
+
:class="{'cursor-pointer': !skeleton}"
|
|
266
|
+
v-on-click-outside="onClickOutside"
|
|
267
|
+
>
|
|
268
|
+
<AntSkeleton
|
|
269
|
+
v-if="skeleton"
|
|
270
|
+
absolute
|
|
271
|
+
rounded
|
|
272
|
+
:grouped="skeletonGrouped"
|
|
273
|
+
/>
|
|
274
|
+
|
|
275
|
+
<input type="hidden" :name="name" v-model="_modelValue">
|
|
276
|
+
|
|
277
|
+
<!-- Input -->
|
|
278
|
+
<div
|
|
279
|
+
:class="inputClasses"
|
|
280
|
+
ref="inputRef"
|
|
281
|
+
:tabindex="disabled ? undefined : 0"
|
|
282
|
+
@mousedown="onClickSelectInput"
|
|
283
|
+
@focusin="onFocusInInput"
|
|
284
|
+
@focusout="onFocusOutInput"
|
|
285
|
+
v-bind="$attrs"
|
|
286
|
+
>
|
|
287
|
+
<div
|
|
288
|
+
v-if="_modelValue === null && placeholder !== undefined"
|
|
289
|
+
:class="placeholderClasses"
|
|
290
|
+
>
|
|
291
|
+
{{ placeholder }}
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div
|
|
295
|
+
v-else-if="_modelValue === null && label !== undefined"
|
|
296
|
+
:class="placeholderClasses"
|
|
297
|
+
>
|
|
298
|
+
{{ label }}
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<div
|
|
302
|
+
v-else
|
|
303
|
+
:class="inputValueClasses"
|
|
304
|
+
>
|
|
305
|
+
{{ valueLabel }}
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<AntIcon
|
|
309
|
+
v-if="isOpen"
|
|
310
|
+
:icon="faChevronUp"
|
|
311
|
+
:size="size as unknown as IconSize"
|
|
312
|
+
:class="arrowClasses"
|
|
313
|
+
/>
|
|
314
|
+
|
|
315
|
+
<AntIcon
|
|
316
|
+
v-else
|
|
317
|
+
:icon="faChevronDown"
|
|
318
|
+
:size="size as unknown as IconSize"
|
|
319
|
+
:class="arrowClasses"
|
|
320
|
+
/>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<!-- Dropdown -->
|
|
324
|
+
<AntDropDown
|
|
325
|
+
v-model="_modelValue"
|
|
326
|
+
v-model:open="isOpen"
|
|
327
|
+
ref="dropDownRef"
|
|
328
|
+
:options="options"
|
|
329
|
+
:input-ref="inputRef"
|
|
330
|
+
:size="size"
|
|
331
|
+
:color-type="_colorType"
|
|
332
|
+
/>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<AntButton
|
|
336
|
+
v-if="nullable && _modelValue !== null"
|
|
337
|
+
:icon-left="faMultiply"
|
|
338
|
+
:color-type="_colorType as unknown as ColorType"
|
|
339
|
+
:grouped="[Grouped.left, Grouped.center].some(item => item === grouped) ? Grouped.center : Grouped.right"
|
|
340
|
+
:size="size"
|
|
341
|
+
:skeleton="skeleton"
|
|
342
|
+
@click="onClickRemoveButton"
|
|
343
|
+
/>
|
|
344
|
+
</div>
|
|
345
|
+
</AntField>
|
|
346
|
+
</template>
|