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