@volverjs/ui-vue 0.0.9-beta.9 → 0.0.9
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/auto-imports.d.ts +2 -2
- package/dist/components/VvAccordion/VvAccordion.es.js +8 -7
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +8 -7
- package/dist/components/VvAction/VvAction.es.js +8 -7
- package/dist/components/VvAlert/VvAlert.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
- package/dist/components/VvAlertGroup/index.d.ts +2 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +8 -7
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +8 -7
- package/dist/components/VvBadge/VvBadge.es.js +8 -7
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +8 -7
- package/dist/components/VvButton/VvButton.es.js +8 -7
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +8 -7
- package/dist/components/VvCard/VvCard.es.js +8 -7
- package/dist/components/VvCheckbox/VvCheckbox.es.js +8 -7
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +8 -7
- package/dist/components/VvCombobox/VvCombobox.es.js +145 -116
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +306 -90
- package/dist/components/VvCombobox/index.d.ts +108 -31
- package/dist/components/VvDialog/VvDialog.es.js +16 -11
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +19 -16
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +299 -91
- package/dist/components/VvDropdown/index.d.ts +99 -30
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +8 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +8 -7
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +8 -7
- package/dist/components/VvInputText/VvInputText.es.js +193 -103
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +19 -37
- package/dist/components/VvInputText/index.d.ts +15 -33
- package/dist/components/VvNav/VvNav.es.js +8 -7
- package/dist/components/VvProgress/VvProgress.es.js +8 -7
- package/dist/components/VvRadio/VvRadio.es.js +8 -7
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +8 -7
- package/dist/components/VvTextarea/VvTextarea.es.js +16 -12
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
- package/dist/components/index.es.js +346 -221
- package/dist/components/index.umd.js +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/directives/index.es.js +8 -7
- package/dist/directives/v-tooltip.es.js +8 -7
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +100 -31
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +18 -18
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/InputText/InputText.settings.d.ts +31 -9
- package/dist/stories/InputText/InputText.stories.d.ts +0 -1
- package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
- package/package.json +60 -59
- 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/VvCombobox/VvCombobox.vue +40 -19
- package/src/components/VvCombobox/index.ts +13 -0
- package/src/components/VvDialog/VvDialog.vue +6 -2
- package/src/components/VvDropdown/VvDropdown.vue +18 -16
- package/src/components/VvInputText/VvInputText.vue +170 -55
- package/src/components/VvInputText/index.ts +32 -34
- package/src/components/VvTextarea/VvTextarea.vue +8 -5
- package/src/constants.ts +5 -0
- package/src/props/index.ts +7 -11
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/InputText/InputText.settings.ts +36 -15
- package/src/stories/InputText/InputText.stories.ts +4 -12
- package/src/stories/InputText/InputText.test.ts +31 -15
- package/src/stories/InputText/InputTextMask.stories.ts +122 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import type { Option } from '../../types/generic';
|
|
2
3
|
export declare const VvComboboxEvents: string[];
|
|
3
4
|
export declare const VvComboboxProps: {
|
|
4
5
|
/**
|
|
@@ -72,6 +73,13 @@ export declare const VvComboboxProps: {
|
|
|
72
73
|
* Use input text to search on options
|
|
73
74
|
*/
|
|
74
75
|
searchable: BooleanConstructor;
|
|
76
|
+
/**
|
|
77
|
+
* Search function to filter options
|
|
78
|
+
*/
|
|
79
|
+
searchFunction: {
|
|
80
|
+
type: PropType<(search: string, options: (Option | string)[]) => (Option | string)[] | Promise<(Option | string)[]>>;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
75
83
|
/**
|
|
76
84
|
* On searchable select is the input search placeholder
|
|
77
85
|
*/
|
|
@@ -151,42 +159,103 @@ export declare const VvComboboxProps: {
|
|
|
151
159
|
validator: (value: never) => boolean;
|
|
152
160
|
};
|
|
153
161
|
strategy: {
|
|
154
|
-
type: PropType<"
|
|
155
|
-
default:
|
|
156
|
-
validator: (value: "
|
|
162
|
+
type: PropType<"absolute" | "fixed">;
|
|
163
|
+
default: undefined;
|
|
164
|
+
validator: (value: import("../../constants").Strategy) => boolean;
|
|
157
165
|
};
|
|
158
166
|
offset: {
|
|
159
167
|
type: PropType<string | import("@floating-ui/core").OffsetOptions | undefined>;
|
|
160
168
|
default: number;
|
|
161
169
|
};
|
|
162
170
|
shift: {
|
|
163
|
-
type: PropType<boolean |
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
171
|
+
type: PropType<boolean | {
|
|
172
|
+
mainAxis?: boolean | undefined;
|
|
173
|
+
crossAxis?: boolean | undefined;
|
|
174
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
175
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
176
|
+
altBoundary?: boolean | undefined;
|
|
177
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
178
|
+
limiter?: {
|
|
179
|
+
fn: (state: import("@floating-ui/core").MiddlewareState) => import("@floating-ui/core").Coords;
|
|
180
|
+
options?: any;
|
|
181
|
+
} | undefined;
|
|
182
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
183
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
184
|
+
mainAxis?: boolean | undefined;
|
|
185
|
+
crossAxis?: boolean | undefined;
|
|
186
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
187
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
188
|
+
altBoundary?: boolean | undefined;
|
|
189
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
190
|
+
limiter?: {
|
|
191
|
+
fn: (state: import("@floating-ui/core").MiddlewareState) => import("@floating-ui/core").Coords;
|
|
192
|
+
options?: any;
|
|
193
|
+
} | undefined;
|
|
194
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
169
195
|
}> | undefined>;
|
|
170
196
|
default: boolean;
|
|
171
197
|
};
|
|
172
198
|
flip: {
|
|
173
|
-
type: PropType<boolean |
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
199
|
+
type: PropType<boolean | {
|
|
200
|
+
mainAxis?: boolean | undefined;
|
|
201
|
+
crossAxis?: boolean | undefined;
|
|
202
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
203
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
204
|
+
altBoundary?: boolean | undefined;
|
|
205
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
206
|
+
fallbackPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
207
|
+
fallbackStrategy?: "initialPlacement" | "bestFit" | undefined;
|
|
208
|
+
fallbackAxisSideDirection?: "start" | "end" | "none" | undefined;
|
|
209
|
+
flipAlignment?: boolean | undefined;
|
|
210
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
211
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
212
|
+
mainAxis?: boolean | undefined;
|
|
213
|
+
crossAxis?: boolean | undefined;
|
|
214
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
215
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
216
|
+
altBoundary?: boolean | undefined;
|
|
217
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
218
|
+
fallbackPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
219
|
+
fallbackStrategy?: "initialPlacement" | "bestFit" | undefined;
|
|
220
|
+
fallbackAxisSideDirection?: "start" | "end" | "none" | undefined;
|
|
221
|
+
flipAlignment?: boolean | undefined;
|
|
222
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
179
223
|
}> | undefined>;
|
|
180
224
|
default: boolean;
|
|
181
225
|
};
|
|
182
226
|
size: {
|
|
183
|
-
type: PropType<boolean |
|
|
184
|
-
|
|
227
|
+
type: PropType<boolean | {
|
|
228
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
229
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
230
|
+
altBoundary?: boolean | undefined;
|
|
231
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
232
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
233
|
+
apply?: ((args: {
|
|
185
234
|
x: number;
|
|
186
235
|
y: number;
|
|
236
|
+
initialPlacement: import("@floating-ui/core").Placement;
|
|
187
237
|
placement: import("@floating-ui/core").Placement;
|
|
188
238
|
strategy: import("@floating-ui/core").Strategy;
|
|
239
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
240
|
+
rects: import("@floating-ui/core").ElementRects;
|
|
241
|
+
platform: import("@floating-ui/core").Platform;
|
|
242
|
+
elements: import("@floating-ui/dom").Elements;
|
|
243
|
+
} & {
|
|
244
|
+
availableWidth: number;
|
|
245
|
+
availableHeight: number;
|
|
246
|
+
}) => void | Promise<void>) | undefined;
|
|
247
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
248
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
249
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
250
|
+
altBoundary?: boolean | undefined;
|
|
251
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
252
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
253
|
+
apply?: ((args: {
|
|
254
|
+
x: number;
|
|
255
|
+
y: number;
|
|
189
256
|
initialPlacement: import("@floating-ui/core").Placement;
|
|
257
|
+
placement: import("@floating-ui/core").Placement;
|
|
258
|
+
strategy: import("@floating-ui/core").Strategy;
|
|
190
259
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
191
260
|
rects: import("@floating-ui/core").ElementRects;
|
|
192
261
|
platform: import("@floating-ui/core").Platform;
|
|
@@ -194,25 +263,33 @@ export declare const VvComboboxProps: {
|
|
|
194
263
|
} & {
|
|
195
264
|
availableWidth: number;
|
|
196
265
|
availableHeight: number;
|
|
197
|
-
}) => void | Promise<void
|
|
198
|
-
} & {
|
|
199
|
-
rootBoundary: import("@floating-ui/core").RootBoundary;
|
|
200
|
-
elementContext: import("@floating-ui/core").ElementContext;
|
|
201
|
-
altBoundary: boolean;
|
|
202
|
-
padding: import("@floating-ui/core").Padding;
|
|
203
|
-
boundary: import("@floating-ui/dom").Boundary;
|
|
266
|
+
}) => void | Promise<void>) | undefined;
|
|
204
267
|
}> | undefined>;
|
|
205
268
|
default: () => {
|
|
206
269
|
padding: number;
|
|
207
270
|
};
|
|
208
271
|
};
|
|
209
272
|
autoPlacement: {
|
|
210
|
-
type: PropType<boolean |
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
273
|
+
type: PropType<boolean | {
|
|
274
|
+
crossAxis?: boolean | undefined;
|
|
275
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
276
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
277
|
+
altBoundary?: boolean | undefined;
|
|
278
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
279
|
+
alignment?: import("@floating-ui/core").Alignment | null | undefined;
|
|
280
|
+
autoAlignment?: boolean | undefined;
|
|
281
|
+
allowedPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
282
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
283
|
+
} | import("@floating-ui/dom").Derivable<{
|
|
284
|
+
crossAxis?: boolean | undefined;
|
|
285
|
+
rootBoundary?: import("@floating-ui/core").RootBoundary | undefined;
|
|
286
|
+
elementContext?: import("@floating-ui/core").ElementContext | undefined;
|
|
287
|
+
altBoundary?: boolean | undefined;
|
|
288
|
+
padding?: import("@floating-ui/core").Padding | undefined;
|
|
289
|
+
alignment?: import("@floating-ui/core").Alignment | null | undefined;
|
|
290
|
+
autoAlignment?: boolean | undefined;
|
|
291
|
+
allowedPlacements?: import("@floating-ui/core").Placement[] | undefined;
|
|
292
|
+
boundary?: import("@floating-ui/dom").Boundary | undefined;
|
|
216
293
|
}> | undefined>;
|
|
217
294
|
default: boolean;
|
|
218
295
|
};
|
|
@@ -238,7 +315,7 @@ export declare const VvComboboxProps: {
|
|
|
238
315
|
validation: (value: import("../../constants").Position) => boolean;
|
|
239
316
|
};
|
|
240
317
|
options: {
|
|
241
|
-
type: PropType<(string |
|
|
318
|
+
type: PropType<(string | Option)[]>;
|
|
242
319
|
default: () => never[];
|
|
243
320
|
};
|
|
244
321
|
labelKey: {
|
|
@@ -95,6 +95,11 @@ const VvIconProps = {
|
|
|
95
95
|
type: [String, Array]
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
99
|
+
Strategy2["absolute"] = "absolute";
|
|
100
|
+
Strategy2["fixed"] = "fixed";
|
|
101
|
+
return Strategy2;
|
|
102
|
+
})(Strategy || {});
|
|
98
103
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
99
104
|
Side2["left"] = "left";
|
|
100
105
|
Side2["right"] = "right";
|
|
@@ -334,19 +339,15 @@ const IdProps = {
|
|
|
334
339
|
placement: {
|
|
335
340
|
type: String,
|
|
336
341
|
default: Side.bottom,
|
|
337
|
-
validator: (value) =>
|
|
338
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
339
|
-
}
|
|
342
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
340
343
|
},
|
|
341
344
|
/**
|
|
342
345
|
* Dropdown strategy
|
|
343
346
|
*/
|
|
344
347
|
strategy: {
|
|
345
348
|
type: String,
|
|
346
|
-
default:
|
|
347
|
-
validator: (value) =>
|
|
348
|
-
return ["fixed", "absolute"].includes(value);
|
|
349
|
-
}
|
|
349
|
+
default: void 0,
|
|
350
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
350
351
|
},
|
|
351
352
|
/**
|
|
352
353
|
* Dropdown show / hide transition name
|
|
@@ -532,14 +533,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
532
533
|
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
533
534
|
const dialogTransitionHandlers = {
|
|
534
535
|
"before-enter": () => {
|
|
535
|
-
var _a;
|
|
536
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
536
|
+
var _a, _b;
|
|
537
|
+
if (!((_a = dialogEl.value) == null ? void 0 : _a.open)) {
|
|
538
|
+
(_b = dialogEl.value) == null ? void 0 : _b.showModal();
|
|
539
|
+
}
|
|
537
540
|
emit("open");
|
|
538
541
|
emit("before-enter");
|
|
539
542
|
},
|
|
540
543
|
"after-leave": () => {
|
|
541
|
-
var _a;
|
|
542
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
544
|
+
var _a, _b;
|
|
545
|
+
if ((_a = dialogEl.value) == null ? void 0 : _a.open) {
|
|
546
|
+
(_b = dialogEl.value) == null ? void 0 : _b.close();
|
|
547
|
+
}
|
|
543
548
|
emit("close");
|
|
544
549
|
emit("after-leave");
|
|
545
550
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver");const c=e.defineComponent({name:"VvIcon",props:n,setup(t){const n=t,r=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),l=e.ref(!0),i=e.inject(a),{modifiers:c}=e.toRefs(n),s=function(o,t,n){return e.computed((()=>{const r={[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&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-icon",c),u=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=n.name??"",t=`@${u.value}:${n.prefix}:${e}`;if(o.iconExists(t))return t;const r=null==i?void 0:i.iconsCollections.find((t=>{const n=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(n)}));return r?`@${u.value}:${r.prefix}:${e}`:e}));function
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver");const c=e.defineComponent({name:"VvIcon",props:n,setup(t){const n=t,r=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),l=e.ref(!0),i=e.inject(a),{modifiers:c}=e.toRefs(n),s=function(o,t,n){return e.computed((()=>{const r={[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&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-icon",c),u=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=n.name??"",t=`@${u.value}:${n.prefix}:${e}`;if(o.iconExists(t))return t;const r=null==i?void 0:i.iconsCollections.find((t=>{const n=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(n)}));return r?`@${u.value}:${r.prefix}:${e}`:e}));function v(e){const t=function(e){let o;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==t?void 0:t.innerHTML.trim())||"";t&&r&&o.addIcon(`@${u.value}:${n.prefix}:${n.name}`,{body:r,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&n.src&&!o.iconExists(`@${u.value}:${n.prefix}:${n.name}`)&&(l.value=!1,i.fetchIcon(n.src).then((e=>{e&&(v(e),l.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),n.svg&&v(n.svg),(t,n)=>e.unref(l)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(r),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}});Boolean,Boolean,Boolean;l.before;const s={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const u={...s,title:String,modelValue:{type:Boolean,default:void 0},transition:{type:String,default:"fade-block"},size:String,keepOpen:{type:Boolean,default:!1}},d=["onCancel"],v={key:0,class:"vv-dialog__header"},f={class:"vv-dialog__content"},p={key:1,class:"vv-dialog__footer"};return e.defineComponent({name:"VvDialog",props:u,emits:["open","close","update:modelValue","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(o,{expose:n,emit:r}){const l=o,i=e.ref(),a=t.useVModel(l,"modelValue",r),s=e.ref(!1),u=e.computed({get:()=>a.value??s.value,set:e=>{void 0!==a.value?a.value=e:s.value=e}}),m=e.ref(null),g=e.computed((()=>{const{id:e}=l;return{id:e}})),h=e.computed((()=>l.size?["vv-dialog",`vv-dialog--${l.size}`]:"vv-dialog")),b=e.computed((()=>`vv-dialog--${l.transition}`)),y={"before-enter":()=>{var e,o;(null==(e=i.value)?void 0:e.open)||null==(o=i.value)||o.showModal(),r("open"),r("before-enter")},"after-leave":()=>{var e,o;(null==(e=i.value)?void 0:e.open)&&(null==(o=i.value)||o.close()),r("close"),r("after-leave")},enter:()=>{r("enter")},"after-enter":()=>{r("after-enter")},"enter-cancelled":()=>{r("enter-cancelled")},"before-leave":()=>{r("before-leave")},leave:()=>{r("leave")},"leave-cancelled":()=>{r("leave-cancelled")}};function $(){u.value=!1}t.onClickOutside(m,(()=>{l.keepOpen||$()})),n({close:$,open:function(){u.value=!0}});const B=()=>{l.keepOpen||$()};return(o,t)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(b)},e.toHandlers(y)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(g),{ref_key:"dialogEl",ref:i,class:e.unref(h),onCancel:e.withModifiers(B,["stop","prevent"])}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:m,class:"vv-dialog__wrapper"},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",v,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title)+" ",1),e.createElementVNode("button",{type:"button","aria-label":"Close",class:"vv-dialog__close",onClickPassive:$},[e.createVNode(c,{name:"close"})],32)]))])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[e.renderSlot(o.$slots,"default")]),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",p,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)],512)],16,d),[[e.vShow,e.unref(u)]])])),_:3},16,["name"]))}})}));
|
|
@@ -3,6 +3,11 @@ import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdat
|
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke } from "@vueuse/core";
|
|
5
5
|
import mitt from "mitt";
|
|
6
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
7
|
+
Strategy2["absolute"] = "absolute";
|
|
8
|
+
Strategy2["fixed"] = "fixed";
|
|
9
|
+
return Strategy2;
|
|
10
|
+
})(Strategy || {});
|
|
6
11
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
7
12
|
Side2["left"] = "left";
|
|
8
13
|
Side2["right"] = "right";
|
|
@@ -141,19 +146,15 @@ const DropdownProps = {
|
|
|
141
146
|
placement: {
|
|
142
147
|
type: String,
|
|
143
148
|
default: Side.bottom,
|
|
144
|
-
validator: (value) =>
|
|
145
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
146
|
-
}
|
|
149
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
147
150
|
},
|
|
148
151
|
/**
|
|
149
152
|
* Dropdown strategy
|
|
150
153
|
*/
|
|
151
154
|
strategy: {
|
|
152
155
|
type: String,
|
|
153
|
-
default:
|
|
154
|
-
validator: (value) =>
|
|
155
|
-
return ["fixed", "absolute"].includes(value);
|
|
156
|
-
}
|
|
156
|
+
default: void 0,
|
|
157
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
157
158
|
},
|
|
158
159
|
/**
|
|
159
160
|
* Dropdown show / hide transition name
|
|
@@ -410,7 +411,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
410
411
|
}
|
|
411
412
|
} else if (props.flip) {
|
|
412
413
|
if (typeof props.flip === "boolean") {
|
|
413
|
-
toReturn.push(flip());
|
|
414
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
414
415
|
} else {
|
|
415
416
|
toReturn.push(flip(props.flip));
|
|
416
417
|
}
|
|
@@ -462,13 +463,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
462
463
|
}
|
|
463
464
|
return toReturn;
|
|
464
465
|
});
|
|
465
|
-
const { x, y,
|
|
466
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
466
467
|
referenceEl,
|
|
467
468
|
floatingEl,
|
|
468
469
|
{
|
|
469
470
|
whileElementsMounted: (...args) => {
|
|
470
471
|
return autoUpdate(...args, {
|
|
471
|
-
animationFrame: props.strategy ===
|
|
472
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
472
473
|
});
|
|
473
474
|
},
|
|
474
475
|
placement: computed(() => props.placement),
|
|
@@ -477,16 +478,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
477
478
|
}
|
|
478
479
|
);
|
|
479
480
|
const dropdownPlacement = computed(() => {
|
|
481
|
+
var _a;
|
|
480
482
|
if (hasCustomPosition.value) {
|
|
481
483
|
return void 0;
|
|
482
484
|
}
|
|
485
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
483
486
|
return {
|
|
484
487
|
position: strategy.value,
|
|
485
488
|
top: `${y.value ?? 0}px`,
|
|
486
489
|
left: `${x.value ?? 0}px`,
|
|
487
|
-
maxWidth: maxWidth.value,
|
|
490
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
488
491
|
maxHeight: maxHeight.value,
|
|
489
|
-
width
|
|
492
|
+
width
|
|
490
493
|
};
|
|
491
494
|
});
|
|
492
495
|
const side = computed(
|
|
@@ -498,10 +501,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
498
501
|
return void 0;
|
|
499
502
|
}
|
|
500
503
|
const staticSide = {
|
|
501
|
-
top:
|
|
502
|
-
right:
|
|
503
|
-
bottom:
|
|
504
|
-
left:
|
|
504
|
+
[Side.top]: Side.bottom,
|
|
505
|
+
[Side.right]: Side.left,
|
|
506
|
+
[Side.bottom]: Side.top,
|
|
507
|
+
[Side.left]: Side.right
|
|
505
508
|
}[side.value];
|
|
506
509
|
return {
|
|
507
510
|
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var a=(e=>(e.absolute="absolute",e.fixed="fixed",e))(a||{}),n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),u=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(u||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),s=(e=>(e.listbox="listbox",e.menu="menu",e))(s||{}),f=(e=>(e.option="option",e.presentation="presentation",e))(f||{});const p=Symbol.for("dropdownTrigger"),c=Symbol.for("dropdownItem"),v=(Boolean,Boolean,Boolean,{modifiers:[String,Array]});i.before;const m={id:[String,Number]},b={placement:{type:String,default:n.bottom,validator:e=>Object.values(n).includes(e)||Object.values(u).includes(e)},strategy:{type:String,default:void 0,validator:e=>Object.values(a).includes(e)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}};d.button;const g={...m,...b,...v,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:s.menu,validator:e=>Object.values(s).includes(e)}};const h=["id","tabindex","role","aria-labelledby"];return e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:g,emits:["update:modelValue","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(u,{expose:i,emit:d}){const v=u,{id:m}=e.toRefs(v),b=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(m),g=e.useAttrs(),y=e.ref("auto"),x=e.ref("auto"),w=e.ref(null),S=e.ref(),E=e.ref(null),k=e.ref(null),P=e.computed({get:()=>v.reference??w.value,set:e=>{w.value=e}}),O=e.ref(!1);e.onMounted((()=>{r.useMutationObserver(S.value,(()=>{var e;O.value="true"===(null==(e=window.getComputedStyle(S.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const $=e.computed((()=>{const e=[];if(v.autoPlacement?"boolean"==typeof v.autoPlacement?e.push(t.autoPlacement()):e.push(t.autoPlacement(v.autoPlacement)):v.flip&&("boolean"==typeof v.flip?e.push(t.flip({fallbackStrategy:"initialPlacement"})):e.push(t.flip(v.flip))),v.shift&&("boolean"==typeof v.shift?e.push(t.shift()):e.push(t.shift(v.shift))),v.size){const o=({availableWidth:e,availableHeight:t})=>{y.value=`${e}px`,x.value=`${t}px`};"boolean"==typeof v.size?e.push(t.size({apply:o})):e.push(t.size({...v.size,apply:o}))}return v.offset&&(e.push(t.offset(Number(v.offset))),["string","number"].includes(typeof v.offset)?e.push(t.offset(Number(v.offset))):e.push(t.offset(v.offset))),v.arrow&&e.push(t.arrow({element:E})),e})),{x:B,y:z,middlewareData:V,placement:j,strategy:C}=t.useFloating(P,S,{whileElementsMounted:(...e)=>t.autoUpdate(...e,{animationFrame:v.strategy===a.fixed}),placement:e.computed((()=>v.placement)),strategy:e.computed((()=>v.strategy)),middleware:$}),A=e.computed((()=>{var e;if(O.value)return;const t=v.triggerWidth&&P.value?`${null==(e=P.value)?void 0:e.offsetWidth}px`:void 0;return{position:C.value,top:`${z.value??0}px`,left:`${B.value??0}px`,maxWidth:t?void 0:y.value,maxHeight:x.value,width:t}})),N=e.computed((()=>j.value.split("-")[0])),D=e.computed((()=>{var e,t,o,r,l;if(O.value)return;const a={[n.top]:n.bottom,[n.right]:n.left,[n.bottom]:n.top,[n.left]:n.right}[N.value];return{left:void 0!==(null==(e=V.value.arrow)?void 0:e.x)?`${null==(t=V.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(o=V.value.arrow)?void 0:o.y)?`${null==(r=V.value.arrow)?void 0:r.y}px`:void 0,[a]:-((null==(l=E.value)?void 0:l.offsetWidth)??0)/2+"px"}})),_=r.useVModel(v,"modelValue",d),F=e.ref(!1),R=e.computed({get:()=>_.value??F.value,set:e=>{void 0!==_.value?_.value=e:F.value=e}}),T=()=>{R.value=!0},W=()=>{R.value=!1},q=()=>{R.value=!R.value},K=e=>{P.value=e};i({toggle:q,show:T,hide:W,init:K,customPosition:O}),e.watch(R,(t=>{t&&v.autofocusFirst&&e.nextTick((()=>{const e=Y(S.value);e.length>0&&e[0].focus({preventScroll:!0})}))})),r.onClickOutside(S,(()=>{!v.keepOpen&&R.value&&(R.value=!1)}),{ignore:[P]});const M=e.computed((()=>{var e,t;return(null==(t=null==(e=P.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),H=e.computed((()=>({"aria-controls":b.value,"aria-haspopup":!0,"aria-expanded":R.value}))),{component:U,bus:I}=function({reference:t,id:o,expanded:r,aria:a}){const n=l(),u=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(p,{reference:t,id:o,expanded:r,aria:a,bus:n})},render(){var t,o;return e.h(e.Fragment,{},null==(o=(t=this.$slots).default)?void 0:o.call(t))}});return{bus:n,component:u}}({reference:P,id:b,expanded:R,aria:H});I.on("click",q);const{role:G,modifiers:J}=e.toRefs(v),{itemRole:L}=function({role:t,expanded:o}){const r=e.computed((()=>t.value===s.listbox?f.option:f.presentation));return e.provide(c,{role:r,expanded:o}),{itemRole:r}}({role:G,expanded:R}),Q=function(t,o,r){return e.computed((()=>{const l={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{l[`${t}--${o}`]=e.unref(r.value[o])})),l}))}("vv-dropdown",J,e.computed((()=>({arrow:v.arrow})))),{focused:X}=r.useFocusWithin(S);function Y(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}r.onKeyStroke("Escape",(e=>{R.value&&(e.preventDefault(),W())})),r.onKeyStroke("ArrowDown",(t=>{R.value&&X.value&&(t.preventDefault(),e.nextTick((()=>{if(X.value){const e=Y(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}})))})),r.onKeyStroke("ArrowUp",(t=>{R.value&&X.value&&(t.preventDefault(),e.nextTick((()=>{if(X.value){const e=Y(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}})))})),r.onKeyStroke([" ","Enter"],(e=>{const t=e.target;R.value&&X.value&&t&&(null==t||t.click())}));const Z={"before-enter":()=>{d(R.value?"beforeExpand":"beforeCollapse"),d("before-enter")},"after-leave":()=>{d(R.value?"afterExpand":"afterCollapse"),d("after-leave")},enter:()=>{d("enter")},"after-enter":()=>{d("after-enter")},"enter-cancelled":()=>{d("enter-cancelled")},"before-leave":()=>{d("before-leave")},leave:()=>{d("leave")},"leave-cancelled":()=>{d("leave-cancelled")}};return(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(U),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:K,show:T,hide:W,toggle:q,expanded:e.unref(R),aria:e.unref(H)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(Z)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:S,style:e.normalizeStyle(e.unref(A)),class:e.normalizeClass(e.unref(Q))},[v.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:E,style:e.normalizeStyle(e.unref(D)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(R)}))),e.createElementVNode("div",e.mergeProps(e.unref(g),{id:e.unref(b),ref_key:"listEl",ref:k,tabindex:e.unref(R)?void 0:-1,role:e.unref(G),"aria-labelledby":e.unref(M),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(L)})))],16,h),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(R)})))],6),[[e.vShow,e.unref(R)]])])),_:3},16,["name"])],64))}})}));
|