@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
|
@@ -1,27 +1,145 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { autoPlacement
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { computed, defineComponent, h, Fragment, provide, unref, toRefs, useAttrs, ref, watch, nextTick, openBlock, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, withDirectives, createElementVNode, normalizeStyle, normalizeClass, createCommentVNode, mergeProps, vShow } from "vue";
|
|
2
|
+
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
import { useVModel, onClickOutside, useFocusWithin, onKeyStroke } from "@vueuse/core";
|
|
5
|
+
import mitt from "mitt";
|
|
6
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
7
|
+
Side2["left"] = "left";
|
|
8
|
+
Side2["right"] = "right";
|
|
9
|
+
Side2["top"] = "top";
|
|
10
|
+
Side2["bottom"] = "bottom";
|
|
11
|
+
return Side2;
|
|
12
|
+
})(Side || {});
|
|
13
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
14
|
+
Placement2["topStart"] = "top-start";
|
|
15
|
+
Placement2["topEnd"] = "top-end";
|
|
16
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
17
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
18
|
+
Placement2["leftStart"] = "left-start";
|
|
19
|
+
Placement2["leftEnd"] = "left-end";
|
|
20
|
+
Placement2["rightStart"] = "right-start";
|
|
21
|
+
Placement2["rightEnd"] = "right-end";
|
|
22
|
+
return Placement2;
|
|
23
|
+
})(Placement || {});
|
|
24
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
25
|
+
Position2["before"] = "before";
|
|
26
|
+
Position2["after"] = "after";
|
|
27
|
+
return Position2;
|
|
28
|
+
})(Position || {});
|
|
29
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
30
|
+
ButtonType2["button"] = "button";
|
|
31
|
+
ButtonType2["submit"] = "submit";
|
|
32
|
+
ButtonType2["reset"] = "reset";
|
|
33
|
+
return ButtonType2;
|
|
34
|
+
})(ButtonType || {});
|
|
35
|
+
var DropdownRole = /* @__PURE__ */ ((DropdownRole2) => {
|
|
36
|
+
DropdownRole2["listbox"] = "listbox";
|
|
37
|
+
DropdownRole2["menu"] = "menu";
|
|
38
|
+
return DropdownRole2;
|
|
39
|
+
})(DropdownRole || {});
|
|
40
|
+
var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
|
|
41
|
+
DropdownItemRole2["option"] = "option";
|
|
42
|
+
DropdownItemRole2["presentation"] = "presentation";
|
|
43
|
+
return DropdownItemRole2;
|
|
44
|
+
})(DropdownItemRole || {});
|
|
45
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
46
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
47
|
+
AnchorTarget2["_self"] = "_self";
|
|
48
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
49
|
+
AnchorTarget2["_top"] = "_top";
|
|
50
|
+
return AnchorTarget2;
|
|
51
|
+
})(AnchorTarget || {});
|
|
52
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
|
|
53
|
+
const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
|
|
54
|
+
const LinkProps = {
|
|
55
|
+
/**
|
|
56
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
57
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
58
|
+
*/
|
|
59
|
+
to: {
|
|
60
|
+
type: [String, Object]
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Anchor href
|
|
64
|
+
*/
|
|
65
|
+
href: String,
|
|
66
|
+
/**
|
|
67
|
+
* Anchor target
|
|
68
|
+
*/
|
|
69
|
+
target: {
|
|
70
|
+
type: String,
|
|
71
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Anchor rel
|
|
75
|
+
*/
|
|
76
|
+
rel: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: "noopener noreferrer"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const DisabledProps = {
|
|
82
|
+
/**
|
|
83
|
+
* Whether the form control is disabled
|
|
84
|
+
*/
|
|
85
|
+
disabled: Boolean
|
|
86
|
+
};
|
|
87
|
+
const ActiveProps = {
|
|
88
|
+
/**
|
|
89
|
+
* Whether the item is active
|
|
90
|
+
*/
|
|
91
|
+
active: Boolean
|
|
92
|
+
};
|
|
93
|
+
const PressedProps = {
|
|
94
|
+
/**
|
|
95
|
+
* Whether the item is pressed
|
|
96
|
+
*/
|
|
97
|
+
pressed: Boolean
|
|
98
|
+
};
|
|
99
|
+
const LabelProps = {
|
|
100
|
+
/**
|
|
101
|
+
* The item label
|
|
102
|
+
*/
|
|
103
|
+
label: [String, Number]
|
|
104
|
+
};
|
|
105
|
+
const ModifiersProps = {
|
|
5
106
|
/**
|
|
6
107
|
* Component BEM modifiers
|
|
7
108
|
*/
|
|
8
109
|
modifiers: [String, Array]
|
|
9
110
|
};
|
|
10
|
-
|
|
11
|
-
|
|
111
|
+
({
|
|
112
|
+
/**
|
|
113
|
+
* VvIcon name or props
|
|
114
|
+
* @see VVIcon
|
|
115
|
+
*/
|
|
116
|
+
icon: { type: [String, Object] },
|
|
117
|
+
/**
|
|
118
|
+
* VvIcon position
|
|
119
|
+
*/
|
|
120
|
+
iconPosition: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: Position.before,
|
|
123
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
const IdProps = {
|
|
12
127
|
/**
|
|
13
128
|
* Global attribute id
|
|
14
129
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
15
130
|
*/
|
|
16
131
|
id: [String, Number]
|
|
17
|
-
}
|
|
132
|
+
};
|
|
133
|
+
const DropdownProps = {
|
|
18
134
|
/**
|
|
19
135
|
* Dropdown placement
|
|
20
136
|
*/
|
|
21
137
|
placement: {
|
|
22
138
|
type: String,
|
|
23
|
-
default:
|
|
24
|
-
validator: (
|
|
139
|
+
default: Side.bottom,
|
|
140
|
+
validator: (value) => {
|
|
141
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
142
|
+
}
|
|
25
143
|
},
|
|
26
144
|
/**
|
|
27
145
|
* Dropdown show / hide transition name
|
|
@@ -43,7 +161,7 @@ const Se = {
|
|
|
43
161
|
*/
|
|
44
162
|
shift: {
|
|
45
163
|
type: [Boolean, Object],
|
|
46
|
-
default:
|
|
164
|
+
default: false
|
|
47
165
|
},
|
|
48
166
|
/**
|
|
49
167
|
* Flip dropdown position if there is no space in the default position
|
|
@@ -51,7 +169,7 @@ const Se = {
|
|
|
51
169
|
*/
|
|
52
170
|
flip: {
|
|
53
171
|
type: [Boolean, Object],
|
|
54
|
-
default:
|
|
172
|
+
default: true
|
|
55
173
|
},
|
|
56
174
|
/**
|
|
57
175
|
* Size of the dropdown
|
|
@@ -67,7 +185,7 @@ const Se = {
|
|
|
67
185
|
*/
|
|
68
186
|
autoPlacement: {
|
|
69
187
|
type: [Boolean, Object],
|
|
70
|
-
default:
|
|
188
|
+
default: false
|
|
71
189
|
},
|
|
72
190
|
/**
|
|
73
191
|
* Add arrow to the dropdown
|
|
@@ -75,21 +193,21 @@ const Se = {
|
|
|
75
193
|
*/
|
|
76
194
|
arrow: {
|
|
77
195
|
type: Boolean,
|
|
78
|
-
default:
|
|
196
|
+
default: false
|
|
79
197
|
},
|
|
80
198
|
/**
|
|
81
199
|
* Close dropdown on click outside
|
|
82
200
|
*/
|
|
83
201
|
autoClose: {
|
|
84
202
|
type: Boolean,
|
|
85
|
-
default:
|
|
203
|
+
default: true
|
|
86
204
|
},
|
|
87
205
|
/**
|
|
88
206
|
* Autofocus first item on dropdown open
|
|
89
207
|
*/
|
|
90
208
|
autofocusFirst: {
|
|
91
209
|
type: Boolean,
|
|
92
|
-
default:
|
|
210
|
+
default: true
|
|
93
211
|
},
|
|
94
212
|
/**
|
|
95
213
|
* Set dropdown width to the same as the trigger
|
|
@@ -97,10 +215,26 @@ const Se = {
|
|
|
97
215
|
triggerWidth: {
|
|
98
216
|
type: Boolean
|
|
99
217
|
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
...
|
|
103
|
-
...
|
|
218
|
+
};
|
|
219
|
+
({
|
|
220
|
+
...DisabledProps,
|
|
221
|
+
...LabelProps,
|
|
222
|
+
...PressedProps,
|
|
223
|
+
...ActiveProps,
|
|
224
|
+
...LinkProps,
|
|
225
|
+
/**
|
|
226
|
+
* Button type
|
|
227
|
+
*/
|
|
228
|
+
type: {
|
|
229
|
+
type: String,
|
|
230
|
+
default: ButtonType.button,
|
|
231
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const VvDropdownProps = {
|
|
235
|
+
...IdProps,
|
|
236
|
+
...ModifiersProps,
|
|
237
|
+
...DropdownProps,
|
|
104
238
|
/**
|
|
105
239
|
* Show / hide dropdown programmatically
|
|
106
240
|
*/
|
|
@@ -120,225 +254,405 @@ const Se = {
|
|
|
120
254
|
*/
|
|
121
255
|
role: {
|
|
122
256
|
type: String,
|
|
123
|
-
default:
|
|
124
|
-
validator: (
|
|
257
|
+
default: DropdownRole.menu,
|
|
258
|
+
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
125
259
|
}
|
|
126
|
-
}
|
|
260
|
+
};
|
|
261
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
262
|
+
function useProvideDropdownTrigger({
|
|
263
|
+
reference,
|
|
264
|
+
id,
|
|
265
|
+
expanded,
|
|
266
|
+
aria
|
|
267
|
+
}) {
|
|
268
|
+
const bus = mitt();
|
|
269
|
+
const component = defineComponent({
|
|
270
|
+
name: "VvDropdownTriggerProvider",
|
|
271
|
+
provide() {
|
|
272
|
+
return {
|
|
273
|
+
[INJECTION_KEY_DROPDOWN_TRIGGER]: {
|
|
274
|
+
reference,
|
|
275
|
+
id,
|
|
276
|
+
expanded,
|
|
277
|
+
aria,
|
|
278
|
+
bus
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
setup() {
|
|
283
|
+
return {};
|
|
284
|
+
},
|
|
285
|
+
render() {
|
|
286
|
+
var _a, _b;
|
|
287
|
+
return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
return {
|
|
291
|
+
bus,
|
|
292
|
+
component
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function useProvideDropdownItem({
|
|
296
|
+
role,
|
|
297
|
+
expanded
|
|
298
|
+
}) {
|
|
299
|
+
const itemRole = computed(
|
|
300
|
+
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
301
|
+
);
|
|
302
|
+
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
303
|
+
role: itemRole,
|
|
304
|
+
expanded
|
|
305
|
+
});
|
|
306
|
+
return { itemRole };
|
|
307
|
+
}
|
|
308
|
+
function useModifiers(prefix, modifiers, others) {
|
|
309
|
+
return computed(() => {
|
|
310
|
+
const toReturn = {
|
|
311
|
+
[prefix]: true
|
|
312
|
+
};
|
|
313
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
314
|
+
if (modifiersArray) {
|
|
315
|
+
if (Array.isArray(modifiersArray)) {
|
|
316
|
+
modifiersArray.forEach((modifier) => {
|
|
317
|
+
if (modifier) {
|
|
318
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (others) {
|
|
324
|
+
Object.keys(others.value).forEach((key) => {
|
|
325
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return toReturn;
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const _hoisted_1 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
332
|
+
const __default__ = {
|
|
127
333
|
name: "VvDropdown",
|
|
128
|
-
inheritAttrs:
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
334
|
+
inheritAttrs: false
|
|
335
|
+
};
|
|
336
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
337
|
+
...__default__,
|
|
338
|
+
props: VvDropdownProps,
|
|
132
339
|
emits: ["update:modelValue"],
|
|
133
|
-
setup(
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
340
|
+
setup(__props, { emit }) {
|
|
341
|
+
const props = __props;
|
|
342
|
+
const { id } = toRefs(props);
|
|
343
|
+
const hasId = useUniqueId(id);
|
|
344
|
+
const attrs = useAttrs();
|
|
345
|
+
const maxWidth = ref("auto");
|
|
346
|
+
const maxHeight = ref("auto");
|
|
347
|
+
const localReferenceEl = ref(null);
|
|
348
|
+
const floatingEl = ref(null);
|
|
349
|
+
const arrowEl = ref(null);
|
|
350
|
+
const listEl = ref(null);
|
|
351
|
+
const referenceEl = computed({
|
|
352
|
+
get: () => props.reference ?? localReferenceEl.value,
|
|
353
|
+
set: (newValue) => {
|
|
354
|
+
localReferenceEl.value = newValue;
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
const middleware = computed(() => {
|
|
358
|
+
const toReturn = [];
|
|
359
|
+
if (props.autoPlacement) {
|
|
360
|
+
if (typeof props.autoPlacement === "boolean") {
|
|
361
|
+
toReturn.push(autoPlacement());
|
|
362
|
+
} else {
|
|
363
|
+
toReturn.push(
|
|
364
|
+
autoPlacement(props.autoPlacement)
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
} else if (props.flip) {
|
|
368
|
+
if (typeof props.flip === "boolean") {
|
|
369
|
+
toReturn.push(flip());
|
|
370
|
+
} else {
|
|
371
|
+
toReturn.push(flip(props.flip));
|
|
372
|
+
}
|
|
138
373
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
374
|
+
if (props.shift) {
|
|
375
|
+
if (typeof props.shift === "boolean") {
|
|
376
|
+
toReturn.push(shift());
|
|
377
|
+
} else {
|
|
378
|
+
toReturn.push(shift(props.shift));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (props.size) {
|
|
382
|
+
const apply = ({
|
|
383
|
+
availableWidth,
|
|
384
|
+
availableHeight
|
|
147
385
|
}) => {
|
|
148
|
-
|
|
386
|
+
maxWidth.value = `${availableWidth}px`;
|
|
387
|
+
maxHeight.value = `${availableHeight}px`;
|
|
149
388
|
};
|
|
150
|
-
typeof
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
389
|
+
if (typeof props.size === "boolean") {
|
|
390
|
+
toReturn.push(
|
|
391
|
+
size({
|
|
392
|
+
apply
|
|
393
|
+
})
|
|
394
|
+
);
|
|
395
|
+
} else {
|
|
396
|
+
toReturn.push(
|
|
397
|
+
size({
|
|
398
|
+
...props.size,
|
|
399
|
+
apply
|
|
400
|
+
})
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (props.offset) {
|
|
405
|
+
toReturn.push(offset(Number(props.offset)));
|
|
406
|
+
if (["string", "number"].includes(typeof props.offset)) {
|
|
407
|
+
toReturn.push(offset(Number(props.offset)));
|
|
408
|
+
} else {
|
|
409
|
+
toReturn.push(offset(props.offset));
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (props.arrow) {
|
|
413
|
+
toReturn.push(
|
|
414
|
+
arrow({
|
|
415
|
+
element: arrowEl
|
|
158
416
|
})
|
|
159
417
|
);
|
|
160
418
|
}
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}), { x: G, y: J, strategy: Q, middlewareData: O, placement: X } = we(
|
|
167
|
-
s,
|
|
168
|
-
n,
|
|
419
|
+
return toReturn;
|
|
420
|
+
});
|
|
421
|
+
const { x, y, strategy, middlewareData, placement } = useFloating(
|
|
422
|
+
referenceEl,
|
|
423
|
+
floatingEl,
|
|
169
424
|
{
|
|
170
|
-
whileElementsMounted:
|
|
171
|
-
placement:
|
|
172
|
-
middleware
|
|
425
|
+
whileElementsMounted: autoUpdate,
|
|
426
|
+
placement: props.placement,
|
|
427
|
+
middleware
|
|
173
428
|
}
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
429
|
+
);
|
|
430
|
+
const dropdownPlacement = computed(() => ({
|
|
431
|
+
position: strategy.value,
|
|
432
|
+
top: `${y.value ?? 0}px`,
|
|
433
|
+
left: `${x.value ?? 0}px`,
|
|
434
|
+
maxWidth: maxWidth.value,
|
|
435
|
+
maxHeight: maxHeight.value,
|
|
436
|
+
width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
|
|
437
|
+
}));
|
|
438
|
+
const side = computed(() => placement.value.split("-")[0]);
|
|
439
|
+
const staticSide = computed(
|
|
182
440
|
() => ({
|
|
183
441
|
top: "bottom",
|
|
184
442
|
right: "left",
|
|
185
443
|
bottom: "top",
|
|
186
444
|
left: "right"
|
|
187
|
-
})[
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
445
|
+
})[side.value] ?? "bottom"
|
|
446
|
+
);
|
|
447
|
+
const arrowPlacement = computed(() => {
|
|
448
|
+
var _a, _b, _c, _d;
|
|
449
|
+
if (["bottom", "top"].includes(staticSide.value)) {
|
|
450
|
+
return {
|
|
451
|
+
right: `${((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) ?? 0}px`,
|
|
452
|
+
[staticSide.value]: `${-(((_b = arrowEl.value) == null ? void 0 : _b.offsetWidth) ?? 0) / 2}px`
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
top: `${((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) ?? 0}px`,
|
|
457
|
+
[staticSide.value]: `${-(((_d = arrowEl.value) == null ? void 0 : _d.offsetWidth) ?? 0) / 2}px`
|
|
196
458
|
};
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
459
|
+
});
|
|
460
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
461
|
+
const localModelValue = ref(false);
|
|
462
|
+
const expanded = computed({
|
|
463
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
464
|
+
set: (newValue) => {
|
|
465
|
+
if (modelValue.value === void 0) {
|
|
466
|
+
localModelValue.value = newValue;
|
|
202
467
|
return;
|
|
203
468
|
}
|
|
204
|
-
|
|
469
|
+
modelValue.value = newValue;
|
|
205
470
|
}
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
a.value = !1;
|
|
210
|
-
}, $ = () => {
|
|
211
|
-
a.value = !a.value;
|
|
212
|
-
}, oe = (e) => {
|
|
213
|
-
s.value = e;
|
|
471
|
+
});
|
|
472
|
+
const show = () => {
|
|
473
|
+
expanded.value = true;
|
|
214
474
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
475
|
+
const hide = () => {
|
|
476
|
+
expanded.value = false;
|
|
477
|
+
};
|
|
478
|
+
const toggle = () => {
|
|
479
|
+
expanded.value = !expanded.value;
|
|
480
|
+
};
|
|
481
|
+
const init = (el) => {
|
|
482
|
+
referenceEl.value = el;
|
|
483
|
+
};
|
|
484
|
+
watch(expanded, (newValue) => {
|
|
485
|
+
if (newValue && props.autofocusFirst) {
|
|
486
|
+
nextTick(() => {
|
|
487
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
488
|
+
floatingEl.value
|
|
489
|
+
);
|
|
490
|
+
if (focusableElements.length > 0) {
|
|
491
|
+
focusableElements[0].focus();
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
onClickOutside(
|
|
497
|
+
floatingEl,
|
|
224
498
|
() => {
|
|
225
|
-
|
|
499
|
+
if (props.autoClose) {
|
|
500
|
+
expanded.value = false;
|
|
501
|
+
}
|
|
226
502
|
},
|
|
227
|
-
{ ignore: [
|
|
503
|
+
{ ignore: [referenceEl] }
|
|
228
504
|
);
|
|
229
|
-
const
|
|
230
|
-
var
|
|
231
|
-
return ((
|
|
232
|
-
})
|
|
233
|
-
|
|
234
|
-
"aria-
|
|
235
|
-
"aria-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
505
|
+
const hasAriaLabelledby = computed(() => {
|
|
506
|
+
var _a, _b;
|
|
507
|
+
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
508
|
+
});
|
|
509
|
+
const referenceAria = computed(() => ({
|
|
510
|
+
"aria-controls": hasId.value,
|
|
511
|
+
"aria-haspopup": true,
|
|
512
|
+
"aria-expanded": expanded.value
|
|
513
|
+
}));
|
|
514
|
+
const { component: VvDropdownTriggerProvider, bus } = useProvideDropdownTrigger({
|
|
515
|
+
reference: referenceEl,
|
|
516
|
+
id: hasId,
|
|
517
|
+
expanded,
|
|
518
|
+
aria: referenceAria
|
|
241
519
|
});
|
|
242
|
-
|
|
243
|
-
const { role
|
|
520
|
+
bus.on("click", toggle);
|
|
521
|
+
const { role, modifiers } = toRefs(props);
|
|
522
|
+
const { itemRole } = useProvideDropdownItem({ role, expanded });
|
|
523
|
+
const bemCssClasses = useModifiers(
|
|
244
524
|
"vv-dropdown",
|
|
245
|
-
|
|
525
|
+
modifiers,
|
|
246
526
|
computed(() => ({
|
|
247
|
-
arrow:
|
|
527
|
+
arrow: props.arrow
|
|
248
528
|
}))
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
529
|
+
);
|
|
530
|
+
const { focused } = useFocusWithin(floatingEl);
|
|
531
|
+
function getKeyboardFocusableElements(element) {
|
|
532
|
+
if (!element) {
|
|
533
|
+
return [];
|
|
534
|
+
}
|
|
535
|
+
return [
|
|
536
|
+
...element.querySelectorAll(
|
|
253
537
|
'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
|
|
254
538
|
)
|
|
255
539
|
].filter(
|
|
256
|
-
(
|
|
257
|
-
)
|
|
540
|
+
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
541
|
+
);
|
|
258
542
|
}
|
|
259
|
-
const
|
|
543
|
+
const focusNext = () => {
|
|
260
544
|
nextTick(() => {
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
|
|
545
|
+
if (focused.value) {
|
|
546
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
547
|
+
floatingEl.value
|
|
264
548
|
);
|
|
265
|
-
if (
|
|
549
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
266
550
|
return;
|
|
267
|
-
|
|
551
|
+
}
|
|
552
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
268
553
|
document.activeElement
|
|
269
554
|
);
|
|
270
|
-
|
|
555
|
+
if (activeElementIndex < focusableElements.length - 1) {
|
|
556
|
+
focusableElements[activeElementIndex + 1].focus();
|
|
557
|
+
} else {
|
|
558
|
+
focusableElements[0].focus();
|
|
559
|
+
}
|
|
271
560
|
}
|
|
272
561
|
});
|
|
273
|
-
}
|
|
562
|
+
};
|
|
563
|
+
const focusPrev = () => {
|
|
274
564
|
nextTick(() => {
|
|
275
|
-
if (
|
|
276
|
-
const
|
|
277
|
-
|
|
565
|
+
if (focused.value) {
|
|
566
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
567
|
+
floatingEl.value
|
|
278
568
|
);
|
|
279
|
-
if (
|
|
569
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
280
570
|
return;
|
|
281
|
-
|
|
571
|
+
}
|
|
572
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
282
573
|
document.activeElement
|
|
283
574
|
);
|
|
284
|
-
|
|
575
|
+
if (activeElementIndex > 0) {
|
|
576
|
+
focusableElements[activeElementIndex - 1].focus();
|
|
577
|
+
} else {
|
|
578
|
+
focusableElements[focusableElements.length - 1].focus();
|
|
579
|
+
}
|
|
285
580
|
}
|
|
286
581
|
});
|
|
287
582
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
583
|
+
onKeyStroke("Escape", (e) => {
|
|
584
|
+
if (expanded.value) {
|
|
585
|
+
e.preventDefault();
|
|
586
|
+
hide();
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
onKeyStroke("ArrowDown", (e) => {
|
|
590
|
+
if (expanded.value && focused.value) {
|
|
591
|
+
e.preventDefault();
|
|
592
|
+
focusNext();
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
onKeyStroke("ArrowUp", (e) => {
|
|
596
|
+
if (expanded.value && focused.value) {
|
|
597
|
+
e.preventDefault();
|
|
598
|
+
focusPrev();
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
onKeyStroke([" ", "Enter"], (e) => {
|
|
602
|
+
if (expanded.value && focused.value) {
|
|
603
|
+
e.preventDefault();
|
|
604
|
+
const activeElement = document.activeElement;
|
|
605
|
+
activeElement.click();
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
return (_ctx, _cache) => {
|
|
609
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
610
|
+
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
611
|
+
default: withCtx(() => [
|
|
612
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
|
|
613
|
+
]),
|
|
614
|
+
_: 3
|
|
615
|
+
}),
|
|
616
|
+
createVNode(Transition, { name: _ctx.transitionName }, {
|
|
617
|
+
default: withCtx(() => [
|
|
618
|
+
withDirectives(createElementVNode("div", {
|
|
619
|
+
ref_key: "floatingEl",
|
|
620
|
+
ref: floatingEl,
|
|
621
|
+
style: normalizeStyle(unref(dropdownPlacement)),
|
|
622
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
623
|
+
}, [
|
|
624
|
+
props.arrow ? (openBlock(), createElementBlock("div", {
|
|
625
|
+
key: 0,
|
|
626
|
+
ref_key: "arrowEl",
|
|
627
|
+
ref: arrowEl,
|
|
628
|
+
style: normalizeStyle(unref(arrowPlacement)),
|
|
629
|
+
class: "vv-dropdown__arrow"
|
|
630
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
631
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
|
|
632
|
+
createElementVNode("ul", mergeProps(unref(attrs), {
|
|
633
|
+
id: unref(hasId),
|
|
634
|
+
ref_key: "listEl",
|
|
635
|
+
ref: listEl,
|
|
636
|
+
tabindex: !unref(expanded) ? -1 : void 0,
|
|
637
|
+
role: unref(role),
|
|
638
|
+
"aria-labelledby": unref(hasAriaLabelledby),
|
|
639
|
+
class: "vv-dropdown__list"
|
|
640
|
+
}), [
|
|
641
|
+
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
642
|
+
role: unref(itemRole)
|
|
643
|
+
})))
|
|
644
|
+
], 16, _hoisted_1),
|
|
645
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
646
|
+
], 6), [
|
|
647
|
+
[vShow, unref(expanded)]
|
|
648
|
+
])
|
|
649
|
+
]),
|
|
650
|
+
_: 3
|
|
651
|
+
}, 8, ["name"])
|
|
652
|
+
], 64);
|
|
653
|
+
};
|
|
340
654
|
}
|
|
341
655
|
});
|
|
342
656
|
export {
|
|
343
|
-
|
|
657
|
+
_sfc_main as default
|
|
344
658
|
};
|