@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- 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 +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -5,12 +5,8 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
VvRadioEvents,
|
|
11
|
-
useGroupProps,
|
|
12
|
-
} from '@/components/VvRadio'
|
|
13
|
-
import { HintSlotFactory } from '@/components/common/HintSlot'
|
|
8
|
+
import { VvRadioProps, VvRadioEvents, useGroupProps } from '.'
|
|
9
|
+
import { HintSlotFactory } from '../common/HintSlot'
|
|
14
10
|
|
|
15
11
|
// props, emit and slots
|
|
16
12
|
const props = defineProps(VvRadioProps)
|
|
@@ -63,7 +59,7 @@
|
|
|
63
59
|
|
|
64
60
|
// styles
|
|
65
61
|
const { modifiers } = toRefs(props)
|
|
66
|
-
const bemCssClasses =
|
|
62
|
+
const bemCssClasses = useModifiers(
|
|
67
63
|
'vv-radio',
|
|
68
64
|
modifiers,
|
|
69
65
|
computed(() => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, Ref } from 'vue'
|
|
2
|
-
import type { InputGroupState } from '
|
|
3
|
-
import { CheckboxRadioProps } from '
|
|
4
|
-
import { INJECTION_KEY_RADIO_GROUP } from '
|
|
2
|
+
import type { InputGroupState } from '../../types/group'
|
|
3
|
+
import { CheckboxRadioProps } from '../../props'
|
|
4
|
+
import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
|
|
5
5
|
|
|
6
6
|
export const VvRadioProps = CheckboxRadioProps
|
|
7
7
|
|
|
@@ -22,10 +22,14 @@ export function useGroupProps(
|
|
|
22
22
|
|
|
23
23
|
// global props
|
|
24
24
|
const modelValue = getGroupOrLocalRef('modelValue', props, emit)
|
|
25
|
-
const readonly = getGroupOrLocalRef('readonly', props) as Ref<boolean>
|
|
26
|
-
const disabled = getGroupOrLocalRef('disabled', props) as Ref<boolean>
|
|
27
25
|
const valid = getGroupOrLocalRef('valid', props) as Ref<boolean>
|
|
28
26
|
const invalid = getGroupOrLocalRef('invalid', props) as Ref<boolean>
|
|
27
|
+
const readonly = computed(() =>
|
|
28
|
+
Boolean(props.readonly || group?.value?.disabled.value),
|
|
29
|
+
)
|
|
30
|
+
const disabled = computed(() =>
|
|
31
|
+
Boolean(props.disabled || group?.value?.disabled.value),
|
|
32
|
+
)
|
|
29
33
|
|
|
30
34
|
return {
|
|
31
35
|
// local props
|
|
@@ -34,9 +38,9 @@ export function useGroupProps(
|
|
|
34
38
|
group,
|
|
35
39
|
isInGroup,
|
|
36
40
|
modelValue,
|
|
37
|
-
readonly,
|
|
38
|
-
disabled,
|
|
39
41
|
valid,
|
|
40
42
|
invalid,
|
|
43
|
+
readonly,
|
|
44
|
+
disabled,
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import type { Option } from '
|
|
9
|
-
import type { InputGroupState } from '
|
|
10
|
-
import { INJECTION_KEY_RADIO_GROUP } from '
|
|
11
|
-
import { HintSlotFactory } from '
|
|
12
|
-
import VvRadio from '
|
|
13
|
-
import {
|
|
14
|
-
VvRadioGroupProps,
|
|
15
|
-
VvRadioGroupEvents,
|
|
16
|
-
} from '@/components/VvRadioGroup'
|
|
8
|
+
import type { Option } from '../../types/generic'
|
|
9
|
+
import type { InputGroupState } from '../../types/group'
|
|
10
|
+
import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
|
|
11
|
+
import { HintSlotFactory } from '../common/HintSlot'
|
|
12
|
+
import VvRadio from '../VvRadio/VvRadio.vue'
|
|
13
|
+
import { VvRadioGroupProps, VvRadioGroupEvents } from '.'
|
|
17
14
|
|
|
18
15
|
// props, emit and slots
|
|
19
16
|
const props = defineProps(VvRadioGroupProps)
|
|
@@ -38,7 +35,7 @@
|
|
|
38
35
|
const { getOptionLabel, getOptionValue } = useOptions(props)
|
|
39
36
|
|
|
40
37
|
// styles
|
|
41
|
-
const bemCssClasses =
|
|
38
|
+
const bemCssClasses = useModifiers(
|
|
42
39
|
'vv-radio-group',
|
|
43
40
|
modifiers,
|
|
44
41
|
computed(() => ({
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import type { SelectHTMLAttributes } from 'vue'
|
|
9
|
-
import VvIcon from '
|
|
10
|
-
import HintSlotFactory from '
|
|
11
|
-
import { VvSelectProps, VvSelectEmits } from '
|
|
9
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
10
|
+
import HintSlotFactory from '../common/HintSlot'
|
|
11
|
+
import { VvSelectProps, VvSelectEmits } from '.'
|
|
12
12
|
|
|
13
13
|
// props, emit and slots
|
|
14
14
|
const props = defineProps(VvSelectProps)
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
// styles
|
|
81
|
-
const bemCssClasses =
|
|
81
|
+
const bemCssClasses = useModifiers(
|
|
82
82
|
'vv-select',
|
|
83
83
|
modifiers,
|
|
84
84
|
computed(() => ({
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
UnselectableProps,
|
|
15
15
|
AutofocusProps,
|
|
16
16
|
AutocompleteProps,
|
|
17
|
-
|
|
17
|
+
LabelProps,
|
|
18
|
+
} from '../../props'
|
|
18
19
|
|
|
19
20
|
export const VvSelectProps = {
|
|
20
21
|
...IdNameProps,
|
|
@@ -32,6 +33,7 @@ export const VvSelectProps = {
|
|
|
32
33
|
...IconProps,
|
|
33
34
|
...FloatingLabelProps,
|
|
34
35
|
...UnselectableProps,
|
|
36
|
+
...LabelProps,
|
|
35
37
|
/**
|
|
36
38
|
* This Boolean attribute indicates that multiple options can be selected in the list.
|
|
37
39
|
* If it is not specified, then only one option can be selected at a time.
|
|
@@ -58,10 +60,6 @@ export const VvSelectProps = {
|
|
|
58
60
|
type: [String, Number, Boolean, Object, Array],
|
|
59
61
|
default: undefined,
|
|
60
62
|
},
|
|
61
|
-
/**
|
|
62
|
-
* <label> value for the select
|
|
63
|
-
*/
|
|
64
|
-
label: String,
|
|
65
63
|
/**
|
|
66
64
|
* Select placeholder
|
|
67
65
|
*/
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import type { TextareaHTMLAttributes } from 'vue'
|
|
9
|
-
import HintSlotFactory from '
|
|
10
|
-
import VvIcon from '
|
|
11
|
-
import { VvTextareaProps, VvTextareaEvents } from '
|
|
9
|
+
import HintSlotFactory from '../common/HintSlot'
|
|
10
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
11
|
+
import { VvTextareaProps, VvTextareaEvents } from '.'
|
|
12
12
|
|
|
13
13
|
// props, emit and slots
|
|
14
14
|
const props = defineProps(VvTextareaProps)
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots)
|
|
90
90
|
|
|
91
91
|
// styles
|
|
92
|
-
const bemCssClasses =
|
|
92
|
+
const bemCssClasses = useModifiers(
|
|
93
93
|
'vv-textarea',
|
|
94
94
|
modifiers,
|
|
95
95
|
computed(() => ({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { VvTooltipProps } from '
|
|
2
|
+
import { VvTooltipProps } from '.'
|
|
3
3
|
|
|
4
4
|
const props = defineProps(VvTooltipProps)
|
|
5
5
|
const { modifiers } = toRefs(props)
|
|
6
6
|
|
|
7
7
|
// styles
|
|
8
|
-
const bemCssClasses =
|
|
8
|
+
const bemCssClasses = useModifiers(
|
|
9
9
|
'vv-tooltip',
|
|
10
10
|
modifiers,
|
|
11
11
|
computed(() => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Side } from '@/constants'
|
|
2
|
-
import { ModifiersProps } from '@/props'
|
|
3
1
|
import type { PropType } from 'vue'
|
|
2
|
+
import { Side } from '../../constants'
|
|
3
|
+
import { ModifiersProps } from '../../props'
|
|
4
4
|
|
|
5
5
|
export const VvTooltipProps = {
|
|
6
6
|
...ModifiersProps,
|
|
@@ -9,7 +9,7 @@ export const VvTooltipProps = {
|
|
|
9
9
|
* @default Side.bottom
|
|
10
10
|
*/
|
|
11
11
|
position: {
|
|
12
|
-
type: String as PropType
|
|
12
|
+
type: String as PropType<`${Side}`>,
|
|
13
13
|
default: Side.bottom,
|
|
14
14
|
},
|
|
15
15
|
value: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import type { Emitter, EventType } from 'mitt'
|
|
3
|
-
import type { DropdownItemRole } from '@/components/VvDropdown/'
|
|
4
3
|
import {
|
|
4
|
+
type DropdownItemRole,
|
|
5
5
|
INJECTION_KEY_DROPDOWN_TRIGGER,
|
|
6
6
|
INJECTION_KEY_DROPDOWN_ACTION,
|
|
7
7
|
INJECTION_KEY_DROPDOWN_ITEM,
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../constants'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Injects dropdown reference and the event bus
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type Ref, Fragment } from 'vue'
|
|
2
2
|
import mitt from 'mitt'
|
|
3
|
-
import {
|
|
4
|
-
type DropdownRole,
|
|
5
|
-
DROPDOWN_ROLES,
|
|
6
|
-
DROPDOWN_ITEM_ROLES,
|
|
7
|
-
} from '@/components/VvDropdown/'
|
|
8
3
|
import {
|
|
9
4
|
INJECTION_KEY_DROPDOWN_TRIGGER,
|
|
10
5
|
INJECTION_KEY_DROPDOWN_ACTION,
|
|
11
6
|
INJECTION_KEY_DROPDOWN_ITEM,
|
|
12
|
-
|
|
7
|
+
DropdownRole,
|
|
8
|
+
DropdownItemRole,
|
|
9
|
+
ActionRoles,
|
|
10
|
+
} from '../../constants'
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Share the dropdown reference and the event bus with all its children.
|
|
@@ -66,13 +64,13 @@ export function useProvideDropdownItem({
|
|
|
66
64
|
role,
|
|
67
65
|
expanded,
|
|
68
66
|
}: {
|
|
69
|
-
role: Ref
|
|
67
|
+
role: Ref<`${DropdownRole}`>
|
|
70
68
|
expanded: Ref<boolean>
|
|
71
69
|
}) {
|
|
72
70
|
const itemRole = computed(() =>
|
|
73
|
-
role.value ===
|
|
74
|
-
?
|
|
75
|
-
:
|
|
71
|
+
role.value === DropdownRole.listbox
|
|
72
|
+
? DropdownItemRole.option
|
|
73
|
+
: DropdownItemRole.presentation,
|
|
76
74
|
)
|
|
77
75
|
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
78
76
|
role: itemRole,
|
|
@@ -91,7 +89,7 @@ export function useProvideDropdownAction({
|
|
|
91
89
|
expanded: Ref<boolean>
|
|
92
90
|
}) {
|
|
93
91
|
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
94
|
-
role:
|
|
92
|
+
role: ActionRoles.menuitem,
|
|
95
93
|
expanded,
|
|
96
94
|
})
|
|
97
95
|
}
|
|
@@ -2,8 +2,15 @@ import type { Ref } from 'vue'
|
|
|
2
2
|
|
|
3
3
|
export function useDebouncedInput(
|
|
4
4
|
modelValue: Ref | undefined,
|
|
5
|
-
emit: (event: string, value:
|
|
5
|
+
emit: (event: string, value: string | number) => void,
|
|
6
6
|
ms: string | number = 0,
|
|
7
|
+
{
|
|
8
|
+
getter = (value) => value,
|
|
9
|
+
setter = (value) => value,
|
|
10
|
+
}: {
|
|
11
|
+
getter?: (value: string | number) => string | number
|
|
12
|
+
setter?: (value: string | number) => string | number
|
|
13
|
+
} = {},
|
|
7
14
|
): Ref {
|
|
8
15
|
let timeout: NodeJS.Timeout
|
|
9
16
|
|
|
@@ -12,13 +19,13 @@ export function useDebouncedInput(
|
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
return computed({
|
|
15
|
-
get: () => modelValue?.value,
|
|
22
|
+
get: () => getter(modelValue?.value),
|
|
16
23
|
set: (value) => {
|
|
17
24
|
if (timeout) {
|
|
18
25
|
clearTimeout(timeout)
|
|
19
26
|
}
|
|
20
27
|
timeout = setTimeout(() => {
|
|
21
|
-
emit('update:modelValue', value)
|
|
28
|
+
emit('update:modelValue', setter(value))
|
|
22
29
|
}, ms as number)
|
|
23
30
|
},
|
|
24
31
|
})
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
type VueProp =
|
|
4
|
+
| StringConstructor
|
|
5
|
+
| NumberConstructor
|
|
6
|
+
| ObjectConstructor
|
|
7
|
+
| FunctionConstructor
|
|
8
|
+
| SymbolConstructor
|
|
9
|
+
| ArrayConstructor
|
|
10
|
+
| BooleanConstructor
|
|
11
|
+
| PropType<unknown>
|
|
12
|
+
|
|
13
|
+
export function useDefaults<Definition>(
|
|
14
|
+
componentName: string,
|
|
15
|
+
propsDefinition: Definition,
|
|
16
|
+
props: Readonly<ExtractPropTypes<Definition>>,
|
|
17
|
+
) {
|
|
18
|
+
const volver = useVolver()
|
|
19
|
+
|
|
20
|
+
const volverComponentDefaults = computed(() => {
|
|
21
|
+
if (!volver || !volver.defaults.value?.[componentName]) {
|
|
22
|
+
return undefined
|
|
23
|
+
}
|
|
24
|
+
return volver.defaults.value[componentName]
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return computed(() => {
|
|
28
|
+
if (volverComponentDefaults.value === undefined) {
|
|
29
|
+
return props
|
|
30
|
+
}
|
|
31
|
+
const componentDefaults = volverComponentDefaults.value
|
|
32
|
+
const simplifiedPropsDefinition = propsDefinition as {
|
|
33
|
+
[key: string]:
|
|
34
|
+
| VueProp
|
|
35
|
+
| VueProp[]
|
|
36
|
+
| { type: VueProp | VueProp[]; default?: unknown }
|
|
37
|
+
}
|
|
38
|
+
const simplifiedProps = props as Record<string, unknown>
|
|
39
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
40
|
+
const propValue = simplifiedProps[key]
|
|
41
|
+
acc[key] = propValue
|
|
42
|
+
if (key in componentDefaults) {
|
|
43
|
+
// array of types
|
|
44
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
45
|
+
const typeArray = simplifiedPropsDefinition[
|
|
46
|
+
key
|
|
47
|
+
] as VueProp[]
|
|
48
|
+
if (typeArray.length) {
|
|
49
|
+
const typeFunction = typeArray[0] as <T>() => T
|
|
50
|
+
if (typeFunction === propValue) {
|
|
51
|
+
acc[key] = componentDefaults[key]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// single type
|
|
56
|
+
if (typeof simplifiedPropsDefinition[key] === 'function') {
|
|
57
|
+
const typeFunction = simplifiedPropsDefinition[key] as <
|
|
58
|
+
T,
|
|
59
|
+
>() => T
|
|
60
|
+
if (typeFunction() === propValue) {
|
|
61
|
+
acc[key] = componentDefaults[key]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// object with type and default
|
|
65
|
+
if (typeof simplifiedPropsDefinition[key] === 'object') {
|
|
66
|
+
let defaultValue = (
|
|
67
|
+
simplifiedPropsDefinition[key] as { default: unknown }
|
|
68
|
+
).default
|
|
69
|
+
if (typeof defaultValue === 'function') {
|
|
70
|
+
defaultValue = defaultValue()
|
|
71
|
+
}
|
|
72
|
+
if (typeof defaultValue === 'object') {
|
|
73
|
+
if (
|
|
74
|
+
JSON.stringify(defaultValue) ===
|
|
75
|
+
JSON.stringify(propValue)
|
|
76
|
+
) {
|
|
77
|
+
acc[key] = componentDefaults[key]
|
|
78
|
+
}
|
|
79
|
+
} else if (defaultValue === propValue) {
|
|
80
|
+
acc[key] = componentDefaults[key]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return acc
|
|
85
|
+
}, {} as Record<string, unknown>) as Readonly<
|
|
86
|
+
ExtractPropTypes<Definition>
|
|
87
|
+
>
|
|
88
|
+
})
|
|
89
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
|
|
3
|
-
export function
|
|
3
|
+
export function useModifiers(
|
|
4
4
|
prefix: string,
|
|
5
5
|
modifiers?: Ref<string | string[] | unknown | unknown[] | undefined>,
|
|
6
6
|
others?: Ref<Record<string, boolean>>,
|
|
@@ -10,17 +10,16 @@ export function useBemModifiers(
|
|
|
10
10
|
[prefix]: true,
|
|
11
11
|
}
|
|
12
12
|
// props modifiers
|
|
13
|
-
|
|
13
|
+
const modifiersArray =
|
|
14
|
+
typeof modifiers?.value === 'string'
|
|
15
|
+
? modifiers.value.split(' ')
|
|
16
|
+
: modifiers?.value
|
|
14
17
|
if (modifiersArray) {
|
|
15
|
-
if (
|
|
16
|
-
!Array.isArray(modifiersArray) &&
|
|
17
|
-
typeof modifiersArray === 'string'
|
|
18
|
-
) {
|
|
19
|
-
modifiersArray = modifiersArray.split(' ')
|
|
20
|
-
}
|
|
21
18
|
if (Array.isArray(modifiersArray)) {
|
|
22
19
|
modifiersArray.forEach((modifier) => {
|
|
23
|
-
|
|
20
|
+
if (modifier) {
|
|
21
|
+
toReturn[`${prefix}--${modifier}`] = true
|
|
22
|
+
}
|
|
24
23
|
})
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { INJECTION_KEY_VOLVER } from '
|
|
2
|
-
import type { VolverInterface } from '
|
|
1
|
+
import { INJECTION_KEY_VOLVER } from '../constants'
|
|
2
|
+
import type { VolverInterface } from '../Volver'
|
|
3
3
|
|
|
4
4
|
export function useVolver() {
|
|
5
5
|
return inject<VolverInterface>(INJECTION_KEY_VOLVER)
|
package/src/constants.ts
CHANGED
|
@@ -23,6 +23,42 @@ export enum Position {
|
|
|
23
23
|
after = 'after',
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export enum ButtonType {
|
|
27
|
+
button = 'button',
|
|
28
|
+
submit = 'submit',
|
|
29
|
+
reset = 'reset',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum ActionTag {
|
|
33
|
+
nuxtLink = 'nuxt-link',
|
|
34
|
+
routerLink = 'router-link',
|
|
35
|
+
a = 'a',
|
|
36
|
+
button = 'button',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export enum ActionRoles {
|
|
40
|
+
button = 'button',
|
|
41
|
+
link = 'link',
|
|
42
|
+
menuitem = 'menuitem',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum DropdownRole {
|
|
46
|
+
listbox = 'listbox',
|
|
47
|
+
menu = 'menu',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export enum DropdownItemRole {
|
|
51
|
+
option = 'option',
|
|
52
|
+
presentation = 'presentation',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export enum AnchorTarget {
|
|
56
|
+
_blank = '_blank',
|
|
57
|
+
_self = '_self',
|
|
58
|
+
_parent = '_parent',
|
|
59
|
+
_top = '_top',
|
|
60
|
+
}
|
|
61
|
+
|
|
26
62
|
// volver
|
|
27
63
|
export const INJECTION_KEY_VOLVER = Symbol.for('volver')
|
|
28
64
|
|
package/src/directives/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render, type Directive, type DirectiveBinding } from 'vue'
|
|
2
|
-
import VvTooltip from '
|
|
3
|
-
import type { Side } from '
|
|
2
|
+
import VvTooltip from '../components/VvTooltip/VvTooltip.vue'
|
|
3
|
+
import type { Side } from '../constants'
|
|
4
4
|
|
|
5
5
|
const tooltip: Directive = {
|
|
6
6
|
beforeMount(el: HTMLElement, binding: DirectiveBinding) {
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import VolverPlugin from './Volver'
|
|
2
2
|
import type { Volver } from './Volver'
|
|
3
3
|
|
|
4
|
-
// export all components as vue plugin
|
|
5
|
-
export * from './components/index'
|
|
6
4
|
export { VolverPlugin }
|
|
7
5
|
|
|
8
6
|
// https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties
|