@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,38 +1,53 @@
|
|
|
1
|
-
import { inject
|
|
1
|
+
import { inject, provide, defineComponent, ref, watch, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
|
|
2
2
|
import "mitt";
|
|
3
|
-
import { useElementHover
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { useElementHover, useFocus, useFocusWithin } from "@vueuse/core";
|
|
4
|
+
var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
|
|
5
|
+
ActionRoles2["button"] = "button";
|
|
6
|
+
ActionRoles2["link"] = "link";
|
|
7
|
+
ActionRoles2["menuitem"] = "menuitem";
|
|
8
|
+
return ActionRoles2;
|
|
9
|
+
})(ActionRoles || {});
|
|
10
|
+
const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
|
|
11
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
|
|
12
|
+
function useInjectedDropdownItem() {
|
|
13
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
8
14
|
}
|
|
9
|
-
function
|
|
10
|
-
expanded
|
|
15
|
+
function useProvideDropdownAction({
|
|
16
|
+
expanded
|
|
11
17
|
}) {
|
|
12
|
-
|
|
13
|
-
role:
|
|
14
|
-
expanded
|
|
18
|
+
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
19
|
+
role: ActionRoles.menuitem,
|
|
20
|
+
expanded
|
|
15
21
|
});
|
|
16
22
|
}
|
|
17
|
-
const
|
|
23
|
+
const __default__ = {
|
|
18
24
|
name: "VvDropdownItem"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
};
|
|
26
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
|
+
...__default__,
|
|
28
|
+
setup(__props) {
|
|
29
|
+
const { role, expanded } = useInjectedDropdownItem();
|
|
30
|
+
const element = ref(null);
|
|
31
|
+
useProvideDropdownAction({ expanded });
|
|
32
|
+
const hovered = useElementHover(element);
|
|
33
|
+
const { focused } = useFocus(element);
|
|
34
|
+
const { focused: focusedWithin } = useFocusWithin(element);
|
|
35
|
+
watch(hovered, (newValue) => {
|
|
36
|
+
if (newValue) {
|
|
37
|
+
focused.value = true;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
|
|
42
|
+
ref_key: "element",
|
|
43
|
+
ref: element,
|
|
44
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
45
|
+
}), [
|
|
46
|
+
renderSlot(_ctx.$slots, "default")
|
|
47
|
+
], 16);
|
|
48
|
+
};
|
|
34
49
|
}
|
|
35
50
|
});
|
|
36
51
|
export {
|
|
37
|
-
|
|
52
|
+
_sfc_main as default
|
|
38
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdownItem=o(e.vue,null,e.core)}(this,(function(e,o,n){"use strict";var t=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(t||{});const u=Symbol.for("dropdownItem"),r=Symbol.for("dropdownAction");return e.defineComponent({name:"VvDropdownItem",setup(o){const{role:i,expanded:d}=e.inject(u,{}),l=e.ref(null);!function({expanded:o}){e.provide(r,{role:t.menuitem,expanded:o})}({expanded:d});const s=n.useElementHover(l),{focused:f}=n.useFocus(l),{focused:c}=n.useFocusWithin(l);return e.watch(s,(e=>{e&&(f.value=!0)})),(o,n)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(i)},{ref_key:"element",ref:l,class:["vv-dropdown__item",{"focus-visible":e.unref(f)||e.unref(c)}]}),[e.renderSlot(o.$slots,"default")],16))}})}));
|
|
@@ -1,38 +1,90 @@
|
|
|
1
|
-
import { inject
|
|
1
|
+
import { inject, provide, defineComponent, ref, watch, openBlock, createElementBlock, mergeProps, unref, renderSlot, computed, toRefs, createBlock, normalizeClass, withCtx, createElementVNode, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import "mitt";
|
|
3
|
-
import { useElementHover
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { useElementHover, useFocus, useFocusWithin } from "@vueuse/core";
|
|
4
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
5
|
+
Side2["left"] = "left";
|
|
6
|
+
Side2["right"] = "right";
|
|
7
|
+
Side2["top"] = "top";
|
|
8
|
+
Side2["bottom"] = "bottom";
|
|
9
|
+
return Side2;
|
|
10
|
+
})(Side || {});
|
|
11
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
12
|
+
Placement2["topStart"] = "top-start";
|
|
13
|
+
Placement2["topEnd"] = "top-end";
|
|
14
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
15
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
16
|
+
Placement2["leftStart"] = "left-start";
|
|
17
|
+
Placement2["leftEnd"] = "left-end";
|
|
18
|
+
Placement2["rightStart"] = "right-start";
|
|
19
|
+
Placement2["rightEnd"] = "right-end";
|
|
20
|
+
return Placement2;
|
|
21
|
+
})(Placement || {});
|
|
22
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
23
|
+
Position2["before"] = "before";
|
|
24
|
+
Position2["after"] = "after";
|
|
25
|
+
return Position2;
|
|
26
|
+
})(Position || {});
|
|
27
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
28
|
+
ButtonType2["button"] = "button";
|
|
29
|
+
ButtonType2["submit"] = "submit";
|
|
30
|
+
ButtonType2["reset"] = "reset";
|
|
31
|
+
return ButtonType2;
|
|
32
|
+
})(ButtonType || {});
|
|
33
|
+
var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
|
|
34
|
+
ActionRoles2["button"] = "button";
|
|
35
|
+
ActionRoles2["link"] = "link";
|
|
36
|
+
ActionRoles2["menuitem"] = "menuitem";
|
|
37
|
+
return ActionRoles2;
|
|
38
|
+
})(ActionRoles || {});
|
|
39
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
40
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
41
|
+
AnchorTarget2["_self"] = "_self";
|
|
42
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
43
|
+
AnchorTarget2["_top"] = "_top";
|
|
44
|
+
return AnchorTarget2;
|
|
45
|
+
})(AnchorTarget || {});
|
|
46
|
+
const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for("dropdownItem");
|
|
47
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
|
|
48
|
+
function useInjectedDropdownItem() {
|
|
49
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
8
50
|
}
|
|
9
|
-
function
|
|
10
|
-
expanded
|
|
51
|
+
function useProvideDropdownAction({
|
|
52
|
+
expanded
|
|
11
53
|
}) {
|
|
12
|
-
|
|
13
|
-
role:
|
|
14
|
-
expanded
|
|
54
|
+
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
55
|
+
role: ActionRoles.menuitem,
|
|
56
|
+
expanded
|
|
15
57
|
});
|
|
16
58
|
}
|
|
17
|
-
const
|
|
59
|
+
const __default__$1 = {
|
|
18
60
|
name: "VvDropdownItem"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
61
|
+
};
|
|
62
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
63
|
+
...__default__$1,
|
|
64
|
+
setup(__props) {
|
|
65
|
+
const { role, expanded } = useInjectedDropdownItem();
|
|
66
|
+
const element = ref(null);
|
|
67
|
+
useProvideDropdownAction({ expanded });
|
|
68
|
+
const hovered = useElementHover(element);
|
|
69
|
+
const { focused } = useFocus(element);
|
|
70
|
+
const { focused: focusedWithin } = useFocusWithin(element);
|
|
71
|
+
watch(hovered, (newValue) => {
|
|
72
|
+
if (newValue) {
|
|
73
|
+
focused.value = true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return (_ctx, _cache) => {
|
|
77
|
+
return openBlock(), createElementBlock("li", mergeProps({ role: unref(role) }, {
|
|
78
|
+
ref_key: "element",
|
|
79
|
+
ref: element,
|
|
80
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
81
|
+
}), [
|
|
82
|
+
renderSlot(_ctx.$slots, "default")
|
|
83
|
+
], 16);
|
|
84
|
+
};
|
|
34
85
|
}
|
|
35
|
-
})
|
|
86
|
+
});
|
|
87
|
+
const LinkProps = {
|
|
36
88
|
/**
|
|
37
89
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
38
90
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -49,7 +101,7 @@ const K = {
|
|
|
49
101
|
*/
|
|
50
102
|
target: {
|
|
51
103
|
type: String,
|
|
52
|
-
validator: (
|
|
104
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
53
105
|
},
|
|
54
106
|
/**
|
|
55
107
|
* Anchor rel
|
|
@@ -58,77 +110,209 @@ const K = {
|
|
|
58
110
|
type: String,
|
|
59
111
|
default: "noopener noreferrer"
|
|
60
112
|
}
|
|
61
|
-
}
|
|
113
|
+
};
|
|
114
|
+
const DisabledProps = {
|
|
62
115
|
/**
|
|
63
116
|
* Whether the form control is disabled
|
|
64
117
|
*/
|
|
65
118
|
disabled: Boolean
|
|
66
|
-
}
|
|
119
|
+
};
|
|
120
|
+
const SelectedProps = {
|
|
67
121
|
/**
|
|
68
122
|
* Whether the item is selected
|
|
69
123
|
*/
|
|
70
124
|
selected: Boolean
|
|
71
|
-
}
|
|
125
|
+
};
|
|
126
|
+
const ActiveProps = {
|
|
72
127
|
/**
|
|
73
128
|
* Whether the item is active
|
|
74
129
|
*/
|
|
75
130
|
active: Boolean
|
|
76
|
-
}
|
|
131
|
+
};
|
|
132
|
+
const PressedProps = {
|
|
77
133
|
/**
|
|
78
134
|
* Whether the item is pressed
|
|
79
135
|
*/
|
|
80
136
|
pressed: Boolean
|
|
81
|
-
}
|
|
137
|
+
};
|
|
138
|
+
const LabelProps = {
|
|
82
139
|
/**
|
|
83
140
|
* The item label
|
|
84
141
|
*/
|
|
85
142
|
label: [String, Number]
|
|
86
|
-
}
|
|
143
|
+
};
|
|
144
|
+
const ModifiersProps = {
|
|
87
145
|
/**
|
|
88
146
|
* Component BEM modifiers
|
|
89
147
|
*/
|
|
90
148
|
modifiers: [String, Array]
|
|
91
149
|
};
|
|
92
|
-
|
|
93
|
-
|
|
150
|
+
({
|
|
151
|
+
/**
|
|
152
|
+
* VvIcon name or props
|
|
153
|
+
* @see VVIcon
|
|
154
|
+
*/
|
|
155
|
+
icon: { type: [String, Object] },
|
|
156
|
+
/**
|
|
157
|
+
* VvIcon position
|
|
158
|
+
*/
|
|
159
|
+
iconPosition: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: Position.before,
|
|
162
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const UnselectableProps = {
|
|
94
166
|
/**
|
|
95
167
|
* If true the input will be unselectable
|
|
96
168
|
*/
|
|
97
|
-
unselectable: { type: Boolean, default:
|
|
169
|
+
unselectable: { type: Boolean, default: true }
|
|
98
170
|
};
|
|
99
|
-
c.bottom;
|
|
100
171
|
({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Dropdown placement
|
|
174
|
+
*/
|
|
175
|
+
placement: {
|
|
176
|
+
type: String,
|
|
177
|
+
default: Side.bottom,
|
|
178
|
+
validator: (value) => {
|
|
179
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Dropdown strategy
|
|
184
|
+
*/
|
|
185
|
+
strategy: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: "absolute",
|
|
188
|
+
validator: (value) => {
|
|
189
|
+
return ["fixed", "absolute"].includes(value);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Dropdown show / hide transition name
|
|
194
|
+
*/
|
|
195
|
+
transitionName: {
|
|
196
|
+
type: String
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* Offset of the dropdown from the trigger
|
|
200
|
+
* @see https://floating-ui.com/docs/offset
|
|
201
|
+
*/
|
|
202
|
+
offset: {
|
|
203
|
+
type: [Number, String, Object],
|
|
204
|
+
default: 0
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Move dropdown to the side if there is no space in the default position
|
|
208
|
+
* @see https://floating-ui.com/docs/shift
|
|
209
|
+
*/
|
|
210
|
+
shift: {
|
|
211
|
+
type: [Boolean, Object],
|
|
212
|
+
default: false
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Flip dropdown position if there is no space in the default position
|
|
216
|
+
* @see https://floating-ui.com/docs/flip
|
|
217
|
+
*/
|
|
218
|
+
flip: {
|
|
219
|
+
type: [Boolean, Object],
|
|
220
|
+
default: true
|
|
221
|
+
},
|
|
222
|
+
/**
|
|
223
|
+
* Size of the dropdown
|
|
224
|
+
* @see https://floating-ui.com/docs/size
|
|
225
|
+
*/
|
|
226
|
+
size: {
|
|
227
|
+
type: [Boolean, Object],
|
|
228
|
+
default: () => ({ padding: 10 })
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* Automatically change the position of the dropdown
|
|
232
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
233
|
+
*/
|
|
234
|
+
autoPlacement: {
|
|
235
|
+
type: [Boolean, Object],
|
|
236
|
+
default: false
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Add arrow to the dropdown
|
|
240
|
+
* @see https://floating-ui.com/docs/arrow
|
|
241
|
+
*/
|
|
242
|
+
arrow: {
|
|
243
|
+
type: Boolean,
|
|
244
|
+
default: false
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* Close dropdown on click outside
|
|
248
|
+
*/
|
|
249
|
+
autoClose: {
|
|
250
|
+
type: Boolean,
|
|
251
|
+
default: true
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Autofocus first item on dropdown open
|
|
255
|
+
*/
|
|
256
|
+
autofocusFirst: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: true
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* Set dropdown width to the same as the trigger
|
|
262
|
+
*/
|
|
263
|
+
triggerWidth: {
|
|
264
|
+
type: Boolean
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
({
|
|
268
|
+
...DisabledProps,
|
|
269
|
+
...LabelProps,
|
|
270
|
+
...PressedProps,
|
|
271
|
+
...ActiveProps,
|
|
272
|
+
...LinkProps,
|
|
106
273
|
/**
|
|
107
274
|
* Button type
|
|
108
275
|
*/
|
|
109
|
-
type:
|
|
276
|
+
type: {
|
|
277
|
+
type: String,
|
|
278
|
+
default: ButtonType.button,
|
|
279
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
280
|
+
}
|
|
110
281
|
});
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
-
const
|
|
114
|
-
[
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
282
|
+
function useModifiers(prefix, modifiers, others) {
|
|
283
|
+
return computed(() => {
|
|
284
|
+
const toReturn = {
|
|
285
|
+
[prefix]: true
|
|
286
|
+
};
|
|
287
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
288
|
+
if (modifiersArray) {
|
|
289
|
+
if (Array.isArray(modifiersArray)) {
|
|
290
|
+
modifiersArray.forEach((modifier) => {
|
|
291
|
+
if (modifier) {
|
|
292
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (others) {
|
|
298
|
+
Object.keys(others.value).forEach((key) => {
|
|
299
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return toReturn;
|
|
121
303
|
});
|
|
122
304
|
}
|
|
123
|
-
const
|
|
305
|
+
const _hoisted_1 = ["title"];
|
|
306
|
+
const __default__ = {
|
|
124
307
|
name: "VvDropdownOption"
|
|
125
|
-
}
|
|
126
|
-
|
|
308
|
+
};
|
|
309
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
310
|
+
...__default__,
|
|
127
311
|
props: {
|
|
128
|
-
...
|
|
129
|
-
...
|
|
130
|
-
...
|
|
131
|
-
...
|
|
312
|
+
...DisabledProps,
|
|
313
|
+
...SelectedProps,
|
|
314
|
+
...UnselectableProps,
|
|
315
|
+
...ModifiersProps,
|
|
132
316
|
deselectHintLabel: {
|
|
133
317
|
type: String
|
|
134
318
|
},
|
|
@@ -139,38 +323,49 @@ const ee = { class: "vv-dropdown-option__hint" }, te = {
|
|
|
139
323
|
type: String
|
|
140
324
|
}
|
|
141
325
|
},
|
|
142
|
-
setup(
|
|
143
|
-
const
|
|
326
|
+
setup(__props) {
|
|
327
|
+
const props = __props;
|
|
328
|
+
const { modifiers } = toRefs(props);
|
|
329
|
+
const bemCssClasses = useModifiers(
|
|
144
330
|
"vv-dropdown-option",
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
disabled:
|
|
148
|
-
selected:
|
|
149
|
-
unselectable:
|
|
331
|
+
modifiers,
|
|
332
|
+
computed(() => ({
|
|
333
|
+
disabled: props.disabled,
|
|
334
|
+
selected: props.selected,
|
|
335
|
+
unselectable: props.unselectable && props.selected
|
|
150
336
|
}))
|
|
151
337
|
);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
338
|
+
const hintLabel = computed(() => {
|
|
339
|
+
if (props.selected) {
|
|
340
|
+
return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
|
|
341
|
+
}
|
|
342
|
+
if (!props.disabled) {
|
|
343
|
+
return props.selectHintLabel;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
return (_ctx, _cache) => {
|
|
347
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
348
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
349
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
350
|
+
"aria-selected": _ctx.selected,
|
|
351
|
+
"aria-disabled": _ctx.disabled
|
|
352
|
+
}, {
|
|
353
|
+
default: withCtx(() => [
|
|
354
|
+
renderSlot(_ctx.$slots, "default"),
|
|
355
|
+
createElementVNode("span", {
|
|
356
|
+
class: "vv-dropdown-option__hint",
|
|
357
|
+
title: unref(hintLabel)
|
|
358
|
+
}, [
|
|
359
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
360
|
+
createTextVNode(toDisplayString(unref(hintLabel)), 1)
|
|
361
|
+
])
|
|
362
|
+
], 8, _hoisted_1)
|
|
363
|
+
]),
|
|
364
|
+
_: 3
|
|
365
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
|
|
366
|
+
};
|
|
172
367
|
}
|
|
173
368
|
});
|
|
174
369
|
export {
|
|
175
|
-
|
|
370
|
+
_sfc_main as default
|
|
176
371
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("mitt"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","mitt","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdownOption=t(e.vue,null,e.core)}(this,(function(e,t,o){"use strict";var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),s=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(s||{});const d=Symbol.for("dropdownItem"),i=Symbol.for("dropdownAction");const a=e.defineComponent({name:"VvDropdownItem",setup(t){const{role:n,expanded:l}=e.inject(d,{}),r=e.ref(null);!function({expanded:t}){e.provide(i,{role:s.menuitem,expanded:t})}({expanded:l});const a=o.useElementHover(r),{focused:u}=o.useFocus(r),{focused:c}=o.useFocusWithin(r);return e.watch(a,(e=>{e&&(u.value=!0)})),(t,o)=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({role:e.unref(n)},{ref_key:"element",ref:r,class:["vv-dropdown__item",{"focus-visible":e.unref(u)||e.unref(c)}]}),[e.renderSlot(t.$slots,"default")],16))}}),u={disabled:Boolean},c={selected:Boolean},f=(Boolean,Boolean,{modifiers:[String,Array]});l.before;const p={unselectable:{type:Boolean,default:!0}};n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,r.button;const b=["title"];return e.defineComponent({name:"VvDropdownOption",props:{...u,...c,...p,...f,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String}},setup(t){const o=t,{modifiers:n}=e.toRefs(o),l=function(t,o,n){return e.computed((()=>{const l={[t]:!0},r="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}("vv-dropdown-option",n,e.computed((()=>({disabled:o.disabled,selected:o.selected,unselectable:o.unselectable&&o.selected})))),r=e.computed((()=>o.selected?o.unselectable?o.deselectHintLabel:o.selectedHintLabel:o.disabled?void 0:o.selectHintLabel));return(t,o)=>(e.openBlock(),e.createBlock(a,{class:e.normalizeClass(e.unref(l)),tabindex:t.disabled?-1:0,"aria-selected":t.selected,"aria-disabled":t.disabled},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default"),e.createElementVNode("span",{class:"vv-dropdown-option__hint",title:e.unref(r)},[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps({disabled:t.disabled,selected:t.selected,unselectable:t.unselectable})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)),1)]))],8,b)])),_:3},8,["class","tabindex","aria-selected","aria-disabled"]))}})}));
|