@antify/ui-module 1.6.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +182 -51
- package/dist/module.d.ts +182 -51
- package/dist/module.json +1 -1
- package/dist/module.mjs +152 -49
- package/dist/runtime/components/AntAccordion.vue +10 -5
- package/dist/runtime/components/AntAccordionItem.vue +19 -7
- package/dist/runtime/components/AntAlert.vue +27 -27
- package/dist/runtime/components/AntCard.vue +34 -0
- package/dist/runtime/components/AntDropdown.vue +2 -2
- package/dist/runtime/components/AntIcon.vue +21 -16
- package/dist/runtime/components/AntKeycap.vue +26 -5
- package/dist/runtime/components/AntListGroupItem.vue +24 -28
- package/dist/runtime/components/AntModal.vue +5 -5
- package/dist/runtime/components/AntPagination.vue +45 -45
- package/dist/runtime/components/AntPopover.vue +3 -3
- package/dist/runtime/components/AntSpinner.vue +56 -50
- package/dist/runtime/components/AntTag.vue +75 -40
- package/dist/runtime/components/AntToast.vue +40 -31
- package/dist/runtime/components/AntToaster.vue +14 -9
- package/dist/runtime/components/AntTooltip.vue +75 -69
- package/dist/runtime/components/__stories/AntAccordion.stories.mjs +3 -2
- package/dist/runtime/components/__stories/AntAlert.stories.mjs +3 -3
- package/dist/runtime/components/__stories/AntCard.stories.d.ts +7 -0
- package/dist/runtime/components/__stories/AntCard.stories.mjs +87 -0
- package/dist/runtime/components/__stories/AntIcon.stories.mjs +7 -4
- package/dist/runtime/components/__stories/AntKeycap.stories.mjs +8 -1
- package/dist/runtime/components/__stories/AntListGroupItem.stories.mjs +3 -3
- package/dist/runtime/components/__stories/AntModal.stories.mjs +2 -2
- package/dist/runtime/components/__stories/AntSpinner.stories.mjs +7 -7
- package/dist/runtime/components/__stories/AntTag.stories.mjs +5 -6
- package/dist/runtime/components/__stories/AntToast.stories.mjs +3 -3
- package/dist/runtime/components/__stories/AntToaster.stories.d.ts +2 -2
- package/dist/runtime/components/__stories/AntToaster.stories.mjs +4 -4
- package/dist/runtime/components/__stories/AntTooltip.stories.d.ts +5 -0
- package/dist/runtime/components/__stories/AntTooltip.stories.mjs +35 -11
- package/dist/runtime/components/__types/AntIcon.types.d.ts +5 -3
- package/dist/runtime/components/__types/AntIcon.types.mjs +5 -3
- package/dist/runtime/components/__types/AntKeycap.types.d.ts +4 -0
- package/dist/runtime/components/__types/AntKeycap.types.mjs +5 -0
- package/dist/runtime/components/__types/AntListGroupItem.types.d.ts +9 -0
- package/dist/runtime/components/__types/AntListGroupItem.types.mjs +10 -0
- package/dist/runtime/components/__types/AntSpinner.types.d.ts +10 -0
- package/dist/runtime/components/__types/AntSpinner.types.mjs +11 -0
- package/dist/runtime/components/__types/AntTag.types.d.ts +17 -0
- package/dist/runtime/components/__types/AntTag.types.mjs +19 -0
- package/dist/runtime/components/__types/AntToaster.types.d.ts +2 -2
- package/dist/runtime/components/__types/index.d.ts +6 -1
- package/dist/runtime/components/__types/index.mjs +6 -1
- package/dist/runtime/components/buttons/AntActionButton.vue +26 -23
- package/dist/runtime/components/buttons/AntButton.vue +85 -75
- package/dist/runtime/components/buttons/AntCreateButton.vue +2 -2
- package/dist/runtime/components/buttons/AntDeleteButton.vue +2 -2
- package/dist/runtime/components/buttons/AntDuplicateButton.vue +2 -2
- package/dist/runtime/components/buttons/AntEditButton.vue +2 -2
- package/dist/runtime/components/buttons/AntSaveAndNewButton.vue +14 -13
- package/dist/runtime/components/buttons/AntSaveButton.vue +13 -12
- package/dist/runtime/components/buttons/__stories/AntActionButton.stories.mjs +15 -11
- package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +39 -36
- package/dist/runtime/components/buttons/__stories/AntCreateButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__stories/AntDeleteButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__stories/AntDuplicateButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__stories/AntEditButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__stories/AntSaveButton.stories.mjs +1 -1
- package/dist/runtime/components/buttons/__types/index.d.ts +1 -1
- package/dist/runtime/components/buttons/__types/index.mjs +1 -1
- package/dist/runtime/components/crud/AntCrudDetailActions.vue +2 -2
- package/dist/runtime/components/crud/AntCrudDetailNav.vue +10 -3
- package/dist/runtime/components/crud/AntCrudTableFilter.vue +14 -14
- package/dist/runtime/components/crud/AntCrudTableNav.vue +27 -27
- package/dist/runtime/components/crud/__stories/AntCrud.stories.mjs +1 -1
- package/dist/runtime/components/dialogs/AntDeleteDialog.vue +3 -3
- package/dist/runtime/components/dialogs/AntDialog.vue +23 -23
- package/dist/runtime/components/dialogs/__stories/AndDeleteDialog.stories.mjs +3 -1
- package/dist/runtime/components/dialogs/__stories/AntDialog.stories.mjs +4 -4
- package/dist/runtime/components/forms/AntField.vue +123 -0
- package/dist/runtime/components/forms/AntFormGroupLabel.vue +5 -0
- package/dist/runtime/components/{form/Elements → forms}/__stories/AntField.stories.mjs +15 -15
- package/dist/runtime/components/{form → forms}/__stories/AntFormGroup.stories.mjs +3 -3
- package/dist/runtime/components/{form → forms}/__stories/AntFormGroupLabel.stories.mjs +1 -1
- package/dist/runtime/components/index.d.ts +46 -6
- package/dist/runtime/components/index.mjs +90 -7
- package/dist/runtime/components/inputs/AntCheckbox.vue +183 -0
- package/dist/runtime/components/inputs/AntCheckboxGroup.vue +117 -0
- package/dist/runtime/components/inputs/AntDateInput.vue +97 -0
- package/{src/runtime/components/form → dist/runtime/components/inputs}/AntNumberInput.vue +28 -50
- package/dist/runtime/components/inputs/AntPasswordInput.vue +107 -0
- package/dist/runtime/components/inputs/AntRadio.vue +192 -0
- package/dist/runtime/components/inputs/AntRadioGroup.vue +116 -0
- package/dist/runtime/components/inputs/AntRangeSlider.vue +101 -0
- package/{src/runtime/components/form → dist/runtime/components/inputs}/AntSearch.vue +17 -21
- package/dist/runtime/components/{form → inputs}/AntSelect.vue +68 -60
- package/dist/runtime/components/inputs/AntSwitch.vue +192 -0
- package/dist/runtime/components/inputs/AntSwitcher.vue +196 -0
- package/{src/runtime/components/form → dist/runtime/components/inputs}/AntTagInput.vue +94 -69
- package/dist/runtime/components/inputs/AntTextInput.vue +72 -0
- package/dist/runtime/components/{form → inputs}/AntTextarea.vue +53 -41
- package/dist/runtime/components/{form → inputs}/AntUnitInput.vue +17 -23
- package/dist/runtime/components/inputs/Elements/AntBaseInput.vue +256 -0
- package/dist/runtime/components/{form → inputs}/Elements/AntDropDown.vue +29 -30
- package/dist/runtime/components/{form → inputs}/Elements/AntInputDescription.vue +17 -14
- package/dist/runtime/components/inputs/Elements/AntInputLabel.vue +65 -0
- package/dist/runtime/components/inputs/Elements/AntInputLimiter.vue +58 -0
- package/dist/runtime/components/{form → inputs}/Elements/__stories/AntBaseInput.stories.d.ts +2 -0
- package/dist/runtime/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +234 -0
- package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputDescription.stories.mjs +5 -5
- package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputLabel.stories.mjs +3 -3
- package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputLimiter.stories.mjs +5 -5
- package/dist/runtime/components/inputs/Elements/__types/index.d.ts +1 -0
- package/dist/runtime/components/inputs/Elements/__types/index.mjs +1 -0
- package/dist/runtime/components/{form → inputs}/Elements/index.d.ts +1 -1
- package/dist/runtime/components/{form → inputs}/Elements/index.mjs +1 -1
- package/dist/runtime/components/inputs/__stories/AntCheckbox.stories.mjs +341 -0
- package/dist/runtime/components/{form/AntCheckboxWidget → inputs}/__stories/AntCheckboxGroup.stories.mjs +23 -34
- package/dist/runtime/components/inputs/__stories/AntDateInput.stories.d.ts +8 -0
- package/dist/runtime/components/inputs/__stories/AntDateInput.stories.mjs +193 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntNumberInput.stories.d.ts +2 -1
- package/dist/runtime/components/inputs/__stories/AntNumberInput.stories.mjs +106 -0
- package/dist/runtime/components/inputs/__stories/AntPasswordInput.stories.d.ts +8 -0
- package/dist/runtime/components/inputs/__stories/AntPasswordInput.stories.mjs +156 -0
- package/dist/runtime/components/{form/AntRadioWidget → inputs}/__stories/AntRadioGroup.stories.d.ts +1 -1
- package/dist/runtime/components/inputs/__stories/AntRadioGroup.stories.mjs +243 -0
- package/dist/runtime/components/inputs/__stories/AntRangeSlider.stories.d.ts +7 -0
- package/dist/runtime/components/inputs/__stories/AntRangeSlider.stories.mjs +67 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntSearch.stories.d.ts +1 -0
- package/dist/runtime/components/inputs/__stories/AntSearch.stories.mjs +103 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntSelect.stories.mjs +78 -46
- package/dist/runtime/components/{form → inputs}/__stories/AntSwitch.stories.d.ts +1 -1
- package/dist/runtime/components/inputs/__stories/AntSwitch.stories.mjs +344 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntSwitcher.stories.d.ts +1 -1
- package/dist/runtime/components/inputs/__stories/AntSwitcher.stories.mjs +235 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntTagInput.stories.d.ts +3 -3
- package/dist/runtime/components/inputs/__stories/AntTagInput.stories.mjs +228 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntTextInput.stories.d.ts +2 -0
- package/dist/runtime/components/inputs/__stories/AntTextInput.stories.mjs +225 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntTextarea.stories.d.ts +1 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntTextarea.stories.mjs +44 -31
- package/dist/runtime/components/{form → inputs}/__stories/AntUnitInput.stories.d.ts +1 -0
- package/dist/runtime/components/{form → inputs}/__stories/AntUnitInput.stories.mjs +49 -17
- package/dist/runtime/components/{form/AntCheckboxWidget/__types/AntCheckbox.d.ts → inputs/__types/AntCheckbox.types.d.ts} +4 -0
- package/dist/runtime/components/inputs/__types/AntCheckbox.types.mjs +5 -0
- package/dist/runtime/components/inputs/__types/AntDateInput.types.d.ts +7 -0
- package/dist/runtime/components/inputs/__types/AntDateInput.types.mjs +8 -0
- package/dist/runtime/components/inputs/__types/AntRadio.types.d.ts +13 -0
- package/dist/runtime/components/inputs/__types/AntRadio.types.mjs +5 -0
- package/dist/runtime/components/inputs/__types/AntTagInput.types.d.ts +5 -0
- package/dist/runtime/components/inputs/__types/AntTagInput.types.mjs +6 -0
- package/dist/runtime/components/{form/__types/AntTextInput.type.d.ts → inputs/__types/AntTextInput.types.d.ts} +0 -1
- package/dist/runtime/components/{form/__types/AntTextInput.type.mjs → inputs/__types/AntTextInput.types.mjs} +0 -1
- package/dist/runtime/components/inputs/__types/index.d.ts +7 -0
- package/dist/runtime/components/inputs/__types/index.mjs +7 -0
- package/dist/runtime/components/layouts/AntNavLeftLayout.vue +3 -3
- package/dist/runtime/components/navbar/AntNavbar.vue +10 -10
- package/dist/runtime/components/navbar/AntNavbarItem.vue +5 -5
- package/dist/runtime/components/navbar/__types/{NavbarItem.d.ts → NavbarItem.types.d.ts} +2 -2
- package/dist/runtime/components/navbar/__types/index.d.ts +1 -0
- package/dist/runtime/components/navbar/__types/index.mjs +1 -0
- package/dist/runtime/components/table/AntTable.vue +10 -6
- package/dist/runtime/components/table/AntTableSortButton.vue +37 -27
- package/dist/runtime/components/table/AntTd.vue +21 -10
- package/dist/runtime/components/table/AntTh.vue +21 -14
- package/dist/runtime/components/table/__stories/AntTable.stories.mjs +35 -36
- package/dist/runtime/components/table/__types/{TableHeader.type.d.ts → TableHeader.types.d.ts} +5 -0
- package/dist/runtime/components/table/__types/{TableHeader.type.mjs → TableHeader.types.mjs} +6 -0
- package/dist/runtime/components/table/__types/index.d.ts +1 -0
- package/dist/runtime/components/table/__types/index.mjs +1 -0
- package/dist/runtime/components/tabs/AntTabItem.vue +34 -34
- package/dist/runtime/components/tabs/__stories/AntTabItem.stories.mjs +4 -4
- package/dist/runtime/components/tabs/__stories/AntTabs.stories.mjs +3 -3
- package/dist/runtime/components/tabs/__types/AntTabItem.types.d.ts +2 -2
- package/dist/runtime/components/tabs/__types/AntTabItem.types.mjs +6 -6
- package/dist/runtime/components/tabs/__types/index.d.ts +1 -0
- package/dist/runtime/components/tabs/__types/index.mjs +1 -0
- package/dist/runtime/composables/useUi.d.ts +6 -6
- package/dist/runtime/composables/useUi.mjs +8 -8
- package/dist/runtime/enums/Size.enum.d.ts +4 -1
- package/dist/runtime/enums/Size.enum.mjs +4 -1
- package/dist/runtime/enums/{ColorType.enum.d.ts → State.enum.d.ts} +2 -2
- package/dist/runtime/enums/State.enum.mjs +18 -0
- package/dist/runtime/enums/index.d.ts +2 -1
- package/dist/runtime/enums/index.mjs +2 -1
- package/dist/runtime/plugins/toaster.d.ts +2 -2
- package/dist/runtime/plugins/toaster.mjs +5 -5
- package/dist/runtime/plugins/ui-module.mjs +1 -1
- package/dist/runtime/tailwind.config.d.ts +1 -181
- package/dist/runtime/tailwind.config.mjs +3 -0
- package/dist/runtime/types.d.ts +5 -4
- package/dist/runtime/types.mjs +5 -4
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/runtime/components/AntAccordion.vue +10 -5
- package/src/runtime/components/AntAccordionItem.vue +19 -7
- package/src/runtime/components/AntAlert.vue +27 -27
- package/src/runtime/components/AntCard.vue +34 -0
- package/src/runtime/components/AntDropdown.vue +2 -2
- package/src/runtime/components/AntIcon.vue +21 -16
- package/src/runtime/components/AntKeycap.vue +26 -5
- package/src/runtime/components/AntListGroupItem.vue +24 -28
- package/src/runtime/components/AntModal.vue +5 -5
- package/src/runtime/components/AntPagination.vue +45 -45
- package/src/runtime/components/AntPopover.vue +3 -3
- package/src/runtime/components/AntSpinner.vue +56 -50
- package/src/runtime/components/AntTag.vue +75 -40
- package/src/runtime/components/AntToast.vue +40 -31
- package/src/runtime/components/AntToaster.vue +16 -17
- package/src/runtime/components/AntTooltip.vue +75 -69
- package/src/runtime/components/buttons/AntActionButton.vue +26 -23
- package/src/runtime/components/buttons/AntButton.vue +85 -75
- package/src/runtime/components/buttons/AntCreateButton.vue +2 -2
- package/src/runtime/components/buttons/AntDeleteButton.vue +2 -2
- package/src/runtime/components/buttons/AntDuplicateButton.vue +2 -2
- package/src/runtime/components/buttons/AntEditButton.vue +2 -2
- package/src/runtime/components/buttons/AntSaveAndNewButton.vue +14 -13
- package/src/runtime/components/buttons/AntSaveButton.vue +13 -12
- package/src/runtime/components/crud/AntCrudDetailActions.vue +2 -2
- package/src/runtime/components/crud/AntCrudDetailNav.vue +10 -3
- package/src/runtime/components/crud/AntCrudTableFilter.vue +14 -14
- package/src/runtime/components/crud/AntCrudTableNav.vue +27 -27
- package/src/runtime/components/dialogs/AntDeleteDialog.vue +3 -3
- package/src/runtime/components/dialogs/AntDialog.vue +23 -23
- package/src/runtime/components/forms/AntField.vue +123 -0
- package/src/runtime/components/forms/AntFormGroupLabel.vue +5 -0
- package/src/runtime/components/inputs/AntCheckbox.vue +202 -0
- package/src/runtime/components/inputs/AntCheckboxGroup.vue +117 -0
- package/src/runtime/components/inputs/AntDateInput.vue +97 -0
- package/{dist/runtime/components/form → src/runtime/components/inputs}/AntNumberInput.vue +28 -50
- package/src/runtime/components/inputs/AntPasswordInput.vue +107 -0
- package/src/runtime/components/inputs/AntRadio.vue +200 -0
- package/src/runtime/components/inputs/AntRadioGroup.vue +116 -0
- package/src/runtime/components/inputs/AntRangeSlider.vue +121 -0
- package/{dist/runtime/components/form → src/runtime/components/inputs}/AntSearch.vue +17 -21
- package/src/runtime/components/{form → inputs}/AntSelect.vue +68 -60
- package/src/runtime/components/inputs/AntSwitch.vue +192 -0
- package/src/runtime/components/inputs/AntSwitcher.vue +196 -0
- package/{dist/runtime/components/form → src/runtime/components/inputs}/AntTagInput.vue +94 -69
- package/src/runtime/components/inputs/AntTextInput.vue +72 -0
- package/src/runtime/components/{form → inputs}/AntTextarea.vue +53 -41
- package/src/runtime/components/{form → inputs}/AntUnitInput.vue +17 -23
- package/src/runtime/components/inputs/Elements/AntBaseInput.vue +304 -0
- package/src/runtime/components/{form → inputs}/Elements/AntDropDown.vue +29 -30
- package/src/runtime/components/{form → inputs}/Elements/AntInputDescription.vue +17 -14
- package/src/runtime/components/inputs/Elements/AntInputLabel.vue +65 -0
- package/src/runtime/components/inputs/Elements/AntInputLimiter.vue +58 -0
- package/src/runtime/components/layouts/AntNavLeftLayout.vue +3 -3
- package/src/runtime/components/navbar/AntNavbar.vue +10 -10
- package/src/runtime/components/navbar/AntNavbarItem.vue +5 -5
- package/src/runtime/components/table/AntTable.vue +10 -6
- package/src/runtime/components/table/AntTableSortButton.vue +37 -27
- package/src/runtime/components/table/AntTd.vue +21 -10
- package/src/runtime/components/table/AntTh.vue +21 -14
- package/src/runtime/components/tabs/AntTabItem.vue +34 -34
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +0 -144
- package/dist/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +0 -91
- package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.mjs +0 -289
- package/dist/runtime/components/form/AntFormGroupLabel.vue +0 -5
- package/dist/runtime/components/form/AntRadioWidget/AntRadio.vue +0 -139
- package/dist/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +0 -80
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.d.ts +0 -8
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadio.stories.mjs +0 -79
- package/dist/runtime/components/form/AntRadioWidget/__stories/AntRadioGroup.stories.mjs +0 -125
- package/dist/runtime/components/form/AntRadioWidget/__types/AntRadio.type.d.ts +0 -9
- package/dist/runtime/components/form/AntRangeSlider.vue +0 -81
- package/dist/runtime/components/form/AntSwitch.vue +0 -153
- package/dist/runtime/components/form/AntSwitcher.vue +0 -184
- package/dist/runtime/components/form/AntTextInput.vue +0 -73
- package/dist/runtime/components/form/Elements/AntBaseInput.vue +0 -220
- package/dist/runtime/components/form/Elements/AntField.vue +0 -105
- package/dist/runtime/components/form/Elements/AntInputLabel.vue +0 -55
- package/dist/runtime/components/form/Elements/AntInputLimiter.vue +0 -55
- package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.mjs +0 -171
- package/dist/runtime/components/form/Elements/__types/index.d.ts +0 -1
- package/dist/runtime/components/form/Elements/__types/index.mjs +0 -1
- package/dist/runtime/components/form/__stories/AntNumberInput.stories.mjs +0 -74
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.d.ts +0 -6
- package/dist/runtime/components/form/__stories/AntRangeSlider.stories.mjs +0 -40
- package/dist/runtime/components/form/__stories/AntSearch.stories.mjs +0 -43
- package/dist/runtime/components/form/__stories/AntSwitch.stories.mjs +0 -218
- package/dist/runtime/components/form/__stories/AntSwitcher.stories.mjs +0 -228
- package/dist/runtime/components/form/__stories/AntTagInput.stories.mjs +0 -106
- package/dist/runtime/components/form/__stories/AntTextInput.stories.mjs +0 -68
- package/dist/runtime/components/form/__types/AntSwitcher.type.mjs +0 -0
- package/dist/runtime/components/form/__types/index.d.ts +0 -3
- package/dist/runtime/components/form/__types/index.mjs +0 -3
- package/dist/runtime/components/form/index.d.ts +0 -12
- package/dist/runtime/components/form/index.mjs +0 -24
- package/dist/runtime/components/navbar/__types/NavbarItem.mjs +0 -0
- package/dist/runtime/enums/ColorType.enum.mjs +0 -18
- package/dist/runtime/types/AntListGroupItem.type.d.ts +0 -11
- package/dist/runtime/types/AntListGroupItem.type.mjs +0 -12
- package/dist/runtime/types/AntTag.type.d.ts +0 -7
- package/dist/runtime/types/AntTag.type.mjs +0 -8
- package/dist/runtime/types/Checkbox.type.d.ts +0 -8
- package/dist/runtime/types/Checkbox.type.mjs +0 -0
- package/dist/runtime/types/NavItem.type.d.ts +0 -9
- package/dist/runtime/types/NavItem.type.mjs +0 -0
- package/dist/runtime/types/RadioButton.type.d.ts +0 -5
- package/dist/runtime/types/RadioButton.type.mjs +0 -0
- package/dist/runtime/types/Tabs.type.d.ts +0 -6
- package/dist/runtime/types/Tabs.type.mjs +0 -0
- package/dist/runtime/types/Toaster.type.d.ts +0 -6
- package/dist/runtime/types/Toaster.type.mjs +0 -0
- package/dist/runtime/types/index.d.ts +0 -7
- package/dist/runtime/types/index.mjs +0 -7
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckbox.vue +0 -166
- package/src/runtime/components/form/AntCheckboxWidget/AntCheckboxGroup.vue +0 -91
- package/src/runtime/components/form/AntFormGroupLabel.vue +0 -5
- package/src/runtime/components/form/AntRadioWidget/AntRadio.vue +0 -164
- package/src/runtime/components/form/AntRadioWidget/AntRadioGroup.vue +0 -80
- package/src/runtime/components/form/AntRangeSlider.vue +0 -101
- package/src/runtime/components/form/AntSwitch.vue +0 -153
- package/src/runtime/components/form/AntSwitcher.vue +0 -200
- package/src/runtime/components/form/AntTextInput.vue +0 -73
- package/src/runtime/components/form/Elements/AntBaseInput.vue +0 -251
- package/src/runtime/components/form/Elements/AntField.vue +0 -105
- package/src/runtime/components/form/Elements/AntInputLabel.vue +0 -55
- package/src/runtime/components/form/Elements/AntInputLimiter.vue +0 -55
- /package/dist/runtime/components/__types/{Accordion.types.d.ts → AntAccordion.types.d.ts} +0 -0
- /package/dist/runtime/components/__types/{Accordion.types.mjs → AntAccordion.types.mjs} +0 -0
- /package/dist/runtime/components/buttons/__types/{AntButton.type.d.ts → AntButton.types.d.ts} +0 -0
- /package/dist/runtime/components/buttons/__types/{AntButton.type.mjs → AntButton.types.mjs} +0 -0
- /package/dist/runtime/components/{form → forms}/AntFormGroup.vue +0 -0
- /package/dist/runtime/components/{form/Elements → forms}/__stories/AntField.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → forms}/__stories/AntFormGroup.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → forms}/__stories/AntFormGroupLabel.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → inputs}/AntRichTextEditor.vue +0 -0
- /package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputDescription.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputLabel.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → inputs}/Elements/__stories/AntInputLimiter.stories.d.ts +0 -0
- /package/dist/runtime/components/{form/Elements/__types/AntBaseInput.type.d.ts → inputs/Elements/__types/AntBaseInput.types.d.ts} +0 -0
- /package/dist/runtime/components/{form/Elements/__types/AntBaseInput.type.mjs → inputs/Elements/__types/AntBaseInput.types.mjs} +0 -0
- /package/dist/runtime/components/{form/AntCheckboxWidget → inputs}/__stories/AntCheckbox.stories.d.ts +0 -0
- /package/dist/runtime/components/{form/AntCheckboxWidget → inputs}/__stories/AntCheckboxGroup.stories.d.ts +0 -0
- /package/dist/runtime/components/{form → inputs}/__stories/AntRichTextEditor.stories-old.d.ts +0 -0
- /package/dist/runtime/components/{form → inputs}/__stories/AntRichTextEditor.stories-old.mjs +0 -0
- /package/dist/runtime/components/{form → inputs}/__stories/AntSelect.stories.d.ts +0 -0
- /package/dist/runtime/components/{form/__types/AntSelect.type.d.ts → inputs/__types/AntSelect.types.d.ts} +0 -0
- /package/dist/runtime/components/{form/AntCheckboxWidget/__types/AntCheckbox.mjs → inputs/__types/AntSelect.types.mjs} +0 -0
- /package/dist/runtime/components/{form/__types/AntSwitcher.type.d.ts → inputs/__types/AntSwitcher.types.d.ts} +0 -0
- /package/dist/runtime/components/{form/AntRadioWidget/__types/AntRadio.type.mjs → inputs/__types/AntSwitcher.types.mjs} +0 -0
- /package/dist/runtime/components/{form/__types/AntSelect.type.mjs → navbar/__types/NavbarItem.types.mjs} +0 -0
- /package/src/runtime/components/{form → forms}/AntFormGroup.vue +0 -0
- /package/src/runtime/components/{form → inputs}/AntRichTextEditor.vue +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {useVModel} from '@vueuse/core';
|
|
3
|
+
import {AntField} from './Elements';
|
|
4
|
+
import {InputState, Size} from '../../enums';
|
|
5
|
+
import AntSkeleton from '../AntSkeleton.vue';
|
|
6
|
+
import {computed, onMounted, ref, watch} from 'vue';
|
|
7
|
+
import {handleEnumValidation} from '../../handler';
|
|
8
|
+
import {faCheck} from '@fortawesome/free-solid-svg-icons';
|
|
9
|
+
import AntIcon from '../AntIcon.vue';
|
|
10
|
+
import {IconSize} from '../__types';
|
|
11
|
+
import {AntCheckboxSize} from './__types/AntCheckbox.types';
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits(['update:modelValue', 'update:skeleton', 'validate', 'blur']);
|
|
14
|
+
const props =
|
|
15
|
+
withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
modelValue: boolean | null;
|
|
18
|
+
label?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
state?: InputState;
|
|
21
|
+
size?: AntCheckboxSize,
|
|
22
|
+
skeleton?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
readonly?: boolean;
|
|
25
|
+
messages?: string[];
|
|
26
|
+
}>(), {
|
|
27
|
+
state: InputState.base,
|
|
28
|
+
size: AntCheckboxSize.md,
|
|
29
|
+
skeleton: false,
|
|
30
|
+
disabled: false,
|
|
31
|
+
readonly: false,
|
|
32
|
+
messages: () => []
|
|
33
|
+
});
|
|
34
|
+
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
35
|
+
const delayedValue = ref(_modelValue.value);
|
|
36
|
+
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
37
|
+
const inputClasses = computed(() => {
|
|
38
|
+
const focusColorVariant: Record<InputState, string> = {
|
|
39
|
+
[InputState.base]: 'focus:ring-primary-200',
|
|
40
|
+
[InputState.danger]: 'focus:ring-danger-200',
|
|
41
|
+
[InputState.info]: 'focus:ring-info-200',
|
|
42
|
+
[InputState.success]: 'focus:ring-success-200',
|
|
43
|
+
[InputState.warning]: 'focus:ring-warning-200',
|
|
44
|
+
};
|
|
45
|
+
const activeColorVariant: Record<InputState, string> = {
|
|
46
|
+
[InputState.base]: 'text-primary-500',
|
|
47
|
+
[InputState.danger]: 'text-danger-500',
|
|
48
|
+
[InputState.info]: 'text-info-500',
|
|
49
|
+
[InputState.success]: 'text-success-500',
|
|
50
|
+
[InputState.warning]: 'text-warning-500',
|
|
51
|
+
};
|
|
52
|
+
const inactiveColorVariant: Record<InputState, string> = {
|
|
53
|
+
[InputState.base]: 'outline-neutral-300',
|
|
54
|
+
[InputState.danger]: 'outline-danger-500',
|
|
55
|
+
[InputState.info]: 'outline-info-500',
|
|
56
|
+
[InputState.success]: 'outline-success-500',
|
|
57
|
+
[InputState.warning]: 'outline-warning-500',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
'relative inline-flex flex-shrink-0 bg-neutral-100 border-0': true,
|
|
62
|
+
'outline outline-1 outline-offset-[-1px] rounded': true,
|
|
63
|
+
'focus:ring-offset-0': true,
|
|
64
|
+
'invisible': props.skeleton,
|
|
65
|
+
'cursor-pointer': !hasInputState.value,
|
|
66
|
+
'focus:ring-2': props.size === AntCheckboxSize.sm && !hasInputState.value,
|
|
67
|
+
'focus:ring-4': props.size === AntCheckboxSize.md && !hasInputState.value,
|
|
68
|
+
'h-5 w-5': props.size === AntCheckboxSize.md,
|
|
69
|
+
'h-4 w-4': props.size === AntCheckboxSize.sm,
|
|
70
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
|
71
|
+
[focusColorVariant[props.state]]: hasInputState.value,
|
|
72
|
+
[activeColorVariant[props.state]]: delayedValue.value,
|
|
73
|
+
[inactiveColorVariant[props.state]]: !_modelValue.value,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const contentClasses = computed(() => ({
|
|
77
|
+
'text-for-white-bg-font': true,
|
|
78
|
+
'cursor-pointer': !hasInputState.value,
|
|
79
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
|
80
|
+
'text-sm': props.size === AntCheckboxSize.md,
|
|
81
|
+
'text-xs': props.size === AntCheckboxSize.sm
|
|
82
|
+
}));
|
|
83
|
+
const fieldSize = computed(() => {
|
|
84
|
+
if (props.size === AntCheckboxSize.md) {
|
|
85
|
+
return Size.sm;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return Size.xs;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Delay value to change the checkboxes background color after
|
|
93
|
+
* animation is finished.
|
|
94
|
+
*/
|
|
95
|
+
watch(_modelValue, (val) => {
|
|
96
|
+
if (val === false) {
|
|
97
|
+
setTimeout(() => delayedValue.value = false, 120);
|
|
98
|
+
} else {
|
|
99
|
+
delayedValue.value = true;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
watch(_modelValue, (val) => {
|
|
103
|
+
if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
|
|
104
|
+
emit('validate', val);
|
|
105
|
+
}
|
|
106
|
+
}, {deep: true});
|
|
107
|
+
watch(() => props.skeleton, (val) => {
|
|
108
|
+
if (!val && props.modelValue !== null) {
|
|
109
|
+
emit('validate', props.modelValue);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
function onBlur(e: FocusEvent) {
|
|
114
|
+
emit('validate', props.modelValue);
|
|
115
|
+
emit('blur', e);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
handleEnumValidation(props.size, AntCheckboxSize, 'size');
|
|
120
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
121
|
+
|
|
122
|
+
if (!props.skeleton && props.modelValue !== null) {
|
|
123
|
+
emit('validate', props.modelValue);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<AntField
|
|
130
|
+
:label="label"
|
|
131
|
+
:description="description"
|
|
132
|
+
:skeleton="skeleton"
|
|
133
|
+
:state="state"
|
|
134
|
+
:size="fieldSize"
|
|
135
|
+
:expanded="false"
|
|
136
|
+
:messages="messages"
|
|
137
|
+
>
|
|
138
|
+
<div class="flex items-center gap-1.5">
|
|
139
|
+
<div class="relative full-height flex items-center">
|
|
140
|
+
<input
|
|
141
|
+
v-model="_modelValue"
|
|
142
|
+
:class="inputClasses"
|
|
143
|
+
type="checkbox"
|
|
144
|
+
:aria-checked="_modelValue"
|
|
145
|
+
:disabled="disabled || readonly"
|
|
146
|
+
@blur="onBlur"
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<AntIcon
|
|
150
|
+
v-if="_modelValue"
|
|
151
|
+
:icon="faCheck"
|
|
152
|
+
class="absolute !text-white pointer-events-none"
|
|
153
|
+
:size="size === AntCheckboxSize.md ? IconSize.sm : IconSize.xs"
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<AntSkeleton
|
|
157
|
+
v-if="skeleton"
|
|
158
|
+
absolute
|
|
159
|
+
rounded
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div
|
|
164
|
+
class="relative flex items-center"
|
|
165
|
+
:class="props.size === AntCheckboxSize.md ? 'h-5' : 'h-4'"
|
|
166
|
+
>
|
|
167
|
+
<span :class="contentClasses">
|
|
168
|
+
<slot />
|
|
169
|
+
</span>
|
|
170
|
+
|
|
171
|
+
<AntSkeleton
|
|
172
|
+
v-if="skeleton"
|
|
173
|
+
absolute
|
|
174
|
+
rounded
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</AntField>
|
|
179
|
+
</template>
|
|
180
|
+
|
|
181
|
+
<style scoped>
|
|
182
|
+
input[type=checkbox]{-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative}input[type=checkbox]:before{background:currentColor;border-radius:inherit;content:"";height:100%;position:absolute;transform:scale(0);transition:transform .12s;width:100%}input[type=checkbox]:checked:before{transform:scale(1)}
|
|
183
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {type AntCheckboxType, AntCheckboxSize} from './__types/AntCheckbox.types';
|
|
3
|
+
import {AntField} from './Elements';
|
|
4
|
+
import {useVModel} from '@vueuse/core';
|
|
5
|
+
import AntCheckbox from './AntCheckbox.vue';
|
|
6
|
+
import {computed, onMounted, ref, watch} from 'vue';
|
|
7
|
+
import {Direction} from '../../enums/Direction.enum';
|
|
8
|
+
import {InputState, Size} from '../../enums';
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['update:modelValue', 'validate', 'blur']);
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<{
|
|
13
|
+
modelValue: string[] | null;
|
|
14
|
+
checkboxes?: AntCheckboxType[];
|
|
15
|
+
label?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
direction?: Direction;
|
|
18
|
+
state?: InputState;
|
|
19
|
+
size?: AntCheckboxSize,
|
|
20
|
+
skeleton?: boolean;
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
messages?: string[]
|
|
24
|
+
}>(),
|
|
25
|
+
{
|
|
26
|
+
direction: Direction.column,
|
|
27
|
+
state: InputState.base,
|
|
28
|
+
size: AntCheckboxSize.md,
|
|
29
|
+
skeleton: false,
|
|
30
|
+
readonly: false,
|
|
31
|
+
disabled: false,
|
|
32
|
+
messages: () => []
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
36
|
+
const containerClasses = computed(() => ({
|
|
37
|
+
'flex gap-2.5': true,
|
|
38
|
+
'flex-row': props.direction === Direction.row,
|
|
39
|
+
'flex-col': props.direction === Direction.column
|
|
40
|
+
}));
|
|
41
|
+
const containerRef = ref<null | HTMLElement>(null);
|
|
42
|
+
|
|
43
|
+
watch(_modelValue, (val) => {
|
|
44
|
+
if ([InputState.danger, InputState.warning, InputState.info].includes(props.state)) {
|
|
45
|
+
emit('validate', val);
|
|
46
|
+
}
|
|
47
|
+
}, {deep: true});
|
|
48
|
+
watch(() => props.skeleton, (val) => {
|
|
49
|
+
if (!val && props.modelValue !== null) {
|
|
50
|
+
emit('validate', props.modelValue);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function updateValue(value: string) {
|
|
55
|
+
if (_modelValue.value === null) {
|
|
56
|
+
return _modelValue.value = [value];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const index = _modelValue.value.indexOf(value);
|
|
60
|
+
|
|
61
|
+
if (index === -1) {
|
|
62
|
+
_modelValue.value.push(value);
|
|
63
|
+
} else {
|
|
64
|
+
_modelValue.value.splice(index, 1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function hasFocusedCheckbox() {
|
|
69
|
+
return !!containerRef.value?.querySelector('input[type="checkbox"]:focus');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function onBlurCheckbox() {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
if (!hasFocusedCheckbox()) {
|
|
75
|
+
emit('validate', _modelValue.value);
|
|
76
|
+
}
|
|
77
|
+
}, 100);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onMounted(() => {
|
|
81
|
+
if (!props.skeleton && props.modelValue !== null) {
|
|
82
|
+
emit('validate', props.modelValue);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<AntField
|
|
89
|
+
:label="label"
|
|
90
|
+
:description="description"
|
|
91
|
+
:skeleton="skeleton"
|
|
92
|
+
:state="state"
|
|
93
|
+
:size="size as unknown as Size"
|
|
94
|
+
:messages="messages"
|
|
95
|
+
label-for="noop"
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
ref="containerRef"
|
|
99
|
+
:class="containerClasses"
|
|
100
|
+
>
|
|
101
|
+
<AntCheckbox
|
|
102
|
+
v-for="(checkbox, index) in checkboxes"
|
|
103
|
+
:key="`checkbox-group-${index}`"
|
|
104
|
+
:model-value="_modelValue !== null ? _modelValue?.indexOf(checkbox.value) !== -1 : null"
|
|
105
|
+
:size="size"
|
|
106
|
+
:state="state"
|
|
107
|
+
:skeleton="skeleton"
|
|
108
|
+
:disabled="disabled || checkbox.disabled"
|
|
109
|
+
:readonly="readonly || checkbox.readonly"
|
|
110
|
+
@update:model-value="updateValue(checkbox.value)"
|
|
111
|
+
@blur="() => onBlurCheckbox()"
|
|
112
|
+
>
|
|
113
|
+
{{ checkbox.label }}
|
|
114
|
+
</AntCheckbox>
|
|
115
|
+
</div>
|
|
116
|
+
</AntField>
|
|
117
|
+
</template>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {computed, onMounted, ref} from 'vue';
|
|
3
|
+
import AntField from '../forms/AntField.vue';
|
|
4
|
+
import AntBaseInput from './Elements/AntBaseInput.vue';
|
|
5
|
+
import AntIcon from '../AntIcon.vue';
|
|
6
|
+
import {Size} from '../../enums/Size.enum';
|
|
7
|
+
import {useVModel} from '@vueuse/core';
|
|
8
|
+
import {InputState} from '../../enums';
|
|
9
|
+
import {BaseInputType} from './Elements/__types';
|
|
10
|
+
import {handleEnumValidation} from '../../handler';
|
|
11
|
+
import {AntDateInputTypes} from './__types/AntDateInput.types';
|
|
12
|
+
import {faCalendar, faClock} from '@fortawesome/free-solid-svg-icons';
|
|
13
|
+
import {IconSize} from '../__types/AntIcon.types';
|
|
14
|
+
|
|
15
|
+
defineOptions({inheritAttrs: false});
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<{
|
|
18
|
+
modelValue: string | null;
|
|
19
|
+
label?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
size?: Size;
|
|
22
|
+
type?: AntDateInputTypes;
|
|
23
|
+
state?: InputState;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
skeleton?: boolean;
|
|
26
|
+
messages?: string[];
|
|
27
|
+
}>(), {
|
|
28
|
+
state: InputState.base,
|
|
29
|
+
type: AntDateInputTypes.date,
|
|
30
|
+
disabled: false,
|
|
31
|
+
skeleton: false,
|
|
32
|
+
size: Size.md,
|
|
33
|
+
messages: () => []
|
|
34
|
+
});
|
|
35
|
+
const emit = defineEmits(['update:modelValue', 'validate']);
|
|
36
|
+
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
37
|
+
const inputRef = ref<null | HTMLInputElement>(null);
|
|
38
|
+
const iconColor = computed(() => {
|
|
39
|
+
switch (props.state) {
|
|
40
|
+
case InputState.info:
|
|
41
|
+
return 'text-info-700';
|
|
42
|
+
case InputState.success:
|
|
43
|
+
return 'text-success-700';
|
|
44
|
+
case InputState.warning:
|
|
45
|
+
return 'text-warning-700';
|
|
46
|
+
case InputState.danger:
|
|
47
|
+
return 'text-danger-700';
|
|
48
|
+
default:
|
|
49
|
+
return 'text-for-white-bg-font';
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const iconSize = computed(() => props.size === Size.xs || props.size === Size.xs2 ? IconSize.xs : IconSize.sm);
|
|
53
|
+
const _icon = computed(() => props.type === AntDateInputTypes.time ? faClock : faCalendar);
|
|
54
|
+
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
57
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function onClickCalendar() {
|
|
61
|
+
inputRef.value?.showPicker();
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<AntField
|
|
67
|
+
:label="label"
|
|
68
|
+
:size="size"
|
|
69
|
+
:skeleton="skeleton"
|
|
70
|
+
:description="description"
|
|
71
|
+
:state="state"
|
|
72
|
+
:messages="messages"
|
|
73
|
+
>
|
|
74
|
+
<AntBaseInput
|
|
75
|
+
v-model="_modelValue"
|
|
76
|
+
v-model:input-ref="inputRef"
|
|
77
|
+
:type="type as unknown as BaseInputType"
|
|
78
|
+
:state="state"
|
|
79
|
+
:size="size"
|
|
80
|
+
:skeleton="skeleton"
|
|
81
|
+
:disabled="disabled"
|
|
82
|
+
:show-icon="false"
|
|
83
|
+
v-bind="$attrs"
|
|
84
|
+
@validate="val => $emit('validate', val)"
|
|
85
|
+
>
|
|
86
|
+
<template #icon-right>
|
|
87
|
+
<AntIcon
|
|
88
|
+
:icon="_icon"
|
|
89
|
+
:color="iconColor"
|
|
90
|
+
:size="iconSize"
|
|
91
|
+
class="cursor-pointer"
|
|
92
|
+
@click="onClickCalendar"
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
|
95
|
+
</AntBaseInput>
|
|
96
|
+
</AntField>
|
|
97
|
+
</template>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {computed, onMounted
|
|
3
|
-
import AntButton from '../buttons/AntButton.vue'
|
|
4
|
-
import AntField from '
|
|
5
|
-
import AntBaseInput from './Elements/AntBaseInput.vue'
|
|
6
|
-
import {Size} from '../../enums/Size.enum'
|
|
2
|
+
import {computed, onMounted} from 'vue';
|
|
3
|
+
import AntButton from '../buttons/AntButton.vue';
|
|
4
|
+
import AntField from '../forms/AntField.vue';
|
|
5
|
+
import AntBaseInput from './Elements/AntBaseInput.vue';
|
|
6
|
+
import {Size} from '../../enums/Size.enum';
|
|
7
7
|
import {faPlus, faMinus} from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
import {
|
|
8
|
+
import {State, InputState} from '../../enums/State.enum';
|
|
9
9
|
import {handleEnumValidation} from '../../handler';
|
|
10
10
|
import {useVModel} from '@vueuse/core';
|
|
11
11
|
import {Grouped} from '../../enums/Grouped.enum';
|
|
12
12
|
import {BaseInputType} from './Elements/__types';
|
|
13
13
|
|
|
14
|
-
defineOptions({
|
|
14
|
+
defineOptions({inheritAttrs: false});
|
|
15
15
|
|
|
16
16
|
const props = withDefaults(defineProps<{
|
|
17
17
|
modelValue: number | null;
|
|
@@ -19,24 +19,24 @@ const props = withDefaults(defineProps<{
|
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
description?: string;
|
|
21
21
|
size?: Size;
|
|
22
|
-
|
|
22
|
+
state?: InputState;
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
skeleton?: boolean;
|
|
25
25
|
steps?: number;
|
|
26
26
|
min?: number;
|
|
27
27
|
max?: number;
|
|
28
28
|
limiter?: boolean;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
messages?: string[];
|
|
30
|
+
indicators?: boolean;
|
|
31
31
|
}>(), {
|
|
32
|
-
|
|
32
|
+
state: InputState.base,
|
|
33
33
|
disabled: false,
|
|
34
34
|
skeleton: false,
|
|
35
35
|
size: Size.md,
|
|
36
36
|
steps: 1,
|
|
37
37
|
limiter: false,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
messages: () => [],
|
|
39
|
+
indicators: false
|
|
40
40
|
});
|
|
41
41
|
const emit = defineEmits(['update:modelValue', 'validate']);
|
|
42
42
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
@@ -45,41 +45,27 @@ const isPrevButtonDisabled = computed(() => {
|
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
48
|
+
if (_modelValue.value === null) {
|
|
49
|
+
return false;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return false;
|
|
52
|
+
return props.min !== undefined ? _modelValue.value <= props.min : false;
|
|
53
53
|
});
|
|
54
54
|
const isNextButtonDisabled = computed(() => {
|
|
55
55
|
if (props.disabled) {
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return false;
|
|
64
|
-
});
|
|
65
|
-
const hasErrors = computed(() => props.errors.length > 0);
|
|
66
|
-
const buttonColorType = computed(() => {
|
|
67
|
-
if (hasErrors.value) {
|
|
68
|
-
return ColorType.danger;
|
|
59
|
+
if (_modelValue.value === null) {
|
|
60
|
+
return false;
|
|
69
61
|
}
|
|
70
62
|
|
|
71
|
-
return props.
|
|
63
|
+
return props.max !== undefined ? _modelValue.value >= props.max : false;
|
|
72
64
|
});
|
|
73
65
|
|
|
74
66
|
onMounted(() => {
|
|
75
67
|
handleEnumValidation(props.size, Size, 'size');
|
|
76
|
-
handleEnumValidation(props.
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
watch(_modelValue, (val) => {
|
|
80
|
-
if (hasErrors.value) {
|
|
81
|
-
emit('validate', val)
|
|
82
|
-
}
|
|
68
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
83
69
|
});
|
|
84
70
|
|
|
85
71
|
function subtract() {
|
|
@@ -90,10 +76,6 @@ function subtract() {
|
|
|
90
76
|
} else {
|
|
91
77
|
_modelValue.value -= props.steps;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
if (hasErrors.value) {
|
|
95
|
-
emit('validate', _modelValue.value)
|
|
96
|
-
}
|
|
97
79
|
}
|
|
98
80
|
|
|
99
81
|
function add() {
|
|
@@ -104,13 +86,10 @@ function add() {
|
|
|
104
86
|
} else {
|
|
105
87
|
_modelValue.value += props.steps;
|
|
106
88
|
}
|
|
107
|
-
|
|
108
|
-
if (hasErrors.value) {
|
|
109
|
-
emit('validate', _modelValue.value)
|
|
110
|
-
}
|
|
111
89
|
}
|
|
90
|
+
|
|
112
91
|
function onButtonBlur() {
|
|
113
|
-
emit('validate', _modelValue.value)
|
|
92
|
+
emit('validate', _modelValue.value);
|
|
114
93
|
}
|
|
115
94
|
</script>
|
|
116
95
|
|
|
@@ -120,10 +99,10 @@ function onButtonBlur() {
|
|
|
120
99
|
:size="size"
|
|
121
100
|
:skeleton="skeleton"
|
|
122
101
|
:description="description"
|
|
123
|
-
:
|
|
102
|
+
:state="state"
|
|
124
103
|
:limiter-max-value="limiter && max !== undefined ? max : undefined"
|
|
125
104
|
:limiter-value="limiter && _modelValue !== undefined && _modelValue !== null ? _modelValue : undefined"
|
|
126
|
-
:
|
|
105
|
+
:messages="messages"
|
|
127
106
|
>
|
|
128
107
|
<div
|
|
129
108
|
class="flex relative"
|
|
@@ -132,7 +111,7 @@ function onButtonBlur() {
|
|
|
132
111
|
v-if="indicators"
|
|
133
112
|
:icon-left="faMinus"
|
|
134
113
|
:grouped="Grouped.left"
|
|
135
|
-
:
|
|
114
|
+
:state="state as unknown as State"
|
|
136
115
|
:size="size"
|
|
137
116
|
:skeleton="skeleton"
|
|
138
117
|
:disabled="isPrevButtonDisabled"
|
|
@@ -141,11 +120,11 @@ function onButtonBlur() {
|
|
|
141
120
|
/>
|
|
142
121
|
|
|
143
122
|
<AntBaseInput
|
|
144
|
-
v-model
|
|
123
|
+
v-model.number="_modelValue"
|
|
145
124
|
:type="BaseInputType.number"
|
|
146
125
|
:grouped="indicators ? Grouped.center : Grouped.none"
|
|
147
126
|
wrapper-class="flex-grow"
|
|
148
|
-
:
|
|
127
|
+
:state="state"
|
|
149
128
|
:size="size"
|
|
150
129
|
:skeleton="skeleton"
|
|
151
130
|
:min="min"
|
|
@@ -153,7 +132,6 @@ function onButtonBlur() {
|
|
|
153
132
|
:disabled="disabled"
|
|
154
133
|
:placeholder="placeholder || label"
|
|
155
134
|
:show-icon="false"
|
|
156
|
-
:has-errors="hasErrors"
|
|
157
135
|
v-bind="$attrs"
|
|
158
136
|
@validate="val => $emit('validate', val)"
|
|
159
137
|
/>
|
|
@@ -162,7 +140,7 @@ function onButtonBlur() {
|
|
|
162
140
|
v-if="indicators"
|
|
163
141
|
:icon-left="faPlus"
|
|
164
142
|
:grouped="Grouped.right"
|
|
165
|
-
:
|
|
143
|
+
:state="state as unknown as State"
|
|
166
144
|
:size="size"
|
|
167
145
|
:skeleton="skeleton"
|
|
168
146
|
:disabled="isNextButtonDisabled"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {computed, onMounted, ref} from 'vue';
|
|
3
|
+
import AntField from '../forms/AntField.vue';
|
|
4
|
+
import AntBaseInput from './Elements/AntBaseInput.vue';
|
|
5
|
+
import AntIcon from '../AntIcon.vue';
|
|
6
|
+
import {Size} from '../../enums/Size.enum';
|
|
7
|
+
import {faEye, faEyeSlash} from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import {useVModel} from '@vueuse/core';
|
|
9
|
+
import {InputState} from '../../enums';
|
|
10
|
+
import {BaseInputType} from './Elements/__types';
|
|
11
|
+
import {handleEnumValidation} from '../../handler';
|
|
12
|
+
import {IconSize} from '../__types/AntIcon.types';
|
|
13
|
+
|
|
14
|
+
defineOptions({inheritAttrs: false});
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<{
|
|
17
|
+
modelValue: string | null;
|
|
18
|
+
label?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
size?: Size;
|
|
22
|
+
state?: InputState;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
skeleton?: boolean;
|
|
25
|
+
messages?: string[];
|
|
26
|
+
}>(), {
|
|
27
|
+
state: InputState.base,
|
|
28
|
+
disabled: false,
|
|
29
|
+
skeleton: false,
|
|
30
|
+
size: Size.md,
|
|
31
|
+
messages: () => []
|
|
32
|
+
});
|
|
33
|
+
const emit = defineEmits(['update:modelValue', 'validate']);
|
|
34
|
+
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
35
|
+
const isVisible = ref(false);
|
|
36
|
+
const iconSize = computed(() => {
|
|
37
|
+
if (props.size === Size.xs2 || props.size === Size.xs) {
|
|
38
|
+
return IconSize.xs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return IconSize.sm;
|
|
42
|
+
});
|
|
43
|
+
const iconColor = computed(() => {
|
|
44
|
+
switch (props.state) {
|
|
45
|
+
case InputState.info:
|
|
46
|
+
return 'text-info-700';
|
|
47
|
+
case InputState.success:
|
|
48
|
+
return 'text-success-700';
|
|
49
|
+
case InputState.warning:
|
|
50
|
+
return 'text-warning-700';
|
|
51
|
+
case InputState.danger:
|
|
52
|
+
return 'text-danger-700';
|
|
53
|
+
default:
|
|
54
|
+
return 'text-neutral-500';
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
handleEnumValidation(props.state, InputState, 'state');
|
|
60
|
+
handleEnumValidation(props.size, Size, 'size');
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<AntField
|
|
66
|
+
:label="label"
|
|
67
|
+
:size="size"
|
|
68
|
+
:skeleton="skeleton"
|
|
69
|
+
:description="description"
|
|
70
|
+
:state="state"
|
|
71
|
+
:messages="messages"
|
|
72
|
+
>
|
|
73
|
+
<div class="flex relative">
|
|
74
|
+
<AntBaseInput
|
|
75
|
+
v-model="_modelValue"
|
|
76
|
+
:type="isVisible ? BaseInputType.text : BaseInputType.password"
|
|
77
|
+
:state="state"
|
|
78
|
+
:size="size"
|
|
79
|
+
:skeleton="skeleton"
|
|
80
|
+
:disabled="disabled"
|
|
81
|
+
:placeholder="placeholder || label"
|
|
82
|
+
:show-icon="false"
|
|
83
|
+
v-bind="$attrs"
|
|
84
|
+
@validate="val => $emit('validate', val)"
|
|
85
|
+
>
|
|
86
|
+
<template #icon-right>
|
|
87
|
+
<AntIcon
|
|
88
|
+
v-if="!isVisible"
|
|
89
|
+
class="cursor-pointer"
|
|
90
|
+
:icon="faEye"
|
|
91
|
+
:color="iconColor"
|
|
92
|
+
:size="iconSize"
|
|
93
|
+
@click="() => isVisible = !isVisible"
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<AntIcon
|
|
97
|
+
v-else
|
|
98
|
+
class="cursor-pointer"
|
|
99
|
+
:icon="faEyeSlash"
|
|
100
|
+
:color="iconColor"
|
|
101
|
+
@click="() => isVisible = !isVisible"
|
|
102
|
+
/>
|
|
103
|
+
</template>
|
|
104
|
+
</AntBaseInput>
|
|
105
|
+
</div>
|
|
106
|
+
</AntField>
|
|
107
|
+
</template>
|