@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
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
|
+
Side2["left"] = "left";
|
|
4
|
+
Side2["right"] = "right";
|
|
5
|
+
Side2["top"] = "top";
|
|
6
|
+
Side2["bottom"] = "bottom";
|
|
7
|
+
return Side2;
|
|
8
|
+
})(Side || {});
|
|
9
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
10
|
+
Placement2["topStart"] = "top-start";
|
|
11
|
+
Placement2["topEnd"] = "top-end";
|
|
12
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
13
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
14
|
+
Placement2["leftStart"] = "left-start";
|
|
15
|
+
Placement2["leftEnd"] = "left-end";
|
|
16
|
+
Placement2["rightStart"] = "right-start";
|
|
17
|
+
Placement2["rightEnd"] = "right-end";
|
|
18
|
+
return Placement2;
|
|
19
|
+
})(Placement || {});
|
|
20
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
21
|
+
Position2["before"] = "before";
|
|
22
|
+
Position2["after"] = "after";
|
|
23
|
+
return Position2;
|
|
24
|
+
})(Position || {});
|
|
25
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
26
|
+
ButtonType2["button"] = "button";
|
|
27
|
+
ButtonType2["submit"] = "submit";
|
|
28
|
+
ButtonType2["reset"] = "reset";
|
|
29
|
+
return ButtonType2;
|
|
30
|
+
})(ButtonType || {});
|
|
31
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
32
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
33
|
+
ActionTag2["routerLink"] = "router-link";
|
|
34
|
+
ActionTag2["a"] = "a";
|
|
35
|
+
ActionTag2["button"] = "button";
|
|
36
|
+
return ActionTag2;
|
|
37
|
+
})(ActionTag || {});
|
|
38
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
39
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
40
|
+
AnchorTarget2["_self"] = "_self";
|
|
41
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
42
|
+
AnchorTarget2["_top"] = "_top";
|
|
43
|
+
return AnchorTarget2;
|
|
44
|
+
})(AnchorTarget || {});
|
|
45
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
46
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
|
|
47
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
|
|
48
|
+
const LinkProps = {
|
|
49
|
+
/**
|
|
50
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
51
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
52
|
+
*/
|
|
53
|
+
to: {
|
|
54
|
+
type: [String, Object]
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Anchor href
|
|
58
|
+
*/
|
|
59
|
+
href: String,
|
|
60
|
+
/**
|
|
61
|
+
* Anchor target
|
|
62
|
+
*/
|
|
63
|
+
target: {
|
|
64
|
+
type: String,
|
|
65
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Anchor rel
|
|
69
|
+
*/
|
|
70
|
+
rel: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "noopener noreferrer"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const DisabledProps = {
|
|
76
|
+
/**
|
|
77
|
+
* Whether the form control is disabled
|
|
78
|
+
*/
|
|
79
|
+
disabled: Boolean
|
|
80
|
+
};
|
|
81
|
+
const ActiveProps = {
|
|
82
|
+
/**
|
|
83
|
+
* Whether the item is active
|
|
84
|
+
*/
|
|
85
|
+
active: Boolean
|
|
86
|
+
};
|
|
87
|
+
const PressedProps = {
|
|
88
|
+
/**
|
|
89
|
+
* Whether the item is pressed
|
|
90
|
+
*/
|
|
91
|
+
pressed: Boolean
|
|
92
|
+
};
|
|
93
|
+
const LabelProps = {
|
|
94
|
+
/**
|
|
95
|
+
* The item label
|
|
96
|
+
*/
|
|
97
|
+
label: [String, Number]
|
|
98
|
+
};
|
|
99
|
+
({
|
|
100
|
+
/**
|
|
101
|
+
* VvIcon name or props
|
|
102
|
+
* @see VVIcon
|
|
103
|
+
*/
|
|
104
|
+
icon: { type: [String, Object] },
|
|
105
|
+
/**
|
|
106
|
+
* VvIcon position
|
|
107
|
+
*/
|
|
108
|
+
iconPosition: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: Position.before,
|
|
111
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
({
|
|
115
|
+
/**
|
|
116
|
+
* Dropdown placement
|
|
117
|
+
*/
|
|
118
|
+
placement: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: Side.bottom,
|
|
121
|
+
validator: (value) => {
|
|
122
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Dropdown show / hide transition name
|
|
127
|
+
*/
|
|
128
|
+
transitionName: {
|
|
129
|
+
type: String
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Offset of the dropdown from the trigger
|
|
133
|
+
* @see https://floating-ui.com/docs/offset
|
|
134
|
+
*/
|
|
135
|
+
offset: {
|
|
136
|
+
type: [Number, String, Object],
|
|
137
|
+
default: 0
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Move dropdown to the side if there is no space in the default position
|
|
141
|
+
* @see https://floating-ui.com/docs/shift
|
|
142
|
+
*/
|
|
143
|
+
shift: {
|
|
144
|
+
type: [Boolean, Object],
|
|
145
|
+
default: false
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Flip dropdown position if there is no space in the default position
|
|
149
|
+
* @see https://floating-ui.com/docs/flip
|
|
150
|
+
*/
|
|
151
|
+
flip: {
|
|
152
|
+
type: [Boolean, Object],
|
|
153
|
+
default: true
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Size of the dropdown
|
|
157
|
+
* @see https://floating-ui.com/docs/size
|
|
158
|
+
*/
|
|
159
|
+
size: {
|
|
160
|
+
type: [Boolean, Object],
|
|
161
|
+
default: () => ({ padding: 10 })
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* Automatically change the position of the dropdown
|
|
165
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
166
|
+
*/
|
|
167
|
+
autoPlacement: {
|
|
168
|
+
type: [Boolean, Object],
|
|
169
|
+
default: false
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* Add arrow to the dropdown
|
|
173
|
+
* @see https://floating-ui.com/docs/arrow
|
|
174
|
+
*/
|
|
175
|
+
arrow: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Close dropdown on click outside
|
|
181
|
+
*/
|
|
182
|
+
autoClose: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: true
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Autofocus first item on dropdown open
|
|
188
|
+
*/
|
|
189
|
+
autofocusFirst: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: true
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Set dropdown width to the same as the trigger
|
|
195
|
+
*/
|
|
196
|
+
triggerWidth: {
|
|
197
|
+
type: Boolean
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const ActionProps = {
|
|
201
|
+
...DisabledProps,
|
|
202
|
+
...LabelProps,
|
|
203
|
+
...PressedProps,
|
|
204
|
+
...ActiveProps,
|
|
205
|
+
...LinkProps,
|
|
206
|
+
/**
|
|
207
|
+
* Button type
|
|
208
|
+
*/
|
|
209
|
+
type: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: ButtonType.button,
|
|
212
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
216
|
+
const VvActionProps = ActionProps;
|
|
217
|
+
function useVolver() {
|
|
218
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
219
|
+
}
|
|
220
|
+
function useInjectedDropdownTrigger() {
|
|
221
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
222
|
+
}
|
|
223
|
+
function useInjectedDropdownAction() {
|
|
224
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
225
|
+
}
|
|
226
|
+
const __default__ = {
|
|
227
|
+
name: "VvAction"
|
|
228
|
+
};
|
|
229
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
230
|
+
...__default__,
|
|
231
|
+
props: VvActionProps,
|
|
232
|
+
emits: VvActionEvents,
|
|
233
|
+
setup(__props, { expose, emit }) {
|
|
234
|
+
const props = __props;
|
|
235
|
+
const volver = useVolver();
|
|
236
|
+
const element = ref(null);
|
|
237
|
+
expose({ $el: element });
|
|
238
|
+
const {
|
|
239
|
+
reference: dropdownTriggerReference,
|
|
240
|
+
bus: dropdownEventBus,
|
|
241
|
+
aria: dropdownAria,
|
|
242
|
+
expanded: dropdownExpanded
|
|
243
|
+
} = useInjectedDropdownTrigger();
|
|
244
|
+
watch(
|
|
245
|
+
() => element.value,
|
|
246
|
+
(newValue) => {
|
|
247
|
+
if (dropdownTriggerReference) {
|
|
248
|
+
dropdownTriggerReference.value = newValue;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
const pressed = computed(() => {
|
|
253
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
254
|
+
});
|
|
255
|
+
const { role } = useInjectedDropdownAction();
|
|
256
|
+
const hasTag = computed(() => {
|
|
257
|
+
switch (true) {
|
|
258
|
+
case props.disabled:
|
|
259
|
+
return ActionTag.button;
|
|
260
|
+
case props.to !== void 0:
|
|
261
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
262
|
+
case props.href !== void 0:
|
|
263
|
+
return ActionTag.a;
|
|
264
|
+
default:
|
|
265
|
+
return ActionTag.button;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
const hasProps = computed(() => {
|
|
269
|
+
const toReturn = {
|
|
270
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
271
|
+
"aria-pressed": pressed.value ? true : void 0,
|
|
272
|
+
role
|
|
273
|
+
};
|
|
274
|
+
switch (hasTag.value) {
|
|
275
|
+
case ActionTag.a:
|
|
276
|
+
return {
|
|
277
|
+
...toReturn,
|
|
278
|
+
href: props.href,
|
|
279
|
+
target: props.target,
|
|
280
|
+
rel: props.rel
|
|
281
|
+
};
|
|
282
|
+
case ActionTag.routerLink:
|
|
283
|
+
case ActionTag.nuxtLink:
|
|
284
|
+
return {
|
|
285
|
+
...toReturn,
|
|
286
|
+
to: props.to,
|
|
287
|
+
target: props.target
|
|
288
|
+
};
|
|
289
|
+
default:
|
|
290
|
+
return {
|
|
291
|
+
...toReturn,
|
|
292
|
+
type: props.type,
|
|
293
|
+
disabled: props.disabled
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const onClick = (e) => {
|
|
298
|
+
if (props.disabled) {
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
303
|
+
emit("click", e);
|
|
304
|
+
};
|
|
305
|
+
const onMouseover = (e) => {
|
|
306
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
307
|
+
emit("mouseover", e);
|
|
308
|
+
};
|
|
309
|
+
const onMouseleave = (e) => {
|
|
310
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
311
|
+
emit("mouseleave", e);
|
|
312
|
+
};
|
|
313
|
+
return (_ctx, _cache) => {
|
|
314
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
315
|
+
ref_key: "element",
|
|
316
|
+
ref: element,
|
|
317
|
+
class: {
|
|
318
|
+
active: _ctx.active,
|
|
319
|
+
pressed: unref(pressed),
|
|
320
|
+
disabled: _ctx.disabled
|
|
321
|
+
},
|
|
322
|
+
onClickPassive: onClick,
|
|
323
|
+
onMouseoverPassive: onMouseover,
|
|
324
|
+
onMouseleavePassive: onMouseleave
|
|
325
|
+
}), {
|
|
326
|
+
default: withCtx(() => [
|
|
327
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
328
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
329
|
+
])
|
|
330
|
+
]),
|
|
331
|
+
_: 3
|
|
332
|
+
}, 16, ["class"]);
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
export {
|
|
337
|
+
_sfc_main as default
|
|
338
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAction=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{}),l=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(l||{});const a=Symbol.for("volver"),u=Symbol.for("dropdownTrigger"),i=Symbol.for("dropdownAction"),s={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(l).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},f={pressed:Boolean},p={label:[String,Number]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const v={...d,...p,...f,...c,...s,type:{type:String,default:n.button,validator:e=>Object.values(n).includes(e)}};return e.defineComponent({name:"VvAction",props:v,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const l=t,s=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:f,aria:p,expanded:v}=e.inject(u,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const b=e.computed((()=>l.pressed||(null==v?void 0:v.value))),{role:m}=e.inject(i,{}),g=e.computed((()=>{switch(!0){case l.disabled:return r.button;case void 0!==l.to:return(null==s?void 0:s.nuxt)?r.nuxtLink:r.routerLink;case void 0!==l.href:return r.a;default:return r.button}})),k=e.computed((()=>{const e={...null==p?void 0:p.value,"aria-pressed":!!b.value||void 0,role:m};switch(g.value){case r.a:return{...e,href:l.href,target:l.target,rel:l.rel};case r.routerLink:case r.nuxtLink:return{...e,to:l.to,target:l.target};default:return{...e,type:l.type,disabled:l.disabled}}})),y=e=>{l.disabled?e.preventDefault():(null==f||f.emit("click",e),n("click",e))},h=e=>{null==f||f.emit("mouseover",e),n("mouseover",e)},B=e=>{null==f||f.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(g)),e.mergeProps(e.unref(k),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(b),disabled:t.disabled},onClickPassive:y,onMouseoverPassive:h,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}})}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
|
+
type: {
|
|
3
|
+
type: globalThis.PropType<"button" | "submit" | "reset">;
|
|
4
|
+
default: import("../../constants").ButtonType;
|
|
5
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
6
|
+
};
|
|
7
|
+
to: {
|
|
8
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
9
|
+
};
|
|
10
|
+
href: StringConstructor;
|
|
11
|
+
target: {
|
|
12
|
+
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
13
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
14
|
+
};
|
|
15
|
+
rel: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
active: BooleanConstructor;
|
|
20
|
+
pressed: BooleanConstructor;
|
|
21
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
22
|
+
disabled: BooleanConstructor;
|
|
23
|
+
}, {
|
|
24
|
+
$el: globalThis.Ref<HTMLElement | null>;
|
|
25
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
type: {
|
|
27
|
+
type: globalThis.PropType<"button" | "submit" | "reset">;
|
|
28
|
+
default: import("../../constants").ButtonType;
|
|
29
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
30
|
+
};
|
|
31
|
+
to: {
|
|
32
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
33
|
+
};
|
|
34
|
+
href: StringConstructor;
|
|
35
|
+
target: {
|
|
36
|
+
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
37
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
38
|
+
};
|
|
39
|
+
rel: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
active: BooleanConstructor;
|
|
44
|
+
pressed: BooleanConstructor;
|
|
45
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
46
|
+
disabled: BooleanConstructor;
|
|
47
|
+
}>> & {
|
|
48
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
type: "button" | "submit" | "reset";
|
|
52
|
+
rel: string;
|
|
53
|
+
active: boolean;
|
|
54
|
+
pressed: boolean;
|
|
55
|
+
}>, {
|
|
56
|
+
default: (_: {}) => any;
|
|
57
|
+
}>;
|
|
58
|
+
export default _default;
|
|
59
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
60
|
+
new (): {
|
|
61
|
+
$slots: S;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const VvActionEvents: string[];
|
|
2
|
+
export declare const VvActionProps: {
|
|
3
|
+
type: {
|
|
4
|
+
type: globalThis.PropType<"button" | "submit" | "reset">;
|
|
5
|
+
default: import("../../constants").ButtonType;
|
|
6
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
7
|
+
};
|
|
8
|
+
to: {
|
|
9
|
+
type: (StringConstructor | ObjectConstructor)[];
|
|
10
|
+
};
|
|
11
|
+
href: StringConstructor;
|
|
12
|
+
target: {
|
|
13
|
+
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
14
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
15
|
+
};
|
|
16
|
+
rel: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
active: BooleanConstructor;
|
|
21
|
+
pressed: BooleanConstructor;
|
|
22
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
23
|
+
disabled: BooleanConstructor;
|
|
24
|
+
};
|