@volverjs/ui-vue 0.0.10-beta.2 → 0.0.10-beta.3
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/dist/components/VvAccordion/VvAccordion.es.js +7 -0
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +1 -1
- package/dist/components/VvAction/VvAction.es.js +9 -1
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +3 -0
- package/dist/components/VvAction/index.d.ts +1 -0
- package/dist/components/VvAlert/VvAlert.es.js +7 -0
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +7 -0
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +7 -0
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +9 -1
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +6 -3
- package/dist/components/VvButton/index.d.ts +1 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvCard/VvCard.es.js +7 -0
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +7 -0
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +3 -3
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +7 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +16 -2
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +37 -37
- package/dist/components/VvCombobox/index.d.ts +13 -11
- package/dist/components/VvDialog/VvDialog.es.js +7 -0
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +7 -0
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +31 -31
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +3 -0
- package/dist/components/VvDropdown/index.d.ts +10 -10
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +7 -0
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvNav/VvNav.es.js +69 -56
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +12 -8
- package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
- package/dist/components/VvNav/index.d.ts +1 -12
- package/dist/components/VvNavItem/VvNavItem.es.js +392 -0
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
- package/dist/components/VvProgress/VvProgress.es.js +7 -0
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +7 -0
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +3 -3
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +7 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +7 -0
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +7 -7
- package/dist/components/VvTab/VvTab.es.js +127 -87
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +19 -6
- package/dist/components/VvTab/index.d.ts +9 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +7 -0
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +3 -3
- package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +246 -200
- package/dist/components/index.umd.js +1 -1
- package/dist/directives/index.es.js +7 -0
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +7 -0
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +29 -12
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +5 -5
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +31 -31
- package/dist/stories/Tab/Tab.settings.d.ts +3 -23
- package/dist/types/alert.d.ts +13 -0
- package/dist/types/floating-ui.d.ts +6 -0
- package/dist/types/generic.d.ts +5 -0
- package/dist/types/group.d.ts +37 -0
- package/dist/types/nav.d.ts +17 -0
- package/package.json +41 -33
- 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/VvAction/VvAction.vue +1 -0
- package/src/components/VvCombobox/VvCombobox.vue +11 -4
- package/src/components/VvNav/VvNav.vue +29 -51
- package/src/components/VvNav/VvNavItem.vue +18 -0
- package/src/components/VvNav/VvNavSeparator.vue +11 -0
- package/src/components/VvNav/index.ts +2 -15
- package/src/components/VvTab/VvTab.vue +60 -36
- package/src/components/VvTab/index.ts +10 -4
- package/src/props/index.ts +19 -3
- package/src/stories/Nav/Nav.settings.ts +3 -4
- package/src/stories/Nav/Nav.test.ts +4 -15
- package/src/stories/Tab/Tab.settings.ts +8 -8
- package/src/stories/Tab/Tab.stories.ts +2 -2
- package/src/stories/Tab/Tab.test.ts +6 -14
- package/src/types/nav.ts +19 -0
- package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
- package/src/components/VvNav/VvNavItemTitle.vue +0 -11
- package/src/components/VvNav/VvNavSeparator.ts +0 -8
- /package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +0 -0
- /package/src/types/{alert.d.ts → alert.ts} +0 -0
- /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
- /package/src/types/{generic.d.ts → generic.ts} +0 -0
- /package/src/types/{group.d.ts → group.ts} +0 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, createElementBlock, createVNode } from "vue";
|
|
2
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
3
|
+
Strategy2["absolute"] = "absolute";
|
|
4
|
+
Strategy2["fixed"] = "fixed";
|
|
5
|
+
return Strategy2;
|
|
6
|
+
})(Strategy || {});
|
|
7
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
8
|
+
Side2["left"] = "left";
|
|
9
|
+
Side2["right"] = "right";
|
|
10
|
+
Side2["top"] = "top";
|
|
11
|
+
Side2["bottom"] = "bottom";
|
|
12
|
+
return Side2;
|
|
13
|
+
})(Side || {});
|
|
14
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
15
|
+
Placement2["topStart"] = "top-start";
|
|
16
|
+
Placement2["topEnd"] = "top-end";
|
|
17
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
18
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
19
|
+
Placement2["leftStart"] = "left-start";
|
|
20
|
+
Placement2["leftEnd"] = "left-end";
|
|
21
|
+
Placement2["rightStart"] = "right-start";
|
|
22
|
+
Placement2["rightEnd"] = "right-end";
|
|
23
|
+
return Placement2;
|
|
24
|
+
})(Placement || {});
|
|
25
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
26
|
+
Position2["before"] = "before";
|
|
27
|
+
Position2["after"] = "after";
|
|
28
|
+
return Position2;
|
|
29
|
+
})(Position || {});
|
|
30
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
31
|
+
ButtonType2["button"] = "button";
|
|
32
|
+
ButtonType2["submit"] = "submit";
|
|
33
|
+
ButtonType2["reset"] = "reset";
|
|
34
|
+
return ButtonType2;
|
|
35
|
+
})(ButtonType || {});
|
|
36
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
37
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
38
|
+
ActionTag2["routerLink"] = "router-link";
|
|
39
|
+
ActionTag2["a"] = "a";
|
|
40
|
+
ActionTag2["button"] = "button";
|
|
41
|
+
return ActionTag2;
|
|
42
|
+
})(ActionTag || {});
|
|
43
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
44
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
45
|
+
AnchorTarget2["_self"] = "_self";
|
|
46
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
47
|
+
AnchorTarget2["_top"] = "_top";
|
|
48
|
+
return AnchorTarget2;
|
|
49
|
+
})(AnchorTarget || {});
|
|
50
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
51
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
52
|
+
"dropdownTrigger"
|
|
53
|
+
);
|
|
54
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
|
|
55
|
+
"dropdownAction"
|
|
56
|
+
);
|
|
57
|
+
const LinkProps = {
|
|
58
|
+
/**
|
|
59
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
60
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
61
|
+
*/
|
|
62
|
+
to: {
|
|
63
|
+
type: [String, Object]
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Anchor href
|
|
67
|
+
*/
|
|
68
|
+
href: String,
|
|
69
|
+
/**
|
|
70
|
+
* Anchor target
|
|
71
|
+
*/
|
|
72
|
+
target: {
|
|
73
|
+
type: String,
|
|
74
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* Anchor rel
|
|
78
|
+
*/
|
|
79
|
+
rel: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "noopener noreferrer"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const DisabledProps = {
|
|
85
|
+
/**
|
|
86
|
+
* Whether the form control is disabled
|
|
87
|
+
*/
|
|
88
|
+
disabled: Boolean
|
|
89
|
+
};
|
|
90
|
+
const ActiveProps = {
|
|
91
|
+
/**
|
|
92
|
+
* Whether the item is active
|
|
93
|
+
*/
|
|
94
|
+
active: Boolean
|
|
95
|
+
};
|
|
96
|
+
const CurrentProps = {
|
|
97
|
+
/**
|
|
98
|
+
* Whether the item is current
|
|
99
|
+
*/
|
|
100
|
+
current: Boolean
|
|
101
|
+
};
|
|
102
|
+
const PressedProps = {
|
|
103
|
+
/**
|
|
104
|
+
* Whether the item is pressed
|
|
105
|
+
*/
|
|
106
|
+
pressed: Boolean
|
|
107
|
+
};
|
|
108
|
+
const LabelProps = {
|
|
109
|
+
/**
|
|
110
|
+
* The item label
|
|
111
|
+
*/
|
|
112
|
+
label: [String, Number]
|
|
113
|
+
};
|
|
114
|
+
({
|
|
115
|
+
/**
|
|
116
|
+
* VvIcon name or props
|
|
117
|
+
* @see VVIcon
|
|
118
|
+
*/
|
|
119
|
+
icon: { type: [String, Object] },
|
|
120
|
+
/**
|
|
121
|
+
* VvIcon position
|
|
122
|
+
*/
|
|
123
|
+
iconPosition: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: Position.before,
|
|
126
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
({
|
|
130
|
+
/**
|
|
131
|
+
* Dropdown placement
|
|
132
|
+
*/
|
|
133
|
+
placement: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: Side.bottom,
|
|
136
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Dropdown strategy
|
|
140
|
+
*/
|
|
141
|
+
strategy: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: void 0,
|
|
144
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* Dropdown show / hide transition name
|
|
148
|
+
*/
|
|
149
|
+
transitionName: {
|
|
150
|
+
type: String
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* Offset of the dropdown from the trigger
|
|
154
|
+
* @see https://floating-ui.com/docs/offset
|
|
155
|
+
*/
|
|
156
|
+
offset: {
|
|
157
|
+
type: [Number, String, Object],
|
|
158
|
+
default: 0
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Move dropdown to the side if there is no space in the default position
|
|
162
|
+
* @see https://floating-ui.com/docs/shift
|
|
163
|
+
*/
|
|
164
|
+
shift: {
|
|
165
|
+
type: [Boolean, Object],
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Flip dropdown position if there is no space in the default position
|
|
170
|
+
* @see https://floating-ui.com/docs/flip
|
|
171
|
+
*/
|
|
172
|
+
flip: {
|
|
173
|
+
type: [Boolean, Object],
|
|
174
|
+
default: true
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* Size of the dropdown
|
|
178
|
+
* @see https://floating-ui.com/docs/size
|
|
179
|
+
*/
|
|
180
|
+
size: {
|
|
181
|
+
type: [Boolean, Object],
|
|
182
|
+
default: () => ({ padding: 10 })
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* Automatically change the position of the dropdown
|
|
186
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
187
|
+
*/
|
|
188
|
+
autoPlacement: {
|
|
189
|
+
type: [Boolean, Object],
|
|
190
|
+
default: false
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Add arrow to the dropdown
|
|
194
|
+
* @see https://floating-ui.com/docs/arrow
|
|
195
|
+
*/
|
|
196
|
+
arrow: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
default: false
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Keep open dropdown on click outside
|
|
202
|
+
*/
|
|
203
|
+
keepOpen: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
default: false
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Autofocus first item on dropdown open
|
|
209
|
+
*/
|
|
210
|
+
autofocusFirst: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
default: true
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Set dropdown width to the same as the trigger
|
|
216
|
+
*/
|
|
217
|
+
triggerWidth: {
|
|
218
|
+
type: Boolean
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
const ActionProps = {
|
|
222
|
+
...DisabledProps,
|
|
223
|
+
...LabelProps,
|
|
224
|
+
...PressedProps,
|
|
225
|
+
...ActiveProps,
|
|
226
|
+
...CurrentProps,
|
|
227
|
+
...LinkProps,
|
|
228
|
+
/**
|
|
229
|
+
* Button type
|
|
230
|
+
*/
|
|
231
|
+
type: {
|
|
232
|
+
type: String,
|
|
233
|
+
default: ButtonType.button,
|
|
234
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* Button aria-label
|
|
238
|
+
*/
|
|
239
|
+
ariaLabel: {
|
|
240
|
+
type: String,
|
|
241
|
+
default: void 0
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
245
|
+
const VvActionProps = ActionProps;
|
|
246
|
+
function useVolver() {
|
|
247
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
248
|
+
}
|
|
249
|
+
function useInjectedDropdownTrigger() {
|
|
250
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
251
|
+
}
|
|
252
|
+
function useInjectedDropdownAction() {
|
|
253
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
254
|
+
}
|
|
255
|
+
const __default__$1 = {
|
|
256
|
+
name: "VvAction"
|
|
257
|
+
};
|
|
258
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
259
|
+
...__default__$1,
|
|
260
|
+
props: VvActionProps,
|
|
261
|
+
emits: VvActionEvents,
|
|
262
|
+
setup(__props, { expose: __expose, emit }) {
|
|
263
|
+
const props = __props;
|
|
264
|
+
const volver = useVolver();
|
|
265
|
+
const element = ref(null);
|
|
266
|
+
__expose({ $el: element });
|
|
267
|
+
const {
|
|
268
|
+
reference: dropdownTriggerReference,
|
|
269
|
+
bus: dropdownEventBus,
|
|
270
|
+
aria: dropdownAria,
|
|
271
|
+
expanded: dropdownExpanded
|
|
272
|
+
} = useInjectedDropdownTrigger();
|
|
273
|
+
watch(
|
|
274
|
+
() => element.value,
|
|
275
|
+
(newValue) => {
|
|
276
|
+
if (dropdownTriggerReference) {
|
|
277
|
+
dropdownTriggerReference.value = newValue;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
const pressed = computed(() => {
|
|
282
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
283
|
+
});
|
|
284
|
+
const { role } = useInjectedDropdownAction();
|
|
285
|
+
const hasTag = computed(() => {
|
|
286
|
+
switch (true) {
|
|
287
|
+
case props.disabled:
|
|
288
|
+
return ActionTag.button;
|
|
289
|
+
case props.to !== void 0:
|
|
290
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
291
|
+
case props.href !== void 0:
|
|
292
|
+
return ActionTag.a;
|
|
293
|
+
default:
|
|
294
|
+
return ActionTag.button;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const hasProps = computed(() => {
|
|
298
|
+
const toReturn = {
|
|
299
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
300
|
+
ariaPressed: pressed.value ? true : void 0,
|
|
301
|
+
ariaLabel: props.ariaLabel,
|
|
302
|
+
role: role == null ? void 0 : role.value
|
|
303
|
+
};
|
|
304
|
+
switch (hasTag.value) {
|
|
305
|
+
case ActionTag.a:
|
|
306
|
+
return {
|
|
307
|
+
...toReturn,
|
|
308
|
+
href: props.href,
|
|
309
|
+
target: props.target,
|
|
310
|
+
rel: props.rel
|
|
311
|
+
};
|
|
312
|
+
case ActionTag.routerLink:
|
|
313
|
+
case ActionTag.nuxtLink:
|
|
314
|
+
return {
|
|
315
|
+
...toReturn,
|
|
316
|
+
to: props.to,
|
|
317
|
+
target: props.target
|
|
318
|
+
};
|
|
319
|
+
default:
|
|
320
|
+
return {
|
|
321
|
+
...toReturn,
|
|
322
|
+
type: props.type,
|
|
323
|
+
disabled: props.disabled
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
const onClick = (e) => {
|
|
328
|
+
if (props.disabled) {
|
|
329
|
+
e.preventDefault();
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
333
|
+
emit("click", e);
|
|
334
|
+
};
|
|
335
|
+
const onMouseover = (e) => {
|
|
336
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
337
|
+
emit("mouseover", e);
|
|
338
|
+
};
|
|
339
|
+
const onMouseleave = (e) => {
|
|
340
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
341
|
+
emit("mouseleave", e);
|
|
342
|
+
};
|
|
343
|
+
return (_ctx, _cache) => {
|
|
344
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
345
|
+
ref_key: "element",
|
|
346
|
+
ref: element,
|
|
347
|
+
class: {
|
|
348
|
+
active: _ctx.active,
|
|
349
|
+
pressed: unref(pressed),
|
|
350
|
+
disabled: _ctx.disabled,
|
|
351
|
+
current: _ctx.current
|
|
352
|
+
},
|
|
353
|
+
onClickPassive: onClick,
|
|
354
|
+
onMouseoverPassive: onMouseover,
|
|
355
|
+
onMouseleavePassive: onMouseleave
|
|
356
|
+
}), {
|
|
357
|
+
default: withCtx(() => [
|
|
358
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
359
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
360
|
+
])
|
|
361
|
+
]),
|
|
362
|
+
_: 3
|
|
363
|
+
}, 16, ["class"]);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
const _hoisted_1 = {
|
|
368
|
+
class: "vv-nav__item",
|
|
369
|
+
role: "presentation"
|
|
370
|
+
};
|
|
371
|
+
const __default__ = {
|
|
372
|
+
name: "VvNavItem",
|
|
373
|
+
inheritAttrs: false
|
|
374
|
+
};
|
|
375
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
376
|
+
...__default__,
|
|
377
|
+
setup(__props) {
|
|
378
|
+
return (_ctx, _cache) => {
|
|
379
|
+
return openBlock(), createElementBlock("li", _hoisted_1, [
|
|
380
|
+
createVNode(_sfc_main$1, mergeProps(_ctx.$attrs, { class: "vv-nav__item-label" }), {
|
|
381
|
+
default: withCtx(() => [
|
|
382
|
+
renderSlot(_ctx.$slots, "default")
|
|
383
|
+
]),
|
|
384
|
+
_: 3
|
|
385
|
+
}, 16)
|
|
386
|
+
]);
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
export {
|
|
391
|
+
_sfc_main as default
|
|
392
|
+
};
|
|
@@ -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).VvNavItem=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||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),n=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(n||{}),l=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(l||{});const a=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),u=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},v={current:Boolean},f={pressed:Boolean},p={label:[String,Number]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const b={...d,...p,...f,...c,...v,...s,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0}};const m=e.defineComponent({name:"VvAction",props:b,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const l=t,s=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:v,aria:f,expanded:p}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const b=e.computed((()=>l.pressed||(null==p?void 0:p.value))),{role:m}=e.inject(u,{}),g=e.computed((()=>{switch(!0){case l.disabled:return n.button;case void 0!==l.to:return(null==s?void 0:s.nuxt)?n.nuxtLink:n.routerLink;case void 0!==l.href:return n.a;default:return n.button}})),k=e.computed((()=>{const e={...null==f?void 0:f.value,ariaPressed:!!b.value||void 0,ariaLabel:l.ariaLabel,role:null==m?void 0:m.value};switch(g.value){case n.a:return{...e,href:l.href,target:l.target,rel:l.rel};case n.routerLink:case n.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==v||v.emit("click",e),r("click",e))},B=e=>{null==v||v.emit("mouseover",e),r("mouseover",e)},h=e=>{null==v||v.emit("mouseleave",e),r("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,current:t.current},onClickPassive:y,onMouseoverPassive:B,onMouseleavePassive:h}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}}),g={class:"vv-nav__item",role:"presentation"};return e.defineComponent({name:"VvNavItem",inheritAttrs:!1,setup:t=>(t,o)=>(e.openBlock(),e.createElementBlock("li",g,[e.createVNode(m,e.mergeProps(t.$attrs,{class:"vv-nav__item-label"}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default")])),_:3},16)]))})}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { openBlock, createElementBlock, renderSlot } from "vue";
|
|
2
|
+
const _sfc_main = {
|
|
3
|
+
name: "VvNavSeparator"
|
|
4
|
+
};
|
|
5
|
+
const _export_sfc = (sfc, props) => {
|
|
6
|
+
const target = sfc.__vccOpts || sfc;
|
|
7
|
+
for (const [key, val] of props) {
|
|
8
|
+
target[key] = val;
|
|
9
|
+
}
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_1 = {
|
|
13
|
+
class: "vv-nav__separator",
|
|
14
|
+
role: "separator"
|
|
15
|
+
};
|
|
16
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
17
|
+
return openBlock(), createElementBlock("li", _hoisted_1, [
|
|
18
|
+
renderSlot(_ctx.$slots, "default")
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
const VvNavSeparator = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
22
|
+
export {
|
|
23
|
+
VvNavSeparator as default
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNavSeparator=o(e.vue)}(this,(function(e){"use strict";const o={class:"vv-nav__separator",role:"separator"};return((e,o)=>{const t=e.__vccOpts||e;for(const[n,r]of o)t[n]=r;return t})({name:"VvNavSeparator"},[["render",function(t,n,r,a,s,f){return e.openBlock(),e.createElementBlock("li",o,[e.renderSlot(t.$slots,"default")])}]])}));
|
|
@@ -79,6 +79,12 @@ const ActiveProps = {
|
|
|
79
79
|
*/
|
|
80
80
|
active: Boolean
|
|
81
81
|
};
|
|
82
|
+
const CurrentProps = {
|
|
83
|
+
/**
|
|
84
|
+
* Whether the item is current
|
|
85
|
+
*/
|
|
86
|
+
current: Boolean
|
|
87
|
+
};
|
|
82
88
|
const PressedProps = {
|
|
83
89
|
/**
|
|
84
90
|
* Whether the item is pressed
|
|
@@ -209,6 +215,7 @@ const ModifiersProps = {
|
|
|
209
215
|
...LabelProps,
|
|
210
216
|
...PressedProps,
|
|
211
217
|
...ActiveProps,
|
|
218
|
+
...CurrentProps,
|
|
212
219
|
...LinkProps,
|
|
213
220
|
/**
|
|
214
221
|
* Button type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvProgress=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{});Boolean,Boolean,Boolean;const n={modifiers:[String,Array]};t.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,r.button;const l={...n,value:{type:[Number,String],default:void 0},max:{type:[Number,String]},label:{type:String,required:!0}};return e.defineComponent({name:"VvProgress",props:l,setup(o){const t=o,{value:r,max:n,label:l}=e.toRefs(t),u=e.computed((()=>void 0===t.value)),{modifiers:a}=e.toRefs(t),s=function(o,t,r){return e.computed((()=>{const n={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((t=>{n[`${o}--${t}`]=e.unref(r.value[t])})),n}))}("vv-progress",a,e.computed((()=>({indeterminate:u.value}))));return(o,t)=>(e.openBlock(),e.createElementBlock("progress",e.mergeProps({role:"progressbar"},{class:e.unref(s),ariaLabel:e.unref(l),max:e.unref(n),value:e.unref(r)}),null,16))}})}));
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvProgress=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{});Boolean,Boolean,Boolean,Boolean;const n={modifiers:[String,Array]};t.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,r.button;const l={...n,value:{type:[Number,String],default:void 0},max:{type:[Number,String]},label:{type:String,required:!0}};return e.defineComponent({name:"VvProgress",props:l,setup(o){const t=o,{value:r,max:n,label:l}=e.toRefs(t),u=e.computed((()=>void 0===t.value)),{modifiers:a}=e.toRefs(t),s=function(o,t,r){return e.computed((()=>{const n={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((t=>{n[`${o}--${t}`]=e.unref(r.value[t])})),n}))}("vv-progress",a,e.computed((()=>({indeterminate:u.value}))));return(o,t)=>(e.openBlock(),e.createElementBlock("progress",e.mergeProps({role:"progressbar"},{class:e.unref(s),ariaLabel:e.unref(l),max:e.unref(n),value:e.unref(r)}),null,16))}})}));
|
|
@@ -115,6 +115,12 @@ const ActiveProps = {
|
|
|
115
115
|
*/
|
|
116
116
|
active: Boolean
|
|
117
117
|
};
|
|
118
|
+
const CurrentProps = {
|
|
119
|
+
/**
|
|
120
|
+
* Whether the item is current
|
|
121
|
+
*/
|
|
122
|
+
current: Boolean
|
|
123
|
+
};
|
|
118
124
|
const PressedProps = {
|
|
119
125
|
/**
|
|
120
126
|
* Whether the item is pressed
|
|
@@ -298,6 +304,7 @@ const CheckboxRadioProps = {
|
|
|
298
304
|
...LabelProps,
|
|
299
305
|
...PressedProps,
|
|
300
306
|
...ActiveProps,
|
|
307
|
+
...CurrentProps,
|
|
301
308
|
...LinkProps,
|
|
302
309
|
/**
|
|
303
310
|
* Button type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadio=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});const o=Symbol.for("volver"),i=Symbol.for("radioGroup"),r={valid:Boolean,validLabel:[String,Array]},u={invalid:Boolean,invalidLabel:[String,Array]},d={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},s={disabled:Boolean},v=(Boolean,Boolean,{label:[String,Number]}),f={readonly:Boolean},c={modifiers:[String,Array]},p={hintLabel:{type:String,default:""}};a.before;const b={tabindex:{type:[String,Number],default:0}},m={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const g={...{...m,name:{type:String,required:!0}},...b,...r,...u,...p,...s,...f,...c,...v,...d,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};function h(e,l,t){return t?S(e,t)===S(l,t):y(e,l)}function y(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let n,o,i;if(t&&a){if(o=e.length,o!=l.length)return!1;for(n=o;0!=n--;)if(!y(e[n],l[n]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(l).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(l,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!y(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function S(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,n=t.length;l<n;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function L(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,n){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const o=e.toRef(a,l);return e.computed({get:()=>o.value,set(e){n&&n(`update:${l}`,e)}})}}}n.button;const O=g;function B(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function $(l,t,a){const n=e.inject(o),i=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[l]))return n.defaults.value[l]}));return e.computed((()=>{if(void 0===i.value)return a;const e=i.value,l=t,n=a;return Object.keys(l).reduce(((t,a)=>{const o=n[a];if(t[a]=o,a in e){if(Array.isArray(l[a])){const n=l[a];if(n.length){n[0]===o&&(t[a]=e[a])}}if("function"==typeof l[a]){(0,l[a])()===o&&(t[a]=e[a])}if("object"==typeof l[a]){let n=l[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(t[a]=e[a]):n===o&&(t[a]=e[a])}}return t}),{})}))}const V=["for"],A=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvRadio",props:O,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const n=t,o=e.useSlots(),r=$("VvRadio",O,n),{id:u,disabled:d,readonly:s,modelValue:v,valid:f,invalid:c}=function(l,t){const{id:a}=e.toRefs(l),{group:n,isInGroup:o,getGroupOrLocalRef:r}=L(i),u=r("modelValue",l,t),d=r("valid",l),s=r("invalid",l),v=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==n?void 0:n.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{id:a,group:n,isInGroup:o,modelValue:u,valid:d,invalid:s,readonly:v,disabled:f}}(n,a),p=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(u),b=e.computed((()=>`${p.value}-hint`)),m=e.computed((()=>y.value?-1:n.tabindex)),g=e.ref(),y=e.computed((()=>d.value||s.value)),S=e.computed((()=>!0===c.value||!0!==f.value&&void 0)),j=e.computed((()=>Array.isArray(v.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(h(e,t))return!0;return!1}(n.value,v.value):h(n.value,v.value))),R=e.computed((()=>!["string","number","boolean"].includes(typeof n.value)||n.value)),k=e.computed({get:()=>j.value?R.value:null,set(e){Array.isArray(v.value)?v.value=[n.value]:v.value=n.value,a("change",e)}}),{modifiers:x}=e.toRefs(n),N=function(l,t,a){return e.computed((()=>{const n={[l]:!0},o="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${l}--${t}`]=e.unref(a.value[t])})),n}))}("vv-radio",x,e.computed((()=>({valid:f.value,invalid:c.value,disabled:d.value,readonly:s.value})))),{HintSlot:P,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:C,hintSlotScope:w}=function(l,t){const a=e.computed((()=>e.isRef(l)?l.value:l)),n=e.computed((()=>B(a.value.invalidLabel))),o=e.computed((()=>B(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(t.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(t.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),c=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:c,HintSlot:p}}(r,o);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(N)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:g,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(k)?k.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(y),value:e.unref(R),tabindex:e.unref(m),"aria-invalid":e.unref(S),"aria-describedby":e.unref(I)?e.unref(b):void 0,"aria-errormessage":e.unref(C)?e.unref(b):void 0},null,8,A),[[e.vModelRadio,e.unref(k)]]),e.renderSlot(l.$slots,"default",{value:e.unref(v)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(P),{id:e.unref(b),class:"vv-radio__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"3"}:void 0]),1032,["id"])],10,V))}})}));
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadio=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});const o=Symbol.for("volver"),i=Symbol.for("radioGroup"),r={valid:Boolean,validLabel:[String,Array]},u={invalid:Boolean,invalidLabel:[String,Array]},d={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},s={disabled:Boolean},v=(Boolean,Boolean,Boolean,{label:[String,Number]}),f={readonly:Boolean},c={modifiers:[String,Array]},p={hintLabel:{type:String,default:""}};a.before;const b={tabindex:{type:[String,Number],default:0}},m={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const g={...{...m,name:{type:String,required:!0}},...b,...r,...u,...p,...s,...f,...c,...v,...d,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};function h(e,l,t){return t?S(e,t)===S(l,t):y(e,l)}function y(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let n,o,i;if(t&&a){if(o=e.length,o!=l.length)return!1;for(n=o;0!=n--;)if(!y(e[n],l[n]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(l).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(l,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!y(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function S(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,n=t.length;l<n;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function L(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,n){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const o=e.toRef(a,l);return e.computed({get:()=>o.value,set(e){n&&n(`update:${l}`,e)}})}}}n.button;const O=g;function B(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function $(l,t,a){const n=e.inject(o),i=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[l]))return n.defaults.value[l]}));return e.computed((()=>{if(void 0===i.value)return a;const e=i.value,l=t,n=a;return Object.keys(l).reduce(((t,a)=>{const o=n[a];if(t[a]=o,a in e){if(Array.isArray(l[a])){const n=l[a];if(n.length){n[0]===o&&(t[a]=e[a])}}if("function"==typeof l[a]){(0,l[a])()===o&&(t[a]=e[a])}if("object"==typeof l[a]){let n=l[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(t[a]=e[a]):n===o&&(t[a]=e[a])}}return t}),{})}))}const V=["for"],A=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvRadio",props:O,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const n=t,o=e.useSlots(),r=$("VvRadio",O,n),{id:u,disabled:d,readonly:s,modelValue:v,valid:f,invalid:c}=function(l,t){const{id:a}=e.toRefs(l),{group:n,isInGroup:o,getGroupOrLocalRef:r}=L(i),u=r("modelValue",l,t),d=r("valid",l),s=r("invalid",l),v=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==n?void 0:n.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{id:a,group:n,isInGroup:o,modelValue:u,valid:d,invalid:s,readonly:v,disabled:f}}(n,a),p=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(u),b=e.computed((()=>`${p.value}-hint`)),m=e.computed((()=>y.value?-1:n.tabindex)),g=e.ref(),y=e.computed((()=>d.value||s.value)),S=e.computed((()=>!0===c.value||!0!==f.value&&void 0)),j=e.computed((()=>Array.isArray(v.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(h(e,t))return!0;return!1}(n.value,v.value):h(n.value,v.value))),R=e.computed((()=>!["string","number","boolean"].includes(typeof n.value)||n.value)),k=e.computed({get:()=>j.value?R.value:null,set(e){Array.isArray(v.value)?v.value=[n.value]:v.value=n.value,a("change",e)}}),{modifiers:x}=e.toRefs(n),N=function(l,t,a){return e.computed((()=>{const n={[l]:!0},o="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${l}--${t}`]=e.unref(a.value[t])})),n}))}("vv-radio",x,e.computed((()=>({valid:f.value,invalid:c.value,disabled:d.value,readonly:s.value})))),{HintSlot:P,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:C,hintSlotScope:w}=function(l,t){const a=e.computed((()=>e.isRef(l)?l.value:l)),n=e.computed((()=>B(a.value.invalidLabel))),o=e.computed((()=>B(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(t.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(t.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),c=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:c,HintSlot:p}}(r,o);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(N)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:g,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(k)?k.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(y),value:e.unref(R),tabindex:e.unref(m),"aria-invalid":e.unref(S),"aria-describedby":e.unref(I)?e.unref(b):void 0,"aria-errormessage":e.unref(C)?e.unref(b):void 0},null,8,A),[[e.vModelRadio,e.unref(k)]]),e.renderSlot(l.$slots,"default",{value:e.unref(v)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(P),{id:e.unref(b),class:"vv-radio__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"3"}:void 0]),1032,["id"])],10,V))}})}));
|
|
@@ -59,14 +59,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
59
59
|
}>> & {
|
|
60
60
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
61
61
|
}, {
|
|
62
|
+
readonly: boolean;
|
|
62
63
|
disabled: boolean;
|
|
64
|
+
valid: boolean;
|
|
65
|
+
invalid: boolean;
|
|
63
66
|
tabindex: string | number;
|
|
64
67
|
loading: boolean;
|
|
65
68
|
loadingLabel: string;
|
|
66
|
-
readonly: boolean;
|
|
67
69
|
hintLabel: string;
|
|
68
|
-
invalid: boolean;
|
|
69
|
-
valid: boolean;
|
|
70
70
|
}, {}>, {
|
|
71
71
|
default?(_: {
|
|
72
72
|
value: any;
|
|
@@ -320,6 +320,12 @@ const ActiveProps = {
|
|
|
320
320
|
*/
|
|
321
321
|
active: Boolean
|
|
322
322
|
};
|
|
323
|
+
const CurrentProps = {
|
|
324
|
+
/**
|
|
325
|
+
* Whether the item is current
|
|
326
|
+
*/
|
|
327
|
+
current: Boolean
|
|
328
|
+
};
|
|
323
329
|
const PressedProps = {
|
|
324
330
|
/**
|
|
325
331
|
* Whether the item is pressed
|
|
@@ -547,6 +553,7 @@ const CheckboxRadioGroupProps = {
|
|
|
547
553
|
...LabelProps,
|
|
548
554
|
...PressedProps,
|
|
549
555
|
...ActiveProps,
|
|
556
|
+
...CurrentProps,
|
|
550
557
|
...LinkProps,
|
|
551
558
|
/**
|
|
552
559
|
* Button type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("radioGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,i;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!s(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const f=Object.keys(e);if(n=f.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,f[a]))return!1;for(a=n;0!=a--;)if(i=f[a],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function c(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>f(o.value.invalidLabel))),n=e.computed((()=>f(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,{label:[String,Number]}),h={readonly:Boolean},S={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},O={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},k={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...k,name:{type:String,required:!0}},...B,...p,...m,...L,...g,...h,...S,...y,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},$={...p,...m,...O,...L,...g,...h,...S,...y,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function R(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}i.button;const j=V;function A(t,l,o){const a=e.inject(r),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];if(a.length){a[0]===n&&(l[o]=e[o])}}if("function"==typeof t[o]){(0,t[o])()===n&&(l[o]=e[o])}if("object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}function x(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const P=["for"],C=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvRadio",props:j,emits:["click","update:modelValue","change","blur"],setup(l,{emit:o}){const a=l,n=e.useSlots(),i=A("VvRadio",j,a),{id:r,disabled:s,readonly:v,modelValue:f,valid:p,invalid:m}=function(t,l){const{id:o}=e.toRefs(t),{group:a,isInGroup:n,getGroupOrLocalRef:i}=R(u),r=i("modelValue",t,l),d=i("valid",t),s=i("invalid",t),v=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:o,group:a,isInGroup:n,modelValue:r,valid:d,invalid:s,readonly:v,disabled:f}}(a,o),b=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),g=e.computed((()=>`${b.value}-hint`)),y=e.computed((()=>S.value?-1:a.tabindex)),h=e.ref(),S=e.computed((()=>s.value||v.value)),L=e.computed((()=>!0===m.value||!0!==p.value&&void 0)),O=e.computed((()=>Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(a.value,f.value):d(a.value,f.value))),B=e.computed((()=>!["string","number","boolean"].includes(typeof a.value)||a.value)),k=e.computed({get:()=>O.value?B.value:null,set(e){Array.isArray(f.value)?f.value=[a.value]:f.value=a.value,o("change",e)}}),{modifiers:V}=e.toRefs(a),$=x("vv-radio",V,e.computed((()=>({valid:p.value,invalid:m.value,disabled:s.value,readonly:v.value})))),{HintSlot:N,hasHintLabelOrSlot:w,hasInvalidLabelOrSlot:_,hintSlotScope:z}=c(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref($)),for:e.unref(b)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(b),ref_key:"input",ref:h,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(k)?k.value=t:null),type:"radio",class:"vv-radio__input",name:t.name,disabled:e.unref(S),value:e.unref(B),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(w)?e.unref(g):void 0,"aria-errormessage":e.unref(_)?e.unref(g):void 0},null,8,C),[[e.vModelRadio,e.unref(k)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(N),{id:e.unref(g),class:"vv-radio__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"3"}:void 0]),1032,["id"])],10,P))}}),w=$;const _=["textContent"],z={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:w,emits:["update:modelValue","change"],setup(t,{emit:a}){const n=t,i=e.useSlots(),r=A("VvRadioGroup",w,n),d=l.useVModel(n,"modelValue",a),{disabled:s,readonly:v,vertical:f,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:g,getOptionValue:y}=function(t){const{options:l,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof a.value?a.value(e):o.get(e,a.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):o.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):o.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),h=x("vv-radio-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!f.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:L}=c(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(h))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,_)):e.createCommentVNode("",!0),e.createElementVNode("div",z,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:y(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-radio-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("radioGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,i;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!s(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const f=Object.keys(e);if(n=f.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,f[a]))return!1;for(a=n;0!=a--;)if(i=f[a],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function c(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>f(o.value.invalidLabel))),n=e.computed((()=>f(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,Boolean,{label:[String,Number]}),h={readonly:Boolean},S={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},O={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},k={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...k,name:{type:String,required:!0}},...B,...p,...m,...L,...g,...h,...S,...y,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},$={...p,...m,...O,...L,...g,...h,...S,...y,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function R(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}i.button;const j=V;function A(t,l,o){const a=e.inject(r),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];if(a.length){a[0]===n&&(l[o]=e[o])}}if("function"==typeof t[o]){(0,t[o])()===n&&(l[o]=e[o])}if("object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}function x(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const P=["for"],C=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvRadio",props:j,emits:["click","update:modelValue","change","blur"],setup(l,{emit:o}){const a=l,n=e.useSlots(),i=A("VvRadio",j,a),{id:r,disabled:s,readonly:v,modelValue:f,valid:p,invalid:m}=function(t,l){const{id:o}=e.toRefs(t),{group:a,isInGroup:n,getGroupOrLocalRef:i}=R(u),r=i("modelValue",t,l),d=i("valid",t),s=i("invalid",t),v=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:o,group:a,isInGroup:n,modelValue:r,valid:d,invalid:s,readonly:v,disabled:f}}(a,o),b=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),g=e.computed((()=>`${b.value}-hint`)),y=e.computed((()=>S.value?-1:a.tabindex)),h=e.ref(),S=e.computed((()=>s.value||v.value)),L=e.computed((()=>!0===m.value||!0!==p.value&&void 0)),O=e.computed((()=>Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(a.value,f.value):d(a.value,f.value))),B=e.computed((()=>!["string","number","boolean"].includes(typeof a.value)||a.value)),k=e.computed({get:()=>O.value?B.value:null,set(e){Array.isArray(f.value)?f.value=[a.value]:f.value=a.value,o("change",e)}}),{modifiers:V}=e.toRefs(a),$=x("vv-radio",V,e.computed((()=>({valid:p.value,invalid:m.value,disabled:s.value,readonly:v.value})))),{HintSlot:N,hasHintLabelOrSlot:w,hasInvalidLabelOrSlot:_,hintSlotScope:z}=c(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref($)),for:e.unref(b)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(b),ref_key:"input",ref:h,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(k)?k.value=t:null),type:"radio",class:"vv-radio__input",name:t.name,disabled:e.unref(S),value:e.unref(B),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(w)?e.unref(g):void 0,"aria-errormessage":e.unref(_)?e.unref(g):void 0},null,8,C),[[e.vModelRadio,e.unref(k)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(N),{id:e.unref(g),class:"vv-radio__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(z))))])),key:"3"}:void 0]),1032,["id"])],10,P))}}),w=$;const _=["textContent"],z={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:w,emits:["update:modelValue","change"],setup(t,{emit:a}){const n=t,i=e.useSlots(),r=A("VvRadioGroup",w,n),d=l.useVModel(n,"modelValue",a),{disabled:s,readonly:v,vertical:f,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:g,getOptionValue:y}=function(t){const{options:l,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof a.value?a.value(e):o.get(e,a.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):o.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):o.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),h=x("vv-radio-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!f.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:L}=c(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(h))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,_)):e.createCommentVNode("",!0),e.createElementVNode("div",z,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:y(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-radio-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -82,14 +82,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
82
82
|
}>> & {
|
|
83
83
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
84
84
|
}, {
|
|
85
|
+
readonly: boolean;
|
|
85
86
|
disabled: boolean;
|
|
87
|
+
valid: boolean;
|
|
88
|
+
invalid: boolean;
|
|
86
89
|
options: (string | Option)[];
|
|
87
90
|
loading: boolean;
|
|
88
91
|
loadingLabel: string;
|
|
89
|
-
readonly: boolean;
|
|
90
92
|
hintLabel: string;
|
|
91
|
-
invalid: boolean;
|
|
92
|
-
valid: boolean;
|
|
93
93
|
vertical: boolean;
|
|
94
94
|
labelKey: string | Function;
|
|
95
95
|
valueKey: string | Function;
|
|
@@ -457,6 +457,12 @@ const ActiveProps = {
|
|
|
457
457
|
*/
|
|
458
458
|
active: Boolean
|
|
459
459
|
};
|
|
460
|
+
const CurrentProps = {
|
|
461
|
+
/**
|
|
462
|
+
* Whether the item is current
|
|
463
|
+
*/
|
|
464
|
+
current: Boolean
|
|
465
|
+
};
|
|
460
466
|
const PressedProps = {
|
|
461
467
|
/**
|
|
462
468
|
* Whether the item is pressed
|
|
@@ -666,6 +672,7 @@ const AutocompleteProps = {
|
|
|
666
672
|
...LabelProps,
|
|
667
673
|
...PressedProps,
|
|
668
674
|
...ActiveProps,
|
|
675
|
+
...CurrentProps,
|
|
669
676
|
...LinkProps,
|
|
670
677
|
/**
|
|
671
678
|
* Button type
|