@volverjs/ui-vue 0.0.4 → 0.0.5-beta.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/README.md +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- 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 +264 -164
- 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 +276 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +213 -44
- 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 +247 -75
- 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 +646 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
- 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 +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
- package/dist/components/VvCombobox/index.d.ts +41 -10
- package/dist/components/VvDialog/VvDialog.es.js +387 -141
- 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 +452 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +40 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- 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 +986 -462
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +66 -13
- package/dist/components/VvProgress/VvProgress.es.js +216 -45
- 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 +499 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +631 -324
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
- 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 +3522 -2231
- 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/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +264 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +222 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +40 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +50 -18
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +13 -1
- package/package.json +126 -40
- package/src/Volver.ts +49 -22
- 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 +7 -7
- package/src/components/VvAction/index.ts +1 -1
- 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 +11 -11
- package/src/components/VvButton/index.ts +10 -9
- 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 +44 -26
- package/src/components/VvCombobox/index.ts +1 -1
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +7 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- 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 +130 -37
- 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 +1 -1
- package/src/components/VvTextarea/VvTextarea.vue +6 -6
- 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 +2 -2
- 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 +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/directives/index.ts +3 -1
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/directives/v-tooltip.ts +2 -2
- package/src/icons.ts +1 -1
- package/src/index.ts +0 -2
- package/src/props/index.ts +20 -10
- package/src/resolvers/unplugin.ts +15 -1
- 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 +1 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +12 -2
- package/src/types/group.d.ts +5 -0
|
@@ -6,15 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import type { InputHTMLAttributes } from 'vue'
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import { Mask } from 'maska'
|
|
10
|
+
import HintSlotFactory from '../common/HintSlot'
|
|
11
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
12
|
+
import VvInputTextActionsFactory from '../VvInputText/VvInputTextActions'
|
|
12
13
|
import {
|
|
13
14
|
VvInputTextEvents,
|
|
14
15
|
VvInputTextProps,
|
|
15
16
|
INPUT_TYPES,
|
|
16
17
|
TYPES_ICON,
|
|
17
|
-
} from '
|
|
18
|
+
} from '../VvInputText'
|
|
18
19
|
|
|
19
20
|
// props, emit, slots and attrs
|
|
20
21
|
const props = defineProps(VvInputTextProps)
|
|
@@ -22,7 +23,10 @@
|
|
|
22
23
|
const slots = useSlots()
|
|
23
24
|
|
|
24
25
|
// template refs
|
|
25
|
-
const
|
|
26
|
+
const inputEl = ref()
|
|
27
|
+
const innerEl = ref()
|
|
28
|
+
|
|
29
|
+
defineExpose({ $inner: innerEl })
|
|
26
30
|
|
|
27
31
|
// data
|
|
28
32
|
const {
|
|
@@ -44,15 +48,39 @@
|
|
|
44
48
|
)
|
|
45
49
|
|
|
46
50
|
// debounce
|
|
47
|
-
const localModelValue = useDebouncedInput(
|
|
51
|
+
const localModelValue = useDebouncedInput(
|
|
52
|
+
modelValue,
|
|
53
|
+
emit,
|
|
54
|
+
props.debounce,
|
|
55
|
+
{
|
|
56
|
+
getter: (value) => {
|
|
57
|
+
if (mask.value) {
|
|
58
|
+
return mask.value.masked(value ?? '')
|
|
59
|
+
}
|
|
60
|
+
return value
|
|
61
|
+
},
|
|
62
|
+
setter: (value) => {
|
|
63
|
+
if (mask.value) {
|
|
64
|
+
value = mask.value.unmasked(value)
|
|
65
|
+
}
|
|
66
|
+
if (props.type === INPUT_TYPES.NUMBER) {
|
|
67
|
+
return Number(value)
|
|
68
|
+
}
|
|
69
|
+
return value
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
)
|
|
48
73
|
|
|
49
74
|
// focus
|
|
50
|
-
const { focused } = useComponentFocus(
|
|
75
|
+
const { focused } = useComponentFocus(inputEl, emit)
|
|
76
|
+
const isFocused = computed(
|
|
77
|
+
() => focused.value && !props.disabled && !props.readonly,
|
|
78
|
+
)
|
|
51
79
|
|
|
52
80
|
// visibility
|
|
53
|
-
const isVisible = useElementVisibility(
|
|
81
|
+
const isVisible = useElementVisibility(inputEl)
|
|
54
82
|
watch(isVisible, (newValue) => {
|
|
55
|
-
if (newValue && props.autofocus) {
|
|
83
|
+
if (newValue && props.autofocus && !props.disabled && !props.readonly) {
|
|
56
84
|
focused.value = true
|
|
57
85
|
}
|
|
58
86
|
})
|
|
@@ -78,14 +106,14 @@
|
|
|
78
106
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER)
|
|
79
107
|
const onStepUp = () => {
|
|
80
108
|
if (isClickable.value) {
|
|
81
|
-
|
|
82
|
-
localModelValue.value = unref(
|
|
109
|
+
inputEl.value.stepUp()
|
|
110
|
+
localModelValue.value = unref(inputEl).value
|
|
83
111
|
}
|
|
84
112
|
}
|
|
85
113
|
const onStepDown = () => {
|
|
86
114
|
if (isClickable.value) {
|
|
87
|
-
|
|
88
|
-
localModelValue.value = unref(
|
|
115
|
+
inputEl.value.stepDown()
|
|
116
|
+
localModelValue.value = unref(inputEl).value
|
|
89
117
|
}
|
|
90
118
|
}
|
|
91
119
|
|
|
@@ -119,8 +147,8 @@
|
|
|
119
147
|
// count
|
|
120
148
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
121
149
|
mode: props.count,
|
|
122
|
-
upperLimit: props.maxlength,
|
|
123
|
-
lowerLimit: props.minlength,
|
|
150
|
+
upperLimit: Number(props.maxlength),
|
|
151
|
+
lowerLimit: Number(props.minlength),
|
|
124
152
|
})
|
|
125
153
|
|
|
126
154
|
// tabindex
|
|
@@ -145,7 +173,7 @@
|
|
|
145
173
|
|
|
146
174
|
// styles
|
|
147
175
|
const { modifiers } = toRefs(props)
|
|
148
|
-
const bemCssClasses =
|
|
176
|
+
const bemCssClasses = useModifiers(
|
|
149
177
|
'vv-input-text',
|
|
150
178
|
modifiers,
|
|
151
179
|
computed(() => ({
|
|
@@ -158,7 +186,8 @@
|
|
|
158
186
|
'icon-after': hasIconAfter.value || !isEmpty(defaultAfterIcon),
|
|
159
187
|
floating: props.floating && !isEmpty(props.label),
|
|
160
188
|
dirty: isDirty.value,
|
|
161
|
-
focus:
|
|
189
|
+
focus: isFocused.value,
|
|
190
|
+
'auto-width': props.autoWidth,
|
|
162
191
|
})),
|
|
163
192
|
)
|
|
164
193
|
|
|
@@ -199,8 +228,10 @@
|
|
|
199
228
|
type === INPUT_TYPES.NUMBER
|
|
200
229
|
) {
|
|
201
230
|
toReturn.step = props.step
|
|
202
|
-
toReturn.max =
|
|
203
|
-
|
|
231
|
+
toReturn.max =
|
|
232
|
+
props.max !== undefined ? String(props.max) : undefined
|
|
233
|
+
toReturn.min =
|
|
234
|
+
props.min !== undefined ? String(props.min) : undefined
|
|
204
235
|
}
|
|
205
236
|
if (
|
|
206
237
|
type === INPUT_TYPES.TEXT ||
|
|
@@ -256,6 +287,51 @@
|
|
|
256
287
|
INPUT_TYPES.SEARCH,
|
|
257
288
|
props,
|
|
258
289
|
)
|
|
290
|
+
|
|
291
|
+
// mask
|
|
292
|
+
const mask = ref()
|
|
293
|
+
watch(
|
|
294
|
+
[
|
|
295
|
+
() => props.mask,
|
|
296
|
+
() => props.type,
|
|
297
|
+
() => props.maskEager,
|
|
298
|
+
() => props.maskReversed,
|
|
299
|
+
() => props.maskTokens,
|
|
300
|
+
() => props.maskTokensReplace,
|
|
301
|
+
],
|
|
302
|
+
([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
|
|
303
|
+
if (newMask && newType === INPUT_TYPES.TEXT) {
|
|
304
|
+
mask.value = new Mask({
|
|
305
|
+
mask: newMask,
|
|
306
|
+
eager,
|
|
307
|
+
reversed,
|
|
308
|
+
tokens,
|
|
309
|
+
tokensReplace,
|
|
310
|
+
})
|
|
311
|
+
return
|
|
312
|
+
}
|
|
313
|
+
mask.value = undefined
|
|
314
|
+
},
|
|
315
|
+
{ immediate: true },
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
// auto-width
|
|
319
|
+
const onClickInner = () => {
|
|
320
|
+
if (isClickable.value) {
|
|
321
|
+
focused.value = true
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const hasStyle = computed(() => {
|
|
325
|
+
if (!props.autoWidth) {
|
|
326
|
+
return undefined
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
width:
|
|
330
|
+
localModelValue.value !== undefined
|
|
331
|
+
? `${String(localModelValue.value).length + 1}ch`
|
|
332
|
+
: undefined,
|
|
333
|
+
}
|
|
334
|
+
})
|
|
259
335
|
</script>
|
|
260
336
|
|
|
261
337
|
<template>
|
|
@@ -268,7 +344,11 @@
|
|
|
268
344
|
<!-- @slot Slot before input icon -->
|
|
269
345
|
<slot name="before" v-bind="slotProps" />
|
|
270
346
|
</div>
|
|
271
|
-
<div
|
|
347
|
+
<div
|
|
348
|
+
ref="innerEl"
|
|
349
|
+
class="vv-input-text__inner"
|
|
350
|
+
@click.stop="onClickInner"
|
|
351
|
+
>
|
|
272
352
|
<VvIcon
|
|
273
353
|
v-if="hasIconBefore"
|
|
274
354
|
class="vv-input-text__icon"
|
|
@@ -276,28 +356,41 @@
|
|
|
276
356
|
/>
|
|
277
357
|
<input
|
|
278
358
|
:id="hasId"
|
|
279
|
-
ref="
|
|
359
|
+
ref="inputEl"
|
|
280
360
|
v-model="localModelValue"
|
|
281
361
|
v-bind="hasAttrs"
|
|
362
|
+
:style="hasStyle"
|
|
282
363
|
@keyup="emit('keyup', $event)"
|
|
283
364
|
/>
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
/>
|
|
294
|
-
<NumberInputActions
|
|
295
|
-
v-else-if="isNumber"
|
|
296
|
-
@step-up="onStepUp"
|
|
297
|
-
@step-down="onStepDown"
|
|
298
|
-
/>
|
|
299
|
-
<SearchInputActions v-else-if="isSearch" @clear="onClear" />
|
|
365
|
+
<div
|
|
366
|
+
v-if="(unit || $slots.unit) && isDirty"
|
|
367
|
+
class="vv-input-text__unit"
|
|
368
|
+
>
|
|
369
|
+
<!-- @slot Slot to replace unit-->
|
|
370
|
+
<slot name v-bind="slotProps">
|
|
371
|
+
{{ unit }}
|
|
372
|
+
</slot>
|
|
373
|
+
</div>
|
|
300
374
|
</div>
|
|
375
|
+
<!-- @slot Slot to replace right icon -->
|
|
376
|
+
<VvIcon
|
|
377
|
+
v-if="hasIconAfter || defaultAfterIcon"
|
|
378
|
+
class="vv-input-text__icon vv-input-text__icon-after"
|
|
379
|
+
v-bind="hasIconAfter ? hasIcon : defaultAfterIcon"
|
|
380
|
+
/>
|
|
381
|
+
<PasswordInputActions
|
|
382
|
+
v-else-if="isPassword && !hideActions && isClickable"
|
|
383
|
+
@toggle-password="onTogglePassword"
|
|
384
|
+
/>
|
|
385
|
+
<NumberInputActions
|
|
386
|
+
v-else-if="isNumber && !hideActions && isClickable"
|
|
387
|
+
@step-up="onStepUp"
|
|
388
|
+
@step-down="onStepDown"
|
|
389
|
+
/>
|
|
390
|
+
<SearchInputActions
|
|
391
|
+
v-else-if="isSearch && !hideActions && isClickable"
|
|
392
|
+
@clear="onClear"
|
|
393
|
+
/>
|
|
301
394
|
<!-- @slot Slot after input -->
|
|
302
395
|
<div v-if="$slots.after" class="vv-input-text__input-after">
|
|
303
396
|
<!-- @slot Slot before input icon -->
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { Component } from 'vue'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import VvInputPasswordAction from '@/components/VvInputText/VvInputPasswordAction'
|
|
8
|
-
import VvInputStepAction from '@/components/VvInputText/VvInputStepAction'
|
|
9
|
-
import VvInputClearAction from '@/components/VvInputText/VvInputClearAction'
|
|
2
|
+
import { type VvInputTextPropsTypes, INPUT_TYPES } from '.'
|
|
3
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
4
|
+
import VvInputPasswordAction from '../VvInputText/VvInputPasswordAction'
|
|
5
|
+
import VvInputStepAction from '../VvInputText/VvInputStepAction'
|
|
6
|
+
import VvInputClearAction from '../VvInputText/VvInputClearAction'
|
|
10
7
|
|
|
11
8
|
export default function VvInputTextActionsFactory(
|
|
12
9
|
type: string,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
-
import {
|
|
2
|
+
import type { MaskTokens } from 'maska'
|
|
3
|
+
import { InputTextareaProps } from '../../props'
|
|
3
4
|
|
|
4
5
|
export const INPUT_TYPES = {
|
|
5
6
|
TEXT: 'text',
|
|
@@ -135,6 +136,66 @@ export const VvInputTextProps = {
|
|
|
135
136
|
type: String,
|
|
136
137
|
default: 'Clear',
|
|
137
138
|
},
|
|
139
|
+
/**
|
|
140
|
+
* Input mask, only for text type
|
|
141
|
+
* @see https://beholdr.github.io/maska/
|
|
142
|
+
*/
|
|
143
|
+
mask: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: undefined,
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Show mask before typing
|
|
149
|
+
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
150
|
+
*/
|
|
151
|
+
maskEager: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false,
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Write values reverse (ex. for numbers)
|
|
157
|
+
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
158
|
+
*/
|
|
159
|
+
maskReversed: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: false,
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* Add mask custom tokens
|
|
165
|
+
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
166
|
+
*/
|
|
167
|
+
maskTokens: {
|
|
168
|
+
type: Object as PropType<MaskTokens>,
|
|
169
|
+
default: undefined,
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* Replace default tokens
|
|
173
|
+
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
174
|
+
*/
|
|
175
|
+
maskTokensReplace: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false,
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Adjust input width to content
|
|
181
|
+
*/
|
|
182
|
+
autoWidth: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false,
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Hide type number, password and search actions
|
|
188
|
+
*/
|
|
189
|
+
hideActions: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: false,
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Add unit label to input
|
|
195
|
+
*/
|
|
196
|
+
unit: {
|
|
197
|
+
type: String,
|
|
198
|
+
},
|
|
138
199
|
}
|
|
139
200
|
|
|
140
201
|
export type VvInputTextPropsTypes = ExtractPropTypes<typeof VvInputTextProps>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { VvProgressProps } from '
|
|
8
|
+
import { VvProgressProps } from '.'
|
|
9
9
|
|
|
10
10
|
// props
|
|
11
11
|
const props = defineProps(VvProgressProps)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
// styles
|
|
16
16
|
const { modifiers } = toRefs(props)
|
|
17
|
-
const bemCssClasses =
|
|
17
|
+
const bemCssClasses = useModifiers(
|
|
18
18
|
'vv-progress',
|
|
19
19
|
modifiers,
|
|
20
20
|
computed(() => ({ indeterminate: indeterminate.value })),
|
|
@@ -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(() => ({
|
|
@@ -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)
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
// count
|
|
62
62
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
63
63
|
mode: props.count,
|
|
64
|
-
upperLimit: props.maxlength,
|
|
65
|
-
lowerLimit: props.minlength,
|
|
64
|
+
upperLimit: Number(props.maxlength),
|
|
65
|
+
lowerLimit: Number(props.minlength),
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
// tabindex
|
|
@@ -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 '@/constants'
|
|
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
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
DropdownRole,
|
|
8
8
|
DropdownItemRole,
|
|
9
9
|
ActionRoles,
|
|
10
|
-
} from '
|
|
10
|
+
} from '../../constants'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Share the dropdown reference and the event bus with all its children.
|
|
@@ -64,7 +64,7 @@ export function useProvideDropdownItem({
|
|
|
64
64
|
role,
|
|
65
65
|
expanded,
|
|
66
66
|
}: {
|
|
67
|
-
role: Ref
|
|
67
|
+
role: Ref<`${DropdownRole}`>
|
|
68
68
|
expanded: Ref<boolean>
|
|
69
69
|
}) {
|
|
70
70
|
const itemRole = computed(() =>
|
|
@@ -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
|
})
|