@volverjs/ui-vue 0.0.1-beta.12 → 0.0.1-beta.16
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/bin/icons.cjs +73 -0
- package/bin/icons.js +75 -0
- package/dist/Volver.d.ts +15 -2
- package/dist/components/VvAccordion/VvAccordion.es.js +133 -236
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +32 -97
- package/dist/components/VvAccordion/index.d.ts +46 -0
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +199 -277
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +44 -151
- package/dist/components/VvAccordionGroup/{VvAccordionGroup.d.ts → index.d.ts} +9 -13
- package/dist/components/VvBadge/VvBadge.es.js +42 -151
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +12 -53
- package/dist/components/VvBadge/{VvBadge.d.ts → index.d.ts} +0 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +55 -168
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +24 -104
- package/dist/components/VvBreadcrumb/{VvBreadcrumb.d.ts → index.d.ts} +1 -1
- package/dist/components/VvButton/VvButton.es.js +298 -312
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +91 -163
- package/dist/components/VvButton/{VvButton.d.ts → index.d.ts} +46 -9
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +59 -172
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +30 -125
- package/dist/components/VvButtonGroup/{VvButtonGroup.d.ts → index.d.ts} +0 -0
- package/dist/components/VvCard/VvCard.es.js +55 -166
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +16 -61
- package/dist/components/VvCard/{VvCard.d.ts → index.d.ts} +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +344 -0
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -0
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +87 -0
- package/dist/components/VvCheckbox/index.d.ts +86 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +415 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +113 -0
- package/dist/components/{VvCheckGroup/VvCheckGroup.d.ts → VvCheckboxGroup/index.d.ts} +10 -10
- package/dist/components/VvDialog/VvDialog.es.js +108 -230
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +28 -132
- package/dist/components/VvDialog/{VvDialog.d.ts → index.d.ts} +2 -6
- package/dist/components/VvDropdown/VvDropdown.es.js +167 -186
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +34 -136
- package/dist/components/VvDropdown/{VvDropdown.d.ts → index.d.ts} +7 -3
- package/dist/components/VvIcon/VvIcon.es.js +62 -174
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +36 -150
- package/dist/components/VvIcon/{VvIcon.d.ts → index.d.ts} +9 -0
- package/dist/components/VvInputText/VvInputClearAction.d.ts +36 -0
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +56 -0
- package/dist/components/VvInputText/VvInputStepAction.d.ts +37 -0
- package/dist/components/VvInputText/VvInputText.es.js +586 -577
- package/dist/components/VvInputText/VvInputText.umd.js +1 -2
- package/dist/components/VvInputText/VvInputText.vue.d.ts +187 -275
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +175 -0
- package/dist/components/VvNativeSelect/VvNativeSelect.es.js +299 -347
- package/dist/components/VvNativeSelect/VvNativeSelect.umd.js +1 -2
- package/dist/components/VvNativeSelect/VvNativeSelect.vue.d.ts +78 -190
- package/dist/components/VvNativeSelect/{VvNativeSelect.d.ts → index.d.ts} +35 -8
- package/dist/components/VvProgress/VvProgress.es.js +45 -162
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +17 -103
- package/dist/components/VvProgress/{VvProgress.d.ts → index.d.ts} +1 -7
- package/dist/components/VvRadio/VvRadio.es.js +292 -267
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +52 -122
- package/dist/components/VvRadio/index.d.ts +64 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +342 -380
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -2
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +58 -213
- package/dist/components/VvRadioGroup/{VvRadioGroup.d.ts → index.d.ts} +2 -2
- package/dist/components/VvSelect/VvSelect.es.js +556 -510
- package/dist/components/VvSelect/VvSelect.umd.js +1 -2
- package/dist/components/VvSelect/VvSelect.vue.d.ts +75 -240
- package/dist/components/VvSelect/{VvSelect.d.ts → index.d.ts} +12 -5
- package/dist/components/VvTextarea/VvTextarea.es.js +372 -481
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -2
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +103 -299
- package/dist/components/VvTextarea/{VvTextarea.d.ts → index.d.ts} +36 -13
- package/dist/components/common/HintSlot.d.ts +10 -4
- package/dist/components/index.d.ts +13 -6
- package/dist/components/index.es.js +2070 -895
- package/dist/components/index.umd.js +1 -2
- package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -2
- package/dist/composables/focus/useComponentFocus.d.ts +3 -3
- package/dist/composables/group/types/IAccordionGroupState.d.ts +1 -3
- package/dist/composables/group/types/IGroupState.d.ts +2 -2
- package/dist/composables/group/useInjectedGroupState.d.ts +4 -4
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/icons/useComponentIcons.d.ts +2 -2
- package/dist/composables/textLimit/useTextLimit.d.ts +0 -3
- package/dist/constants.d.ts +4 -4
- package/dist/icons.d.ts +1881 -0
- package/dist/icons.es.js +4 -6
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +2113 -932
- package/dist/index.umd.js +1 -2
- package/dist/props/index.d.ts +9 -3
- package/dist/resolvers/unplugin.d.ts +27 -0
- package/dist/resolvers/unplugin.es.js +40 -0
- package/dist/resolvers/unplugin.umd.js +1 -0
- package/dist/stories/Accordion/Accordion.test.d.ts +4 -0
- package/dist/stories/Badge/Badge.test.d.ts +2 -0
- package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +2 -0
- package/dist/stories/Button/Button.test.d.ts +3 -8
- package/dist/stories/Card/Card.test.d.ts +3 -0
- package/dist/stories/Dialog/Dialog.test.d.ts +2 -0
- package/dist/stories/Dropdown/Dropdown.test.d.ts +2 -0
- package/dist/stories/Icon/IconList.vue.d.ts +1 -43
- package/dist/stories/InputText/InputText.test.d.ts +6 -0
- package/dist/stories/Radio/Radio.test.d.ts +3 -0
- package/dist/stories/RadioGroup/RadioGroup.test.d.ts +8 -0
- package/dist/stories/Select/Select.test.d.ts +3 -0
- package/dist/stories/Textarea/Textarea.test.d.ts +8 -0
- package/dist/stories/utils.d.ts +1 -3
- package/dist/test/sleep.d.ts +1 -0
- package/dist/utils/ObjectUtilities.d.ts +82 -95
- package/env.d.ts +1 -0
- package/package.json +102 -68
- package/src/Volver.ts +32 -3
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +80 -76
- package/src/components/VvAccordion/index.ts +69 -0
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +77 -41
- package/src/components/VvAccordionGroup/{VvAccordionGroup.ts → index.ts} +8 -12
- package/src/components/VvBadge/VvBadge.vue +14 -10
- package/src/components/VvBadge/{VvBadge.ts → index.ts} +0 -0
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +18 -19
- package/src/components/VvBreadcrumb/{VvBreadcrumb.ts → index.ts} +1 -1
- package/src/components/VvButton/VvButton.vue +123 -113
- package/src/components/VvButton/index.ts +147 -0
- package/src/components/VvButtonGroup/VvButtonGroup.vue +21 -17
- package/src/components/VvButtonGroup/{VvButtonGroup.ts → index.ts} +0 -0
- package/src/components/VvCard/VvCard.vue +20 -22
- package/src/components/VvCard/{VvCard.ts → index.ts} +0 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +124 -0
- package/src/components/VvCheckbox/index.ts +94 -0
- package/src/components/{VvCheckGroup/VvCheckGroup.vue → VvCheckboxGroup/VvCheckboxGroup.vue} +49 -54
- package/src/components/{VvCheckGroup/VvCheckGroup.ts → VvCheckboxGroup/index.ts} +9 -9
- package/src/components/VvDialog/VvDialog.vue +47 -50
- package/src/components/VvDialog/index.ts +10 -0
- package/src/components/VvDropdown/VvDropdown.vue +61 -40
- package/src/components/VvDropdown/{VvDropdown.ts → index.ts} +8 -4
- package/src/components/VvIcon/VvIcon.vue +31 -25
- package/src/components/VvIcon/{VvIcon.ts → index.ts} +9 -0
- package/src/components/VvInputText/VvInputClearAction.ts +53 -0
- package/src/components/VvInputText/VvInputPasswordAction.ts +70 -0
- package/src/components/VvInputText/VvInputStepAction.ts +49 -0
- package/src/components/VvInputText/VvInputText.vue +168 -170
- package/src/components/VvInputText/VvInputTextActions.ts +54 -108
- package/src/components/VvInputText/index.ts +135 -0
- package/src/components/VvNativeSelect/VvNativeSelect.vue +130 -68
- package/src/components/VvNativeSelect/{VvNativeSelect.ts → index.ts} +26 -7
- package/src/components/VvProgress/VvProgress.vue +25 -26
- package/src/components/VvProgress/{VvProgress.ts → index.ts} +4 -7
- package/src/components/VvRadio/VvRadio.vue +81 -108
- package/src/components/VvRadio/index.ts +78 -0
- package/src/components/VvRadioGroup/VvRadioGroup.vue +45 -45
- package/src/components/VvRadioGroup/{VvRadioGroup.ts → index.ts} +1 -1
- package/src/components/VvSelect/VvSelect.vue +90 -69
- package/src/components/VvSelect/{VvSelect.ts → index.ts} +12 -5
- package/src/components/VvTextarea/VvTextarea.vue +121 -128
- package/src/components/VvTextarea/{VvTextarea.ts → index.ts} +31 -11
- package/src/components/common/HintSlot.ts +157 -136
- package/src/components/index.ts +13 -6
- package/src/composables/debouncedInput/useDebouncedInput.ts +21 -15
- package/src/composables/focus/useComponentFocus.ts +6 -8
- package/src/composables/group/types/IAccordionGroupState.ts +1 -3
- package/src/composables/group/types/IGroupState.ts +2 -2
- package/src/composables/group/useInjectedGroupState.ts +20 -30
- package/src/composables/group/useProvideGroupState.ts +1 -2
- package/src/composables/icons/useComponentIcons.ts +2 -3
- package/src/composables/options/useOptions.ts +3 -0
- package/src/composables/textLimit/useTextLimit.ts +1 -4
- package/src/composables/useModifiers.ts +13 -15
- package/src/constants.ts +5 -7
- package/src/directives/{.README → .gitkeep} +0 -0
- package/src/icons.ts +7 -0
- package/src/index.ts +0 -1
- package/src/props/index.ts +7 -1
- package/src/resolvers/unplugin.ts +103 -0
- package/src/shims.d.ts +11 -0
- package/src/stories/Accordion/Accordion.stories.mdx +10 -9
- package/src/stories/Accordion/Accordion.test.ts +37 -0
- package/src/stories/Accordion/AccordionSlots.stories.mdx +40 -25
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +10 -16
- package/src/stories/AccordionGroup/{accordionGroupTest.js → AccordionGroup.test.js} +15 -17
- package/src/stories/AccordionGroup/AccordionGroupCollapse.stories.mdx +38 -0
- package/src/stories/AccordionGroup/{AccordionItems.stories.mdx → AccordionGroupItems.stories.mdx} +7 -13
- package/src/stories/Badge/Badge.stories.mdx +8 -8
- package/src/stories/Badge/Badge.test.ts +16 -0
- package/src/stories/Badge/BadgeColor.stories.mdx +6 -7
- package/src/stories/Badge/BadgeDot.stories.mdx +4 -3
- package/src/stories/Badge/BadgeModifiers.stories.mdx +7 -6
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +15 -7
- package/src/stories/Breadcrumb/Breadcrumb.test.ts +49 -0
- package/src/stories/Breadcrumb/BreadcrumbMultiline.stories.mdx +15 -7
- package/src/stories/Button/Button.stories.mdx +16 -17
- package/src/stories/Button/Button.test.ts +8 -12
- package/src/stories/Button/ButtonActive.stories.mdx +2 -1
- package/src/stories/Button/ButtonBadge.stories.mdx +2 -2
- package/src/stories/Button/ButtonDisabled.stories.mdx +1 -1
- package/src/stories/Button/ButtonIcon.stories.mdx +6 -3
- package/src/stories/Button/ButtonIconPosition.stories.mdx +1 -1
- package/src/stories/Button/ButtonLink.stories.mdx +1 -19
- package/src/stories/Button/ButtonLoading.stories.mdx +4 -4
- package/src/stories/Button/ButtonModifiers.stories.mdx +1 -1
- package/src/stories/Button/ButtonPressed.stories.mdx +31 -0
- package/src/stories/Button/ButtonSlots.stories.mdx +1 -1
- package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +5 -6
- package/src/stories/ButtonGroup/{ButtonGroupTest.js → ButtonGroup.test.js} +6 -28
- package/src/stories/ButtonGroup/ButtonGroupAction.stories.mdx +5 -6
- package/src/stories/ButtonGroup/ButtonGroupActionQuiet.stories.mdx +3 -4
- package/src/stories/ButtonGroup/ButtonGroupBlock.stories.mdx +3 -4
- package/src/stories/ButtonGroup/ButtonGroupCompact.stories.mdx +3 -4
- package/src/stories/ButtonGroup/ButtonGroupRounded.stories.mdx +3 -4
- package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +11 -12
- package/src/stories/ButtonGroup/ButtonGroupVertical.stories.mdx +3 -4
- package/src/stories/Card/Card.stories.mdx +7 -5
- package/src/stories/Card/Card.test.ts +26 -0
- package/src/stories/Card/CardSlots.stories.mdx +5 -5
- package/src/stories/Card/CardVariant.stories.mdx +5 -4
- package/src/stories/Checkbox/Checkbox.stories.mdx +51 -0
- package/src/stories/Checkbox/Checkbox.test.js +115 -0
- package/src/stories/Checkbox/CheckboxBinary.stories.mdx +76 -0
- package/src/stories/{Check/CheckDisabled.stories.mdx → Checkbox/CheckboxDisabled.stories.mdx} +7 -7
- package/src/stories/Checkbox/CheckboxError.stories.mdx +43 -0
- package/src/stories/Checkbox/CheckboxHintLabel.stories.mdx +35 -0
- package/src/stories/{Check/CheckReadonly.stories.mdx → Checkbox/CheckboxReadonly.stories.mdx} +6 -8
- package/src/stories/Checkbox/CheckboxSlots.stories.mdx +69 -0
- package/src/stories/{Check/CheckSwitch.stories.mdx → Checkbox/CheckboxSwitch.stories.mdx} +8 -8
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +69 -0
- package/src/stories/CheckboxGroup/CheckboxGroupDisabled.stories.mdx +26 -0
- package/src/stories/CheckboxGroup/CheckboxGroupError.stories.mdx +28 -0
- package/src/stories/CheckboxGroup/CheckboxGroupHintLabel.stories.mdx +27 -0
- package/src/stories/CheckboxGroup/CheckboxGroupLabel.stories.mdx +26 -0
- package/src/stories/{CheckGroup/CheckGroupOptionLabel.stories.mdx → CheckboxGroup/CheckboxGroupOptionLabel.stories.mdx} +14 -11
- package/src/stories/{CheckGroup/CheckGroupOptionValue.stories.mdx → CheckboxGroup/CheckboxGroupOptionValue.stories.mdx} +13 -10
- package/src/stories/{CheckGroup/CheckGroupOptions.stories.mdx → CheckboxGroup/CheckboxGroupOptions.stories.mdx} +8 -8
- package/src/stories/CheckboxGroup/CheckboxGroupReadonly.stories.mdx +26 -0
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +152 -0
- package/src/stories/CheckboxGroup/CheckboxGroupValid.stories.mdx +28 -0
- package/src/stories/CheckboxGroup/CheckboxGroupVertical.stories.mdx +26 -0
- package/src/stories/Dialog/Dialog.stories.mdx +5 -5
- package/src/stories/Dialog/Dialog.test.ts +26 -0
- package/src/stories/Dialog/DialogAutoClose.stories.mdx +1 -1
- package/src/stories/Dialog/DialogSize.stories.mdx +1 -1
- package/src/stories/Dropdown/Dropdown.stories.mdx +11 -7
- package/src/stories/Dropdown/Dropdown.test.ts +80 -0
- package/src/stories/Dropdown/DropdownDisabled.stories.mdx +9 -2
- package/src/stories/Dropdown/DropdownLabelNoResults.stories.mdx +2 -2
- package/src/stories/Dropdown/DropdownMaxValues.stories.mdx +4 -2
- package/src/stories/Dropdown/DropdownMultiple.stories.mdx +4 -2
- package/src/stories/Dropdown/DropdownOptions.stories.mdx +4 -4
- package/src/stories/Dropdown/DropdownUseObject.stories.mdx +4 -2
- package/src/stories/Icon/Icon.stories.mdx +8 -8
- package/src/stories/Icon/{IconTest.js → Icon.test.js} +2 -5
- package/src/stories/Icon/IconList.vue +5 -6
- package/src/stories/Icon/IconPrefix.stories.mdx +2 -2
- package/src/stories/Icon/IconRemote.stories.mdx +2 -2
- package/src/stories/Icon/IconsList.stories.mdx +2 -18
- package/src/stories/InputText/InputText.stories.mdx +25 -19
- package/src/stories/InputText/InputText.test.ts +156 -0
- package/src/stories/InputText/InputTextAutocomplete.stories.mdx +9 -2
- package/src/stories/InputText/InputTextAutofocus.stories.mdx +6 -3
- package/src/stories/InputText/InputTextDisabled.stories.mdx +10 -2
- package/src/stories/InputText/InputTextError.stories.mdx +10 -2
- package/src/stories/InputText/InputTextFloating.stories.mdx +10 -3
- package/src/stories/InputText/InputTextHintLabel.stories.mdx +10 -2
- package/src/stories/InputText/InputTextIcon.stories.mdx +6 -2
- package/src/stories/InputText/InputTextIconPosition.stories.mdx +10 -3
- package/src/stories/InputText/InputTextLabel.stories.mdx +8 -2
- package/src/stories/InputText/InputTextLoading.stories.mdx +10 -2
- package/src/stories/InputText/InputTextMax.stories.mdx +10 -3
- package/src/stories/InputText/InputTextMaxLength.stories.mdx +22 -5
- package/src/stories/InputText/InputTextMin.stories.mdx +10 -3
- package/src/stories/InputText/InputTextMinLength.stories.mdx +9 -2
- package/src/stories/InputText/InputTextPlaceholder.stories.mdx +8 -2
- package/src/stories/InputText/InputTextReadonly.stories.mdx +6 -2
- package/src/stories/InputText/InputTextSlots.stories.mdx +4 -5
- package/src/stories/InputText/InputTextStep.stories.mdx +9 -3
- package/src/stories/InputText/InputTextType.stories.mdx +110 -13
- package/src/stories/InputText/InputTextValid.stories.mdx +10 -2
- package/src/stories/NativeSelect/NativeSelect.stories.mdx +15 -11
- package/src/stories/NativeSelect/NativeSelect.test.js +151 -0
- package/src/stories/NativeSelect/NativeSelectDisabled.stories.mdx +6 -7
- package/src/stories/NativeSelect/NativeSelectError.stories.mdx +7 -3
- package/src/stories/NativeSelect/NativeSelectHintLabel.stories.mdx +7 -3
- package/src/stories/NativeSelect/NativeSelectIconLeftRight.stories.mdx +14 -12
- package/src/stories/NativeSelect/NativeSelectLoading.stories.mdx +7 -3
- package/src/stories/NativeSelect/NativeSelectOptions.stories.mdx +44 -38
- package/src/stories/NativeSelect/NativeSelectReadonly.stories.mdx +19 -11
- package/src/stories/NativeSelect/NativeSelectUseObject.stories.mdx +26 -30
- package/src/stories/NativeSelect/NativeSelectValid.stories.mdx +7 -3
- package/src/stories/NativeSelect/NativeSelectValueKey.stories.mdx +30 -30
- package/src/stories/Progress/Progress.stories.mdx +8 -11
- package/src/stories/Progress/{ProgressTest.js → Progress.test.js} +4 -10
- package/src/stories/Progress/ProgressDeterminate.stories.mdx +3 -6
- package/src/stories/Radio/Radio.stories.mdx +11 -17
- package/src/stories/Radio/Radio.test.ts +52 -0
- package/src/stories/Radio/RadioDisabled.stories.mdx +4 -7
- package/src/stories/Radio/RadioError.stories.mdx +8 -28
- package/src/stories/Radio/RadioHintLabel.stories.mdx +6 -7
- package/src/stories/Radio/RadioSlots.stories.mdx +21 -7
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +20 -27
- package/src/stories/RadioGroup/RadioGroup.test.ts +139 -0
- package/src/stories/RadioGroup/RadioGroupDisabled.stories.mdx +6 -8
- package/src/stories/RadioGroup/RadioGroupError.stories.mdx +9 -11
- package/src/stories/RadioGroup/RadioGroupHintLabel.stories.mdx +8 -10
- package/src/stories/RadioGroup/RadioGroupLabel.stories.mdx +6 -8
- package/src/stories/RadioGroup/RadioGroupOptionLabel.stories.mdx +11 -13
- package/src/stories/RadioGroup/RadioGroupOptionValue.stories.mdx +9 -11
- package/src/stories/RadioGroup/RadioGroupOptions.stories.mdx +7 -9
- package/src/stories/RadioGroup/RadioGroupReadonly.stories.mdx +6 -8
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +39 -62
- package/src/stories/RadioGroup/RadioGroupValid.stories.mdx +9 -11
- package/src/stories/RadioGroup/RadioGroupVertical.stories.mdx +6 -8
- package/src/stories/Select/Select.stories.mdx +32 -29
- package/src/stories/Select/Select.test.ts +104 -0
- package/src/stories/Select/SelectDisabled.stories.mdx +3 -3
- package/src/stories/Select/SelectMaxValues.stories.mdx +3 -3
- package/src/stories/Select/SelectMultiple.stories.mdx +5 -6
- package/src/stories/Select/SelectNative.stories.mdx +6 -8
- package/src/stories/Select/SelectOptions.stories.mdx +4 -4
- package/src/stories/Select/SelectSearchable.stories.mdx +13 -12
- package/src/stories/Select/SelectSeparator.stories.mdx +3 -3
- package/src/stories/Select/SelectUseObject.stories.mdx +3 -3
- package/src/stories/Textarea/Textarea.stories.mdx +6 -10
- package/src/stories/Textarea/Textarea.test.ts +204 -0
- package/src/stories/Textarea/TextareaAutoclear.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaAutofocus.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaDebounce.stories.mdx +7 -6
- package/src/stories/Textarea/TextareaDisabled.stories.mdx +9 -3
- package/src/stories/Textarea/TextareaError.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +12 -2
- package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaHintLabel.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaIcon.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaIconPosition.stories.mdx +4 -2
- package/src/stories/Textarea/TextareaId.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaLabel.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaLimit.stories.mdx +5 -2
- package/src/stories/Textarea/TextareaLoading.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +9 -3
- package/src/stories/Textarea/TextareaMaxLength.stories.mdx +5 -4
- package/src/stories/Textarea/TextareaMinLength.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaModifiers.stories.mdx +10 -2
- package/src/stories/Textarea/TextareaName.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +4 -3
- package/src/stories/Textarea/TextareaReadonly.stories.mdx +8 -3
- package/src/stories/Textarea/TextareaRequired.stories.mdx +3 -2
- package/src/stories/Textarea/TextareaResizable.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaRowsCols.stories.mdx +4 -2
- package/src/stories/Textarea/TextareaSlots.stories.mdx +7 -8
- package/src/stories/Textarea/TextareaValid.stories.mdx +7 -1
- package/src/stories/Textarea/TextareaValidLabel.stories.mdx +14 -4
- package/src/stories/utils.ts +1 -1
- package/src/stories/volver-ui-vue.stories.mdx +1 -1
- package/src/test/expect.ts +3 -1
- package/src/test/sleep.ts +2 -0
- package/src/test/types.d.ts +14 -1
- package/src/types/{.README → .gitkeep} +0 -0
- package/src/utils/ObjectUtilities.ts +247 -241
- package/dist/components/VvAccordion/VvAccordion.d.ts +0 -32
- package/dist/components/VvAccordion/useAccordionProps.d.ts +0 -16
- package/dist/components/VvButton/useButtonGroupProps.d.ts +0 -18
- package/dist/components/VvCheck/VvCheck.d.ts +0 -47
- package/dist/components/VvCheck/VvCheck.es.js +0 -318
- package/dist/components/VvCheck/VvCheck.umd.js +0 -1
- package/dist/components/VvCheck/VvCheck.vue.d.ts +0 -165
- package/dist/components/VvCheck/useCheckProps.d.ts +0 -16
- package/dist/components/VvCheckGroup/VvCheckGroup.es.js +0 -451
- package/dist/components/VvCheckGroup/VvCheckGroup.umd.js +0 -2
- package/dist/components/VvCheckGroup/VvCheckGroup.vue.d.ts +0 -272
- package/dist/components/VvDialog/constants.d.ts +0 -5
- package/dist/components/VvInputText/VvInputText.d.ts +0 -73
- package/dist/components/VvInputText/constants.d.ts +0 -55
- package/dist/components/VvRadio/VvRadio.d.ts +0 -22
- package/dist/components/VvRadio/useRadioProps.d.ts +0 -15
- package/dist/components/VvTextarea/constants.d.ts +0 -19
- package/dist/stories/RadioGroup/RadioOption.test.d.ts +0 -4
- package/dist/stories/RadioGroup/RadioProperty.test.d.ts +0 -12
- package/dist/stories/RadioGroup/RadioSlots.test.d.ts +0 -6
- package/src/assets/icons/index.js +0 -7
- package/src/components/VvAccordion/VvAccordion.ts +0 -34
- package/src/components/VvAccordion/useAccordionProps.ts +0 -45
- package/src/components/VvButton/VvButton.ts +0 -87
- package/src/components/VvButton/useButtonGroupProps.ts +0 -43
- package/src/components/VvCheck/VvCheck.ts +0 -48
- package/src/components/VvCheck/VvCheck.vue +0 -147
- package/src/components/VvCheck/useCheckProps.ts +0 -41
- package/src/components/VvDialog/VvDialog.ts +0 -17
- package/src/components/VvDialog/constants.ts +0 -5
- package/src/components/VvInputText/VvInputText.ts +0 -66
- package/src/components/VvInputText/constants.ts +0 -34
- package/src/components/VvRadio/VvRadio.ts +0 -25
- package/src/components/VvRadio/useRadioProps.ts +0 -40
- package/src/components/VvTextarea/constants.ts +0 -14
- package/src/stories/Accordion/AccordionBordered.stories.mdx +0 -26
- package/src/stories/Accordion/AccordionIconRight.stories.mdx +0 -32
- package/src/stories/Accordion/accordionTest.js +0 -36
- package/src/stories/AccordionGroup/Accordion.stories.mdx +0 -42
- package/src/stories/Badge/BadgeTest.js +0 -21
- package/src/stories/Button/ButtonSelected.stories.mdx +0 -30
- package/src/stories/Check/Check.stories.mdx +0 -62
- package/src/stories/Check/CheckBinary.stories.mdx +0 -75
- package/src/stories/Check/CheckError.stories.mdx +0 -64
- package/src/stories/Check/CheckErrorTests.js +0 -74
- package/src/stories/Check/CheckHintLabel.stories.mdx +0 -30
- package/src/stories/Check/CheckPropertyTest.js +0 -102
- package/src/stories/Check/CheckSlots.stories.mdx +0 -51
- package/src/stories/CheckGroup/CheckGroup.stories.mdx +0 -69
- package/src/stories/CheckGroup/CheckGroupDisabled.stories.mdx +0 -26
- package/src/stories/CheckGroup/CheckGroupError.stories.mdx +0 -28
- package/src/stories/CheckGroup/CheckGroupHintLabel.stories.mdx +0 -27
- package/src/stories/CheckGroup/CheckGroupLabel.stories.mdx +0 -26
- package/src/stories/CheckGroup/CheckGroupReadonly.stories.mdx +0 -26
- package/src/stories/CheckGroup/CheckGroupSlots.stories.mdx +0 -152
- package/src/stories/CheckGroup/CheckGroupValid.stories.mdx +0 -28
- package/src/stories/CheckGroup/CheckGroupVertical.stories.mdx +0 -26
- package/src/stories/RadioGroup/RadioOption.test.ts +0 -45
- package/src/stories/RadioGroup/RadioProperty.test.ts +0 -87
- package/src/stories/RadioGroup/RadioSlots.test.ts +0 -29
- package/src/stories/stories.scss +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModifiersProps } from '
|
|
1
|
+
import { ModifiersProps } from '@/props'
|
|
2
2
|
|
|
3
3
|
export const VvProgressProps = {
|
|
4
4
|
...ModifiersProps,
|
|
@@ -6,7 +6,8 @@ export const VvProgressProps = {
|
|
|
6
6
|
* Progress value
|
|
7
7
|
*/
|
|
8
8
|
value: {
|
|
9
|
-
type: [Number, String]
|
|
9
|
+
type: [Number, String],
|
|
10
|
+
default: undefined
|
|
10
11
|
},
|
|
11
12
|
/**
|
|
12
13
|
* Progress max value
|
|
@@ -20,9 +21,5 @@ export const VvProgressProps = {
|
|
|
20
21
|
ariaLabel: {
|
|
21
22
|
type: String,
|
|
22
23
|
default: 'progress-bar'
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* determinate attribute
|
|
26
|
-
*/
|
|
27
|
-
determinate: { type: Boolean, default: false }
|
|
24
|
+
}
|
|
28
25
|
}
|
|
@@ -1,130 +1,103 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
v-bind="radioInputAttrs"
|
|
7
|
-
@input="onChange" />
|
|
8
|
-
<slot :value="modelValue">
|
|
9
|
-
{{ label }}
|
|
10
|
-
</slot>
|
|
11
|
-
</label>
|
|
12
|
-
</template>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvRadio'
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
13
6
|
|
|
14
7
|
<script setup lang="ts">
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
import { computed, useAttrs, ref } from 'vue'
|
|
18
|
-
import ObjectUtilities from '../../utils/ObjectUtilities'
|
|
19
|
-
import { VvRadioProps, VvRadioEvents } from './VvRadio'
|
|
20
|
-
|
|
21
|
-
//Composables
|
|
22
|
-
import { toRadioInputRefs } from './useRadioProps'
|
|
23
|
-
import { useComponentFocus } from '../../composables/focus/useComponentFocus'
|
|
8
|
+
import { computed, ref, useSlots } from 'vue'
|
|
9
|
+
import { contains, equals, removeFromList } from '@/utils/ObjectUtilities'
|
|
24
10
|
import { useBemModifiers } from '@/composables/useModifiers'
|
|
11
|
+
import {
|
|
12
|
+
VvRadioProps,
|
|
13
|
+
VvRadioEvents,
|
|
14
|
+
useGroupProps
|
|
15
|
+
} from '@/components/VvRadio'
|
|
16
|
+
import { HintSlotFactory } from '@/components/common/HintSlot'
|
|
25
17
|
|
|
26
|
-
//
|
|
18
|
+
// props, emit and slots
|
|
27
19
|
const props = defineProps(VvRadioProps)
|
|
28
20
|
const emit = defineEmits(VvRadioEvents)
|
|
29
|
-
const
|
|
21
|
+
const slots = useSlots()
|
|
30
22
|
|
|
31
|
-
//
|
|
32
|
-
const { disabled, readonly, modelValue, valid, error } =
|
|
23
|
+
// data
|
|
24
|
+
const { disabled, readonly, modelValue, valid, error } = useGroupProps(
|
|
33
25
|
props,
|
|
34
26
|
emit
|
|
35
27
|
)
|
|
36
28
|
|
|
37
|
-
//
|
|
29
|
+
// template refs
|
|
38
30
|
const input = ref()
|
|
39
31
|
|
|
40
|
-
//
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
? ObjectUtilities.contains(props.value, modelValue.value)
|
|
44
|
-
: ObjectUtilities.equals(props.value, modelValue.value)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
// #region FOCUS
|
|
48
|
-
const { focused } = useComponentFocus(input, emit)
|
|
49
|
-
// #endregion FOCUS
|
|
50
|
-
|
|
51
|
-
//Styles & Bindings
|
|
52
|
-
const { bemCssClasses: bemRadioClass } = useBemModifiers('vv-input-radio', {
|
|
53
|
-
valid,
|
|
54
|
-
invalid: error
|
|
55
|
-
})
|
|
56
|
-
const { bemCssClasses: bemInputRadioClass } = useBemModifiers(
|
|
57
|
-
'vv-input-radio__input',
|
|
58
|
-
{
|
|
59
|
-
checked: isChecked,
|
|
60
|
-
disabled,
|
|
61
|
-
readonly
|
|
62
|
-
}
|
|
32
|
+
// computed
|
|
33
|
+
const hasId = computed(() =>
|
|
34
|
+
props.id !== undefined ? String(props.id) : undefined
|
|
63
35
|
)
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
36
|
+
const isDisabled = computed(() => disabled.value || readonly.value)
|
|
37
|
+
const hasTabindex = computed(() => (isDisabled.value ? -1 : props.tabindex))
|
|
38
|
+
const isInvalid = computed(() => {
|
|
39
|
+
if (props.error === true) {
|
|
40
|
+
return true
|
|
69
41
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
'focus-visible': focused.value,
|
|
74
|
-
...bemInputRadioClass.value
|
|
42
|
+
if (props.valid === true) {
|
|
43
|
+
return false
|
|
75
44
|
}
|
|
45
|
+
return undefined
|
|
76
46
|
})
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
const radioInputAriaAttrs = computed(() => {
|
|
102
|
-
const { name } = attrs
|
|
103
|
-
const dataAttrs = ObjectUtilities.pickBy(attrs, (k: string) =>
|
|
104
|
-
k.startsWith('aria-')
|
|
105
|
-
)
|
|
106
|
-
return {
|
|
107
|
-
'aria-label': name,
|
|
108
|
-
'aria-checked': isChecked.value,
|
|
109
|
-
...dataAttrs
|
|
47
|
+
const isChecked = computed(() =>
|
|
48
|
+
Array.isArray(modelValue.value)
|
|
49
|
+
? contains(props.value, modelValue.value)
|
|
50
|
+
: equals(props.value, modelValue.value)
|
|
51
|
+
)
|
|
52
|
+
const hasValue = computed(() =>
|
|
53
|
+
['string', 'number', 'boolean'].includes(typeof props.value)
|
|
54
|
+
? props.value
|
|
55
|
+
: true
|
|
56
|
+
)
|
|
57
|
+
const localModelValue = computed({
|
|
58
|
+
get() {
|
|
59
|
+
return isChecked.value ? hasValue.value : null
|
|
60
|
+
},
|
|
61
|
+
set(newValue) {
|
|
62
|
+
if (Array.isArray(modelValue.value)) {
|
|
63
|
+
modelValue.value = newValue
|
|
64
|
+
? [...modelValue.value, props.value]
|
|
65
|
+
: removeFromList(props.value, modelValue.value)
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
modelValue.value = props.value
|
|
69
|
+
emit('change', newValue)
|
|
110
70
|
}
|
|
111
71
|
})
|
|
112
72
|
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
emit('click', event)
|
|
121
|
-
focused.value = true
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
</script>
|
|
73
|
+
// styles
|
|
74
|
+
const { bemCssClasses } = useBemModifiers('vv-radio', {
|
|
75
|
+
valid,
|
|
76
|
+
invalid: error,
|
|
77
|
+
disabled,
|
|
78
|
+
readonly
|
|
79
|
+
})
|
|
125
80
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
inheritAttrs: false
|
|
129
|
-
}
|
|
81
|
+
// hint
|
|
82
|
+
const { HintSlot } = HintSlotFactory(props, slots)
|
|
130
83
|
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<label :class="bemCssClasses" :for="hasId">
|
|
87
|
+
<input
|
|
88
|
+
:id="hasId"
|
|
89
|
+
ref="input"
|
|
90
|
+
v-model="localModelValue"
|
|
91
|
+
type="radio"
|
|
92
|
+
class="vv-radio__input"
|
|
93
|
+
:name="name"
|
|
94
|
+
:disabled="isDisabled"
|
|
95
|
+
:value="hasValue"
|
|
96
|
+
:tabindex="hasTabindex"
|
|
97
|
+
:aria-invalid="isInvalid" />
|
|
98
|
+
<slot :value="modelValue">
|
|
99
|
+
{{ label }}
|
|
100
|
+
</slot>
|
|
101
|
+
<HintSlot class="vv-radio__hint" :params="{ value: modelValue }" />
|
|
102
|
+
</label>
|
|
103
|
+
</template>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type Ref, toRefs } from 'vue'
|
|
2
|
+
import type { IInputGroupState } from '@/composables/group/types/IInputGroup'
|
|
3
|
+
import { ValidProps, ErrorProps, HintProps } from '@/props'
|
|
4
|
+
import { useInjectedGroupState } from '@/composables/group/useInjectedGroupState'
|
|
5
|
+
import { VV_RADIO_GROUP } from '@/constants'
|
|
6
|
+
|
|
7
|
+
export const VvRadioProps = {
|
|
8
|
+
...ValidProps,
|
|
9
|
+
...ErrorProps,
|
|
10
|
+
...HintProps,
|
|
11
|
+
/**
|
|
12
|
+
* Input id
|
|
13
|
+
*/
|
|
14
|
+
id: [String, Number],
|
|
15
|
+
/**
|
|
16
|
+
* Input name
|
|
17
|
+
*/
|
|
18
|
+
name: { type: String, required: true },
|
|
19
|
+
/**
|
|
20
|
+
* Input value
|
|
21
|
+
*/
|
|
22
|
+
value: [String, Number, Boolean],
|
|
23
|
+
/**
|
|
24
|
+
* Input value
|
|
25
|
+
*/
|
|
26
|
+
modelValue: [Object, Number, Boolean, String],
|
|
27
|
+
/**
|
|
28
|
+
* Input name
|
|
29
|
+
*/
|
|
30
|
+
label: String,
|
|
31
|
+
/**
|
|
32
|
+
* If true, the input will be disabled
|
|
33
|
+
*/
|
|
34
|
+
disabled: Boolean,
|
|
35
|
+
/**
|
|
36
|
+
* If true, the input will be readonly
|
|
37
|
+
*/
|
|
38
|
+
readonly: Boolean,
|
|
39
|
+
/**
|
|
40
|
+
* Sequential keyboard navigation
|
|
41
|
+
*/
|
|
42
|
+
tabindex: { type: [String, Number], default: 0 }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const VvRadioEvents = ['click', 'update:modelValue', 'change', 'blur']
|
|
46
|
+
|
|
47
|
+
export type VvRadioPropsType = ExtractPropTypes<typeof VvRadioProps>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Merges local and group props
|
|
51
|
+
*/
|
|
52
|
+
export function useGroupProps(
|
|
53
|
+
props: VvRadioPropsType,
|
|
54
|
+
emit: (event: typeof VvRadioEvents[number], value: unknown) => void
|
|
55
|
+
) {
|
|
56
|
+
const { group, isInGroup, getGroupOrLocalRef } =
|
|
57
|
+
useInjectedGroupState<IInputGroupState>(VV_RADIO_GROUP)
|
|
58
|
+
|
|
59
|
+
// local props
|
|
60
|
+
const { valid, error } = toRefs(props)
|
|
61
|
+
|
|
62
|
+
// global props
|
|
63
|
+
const modelValue = getGroupOrLocalRef('modelValue', props, emit)
|
|
64
|
+
const readonly = getGroupOrLocalRef('readonly', props) as Ref<boolean>
|
|
65
|
+
const disabled = getGroupOrLocalRef('disabled', props) as Ref<boolean>
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
// local props
|
|
69
|
+
valid,
|
|
70
|
+
error,
|
|
71
|
+
// global props
|
|
72
|
+
group,
|
|
73
|
+
isInGroup,
|
|
74
|
+
modelValue,
|
|
75
|
+
readonly,
|
|
76
|
+
disabled
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -1,52 +1,36 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<template v-if="options.length > 0">
|
|
7
|
-
<vv-radio
|
|
8
|
-
v-for="(o, oIndex) in options"
|
|
9
|
-
:key="oIndex"
|
|
10
|
-
v-bind="getOptionProps(o, oIndex)" />
|
|
11
|
-
</template>
|
|
12
|
-
<!-- #endregion options set up -->
|
|
13
|
-
<!-- #region default -->
|
|
14
|
-
<slot v-else />
|
|
15
|
-
<!-- #endregion default -->
|
|
16
|
-
</div>
|
|
17
|
-
<!-- @slot error,valid,hint,loading vanno vanno qua -->
|
|
18
|
-
<HintSlot class="vv-input-radio-group__hint" />
|
|
19
|
-
</fieldset>
|
|
20
|
-
</template>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvRadioGroup'
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
21
6
|
|
|
22
7
|
<script setup lang="ts">
|
|
23
8
|
import { useSlots, computed, toRefs } from 'vue'
|
|
24
9
|
import type { IInputGroupState } from '@/composables/group/types/IInputGroup'
|
|
25
|
-
import { VvRadioGroupProps, VvRadioGroupEvents } from './VvRadioGroup'
|
|
26
|
-
|
|
27
|
-
//Composables
|
|
28
10
|
import { useVModel } from '@vueuse/core'
|
|
29
|
-
import { useProvideGroupState } from '
|
|
30
|
-
import { useOptions } from '
|
|
11
|
+
import { useProvideGroupState } from '@/composables/group/useProvideGroupState'
|
|
12
|
+
import { useOptions } from '@/composables/options/useOptions'
|
|
31
13
|
import { useBemModifiers } from '@/composables/useModifiers'
|
|
14
|
+
import { VV_RADIO_GROUP } from '@/constants'
|
|
15
|
+
import { HintSlotFactory } from '@/components/common/HintSlot'
|
|
16
|
+
import VvRadio from '@/components/VvRadio/VvRadio.vue'
|
|
17
|
+
import {
|
|
18
|
+
VvRadioGroupProps,
|
|
19
|
+
VvRadioGroupEvents
|
|
20
|
+
} from '@/components/VvRadioGroup'
|
|
32
21
|
|
|
33
|
-
//
|
|
34
|
-
import { VV_RADIO_GROUP } from '../../constants'
|
|
35
|
-
|
|
36
|
-
//Components
|
|
37
|
-
import VvRadio from '../../components/VvRadio/VvRadio.vue'
|
|
38
|
-
import { HintSlotFactory } from '../common/HintSlot'
|
|
39
|
-
|
|
40
|
-
//Props, Emits, Slots e Attrs
|
|
41
|
-
const emit = defineEmits(VvRadioGroupEvents)
|
|
22
|
+
// props, emit and slots
|
|
42
23
|
const props = defineProps(VvRadioGroupProps)
|
|
24
|
+
const emit = defineEmits(VvRadioGroupEvents)
|
|
43
25
|
const slots = useSlots()
|
|
44
26
|
|
|
45
|
-
//
|
|
27
|
+
// hint
|
|
28
|
+
const { HintSlot } = HintSlotFactory(props, slots)
|
|
29
|
+
|
|
30
|
+
// data
|
|
46
31
|
const modelValue = useVModel(props, 'modelValue', emit)
|
|
47
32
|
const { disabled, readonly, vertical, valid, error } = toRefs(props)
|
|
48
33
|
|
|
49
|
-
// #region group
|
|
50
34
|
const groupState: IInputGroupState = {
|
|
51
35
|
key: VV_RADIO_GROUP,
|
|
52
36
|
modelValue,
|
|
@@ -54,27 +38,43 @@ const groupState: IInputGroupState = {
|
|
|
54
38
|
readonly
|
|
55
39
|
}
|
|
56
40
|
useProvideGroupState(groupState)
|
|
57
|
-
// #endregion group
|
|
58
41
|
|
|
59
|
-
//OPTIONS
|
|
60
42
|
const { getOptionLabel, getOptionValue } = useOptions(props)
|
|
61
43
|
|
|
62
|
-
//
|
|
63
|
-
const { bemCssClasses: groupClass } = useBemModifiers('vv-
|
|
44
|
+
// styles
|
|
45
|
+
const { bemCssClasses: groupClass } = useBemModifiers('vv-radio-group', {
|
|
64
46
|
horizontal: computed(() => !vertical.value),
|
|
65
47
|
valid,
|
|
66
48
|
invalid: error
|
|
67
49
|
})
|
|
68
50
|
|
|
69
|
-
//
|
|
70
|
-
|
|
51
|
+
// methods
|
|
52
|
+
const getOptionProps = (option: unknown, index: number) => {
|
|
71
53
|
return {
|
|
72
|
-
id: `${props.name}_opt${
|
|
54
|
+
id: `${props.name}_opt${index}`,
|
|
73
55
|
name: props.name,
|
|
74
56
|
label: getOptionLabel(option),
|
|
75
57
|
value: getOptionValue(option)
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
|
-
|
|
79
|
-
const HintSlot = HintSlotFactory(props, slots)
|
|
80
60
|
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<fieldset :class="groupClass">
|
|
64
|
+
<legend v-if="label" v-text="label" />
|
|
65
|
+
<div class="vv-radio-group__wrapper">
|
|
66
|
+
<!-- #region options -->
|
|
67
|
+
<template v-if="options.length > 0">
|
|
68
|
+
<vv-radio
|
|
69
|
+
v-for="(o, oIndex) in options"
|
|
70
|
+
:key="oIndex"
|
|
71
|
+
v-bind="getOptionProps(o, oIndex)" />
|
|
72
|
+
</template>
|
|
73
|
+
<!-- #endregion -->
|
|
74
|
+
<!-- #region default -->
|
|
75
|
+
<slot v-else />
|
|
76
|
+
<!-- #endregion -->
|
|
77
|
+
</div>
|
|
78
|
+
<HintSlot class="vv-radio-group__hint" />
|
|
79
|
+
</fieldset>
|
|
80
|
+
</template>
|
|
@@ -1,74 +1,38 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
role="list"
|
|
7
|
-
class="vv-select__wrapper"
|
|
8
|
-
@click="disabled || readonly ? $event.preventDefault() : null"
|
|
9
|
-
@keyup.esc="dropdown.open = false"
|
|
10
|
-
@toggle="onToggle">
|
|
11
|
-
<summary
|
|
12
|
-
class="vv-select__input"
|
|
13
|
-
aria-haspopup="listbox"
|
|
14
|
-
@keyup.space="searchable ? $event.preventDefault() : null">
|
|
15
|
-
<!-- #region search input -->
|
|
16
|
-
<template v-if="searchable && dropdownOpen">
|
|
17
|
-
<input
|
|
18
|
-
ref="inputSearch"
|
|
19
|
-
v-model="searchText"
|
|
20
|
-
:placeholder="searchPlaceholder" />
|
|
21
|
-
</template>
|
|
22
|
-
<!-- #endregion search input -->
|
|
23
|
-
<!-- #region label of selected value/s -->
|
|
24
|
-
<template v-else>
|
|
25
|
-
{{ labelValue || placeholder }}
|
|
26
|
-
</template>
|
|
27
|
-
<!-- #endregion label of selected value/s -->
|
|
28
|
-
</summary>
|
|
29
|
-
<VvDropdown
|
|
30
|
-
v-bind="{
|
|
31
|
-
...props,
|
|
32
|
-
options: currentOptions
|
|
33
|
-
}"
|
|
34
|
-
@update:model-value="onInput" />
|
|
35
|
-
</details>
|
|
36
|
-
<HintSlot class="vv-select__hint" />
|
|
37
|
-
</div>
|
|
38
|
-
<VvNativeSelect
|
|
39
|
-
v-else
|
|
40
|
-
v-bind="props"
|
|
41
|
-
@update:model-value="emit('update:modelValue', $event)" />
|
|
42
|
-
</template>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'VvSelect'
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
43
6
|
|
|
44
7
|
<script setup lang="ts">
|
|
45
|
-
import type { Option } from '../VvDropdown/VvDropdown'
|
|
46
8
|
import { computed, ref, toRefs, useSlots, watch } from 'vue'
|
|
9
|
+
import { nanoid } from 'nanoid'
|
|
47
10
|
import { onClickOutside, refDebounced, useFocus } from '@vueuse/core'
|
|
48
|
-
import {
|
|
49
|
-
import
|
|
50
|
-
import {
|
|
51
|
-
import HintSlotFactory from '
|
|
52
|
-
import VvDropdown from '
|
|
53
|
-
import
|
|
54
|
-
import
|
|
11
|
+
import type { Option } from '@/components/VvDropdown'
|
|
12
|
+
import { isEmpty, filterArray } from '@/utils/ObjectUtilities'
|
|
13
|
+
import { useBemModifiers } from '@/composables/useModifiers'
|
|
14
|
+
import HintSlotFactory from '@/components/common/HintSlot'
|
|
15
|
+
import VvDropdown from '@/components/VvDropdown/VvDropdown.vue'
|
|
16
|
+
import VvNativeSelect from '@/components/VvNativeSelect/VvNativeSelect.vue'
|
|
17
|
+
import { VvSelectProps } from '@/components/VvSelect'
|
|
55
18
|
|
|
56
19
|
const props = defineProps(VvSelectProps)
|
|
57
20
|
const slots = useSlots()
|
|
58
21
|
|
|
59
22
|
const emit = defineEmits(['update:modelValue', 'change:search'])
|
|
60
23
|
|
|
61
|
-
//
|
|
62
|
-
const HintSlot = HintSlotFactory(props, slots)
|
|
24
|
+
// hint slot
|
|
25
|
+
const { HintSlot } = HintSlotFactory(props, slots)
|
|
63
26
|
|
|
64
|
-
//
|
|
27
|
+
// template ref
|
|
65
28
|
const dropdown = ref()
|
|
66
29
|
const inputSearch = ref()
|
|
67
|
-
|
|
30
|
+
|
|
31
|
+
// focus state
|
|
68
32
|
useFocus(inputSearch, { initialValue: true })
|
|
69
33
|
|
|
70
34
|
// data
|
|
71
|
-
const id =
|
|
35
|
+
const id = nanoid()
|
|
72
36
|
const searchText = ref('')
|
|
73
37
|
const debouncedSearchText = refDebounced(
|
|
74
38
|
searchText,
|
|
@@ -86,14 +50,21 @@ const {
|
|
|
86
50
|
error
|
|
87
51
|
} = toRefs(props)
|
|
88
52
|
|
|
89
|
-
// watch
|
|
90
53
|
// emit on change search text
|
|
91
54
|
watch(debouncedSearchText, () =>
|
|
92
55
|
emit('change:search', debouncedSearchText.value)
|
|
93
56
|
)
|
|
94
57
|
|
|
95
|
-
//
|
|
96
|
-
const
|
|
58
|
+
// dirty
|
|
59
|
+
const isDirty = computed(() => !isEmpty(props.modelValue))
|
|
60
|
+
|
|
61
|
+
// tabindex
|
|
62
|
+
const hasTabindex = computed(() => {
|
|
63
|
+
return disabled.value || readonly.value ? -1 : props.tabindex
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// styles
|
|
67
|
+
const { bemCssClasses } = useBemModifiers('vv-select', {
|
|
97
68
|
modifiers,
|
|
98
69
|
disabled,
|
|
99
70
|
loading,
|
|
@@ -102,12 +73,10 @@ const { bemCssClasses: selectClasses } = useBemModifiers('vv-select', {
|
|
|
102
73
|
iconRight,
|
|
103
74
|
valid,
|
|
104
75
|
invalid: error,
|
|
105
|
-
dirty:
|
|
76
|
+
dirty: isDirty
|
|
106
77
|
})
|
|
107
78
|
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
// Check if options are objects
|
|
79
|
+
// check if options are objects
|
|
111
80
|
const isOptionsObjects = computed(() =>
|
|
112
81
|
props.options?.every((option) => typeof option === 'object')
|
|
113
82
|
)
|
|
@@ -125,9 +94,12 @@ const filteredOptions = computed(() => {
|
|
|
125
94
|
.toLowerCase()
|
|
126
95
|
.includes(debouncedSearchText.value.toLowerCase().trim())
|
|
127
96
|
}
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
|
|
97
|
+
if (typeof option[props.labelKey] === 'string') {
|
|
98
|
+
return (option[props.labelKey] as string)
|
|
99
|
+
.toLowerCase()
|
|
100
|
+
.includes(debouncedSearchText.value.toLowerCase().trim())
|
|
101
|
+
}
|
|
102
|
+
return false
|
|
131
103
|
})
|
|
132
104
|
})
|
|
133
105
|
|
|
@@ -139,12 +111,12 @@ const labelValue = computed(() => {
|
|
|
139
111
|
// #region multiple mode
|
|
140
112
|
if (
|
|
141
113
|
props.multiple &&
|
|
142
|
-
props.modelValue
|
|
143
|
-
|
|
114
|
+
Array.isArray(props.modelValue) &&
|
|
115
|
+
props.modelValue?.length
|
|
144
116
|
) {
|
|
145
117
|
if (isOptionsObjects.value) {
|
|
146
118
|
// filter options by selected values
|
|
147
|
-
return
|
|
119
|
+
return filterArray<Option>(
|
|
148
120
|
props.options as Option[],
|
|
149
121
|
props.modelValue,
|
|
150
122
|
props.valueKey
|
|
@@ -194,7 +166,56 @@ function onInput(value: typeof props.modelValue) {
|
|
|
194
166
|
if (dropdown.value && !props.multiple) {
|
|
195
167
|
dropdown.value.open = false
|
|
196
168
|
}
|
|
197
|
-
|
|
198
169
|
emit('update:modelValue', value)
|
|
199
170
|
}
|
|
200
171
|
</script>
|
|
172
|
+
|
|
173
|
+
<template>
|
|
174
|
+
<div v-if="!native" :id="id" :class="bemCssClasses">
|
|
175
|
+
<label
|
|
176
|
+
v-if="label"
|
|
177
|
+
:id="`${id}-label`"
|
|
178
|
+
:for="searchable && dropdownOpen ? `${id}-input` : undefined"
|
|
179
|
+
>{{ label }}</label
|
|
180
|
+
>
|
|
181
|
+
<details
|
|
182
|
+
ref="dropdown"
|
|
183
|
+
class="vv-select__wrapper"
|
|
184
|
+
@click="disabled || readonly ? $event.preventDefault() : null"
|
|
185
|
+
@keyup.esc="dropdown.open = false"
|
|
186
|
+
@toggle="onToggle">
|
|
187
|
+
<summary
|
|
188
|
+
class="vv-select__input"
|
|
189
|
+
:tabindex="hasTabindex"
|
|
190
|
+
@keyup.space="searchable ? $event.preventDefault() : null">
|
|
191
|
+
<!-- #region search input -->
|
|
192
|
+
<template v-if="searchable && dropdownOpen">
|
|
193
|
+
<input
|
|
194
|
+
:id="`${id}-input`"
|
|
195
|
+
ref="inputSearch"
|
|
196
|
+
v-model="searchText"
|
|
197
|
+
role="combobox"
|
|
198
|
+
:placeholder="searchPlaceholder" />
|
|
199
|
+
</template>
|
|
200
|
+
<!-- #endregion search input -->
|
|
201
|
+
<!-- #region label of selected value/s -->
|
|
202
|
+
<template v-else>
|
|
203
|
+
{{ labelValue || placeholder }}
|
|
204
|
+
</template>
|
|
205
|
+
<!-- #endregion label of selected value/s -->
|
|
206
|
+
</summary>
|
|
207
|
+
<VvDropdown
|
|
208
|
+
:id="`${id}-dropdown`"
|
|
209
|
+
v-bind="{
|
|
210
|
+
...props,
|
|
211
|
+
options: currentOptions
|
|
212
|
+
}"
|
|
213
|
+
@update:model-value="onInput" />
|
|
214
|
+
</details>
|
|
215
|
+
<HintSlot class="vv-select__hint" />
|
|
216
|
+
</div>
|
|
217
|
+
<VvNativeSelect
|
|
218
|
+
v-else
|
|
219
|
+
v-bind="props"
|
|
220
|
+
@update:model-value="emit('update:modelValue', $event)" />
|
|
221
|
+
</template>
|