@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
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { AntField } from '../Elements';
|
|
3
|
-
import { InputColorType, Size } from '../../../enums';
|
|
4
|
-
import AntSkeleton from '../../AntSkeleton.vue';
|
|
5
|
-
import { computed, onMounted } from 'vue';
|
|
6
|
-
import { type AntRadioType } from './__types/AntRadio.type';
|
|
7
|
-
import { handleEnumValidation } from '../../../handler';
|
|
8
|
-
|
|
9
|
-
defineOptions({ inheritAttrs: false });
|
|
10
|
-
|
|
11
|
-
const emits = defineEmits([ 'update:modelValue', 'update:skeleton' ]);
|
|
12
|
-
const props = withDefaults(
|
|
13
|
-
defineProps<{
|
|
14
|
-
modelValue: string | null;
|
|
15
|
-
value: AntRadioType;
|
|
16
|
-
|
|
17
|
-
description?: string;
|
|
18
|
-
skeleton?: boolean;
|
|
19
|
-
colorType?: InputColorType;
|
|
20
|
-
size?: Size
|
|
21
|
-
readonly?: boolean;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
}>(), {
|
|
24
|
-
colorType: InputColorType.base,
|
|
25
|
-
size: Size.md,
|
|
26
|
-
readonly: false,
|
|
27
|
-
disabled: false,
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const _value = computed({
|
|
32
|
-
get(): string | null | AntRadioType {
|
|
33
|
-
return props.modelValue;
|
|
34
|
-
},
|
|
35
|
-
set(val: string | null | AntRadioType) {
|
|
36
|
-
emits('update:modelValue', val ? typeof val === 'string' ? val : val.value : null);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const hasAction = computed(() => (!props.skeleton && !props.readonly && !props.disabled))
|
|
40
|
-
const isActive = computed(() => {
|
|
41
|
-
return _value.value === props.value.value
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const inputClasses = computed(() => {
|
|
45
|
-
const classes: { [key: string]: boolean } = {
|
|
46
|
-
'relative inline-flex flex-shrink-0': true,
|
|
47
|
-
'focus:ring-offset-0 outline outline-offset-[-1px] outline-1 focus:outline-offset-[-1px] focus:outline-1 rounded-full': true,
|
|
48
|
-
'cursor-pointer': hasAction.value,
|
|
49
|
-
'outline-neutral-300 focus:outline-neutral-300': !isActive.value,
|
|
50
|
-
'rounded-full transition-colors ease-in-out duration-200 disabled:opacity-50 disabled:cursor-not-allowed': true,
|
|
51
|
-
'focus:ring-2': props.size === Size.sm && hasAction.value,
|
|
52
|
-
'focus:ring-4': props.size === Size.md && hasAction.value,
|
|
53
|
-
'h-4 w-4 small': props.size === Size.sm,
|
|
54
|
-
'h-5 w-5': props.size === Size.md,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const focusColorVariant = {
|
|
58
|
-
[InputColorType.base]: 'focus:ring-primary-100',
|
|
59
|
-
[InputColorType.danger]: 'focus:ring-danger-100',
|
|
60
|
-
[InputColorType.info]: 'focus:ring-info-100',
|
|
61
|
-
[InputColorType.success]: 'focus:ring-success-100',
|
|
62
|
-
[InputColorType.warning]: 'focus:ring-warning-100',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const activeColorVariant = {
|
|
66
|
-
[InputColorType.base]: 'text-primary-500 outline-primary-500 focus:outline-primary-500',
|
|
67
|
-
[InputColorType.danger]: 'text-danger-500 outline-danger-500 focus:outline-danger-500',
|
|
68
|
-
[InputColorType.info]: 'text-info-500 outline-info-500 focus:outline-info-500',
|
|
69
|
-
[InputColorType.success]: 'text-success-500 outline-success-500 focus:outline-success-500',
|
|
70
|
-
[InputColorType.warning]: 'text-warning-500 outline-warning-500 focus:outline-warning-500',
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
classes[focusColorVariant[props.colorType]] = hasAction.value;
|
|
74
|
-
classes[activeColorVariant[props.colorType]] = isActive.value;
|
|
75
|
-
|
|
76
|
-
return classes;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const valueClass = computed(() => {
|
|
80
|
-
const classes = {
|
|
81
|
-
'relative w-fit full-height': true,
|
|
82
|
-
'cursor-pointer': hasAction.value,
|
|
83
|
-
'cursor-not-allowed opacity-50': props.disabled
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return classes;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
onMounted(() => {
|
|
90
|
-
handleEnumValidation(props.size, Size, 'size');
|
|
91
|
-
handleEnumValidation(props.colorType, InputColorType, 'colorType');
|
|
92
|
-
});
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<template>
|
|
96
|
-
<AntField
|
|
97
|
-
:description="description"
|
|
98
|
-
:color-type="colorType"
|
|
99
|
-
class="cursor-pointer"
|
|
100
|
-
:skeleton="skeleton"
|
|
101
|
-
:size="size"
|
|
102
|
-
:expanded="false"
|
|
103
|
-
>
|
|
104
|
-
<div class="flex items-center gap-1.5">
|
|
105
|
-
<div class="relative full-height flex items-center">
|
|
106
|
-
<input
|
|
107
|
-
v-model="_value"
|
|
108
|
-
:value="value.value"
|
|
109
|
-
:class="inputClasses"
|
|
110
|
-
type="radio"
|
|
111
|
-
:aria-checked="isActive"
|
|
112
|
-
:disabled="disabled"
|
|
113
|
-
/>
|
|
114
|
-
|
|
115
|
-
<AntSkeleton
|
|
116
|
-
v-if="skeleton"
|
|
117
|
-
absolute
|
|
118
|
-
rounded-full
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div class="relative">
|
|
123
|
-
<span :class="valueClass">
|
|
124
|
-
{{ value.label }}
|
|
125
|
-
</span>
|
|
126
|
-
|
|
127
|
-
<AntSkeleton
|
|
128
|
-
v-if="skeleton"
|
|
129
|
-
absolute
|
|
130
|
-
rounded
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</AntField>
|
|
135
|
-
</template>
|
|
136
|
-
|
|
137
|
-
<style scoped>
|
|
138
|
-
input[type="radio"] {
|
|
139
|
-
appearance: none;
|
|
140
|
-
border-radius: 100%;
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
input[type="radio"]::before {
|
|
147
|
-
content: "";
|
|
148
|
-
width: 12px;
|
|
149
|
-
height: 12px;
|
|
150
|
-
border-radius: 100%;
|
|
151
|
-
transform: scale(0);
|
|
152
|
-
transition: 120ms transform;
|
|
153
|
-
background: currentColor;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
input[type="radio"].small::before {
|
|
157
|
-
width: 8px;
|
|
158
|
-
height: 8px;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
input[type="radio"]:checked::before {
|
|
162
|
-
transform: scale(1);
|
|
163
|
-
}
|
|
164
|
-
</style>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import AntRadio from './AntRadio.vue';
|
|
3
|
-
import { useVModel } from '@vueuse/core';
|
|
4
|
-
import { AntField } from '../Elements';
|
|
5
|
-
import { type AntRadioType } from './__types/AntRadio.type';
|
|
6
|
-
import { InputColorType, Size } from '../../../enums';
|
|
7
|
-
import { FieldValidator } from '@antify/validate';
|
|
8
|
-
import { computed, type Ref, watch } from 'vue';
|
|
9
|
-
import { Direction } from '../../../enums/Direction.enum';
|
|
10
|
-
|
|
11
|
-
defineOptions({ inheritAttrs: false });
|
|
12
|
-
|
|
13
|
-
const emits = defineEmits([ 'update:modelValue', 'update:skeleton' ]);
|
|
14
|
-
const props = withDefaults(
|
|
15
|
-
defineProps<{
|
|
16
|
-
modelValue: string | null;
|
|
17
|
-
radioButtons: AntRadioType[];
|
|
18
|
-
label?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
direction?: Direction;
|
|
21
|
-
colorType?: InputColorType;
|
|
22
|
-
size?: Size;
|
|
23
|
-
skeleton?: boolean;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
readonly?: boolean;
|
|
26
|
-
validator?: FieldValidator;
|
|
27
|
-
}>(), {
|
|
28
|
-
direction: Direction.column,
|
|
29
|
-
colorType: InputColorType.base,
|
|
30
|
-
size: Size.md,
|
|
31
|
-
skeleton: false,
|
|
32
|
-
disabled: false,
|
|
33
|
-
readonly: false
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const _value = useVModel(props, 'modelValue', emits);
|
|
37
|
-
const _colorType: Ref<InputColorType | undefined> = computed(() => props.validator?.hasErrors() ? InputColorType.danger : undefined);
|
|
38
|
-
const containerClasses = computed(() => {
|
|
39
|
-
const classes = {
|
|
40
|
-
'flex gap-2.5 justify-start': true,
|
|
41
|
-
'flex-row': props.direction === Direction.row,
|
|
42
|
-
'flex-col': props.direction === Direction.column,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return classes;
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
watch(_value, () => {
|
|
49
|
-
props.validator?.validate(_value.value);
|
|
50
|
-
}, {
|
|
51
|
-
deep: true
|
|
52
|
-
});
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<template>
|
|
56
|
-
<AntField
|
|
57
|
-
:label="label"
|
|
58
|
-
:description="description"
|
|
59
|
-
:color-type="colorType"
|
|
60
|
-
:skeleton="skeleton"
|
|
61
|
-
:validator="validator"
|
|
62
|
-
:size="size"
|
|
63
|
-
label-for="noop"
|
|
64
|
-
>
|
|
65
|
-
<div
|
|
66
|
-
:class="containerClasses"
|
|
67
|
-
>
|
|
68
|
-
<AntRadio
|
|
69
|
-
v-model="_value"
|
|
70
|
-
v-for="(radio, index) in radioButtons"
|
|
71
|
-
:key="`radio-button-widget_${radio.value}-${index}`"
|
|
72
|
-
:value="radio"
|
|
73
|
-
:skeleton="skeleton"
|
|
74
|
-
:disabled="disabled || radio.disabled"
|
|
75
|
-
:readonly="readonly || radio.readonly"
|
|
76
|
-
:color-type="_colorType || radio.colorType || colorType"
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
</AntField>
|
|
80
|
-
</template>
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AntField from './Elements/AntField.vue';
|
|
3
|
-
import {FieldValidator} from '@antify/validate';
|
|
4
|
-
import {useVModel} from '@vueuse/core';
|
|
5
|
-
import {computed, onMounted} from 'vue';
|
|
6
|
-
import {InputColorType, Size} from '../../enums';
|
|
7
|
-
import {handleEnumValidation} from '../../handler';
|
|
8
|
-
|
|
9
|
-
defineOptions({ inheritAttrs: false });
|
|
10
|
-
|
|
11
|
-
const emits = defineEmits(['update:modelValue', 'update:skeleton'])
|
|
12
|
-
const props = withDefaults(defineProps<{
|
|
13
|
-
modelValue: number | number[] | undefined;
|
|
14
|
-
label?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
colorType?: InputColorType;
|
|
17
|
-
size?: Size,
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
skeleton?: boolean;
|
|
20
|
-
validator?: FieldValidator;
|
|
21
|
-
min?: number;
|
|
22
|
-
max?: number;
|
|
23
|
-
}>(), {
|
|
24
|
-
colorType: InputColorType.base,
|
|
25
|
-
size: Size.md,
|
|
26
|
-
disabled: false,
|
|
27
|
-
skeleton: false,
|
|
28
|
-
limiter: false
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const value = useVModel(props, 'modelValue', emits);
|
|
32
|
-
const _colorType = computed(() => props.validator?.hasErrors() ? InputColorType.danger : props.colorType);
|
|
33
|
-
const inputClasses = computed(() => {
|
|
34
|
-
const variants: Record<InputColorType, string> = {
|
|
35
|
-
[InputColorType.base]: 'text-neutral-base',
|
|
36
|
-
[InputColorType.danger]: 'text-danger-base',
|
|
37
|
-
[InputColorType.info]: 'text-info-base',
|
|
38
|
-
[InputColorType.success]: 'text-success-base',
|
|
39
|
-
[InputColorType.warning]: 'text-warning-base',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
'ant-range-slider transition-colors relative border-none w-full focus:z-10 h-2 bg-neutral-300 rounded-md outline-none': true,
|
|
44
|
-
'disabled:opacity-50 disabled:cursor-not-allowed': props.disabled,
|
|
45
|
-
'invisible': props.skeleton,
|
|
46
|
-
[variants[_colorType.value]]: true
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
onMounted(() => {
|
|
51
|
-
handleEnumValidation(props.colorType, InputColorType, 'colorType');
|
|
52
|
-
handleEnumValidation(props.size, Size, 'size');
|
|
53
|
-
|
|
54
|
-
props.validator?.validate(props.modelValue);
|
|
55
|
-
});
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<template>
|
|
59
|
-
<AntField
|
|
60
|
-
:label="label"
|
|
61
|
-
:size="size"
|
|
62
|
-
:skeleton="skeleton"
|
|
63
|
-
:description="description"
|
|
64
|
-
:color-type="colorType"
|
|
65
|
-
:validator="validator"
|
|
66
|
-
>
|
|
67
|
-
<input
|
|
68
|
-
v-model="value"
|
|
69
|
-
:class="inputClasses"
|
|
70
|
-
type="range"
|
|
71
|
-
:disabled="disabled || skeleton"
|
|
72
|
-
:min="min"
|
|
73
|
-
:max="max"
|
|
74
|
-
v-bind="$attrs"
|
|
75
|
-
>
|
|
76
|
-
</AntField>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<style scoped>
|
|
80
|
-
.ant-range-slider {
|
|
81
|
-
-webkit-appearance: none;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.ant-range-slider::-webkit-slider-thumb {
|
|
85
|
-
-webkit-appearance: none;
|
|
86
|
-
border-radius: 100%;
|
|
87
|
-
appearance: none;
|
|
88
|
-
width: 14px;
|
|
89
|
-
height: 14px;
|
|
90
|
-
background: #fff;
|
|
91
|
-
border: 1px solid #CBD5E1;
|
|
92
|
-
cursor: pointer;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.ant-range-slider::-moz-range-thumb {
|
|
96
|
-
width: 25px;
|
|
97
|
-
height: 25px;
|
|
98
|
-
background: #04AA6D;
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
}
|
|
101
|
-
</style>
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AntField from './Elements/AntField.vue';
|
|
3
|
-
import { computed, type Ref } from 'vue';
|
|
4
|
-
import { FieldValidator } from '@antify/validate';
|
|
5
|
-
import AntSkeleton from '../AntSkeleton.vue';
|
|
6
|
-
import { InputColorType, Size } from '../../enums';
|
|
7
|
-
|
|
8
|
-
const emits = defineEmits([ 'update:modelValue', 'input' ]);
|
|
9
|
-
const props = withDefaults(defineProps<{
|
|
10
|
-
modelValue: boolean;
|
|
11
|
-
label?: string;
|
|
12
|
-
value?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
skeleton?: boolean;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
validator?: FieldValidator;
|
|
18
|
-
size?: Size;
|
|
19
|
-
colorType?: InputColorType
|
|
20
|
-
}>(), {
|
|
21
|
-
size: Size.md,
|
|
22
|
-
colorType: InputColorType.base
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const _value = computed({
|
|
26
|
-
get: () => props.modelValue,
|
|
27
|
-
set: (value: boolean) => {
|
|
28
|
-
emits('update:modelValue', value)
|
|
29
|
-
emits('input', value)
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const hasAction = computed(() => (!props.skeleton && !props.readonly && !props.disabled))
|
|
33
|
-
const _colorType: Ref<InputColorType> = computed(() => props.validator?.hasErrors() ? InputColorType.danger : props.colorType);
|
|
34
|
-
|
|
35
|
-
const buttonClasses = computed(() => {
|
|
36
|
-
const classes: { [key: string]: boolean } = {
|
|
37
|
-
'relative inline-flex flex-shrink-0': true,
|
|
38
|
-
'focus:outline-none': true,
|
|
39
|
-
'rounded-full transition-colors ease-in-out duration-200': true,
|
|
40
|
-
'focus-within:ring-2': props.size === Size.sm && hasAction.value,
|
|
41
|
-
'focus-within:ring-4': props.size === Size.md && hasAction.value,
|
|
42
|
-
'h-4 w-[30px]': props.size === Size.sm,
|
|
43
|
-
'h-5 w-9': props.size === Size.md,
|
|
44
|
-
'bg-neutral-300': !_value.value,
|
|
45
|
-
'invisible': props.skeleton,
|
|
46
|
-
// Disabled
|
|
47
|
-
'opacity-50 cursor-not-allowed': props.disabled,
|
|
48
|
-
'cursor-default': props.readonly
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const colorVariant = {
|
|
52
|
-
[InputColorType.base]: 'focus-within:ring-primary-100',
|
|
53
|
-
[InputColorType.danger]: 'focus-within:ring-danger-100',
|
|
54
|
-
[InputColorType.info]: 'focus-within:ring-info-100',
|
|
55
|
-
[InputColorType.success]: 'focus-within:ring-success-100',
|
|
56
|
-
[InputColorType.warning]: 'focus-within:ring-warning-100',
|
|
57
|
-
};
|
|
58
|
-
const activeColorVariant = {
|
|
59
|
-
[InputColorType.base]: 'bg-primary-500',
|
|
60
|
-
[InputColorType.danger]: 'bg-danger-500',
|
|
61
|
-
[InputColorType.info]: 'bg-info-500',
|
|
62
|
-
[InputColorType.success]: 'bg-success-500',
|
|
63
|
-
[InputColorType.warning]: 'bg-warning-500',
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
classes[colorVariant[_colorType.value]] = hasAction.value;
|
|
67
|
-
classes[activeColorVariant[_colorType.value]] = _value.value;
|
|
68
|
-
|
|
69
|
-
return classes;
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
const ballClasses = computed(() => ({
|
|
73
|
-
'pointer-events-none inline-block rounded-full bg-neutral-100 shadow transform ring-0 transition ease-in-out duration-200': true,
|
|
74
|
-
'h-4 w-4 translate-y-0.5': props.size === Size.md,
|
|
75
|
-
'h-3.5 w-3.5 translate-y-[1px]': props.size === Size.sm,
|
|
76
|
-
'translate-x-[1.125rem]': _value.value && props.size === Size.md,
|
|
77
|
-
'translate-x-0.5': !_value.value && props.size === Size.md,
|
|
78
|
-
'translate-x-[.925rem]': _value.value && props.size === Size.sm,
|
|
79
|
-
'translate-x-[1px]': !_value.value && props.size === Size.sm,
|
|
80
|
-
'invisible': props.skeleton
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
const valueClasses = computed(() => {
|
|
84
|
-
const classes = {
|
|
85
|
-
'text-for-white-bg-font': true,
|
|
86
|
-
'text-sm': props.size === Size.sm,
|
|
87
|
-
'text-md': props.size === Size.md,
|
|
88
|
-
'opacity-50 cursor-not-allowed': props.disabled
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return classes;
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
function changeValue() {
|
|
95
|
-
if (!props.readonly && !props.disabled) {
|
|
96
|
-
_value.value = !_value.value
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
</script>
|
|
100
|
-
|
|
101
|
-
<template>
|
|
102
|
-
<AntField
|
|
103
|
-
:label="label"
|
|
104
|
-
:size="size"
|
|
105
|
-
:description="description"
|
|
106
|
-
:skeleton="skeleton"
|
|
107
|
-
:validator="validator"
|
|
108
|
-
:color-type="colorType"
|
|
109
|
-
>
|
|
110
|
-
<div class="relative w-fit flex items-center gap-1.5">
|
|
111
|
-
<div class="relative w-fit flex items-center">
|
|
112
|
-
<button
|
|
113
|
-
v-bind="$attrs"
|
|
114
|
-
type="button"
|
|
115
|
-
:class="buttonClasses"
|
|
116
|
-
role="switch"
|
|
117
|
-
:aria-checked="_value"
|
|
118
|
-
:disabled="disabled"
|
|
119
|
-
:tabindex="readonly ? -1 : 1"
|
|
120
|
-
@click="changeValue"
|
|
121
|
-
@blur="validator?.validate(_value)"
|
|
122
|
-
>
|
|
123
|
-
<span
|
|
124
|
-
aria-hidden="true"
|
|
125
|
-
:class="ballClasses"
|
|
126
|
-
>
|
|
127
|
-
<slot name="icon"></slot>
|
|
128
|
-
</span>
|
|
129
|
-
</button>
|
|
130
|
-
|
|
131
|
-
<AntSkeleton
|
|
132
|
-
v-if="skeleton"
|
|
133
|
-
absolute
|
|
134
|
-
rounded-full
|
|
135
|
-
></AntSkeleton>
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<div
|
|
139
|
-
v-if="value"
|
|
140
|
-
class="relative"
|
|
141
|
-
>
|
|
142
|
-
<span :class="valueClasses">{{ value }}</span>
|
|
143
|
-
|
|
144
|
-
<AntSkeleton
|
|
145
|
-
v-if="skeleton"
|
|
146
|
-
absolute
|
|
147
|
-
rounded
|
|
148
|
-
class="l-1.5"
|
|
149
|
-
></AntSkeleton>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</AntField>
|
|
153
|
-
</template>
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import AntField from './Elements/AntField.vue';
|
|
3
|
-
import AntButton from '../buttons/AntButton.vue';
|
|
4
|
-
import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
-
import AntSkeleton from '../AntSkeleton.vue';
|
|
6
|
-
import { FieldValidator } from '@antify/validate';
|
|
7
|
-
import { type SwitcherOption } from './__types/AntSwitcher.type';
|
|
8
|
-
import { ColorType, InputColorType } from '../../enums';
|
|
9
|
-
import { Grouped, Size } from '../../enums';
|
|
10
|
-
import { computed, onMounted, watch } from 'vue';
|
|
11
|
-
|
|
12
|
-
const emits = defineEmits([ 'update:modelValue' ]);
|
|
13
|
-
const props = withDefaults(defineProps<{
|
|
14
|
-
modelValue: string;
|
|
15
|
-
options: string[] | SwitcherOption[];
|
|
16
|
-
label?: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
skeleton?: boolean;
|
|
19
|
-
readonly?: boolean;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
colorType?: InputColorType;
|
|
22
|
-
validator?: FieldValidator;
|
|
23
|
-
size?: Size,
|
|
24
|
-
}>(), {
|
|
25
|
-
colorType: InputColorType.base,
|
|
26
|
-
size: Size.md
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const _value = computed({
|
|
30
|
-
get() {
|
|
31
|
-
const found = props.options.find((option: string | SwitcherOption) => typeof option === 'string' ? option === props.modelValue : option.value === props.modelValue);
|
|
32
|
-
|
|
33
|
-
if (!found) {
|
|
34
|
-
return props.options[0];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return found;
|
|
38
|
-
},
|
|
39
|
-
set(val: string | SwitcherOption) {
|
|
40
|
-
emits('update:modelValue', typeof val === 'string' ? val : val.value);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const hasAction = computed(() => (!props.skeleton && !props.readonly && !props.disabled))
|
|
45
|
-
const _colorType = computed(() => props.validator?.hasErrors() ? InputColorType.danger : props.colorType);
|
|
46
|
-
|
|
47
|
-
watch(_value, () => props.validator?.validate(_value.value));
|
|
48
|
-
|
|
49
|
-
onMounted(() => {
|
|
50
|
-
props.validator?.validate(_value.value);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const containerClasses = computed(() => {
|
|
54
|
-
const classes: { [key: string]: boolean } = {
|
|
55
|
-
'flex relative ring-primary/25 rounded-md outline-none': true,
|
|
56
|
-
'focus-within:ring-2': (props.size as Size) === Size.sm && hasAction.value,
|
|
57
|
-
'focus-within:ring-4': (props.size as Size) === Size.md && hasAction.value,
|
|
58
|
-
};
|
|
59
|
-
const colorVariant = {
|
|
60
|
-
[InputColorType.base]: 'focus-within:ring-primary-100',
|
|
61
|
-
[InputColorType.danger]: 'focus-within:ring-danger-100',
|
|
62
|
-
[InputColorType.info]: 'focus-within:ring-info-100',
|
|
63
|
-
[InputColorType.success]: 'focus-within:ring-success-100',
|
|
64
|
-
[InputColorType.warning]: 'focus-within:ring-warning-100',
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
classes[colorVariant[_colorType.value]] = true;
|
|
68
|
-
|
|
69
|
-
return classes;
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const itemClasses = computed(() => {
|
|
73
|
-
const classes: { [key: string]: boolean } = {
|
|
74
|
-
'grow text-center': true,
|
|
75
|
-
'p-2.5 text-sm ': (props.size as Size) === Size.md,
|
|
76
|
-
'p-1.5 text-xs ': (props.size as Size) === Size.sm,
|
|
77
|
-
'invisible': props.skeleton,
|
|
78
|
-
'opacity-50 cursor-not-allowed': props.disabled,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const colorVariant = {
|
|
82
|
-
[InputColorType.base]: 'border-neutral-300 bg-white text-for-white-bg-font',
|
|
83
|
-
[InputColorType.danger]: 'border-danger-500 bg-danger-100 text-danger-100-font',
|
|
84
|
-
[InputColorType.info]: 'border-info-500 bg-info-100 text-info-100-font',
|
|
85
|
-
[InputColorType.success]: 'border-success-500 bg-success-100 text-success-100-font',
|
|
86
|
-
[InputColorType.warning]: 'border-warning-500 bg-warning-100 text-warning-100-font',
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
classes[colorVariant[_colorType.value]] = true;
|
|
90
|
-
|
|
91
|
-
return classes;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
function prevOption() {
|
|
95
|
-
if (props.readonly || props.disabled) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const index = props.options.findIndex((option) => option === _value.value);
|
|
100
|
-
|
|
101
|
-
if (index !== -1 && props.options[index - 1]) {
|
|
102
|
-
_value.value = props.options[index - 1];
|
|
103
|
-
} else {
|
|
104
|
-
_value.value = props.options[props.options.length - 1];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function nextOption() {
|
|
109
|
-
if (props.readonly || props.disabled) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const index = props.options.findIndex((option) => option === _value.value);
|
|
114
|
-
|
|
115
|
-
if (index !== -1 && props.options[index + 1]) {
|
|
116
|
-
_value.value = props.options[index + 1];
|
|
117
|
-
} else {
|
|
118
|
-
_value.value = props.options[0];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
</script>
|
|
122
|
-
|
|
123
|
-
<template>
|
|
124
|
-
<AntField
|
|
125
|
-
:label="label"
|
|
126
|
-
:size="size"
|
|
127
|
-
:skeleton="skeleton"
|
|
128
|
-
:description="description"
|
|
129
|
-
:color-type="colorType"
|
|
130
|
-
:validator="validator"
|
|
131
|
-
label-for="noop"
|
|
132
|
-
>
|
|
133
|
-
<div
|
|
134
|
-
:class="containerClasses"
|
|
135
|
-
tabindex="0"
|
|
136
|
-
@keydown.left.prevent="prevOption()"
|
|
137
|
-
@keydown.right.prevent="nextOption()"
|
|
138
|
-
>
|
|
139
|
-
<AntButton
|
|
140
|
-
:icon-left="faChevronLeft"
|
|
141
|
-
:grouped="Grouped.left"
|
|
142
|
-
no-focus
|
|
143
|
-
:color-type="_colorType as unknown as ColorType"
|
|
144
|
-
:size="size"
|
|
145
|
-
:skeleton="skeleton"
|
|
146
|
-
:readonly="readonly"
|
|
147
|
-
:disabled="disabled"
|
|
148
|
-
@click="prevOption"
|
|
149
|
-
/>
|
|
150
|
-
|
|
151
|
-
<div class="grow relative">
|
|
152
|
-
<div
|
|
153
|
-
:class="itemClasses"
|
|
154
|
-
class="switcher-content"
|
|
155
|
-
>
|
|
156
|
-
{{ typeof _value === 'string' ? _value : _value.label }}
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
<AntSkeleton
|
|
160
|
-
v-if="skeleton"
|
|
161
|
-
absolute
|
|
162
|
-
:grouped="Grouped.center"
|
|
163
|
-
rounded
|
|
164
|
-
/>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<AntButton
|
|
168
|
-
:icon-left="faChevronRight"
|
|
169
|
-
:grouped="Grouped.right"
|
|
170
|
-
no-focus
|
|
171
|
-
:color-type="_colorType as unknown as ColorType"
|
|
172
|
-
:size="size"
|
|
173
|
-
:skeleton="skeleton"
|
|
174
|
-
:readonly="readonly"
|
|
175
|
-
:disabled="disabled"
|
|
176
|
-
@click="nextOption"
|
|
177
|
-
/>
|
|
178
|
-
</div>
|
|
179
|
-
</AntField>
|
|
180
|
-
</template>
|
|
181
|
-
|
|
182
|
-
<style scoped>
|
|
183
|
-
.switcher-content {
|
|
184
|
-
position: relative;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.switcher-content:before {
|
|
188
|
-
content: '';
|
|
189
|
-
|
|
190
|
-
position: absolute;
|
|
191
|
-
|
|
192
|
-
inset: 0;
|
|
193
|
-
|
|
194
|
-
border-top: 1px;
|
|
195
|
-
border-bottom: 1px;
|
|
196
|
-
border-style: solid;
|
|
197
|
-
|
|
198
|
-
border-color: inherit;
|
|
199
|
-
}
|
|
200
|
-
</style>
|