@volverjs/ui-vue 0.0.6-beta.2 → 0.0.6-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/README.md +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +4 -2
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvNav/VvNav.es.js +442 -0
- package/dist/components/VvNav/VvNav.umd.js +1 -0
- package/dist/components/VvNav/VvNav.vue.d.ts +47 -0
- package/dist/components/VvNav/index.d.ts +31 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +19 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +1 -0
- package/dist/components/VvNavItemTitle/VvNavItemTitle.vue.d.ts +6 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.d.ts +2 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/stories/Nav/Nav.settings.d.ts +33 -0
- package/dist/stories/Nav/Nav.test.d.ts +2 -0
- package/package.json +17 -1
- 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/VvAvatarGroup/VvAvatarGroup.vue +2 -2
- package/src/components/VvNav/VvNav.vue +56 -0
- package/src/components/VvNav/index.ts +20 -0
- package/src/components/VvNavItemTitle/VvNavItemTitle.vue +11 -0
- package/src/components/VvNavSeparator/VvNavSeparator.ts +8 -0
- package/src/stories/Nav/Nav.settings.ts +34 -0
- package/src/stories/Nav/Nav.stories.mdx +28 -0
- package/src/stories/Nav/Nav.test.ts +32 -0
- package/src/stories/Nav/NavModifiers.stories.mdx +48 -0
package/README.md
CHANGED
|
@@ -166,9 +166,9 @@ The following features are planned for the next releases:
|
|
|
166
166
|
- [x] (v0.0.5) Input masks for `VvInputText` component;
|
|
167
167
|
- [x] `VvAvatar` component;
|
|
168
168
|
- [x] `VvAvatarGroup` component;
|
|
169
|
+
- [x] Menus, navigation and tabs with `VvNav`;
|
|
169
170
|
- [ ] Alerts, notifications and toasts with `VvAlert` and `VvToast` component;
|
|
170
171
|
- [ ] Loaders with `VvLoader` and `VvSkeleton`;
|
|
171
|
-
- [ ] Menus, navigation and tabs with `VvNav`;
|
|
172
172
|
- [ ] `VvTable` component with sort, filters, pagination and cell editing;
|
|
173
173
|
- [ ] Multiple uploads, image crop and file previews with `VvInputFile`;
|
|
174
174
|
- [ ] Carousel and galleries with `VvCarousel` component;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, Fragment, renderList, createBlock, mergeProps, withCtx, toDisplayString, createTextVNode } from "vue";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
2
3
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
4
|
Side2["left"] = "left";
|
|
4
5
|
Side2["right"] = "right";
|
|
@@ -293,6 +294,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
293
294
|
};
|
|
294
295
|
}
|
|
295
296
|
});
|
|
297
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
296
298
|
const _hoisted_1 = { key: 0 };
|
|
297
299
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
298
300
|
__name: "VvAvatarGroup",
|
|
@@ -308,7 +310,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
308
310
|
return (avatarModifiers == null ? void 0 : avatarModifiers.value) || "";
|
|
309
311
|
});
|
|
310
312
|
const avatarItems = computed(() => {
|
|
311
|
-
return items.value.slice(0, toShow.value).map((item
|
|
313
|
+
return items.value.slice(0, toShow.value).map((item) => {
|
|
312
314
|
let modifiers2 = [];
|
|
313
315
|
let itemModifiers = [];
|
|
314
316
|
if (avatarModifiers == null ? void 0 : avatarModifiers.value) {
|
|
@@ -319,7 +321,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
319
321
|
}
|
|
320
322
|
return {
|
|
321
323
|
...item,
|
|
322
|
-
key: item.key ||
|
|
324
|
+
key: item.key || useUniqueId().value,
|
|
323
325
|
modifiers: [...modifiers2, ...itemModifiers]
|
|
324
326
|
};
|
|
325
327
|
});
|
|
@@ -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).VvAvatarGroup=o(e.vue)}(this,(function(e){"use strict";var
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAvatarGroup=o(e.vue,e.nanoid)}(this,(function(e,o){"use strict";var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{});Boolean,Boolean,Boolean;const n={modifiers:[String,Array]};t.before,r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,a.button;const l={...n,items:{type:Array,default:()=>[],required:!0},toShow:{type:Number,default:3},totalItems:{type:Number},avatarModifiers:[String,Array]},i={...n,imgSrc:String};function u(o,r,t){return e.computed((()=>{const a={[o]:!0},n="string"==typeof(null==r?void 0:r.value)?r.value.split(" "):null==r?void 0:r.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${o}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((r=>{a[`${o}--${r}`]=e.unref(t.value[r])})),a}))}const s=["role","aria-label"],d=["src"],f=e.defineComponent({__name:"VvAvatar",props:i,setup(o){const r=o,{modifiers:t}=e.toRefs(r),a=u("vv-avatar",t);return(o,r)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(a)),role:o.imgSrc?void 0:"img","aria-label":o.imgSrc?void 0:"avatar"},[e.renderSlot(o.$slots,"default",{},(()=>[o.imgSrc?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.imgSrc,alt:"avatar"},null,8,d)):e.createCommentVNode("",!0)]))],10,s))}}),m={key:0};return e.defineComponent({__name:"VvAvatarGroup",props:l,setup(r){const t=r,{modifiers:a,items:n,toShow:l,totalItems:i,avatarModifiers:s}=e.toRefs(t),d=u("vv-avatar-group",a),c=e.computed((()=>(null==s?void 0:s.value)&&Array.isArray(null==s?void 0:s.value)?s.value.join(" "):(null==s?void 0:s.value)||"")),v=e.computed((()=>n.value.slice(0,l.value).map((r=>{let t=[],a=[];return(null==s?void 0:s.value)&&(t=Array.isArray(null==s?void 0:s.value)?null==s?void 0:s.value:[null==s?void 0:s.value]),r.modifiers&&(a=Array.isArray(r.modifiers)?r.modifiers:[r.modifiers]),{...r,key:r.key||e.computed((()=>String((null==n?void 0:n.value)||o.nanoid()))).value,modifiers:[...t,...a]};var n}))));return(o,r)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(d))},[e.renderSlot(o.$slots,"default",{},(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),(o=>(e.openBlock(),e.createBlock(f,e.mergeProps({key:o.key},{modifiers:o.modifiers,imgSrc:o.imgSrc}),{default:e.withCtx((()=>[o.text?(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(o.text),1)):e.createCommentVNode("",!0)])),_:2},1040)))),128)),(e.unref(i)||e.unref(n).length)>e.unref(l)?(e.openBlock(),e.createBlock(f,{key:0,modifiers:`${e.unref(c)} surface bordered`},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString("+"+((e.unref(i)||e.unref(n).length)-e.unref(l))),1)])),_:1},8,["modifiers"])):e.createCommentVNode("",!0)]))],2))}})}));
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, toRefs, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, createVNode, toHandlers } 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
|
+
const ModifiersProps = {
|
|
100
|
+
/**
|
|
101
|
+
* Component BEM modifiers
|
|
102
|
+
*/
|
|
103
|
+
modifiers: [String, Array]
|
|
104
|
+
};
|
|
105
|
+
({
|
|
106
|
+
/**
|
|
107
|
+
* VvIcon name or props
|
|
108
|
+
* @see VVIcon
|
|
109
|
+
*/
|
|
110
|
+
icon: { type: [String, Object] },
|
|
111
|
+
/**
|
|
112
|
+
* VvIcon position
|
|
113
|
+
*/
|
|
114
|
+
iconPosition: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: Position.before,
|
|
117
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
({
|
|
121
|
+
/**
|
|
122
|
+
* Dropdown placement
|
|
123
|
+
*/
|
|
124
|
+
placement: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: Side.bottom,
|
|
127
|
+
validator: (value) => {
|
|
128
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Dropdown strategy
|
|
133
|
+
*/
|
|
134
|
+
strategy: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: "absolute",
|
|
137
|
+
validator: (value) => {
|
|
138
|
+
return ["fixed", "absolute"].includes(value);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Dropdown show / hide transition name
|
|
143
|
+
*/
|
|
144
|
+
transitionName: {
|
|
145
|
+
type: String
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Offset of the dropdown from the trigger
|
|
149
|
+
* @see https://floating-ui.com/docs/offset
|
|
150
|
+
*/
|
|
151
|
+
offset: {
|
|
152
|
+
type: [Number, String, Object],
|
|
153
|
+
default: 0
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Move dropdown to the side if there is no space in the default position
|
|
157
|
+
* @see https://floating-ui.com/docs/shift
|
|
158
|
+
*/
|
|
159
|
+
shift: {
|
|
160
|
+
type: [Boolean, Object],
|
|
161
|
+
default: false
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* Flip dropdown position if there is no space in the default position
|
|
165
|
+
* @see https://floating-ui.com/docs/flip
|
|
166
|
+
*/
|
|
167
|
+
flip: {
|
|
168
|
+
type: [Boolean, Object],
|
|
169
|
+
default: true
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* Size of the dropdown
|
|
173
|
+
* @see https://floating-ui.com/docs/size
|
|
174
|
+
*/
|
|
175
|
+
size: {
|
|
176
|
+
type: [Boolean, Object],
|
|
177
|
+
default: () => ({ padding: 10 })
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Automatically change the position of the dropdown
|
|
181
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
182
|
+
*/
|
|
183
|
+
autoPlacement: {
|
|
184
|
+
type: [Boolean, Object],
|
|
185
|
+
default: false
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* Add arrow to the dropdown
|
|
189
|
+
* @see https://floating-ui.com/docs/arrow
|
|
190
|
+
*/
|
|
191
|
+
arrow: {
|
|
192
|
+
type: Boolean,
|
|
193
|
+
default: false
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Close dropdown on click outside
|
|
197
|
+
*/
|
|
198
|
+
autoClose: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: true
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* Autofocus first item on dropdown open
|
|
204
|
+
*/
|
|
205
|
+
autofocusFirst: {
|
|
206
|
+
type: Boolean,
|
|
207
|
+
default: true
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* Set dropdown width to the same as the trigger
|
|
211
|
+
*/
|
|
212
|
+
triggerWidth: {
|
|
213
|
+
type: Boolean
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const ActionProps = {
|
|
217
|
+
...DisabledProps,
|
|
218
|
+
...LabelProps,
|
|
219
|
+
...PressedProps,
|
|
220
|
+
...ActiveProps,
|
|
221
|
+
...LinkProps,
|
|
222
|
+
/**
|
|
223
|
+
* Button type
|
|
224
|
+
*/
|
|
225
|
+
type: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: ButtonType.button,
|
|
228
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const VvNavProps = {
|
|
232
|
+
...ModifiersProps,
|
|
233
|
+
items: {
|
|
234
|
+
type: Array,
|
|
235
|
+
required: true,
|
|
236
|
+
default: () => []
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const VvNavEvents = ["click"];
|
|
240
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
241
|
+
const VvActionProps = ActionProps;
|
|
242
|
+
function useVolver() {
|
|
243
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
244
|
+
}
|
|
245
|
+
function useInjectedDropdownTrigger() {
|
|
246
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
247
|
+
}
|
|
248
|
+
function useInjectedDropdownAction() {
|
|
249
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
250
|
+
}
|
|
251
|
+
const __default__ = {
|
|
252
|
+
name: "VvAction"
|
|
253
|
+
};
|
|
254
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
255
|
+
...__default__,
|
|
256
|
+
props: VvActionProps,
|
|
257
|
+
emits: VvActionEvents,
|
|
258
|
+
setup(__props, { expose, emit }) {
|
|
259
|
+
const props = __props;
|
|
260
|
+
const volver = useVolver();
|
|
261
|
+
const element = ref(null);
|
|
262
|
+
expose({ $el: element });
|
|
263
|
+
const {
|
|
264
|
+
reference: dropdownTriggerReference,
|
|
265
|
+
bus: dropdownEventBus,
|
|
266
|
+
aria: dropdownAria,
|
|
267
|
+
expanded: dropdownExpanded
|
|
268
|
+
} = useInjectedDropdownTrigger();
|
|
269
|
+
watch(
|
|
270
|
+
() => element.value,
|
|
271
|
+
(newValue) => {
|
|
272
|
+
if (dropdownTriggerReference) {
|
|
273
|
+
dropdownTriggerReference.value = newValue;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
const pressed = computed(() => {
|
|
278
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
279
|
+
});
|
|
280
|
+
const { role } = useInjectedDropdownAction();
|
|
281
|
+
const hasTag = computed(() => {
|
|
282
|
+
switch (true) {
|
|
283
|
+
case props.disabled:
|
|
284
|
+
return ActionTag.button;
|
|
285
|
+
case props.to !== void 0:
|
|
286
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
287
|
+
case props.href !== void 0:
|
|
288
|
+
return ActionTag.a;
|
|
289
|
+
default:
|
|
290
|
+
return ActionTag.button;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
const hasProps = computed(() => {
|
|
294
|
+
const toReturn = {
|
|
295
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
296
|
+
"aria-pressed": pressed.value ? true : void 0,
|
|
297
|
+
role
|
|
298
|
+
};
|
|
299
|
+
switch (hasTag.value) {
|
|
300
|
+
case ActionTag.a:
|
|
301
|
+
return {
|
|
302
|
+
...toReturn,
|
|
303
|
+
href: props.href,
|
|
304
|
+
target: props.target,
|
|
305
|
+
rel: props.rel
|
|
306
|
+
};
|
|
307
|
+
case ActionTag.routerLink:
|
|
308
|
+
case ActionTag.nuxtLink:
|
|
309
|
+
return {
|
|
310
|
+
...toReturn,
|
|
311
|
+
to: props.to,
|
|
312
|
+
target: props.target
|
|
313
|
+
};
|
|
314
|
+
default:
|
|
315
|
+
return {
|
|
316
|
+
...toReturn,
|
|
317
|
+
type: props.type,
|
|
318
|
+
disabled: props.disabled
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
const onClick = (e) => {
|
|
323
|
+
if (props.disabled) {
|
|
324
|
+
e.preventDefault();
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
328
|
+
emit("click", e);
|
|
329
|
+
};
|
|
330
|
+
const onMouseover = (e) => {
|
|
331
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
332
|
+
emit("mouseover", e);
|
|
333
|
+
};
|
|
334
|
+
const onMouseleave = (e) => {
|
|
335
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
336
|
+
emit("mouseleave", e);
|
|
337
|
+
};
|
|
338
|
+
return (_ctx, _cache) => {
|
|
339
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
340
|
+
ref_key: "element",
|
|
341
|
+
ref: element,
|
|
342
|
+
class: {
|
|
343
|
+
active: _ctx.active,
|
|
344
|
+
pressed: unref(pressed),
|
|
345
|
+
disabled: _ctx.disabled
|
|
346
|
+
},
|
|
347
|
+
onClickPassive: onClick,
|
|
348
|
+
onMouseoverPassive: onMouseover,
|
|
349
|
+
onMouseleavePassive: onMouseleave
|
|
350
|
+
}), {
|
|
351
|
+
default: withCtx(() => [
|
|
352
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
353
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
354
|
+
])
|
|
355
|
+
]),
|
|
356
|
+
_: 3
|
|
357
|
+
}, 16, ["class"]);
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
function useModifiers(prefix, modifiers, others) {
|
|
362
|
+
return computed(() => {
|
|
363
|
+
const toReturn = {
|
|
364
|
+
[prefix]: true
|
|
365
|
+
};
|
|
366
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
367
|
+
if (modifiersArray) {
|
|
368
|
+
if (Array.isArray(modifiersArray)) {
|
|
369
|
+
modifiersArray.forEach((modifier) => {
|
|
370
|
+
if (modifier) {
|
|
371
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (others) {
|
|
377
|
+
Object.keys(others.value).forEach((key) => {
|
|
378
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
return toReturn;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const _hoisted_1 = {
|
|
385
|
+
class: "vv-nav__menu",
|
|
386
|
+
role: "menu",
|
|
387
|
+
"aria-busy": "true"
|
|
388
|
+
};
|
|
389
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
390
|
+
__name: "VvNav",
|
|
391
|
+
props: VvNavProps,
|
|
392
|
+
emits: VvNavEvents,
|
|
393
|
+
setup(__props, { emit }) {
|
|
394
|
+
const props = __props;
|
|
395
|
+
const { modifiers } = toRefs(props);
|
|
396
|
+
const activeItem = ref(null);
|
|
397
|
+
const bemCssClasses = useModifiers("vv-nav", modifiers);
|
|
398
|
+
function onClick(item, id) {
|
|
399
|
+
if (!item.disabled) {
|
|
400
|
+
emit("click", item);
|
|
401
|
+
activeItem.value = id;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return (_ctx, _cache) => {
|
|
405
|
+
return openBlock(), createElementBlock("nav", {
|
|
406
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
407
|
+
}, [
|
|
408
|
+
createElementVNode("ul", _hoisted_1, [
|
|
409
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (navItem, index) => {
|
|
410
|
+
return openBlock(), createElementBlock("li", {
|
|
411
|
+
key: `nav-item_${index}`,
|
|
412
|
+
class: "vv-nav__item",
|
|
413
|
+
role: "presentation"
|
|
414
|
+
}, [
|
|
415
|
+
createVNode(_sfc_main$1, mergeProps({
|
|
416
|
+
disabled: navItem.disabled,
|
|
417
|
+
to: navItem.to,
|
|
418
|
+
href: navItem.href,
|
|
419
|
+
tabindex: 0
|
|
420
|
+
}, {
|
|
421
|
+
class: [{
|
|
422
|
+
current: unref(activeItem) == `nav-item_${index}`,
|
|
423
|
+
disabled: navItem.disabled
|
|
424
|
+
}, "vv-nav__item-label"]
|
|
425
|
+
}, toHandlers(navItem.on || {}), {
|
|
426
|
+
onClick: ($event) => onClick(navItem, `nav-item_${index}`)
|
|
427
|
+
}), {
|
|
428
|
+
default: withCtx(() => [
|
|
429
|
+
createTextVNode(toDisplayString(navItem.title), 1)
|
|
430
|
+
]),
|
|
431
|
+
_: 2
|
|
432
|
+
}, 1040, ["class", "onClick"])
|
|
433
|
+
]);
|
|
434
|
+
}), 128))
|
|
435
|
+
])
|
|
436
|
+
], 2);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
export {
|
|
441
|
+
_sfc_main as default
|
|
442
|
+
};
|
|
@@ -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).VvNav=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"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(l).includes(e)},rel:{type:String,default:"noopener noreferrer"}},c={disabled:Boolean},d={active:Boolean},v={pressed:Boolean},f={label:[String,Number]},m={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const p={...c,...f,...v,...d,...u,type:{type:String,default:n.button,validator:e=>Object.values(n).includes(e)}},b={...m,items:{type:Array,required:!0,default:()=>[]}},k=p;const y=e.defineComponent({name:"VvAction",props:k,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const l=t,u=e.inject(a),c=e.ref(null);o({$el:c});const{reference:d,bus:v,aria:f,expanded:m}=e.inject(i,{});e.watch((()=>c.value),(e=>{d&&(d.value=e)}));const p=e.computed((()=>l.pressed||(null==m?void 0:m.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case l.disabled:return r.button;case void 0!==l.to:return(null==u?void 0:u.nuxt)?r.nuxtLink:r.routerLink;case void 0!==l.href:return r.a;default:return r.button}})),y=e.computed((()=>{const e={...null==f?void 0:f.value,"aria-pressed":!!p.value||void 0,role:b};switch(k.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}}})),g=e=>{l.disabled?e.preventDefault():(null==v||v.emit("click",e),n("click",e))},_=e=>{null==v||v.emit("mouseover",e),n("mouseover",e)},B=e=>{null==v||v.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(y),{ref_key:"element",ref:c,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled},onClickPassive:g,onMouseoverPassive:_,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const g={class:"vv-nav__menu",role:"menu","aria-busy":"true"};return e.defineComponent({__name:"VvNav",props:b,emits:["click"],setup(t,{emit:o}){const n=t,{modifiers:r}=e.toRefs(n),l=e.ref(null),a=function(t,o,n){return e.computed((()=>{const r={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{r[`${t}--${o}`]=e.unref(n.value[o])})),r}))}("vv-nav",r);return(t,n)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(a))},[e.createElementVNode("ul",g,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,((t,n)=>(e.openBlock(),e.createElementBlock("li",{key:`nav-item_${n}`,class:"vv-nav__item",role:"presentation"},[e.createVNode(y,e.mergeProps({disabled:t.disabled,to:t.to,href:t.href,tabindex:0},{class:[{current:e.unref(l)==`nav-item_${n}`,disabled:t.disabled},"vv-nav__item-label"]},e.toHandlers(t.on||{}),{onClick:e=>{return a=`nav-item_${n}`,void((r=t).disabled||(o("click",r),l.value=a));var r,a}}),{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(t.title),1)])),_:2},1040,["class","onClick"])])))),128))])],2))}})}));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type NavItem } from '@/components/VvNav';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
items: {
|
|
4
|
+
type: {
|
|
5
|
+
(arrayLength: number): NavItem[];
|
|
6
|
+
(...items: NavItem[]): NavItem[];
|
|
7
|
+
new (arrayLength: number): NavItem[];
|
|
8
|
+
new (...items: NavItem[]): NavItem[];
|
|
9
|
+
isArray(arg: any): arg is any[];
|
|
10
|
+
readonly prototype: any[];
|
|
11
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
12
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
13
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
14
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
15
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
16
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
17
|
+
};
|
|
18
|
+
required: boolean;
|
|
19
|
+
default: () => never[];
|
|
20
|
+
};
|
|
21
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
22
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
items: {
|
|
24
|
+
type: {
|
|
25
|
+
(arrayLength: number): NavItem[];
|
|
26
|
+
(...items: NavItem[]): NavItem[];
|
|
27
|
+
new (arrayLength: number): NavItem[];
|
|
28
|
+
new (...items: NavItem[]): NavItem[];
|
|
29
|
+
isArray(arg: any): arg is any[];
|
|
30
|
+
readonly prototype: any[];
|
|
31
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
32
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
33
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
34
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
35
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
36
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
37
|
+
};
|
|
38
|
+
required: boolean;
|
|
39
|
+
default: () => never[];
|
|
40
|
+
};
|
|
41
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
42
|
+
}>> & {
|
|
43
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
items: NavItem[];
|
|
46
|
+
}>;
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type NavItem = {
|
|
2
|
+
title: string;
|
|
3
|
+
to?: string | {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
href?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
on: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const VvNavProps: {
|
|
11
|
+
items: {
|
|
12
|
+
type: {
|
|
13
|
+
(arrayLength: number): NavItem[];
|
|
14
|
+
(...items: NavItem[]): NavItem[];
|
|
15
|
+
new (arrayLength: number): NavItem[];
|
|
16
|
+
new (...items: NavItem[]): NavItem[];
|
|
17
|
+
isArray(arg: any): arg is any[];
|
|
18
|
+
readonly prototype: any[];
|
|
19
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
20
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
21
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
22
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
23
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
24
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
25
|
+
};
|
|
26
|
+
required: boolean;
|
|
27
|
+
default: () => never[];
|
|
28
|
+
};
|
|
29
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
30
|
+
};
|
|
31
|
+
export declare const VvNavEvents: string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, toDisplayString } from "vue";
|
|
2
|
+
const _hoisted_1 = {
|
|
3
|
+
class: "vv-nav__heading-label",
|
|
4
|
+
"aria-hidden": "true"
|
|
5
|
+
};
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "VvNavItemTitle",
|
|
8
|
+
props: {
|
|
9
|
+
title: String
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
return openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.title), 1);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
_sfc_main as default
|
|
19
|
+
};
|
|
@@ -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).VvNavItemTitle=t(e.vue)}(this,(function(e){"use strict";const t={class:"vv-nav__heading-label","aria-hidden":"true"};return e.defineComponent({__name:"VvNavItemTitle",props:{title:String},setup:n=>(i,o)=>(e.openBlock(),e.createElementBlock("span",t,e.toDisplayString(n.title),1))})}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
title: StringConstructor;
|
|
3
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
4
|
+
title: StringConstructor;
|
|
5
|
+
}>>, {}>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
package/dist/icons.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const prefix$2 = "normal";
|
|
2
|
-
const lastModified$2 =
|
|
2
|
+
const lastModified$2 = 1680267634;
|
|
3
3
|
const icons$3 = {
|
|
4
4
|
add: {
|
|
5
5
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M4 12h16m-8-8v16"/>'
|
|
@@ -614,7 +614,7 @@ const normal = {
|
|
|
614
614
|
height: height$1
|
|
615
615
|
};
|
|
616
616
|
const prefix$1 = "detailed";
|
|
617
|
-
const lastModified$1 =
|
|
617
|
+
const lastModified$1 = 1680267634;
|
|
618
618
|
const icons$2 = {
|
|
619
619
|
add: {
|
|
620
620
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M4 15.999h24m-12-12v24"/>'
|
|
@@ -1227,7 +1227,7 @@ const detailed = {
|
|
|
1227
1227
|
height
|
|
1228
1228
|
};
|
|
1229
1229
|
const prefix = "simple";
|
|
1230
|
-
const lastModified =
|
|
1230
|
+
const lastModified = 1680267634;
|
|
1231
1231
|
const icons$1 = {
|
|
1232
1232
|
add: {
|
|
1233
1233
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" d="M.5 8h15M8 .5v15"/>'
|