@volverjs/ui-vue 0.0.5-beta.9 → 0.0.6-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -164,7 +164,7 @@ The following features are planned for the next releases:
164
164
  - [x] (v0.0.3) Redesign of `VvCombobox` for better accessibility and more features;
165
165
  - [x] (v0.0.3) Rewrite of `VvDropdown` to get it applicable to any element;
166
166
  - [x] (v0.0.5) Input masks for `VvInputText` component;
167
- - [ ] `VvAvatar` component;
167
+ - [x] `VvAvatar` component;
168
168
  - [ ] `VvAvatarGroup` component;
169
169
  - [ ] Alerts, notifications and toasts with `VvAlert` and `VvToast` component;
170
170
  - [ ] Loaders with `VvLoader` and `VvSkeleton`;
@@ -0,0 +1,279 @@
1
+ import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode } 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 AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
32
+ AnchorTarget2["_blank"] = "_blank";
33
+ AnchorTarget2["_self"] = "_self";
34
+ AnchorTarget2["_parent"] = "_parent";
35
+ AnchorTarget2["_top"] = "_top";
36
+ return AnchorTarget2;
37
+ })(AnchorTarget || {});
38
+ const LinkProps = {
39
+ /**
40
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
41
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
42
+ */
43
+ to: {
44
+ type: [String, Object]
45
+ },
46
+ /**
47
+ * Anchor href
48
+ */
49
+ href: String,
50
+ /**
51
+ * Anchor target
52
+ */
53
+ target: {
54
+ type: String,
55
+ validator: (value) => Object.values(AnchorTarget).includes(value)
56
+ },
57
+ /**
58
+ * Anchor rel
59
+ */
60
+ rel: {
61
+ type: String,
62
+ default: "noopener noreferrer"
63
+ }
64
+ };
65
+ const DisabledProps = {
66
+ /**
67
+ * Whether the form control is disabled
68
+ */
69
+ disabled: Boolean
70
+ };
71
+ const ActiveProps = {
72
+ /**
73
+ * Whether the item is active
74
+ */
75
+ active: Boolean
76
+ };
77
+ const PressedProps = {
78
+ /**
79
+ * Whether the item is pressed
80
+ */
81
+ pressed: Boolean
82
+ };
83
+ const LabelProps = {
84
+ /**
85
+ * The item label
86
+ */
87
+ label: [String, Number]
88
+ };
89
+ const ModifiersProps = {
90
+ /**
91
+ * Component BEM modifiers
92
+ */
93
+ modifiers: [String, Array]
94
+ };
95
+ ({
96
+ /**
97
+ * VvIcon name or props
98
+ * @see VVIcon
99
+ */
100
+ icon: { type: [String, Object] },
101
+ /**
102
+ * VvIcon position
103
+ */
104
+ iconPosition: {
105
+ type: String,
106
+ default: Position.before,
107
+ validation: (value) => Object.values(Position).includes(value)
108
+ }
109
+ });
110
+ ({
111
+ /**
112
+ * Dropdown placement
113
+ */
114
+ placement: {
115
+ type: String,
116
+ default: Side.bottom,
117
+ validator: (value) => {
118
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
119
+ }
120
+ },
121
+ /**
122
+ * Dropdown strategy
123
+ */
124
+ strategy: {
125
+ type: String,
126
+ default: "absolute",
127
+ validator: (value) => {
128
+ return ["fixed", "absolute"].includes(value);
129
+ }
130
+ },
131
+ /**
132
+ * Dropdown show / hide transition name
133
+ */
134
+ transitionName: {
135
+ type: String
136
+ },
137
+ /**
138
+ * Offset of the dropdown from the trigger
139
+ * @see https://floating-ui.com/docs/offset
140
+ */
141
+ offset: {
142
+ type: [Number, String, Object],
143
+ default: 0
144
+ },
145
+ /**
146
+ * Move dropdown to the side if there is no space in the default position
147
+ * @see https://floating-ui.com/docs/shift
148
+ */
149
+ shift: {
150
+ type: [Boolean, Object],
151
+ default: false
152
+ },
153
+ /**
154
+ * Flip dropdown position if there is no space in the default position
155
+ * @see https://floating-ui.com/docs/flip
156
+ */
157
+ flip: {
158
+ type: [Boolean, Object],
159
+ default: true
160
+ },
161
+ /**
162
+ * Size of the dropdown
163
+ * @see https://floating-ui.com/docs/size
164
+ */
165
+ size: {
166
+ type: [Boolean, Object],
167
+ default: () => ({ padding: 10 })
168
+ },
169
+ /**
170
+ * Automatically change the position of the dropdown
171
+ * @see https://floating-ui.com/docs/autoPlacement
172
+ */
173
+ autoPlacement: {
174
+ type: [Boolean, Object],
175
+ default: false
176
+ },
177
+ /**
178
+ * Add arrow to the dropdown
179
+ * @see https://floating-ui.com/docs/arrow
180
+ */
181
+ arrow: {
182
+ type: Boolean,
183
+ default: false
184
+ },
185
+ /**
186
+ * Close dropdown on click outside
187
+ */
188
+ autoClose: {
189
+ type: Boolean,
190
+ default: true
191
+ },
192
+ /**
193
+ * Autofocus first item on dropdown open
194
+ */
195
+ autofocusFirst: {
196
+ type: Boolean,
197
+ default: true
198
+ },
199
+ /**
200
+ * Set dropdown width to the same as the trigger
201
+ */
202
+ triggerWidth: {
203
+ type: Boolean
204
+ }
205
+ });
206
+ ({
207
+ ...DisabledProps,
208
+ ...LabelProps,
209
+ ...PressedProps,
210
+ ...ActiveProps,
211
+ ...LinkProps,
212
+ /**
213
+ * Button type
214
+ */
215
+ type: {
216
+ type: String,
217
+ default: ButtonType.button,
218
+ validator: (value) => Object.values(ButtonType).includes(value)
219
+ }
220
+ });
221
+ const VvAvatarProps = {
222
+ ...ModifiersProps,
223
+ /**
224
+ * Image src for avatar
225
+ */
226
+ imgSrc: String
227
+ };
228
+ function useModifiers(prefix, modifiers, others) {
229
+ return computed(() => {
230
+ const toReturn = {
231
+ [prefix]: true
232
+ };
233
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
234
+ if (modifiersArray) {
235
+ if (Array.isArray(modifiersArray)) {
236
+ modifiersArray.forEach((modifier) => {
237
+ if (modifier) {
238
+ toReturn[`${prefix}--${modifier}`] = true;
239
+ }
240
+ });
241
+ }
242
+ }
243
+ if (others) {
244
+ Object.keys(others.value).forEach((key) => {
245
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
246
+ });
247
+ }
248
+ return toReturn;
249
+ });
250
+ }
251
+ const _hoisted_1 = ["role", "aria-label"];
252
+ const _hoisted_2 = ["src"];
253
+ const _sfc_main = /* @__PURE__ */ defineComponent({
254
+ __name: "VvAvatar",
255
+ props: VvAvatarProps,
256
+ setup(__props) {
257
+ const props = __props;
258
+ const { modifiers } = toRefs(props);
259
+ const bemCssClasses = useModifiers("vv-avatar", modifiers);
260
+ return (_ctx, _cache) => {
261
+ return openBlock(), createElementBlock("span", {
262
+ class: normalizeClass(unref(bemCssClasses)),
263
+ role: _ctx.imgSrc ? void 0 : "img",
264
+ "aria-label": _ctx.imgSrc ? void 0 : "avatar"
265
+ }, [
266
+ renderSlot(_ctx.$slots, "default", {}, () => [
267
+ _ctx.imgSrc ? (openBlock(), createElementBlock("img", {
268
+ key: 0,
269
+ src: _ctx.imgSrc,
270
+ alt: "avatar"
271
+ }, null, 8, _hoisted_2)) : createCommentVNode("", true)
272
+ ])
273
+ ], 10, _hoisted_1);
274
+ };
275
+ }
276
+ });
277
+ export {
278
+ _sfc_main as default
279
+ };
@@ -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).VvAvatar=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 a={...n,imgSrc:String};const l=["role","aria-label"],i=["src"];return e.defineComponent({__name:"VvAvatar",props:a,setup(o){const t=o,{modifiers:r}=e.toRefs(t),n=function(o,t,r){return e.computed((()=>{const n={[o]:!0},a="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${o}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((t=>{n[`${o}--${t}`]=e.unref(r.value[t])})),n}))}("vv-avatar",r);return(o,t)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(n)),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,i)):e.createCommentVNode("",!0)]))],10,l))}})}));
@@ -0,0 +1,15 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
+ imgSrc: StringConstructor;
3
+ modifiers: globalThis.PropType<string | string[]>;
4
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
5
+ imgSrc: StringConstructor;
6
+ modifiers: globalThis.PropType<string | string[]>;
7
+ }>>, {}>, {
8
+ default: (_: {}) => any;
9
+ }>;
10
+ export default _default;
11
+ type __VLS_WithTemplateSlots<T, S> = T & {
12
+ new (): {
13
+ $slots: S;
14
+ };
15
+ };
@@ -0,0 +1,7 @@
1
+ export declare const VvAvatarProps: {
2
+ /**
3
+ * Image src for avatar
4
+ */
5
+ imgSrc: StringConstructor;
6
+ modifiers: globalThis.PropType<string | string[]>;
7
+ };
package/dist/icons.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const prefix$2 = "normal";
2
- const lastModified$2 = 1680081885;
2
+ const lastModified$2 = 1680085437;
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 = 1680081885;
617
+ const lastModified$1 = 1680085437;
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 = 1680081885;
1230
+ const lastModified = 1680085437;
1231
1231
  const icons$1 = {
1232
1232
  add: {
1233
1233
  body: '<path fill="none" stroke="currentColor" stroke-linecap="round" d="M.5 8h15M8 .5v15"/>'