@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
|
@@ -7,21 +7,28 @@
|
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
9
|
import type { Ref } from 'vue'
|
|
10
|
-
import { VvComboboxProps, VvComboboxEvents } from '
|
|
11
|
-
import VvIcon from '
|
|
12
|
-
import VvDropdown from '
|
|
13
|
-
import VvDropdownOption from '
|
|
14
|
-
import VvSelect from '
|
|
15
|
-
import VvBadge from '
|
|
16
|
-
import HintSlotFactory from '
|
|
17
|
-
import type { Option } from '
|
|
18
|
-
import { DropdownRole } from '
|
|
10
|
+
import { VvComboboxProps, VvComboboxEvents } from '.'
|
|
11
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
12
|
+
import VvDropdown from '../VvDropdown/VvDropdown.vue'
|
|
13
|
+
import VvDropdownOption from '../VvDropdown/VvDropdownOption.vue'
|
|
14
|
+
import VvSelect from '../VvSelect/VvSelect.vue'
|
|
15
|
+
import VvBadge from '../VvBadge/VvBadge.vue'
|
|
16
|
+
import HintSlotFactory from '../common/HintSlot'
|
|
17
|
+
import type { Option } from '../../types/generic'
|
|
18
|
+
import { DropdownRole } from '../../constants'
|
|
19
19
|
|
|
20
20
|
// props, emit and slots
|
|
21
21
|
const props = defineProps(VvComboboxProps)
|
|
22
22
|
const emit = defineEmits(VvComboboxEvents)
|
|
23
23
|
const slots = useSlots()
|
|
24
24
|
|
|
25
|
+
// props merged with volver defaults (now only for labels)
|
|
26
|
+
const propsDefaults = useDefaults<typeof VvComboboxProps>(
|
|
27
|
+
'VvCombobox',
|
|
28
|
+
VvComboboxProps,
|
|
29
|
+
props,
|
|
30
|
+
)
|
|
31
|
+
|
|
25
32
|
// hint slot
|
|
26
33
|
const { HintSlot } = HintSlotFactory(props, slots)
|
|
27
34
|
|
|
@@ -126,7 +133,7 @@
|
|
|
126
133
|
})
|
|
127
134
|
|
|
128
135
|
// styles
|
|
129
|
-
const bemCssClasses =
|
|
136
|
+
const bemCssClasses = useModifiers(
|
|
130
137
|
'vv-select',
|
|
131
138
|
modifiers,
|
|
132
139
|
computed(() => ({
|
|
@@ -186,7 +193,7 @@
|
|
|
186
193
|
const selectedOptions = computed(() => {
|
|
187
194
|
let selectedValues: Array<typeof props.modelValue> = []
|
|
188
195
|
if (Array.isArray(props.modelValue)) {
|
|
189
|
-
selectedValues = props.modelValue
|
|
196
|
+
selectedValues = props.modelValue as Array<typeof props.modelValue>
|
|
190
197
|
} else if (props.modelValue) {
|
|
191
198
|
selectedValues = [props.modelValue]
|
|
192
199
|
}
|
|
@@ -230,10 +237,11 @@
|
|
|
230
237
|
if (props.multiple) {
|
|
231
238
|
// check maxValues prop and block check new values
|
|
232
239
|
if (Array.isArray(props.modelValue)) {
|
|
240
|
+
const maxValues = Number(props.maxValues)
|
|
233
241
|
if (
|
|
234
242
|
props.maxValues !== undefined &&
|
|
235
|
-
|
|
236
|
-
props.modelValue?.length >=
|
|
243
|
+
maxValues >= 0 &&
|
|
244
|
+
props.modelValue?.length >= maxValues
|
|
237
245
|
) {
|
|
238
246
|
if (!contains(value, props.modelValue)) {
|
|
239
247
|
// maxValues reached
|
|
@@ -246,8 +254,13 @@
|
|
|
246
254
|
} else {
|
|
247
255
|
toReturn = [value as Option]
|
|
248
256
|
}
|
|
249
|
-
} else
|
|
250
|
-
|
|
257
|
+
} else {
|
|
258
|
+
if (props.autoClose) {
|
|
259
|
+
collapse()
|
|
260
|
+
}
|
|
261
|
+
if (props.unselectable && value === props.modelValue) {
|
|
262
|
+
toReturn = undefined
|
|
263
|
+
}
|
|
251
264
|
}
|
|
252
265
|
emit('update:modelValue', toReturn)
|
|
253
266
|
}
|
|
@@ -257,12 +270,12 @@
|
|
|
257
270
|
name: props.name,
|
|
258
271
|
tabindex: hasTabindex.value,
|
|
259
272
|
valid: valid.value,
|
|
260
|
-
validLabel:
|
|
273
|
+
validLabel: propsDefaults.value.validLabel,
|
|
261
274
|
invalid: invalid.value,
|
|
262
|
-
invalidLabel:
|
|
263
|
-
hintLabel:
|
|
275
|
+
invalidLabel: propsDefaults.value.invalidLabel,
|
|
276
|
+
hintLabel: propsDefaults.value.hintLabel,
|
|
264
277
|
loading: loading.value,
|
|
265
|
-
loadingLabel:
|
|
278
|
+
loadingLabel: propsDefaults.value.loadingLabel,
|
|
266
279
|
disabled: disabled.value,
|
|
267
280
|
readonly: readonly.value,
|
|
268
281
|
modifiers: props.modifiers,
|
|
@@ -283,6 +296,7 @@
|
|
|
283
296
|
id: hasDropdownId.value,
|
|
284
297
|
reference: wrapperEl.value,
|
|
285
298
|
placement: props.placement,
|
|
299
|
+
strategy: props.strategy,
|
|
286
300
|
transitionName: props.transitionName,
|
|
287
301
|
offset: props.offset,
|
|
288
302
|
shift: props.shift,
|
|
@@ -350,7 +364,7 @@
|
|
|
350
364
|
spellcheck="false"
|
|
351
365
|
type="search"
|
|
352
366
|
class="vv-dropdown__search"
|
|
353
|
-
:placeholder="searchPlaceholder"
|
|
367
|
+
:placeholder="propsDefaults.searchPlaceholder"
|
|
354
368
|
/>
|
|
355
369
|
</template>
|
|
356
370
|
<template #default="{ aria }">
|
|
@@ -398,7 +412,9 @@
|
|
|
398
412
|
!readonly &&
|
|
399
413
|
!disabled
|
|
400
414
|
"
|
|
401
|
-
:aria-label="
|
|
415
|
+
:aria-label="
|
|
416
|
+
propsDefaults.deselectActionLabel
|
|
417
|
+
"
|
|
402
418
|
@click.stop="onInput(option)"
|
|
403
419
|
>
|
|
404
420
|
<VvIcon name="close" />
|
|
@@ -429,9 +445,11 @@
|
|
|
429
445
|
disabled: getOptionDisabled(option),
|
|
430
446
|
selected: getOptionSelected(option),
|
|
431
447
|
unselectable,
|
|
432
|
-
deselectHintLabel
|
|
433
|
-
|
|
434
|
-
|
|
448
|
+
deselectHintLabel:
|
|
449
|
+
propsDefaults.deselectHintLabel,
|
|
450
|
+
selectHintLabel: propsDefaults.selectHintLabel,
|
|
451
|
+
selectedHintLabel:
|
|
452
|
+
propsDefaults.selectedHintLabel,
|
|
435
453
|
}"
|
|
436
454
|
:key="index"
|
|
437
455
|
class="vv-dropdown-option"
|
|
@@ -457,13 +475,13 @@
|
|
|
457
475
|
>
|
|
458
476
|
<!-- @slot Slot for no options available -->
|
|
459
477
|
<slot name="no-options">
|
|
460
|
-
{{ noOptionsLabel }}
|
|
478
|
+
{{ propsDefaults.noOptionsLabel }}
|
|
461
479
|
</slot>
|
|
462
480
|
</VvDropdownOption>
|
|
463
481
|
<VvDropdownOption v-else modifiers="inert">
|
|
464
482
|
<!-- @slot Slot for no results available -->
|
|
465
483
|
<slot name="no-results">
|
|
466
|
-
{{ noResultsLabel }}
|
|
484
|
+
{{ propsDefaults.noResultsLabel }}
|
|
467
485
|
</slot>
|
|
468
486
|
</VvDropdownOption>
|
|
469
487
|
</template>
|
|
@@ -6,15 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import type { DialogHTMLAttributes } from 'vue'
|
|
9
|
-
import VvIcon from '
|
|
10
|
-
import { VvDialogEvents, VvDialogProps } from '
|
|
9
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
10
|
+
import { VvDialogEvents, VvDialogProps } from '.'
|
|
11
11
|
|
|
12
|
-
// props
|
|
12
|
+
// props and emit
|
|
13
13
|
const props = defineProps(VvDialogProps)
|
|
14
14
|
const emit = defineEmits(VvDialogEvents)
|
|
15
15
|
|
|
16
16
|
// data
|
|
17
|
-
const
|
|
17
|
+
const localModelValue = ref(false)
|
|
18
|
+
const modelValue = computed({
|
|
19
|
+
get() {
|
|
20
|
+
return props.modelValue ?? localModelValue.value
|
|
21
|
+
},
|
|
22
|
+
set(value) {
|
|
23
|
+
if (props.modelValue === undefined) {
|
|
24
|
+
localModelValue.value = value
|
|
25
|
+
}
|
|
26
|
+
emit('update:modelValue', value)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
18
29
|
const htmlAttrIsOpen = ref(true)
|
|
19
30
|
|
|
20
31
|
// template ref
|
|
@@ -51,26 +62,32 @@
|
|
|
51
62
|
// methods
|
|
52
63
|
onClickOutside(modalWrapper, () => {
|
|
53
64
|
if (props.autoClose) {
|
|
54
|
-
|
|
65
|
+
modelValue.value = false
|
|
55
66
|
}
|
|
56
67
|
})
|
|
57
68
|
|
|
58
|
-
function
|
|
59
|
-
|
|
69
|
+
function close() {
|
|
70
|
+
modelValue.value = false
|
|
60
71
|
}
|
|
61
72
|
|
|
73
|
+
function open() {
|
|
74
|
+
modelValue.value = true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
defineExpose({ close, open })
|
|
78
|
+
|
|
62
79
|
// keyboard
|
|
63
80
|
onKeyStroke('Escape', (e) => {
|
|
64
|
-
if (
|
|
81
|
+
if (modelValue.value) {
|
|
65
82
|
e.preventDefault()
|
|
66
|
-
|
|
83
|
+
close()
|
|
67
84
|
}
|
|
68
85
|
})
|
|
69
86
|
</script>
|
|
70
87
|
|
|
71
88
|
<template>
|
|
72
89
|
<Transition :name="transitioName" v-on="dialogTransitionHandlers">
|
|
73
|
-
<dialog v-show="
|
|
90
|
+
<dialog v-show="modelValue" v-bind="dialogAttrs" :class="dialogClass">
|
|
74
91
|
<article ref="modalWrapper" class="vv-dialog__wrapper">
|
|
75
92
|
<header v-if="$slots.header || title" class="vv-dialog__header">
|
|
76
93
|
<!-- @slot Header slot -->
|
|
@@ -80,7 +97,7 @@
|
|
|
80
97
|
type="button"
|
|
81
98
|
aria-label="Close"
|
|
82
99
|
class="vv-dialog__close"
|
|
83
|
-
@click.passive="
|
|
100
|
+
@click.passive="close"
|
|
84
101
|
>
|
|
85
102
|
<VvIcon name="close" />
|
|
86
103
|
</button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdProps } from '
|
|
1
|
+
import { IdProps } from '../../props'
|
|
2
2
|
|
|
3
3
|
export const VvDialogEvents = ['open', 'close', 'update:modelValue']
|
|
4
4
|
|
|
@@ -11,7 +11,10 @@ export const VvDialogProps = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Show / hide dialog programmatically
|
|
13
13
|
*/
|
|
14
|
-
modelValue:
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: undefined,
|
|
17
|
+
},
|
|
15
18
|
/**
|
|
16
19
|
* Dialog transition
|
|
17
20
|
*/
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
arrow,
|
|
18
18
|
size,
|
|
19
19
|
} from '@floating-ui/vue'
|
|
20
|
-
import { VvDropdownProps } from '
|
|
20
|
+
import { VvDropdownProps } from '.'
|
|
21
21
|
import type {
|
|
22
22
|
AutoPlacementOptions,
|
|
23
23
|
FlipOptions,
|
|
24
24
|
OffsetOptions,
|
|
25
25
|
ShiftOptions,
|
|
26
26
|
SizeOptions,
|
|
27
|
-
} from '
|
|
27
|
+
} from '../../types/floating-ui'
|
|
28
28
|
|
|
29
29
|
// props, emit and attrs
|
|
30
30
|
const props = defineProps(VvDropdownProps)
|
|
@@ -127,7 +127,8 @@
|
|
|
127
127
|
floatingEl,
|
|
128
128
|
{
|
|
129
129
|
whileElementsMounted: autoUpdate,
|
|
130
|
-
placement: props.placement,
|
|
130
|
+
placement: computed(() => props.placement),
|
|
131
|
+
strategy: computed(() => props.strategy),
|
|
131
132
|
middleware,
|
|
132
133
|
},
|
|
133
134
|
)
|
|
@@ -194,6 +195,7 @@
|
|
|
194
195
|
const init = (el: HTMLElement) => {
|
|
195
196
|
referenceEl.value = el
|
|
196
197
|
}
|
|
198
|
+
defineExpose({ toggle, show, hide, init })
|
|
197
199
|
watch(expanded, (newValue) => {
|
|
198
200
|
if (newValue && props.autofocusFirst) {
|
|
199
201
|
nextTick(() => {
|
|
@@ -219,7 +221,7 @@
|
|
|
219
221
|
|
|
220
222
|
// aria
|
|
221
223
|
const hasAriaLabelledby = computed(() => {
|
|
222
|
-
return referenceEl.value?.getAttribute('id') ?? undefined
|
|
224
|
+
return referenceEl.value?.getAttribute?.('id') ?? undefined
|
|
223
225
|
})
|
|
224
226
|
const referenceAria = computed(() => ({
|
|
225
227
|
'aria-controls': hasId.value,
|
|
@@ -242,7 +244,7 @@
|
|
|
242
244
|
const { itemRole } = useProvideDropdownItem({ role, expanded })
|
|
243
245
|
|
|
244
246
|
// styles
|
|
245
|
-
const bemCssClasses =
|
|
247
|
+
const bemCssClasses = useModifiers(
|
|
246
248
|
'vv-dropdown',
|
|
247
249
|
modifiers,
|
|
248
250
|
computed(() => ({
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import VvAction from '
|
|
9
|
-
import VvDropdownItem from '
|
|
10
|
-
import { ActionProps, ModifiersProps } from '
|
|
8
|
+
import VvAction from '../VvAction/VvAction.vue'
|
|
9
|
+
import VvDropdownItem from '../VvDropdown/VvDropdownItem.vue'
|
|
10
|
+
import { ActionProps, ModifiersProps } from '../../props'
|
|
11
11
|
|
|
12
12
|
// props
|
|
13
13
|
const props = defineProps({
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @returns {Array} The component classes.
|
|
21
21
|
*/
|
|
22
22
|
const { modifiers } = toRefs(props)
|
|
23
|
-
const bemCssClasses =
|
|
23
|
+
const bemCssClasses = useModifiers('vv-dropdown-action', modifiers)
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
}"
|
|
39
39
|
:class="bemCssClasses"
|
|
40
40
|
>
|
|
41
|
-
<slot
|
|
41
|
+
<slot>
|
|
42
|
+
{{ label }}
|
|
43
|
+
</slot>
|
|
42
44
|
</VvAction>
|
|
43
45
|
</VvDropdownItem>
|
|
44
46
|
</template>
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import VvDropdownItem from '
|
|
8
|
+
import VvDropdownItem from './VvDropdownItem.vue'
|
|
9
9
|
import {
|
|
10
10
|
DisabledProps,
|
|
11
11
|
ModifiersProps,
|
|
12
12
|
SelectedProps,
|
|
13
13
|
UnselectableProps,
|
|
14
|
-
} from '
|
|
14
|
+
} from '../../props'
|
|
15
15
|
|
|
16
16
|
// props
|
|
17
17
|
const props = defineProps({
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
// style
|
|
34
34
|
const { modifiers } = toRefs(props)
|
|
35
|
-
const bemCssClasses =
|
|
35
|
+
const bemCssClasses = useModifiers(
|
|
36
36
|
'vv-dropdown-option',
|
|
37
37
|
modifiers,
|
|
38
38
|
computed(() => ({
|
|
@@ -41,6 +41,18 @@
|
|
|
41
41
|
unselectable: props.unselectable && props.selected,
|
|
42
42
|
})),
|
|
43
43
|
)
|
|
44
|
+
|
|
45
|
+
// hint
|
|
46
|
+
const hintLabel = computed(() => {
|
|
47
|
+
if (props.selected) {
|
|
48
|
+
return props.unselectable
|
|
49
|
+
? props.deselectHintLabel
|
|
50
|
+
: props.selectedHintLabel
|
|
51
|
+
}
|
|
52
|
+
if (!props.disabled) {
|
|
53
|
+
return props.selectHintLabel
|
|
54
|
+
}
|
|
55
|
+
})
|
|
44
56
|
</script>
|
|
45
57
|
|
|
46
58
|
<template>
|
|
@@ -51,14 +63,9 @@
|
|
|
51
63
|
:aria-disabled="disabled"
|
|
52
64
|
>
|
|
53
65
|
<slot />
|
|
54
|
-
<span class="vv-dropdown-option__hint">
|
|
66
|
+
<span class="vv-dropdown-option__hint" :title="hintLabel">
|
|
55
67
|
<slot name="hint" v-bind="{ disabled, selected, unselectable }">
|
|
56
|
-
|
|
57
|
-
{{ unselectable ? deselectHintLabel : selectedHintLabel }}
|
|
58
|
-
</template>
|
|
59
|
-
<template v-else-if="!disabled">
|
|
60
|
-
{{ selectHintLabel }}
|
|
61
|
-
</template>
|
|
68
|
+
{{ hintLabel }}
|
|
62
69
|
</slot>
|
|
63
70
|
</span>
|
|
64
71
|
</VvDropdownItem>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DropdownProps, IdProps, ModifiersProps } from '@/props'
|
|
2
1
|
import type { PropType } from 'vue'
|
|
3
|
-
import {
|
|
2
|
+
import { DropdownProps, IdProps, ModifiersProps } from '../../props'
|
|
3
|
+
import { DropdownRole } from '../../constants'
|
|
4
4
|
|
|
5
5
|
export const VvDropdownProps = {
|
|
6
6
|
...IdProps,
|
|
@@ -24,7 +24,7 @@ export const VvDropdownProps = {
|
|
|
24
24
|
* Dropdown role
|
|
25
25
|
*/
|
|
26
26
|
role: {
|
|
27
|
-
type: String as PropType
|
|
27
|
+
type: String as PropType<`${DropdownRole}`>,
|
|
28
28
|
default: DropdownRole.menu,
|
|
29
29
|
validator: (value: DropdownRole) =>
|
|
30
30
|
Object.values(DropdownRole).includes(value),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { Icon, addIcon, iconExists, type IconifyJSON } from '@iconify/vue'
|
|
9
|
-
import { VvIconProps } from '
|
|
9
|
+
import { VvIconProps } from '.'
|
|
10
10
|
|
|
11
11
|
// props
|
|
12
12
|
const props = defineProps(VvIconProps)
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
|
|
20
20
|
// classes
|
|
21
21
|
const { modifiers } = toRefs(props)
|
|
22
|
-
const bemCssClasses =
|
|
22
|
+
const bemCssClasses = useModifiers('vv-icon', modifiers)
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Provider name
|
|
26
26
|
*/
|
|
27
27
|
const provider = computed(() => {
|
|
28
|
-
return props.provider || volver?.
|
|
28
|
+
return props.provider || volver?.iconsProvider
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PropType } from 'vue'
|
|
2
2
|
import type { IconifyRenderMode } from '@iconify/vue'
|
|
3
3
|
|
|
4
|
-
export enum
|
|
4
|
+
export enum IconPrefix {
|
|
5
5
|
simple = 'simple',
|
|
6
6
|
normal = 'normal',
|
|
7
7
|
detailed = 'detailed',
|
|
@@ -46,7 +46,7 @@ export const VvIconProps = {
|
|
|
46
46
|
* Icon default options prefix: simple | normal | detailed
|
|
47
47
|
*/
|
|
48
48
|
prefix: {
|
|
49
|
-
type: String as PropType
|
|
49
|
+
type: String as PropType<`${IconPrefix}` | string>,
|
|
50
50
|
default: 'normal',
|
|
51
51
|
},
|
|
52
52
|
/**
|
|
@@ -74,7 +74,7 @@ export const VvIconProps = {
|
|
|
74
74
|
* 'svg' = svg
|
|
75
75
|
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
76
76
|
*/
|
|
77
|
-
mode: String as PropType
|
|
77
|
+
mode: String as PropType<`${IconifyRenderMode}`>,
|
|
78
78
|
/**
|
|
79
79
|
* Toggles inline or block mode
|
|
80
80
|
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import VvIcon from '
|
|
1
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
2
2
|
|
|
3
3
|
export default defineComponent({
|
|
4
4
|
components: {
|
|
@@ -34,7 +34,7 @@ export default defineComponent({
|
|
|
34
34
|
render() {
|
|
35
35
|
const icon = h(VvIcon, {
|
|
36
36
|
name: this.icon,
|
|
37
|
-
class: 'vv-input-
|
|
37
|
+
class: 'vv-input-text__icon',
|
|
38
38
|
})
|
|
39
39
|
|
|
40
40
|
return h(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TYPES_ICON } from '
|
|
2
|
-
import VvIcon from '
|
|
1
|
+
import { TYPES_ICON } from '../VvInputText'
|
|
2
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
3
3
|
|
|
4
4
|
export default defineComponent({
|
|
5
5
|
components: {
|
|
@@ -51,9 +51,8 @@ export default defineComponent({
|
|
|
51
51
|
render() {
|
|
52
52
|
const icon = h(VvIcon, {
|
|
53
53
|
name: this.activeIcon,
|
|
54
|
-
class: 'vv-input-
|
|
54
|
+
class: 'vv-input-text__icon',
|
|
55
55
|
})
|
|
56
|
-
|
|
57
56
|
return h(
|
|
58
57
|
'button',
|
|
59
58
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import VvIcon from '
|
|
1
|
+
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
2
2
|
|
|
3
3
|
export default defineComponent({
|
|
4
4
|
components: {
|
|
@@ -37,11 +37,12 @@ export default defineComponent({
|
|
|
37
37
|
render() {
|
|
38
38
|
return h('button', {
|
|
39
39
|
class: [
|
|
40
|
-
'vv-input-text__action-chevron',
|
|
40
|
+
'vv-input-text__action vv-input-text__action-chevron',
|
|
41
41
|
this.isUp && 'vv-input-text__action-chevron-up',
|
|
42
42
|
],
|
|
43
43
|
disabled: this.disabled,
|
|
44
44
|
ariaLabel: this.label,
|
|
45
|
+
type: 'button',
|
|
45
46
|
onClick: this.onClick,
|
|
46
47
|
})
|
|
47
48
|
},
|