@volverjs/ui-vue 0.0.11 → 0.0.13-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.
Files changed (98) hide show
  1. package/bin/icons.js +1 -93
  2. package/dist/components/VvAccordion/VvAccordion.es.js +1 -366
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +7 -2
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +2 -702
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +5 -2
  6. package/dist/components/VvAction/VvAction.es.js +1 -302
  7. package/dist/components/VvAction/VvAction.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.vue.d.ts +3 -2
  9. package/dist/components/VvAlert/VvAlert.es.js +1 -527
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +3 -2
  11. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +1 -730
  12. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +3 -3
  13. package/dist/components/VvAvatar/VvAvatar.es.js +1 -132
  14. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +2 -2
  15. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +1 -250
  16. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +2 -2
  17. package/dist/components/VvBadge/VvBadge.es.js +1 -131
  18. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  19. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +1 -410
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -2
  22. package/dist/components/VvButton/VvButton.es.js +1 -882
  23. package/dist/components/VvButton/VvButton.umd.js +1 -1
  24. package/dist/components/VvButton/VvButton.vue.d.ts +3 -2
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -214
  26. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  27. package/dist/components/VvCard/VvCard.es.js +1 -152
  28. package/dist/components/VvCard/VvCard.vue.d.ts +2 -2
  29. package/dist/components/VvCheckbox/VvCheckbox.es.js +1 -741
  30. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +1 -981
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  33. package/dist/components/VvCombobox/VvCombobox.es.js +1 -3463
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +16 -7
  36. package/dist/components/VvDialog/VvDialog.es.js +1 -317
  37. package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -2
  38. package/dist/components/VvDropdown/VvDropdown.es.js +1 -750
  39. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +14 -2
  40. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -2
  41. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +2 -2
  42. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +11 -4
  43. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +1 -448
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +1 -149
  47. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +1 -104
  48. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  49. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -281
  50. package/dist/components/VvIcon/VvIcon.es.js +1 -143
  51. package/dist/components/VvIcon/VvIcon.vue.d.ts +2 -2
  52. package/dist/components/VvInputFile/VvInputFile.es.js +1 -1704
  53. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  54. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +34 -4
  55. package/dist/components/VvInputFile/index.d.ts +7 -0
  56. package/dist/components/VvInputText/VvInputText.es.js +4 -2790
  57. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  58. package/dist/components/VvInputText/VvInputText.vue.d.ts +8 -3
  59. package/dist/components/VvNav/VvNav.es.js +1 -438
  60. package/dist/components/VvNav/VvNav.umd.js +1 -1
  61. package/dist/components/VvNav/VvNav.vue.d.ts +2 -2
  62. package/dist/components/VvNav/VvNavItem.vue.d.ts +2 -2
  63. package/dist/components/VvNav/VvNavSeparator.vue.d.ts +1 -1
  64. package/dist/components/VvNavItem/VvNavItem.es.js +1 -337
  65. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  66. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +1 -24
  67. package/dist/components/VvProgress/VvProgress.es.js +1 -163
  68. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  69. package/dist/components/VvRadio/VvRadio.es.js +1 -661
  70. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  71. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +1 -901
  72. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  73. package/dist/components/VvSelect/VvSelect.es.js +1 -1103
  74. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -7
  75. package/dist/components/VvTab/VvTab.es.js +1 -558
  76. package/dist/components/VvTab/VvTab.umd.js +1 -1
  77. package/dist/components/VvTab/VvTab.vue.d.ts +2 -2
  78. package/dist/components/VvTextarea/VvTextarea.es.js +2 -1989
  79. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +3 -3
  80. package/dist/components/VvTooltip/VvTooltip.es.js +1 -154
  81. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +2 -2
  82. package/dist/components/index.es.js +6 -8558
  83. package/dist/components/index.umd.js +1 -1
  84. package/dist/composables/index.es.js +2 -247
  85. package/dist/composables/index.umd.js +1 -1
  86. package/dist/directives/index.es.js +2 -311
  87. package/dist/directives/index.umd.js +1 -1
  88. package/dist/directives/v-contextmenu.es.js +2 -142
  89. package/dist/directives/v-contextmenu.umd.js +1 -1
  90. package/dist/directives/v-tooltip.es.js +1 -172
  91. package/dist/icons.es.js +1 -39
  92. package/dist/icons.umd.js +1 -1
  93. package/dist/index.es.js +1 -219
  94. package/dist/props/index.d.ts +7 -0
  95. package/dist/resolvers/unplugin.es.js +1 -187
  96. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +2 -2
  97. package/dist/stories/Avatar/Avatar.settings.d.ts +1 -1
  98. package/package.json +47 -40
@@ -1,3463 +1 @@
1
- import { computed, isRef, defineComponent, h, inject, unref, mergeDefaults, ref, toRefs, createBlock, createCommentVNode, openBlock, mergeProps, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, toRef, getCurrentInstance, watch, resolveComponent, resolveDynamicComponent, withCtx, useId, useAttrs, useSlots, Fragment, provide, onMounted, createVNode, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, vShow, nextTick, renderList, vModelSelect, createSlots, mergeModels, useModel, withModifiers, withKeys, vModelText } from "vue";
2
- import { iconLoaded, Icon, addIcon } from "@iconify/vue";
3
- import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
- import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
5
- import mitt from "mitt";
6
- import { getProperty } from "dot-prop";
7
- const ACTION_ICONS = {
8
- clear: "close"
9
- };
10
- const VvIconPropsDefaults = {
11
- prefix: "normal"
12
- /* normal */
13
- };
14
- var StorageType = /* @__PURE__ */ ((StorageType2) => {
15
- StorageType2["local"] = "local";
16
- StorageType2["session"] = "session";
17
- return StorageType2;
18
- })(StorageType || {});
19
- var Strategy = /* @__PURE__ */ ((Strategy2) => {
20
- Strategy2["absolute"] = "absolute";
21
- Strategy2["fixed"] = "fixed";
22
- return Strategy2;
23
- })(Strategy || {});
24
- var Side = /* @__PURE__ */ ((Side2) => {
25
- Side2["left"] = "left";
26
- Side2["right"] = "right";
27
- Side2["top"] = "top";
28
- Side2["bottom"] = "bottom";
29
- return Side2;
30
- })(Side || {});
31
- var Placement = /* @__PURE__ */ ((Placement2) => {
32
- Placement2["topStart"] = "top-start";
33
- Placement2["topEnd"] = "top-end";
34
- Placement2["bottomStart"] = "bottom-start";
35
- Placement2["bottomEnd"] = "bottom-end";
36
- Placement2["leftStart"] = "left-start";
37
- Placement2["leftEnd"] = "left-end";
38
- Placement2["rightStart"] = "right-start";
39
- Placement2["rightEnd"] = "right-end";
40
- return Placement2;
41
- })(Placement || {});
42
- var Position = /* @__PURE__ */ ((Position2) => {
43
- Position2["before"] = "before";
44
- Position2["after"] = "after";
45
- return Position2;
46
- })(Position || {});
47
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
48
- ButtonType2["button"] = "button";
49
- ButtonType2["submit"] = "submit";
50
- ButtonType2["reset"] = "reset";
51
- return ButtonType2;
52
- })(ButtonType || {});
53
- var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
54
- ActionTag2["nuxtLink"] = "nuxt-link";
55
- ActionTag2["routerLink"] = "router-link";
56
- ActionTag2["a"] = "a";
57
- ActionTag2["button"] = "button";
58
- return ActionTag2;
59
- })(ActionTag || {});
60
- var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
61
- ActionRoles2["button"] = "button";
62
- ActionRoles2["link"] = "link";
63
- ActionRoles2["menuitem"] = "menuitem";
64
- return ActionRoles2;
65
- })(ActionRoles || {});
66
- var DropdownRole = /* @__PURE__ */ ((DropdownRole2) => {
67
- DropdownRole2["listbox"] = "listbox";
68
- DropdownRole2["menu"] = "menu";
69
- return DropdownRole2;
70
- })(DropdownRole || {});
71
- var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
72
- DropdownItemRole2["option"] = "option";
73
- DropdownItemRole2["presentation"] = "presentation";
74
- return DropdownItemRole2;
75
- })(DropdownItemRole || {});
76
- const INJECTION_KEY_VOLVER = Symbol.for("volver");
77
- const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
78
- "buttonGroup"
79
- );
80
- const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
81
- "dropdownTrigger"
82
- );
83
- const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
84
- "dropdownItem"
85
- );
86
- const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
87
- "dropdownAction"
88
- );
89
- const LinkProps = {
90
- /**
91
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
92
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
93
- */
94
- to: {
95
- type: [String, Object]
96
- },
97
- /**
98
- * Anchor href
99
- */
100
- href: String,
101
- /**
102
- * Anchor target
103
- */
104
- target: String,
105
- /**
106
- * Anchor rel
107
- */
108
- rel: {
109
- type: String,
110
- default: "noopener noreferrer"
111
- }
112
- };
113
- const ValidProps = {
114
- /**
115
- * Valid status
116
- */
117
- valid: { type: Boolean, default: false },
118
- /**
119
- * Valid label
120
- */
121
- validLabel: { type: [String, Array], default: void 0 }
122
- };
123
- const InvalidProps = {
124
- /**
125
- * Invalid status
126
- */
127
- invalid: {
128
- type: Boolean,
129
- default: false
130
- },
131
- /**
132
- * Invalid label
133
- */
134
- invalidLabel: { type: [String, Array], default: void 0 }
135
- };
136
- const LoadingProps = {
137
- /**
138
- * Loading status
139
- */
140
- loading: {
141
- type: Boolean,
142
- default: false
143
- },
144
- /**
145
- * Loading label
146
- */
147
- loadingLabel: {
148
- type: String,
149
- default: "Loading..."
150
- }
151
- };
152
- const DisabledProps = {
153
- /**
154
- * Whether the form control is disabled
155
- */
156
- disabled: {
157
- type: Boolean,
158
- default: false
159
- }
160
- };
161
- const RequiredProps = {
162
- /**
163
- * Whether the form control is required
164
- */
165
- required: {
166
- type: Boolean,
167
- default: false
168
- }
169
- };
170
- const SelectedProps = {
171
- /**
172
- * Whether the item is selected
173
- */
174
- selected: {
175
- type: Boolean,
176
- default: false
177
- }
178
- };
179
- const ActiveProps = {
180
- /**
181
- * Whether the item is active
182
- */
183
- active: {
184
- type: Boolean,
185
- default: false
186
- }
187
- };
188
- const CurrentProps = {
189
- /**
190
- * Whether the item is current
191
- */
192
- current: {
193
- type: Boolean,
194
- default: false
195
- }
196
- };
197
- const ClearProps = {
198
- /**
199
- * If true, the clear button will be shown
200
- */
201
- showClearAction: {
202
- type: Boolean,
203
- default: false
204
- },
205
- /**
206
- * VvIcon name for clear button
207
- * @see VvIcon
208
- */
209
- iconClear: {
210
- type: [String, Object],
211
- default: ACTION_ICONS.clear
212
- },
213
- /**
214
- * Label for clear button
215
- */
216
- labelClear: {
217
- type: String,
218
- default: "Clear"
219
- }
220
- };
221
- const PressedProps = {
222
- /**
223
- * Whether the item is pressed
224
- */
225
- pressed: {
226
- type: Boolean,
227
- default: false
228
- }
229
- };
230
- const LabelProps = {
231
- /**
232
- * The item label
233
- */
234
- label: {
235
- type: [String, Number],
236
- default: void 0
237
- }
238
- };
239
- const ReadonlyProps = {
240
- /**
241
- * The value is not editable
242
- */
243
- readonly: {
244
- type: Boolean,
245
- default: false
246
- }
247
- };
248
- const ModifiersProps = {
249
- /**
250
- * Component BEM modifiers
251
- */
252
- modifiers: {
253
- type: [String, Array],
254
- default: void 0
255
- }
256
- };
257
- const HintProps = {
258
- hintLabel: { type: String, default: "" }
259
- };
260
- const OptionsProps = {
261
- /**
262
- * List of options, can be string[] or object[]
263
- */
264
- options: {
265
- type: Array,
266
- default: () => []
267
- },
268
- /**
269
- * Used when options are objects: key to use for option label
270
- */
271
- labelKey: { type: [String, Function], default: "label" },
272
- /**
273
- * Used when options are objects: key to use for option label
274
- */
275
- valueKey: { type: [String, Function], default: "value" },
276
- /**
277
- * Used when options are objects: key to use for option disabled
278
- */
279
- disabledKey: { type: [String, Function], default: "disabled" }
280
- };
281
- const IconProps = {
282
- /**
283
- * VvIcon name or props
284
- * @see VvIcon
285
- */
286
- icon: {
287
- type: [String, Object],
288
- default: void 0
289
- },
290
- /**
291
- * VvIcon position
292
- */
293
- iconPosition: {
294
- type: String,
295
- default: Position.before,
296
- validation: (value) => Object.values(Position).includes(value)
297
- }
298
- };
299
- const TabindexProps = {
300
- /**
301
- * Global attribute tabindex
302
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
303
- */
304
- tabindex: { type: [String, Number], default: 0 }
305
- };
306
- const FloatingLabelProps = {
307
- /**
308
- * If true the label will be floating
309
- */
310
- floating: {
311
- type: Boolean,
312
- default: false
313
- }
314
- };
315
- const UnselectableProps = {
316
- /**
317
- * If true the input will be unselectable
318
- */
319
- unselectable: { type: Boolean, default: true }
320
- };
321
- const IdProps = {
322
- /**
323
- * Global attribute id
324
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
325
- */
326
- id: [String, Number]
327
- };
328
- const DropdownProps = {
329
- /**
330
- * Dropdown placement
331
- */
332
- placement: {
333
- type: String,
334
- default: Side.bottom,
335
- validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
336
- },
337
- /**
338
- * Dropdown strategy
339
- */
340
- strategy: {
341
- type: String,
342
- default: void 0,
343
- validator: (value) => Object.values(Strategy).includes(value)
344
- },
345
- /**
346
- * Dropdown show / hide transition name
347
- */
348
- transitionName: {
349
- type: String,
350
- default: void 0
351
- },
352
- /**
353
- * Offset of the dropdown from the trigger
354
- * @see https://floating-ui.com/docs/offset
355
- */
356
- offset: {
357
- type: [Number, String, Object],
358
- default: 0
359
- },
360
- /**
361
- * Move dropdown to the side if there is no space in the default position
362
- * @see https://floating-ui.com/docs/shift
363
- */
364
- shift: {
365
- type: [Boolean, Object],
366
- default: false
367
- },
368
- /**
369
- * Flip dropdown position if there is no space in the default position
370
- * @see https://floating-ui.com/docs/flip
371
- */
372
- flip: {
373
- type: [Boolean, Object],
374
- default: true
375
- },
376
- /**
377
- * Size of the dropdown
378
- * @see https://floating-ui.com/docs/size
379
- */
380
- size: {
381
- type: [Boolean, Object],
382
- default: () => ({ padding: 10 })
383
- },
384
- /**
385
- * Automatically change the position of the dropdown
386
- * @see https://floating-ui.com/docs/autoPlacement
387
- */
388
- autoPlacement: {
389
- type: [Boolean, Object],
390
- default: false
391
- },
392
- /**
393
- * Add arrow to the dropdown
394
- * @see https://floating-ui.com/docs/arrow
395
- */
396
- arrow: {
397
- type: Boolean,
398
- default: false
399
- },
400
- /**
401
- * Keep open dropdown on click outside
402
- */
403
- keepOpen: {
404
- type: Boolean,
405
- default: false
406
- },
407
- /**
408
- * Autofocus first item on dropdown open
409
- */
410
- autofocusFirst: {
411
- type: Boolean,
412
- default: true
413
- },
414
- /**
415
- * Set dropdown width to the same as the trigger
416
- */
417
- triggerWidth: {
418
- type: Boolean,
419
- default: false
420
- }
421
- };
422
- const IdNameProps = {
423
- ...IdProps,
424
- /**
425
- * Input / Textarea name
426
- * Name of the form control. Submitted with the form as part of a name/value pair
427
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
428
- */
429
- name: { type: String, required: true }
430
- };
431
- const AutofocusProps = {
432
- /**
433
- * Global attribute autofocus
434
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
435
- */
436
- autofocus: {
437
- type: Boolean,
438
- default: false
439
- }
440
- };
441
- const AutocompleteProps = {
442
- /**
443
- * Global attribute autocomplete
444
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
445
- */
446
- autocomplete: { type: String, default: "off" }
447
- };
448
- const ActionProps = {
449
- ...DisabledProps,
450
- ...LabelProps,
451
- ...PressedProps,
452
- ...ActiveProps,
453
- ...CurrentProps,
454
- ...LinkProps,
455
- /**
456
- * Button type
457
- */
458
- type: {
459
- type: String,
460
- default: ButtonType.button,
461
- validator: (value) => Object.values(ButtonType).includes(value)
462
- },
463
- /**
464
- * Button aria-label
465
- */
466
- ariaLabel: {
467
- type: String,
468
- default: void 0
469
- },
470
- /**
471
- * Default tag for the action
472
- */
473
- defaultTag: {
474
- type: String,
475
- default: ActionTag.button
476
- }
477
- };
478
- ({
479
- storageType: {
480
- default: StorageType.local
481
- }
482
- });
483
- const VvComboboxProps = {
484
- ...IdNameProps,
485
- ...TabindexProps,
486
- ...ValidProps,
487
- ...InvalidProps,
488
- ...HintProps,
489
- ...LoadingProps,
490
- ...DisabledProps,
491
- ...ReadonlyProps,
492
- ...ModifiersProps,
493
- ...OptionsProps,
494
- ...IconProps,
495
- ...FloatingLabelProps,
496
- ...DropdownProps,
497
- ...LabelProps,
498
- ...RequiredProps,
499
- ...ClearProps,
500
- /**
501
- * Dropdown show / hide transition name
502
- */
503
- transitionName: {
504
- type: String,
505
- default: "vv-dropdown--mobile-fade-block"
506
- },
507
- /**
508
- * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
509
- */
510
- modelValue: {
511
- type: [String, Number, Boolean, Object, Array],
512
- default: void 0
513
- },
514
- /**
515
- * Label for no search results
516
- */
517
- noResultsLabel: { type: String, default: "No results" },
518
- /**
519
- * Label for no options available
520
- */
521
- noOptionsLabel: { type: String, default: "No options available" },
522
- /**
523
- * Label for selected option not found
524
- */
525
- selectedOptionNotFoundLabel: {
526
- type: String,
527
- default: "Selected option not found"
528
- },
529
- /**
530
- * Label for selected option hint
531
- */
532
- selectedHintLabel: { type: String, default: "Selected" },
533
- /**
534
- * Label for deselect action button
535
- */
536
- deselectActionLabel: { type: String, default: "Deselect" },
537
- /**
538
- * Label for select option hint
539
- */
540
- selectHintLabel: { type: String, default: "Press enter to select" },
541
- /**
542
- * Label for deselected option hint
543
- */
544
- deselectHintLabel: { type: String, default: "Press enter to remove" },
545
- /**
546
- * Label for add new option hint
547
- */
548
- addOptionHintLabel: { type: String, default: "Press enter to add" },
549
- /**
550
- * Label close button
551
- */
552
- closeLabel: { type: String, default: "Close" },
553
- /**
554
- * Select input placeholder
555
- */
556
- placeholder: String,
557
- /**
558
- * The options to add new options
559
- */
560
- addable: Boolean,
561
- /**
562
- * Use input text to search on options
563
- */
564
- searchable: Boolean,
565
- /**
566
- * If true, the search input will retain its value even when the dropdown is closed
567
- */
568
- keepSearch: Boolean,
569
- /**
570
- * Search function to filter options
571
- */
572
- searchFunction: {
573
- type: Function,
574
- default: void 0
575
- },
576
- /**
577
- * On searchable select is the input search placeholder
578
- */
579
- searchPlaceholder: {
580
- type: String,
581
- default: "Search..."
582
- },
583
- /**
584
- * The input search debounce time in ms
585
- */
586
- debounceSearch: {
587
- type: [Number, String],
588
- default: 0
589
- },
590
- /**
591
- * Manage modelValue as string[] or object[]
592
- */
593
- multiple: Boolean,
594
- /**
595
- * The min number of selected values
596
- */
597
- minValues: {
598
- type: [Number, String],
599
- default: 0
600
- },
601
- /**
602
- * The max number of selected values
603
- */
604
- maxValues: [Number, String],
605
- /**
606
- * If true the input will be unselectable
607
- * @deprecated use minValues instead
608
- */
609
- unselectable: { type: Boolean, default: true },
610
- /**
611
- * The select label separator visible to the user
612
- */
613
- separator: { type: String, default: ", " },
614
- /**
615
- * Show native select
616
- */
617
- native: Boolean,
618
- /**
619
- * Show badges
620
- */
621
- badges: Boolean,
622
- /**
623
- * Badge modifiers
624
- */
625
- badgeModifiers: {
626
- type: [String, Array],
627
- default: "action sm"
628
- },
629
- /**
630
- * Set dropdown width to the same as the trigger
631
- */
632
- triggerWidth: {
633
- ...DropdownProps.triggerWidth,
634
- default: true
635
- },
636
- /**
637
- * Dropdown modifiers
638
- */
639
- dropdownModifiers: {
640
- type: [String, Array],
641
- default: "mobile"
642
- },
643
- /**
644
- * Open dropdown on focus
645
- */
646
- autoOpen: {
647
- type: Boolean,
648
- default: false
649
- },
650
- /**
651
- * Select first option automatically
652
- */
653
- autoselectFirst: {
654
- type: Boolean,
655
- default: false
656
- },
657
- /**
658
- * Keep open dropdown on single select
659
- */
660
- keepOpen: {
661
- type: Boolean,
662
- default: false
663
- },
664
- /**
665
- * Focus on hover option (this prop remove the focus from the input search)
666
- */
667
- focusOnHover: {
668
- type: Boolean,
669
- default: true
670
- }
671
- };
672
- function useVvComboboxProps() {
673
- return {
674
- ...VvComboboxProps,
675
- options: {
676
- ...VvComboboxProps.options,
677
- type: Array
678
- },
679
- searchFunction: {
680
- ...VvComboboxProps.searchFunction,
681
- type: Function
682
- }
683
- };
684
- }
685
- function equals(obj1, obj2, field) {
686
- return deepEquals(obj1, obj2);
687
- }
688
- function deepEquals(a, b) {
689
- if (a === b)
690
- return true;
691
- if (a && b && typeof a == "object" && typeof b == "object") {
692
- const arrA = Array.isArray(a);
693
- const arrB = Array.isArray(b);
694
- let i, length, key;
695
- if (arrA && arrB) {
696
- length = a.length;
697
- if (length !== b.length)
698
- return false;
699
- for (i = length; i-- !== 0; ) {
700
- if (!deepEquals(a[i], b[i]))
701
- return false;
702
- }
703
- return true;
704
- }
705
- if (arrA !== arrB)
706
- return false;
707
- const dateA = a instanceof Date;
708
- const dateB = b instanceof Date;
709
- if (dateA !== dateB)
710
- return false;
711
- if (dateA && dateB)
712
- return a.getTime() === b.getTime();
713
- const regexpA = a instanceof RegExp;
714
- const regexpB = b instanceof RegExp;
715
- if (regexpA !== regexpB)
716
- return false;
717
- if (regexpA && regexpB)
718
- return a.toString() === b.toString();
719
- const keys = Object.keys(a);
720
- length = keys.length;
721
- if (length !== Object.keys(b).length)
722
- return false;
723
- for (i = length; i-- !== 0; ) {
724
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
725
- return false;
726
- }
727
- for (i = length; i-- !== 0; ) {
728
- key = keys[i];
729
- if (!deepEquals(a[key], b[key]))
730
- return false;
731
- }
732
- return true;
733
- }
734
- return Number.isNaN(a) && Number.isNaN(b);
735
- }
736
- function contains(value, list) {
737
- if (value != null && list && list.length) {
738
- for (const val of list) {
739
- if (equals(value, val)) {
740
- return true;
741
- }
742
- }
743
- }
744
- return false;
745
- }
746
- function isString(value) {
747
- return typeof value === "string";
748
- }
749
- function joinLines(items) {
750
- if (Array.isArray(items)) {
751
- return items.filter((item) => isString(item)).join(" ");
752
- }
753
- return items;
754
- }
755
- function HintSlotFactory(propsOrRef, slots) {
756
- const props = computed(() => {
757
- if (isRef(propsOrRef)) {
758
- return propsOrRef.value;
759
- }
760
- return propsOrRef;
761
- });
762
- const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
763
- const validLabel = computed(() => joinLines(props.value.validLabel));
764
- const loadingLabel = computed(() => props.value.loadingLabel);
765
- const hintLabel = computed(() => props.value.hintLabel);
766
- const hasLoadingLabelOrSlot = computed(
767
- () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
768
- );
769
- const hasInvalidLabelOrSlot = computed(
770
- () => !hasLoadingLabelOrSlot.value && Boolean(
771
- props.value.invalid && (slots.invalid || invalidLabel.value)
772
- )
773
- );
774
- const hasValidLabelOrSlot = computed(
775
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
776
- );
777
- const hasHintLabelOrSlot = computed(
778
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
779
- );
780
- const isVisible = computed(
781
- () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
782
- );
783
- const hintSlotScope = computed(() => ({
784
- modelValue: props.value.modelValue,
785
- valid: props.value.valid,
786
- invalid: props.value.invalid,
787
- loading: props.value.loading
788
- }));
789
- const HintSlot = defineComponent({
790
- name: "HintSlot",
791
- props: {
792
- tag: {
793
- type: String,
794
- default: "small"
795
- }
796
- },
797
- setup() {
798
- return {
799
- isVisible,
800
- invalidLabel,
801
- validLabel,
802
- loadingLabel,
803
- hintLabel,
804
- hasInvalidLabelOrSlot,
805
- hasValidLabelOrSlot,
806
- hasLoadingLabelOrSlot,
807
- hasHintLabelOrSlot
808
- };
809
- },
810
- render() {
811
- if (this.isVisible) {
812
- let role;
813
- if (this.hasInvalidLabelOrSlot) {
814
- role = "alert";
815
- }
816
- if (this.hasValidLabelOrSlot) {
817
- role = "status";
818
- }
819
- if (this.hasLoadingLabelOrSlot) {
820
- return h(
821
- this.tag,
822
- {
823
- role
824
- },
825
- this.$slots.loading?.() ?? this.loadingLabel
826
- );
827
- }
828
- if (this.hasInvalidLabelOrSlot) {
829
- return h(
830
- this.tag,
831
- {
832
- role
833
- },
834
- this.$slots.invalid?.() ?? this.$slots.invalid ?? this.invalidLabel
835
- );
836
- }
837
- if (this.hasValidLabelOrSlot) {
838
- return h(
839
- this.tag,
840
- {
841
- role
842
- },
843
- this.$slots.valid?.() ?? this.validLabel
844
- );
845
- }
846
- return h(
847
- this.tag,
848
- {
849
- role
850
- },
851
- this.$slots.hint?.() ?? this.$slots.hint ?? this.hintLabel
852
- );
853
- }
854
- return null;
855
- }
856
- });
857
- return {
858
- hasInvalidLabelOrSlot,
859
- hasHintLabelOrSlot,
860
- hasValidLabelOrSlot,
861
- hasLoadingLabelOrSlot,
862
- hintSlotScope,
863
- HintSlot
864
- };
865
- }
866
- function useVolver() {
867
- return inject(INJECTION_KEY_VOLVER, void 0);
868
- }
869
- function useModifiers(prefix, modifiers, others) {
870
- return computed(() => {
871
- const toReturn = {
872
- [prefix]: true
873
- };
874
- const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
875
- if (modifiersArray) {
876
- if (Array.isArray(modifiersArray)) {
877
- modifiersArray.forEach((modifier) => {
878
- if (modifier) {
879
- toReturn[`${prefix}--${modifier}`] = true;
880
- }
881
- });
882
- }
883
- }
884
- if (others) {
885
- Object.keys(others.value).forEach((key) => {
886
- toReturn[`${prefix}--${key}`] = unref(others.value[key]);
887
- });
888
- }
889
- return toReturn;
890
- });
891
- }
892
- const __default__$9 = {
893
- name: "VvIcon"
894
- };
895
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
896
- ...__default__$9,
897
- props: /* @__PURE__ */ mergeDefaults({
898
- name: {},
899
- color: {},
900
- width: {},
901
- height: {},
902
- provider: {},
903
- prefix: {},
904
- src: {},
905
- horizontalFlip: { type: Boolean },
906
- verticalFlip: { type: Boolean },
907
- flip: {},
908
- mode: {},
909
- inline: { type: Boolean },
910
- rotate: {},
911
- onLoad: { type: Function },
912
- svg: {},
913
- modifiers: {}
914
- }, VvIconPropsDefaults),
915
- setup(__props) {
916
- const props = __props;
917
- const hasRotate = computed(() => {
918
- if (typeof props.rotate === "string") {
919
- return Number.parseFloat(props.rotate);
920
- }
921
- return props.rotate;
922
- });
923
- const show = ref(true);
924
- const volver = useVolver();
925
- const { modifiers } = toRefs(props);
926
- const bemCssClasses = useModifiers("vv-icon", modifiers);
927
- const provider = computed(() => {
928
- return props.provider || volver?.iconsProvider;
929
- });
930
- const icon = computed(() => {
931
- const name = props.name ?? "";
932
- const iconName = `@${provider.value}:${props.prefix}:${name}`;
933
- if (iconLoaded(iconName)) {
934
- return iconName;
935
- }
936
- const iconsCollection = volver?.iconsCollections.find(
937
- (iconsCollection2) => {
938
- const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
939
- return iconLoaded(icon2);
940
- }
941
- );
942
- if (iconsCollection) {
943
- return `@${provider.value}:${iconsCollection.prefix}:${name}`;
944
- }
945
- return name;
946
- });
947
- function getSvgContent(svg) {
948
- let dom;
949
- if (typeof window === "undefined") {
950
- const { JSDOM } = require("jsdom");
951
- dom = new JSDOM().window;
952
- }
953
- const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
954
- const svgDomString = domParser.parseFromString(svg, "text/html");
955
- const svgEl = svgDomString.querySelector("svg");
956
- return svgEl;
957
- }
958
- function addIconFromSvg(svg) {
959
- const svgContentEl = getSvgContent(svg);
960
- const svgContent = svgContentEl?.innerHTML.trim() || "";
961
- if (svgContentEl && svgContent) {
962
- addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
963
- body: svgContent,
964
- // Set height and width from svg content
965
- height: svgContentEl.viewBox.baseVal.height,
966
- width: svgContentEl.viewBox.baseVal.width
967
- });
968
- }
969
- }
970
- if (volver) {
971
- if (props.src && !iconLoaded(`@${provider.value}:${props.prefix}:${props.name}`)) {
972
- show.value = false;
973
- volver.fetchIcon(props.src).then((svg) => {
974
- if (svg) {
975
- addIconFromSvg(svg);
976
- show.value = true;
977
- }
978
- }).catch((e) => {
979
- throw new Error(`Error during fetch icon: ${e?.message}`);
980
- });
981
- }
982
- }
983
- if (props.svg) {
984
- addIconFromSvg(props.svg);
985
- }
986
- return (_ctx, _cache) => {
987
- return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
988
- key: 0,
989
- class: unref(bemCssClasses)
990
- }, {
991
- inline: __props.inline,
992
- width: __props.width,
993
- height: __props.height,
994
- horizontalFlip: __props.horizontalFlip,
995
- verticalFlip: __props.verticalFlip,
996
- flip: __props.flip,
997
- rotate: unref(hasRotate),
998
- color: __props.color,
999
- icon: unref(icon)
1000
- }, { onLoad: __props.onLoad }), null, 16, ["class", "onLoad"])) : createCommentVNode("v-if", true);
1001
- };
1002
- }
1003
- });
1004
- function useComponentIcon(icon, iconPosition) {
1005
- const hasIcon = computed(() => {
1006
- if (typeof icon?.value === "string") {
1007
- return { name: icon?.value };
1008
- }
1009
- return icon?.value;
1010
- });
1011
- const hasIconBefore = computed(
1012
- () => iconPosition?.value === Position.before ? hasIcon.value : void 0
1013
- );
1014
- const hasIconAfter = computed(
1015
- () => iconPosition?.value === Position.after ? hasIcon.value : void 0
1016
- );
1017
- const hasIconLeft = computed(
1018
- () => iconPosition?.value === Side.left ? hasIcon.value : void 0
1019
- );
1020
- const hasIconRight = computed(
1021
- () => iconPosition?.value === Side.right ? hasIcon.value : void 0
1022
- );
1023
- const hasIconTop = computed(
1024
- () => iconPosition?.value === Side.top ? hasIcon.value : void 0
1025
- );
1026
- const hasIconBottom = computed(
1027
- () => iconPosition?.value === Side.bottom ? hasIcon.value : void 0
1028
- );
1029
- return {
1030
- hasIcon,
1031
- hasIconLeft,
1032
- hasIconRight,
1033
- hasIconTop,
1034
- hasIconBottom,
1035
- hasIconBefore,
1036
- hasIconAfter
1037
- };
1038
- }
1039
- const VvInputClearAction = defineComponent({
1040
- components: {
1041
- VvIcon: _sfc_main$9
1042
- },
1043
- props: {
1044
- inputType: {
1045
- type: String,
1046
- default: "input-text"
1047
- },
1048
- disabled: {
1049
- type: Boolean,
1050
- default: false
1051
- },
1052
- label: {
1053
- type: String,
1054
- default: "Clear"
1055
- },
1056
- icon: {
1057
- type: [String, Object],
1058
- default: "close"
1059
- }
1060
- },
1061
- emits: ["clear"],
1062
- setup(props, { emit }) {
1063
- const { hasIcon } = useComponentIcon(computed(() => props.icon));
1064
- function onClick(e) {
1065
- e?.stopPropagation();
1066
- if (!props.disabled) {
1067
- emit("clear");
1068
- }
1069
- }
1070
- return {
1071
- hasIcon,
1072
- onClick
1073
- };
1074
- },
1075
- render() {
1076
- const icon = this.hasIcon ? h(_sfc_main$9, {
1077
- ...this.hasIcon,
1078
- class: `vv-${this.inputType}__icon`
1079
- }) : void 0;
1080
- return h(
1081
- "button",
1082
- {
1083
- disabled: this.disabled,
1084
- class: `vv-${this.inputType}__action`,
1085
- ariaLabel: this.label,
1086
- type: "button",
1087
- onClick: this.onClick
1088
- },
1089
- icon
1090
- );
1091
- }
1092
- });
1093
- const VvBadgeProps = {
1094
- ...ModifiersProps,
1095
- value: [String, Number]
1096
- };
1097
- const __default__$8 = {
1098
- name: "VvBadge"
1099
- };
1100
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1101
- ...__default__$8,
1102
- props: VvBadgeProps,
1103
- setup(__props) {
1104
- const props = __props;
1105
- const { modifiers } = toRefs(props);
1106
- const bemCssClasses = useModifiers("vv-badge", modifiers);
1107
- return (_ctx, _cache) => {
1108
- return openBlock(), createElementBlock(
1109
- "span",
1110
- {
1111
- class: normalizeClass(unref(bemCssClasses))
1112
- },
1113
- [
1114
- renderSlot(_ctx.$slots, "default", {}, () => [
1115
- createTextVNode(
1116
- toDisplayString(_ctx.value),
1117
- 1
1118
- /* TEXT */
1119
- )
1120
- ])
1121
- ],
1122
- 2
1123
- /* CLASS */
1124
- );
1125
- };
1126
- }
1127
- });
1128
- function useGroupStateInject(groupKey) {
1129
- const group = inject(groupKey, void 0);
1130
- const isInGroup = computed(() => group !== void 0);
1131
- function getGroupOrLocalRef(propName, props, emit) {
1132
- const groupPropValue = group?.[propName];
1133
- if (groupPropValue) {
1134
- return computed({
1135
- get() {
1136
- return groupPropValue.value;
1137
- },
1138
- set(value) {
1139
- groupPropValue.value = value;
1140
- }
1141
- });
1142
- }
1143
- const propRef = toRef(props, propName);
1144
- return computed({
1145
- get() {
1146
- return propRef.value;
1147
- },
1148
- set(value) {
1149
- if (emit) {
1150
- emit(`update:${propName}`, value);
1151
- }
1152
- }
1153
- });
1154
- }
1155
- return {
1156
- group,
1157
- isInGroup,
1158
- getGroupOrLocalRef
1159
- };
1160
- }
1161
- const VvButtonEvents = ["update:modelValue"];
1162
- const VvButtonProps = {
1163
- ...ActionProps,
1164
- ...IdProps,
1165
- ...ModifiersProps,
1166
- ...UnselectableProps,
1167
- ...LoadingProps,
1168
- ...IconProps,
1169
- /**
1170
- * Button icon position
1171
- */
1172
- iconPosition: {
1173
- type: String,
1174
- default: Side.left,
1175
- validator: (value) => Object.values(Side).includes(value)
1176
- },
1177
- /**
1178
- * Loading icon
1179
- */
1180
- loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
1181
- /**
1182
- * Enable button toggle
1183
- */
1184
- toggle: {
1185
- type: Boolean,
1186
- default: false
1187
- },
1188
- /**
1189
- * Button toggle value
1190
- */
1191
- value: {
1192
- type: [String, Number, Boolean],
1193
- default: void 0
1194
- },
1195
- /**
1196
- * Value associated with the unchecked state
1197
- */
1198
- uncheckedValue: {
1199
- type: [String, Number, Boolean],
1200
- default: void 0
1201
- },
1202
- /**
1203
- * Button toggle model value
1204
- */
1205
- modelValue: {
1206
- type: [String, Number, Boolean],
1207
- default: void 0
1208
- }
1209
- };
1210
- function useGroupProps(props, emit) {
1211
- const { group, isInGroup, getGroupOrLocalRef } = useGroupStateInject(INJECTION_KEY_BUTTON_GROUP);
1212
- const { id, iconPosition, icon, label, pressed } = toRefs(props);
1213
- const modelValue = getGroupOrLocalRef("modelValue", props, emit);
1214
- const toggle = getGroupOrLocalRef("toggle", props);
1215
- const unselectable = getGroupOrLocalRef("unselectable", props);
1216
- const multiple = computed(() => group?.multiple.value ?? false);
1217
- const modifiers = computed(() => {
1218
- let localModifiers = props.modifiers;
1219
- let groupModifiers = group?.modifiers.value;
1220
- const toReturn = /* @__PURE__ */ new Set();
1221
- if (localModifiers) {
1222
- if (!Array.isArray(localModifiers)) {
1223
- localModifiers = localModifiers.split(" ");
1224
- }
1225
- localModifiers.forEach((modifier) => toReturn.add(modifier));
1226
- }
1227
- if (groupModifiers) {
1228
- if (!Array.isArray(groupModifiers)) {
1229
- groupModifiers = groupModifiers.split(" ");
1230
- }
1231
- groupModifiers.forEach((modifier) => toReturn.add(modifier));
1232
- }
1233
- return Array.from(toReturn);
1234
- });
1235
- const disabled = computed(
1236
- () => Boolean(props.disabled || group?.disabled.value)
1237
- );
1238
- return {
1239
- // group props
1240
- group,
1241
- isInGroup,
1242
- modelValue,
1243
- toggle,
1244
- unselectable,
1245
- multiple,
1246
- modifiers,
1247
- disabled,
1248
- // local props
1249
- id,
1250
- pressed,
1251
- iconPosition,
1252
- icon,
1253
- label
1254
- };
1255
- }
1256
- const VvActionEvents = ["click", "mouseover", "mouseleave"];
1257
- const VvActionProps = ActionProps;
1258
- function useInjectedDropdownTrigger() {
1259
- return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
1260
- }
1261
- function useInjectedDropdownItem() {
1262
- return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
1263
- }
1264
- function useInjectedDropdownAction() {
1265
- return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
1266
- }
1267
- const __default__$7 = {
1268
- name: "VvAction"
1269
- };
1270
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1271
- ...__default__$7,
1272
- props: VvActionProps,
1273
- emits: VvActionEvents,
1274
- setup(__props, { expose: __expose, emit: __emit }) {
1275
- const props = __props;
1276
- const emit = __emit;
1277
- const instance = getCurrentInstance();
1278
- const volver = useVolver();
1279
- const element = ref(null);
1280
- __expose({ $el: element });
1281
- const {
1282
- reference: dropdownTriggerReference,
1283
- bus: dropdownEventBus,
1284
- aria: dropdownAria,
1285
- expanded: dropdownExpanded
1286
- } = useInjectedDropdownTrigger();
1287
- watch(
1288
- () => element.value,
1289
- (newValue) => {
1290
- if (dropdownTriggerReference) {
1291
- dropdownTriggerReference.value = newValue;
1292
- }
1293
- }
1294
- );
1295
- const pressed = computed(() => {
1296
- return props.pressed || dropdownExpanded?.value;
1297
- });
1298
- const { role } = useInjectedDropdownAction();
1299
- const hasTag = computed(() => {
1300
- switch (true) {
1301
- case props.disabled:
1302
- return ActionTag.button;
1303
- case props.to !== void 0:
1304
- return volver?.nuxt ? resolveComponent(ActionTag.nuxtLink) : ActionTag.routerLink;
1305
- case props.href !== void 0:
1306
- return ActionTag.a;
1307
- default:
1308
- return props.defaultTag;
1309
- }
1310
- });
1311
- const hasProps = computed(() => {
1312
- const toReturn = {
1313
- ...dropdownAria?.value,
1314
- ariaPressed: pressed.value ? true : void 0,
1315
- ariaLabel: props.ariaLabel,
1316
- role: role?.value
1317
- };
1318
- switch (hasTag.value) {
1319
- case ActionTag.a:
1320
- return {
1321
- ...toReturn,
1322
- href: props.href,
1323
- target: props.target,
1324
- rel: props.rel
1325
- };
1326
- case ActionTag.routerLink:
1327
- case ActionTag.nuxtLink:
1328
- return {
1329
- ...toReturn,
1330
- to: props.to,
1331
- target: props.target
1332
- };
1333
- case ActionTag.button:
1334
- return {
1335
- ...toReturn,
1336
- type: props.type,
1337
- disabled: props.disabled
1338
- };
1339
- default:
1340
- return toReturn;
1341
- }
1342
- });
1343
- function onClick(e) {
1344
- if (props.disabled) {
1345
- e.preventDefault();
1346
- return;
1347
- }
1348
- if (instance?.vnode.props?.onClick) {
1349
- emit("click", e);
1350
- return;
1351
- }
1352
- dropdownEventBus?.emit("click", e);
1353
- }
1354
- function onMouseover(e) {
1355
- if (instance?.vnode.props?.onMouseover) {
1356
- emit("mouseover", e);
1357
- return;
1358
- }
1359
- dropdownEventBus?.emit("mouseover", e);
1360
- }
1361
- function onMouseleave(e) {
1362
- if (instance?.vnode.props?.onMouseleave) {
1363
- emit("mouseleave", e);
1364
- return;
1365
- }
1366
- dropdownEventBus?.emit("mouseleave", e);
1367
- }
1368
- return (_ctx, _cache) => {
1369
- return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
1370
- ref_key: "element",
1371
- ref: element,
1372
- class: {
1373
- active: _ctx.active,
1374
- pressed: unref(pressed),
1375
- disabled: _ctx.disabled,
1376
- current: _ctx.current
1377
- },
1378
- onClickPassive: onClick,
1379
- onMouseoverPassive: onMouseover,
1380
- onMouseleavePassive: onMouseleave
1381
- }), {
1382
- default: withCtx(() => [
1383
- renderSlot(_ctx.$slots, "default", {}, () => [
1384
- createTextVNode(
1385
- toDisplayString(_ctx.label),
1386
- 1
1387
- /* TEXT */
1388
- )
1389
- ])
1390
- ]),
1391
- _: 3
1392
- /* FORWARDED */
1393
- }, 16, ["class"]);
1394
- };
1395
- }
1396
- });
1397
- function useUniqueId(id) {
1398
- return computed(() => String(id?.value || useId()));
1399
- }
1400
- const _hoisted_1$5 = {
1401
- key: 1,
1402
- class: "vv-button__label"
1403
- };
1404
- const _hoisted_2$2 = {
1405
- key: 1,
1406
- class: "vv-button__label"
1407
- };
1408
- const __default__$6 = {
1409
- name: "VvButton",
1410
- inheritAttrs: false
1411
- };
1412
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1413
- ...__default__$6,
1414
- props: VvButtonProps,
1415
- emits: VvButtonEvents,
1416
- setup(__props, { expose: __expose, emit: __emit }) {
1417
- const props = __props;
1418
- const emit = __emit;
1419
- const attrs = useAttrs();
1420
- const slots = useSlots();
1421
- const {
1422
- id,
1423
- modifiers,
1424
- iconPosition,
1425
- icon,
1426
- label,
1427
- modelValue,
1428
- disabled,
1429
- toggle,
1430
- unselectable
1431
- } = useGroupProps(props, emit);
1432
- const hasId = useUniqueId(id);
1433
- const name = computed(() => attrs?.name || hasId.value);
1434
- const element = ref(null);
1435
- const $el = computed(() => element.value?.$el);
1436
- __expose({ $el });
1437
- const pressed = computed(() => {
1438
- if (!toggle.value) {
1439
- return props.pressed;
1440
- }
1441
- if (Array.isArray(modelValue.value)) {
1442
- return contains(name.value, modelValue.value);
1443
- }
1444
- return equals(name.value, modelValue.value);
1445
- });
1446
- const bemCssClasses = useModifiers(
1447
- "vv-button",
1448
- modifiers,
1449
- computed(() => ({
1450
- "reverse": [Side.right, Side.bottom].includes(
1451
- iconPosition.value
1452
- ),
1453
- "column": [Side.top, Side.bottom].includes(
1454
- iconPosition.value
1455
- ),
1456
- "icon-only": Boolean(
1457
- icon?.value && !label?.value && !slots.default
1458
- )
1459
- }))
1460
- );
1461
- const { hasIcon } = useComponentIcon(icon);
1462
- const toggleValue = computed(() => {
1463
- return props.value !== void 0 ? props.value : name.value;
1464
- });
1465
- const hasListeners = computed(() => {
1466
- if (!toggle.value) {
1467
- return void 0;
1468
- }
1469
- return {
1470
- onClick
1471
- };
1472
- });
1473
- function onClick() {
1474
- if (toggle.value) {
1475
- if (Array.isArray(modelValue.value)) {
1476
- if (contains(toggleValue.value, modelValue.value)) {
1477
- if (unselectable.value) {
1478
- modelValue.value = modelValue.value.filter(
1479
- (n) => n !== toggleValue.value
1480
- );
1481
- }
1482
- return;
1483
- }
1484
- modelValue.value.push(toggleValue.value);
1485
- return;
1486
- }
1487
- if (toggleValue.value === modelValue.value && unselectable.value) {
1488
- modelValue.value = props.uncheckedValue;
1489
- return;
1490
- }
1491
- modelValue.value = toggleValue.value;
1492
- }
1493
- }
1494
- return (_ctx, _cache) => {
1495
- return openBlock(), createBlock(_sfc_main$7, mergeProps({
1496
- ...unref(attrs),
1497
- ...unref(hasListeners),
1498
- disabled: unref(disabled),
1499
- pressed: unref(pressed),
1500
- active: _ctx.active,
1501
- type: _ctx.type,
1502
- to: _ctx.to,
1503
- href: _ctx.href,
1504
- target: _ctx.target,
1505
- rel: _ctx.rel,
1506
- ariaLabel: _ctx.ariaLabel
1507
- }, {
1508
- id: unref(hasId),
1509
- ref_key: "element",
1510
- ref: element,
1511
- class: unref(bemCssClasses)
1512
- }), {
1513
- default: withCtx(() => [
1514
- renderSlot(_ctx.$slots, "default", {}, () => [
1515
- _ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
1516
- _ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$9, {
1517
- key: 0,
1518
- class: "vv-button__loading-icon",
1519
- name: _ctx.loadingIcon
1520
- }, null, 8, ["name"])) : createCommentVNode("v-if", true),
1521
- _ctx.loadingLabel ? (openBlock(), createElementBlock(
1522
- "span",
1523
- _hoisted_1$5,
1524
- toDisplayString(_ctx.loadingLabel),
1525
- 1
1526
- /* TEXT */
1527
- )) : createCommentVNode("v-if", true)
1528
- ]) : (openBlock(), createElementBlock(
1529
- Fragment,
1530
- { key: 1 },
1531
- [
1532
- renderSlot(_ctx.$slots, "before"),
1533
- unref(hasIcon) ? (openBlock(), createBlock(
1534
- _sfc_main$9,
1535
- mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
1536
- null,
1537
- 16
1538
- /* FULL_PROPS */
1539
- )) : createCommentVNode("v-if", true),
1540
- unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$2, [
1541
- renderSlot(_ctx.$slots, "label", {}, () => [
1542
- createTextVNode(
1543
- toDisplayString(unref(label)),
1544
- 1
1545
- /* TEXT */
1546
- )
1547
- ])
1548
- ])) : createCommentVNode("v-if", true),
1549
- renderSlot(_ctx.$slots, "after")
1550
- ],
1551
- 64
1552
- /* STABLE_FRAGMENT */
1553
- ))
1554
- ])
1555
- ]),
1556
- _: 3
1557
- /* FORWARDED */
1558
- }, 16, ["id", "class"]);
1559
- };
1560
- }
1561
- });
1562
- const VvDropdownProps = {
1563
- ...IdProps,
1564
- ...DropdownProps,
1565
- ...ModifiersProps,
1566
- /**
1567
- * Show / hide dropdown programmatically
1568
- */
1569
- modelValue: {
1570
- type: Boolean,
1571
- default: void 0
1572
- },
1573
- /**
1574
- * Dropdown trigger element
1575
- */
1576
- reference: {
1577
- type: Object,
1578
- default: null
1579
- },
1580
- /**
1581
- * Dropdown role
1582
- */
1583
- role: {
1584
- type: String,
1585
- default: DropdownRole.menu,
1586
- validator: (value) => Object.values(DropdownRole).includes(value)
1587
- }
1588
- };
1589
- const VvDropdownItemProps = {
1590
- focusOnHover: {
1591
- type: Boolean,
1592
- default: false
1593
- }
1594
- };
1595
- const VvDropdownOptionProps = {
1596
- ...DisabledProps,
1597
- ...SelectedProps,
1598
- ...UnselectableProps,
1599
- ...ModifiersProps,
1600
- deselectHintLabel: {
1601
- type: String
1602
- },
1603
- selectHintLabel: {
1604
- type: String
1605
- },
1606
- selectedHintLabel: {
1607
- type: String
1608
- },
1609
- focusOnHover: {
1610
- type: Boolean,
1611
- default: false
1612
- }
1613
- };
1614
- function useDropdownProvideTrigger({
1615
- reference,
1616
- id,
1617
- expanded,
1618
- aria
1619
- }) {
1620
- const bus = mitt();
1621
- const component = defineComponent({
1622
- name: "VvDropdownTriggerProvider",
1623
- setup() {
1624
- provide(INJECTION_KEY_DROPDOWN_TRIGGER, {
1625
- reference,
1626
- id,
1627
- expanded,
1628
- aria,
1629
- bus
1630
- });
1631
- },
1632
- render() {
1633
- return h(Fragment, {}, this.$slots.default?.());
1634
- }
1635
- });
1636
- return {
1637
- bus,
1638
- component
1639
- };
1640
- }
1641
- function useDropdownProvideItem({
1642
- role,
1643
- ...others
1644
- }) {
1645
- const itemRole = computed(
1646
- () => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
1647
- );
1648
- provide(INJECTION_KEY_DROPDOWN_ITEM, {
1649
- role: itemRole,
1650
- ...others
1651
- });
1652
- return { itemRole };
1653
- }
1654
- function useDropdownProvideAction({
1655
- expanded
1656
- }) {
1657
- provide(INJECTION_KEY_DROPDOWN_ACTION, {
1658
- role: ref(ActionRoles.menuitem),
1659
- expanded
1660
- });
1661
- }
1662
- const _hoisted_1$4 = ["id", "tabindex", "role", "aria-labelledby"];
1663
- const __default__$5 = {
1664
- name: "VvDropdown",
1665
- inheritAttrs: false
1666
- };
1667
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1668
- ...__default__$5,
1669
- props: VvDropdownProps,
1670
- emits: [
1671
- "update:modelValue",
1672
- "beforeEnter",
1673
- "afterLeave",
1674
- "beforeExpand",
1675
- "beforeCollapse",
1676
- "afterExpand",
1677
- "afterCollapse",
1678
- "before-enter",
1679
- "after-leave",
1680
- "enter",
1681
- "afterEnter",
1682
- "enterCancelled",
1683
- "beforeLeave",
1684
- "leave",
1685
- "leaveCancelled"
1686
- ],
1687
- setup(__props, { expose: __expose, emit: __emit }) {
1688
- const props = __props;
1689
- const emit = __emit;
1690
- const { id } = toRefs(props);
1691
- const hasId = useUniqueId(id);
1692
- const attrs = useAttrs();
1693
- const maxWidth = ref("auto");
1694
- const maxHeight = ref("auto");
1695
- const localReferenceEl = ref();
1696
- const floatingEl = ref();
1697
- const arrowEl = ref();
1698
- const listEl = ref();
1699
- const referenceEl = computed({
1700
- get: () => props.reference ?? localReferenceEl.value,
1701
- set: (newValue) => {
1702
- localReferenceEl.value = newValue;
1703
- }
1704
- });
1705
- const hasCustomPosition = ref(false);
1706
- onMounted(() => {
1707
- useMutationObserver(
1708
- floatingEl.value,
1709
- () => {
1710
- hasCustomPosition.value = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")?.trim() === "true";
1711
- },
1712
- {
1713
- attributeFilter: ["style"],
1714
- window
1715
- }
1716
- );
1717
- });
1718
- const middleware = computed(() => {
1719
- const toReturn = [];
1720
- if (props.autoPlacement) {
1721
- if (typeof props.autoPlacement === "boolean") {
1722
- toReturn.push(autoPlacement());
1723
- } else {
1724
- toReturn.push(
1725
- autoPlacement(props.autoPlacement)
1726
- );
1727
- }
1728
- } else if (props.flip) {
1729
- if (typeof props.flip === "boolean") {
1730
- toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
1731
- } else {
1732
- toReturn.push(flip(props.flip));
1733
- }
1734
- }
1735
- if (props.shift) {
1736
- if (typeof props.shift === "boolean") {
1737
- toReturn.push(shift());
1738
- } else {
1739
- toReturn.push(shift(props.shift));
1740
- }
1741
- }
1742
- if (props.size) {
1743
- const apply = ({
1744
- availableWidth,
1745
- availableHeight
1746
- }) => {
1747
- maxWidth.value = `${availableWidth}px`;
1748
- maxHeight.value = `${availableHeight}px`;
1749
- };
1750
- if (typeof props.size === "boolean") {
1751
- toReturn.push(
1752
- size({
1753
- apply
1754
- })
1755
- );
1756
- } else {
1757
- toReturn.push(
1758
- size({
1759
- ...props.size,
1760
- apply
1761
- })
1762
- );
1763
- }
1764
- }
1765
- if (props.offset) {
1766
- toReturn.push(offset(Number(props.offset)));
1767
- if (["string", "number"].includes(typeof props.offset)) {
1768
- toReturn.push(offset(Number(props.offset)));
1769
- } else {
1770
- toReturn.push(offset(props.offset));
1771
- }
1772
- }
1773
- if (props.arrow) {
1774
- toReturn.push(
1775
- arrow({
1776
- element: arrowEl
1777
- })
1778
- );
1779
- }
1780
- return toReturn;
1781
- });
1782
- const { x, y, middlewareData, placement, strategy } = useFloating(
1783
- referenceEl,
1784
- floatingEl,
1785
- {
1786
- whileElementsMounted: (...args) => {
1787
- return autoUpdate(...args, {
1788
- animationFrame: props.strategy === Strategy.fixed
1789
- });
1790
- },
1791
- placement: computed(() => props.placement),
1792
- strategy: computed(() => props.strategy),
1793
- middleware
1794
- }
1795
- );
1796
- const dropdownPlacement = computed(() => {
1797
- if (hasCustomPosition.value) {
1798
- return void 0;
1799
- }
1800
- const width = props.triggerWidth && referenceEl.value ? `${referenceEl.value?.offsetWidth}px` : void 0;
1801
- return {
1802
- position: strategy.value,
1803
- top: `${y.value ?? 0}px`,
1804
- left: `${x.value ?? 0}px`,
1805
- maxWidth: width ? void 0 : maxWidth.value,
1806
- maxHeight: maxHeight.value,
1807
- width
1808
- };
1809
- });
1810
- const side = computed(
1811
- () => placement.value.split("-")[0]
1812
- );
1813
- const arrowPlacement = computed(() => {
1814
- if (hasCustomPosition.value) {
1815
- return void 0;
1816
- }
1817
- const staticSide = {
1818
- [Side.top]: Side.bottom,
1819
- [Side.right]: Side.left,
1820
- [Side.bottom]: Side.top,
1821
- [Side.left]: Side.right
1822
- }[side.value];
1823
- return {
1824
- left: middlewareData.value.arrow?.x !== void 0 ? `${middlewareData.value.arrow?.x}px` : void 0,
1825
- top: middlewareData.value.arrow?.y !== void 0 ? `${middlewareData.value.arrow?.y}px` : void 0,
1826
- [staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`
1827
- };
1828
- });
1829
- const modelValue = useVModel(props, "modelValue", emit);
1830
- const localModelValue = ref(false);
1831
- const expanded = computed({
1832
- get: () => modelValue.value ?? localModelValue.value,
1833
- set: (newValue) => {
1834
- if (modelValue.value === void 0) {
1835
- localModelValue.value = newValue;
1836
- return;
1837
- }
1838
- modelValue.value = newValue;
1839
- }
1840
- });
1841
- function show() {
1842
- expanded.value = true;
1843
- }
1844
- function hide() {
1845
- expanded.value = false;
1846
- }
1847
- function toggle() {
1848
- expanded.value = !expanded.value;
1849
- }
1850
- function init(el) {
1851
- referenceEl.value = el;
1852
- }
1853
- onClickOutside(
1854
- floatingEl,
1855
- () => {
1856
- if (!props.keepOpen && expanded.value) {
1857
- expanded.value = false;
1858
- }
1859
- },
1860
- { ignore: [referenceEl] }
1861
- );
1862
- const hasAriaLabelledby = computed(() => {
1863
- return referenceEl.value?.getAttribute?.("id") ?? void 0;
1864
- });
1865
- const referenceAria = computed(() => ({
1866
- "aria-controls": hasId.value,
1867
- "aria-haspopup": true,
1868
- "aria-expanded": expanded.value
1869
- }));
1870
- const { component: VvDropdownTriggerProvider, bus } = useDropdownProvideTrigger({
1871
- reference: referenceEl,
1872
- id: hasId,
1873
- expanded,
1874
- aria: referenceAria
1875
- });
1876
- bus.on("click", toggle);
1877
- const { role, modifiers } = toRefs(props);
1878
- const bemCssClasses = useModifiers(
1879
- "vv-dropdown",
1880
- modifiers,
1881
- computed(() => ({
1882
- arrow: props.arrow
1883
- }))
1884
- );
1885
- const { focused } = useFocusWithin(floatingEl);
1886
- function getKeyboardFocusableElements(element) {
1887
- if (!element) {
1888
- return [];
1889
- }
1890
- return [
1891
- ...element.querySelectorAll(
1892
- 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
1893
- )
1894
- ].filter(
1895
- (el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
1896
- );
1897
- }
1898
- function focusFirst() {
1899
- nextTick(() => {
1900
- const focusableElements = getKeyboardFocusableElements(
1901
- floatingEl.value
1902
- );
1903
- if (focusableElements.length > 0) {
1904
- focusableElements[0].focus({
1905
- preventScroll: true
1906
- });
1907
- }
1908
- });
1909
- }
1910
- function focusFirstListElement() {
1911
- nextTick(() => {
1912
- const focusableElements = getKeyboardFocusableElements(
1913
- listEl.value
1914
- );
1915
- if (focusableElements.length > 0) {
1916
- focusableElements[0].focus({
1917
- preventScroll: true
1918
- });
1919
- }
1920
- });
1921
- }
1922
- function focusNext() {
1923
- nextTick(() => {
1924
- if (focused.value) {
1925
- const focusableElements = getKeyboardFocusableElements(
1926
- floatingEl.value
1927
- );
1928
- if (focusableElements.length === 0 || !document.activeElement) {
1929
- return;
1930
- }
1931
- const activeElementIndex = focusableElements.indexOf(
1932
- document.activeElement
1933
- );
1934
- if (activeElementIndex < focusableElements.length - 1) {
1935
- focusableElements[activeElementIndex + 1].focus({
1936
- preventScroll: true
1937
- });
1938
- } else {
1939
- focusableElements[0].focus({
1940
- preventScroll: true
1941
- });
1942
- }
1943
- }
1944
- });
1945
- }
1946
- function focusPrev() {
1947
- nextTick(() => {
1948
- if (focused.value) {
1949
- const focusableElements = getKeyboardFocusableElements(
1950
- floatingEl.value
1951
- );
1952
- if (focusableElements.length === 0 || !document.activeElement) {
1953
- return;
1954
- }
1955
- const activeElementIndex = focusableElements.indexOf(
1956
- document.activeElement
1957
- );
1958
- if (activeElementIndex > 0) {
1959
- focusableElements[activeElementIndex - 1].focus({
1960
- preventScroll: true
1961
- });
1962
- } else {
1963
- focusableElements[focusableElements.length - 1].focus({
1964
- preventScroll: true
1965
- });
1966
- }
1967
- }
1968
- });
1969
- }
1970
- watch(expanded, (newValue) => {
1971
- if (newValue && props.autofocusFirst) {
1972
- focusFirst();
1973
- }
1974
- });
1975
- __expose({
1976
- toggle,
1977
- show,
1978
- hide,
1979
- init,
1980
- focusFirst,
1981
- focusFirstListElement,
1982
- focusNext,
1983
- focusPrev,
1984
- customPosition: hasCustomPosition
1985
- });
1986
- const hovered = useElementHover(floatingEl);
1987
- const { itemRole } = useDropdownProvideItem({
1988
- role,
1989
- expanded,
1990
- focused,
1991
- hovered
1992
- });
1993
- onKeyStroke("Escape", (e) => {
1994
- if (expanded.value) {
1995
- e.preventDefault();
1996
- hide();
1997
- }
1998
- });
1999
- onKeyStroke("ArrowDown", (e) => {
2000
- if (expanded.value && focused.value) {
2001
- e.preventDefault();
2002
- focusNext();
2003
- }
2004
- });
2005
- onKeyStroke("ArrowUp", (e) => {
2006
- if (expanded.value && focused.value) {
2007
- e.preventDefault();
2008
- focusPrev();
2009
- }
2010
- });
2011
- onKeyStroke([" ", "Enter"], (e) => {
2012
- const htmlEl = e.target;
2013
- if (expanded.value && focused.value && htmlEl) {
2014
- htmlEl?.click();
2015
- }
2016
- });
2017
- const dropdownTransitionHandlers = {
2018
- "before-enter": () => {
2019
- emit(expanded.value ? "beforeExpand" : "beforeCollapse");
2020
- emit("beforeEnter");
2021
- },
2022
- "after-leave": () => {
2023
- emit(expanded.value ? "afterExpand" : "afterCollapse");
2024
- emit("afterLeave");
2025
- },
2026
- "enter": () => {
2027
- emit("enter");
2028
- },
2029
- "after-enter": () => {
2030
- emit("afterEnter");
2031
- },
2032
- "enter-cancelled": () => {
2033
- emit("enterCancelled");
2034
- },
2035
- "before-leave": () => {
2036
- emit("beforeLeave");
2037
- },
2038
- "leave": () => {
2039
- emit("leave");
2040
- },
2041
- "leave-cancelled": () => {
2042
- emit("leaveCancelled");
2043
- }
2044
- };
2045
- return (_ctx, _cache) => {
2046
- return openBlock(), createElementBlock(
2047
- Fragment,
2048
- null,
2049
- [
2050
- createVNode(unref(VvDropdownTriggerProvider), null, {
2051
- default: withCtx(() => [
2052
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
2053
- ]),
2054
- _: 3
2055
- /* FORWARDED */
2056
- }),
2057
- createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
2058
- default: withCtx(() => [
2059
- withDirectives(createElementVNode(
2060
- "div",
2061
- {
2062
- ref_key: "floatingEl",
2063
- ref: floatingEl,
2064
- style: normalizeStyle(unref(dropdownPlacement)),
2065
- class: normalizeClass(unref(bemCssClasses))
2066
- },
2067
- [
2068
- props.arrow ? (openBlock(), createElementBlock(
2069
- "div",
2070
- {
2071
- key: 0,
2072
- ref_key: "arrowEl",
2073
- ref: arrowEl,
2074
- style: normalizeStyle(unref(arrowPlacement)),
2075
- class: "vv-dropdown__arrow"
2076
- },
2077
- null,
2078
- 4
2079
- /* STYLE */
2080
- )) : createCommentVNode("v-if", true),
2081
- renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
2082
- createElementVNode("div", mergeProps(unref(attrs), {
2083
- id: unref(hasId),
2084
- ref_key: "listEl",
2085
- ref: listEl,
2086
- tabindex: !unref(expanded) ? -1 : void 0,
2087
- role: unref(role),
2088
- "aria-labelledby": unref(hasAriaLabelledby),
2089
- class: "vv-dropdown__list"
2090
- }), [
2091
- renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
2092
- role: unref(itemRole)
2093
- })))
2094
- ], 16, _hoisted_1$4),
2095
- renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
2096
- ],
2097
- 6
2098
- /* CLASS, STYLE */
2099
- ), [
2100
- [vShow, unref(expanded)]
2101
- ])
2102
- ]),
2103
- _: 3
2104
- /* FORWARDED */
2105
- }, 16, ["name"])
2106
- ],
2107
- 64
2108
- /* STABLE_FRAGMENT */
2109
- );
2110
- };
2111
- }
2112
- });
2113
- const _hoisted_1$3 = {
2114
- class: "vv-dropdown-optgroup",
2115
- role: "presentation",
2116
- tabindex: "-1"
2117
- };
2118
- const __default__$4 = {
2119
- name: "VvDropdownOptgroup"
2120
- };
2121
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2122
- ...__default__$4,
2123
- props: {
2124
- ...LabelProps
2125
- },
2126
- setup(__props) {
2127
- const props = __props;
2128
- return (_ctx, _cache) => {
2129
- return openBlock(), createElementBlock(
2130
- "li",
2131
- _hoisted_1$3,
2132
- toDisplayString(props.label),
2133
- 1
2134
- /* TEXT */
2135
- );
2136
- };
2137
- }
2138
- });
2139
- const __default__$3 = {
2140
- name: "VvDropdownItem"
2141
- };
2142
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2143
- ...__default__$3,
2144
- props: VvDropdownItemProps,
2145
- setup(__props) {
2146
- const props = __props;
2147
- const { role, expanded } = useInjectedDropdownItem();
2148
- const element = ref(null);
2149
- useDropdownProvideAction({ expanded });
2150
- const hovered = useElementHover(element);
2151
- const { focused } = useFocus(element);
2152
- const { focused: focusedWithin } = useFocusWithin(element);
2153
- watch(hovered, (newValue) => {
2154
- if (newValue && props.focusOnHover) {
2155
- focused.value = true;
2156
- }
2157
- });
2158
- return (_ctx, _cache) => {
2159
- return openBlock(), createElementBlock(
2160
- "div",
2161
- mergeProps({ role: unref(role) }, {
2162
- ref_key: "element",
2163
- ref: element,
2164
- class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
2165
- }),
2166
- [
2167
- renderSlot(_ctx.$slots, "default")
2168
- ],
2169
- 16
2170
- /* FULL_PROPS */
2171
- );
2172
- };
2173
- }
2174
- });
2175
- const _hoisted_1$2 = ["title"];
2176
- const __default__$2 = {
2177
- name: "VvDropdownOption"
2178
- };
2179
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2180
- ...__default__$2,
2181
- props: VvDropdownOptionProps,
2182
- setup(__props) {
2183
- const props = __props;
2184
- const { modifiers } = toRefs(props);
2185
- const bemCssClasses = useModifiers(
2186
- "vv-dropdown-option",
2187
- modifiers,
2188
- computed(() => ({
2189
- disabled: props.disabled,
2190
- selected: props.selected,
2191
- unselectable: props.unselectable && props.selected
2192
- }))
2193
- );
2194
- const hintLabel = computed(() => {
2195
- if (props.selected) {
2196
- return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
2197
- }
2198
- if (!props.disabled) {
2199
- return props.selectHintLabel;
2200
- }
2201
- return "";
2202
- });
2203
- return (_ctx, _cache) => {
2204
- return openBlock(), createBlock(_sfc_main$3, {
2205
- class: normalizeClass(unref(bemCssClasses)),
2206
- tabindex: _ctx.disabled ? -1 : 0,
2207
- "aria-selected": _ctx.selected,
2208
- "aria-disabled": _ctx.disabled,
2209
- "focus-on-hover": _ctx.focusOnHover
2210
- }, {
2211
- default: withCtx(() => [
2212
- renderSlot(_ctx.$slots, "default"),
2213
- createElementVNode("span", {
2214
- class: "vv-dropdown-option__hint",
2215
- title: unref(hintLabel)
2216
- }, [
2217
- renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
2218
- createTextVNode(
2219
- toDisplayString(unref(hintLabel)),
2220
- 1
2221
- /* TEXT */
2222
- )
2223
- ])
2224
- ], 8, _hoisted_1$2)
2225
- ]),
2226
- _: 3
2227
- /* FORWARDED */
2228
- }, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
2229
- };
2230
- }
2231
- });
2232
- const VvSelectProps = {
2233
- ...IdNameProps,
2234
- ...AutofocusProps,
2235
- ...AutocompleteProps,
2236
- ...TabindexProps,
2237
- ...ValidProps,
2238
- ...InvalidProps,
2239
- ...HintProps,
2240
- ...LoadingProps,
2241
- ...DisabledProps,
2242
- ...ReadonlyProps,
2243
- ...ModifiersProps,
2244
- ...OptionsProps,
2245
- ...IconProps,
2246
- ...FloatingLabelProps,
2247
- ...UnselectableProps,
2248
- ...LabelProps,
2249
- ...ClearProps,
2250
- /**
2251
- * This Boolean attribute indicates that multiple options can be selected in the list.
2252
- * If it is not specified, then only one option can be selected at a time.
2253
- * When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
2254
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple
2255
- */
2256
- multiple: Boolean,
2257
- /**
2258
- * A Boolean attribute indicating that an option with a non-empty string value must be selected.
2259
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-required
2260
- */
2261
- required: Boolean,
2262
- /**
2263
- * If the control is presented as a scrolling list box (e.g. when multiple is specified),
2264
- * this attribute represents the number of rows in the list that should be visible at one time.
2265
- * Browsers are not required to present a select element as a scrolled list box. The default value is 0.
2266
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-size
2267
- */
2268
- size: [String, Number],
2269
- /**
2270
- * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
2271
- */
2272
- modelValue: {
2273
- type: [String, Number, Boolean, Object, Array],
2274
- default: void 0
2275
- },
2276
- /**
2277
- * Select first option automatically
2278
- */
2279
- autoselectFirst: {
2280
- type: Boolean,
2281
- default: false
2282
- },
2283
- /**
2284
- * Select placeholder
2285
- */
2286
- placeholder: String
2287
- };
2288
- function useVvSelectProps() {
2289
- return {
2290
- ...VvSelectProps,
2291
- options: {
2292
- ...VvSelectProps.options,
2293
- type: Array,
2294
- default: () => []
2295
- }
2296
- };
2297
- }
2298
- function useDefaults(componentName, propsDefinition, props) {
2299
- const volver = useVolver();
2300
- const volverComponentDefaults = computed(() => {
2301
- if (!volver || !volver.defaults.value?.[componentName]) {
2302
- return void 0;
2303
- }
2304
- return volver.defaults.value[componentName];
2305
- });
2306
- return computed(() => {
2307
- if (volverComponentDefaults.value === void 0) {
2308
- return props;
2309
- }
2310
- const componentDefaults = volverComponentDefaults.value;
2311
- const simplifiedPropsDefinition = propsDefinition;
2312
- const simplifiedProps = props;
2313
- return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
2314
- const propValue = simplifiedProps[key];
2315
- acc[key] = propValue;
2316
- if (key in componentDefaults) {
2317
- if (Array.isArray(simplifiedPropsDefinition[key])) {
2318
- const typeArray = simplifiedPropsDefinition[key];
2319
- if (typeArray.length) {
2320
- const typeFunction = typeArray[0];
2321
- if (typeFunction === propValue) {
2322
- acc[key] = componentDefaults[key];
2323
- }
2324
- }
2325
- }
2326
- if (typeof simplifiedPropsDefinition[key] === "function") {
2327
- const typeFunction = simplifiedPropsDefinition[key];
2328
- if (typeFunction() === propValue) {
2329
- acc[key] = componentDefaults[key];
2330
- }
2331
- }
2332
- if (typeof simplifiedPropsDefinition[key] === "object") {
2333
- let defaultValue = simplifiedPropsDefinition[key].default;
2334
- if (typeof defaultValue === "function") {
2335
- defaultValue = defaultValue();
2336
- }
2337
- if (typeof defaultValue === "object") {
2338
- if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
2339
- acc[key] = componentDefaults[key];
2340
- }
2341
- } else if (defaultValue === propValue) {
2342
- acc[key] = componentDefaults[key];
2343
- }
2344
- }
2345
- }
2346
- return acc;
2347
- }, {});
2348
- });
2349
- }
2350
- function useComponentFocus(inputTemplateRef, emit) {
2351
- const { focused } = useFocus(inputTemplateRef);
2352
- watch(focused, (newValue) => {
2353
- emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
2354
- });
2355
- return {
2356
- focused
2357
- };
2358
- }
2359
- function useOptions(props) {
2360
- const { options, labelKey, valueKey, disabledKey } = toRefs(props);
2361
- const getOptionLabel = (option) => {
2362
- if (typeof option === "string") {
2363
- return option;
2364
- }
2365
- if (typeof labelKey.value === "function") {
2366
- return labelKey.value(option);
2367
- }
2368
- return String(
2369
- labelKey.value ? getProperty(option, labelKey.value) : option
2370
- );
2371
- };
2372
- const getOptionValue = (option) => {
2373
- if (typeof option === "string") {
2374
- return option;
2375
- }
2376
- if (typeof valueKey.value === "function") {
2377
- return valueKey.value(option);
2378
- }
2379
- return valueKey.value ? getProperty(option, valueKey.value) : option;
2380
- };
2381
- const isOptionDisabled = (option) => {
2382
- if (typeof option === "string") {
2383
- return false;
2384
- }
2385
- if (typeof disabledKey.value === "function") {
2386
- return disabledKey.value(option);
2387
- }
2388
- return disabledKey.value ? Boolean(getProperty(option, disabledKey.value)) : false;
2389
- };
2390
- const getOptionGrouped = (option) => {
2391
- if (typeof option == "string") {
2392
- return [];
2393
- }
2394
- if (typeof option === "object" && option && "options" in option) {
2395
- return option.options;
2396
- }
2397
- return [];
2398
- };
2399
- return {
2400
- options,
2401
- getOptionLabel,
2402
- getOptionValue,
2403
- isOptionDisabled,
2404
- getOptionGrouped
2405
- };
2406
- }
2407
- const _hoisted_1$1 = ["for"];
2408
- const _hoisted_2$1 = { class: "vv-select__wrapper" };
2409
- const _hoisted_3$1 = {
2410
- key: 0,
2411
- class: "vv-select__input-before"
2412
- };
2413
- const _hoisted_4$1 = { class: "vv-select__inner" };
2414
- const _hoisted_5$1 = ["id"];
2415
- const _hoisted_6$1 = ["disabled", "hidden"];
2416
- const _hoisted_7$1 = ["disabled", "value"];
2417
- const _hoisted_8$1 = ["disabled", "label"];
2418
- const _hoisted_9$1 = ["disabled", "value"];
2419
- const _hoisted_10 = {
2420
- key: 2,
2421
- class: "vv-select__input-after"
2422
- };
2423
- const __default__$1 = {
2424
- name: "VvSelect"
2425
- };
2426
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2427
- ...__default__$1,
2428
- props: useVvSelectProps(),
2429
- emits: ["update:modelValue", "focus", "blur", "clear"],
2430
- setup(__props, { emit: __emit }) {
2431
- const props = __props;
2432
- const emit = __emit;
2433
- const slots = useSlots();
2434
- const VvSelectProps2 = useVvSelectProps();
2435
- const propsDefaults = useDefaults(
2436
- "VvSelect",
2437
- VvSelectProps2,
2438
- props
2439
- );
2440
- const selectEl = ref();
2441
- const {
2442
- HintSlot,
2443
- hasHintLabelOrSlot,
2444
- hasInvalidLabelOrSlot,
2445
- hintSlotScope
2446
- } = HintSlotFactory(propsDefaults, slots);
2447
- const { focused } = useComponentFocus(selectEl, emit);
2448
- function isGroup(option) {
2449
- if (typeof option === "string") {
2450
- return false;
2451
- }
2452
- return option.options?.length;
2453
- }
2454
- const {
2455
- id,
2456
- modifiers,
2457
- disabled,
2458
- readonly,
2459
- loading,
2460
- icon,
2461
- iconPosition,
2462
- invalid,
2463
- valid,
2464
- floating,
2465
- multiple
2466
- } = toRefs(props);
2467
- const hasId = useUniqueId(id);
2468
- const hasHintId = computed(() => `${hasId.value}-hint`);
2469
- const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
2470
- const hasTabindex = computed(() => {
2471
- return isDisabledOrReadonly.value ? -1 : props.tabindex;
2472
- });
2473
- const localModelValue = computed({
2474
- get: () => {
2475
- return props.modelValue;
2476
- },
2477
- set: (newValue) => {
2478
- if (Array.isArray(newValue)) {
2479
- newValue = newValue.filter((item) => item !== void 0);
2480
- if (newValue.length === 0 && !props.unselectable && selectEl.value) {
2481
- selectEl.value.value = String(props.modelValue);
2482
- return;
2483
- }
2484
- }
2485
- emit("update:modelValue", newValue);
2486
- }
2487
- });
2488
- const isDirty = computed(() => {
2489
- if (Array.isArray(localModelValue.value)) {
2490
- return localModelValue.value.length > 0;
2491
- }
2492
- return localModelValue.value !== void 0 && localModelValue.value !== null;
2493
- });
2494
- const isUnselectable = computed(() => {
2495
- if (isDisabledOrReadonly.value) {
2496
- return false;
2497
- }
2498
- return props.unselectable;
2499
- });
2500
- const isVisible = useElementVisibility(selectEl);
2501
- watch(isVisible, (newValue) => {
2502
- if (newValue && props.autofocus) {
2503
- focused.value = true;
2504
- }
2505
- });
2506
- const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
2507
- const isInvalid = computed(() => {
2508
- if (props.invalid === true) {
2509
- return true;
2510
- }
2511
- if (props.valid === true) {
2512
- return false;
2513
- }
2514
- return void 0;
2515
- });
2516
- const bemCssClasses = useModifiers(
2517
- "vv-select",
2518
- modifiers,
2519
- computed(() => ({
2520
- "valid": valid.value,
2521
- "invalid": invalid.value,
2522
- "loading": loading.value,
2523
- "disabled": disabled.value,
2524
- "readonly": readonly.value,
2525
- "icon-before": hasIconBefore.value !== void 0,
2526
- "icon-after": hasIconAfter.value !== void 0,
2527
- "dirty": isDirty.value,
2528
- "focus": focused.value && !isDisabledOrReadonly.value,
2529
- "floating": floating.value,
2530
- "multiple": multiple.value
2531
- }))
2532
- );
2533
- const {
2534
- getOptionLabel,
2535
- getOptionValue,
2536
- isOptionDisabled,
2537
- getOptionGrouped
2538
- } = useOptions(props);
2539
- watch(
2540
- () => props.options,
2541
- (newValue) => {
2542
- if (newValue?.length && props.autoselectFirst && !isDirty.value) {
2543
- const firstOptionValue = getOptionValue(newValue[0]);
2544
- localModelValue.value = props.multiple ? [firstOptionValue] : firstOptionValue;
2545
- }
2546
- },
2547
- { immediate: true }
2548
- );
2549
- function onClear() {
2550
- if (Array.isArray(localModelValue.value)) {
2551
- localModelValue.value = [];
2552
- } else {
2553
- localModelValue.value = void 0;
2554
- }
2555
- emit("clear");
2556
- }
2557
- const hasAttrs = computed(() => {
2558
- return {
2559
- "name": props.name,
2560
- "tabindex": hasTabindex.value,
2561
- "disabled": isDisabledOrReadonly.value,
2562
- "required": props.required,
2563
- "size": props.size,
2564
- "autocomplete": props.autocomplete,
2565
- "multiple": props.multiple,
2566
- "aria-invalid": isInvalid.value,
2567
- "aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
2568
- "aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
2569
- };
2570
- });
2571
- const slotProps = computed(() => ({
2572
- valid: props.valid,
2573
- invalid: props.invalid,
2574
- modelValue: props.modelValue
2575
- }));
2576
- return (_ctx, _cache) => {
2577
- return openBlock(), createElementBlock(
2578
- "div",
2579
- {
2580
- class: normalizeClass(unref(bemCssClasses))
2581
- },
2582
- [
2583
- _ctx.label ? (openBlock(), createElementBlock("label", {
2584
- key: 0,
2585
- for: unref(hasId)
2586
- }, toDisplayString(_ctx.label), 9, _hoisted_1$1)) : createCommentVNode("v-if", true),
2587
- createElementVNode("div", _hoisted_2$1, [
2588
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
2589
- renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
2590
- ])) : createCommentVNode("v-if", true),
2591
- createElementVNode("div", _hoisted_4$1, [
2592
- unref(hasIconBefore) ? (openBlock(), createBlock(
2593
- _sfc_main$9,
2594
- mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
2595
- null,
2596
- 16
2597
- /* FULL_PROPS */
2598
- )) : createCommentVNode("v-if", true),
2599
- withDirectives(createElementVNode("select", mergeProps({
2600
- id: unref(hasId),
2601
- ref_key: "selectEl",
2602
- ref: selectEl
2603
- }, unref(hasAttrs), {
2604
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
2605
- }), [
2606
- _ctx.placeholder ? (openBlock(), createElementBlock("option", {
2607
- key: 0,
2608
- value: void 0,
2609
- disabled: !unref(isUnselectable),
2610
- hidden: !unref(isUnselectable)
2611
- }, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("v-if", true),
2612
- (openBlock(true), createElementBlock(
2613
- Fragment,
2614
- null,
2615
- renderList(_ctx.options, (option, index) => {
2616
- return openBlock(), createElementBlock(
2617
- Fragment,
2618
- null,
2619
- [
2620
- !isGroup(option) ? (openBlock(), createElementBlock("option", {
2621
- key: index,
2622
- disabled: unref(isOptionDisabled)(option),
2623
- value: unref(getOptionValue)(option)
2624
- }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
2625
- key: `group-${index}`,
2626
- disabled: unref(isOptionDisabled)(option),
2627
- label: unref(getOptionLabel)(option)
2628
- }, [
2629
- (openBlock(true), createElementBlock(
2630
- Fragment,
2631
- null,
2632
- renderList(unref(getOptionGrouped)(option), (item, i) => {
2633
- return openBlock(), createElementBlock("option", {
2634
- key: `group-${index}-item-${i}`,
2635
- disabled: unref(isOptionDisabled)(item),
2636
- value: unref(getOptionValue)(item)
2637
- }, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
2638
- }),
2639
- 128
2640
- /* KEYED_FRAGMENT */
2641
- ))
2642
- ], 8, _hoisted_8$1))
2643
- ],
2644
- 64
2645
- /* STABLE_FRAGMENT */
2646
- );
2647
- }),
2648
- 256
2649
- /* UNKEYED_FRAGMENT */
2650
- ))
2651
- ], 16, _hoisted_5$1), [
2652
- [vModelSelect, unref(localModelValue)]
2653
- ]),
2654
- unref(hasIconAfter) ? (openBlock(), createBlock(
2655
- _sfc_main$9,
2656
- mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
2657
- null,
2658
- 16
2659
- /* FULL_PROPS */
2660
- )) : createCommentVNode("v-if", true)
2661
- ]),
2662
- unref(isUnselectable) && unref(propsDefaults).showClearAction ? (openBlock(), createBlock(unref(VvInputClearAction), {
2663
- key: 1,
2664
- "input-type": "select",
2665
- label: _ctx.labelClear,
2666
- icon: _ctx.iconClear,
2667
- disabled: !unref(isDirty),
2668
- onClear
2669
- }, null, 8, ["label", "icon", "disabled"])) : createCommentVNode("v-if", true),
2670
- _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
2671
- renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2672
- ])) : createCommentVNode("v-if", true)
2673
- ]),
2674
- createVNode(unref(HintSlot), {
2675
- id: unref(hasHintId),
2676
- class: "vv-select__hint"
2677
- }, createSlots({
2678
- _: 2
2679
- /* DYNAMIC */
2680
- }, [
2681
- _ctx.$slots.hint ? {
2682
- name: "hint",
2683
- fn: withCtx(() => [
2684
- renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
2685
- ]),
2686
- key: "0"
2687
- } : void 0,
2688
- _ctx.$slots.loading ? {
2689
- name: "loading",
2690
- fn: withCtx(() => [
2691
- renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
2692
- ]),
2693
- key: "1"
2694
- } : void 0,
2695
- _ctx.$slots.valid ? {
2696
- name: "valid",
2697
- fn: withCtx(() => [
2698
- renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
2699
- ]),
2700
- key: "2"
2701
- } : void 0,
2702
- _ctx.$slots.invalid ? {
2703
- name: "invalid",
2704
- fn: withCtx(() => [
2705
- renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
2706
- ]),
2707
- key: "3"
2708
- } : void 0
2709
- ]), 1032, ["id"])
2710
- ],
2711
- 2
2712
- /* CLASS */
2713
- );
2714
- };
2715
- }
2716
- });
2717
- const _hoisted_1 = ["id"];
2718
- const _hoisted_2 = ["id", "for"];
2719
- const _hoisted_3 = ["id", "aria-controls", "placeholder"];
2720
- const _hoisted_4 = {
2721
- key: 0,
2722
- class: "vv-select__input-before"
2723
- };
2724
- const _hoisted_5 = { class: "vv-select__inner" };
2725
- const _hoisted_6 = ["aria-controls", "aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
2726
- const _hoisted_7 = {
2727
- key: 0,
2728
- class: "vv-select__value"
2729
- };
2730
- const _hoisted_8 = ["aria-label", "onClick"];
2731
- const _hoisted_9 = {
2732
- key: 2,
2733
- class: "vv-select__input-after"
2734
- };
2735
- const __default__ = {
2736
- name: "VvCombobox",
2737
- components: {
2738
- VvDropdown: _sfc_main$5,
2739
- VvDropdownOption: _sfc_main$2,
2740
- VvDropdownOptgroup: _sfc_main$4,
2741
- VvButton: _sfc_main$6
2742
- }
2743
- };
2744
- const _sfc_main = /* @__PURE__ */ defineComponent({
2745
- ...__default__,
2746
- props: /* @__PURE__ */ mergeModels(useVvComboboxProps(), {
2747
- "search": {
2748
- type: String,
2749
- default: "",
2750
- required: false
2751
- },
2752
- "searchModifiers": {}
2753
- }),
2754
- emits: /* @__PURE__ */ mergeModels(["update:modelValue", "update:search", "update:options", "focus", "blur", "clear", "change:search"], ["update:search"]),
2755
- setup(__props, { emit: __emit }) {
2756
- const props = __props;
2757
- const emit = __emit;
2758
- const slots = useSlots();
2759
- const VvComboboxProps2 = useVvComboboxProps();
2760
- const propsDefaults = useDefaults(
2761
- "VvCombobox",
2762
- VvComboboxProps2,
2763
- props
2764
- );
2765
- const inputEl = ref(null);
2766
- const inputSearchEl = ref(null);
2767
- const wrapperEl = ref(null);
2768
- const dropdownEl = ref();
2769
- const {
2770
- HintSlot,
2771
- hasHintLabelOrSlot,
2772
- hasInvalidLabelOrSlot,
2773
- hintSlotScope
2774
- } = HintSlotFactory(propsDefaults, slots);
2775
- const { focused } = useComponentFocus(inputEl, emit);
2776
- const { focused: focusedWithin } = useFocusWithin(wrapperEl);
2777
- watch(focused, (newValue) => {
2778
- if (!props.autoOpen) {
2779
- return;
2780
- }
2781
- if (newValue && !expanded.value) {
2782
- expand();
2783
- return;
2784
- }
2785
- if (!newValue && expanded.value && !focusedWithin.value) {
2786
- collapse();
2787
- }
2788
- });
2789
- watch(focusedWithin, (newValue) => {
2790
- if (!focused.value && !newValue && expanded.value) {
2791
- collapse();
2792
- }
2793
- });
2794
- const searchText = useModel(__props, "search");
2795
- const debouncedSearchText = refDebounced(
2796
- searchText,
2797
- computed(() => Number(props.debounceSearch))
2798
- );
2799
- watch(debouncedSearchText, () => {
2800
- emit("update:search", debouncedSearchText.value);
2801
- emit("change:search", debouncedSearchText.value);
2802
- });
2803
- const expanded = ref(false);
2804
- function toggleExpanded() {
2805
- if (isDisabledOrReadonly.value)
2806
- return;
2807
- expanded.value = !expanded.value;
2808
- }
2809
- function expand() {
2810
- if (isDisabledOrReadonly.value || expanded.value)
2811
- return;
2812
- expanded.value = true;
2813
- }
2814
- function collapse() {
2815
- if (isDisabledOrReadonly.value || !expanded.value)
2816
- return;
2817
- expanded.value = false;
2818
- }
2819
- function onAfterExpand() {
2820
- if (propsDefaults.value.searchable) {
2821
- if (inputSearchEl.value) {
2822
- inputSearchEl.value.focus({
2823
- preventScroll: true
2824
- });
2825
- }
2826
- }
2827
- }
2828
- function onAfterCollapse() {
2829
- if (!propsDefaults.value.keepSearch) {
2830
- searchText.value = "";
2831
- }
2832
- }
2833
- function isGroup(option) {
2834
- if (typeof option === "string") {
2835
- return false;
2836
- }
2837
- return option.options?.length;
2838
- }
2839
- const {
2840
- id,
2841
- icon,
2842
- iconPosition,
2843
- modifiers,
2844
- disabled,
2845
- required,
2846
- readonly,
2847
- loading,
2848
- valid,
2849
- invalid,
2850
- floating
2851
- } = toRefs(props);
2852
- const hasId = useUniqueId(id);
2853
- const hasHintId = computed(() => `${hasId.value}-hint`);
2854
- const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
2855
- const hasSearchId = computed(() => `${hasId.value}-search`);
2856
- const hasLabelId = computed(() => `${hasId.value}-label`);
2857
- const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
2858
- const hasTabindex = computed(() => {
2859
- return isDisabledOrReadonly.value ? -1 : props.tabindex;
2860
- });
2861
- const localModelValue = computed({
2862
- get: () => {
2863
- if (Array.isArray(props.modelValue)) {
2864
- return props.modelValue;
2865
- }
2866
- return props.modelValue !== void 0 && props.modelValue !== null ? [props.modelValue] : [];
2867
- },
2868
- set: (value) => {
2869
- emit("update:modelValue", props.multiple || Array.isArray(props.modelValue) ? value : value.pop());
2870
- }
2871
- });
2872
- const sizeOfModelValue = computed(() => localModelValue.value.length);
2873
- const isDirty = computed(() => sizeOfModelValue.value > 0);
2874
- const hasMaxValues = computed(() => {
2875
- if (!props.multiple) {
2876
- return 1;
2877
- }
2878
- if (props.maxValues === void 0) {
2879
- return Infinity;
2880
- }
2881
- return Number(props.maxValues);
2882
- });
2883
- const isUnselectable = computed(() => {
2884
- if (isDisabledOrReadonly.value) {
2885
- return false;
2886
- }
2887
- if (!props.unselectable) {
2888
- return false;
2889
- }
2890
- return Number(props.minValues) === 0 || sizeOfModelValue.value > Number(props.minValues);
2891
- });
2892
- const isSelectable = computed(() => {
2893
- if (isDisabledOrReadonly.value) {
2894
- return false;
2895
- }
2896
- if (!props.multiple) {
2897
- return true;
2898
- }
2899
- return sizeOfModelValue.value < hasMaxValues.value;
2900
- });
2901
- const localLoading = ref(false);
2902
- const isLoading = computed(() => localLoading.value || loading.value);
2903
- const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
2904
- const bemCssClasses = useModifiers(
2905
- "vv-select",
2906
- modifiers,
2907
- computed(() => ({
2908
- "disabled": disabled.value,
2909
- "required": required.value,
2910
- "loading": isLoading.value,
2911
- "readonly": readonly.value,
2912
- "icon-before": hasIconBefore.value !== void 0,
2913
- "icon-after": hasIconAfter.value !== void 0,
2914
- "valid": valid.value,
2915
- "invalid": invalid.value,
2916
- "dirty": isDirty.value,
2917
- "focus": (focused.value || focusedWithin.value || expanded.value) && !isDisabledOrReadonly.value,
2918
- "floating": floating.value,
2919
- "badges": props.badges
2920
- }))
2921
- );
2922
- const addedOptions = ref(/* @__PURE__ */ new Set());
2923
- const {
2924
- getOptionLabel,
2925
- getOptionValue,
2926
- getOptionGrouped,
2927
- isOptionDisabled
2928
- } = useOptions(props);
2929
- const hasOptions = computed(() => {
2930
- const toReturn = [...props.options, ...addedOptions.value];
2931
- for (const item of localModelValue.value) {
2932
- if (!toReturn.some((option) => {
2933
- const optionValue = getOptionValue(option);
2934
- if (typeof optionValue === "object" && typeof item === "object") {
2935
- return JSON.stringify(optionValue) === JSON.stringify(item);
2936
- }
2937
- return optionValue === item;
2938
- })) {
2939
- toReturn.push(item);
2940
- }
2941
- }
2942
- return toReturn;
2943
- });
2944
- watch(addedOptions, (newValue) => {
2945
- if (newValue.size > 0) {
2946
- emit("update:options", hasOptions.value);
2947
- }
2948
- });
2949
- function isOptionDisabledOrNotSelectable(option) {
2950
- return isOptionDisabled(option) || !isSelectable.value && !isOptionSelected(option);
2951
- }
2952
- const filteredOptions = computedAsync(async () => {
2953
- if (propsDefaults.value.searchFunction) {
2954
- localLoading.value = true;
2955
- const toReturn = await Promise.resolve(
2956
- propsDefaults.value.searchFunction(
2957
- debouncedSearchText.value,
2958
- hasOptions.value
2959
- )
2960
- );
2961
- localLoading.value = false;
2962
- return toReturn;
2963
- }
2964
- return hasOptions.value?.filter((option) => {
2965
- return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
2966
- });
2967
- });
2968
- function isOptionSelected(option) {
2969
- const optionValue = getOptionValue(option);
2970
- if (typeof optionValue === "object") {
2971
- return localModelValue.value.some((item) => {
2972
- if (typeof item === "object") {
2973
- return JSON.stringify(item) === JSON.stringify(optionValue);
2974
- }
2975
- return false;
2976
- });
2977
- }
2978
- return localModelValue.value.includes(optionValue);
2979
- }
2980
- const selectedOptions = computed(() => {
2981
- const toReturn = hasOptions.value.reduce(
2982
- (acc, value) => {
2983
- if (isGroup(value)) {
2984
- return [...acc, ...getOptionGrouped(value)];
2985
- }
2986
- return [...acc, value];
2987
- },
2988
- []
2989
- );
2990
- return toReturn.filter((option) => {
2991
- return isOptionSelected(option);
2992
- });
2993
- });
2994
- const hasValue = computed(() => {
2995
- return selectedOptions.value.map((option) => getOptionLabel(option)).join(props.separator);
2996
- });
2997
- function onClickInput() {
2998
- props.autoOpen ? expand() : toggleExpanded();
2999
- }
3000
- function onInput(option) {
3001
- const isSelected = isOptionSelected(option);
3002
- const optionValue = getOptionValue(option);
3003
- if (isSelected && isUnselectable.value) {
3004
- localModelValue.value = localModelValue.value.filter((item) => {
3005
- if (typeof optionValue === "object" && typeof item === "object") {
3006
- return JSON.stringify(item) !== JSON.stringify(optionValue);
3007
- }
3008
- return item !== optionValue;
3009
- });
3010
- } else if (!isSelected && isSelectable.value) {
3011
- if (!props.multiple) {
3012
- localModelValue.value = [optionValue];
3013
- } else {
3014
- localModelValue.value = [...localModelValue.value, optionValue];
3015
- }
3016
- }
3017
- if (!props.multiple && !props.keepOpen) {
3018
- collapse();
3019
- }
3020
- }
3021
- function onClear() {
3022
- localModelValue.value = [];
3023
- emit("update:search", "");
3024
- emit("clear");
3025
- }
3026
- watch(
3027
- hasOptions,
3028
- (newValue) => {
3029
- if (newValue?.length && props.autoselectFirst && !isDirty.value) {
3030
- onInput(newValue[0]);
3031
- }
3032
- },
3033
- { immediate: true }
3034
- );
3035
- const selectProps = computed(() => ({
3036
- id: hasId.value,
3037
- name: props.name,
3038
- tabindex: hasTabindex.value,
3039
- valid: valid.value,
3040
- validLabel: propsDefaults.value.validLabel,
3041
- invalid: invalid.value,
3042
- invalidLabel: propsDefaults.value.invalidLabel,
3043
- hintLabel: propsDefaults.value.hintLabel,
3044
- loading: isLoading.value,
3045
- loadingLabel: propsDefaults.value.loadingLabel,
3046
- disabled: disabled.value,
3047
- readonly: readonly.value,
3048
- modifiers: propsDefaults.value.modifiers,
3049
- options: propsDefaults.value.options,
3050
- labelKey: propsDefaults.value.labelKey,
3051
- valueKey: propsDefaults.value.valueKey,
3052
- icon: propsDefaults.value.icon,
3053
- iconPosition: propsDefaults.value.iconPosition,
3054
- floating: propsDefaults.value.floating,
3055
- unselectable: isUnselectable.value,
3056
- autoselectFirst: propsDefaults.value.autoselectFirst,
3057
- multiple: propsDefaults.value.multiple,
3058
- label: propsDefaults.value.label,
3059
- placeholder: propsDefaults.value.placeholder,
3060
- modelValue: props.modelValue
3061
- }));
3062
- const dropdownProps = computed(() => ({
3063
- id: hasDropdownId.value,
3064
- reference: wrapperEl.value,
3065
- placement: propsDefaults.value.placement,
3066
- strategy: propsDefaults.value.strategy,
3067
- transitionName: propsDefaults.value.transitionName,
3068
- offset: propsDefaults.value.offset,
3069
- shift: propsDefaults.value.shift,
3070
- flip: propsDefaults.value.flip,
3071
- autoPlacement: propsDefaults.value.autoPlacement,
3072
- arrow: propsDefaults.value.arrow,
3073
- autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
3074
- triggerWidth: propsDefaults.value.triggerWidth,
3075
- modifiers: propsDefaults.value.dropdownModifiers
3076
- }));
3077
- const slotProps = computed(() => ({
3078
- valid: props.valid,
3079
- invalid: props.invalid,
3080
- modelValue: props.modelValue
3081
- }));
3082
- onKeyStroke(
3083
- [" ", "Enter"],
3084
- (e) => {
3085
- if (props.autoOpen) {
3086
- return;
3087
- }
3088
- if (!expanded.value && focused.value) {
3089
- e.preventDefault();
3090
- e.stopImmediatePropagation();
3091
- toggleExpanded();
3092
- }
3093
- },
3094
- { target: inputEl }
3095
- );
3096
- function onKeyupEnterInputSearch() {
3097
- if (filteredOptions.value?.length) {
3098
- if (filteredOptions.value.length === 1) {
3099
- onInput(filteredOptions.value[0]);
3100
- return;
3101
- }
3102
- dropdownEl.value?.focusFirstListElement();
3103
- return;
3104
- }
3105
- if (propsDefaults.value.addable) {
3106
- const trimmedSearch = searchText.value.trim();
3107
- if (!trimmedSearch) {
3108
- return;
3109
- }
3110
- const exists = hasOptions.value.some(
3111
- (opt) => getOptionLabel(opt).toLowerCase() === trimmedSearch.toLowerCase()
3112
- );
3113
- if (exists) {
3114
- return;
3115
- }
3116
- addedOptions.value.add(trimmedSearch);
3117
- onInput(trimmedSearch);
3118
- }
3119
- }
3120
- return (_ctx, _cache) => {
3121
- return !_ctx.native ? (openBlock(), createElementBlock("div", {
3122
- key: 0,
3123
- id: unref(hasId),
3124
- class: normalizeClass(unref(bemCssClasses))
3125
- }, [
3126
- _ctx.label ? (openBlock(), createElementBlock("label", {
3127
- key: 0,
3128
- id: unref(hasLabelId),
3129
- for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
3130
- }, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("v-if", true),
3131
- createElementVNode(
3132
- "div",
3133
- {
3134
- ref_key: "wrapperEl",
3135
- ref: wrapperEl,
3136
- class: "vv-select__wrapper"
3137
- },
3138
- [
3139
- createVNode(_sfc_main$5, mergeProps({
3140
- ref_key: "dropdownEl",
3141
- ref: dropdownEl,
3142
- modelValue: unref(expanded),
3143
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(expanded) ? expanded.value = $event : null)
3144
- }, unref(dropdownProps), {
3145
- role: unref(DropdownRole).listbox,
3146
- onAfterExpand,
3147
- onAfterCollapse
3148
- }), createSlots({
3149
- default: withCtx(({ aria }) => [
3150
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
3151
- renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
3152
- ])) : createCommentVNode("v-if", true),
3153
- createElementVNode("div", _hoisted_5, [
3154
- unref(hasIconBefore) ? (openBlock(), createBlock(
3155
- _sfc_main$9,
3156
- mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
3157
- null,
3158
- 16
3159
- /* FULL_PROPS */
3160
- )) : createCommentVNode("v-if", true),
3161
- createElementVNode("div", mergeProps({
3162
- ref_key: "inputEl",
3163
- ref: inputEl
3164
- }, aria, {
3165
- class: "vv-select__input",
3166
- role: "combobox",
3167
- "aria-controls": unref(hasDropdownId),
3168
- "aria-expanded": unref(expanded),
3169
- "aria-labelledby": unref(hasLabelId),
3170
- "aria-describedby": unref(hasHintLabelOrSlot) ? unref(hasHintId) : void 0,
3171
- "aria-errormessage": unref(hasInvalidLabelOrSlot) ? unref(hasHintId) : void 0,
3172
- tabindex: unref(hasTabindex),
3173
- onClickPassive: onClickInput
3174
- }), [
3175
- unref(hasValue) ? renderSlot(_ctx.$slots, "value", normalizeProps(mergeProps({ key: 0 }, { selectedOptions: unref(selectedOptions), onInput })), () => [
3176
- !_ctx.badges ? (openBlock(), createElementBlock(
3177
- "div",
3178
- _hoisted_7,
3179
- toDisplayString(unref(hasValue)),
3180
- 1
3181
- /* TEXT */
3182
- )) : (openBlock(true), createElementBlock(
3183
- Fragment,
3184
- { key: 1 },
3185
- renderList(unref(selectedOptions), (option, index) => {
3186
- return openBlock(), createBlock(_sfc_main$8, {
3187
- key: index,
3188
- modifiers: _ctx.badgeModifiers,
3189
- class: "vv-select__badge"
3190
- }, {
3191
- default: withCtx(() => [
3192
- createTextVNode(
3193
- toDisplayString(unref(getOptionLabel)(option)) + " ",
3194
- 1
3195
- /* TEXT */
3196
- ),
3197
- unref(isUnselectable) ? (openBlock(), createElementBlock("button", {
3198
- key: 0,
3199
- "aria-label": unref(propsDefaults).deselectActionLabel,
3200
- type: "button",
3201
- onClick: withModifiers(($event) => onInput(option), ["stop"])
3202
- }, [
3203
- createVNode(_sfc_main$9, { name: "close" })
3204
- ], 8, _hoisted_8)) : createCommentVNode("v-if", true)
3205
- ]),
3206
- _: 2
3207
- /* DYNAMIC */
3208
- }, 1032, ["modifiers"]);
3209
- }),
3210
- 128
3211
- /* KEYED_FRAGMENT */
3212
- ))
3213
- ]) : renderSlot(_ctx.$slots, "placeholder", { key: 1 }, () => [
3214
- createTextVNode(
3215
- toDisplayString(_ctx.placeholder),
3216
- 1
3217
- /* TEXT */
3218
- )
3219
- ])
3220
- ], 16, _hoisted_6),
3221
- unref(hasIconAfter) ? (openBlock(), createBlock(
3222
- _sfc_main$9,
3223
- mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
3224
- null,
3225
- 16
3226
- /* FULL_PROPS */
3227
- )) : createCommentVNode("v-if", true)
3228
- ]),
3229
- unref(isUnselectable) && unref(propsDefaults).showClearAction ? (openBlock(), createBlock(unref(VvInputClearAction), {
3230
- key: 1,
3231
- "input-type": "select",
3232
- label: _ctx.labelClear,
3233
- icon: _ctx.iconClear,
3234
- disabled: !unref(isDirty),
3235
- onClear
3236
- }, null, 8, ["label", "icon", "disabled"])) : createCommentVNode("v-if", true),
3237
- _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_9, [
3238
- renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
3239
- ])) : createCommentVNode("v-if", true)
3240
- ]),
3241
- items: withCtx(() => [
3242
- !unref(disabled) && unref(filteredOptions)?.length ? (openBlock(true), createElementBlock(
3243
- Fragment,
3244
- { key: 0 },
3245
- renderList(unref(filteredOptions), (option, index) => {
3246
- return openBlock(), createElementBlock(
3247
- Fragment,
3248
- { key: index },
3249
- [
3250
- isGroup(option) ? (openBlock(), createElementBlock(
3251
- Fragment,
3252
- { key: 0 },
3253
- [
3254
- createVNode(_sfc_main$4, {
3255
- label: unref(getOptionLabel)(option)
3256
- }, null, 8, ["label"]),
3257
- (openBlock(true), createElementBlock(
3258
- Fragment,
3259
- null,
3260
- renderList(unref(getOptionGrouped)(
3261
- option
3262
- ), (item, i) => {
3263
- return openBlock(), createBlock(_sfc_main$2, mergeProps({ ref_for: true }, {
3264
- selected: isOptionSelected(item),
3265
- disabled: isOptionDisabledOrNotSelectable(item),
3266
- unselectable: unref(isUnselectable),
3267
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
3268
- selectHintLabel: unref(propsDefaults).selectHintLabel,
3269
- selectedHintLabel: unref(propsDefaults).selectedHintLabel,
3270
- focusOnHover: _ctx.focusOnHover
3271
- }, {
3272
- key: i,
3273
- class: "vv-dropdown-option",
3274
- onClickPassive: ($event) => onInput(item)
3275
- }), {
3276
- default: withCtx(() => [
3277
- renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
3278
- option,
3279
- selectedOptions: unref(selectedOptions),
3280
- selected: isOptionSelected(item),
3281
- disabled: isOptionDisabledOrNotSelectable(item)
3282
- }), () => [
3283
- createTextVNode(
3284
- toDisplayString(unref(getOptionLabel)(item)),
3285
- 1
3286
- /* TEXT */
3287
- )
3288
- ])
3289
- ]),
3290
- _: 2
3291
- /* DYNAMIC */
3292
- }, 1040, ["onClickPassive"]);
3293
- }),
3294
- 128
3295
- /* KEYED_FRAGMENT */
3296
- ))
3297
- ],
3298
- 64
3299
- /* STABLE_FRAGMENT */
3300
- )) : (openBlock(), createBlock(_sfc_main$2, mergeProps({
3301
- key: 1,
3302
- ref_for: true
3303
- }, {
3304
- selected: isOptionSelected(option),
3305
- disabled: isOptionDisabledOrNotSelectable(option),
3306
- unselectable: unref(isUnselectable),
3307
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
3308
- selectHintLabel: unref(propsDefaults).selectHintLabel,
3309
- selectedHintLabel: unref(propsDefaults).selectedHintLabel,
3310
- focusOnHover: _ctx.focusOnHover
3311
- }, {
3312
- class: "vv-dropdown-option",
3313
- onClickPassive: ($event) => onInput(option)
3314
- }), {
3315
- default: withCtx(() => [
3316
- renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
3317
- option,
3318
- selectedOptions: unref(selectedOptions),
3319
- selected: isOptionSelected(option),
3320
- disabled: isOptionDisabledOrNotSelectable(option)
3321
- }), () => [
3322
- createTextVNode(
3323
- toDisplayString(unref(getOptionLabel)(option)),
3324
- 1
3325
- /* TEXT */
3326
- )
3327
- ])
3328
- ]),
3329
- _: 2
3330
- /* DYNAMIC */
3331
- }, 1040, ["onClickPassive"]))
3332
- ],
3333
- 64
3334
- /* STABLE_FRAGMENT */
3335
- );
3336
- }),
3337
- 128
3338
- /* KEYED_FRAGMENT */
3339
- )) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$2, {
3340
- key: 1,
3341
- modifiers: "inert"
3342
- }, {
3343
- default: withCtx(() => [
3344
- renderSlot(_ctx.$slots, "no-options", {}, () => [
3345
- createTextVNode(
3346
- toDisplayString(unref(propsDefaults).addable && searchText.value.length ? unref(propsDefaults).addOptionHintLabel : unref(propsDefaults).noOptionsLabel),
3347
- 1
3348
- /* TEXT */
3349
- )
3350
- ])
3351
- ]),
3352
- _: 3
3353
- /* FORWARDED */
3354
- })) : (openBlock(), createBlock(_sfc_main$2, {
3355
- key: 2,
3356
- modifiers: "inert"
3357
- }, {
3358
- default: withCtx(() => [
3359
- renderSlot(_ctx.$slots, "no-results", {}, () => [
3360
- createTextVNode(
3361
- toDisplayString(unref(propsDefaults).addable ? unref(propsDefaults).addOptionHintLabel : unref(propsDefaults).noResultsLabel),
3362
- 1
3363
- /* TEXT */
3364
- )
3365
- ])
3366
- ]),
3367
- _: 3
3368
- /* FORWARDED */
3369
- }))
3370
- ]),
3371
- after: withCtx(() => [
3372
- renderSlot(_ctx.$slots, "dropdown::after", {}, () => [
3373
- unref(dropdownEl)?.customPosition ? (openBlock(), createBlock(_sfc_main$6, {
3374
- key: 0,
3375
- label: unref(propsDefaults).closeLabel,
3376
- modifiers: "secondary",
3377
- onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
3378
- }, null, 8, ["label"])) : createCommentVNode("v-if", true)
3379
- ])
3380
- ]),
3381
- _: 2
3382
- /* DYNAMIC */
3383
- }, [
3384
- unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
3385
- name: "before",
3386
- fn: withCtx(() => [
3387
- renderSlot(_ctx.$slots, "dropdown::before"),
3388
- unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
3389
- key: 0,
3390
- id: unref(hasSearchId),
3391
- ref_key: "inputSearchEl",
3392
- ref: inputSearchEl,
3393
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
3394
- "aria-autocomplete": "list",
3395
- "aria-controls": unref(hasDropdownId),
3396
- autocomplete: "off",
3397
- spellcheck: "false",
3398
- type: "search",
3399
- class: "vv-dropdown__search",
3400
- placeholder: unref(propsDefaults).searchPlaceholder,
3401
- onKeyup: withKeys(onKeyupEnterInputSearch, ["enter"])
3402
- }, null, 40, _hoisted_3)), [
3403
- [vModelText, searchText.value]
3404
- ]) : createCommentVNode("v-if", true)
3405
- ]),
3406
- key: "0"
3407
- } : void 0
3408
- ]), 1040, ["modelValue", "role"])
3409
- ],
3410
- 512
3411
- /* NEED_PATCH */
3412
- ),
3413
- createVNode(unref(HintSlot), {
3414
- id: unref(hasHintId),
3415
- class: "vv-select__hint"
3416
- }, createSlots({
3417
- _: 2
3418
- /* DYNAMIC */
3419
- }, [
3420
- _ctx.$slots.hint ? {
3421
- name: "hint",
3422
- fn: withCtx(() => [
3423
- renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
3424
- ]),
3425
- key: "0"
3426
- } : void 0,
3427
- _ctx.$slots.loading ? {
3428
- name: "loading",
3429
- fn: withCtx(() => [
3430
- renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
3431
- ]),
3432
- key: "1"
3433
- } : void 0,
3434
- _ctx.$slots.valid ? {
3435
- name: "valid",
3436
- fn: withCtx(() => [
3437
- renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
3438
- ]),
3439
- key: "2"
3440
- } : void 0,
3441
- _ctx.$slots.invalid ? {
3442
- name: "invalid",
3443
- fn: withCtx(() => [
3444
- renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
3445
- ]),
3446
- key: "3"
3447
- } : void 0
3448
- ]), 1032, ["id"])
3449
- ], 10, _hoisted_1)) : (openBlock(), createBlock(
3450
- _sfc_main$1,
3451
- mergeProps({ key: 1 }, unref(selectProps), {
3452
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => emit("update:modelValue", $event))
3453
- }),
3454
- null,
3455
- 16
3456
- /* FULL_PROPS */
3457
- ));
3458
- };
3459
- }
3460
- });
3461
- export {
3462
- _sfc_main as default
3463
- };
1
+ import{computed as e,isRef as t,defineComponent as l,h as a,inject as o,unref as n,mergeDefaults as i,ref as r,toRefs as u,createBlock as s,createCommentVNode as d,openBlock as v,mergeProps as c,createElementBlock as f,normalizeClass as p,renderSlot as b,createTextVNode as y,toDisplayString as m,toRef as g,getCurrentInstance as h,watch as S,resolveComponent as L,resolveDynamicComponent as k,withCtx as O,useId as $,useAttrs as w,useSlots as _,Fragment as x,provide as V,onMounted as B,createVNode as A,normalizeProps as C,guardReactiveProps as H,Transition as N,toHandlers as P,withDirectives as E,createElementVNode as j,normalizeStyle as F,vShow as I,nextTick as D,renderList as M,vModelSelect as q,createSlots as z,mergeModels as K,useModel as T,withModifiers as W,withKeys as G,vModelText as J}from"vue";import{iconLoaded as R,Icon as U,addIcon as Q}from"@iconify/vue";import{autoPlacement as X,flip as Y,shift as Z,size as ee,offset as te,arrow as le,useFloating as ae,autoUpdate as oe}from"@floating-ui/vue";import{useMutationObserver as ne,useVModel as ie,onClickOutside as re,useFocusWithin as ue,useElementHover as se,onKeyStroke as de,useFocus as ve,useElementVisibility as ce,refDebounced as fe,computedAsync as pe}from"@vueuse/core";import be from"mitt";import{getProperty as ye}from"dot-prop";const me={prefix:"normal"};var ge=/* @__PURE__ */(e=>(e.local="local",e.session="session",e))(ge||{}),he=/* @__PURE__ */(e=>(e.absolute="absolute",e.fixed="fixed",e))(he||{}),Se=/* @__PURE__ */(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(Se||{}),Le=/* @__PURE__ */(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))(Le||{}),ke=/* @__PURE__ */(e=>(e.before="before",e.after="after",e))(ke||{}),Oe=/* @__PURE__ */(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(Oe||{}),$e=/* @__PURE__ */(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))($e||{}),we=/* @__PURE__ */(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(we||{}),_e=/* @__PURE__ */(e=>(e.listbox="listbox",e.menu="menu",e))(_e||{}),xe=/* @__PURE__ */(e=>(e.option="option",e.presentation="presentation",e))(xe||{});const Ve=/* @__PURE__ */Symbol.for("volver"),Be=/* @__PURE__ */Symbol.for("buttonGroup"),Ae=/* @__PURE__ */Symbol.for("dropdownTrigger"),Ce=/* @__PURE__ */Symbol.for("dropdownItem"),He=/* @__PURE__ */Symbol.for("dropdownAction"),Ne={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},Pe={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},Ee={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},je={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},Fe={disabled:{type:Boolean,default:!1}},Ie={required:{type:Boolean,default:!1}},De={selected:{type:Boolean,default:!1}},Me={active:{type:Boolean,default:!1}},qe={current:{type:Boolean,default:!1}},ze={showClearAction:{type:Boolean,default:!1},iconClear:{type:[String,Object],default:"close"},labelClear:{type:String,default:"Clear"}},Ke={pressed:{type:Boolean,default:!1}},Te={label:{type:[String,Number],default:void 0}},We={readonly:{type:Boolean,default:!1}},Ge={modifiers:{type:[String,Array],default:void 0}},Je={hintLabel:{type:String,default:""}},Re={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},Ue={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:ke.before,validation:e=>Object.values(ke).includes(e)}},Qe={tabindex:{type:[String,Number],default:0}},Xe={floating:{type:Boolean,default:!1}},Ye={unselectable:{type:Boolean,default:!0}},Ze={id:[String,Number]},et={placement:{type:String,default:Se.bottom,validator:e=>Object.values(Se).includes(e)||Object.values(Le).includes(e)},strategy:{type:String,default:void 0,validator:e=>Object.values(he).includes(e)},transitionName:{type:String,default:void 0},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,default:!1}},tt={...Ze,name:{type:String,required:!0}},lt={autofocus:{type:Boolean,default:!1}},at={autocomplete:{type:String,default:"off"}},ot={...Fe,...Te,...Ke,...Me,...qe,...Ne,type:{type:String,default:Oe.button,validator:e=>Object.values(Oe).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:$e.button}};ge.local;const nt={...tt,...Qe,...Pe,...Ee,...Je,...je,...Fe,...We,...Ge,...Re,...Ue,...Xe,...et,...Te,...Ie,...ze,transitionName:{type:String,default:"vv-dropdown--mobile-fade-block"},modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},noResultsLabel:{type:String,default:"No results"},noOptionsLabel:{type:String,default:"No options available"},selectedOptionNotFoundLabel:{type:String,default:"Selected option not found"},selectedHintLabel:{type:String,default:"Selected"},deselectActionLabel:{type:String,default:"Deselect"},selectHintLabel:{type:String,default:"Press enter to select"},deselectHintLabel:{type:String,default:"Press enter to remove"},addOptionHintLabel:{type:String,default:"Press enter to add"},closeLabel:{type:String,default:"Close"},placeholder:String,addable:Boolean,searchable:Boolean,keepSearch:Boolean,searchFunction:{type:Function,default:void 0},searchPlaceholder:{type:String,default:"Search..."},debounceSearch:{type:[Number,String],default:0},multiple:Boolean,minValues:{type:[Number,String],default:0},maxValues:[Number,String],unselectable:{type:Boolean,default:!0},separator:{type:String,default:", "},native:Boolean,badges:Boolean,badgeModifiers:{type:[String,Array],default:"action sm"},triggerWidth:{...et.triggerWidth,default:!0},dropdownModifiers:{type:[String,Array],default:"mobile"},autoOpen:{type:Boolean,default:!1},autoselectFirst:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},focusOnHover:{type:Boolean,default:!0}};function it(){return{...nt,options:{...nt.options,type:Array},searchFunction:{...nt.searchFunction,type:Function}}}function rt(e,t,l){return ut(e,t)}function ut(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!ut(e[o],t[o]))return!1;return!0}if(l!==a)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 s=e instanceof RegExp,d=t instanceof RegExp;if(s!==d)return!1;if(s&&d)return e.toString()===t.toString();const v=Object.keys(e);if(n=v.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=n;0!==o--;)if(i=v[o],!ut(e[i],t[i]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function st(e,t){if(null!=e&&t&&t.length)for(const l of t)if(rt(e,l))return!0;return!1}function dt(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).join(" "):e}function vt(o,n){const i=e(()=>t(o)?o.value:o),r=e(()=>dt(i.value.invalidLabel)),u=e(()=>dt(i.value.validLabel)),s=e(()=>i.value.loadingLabel),d=e(()=>i.value.hintLabel),v=e(()=>Boolean(i.value.loading&&(n.loading||s.value))),c=e(()=>!v.value&&Boolean(i.value.invalid&&(n.invalid||r.value))),f=e(()=>!v.value&&!c.value&&Boolean(i.value.valid&&(n.valid||u.value))),p=e(()=>!v.value&&!c.value&&!f.value&&Boolean(n.hint||d.value)),b=e(()=>c.value||f.value||v.value||p.value),y=e(()=>({modelValue:i.value.modelValue,valid:i.value.valid,invalid:i.value.invalid,loading:i.value.loading})),m=l({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:b,invalidLabel:r,validLabel:u,loadingLabel:s,hintLabel:d,hasInvalidLabelOrSlot:c,hasValidLabelOrSlot:f,hasLoadingLabelOrSlot:v,hasHintLabelOrSlot:p}),render(){if(this.isVisible){let e;return this.hasInvalidLabelOrSlot&&(e="alert"),this.hasValidLabelOrSlot&&(e="status"),this.hasLoadingLabelOrSlot?a(this.tag,{role:e},this.$slots.loading?.()??this.loadingLabel):this.hasInvalidLabelOrSlot?a(this.tag,{role:e},this.$slots.invalid?.()??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?a(this.tag,{role:e},this.$slots.valid?.()??this.validLabel):a(this.tag,{role:e},this.$slots.hint?.()??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:c,hasHintLabelOrSlot:p,hasValidLabelOrSlot:f,hasLoadingLabelOrSlot:v,hintSlotScope:y,HintSlot:m}}function ct(){return o(Ve,void 0)}function ft(t,l,a){return e(()=>{const e={[t]:!0},o="string"==typeof l?.value?l.value.split(" "):l?.value;return o&&Array.isArray(o)&&o.forEach(l=>{l&&(e[`${t}--${l}`]=!0)}),a&&Object.keys(a.value).forEach(l=>{e[`${t}--${l}`]=n(a.value[l])}),e})}const pt=/* @__PURE__ */l({name:"VvIcon",props:/* @__PURE__ */i({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},me),setup(t){const l=t,a=e(()=>"string"==typeof l.rotate?Number.parseFloat(l.rotate):l.rotate),o=r(!0),i=ct(),{modifiers:f}=u(l),p=ft("vv-icon",f),b=e(()=>l.provider||i?.iconsProvider),y=e(()=>{const e=l.name??"",t=`@${b.value}:${l.prefix}:${e}`;if(R(t))return t;const a=i?.iconsCollections.find(t=>{const l=`@${b.value}:${t.prefix}:${e}`;return R(l)});return a?`@${b.value}:${a.prefix}:${e}`:e});function m(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=t?.innerHTML.trim()||"";t&&a&&Q(`@${b.value}:${l.prefix}:${l.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&l.src&&!R(`@${b.value}:${l.prefix}:${l.name}`)&&(o.value=!1,i.fetchIcon(l.src).then(e=>{e&&(m(e),o.value=!0)}).catch(e=>{throw new Error(`Error during fetch icon: ${e?.message}`)})),l.svg&&m(l.svg),(e,l)=>n(o)?(v(),s(n(U),c({key:0,class:n(p)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:n(a),color:t.color,icon:n(y)},{onLoad:t.onLoad}),null,16,["class","onLoad"])):d("v-if",!0)}});function bt(t,l){const a=e(()=>"string"==typeof t?.value?{name:t?.value}:t?.value),o=e(()=>l?.value===ke.before?a.value:void 0),n=e(()=>l?.value===ke.after?a.value:void 0),i=e(()=>l?.value===Se.left?a.value:void 0),r=e(()=>l?.value===Se.right?a.value:void 0),u=e(()=>l?.value===Se.top?a.value:void 0),s=e(()=>l?.value===Se.bottom?a.value:void 0);return{hasIcon:a,hasIconLeft:i,hasIconRight:r,hasIconTop:u,hasIconBottom:s,hasIconBefore:o,hasIconAfter:n}}const yt=l({components:{VvIcon:pt},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:l}){const{hasIcon:a}=bt(e(()=>t.icon));return{hasIcon:a,onClick:function(e){e?.stopPropagation(),t.disabled||l("clear")}}},render(){const e=this.hasIcon?a(pt,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return a("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},e)}}),mt={...Ge,value:[String,Number]},gt=/* @__PURE__ */l({name:"VvBadge",props:mt,setup(e){const t=e,{modifiers:l}=u(t),a=ft("vv-badge",l);return(e,t)=>(v(),f("span",{class:p(n(a))},[b(e.$slots,"default",{},()=>[y(m(e.value),1)])],2))}});const ht={...ot,...Ze,...Ge,...Ye,...je,...Ue,iconPosition:{type:String,default:Se.left,validator:e=>Object.values(Se).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function St(t,l){const{group:a,isInGroup:n,getGroupOrLocalRef:i}=function(t){const l=o(t,void 0),a=e(()=>void 0!==l);return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const n=l?.[t];if(n)return e({get:()=>n.value,set(e){n.value=e}});const i=g(a,t);return e({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(Be),{id:r,iconPosition:s,icon:d,label:v,pressed:c}=u(t),f=i("modelValue",t,l),p=i("toggle",t),b=i("unselectable",t),y=e(()=>a?.multiple.value??!1),m=e(()=>{let e=t.modifiers,l=a?.modifiers.value;const o=/* @__PURE__ */new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach(e=>o.add(e))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach(e=>o.add(e))),Array.from(o)}),h=e(()=>Boolean(t.disabled||a?.disabled.value));return{group:a,isInGroup:n,modelValue:f,toggle:p,unselectable:b,multiple:y,modifiers:m,disabled:h,id:r,pressed:c,iconPosition:s,icon:d,label:v}}const Lt=/* @__PURE__ */l({name:"VvAction",props:ot,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:a}){const i=t,u=a,d=h(),f=ct(),p=r(null);l({$el:p});const{reference:g,bus:$,aria:w,expanded:_}=o(Ae,{});S(()=>p.value,e=>{g&&(g.value=e)});const x=e(()=>i.pressed||_?.value),{role:V}=o(He,{}),B=e(()=>{switch(!0){case i.disabled:return $e.button;case void 0!==i.to:return f?.nuxt?L($e.nuxtLink):$e.routerLink;case void 0!==i.href:return $e.a;default:return i.defaultTag}}),A=e(()=>{const e={...w?.value,ariaPressed:!!x.value||void 0,ariaLabel:i.ariaLabel,role:V?.value};switch(B.value){case $e.a:return{...e,href:i.href,target:i.target,rel:i.rel};case $e.routerLink:case $e.nuxtLink:return{...e,to:i.to,target:i.target};case $e.button:return{...e,type:i.type,disabled:i.disabled};default:return e}});function C(e){i.disabled?e.preventDefault():d?.vnode.props?.onClick?u("click",e):$?.emit("click",e)}function H(e){d?.vnode.props?.onMouseover?u("mouseover",e):$?.emit("mouseover",e)}function N(e){d?.vnode.props?.onMouseleave?u("mouseleave",e):$?.emit("mouseleave",e)}return(e,t)=>(v(),s(k(n(B)),c(n(A),{ref_key:"rootEl",ref:p,class:{active:e.active,pressed:n(x),disabled:e.disabled,current:e.current},onClickPassive:C,onMouseoverPassive:H,onMouseleavePassive:N}),{default:O(()=>[b(e.$slots,"default",{},()=>[y(m(e.label),1)])]),_:3},16,["class"]))}});function kt(t){return e(()=>String(t?.value||$()))}const Ot={key:1,class:"vv-button__label"},$t={key:1,class:"vv-button__label"},wt=/* @__PURE__ */l({name:"VvButton",inheritAttrs:!1,props:ht,emits:["update:modelValue"],setup(t,{expose:l,emit:a}){const o=t,i=a,u=w(),p=_(),{id:g,modifiers:h,iconPosition:S,icon:L,label:k,modelValue:$,disabled:V,toggle:B,unselectable:A}=St(o,i),C=kt(g),H=e(()=>u?.name||C.value),N=r(null);l({$el:e(()=>N.value?.$el)});const P=e(()=>B.value?Array.isArray($.value)?st(H.value,$.value):rt(H.value,$.value):o.pressed),E=ft("vv-button",h,e(()=>({reverse:[Se.right,Se.bottom].includes(S.value),column:[Se.top,Se.bottom].includes(S.value),"icon-only":Boolean(L?.value&&!k?.value&&!p.default)}))),{hasIcon:j}=bt(L),F=e(()=>void 0!==o.value?o.value:H.value),I=e(()=>{if(B.value)return{onClick:D}});function D(){if(B.value){if(Array.isArray($.value))return st(F.value,$.value)?void(A.value&&($.value=$.value.filter(e=>e!==F.value))):void $.value.push(F.value);if(F.value===$.value&&A.value)return void($.value=o.uncheckedValue);$.value=F.value}}return(e,t)=>(v(),s(Lt,c({...n(u),...n(I),disabled:n(V),pressed:n(P),active:e.active,type:e.type,to:e.to,href:e.href,target:e.target,rel:e.rel,ariaLabel:e.ariaLabel},{id:n(C),ref_key:"rootEl",ref:N,class:n(E)}),{default:O(()=>[b(e.$slots,"default",{},()=>[e.loading?b(e.$slots,"loading",{key:0},()=>[e.loadingIcon?(v(),s(pt,{key:0,class:"vv-button__loading-icon",name:e.loadingIcon},null,8,["name"])):d("v-if",!0),e.loadingLabel?(v(),f("span",Ot,m(e.loadingLabel),1)):d("v-if",!0)]):(v(),f(x,{key:1},[b(e.$slots,"before"),n(j)?(v(),s(pt,c({key:0},n(j),{class:"vv-button__icon"}),null,16)):d("v-if",!0),n(k)?(v(),f("span",$t,[b(e.$slots,"label",{},()=>[y(m(n(k)),1)])])):d("v-if",!0),b(e.$slots,"after")],64))])]),_:3},16,["id","class"]))}}),_t={...Ze,...et,...Ge,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:_e.menu,validator:e=>Object.values(_e).includes(e)}},xt={focusOnHover:{type:Boolean,default:!1}},Vt={...Fe,...De,...Ye,...Ge,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String},focusOnHover:{type:Boolean,default:!1}};const Bt=["id","tabindex","role","aria-labelledby"],At=/* @__PURE__ */l({name:"VvDropdown",inheritAttrs:!1,props:_t,emits:["update:modelValue","beforeEnter","afterLeave","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","afterEnter","enterCancelled","beforeLeave","leave","leaveCancelled"],setup(t,{expose:o,emit:i}){const s=t,y=i,{id:m}=u(s),g=kt(m),h=w(),L=r("auto"),k=r("auto"),$=r(),_=r(),M=r(),q=r(),z=e({get:()=>s.reference??$.value,set:e=>{$.value=e}}),K=r(!1);B(()=>{ne(_.value,()=>{K.value="true"===window.getComputedStyle(_.value).getPropertyValue("--dropdown-custom-position")?.trim()},{attributeFilter:["style"],window:window})});const T=e(()=>{const e=[];if(s.autoPlacement?"boolean"==typeof s.autoPlacement?e.push(X()):e.push(X(s.autoPlacement)):s.flip&&("boolean"==typeof s.flip?e.push(Y({fallbackStrategy:"initialPlacement"})):e.push(Y(s.flip))),s.shift&&("boolean"==typeof s.shift?e.push(Z()):e.push(Z(s.shift))),s.size){const t=({availableWidth:e,availableHeight:t})=>{L.value=`${e}px`,k.value=`${t}px`};"boolean"==typeof s.size?e.push(ee({apply:t})):e.push(ee({...s.size,apply:t}))}return s.offset&&(e.push(te(Number(s.offset))),["string","number"].includes(typeof s.offset)?e.push(te(Number(s.offset))):e.push(te(s.offset))),s.arrow&&e.push(le({element:M})),e}),{x:W,y:G,middlewareData:J,placement:R,strategy:U}=ae(z,_,{whileElementsMounted:(...e)=>oe(...e,{animationFrame:s.strategy===he.fixed}),placement:e(()=>s.placement),strategy:e(()=>s.strategy),middleware:T}),Q=e(()=>{if(K.value)return;const e=s.triggerWidth&&z.value?`${z.value?.offsetWidth}px`:void 0;return{position:U.value,top:`${G.value??0}px`,left:`${W.value??0}px`,maxWidth:e?void 0:L.value,maxHeight:k.value,width:e}}),ve=e(()=>R.value.split("-")[0]),ce=e(()=>{if(K.value)return;const e={[Se.top]:Se.bottom,[Se.right]:Se.left,[Se.bottom]:Se.top,[Se.left]:Se.right}[ve.value];return{left:void 0!==J.value.arrow?.x?`${J.value.arrow?.x}px`:void 0,top:void 0!==J.value.arrow?.y?`${J.value.arrow?.y}px`:void 0,[e]:-(M.value?.offsetWidth??0)/2+"px"}}),fe=ie(s,"modelValue",y),pe=r(!1),ye=e({get:()=>fe.value??pe.value,set:e=>{void 0!==fe.value?fe.value=e:pe.value=e}});function me(){ye.value=!0}function ge(){ye.value=!1}function Le(){ye.value=!ye.value}function ke(e){z.value=e}re(_,()=>{!s.keepOpen&&ye.value&&(ye.value=!1)},{ignore:[z]});const Oe=e(()=>z.value?.getAttribute?.("id")??void 0),$e=e(()=>({"aria-controls":g.value,"aria-haspopup":!0,"aria-expanded":ye.value})),{component:we,bus:Ve}=function({reference:e,id:t,expanded:o,aria:n}){const i=be(),r=l({name:"VvDropdownTriggerProvider",setup(){V(Ae,{reference:e,id:t,expanded:o,aria:n,bus:i})},render(){return a(x,{},this.$slots.default?.())}});return{bus:i,component:r}}({reference:z,id:g,expanded:ye,aria:$e});Ve.on("click",Le);const{role:Be,modifiers:He}=u(s),Ne=ft("vv-dropdown",He,e(()=>({arrow:s.arrow}))),{focused:Pe}=ue(_);function Ee(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")):[]}function je(){D(()=>{const e=Ee(_.value);e.length>0&&e[0].focus({preventScroll:!0})})}function Fe(){D(()=>{if(Pe.value){const e=Ee(_.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})}})}function Ie(){D(()=>{if(Pe.value){const e=Ee(_.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})}})}S(ye,e=>{e&&s.autofocusFirst&&je()}),o({toggle:Le,show:me,hide:ge,init:ke,focusFirst:je,focusFirstListElement:function(){D(()=>{const e=Ee(q.value);e.length>0&&e[0].focus({preventScroll:!0})})},focusNext:Fe,focusPrev:Ie,customPosition:K});const De=se(_),{itemRole:Me}=function({role:t,...l}){const a=e(()=>t.value===_e.listbox?xe.option:xe.presentation);return V(Ce,{role:a,...l}),{itemRole:a}}({role:Be,expanded:ye,focused:Pe,hovered:De});de("Escape",e=>{ye.value&&(e.preventDefault(),ge())}),de("ArrowDown",e=>{ye.value&&Pe.value&&(e.preventDefault(),Fe())}),de("ArrowUp",e=>{ye.value&&Pe.value&&(e.preventDefault(),Ie())}),de([" ","Enter"],e=>{const t=e.target;ye.value&&Pe.value&&t&&t?.click()});const qe={"before-enter":()=>{y(ye.value?"beforeExpand":"beforeCollapse"),y("beforeEnter")},"after-leave":()=>{y(ye.value?"afterExpand":"afterCollapse"),y("afterLeave")},enter:()=>{y("enter")},"after-enter":()=>{y("afterEnter")},"enter-cancelled":()=>{y("enterCancelled")},"before-leave":()=>{y("beforeLeave")},leave:()=>{y("leave")},"leave-cancelled":()=>{y("leaveCancelled")}};return(e,t)=>(v(),f(x,null,[A(n(we),null,{default:O(()=>[b(e.$slots,"default",C(H({init:ke,show:me,hide:ge,toggle:Le,expanded:n(ye),aria:n($e)})))]),_:3}),A(N,c({name:e.transitionName},P(qe),{persisted:""}),{default:O(()=>[E(j("div",{ref_key:"floatingEl",ref:_,style:F(n(Q)),class:p(n(Ne))},[s.arrow?(v(),f("div",{key:0,ref_key:"arrowEl",ref:M,style:F(n(ce)),class:"vv-dropdown__arrow"},null,4)):d("v-if",!0),b(e.$slots,"before",C(H({expanded:n(ye)}))),j("div",c(n(h),{id:n(g),ref_key:"listEl",ref:q,tabindex:n(ye)?void 0:-1,role:n(Be),"aria-labelledby":n(Oe),class:"vv-dropdown__list"}),[b(e.$slots,"items",C(H({role:n(Me)})))],16,Bt),b(e.$slots,"after",C(H({expanded:n(ye)})))],6),[[I,n(ye)]])]),_:3},16,["name"])],64))}}),Ct={class:"vv-dropdown-optgroup",role:"presentation",tabindex:"-1"},Ht=/* @__PURE__ */l({name:"VvDropdownOptgroup",props:{...Te},setup(e){const t=e;return(e,l)=>(v(),f("li",Ct,[b(e.$slots,"default",{},()=>[y(m(t.label),1)])]))}}),Nt=/* @__PURE__ */l({name:"VvDropdownItem",props:xt,setup(e){const t=e,{role:l,expanded:a}=o(Ce,{}),i=r(null);!function({expanded:e}){V(He,{role:r(we.menuitem),expanded:e})}({expanded:a});const u=se(i),{focused:s}=ve(i),{focused:d}=ue(i);return S(u,e=>{e&&t.focusOnHover&&(s.value=!0)}),(e,t)=>(v(),f("div",c({role:n(l)},{ref_key:"element",ref:i,class:["vv-dropdown__item",{"focus-visible":n(s)||n(d)}]}),[b(e.$slots,"default")],16))}}),Pt=["title"],Et=/* @__PURE__ */l({name:"VvDropdownOption",props:Vt,setup(t){const l=t,{modifiers:a}=u(l),o=ft("vv-dropdown-option",a,e(()=>({disabled:l.disabled,selected:l.selected,unselectable:l.unselectable&&l.selected}))),i=e(()=>l.selected?l.unselectable?l.deselectHintLabel:l.selectedHintLabel:l.disabled?"":l.selectHintLabel);return(e,t)=>(v(),s(Nt,{class:p(n(o)),tabindex:e.disabled?-1:0,"aria-selected":e.selected,"aria-disabled":e.disabled,"focus-on-hover":e.focusOnHover},{default:O(()=>[b(e.$slots,"default"),j("span",{class:"vv-dropdown-option__hint",title:n(i)},[b(e.$slots,"hint",C(H({disabled:e.disabled,selected:e.selected,unselectable:e.unselectable})),()=>[y(m(n(i)),1)])],8,Pt)]),_:3},8,["class","tabindex","aria-selected","aria-disabled","focus-on-hover"]))}}),jt={...tt,...lt,...at,...Qe,...Pe,...Ee,...Je,...je,...Fe,...We,...Ge,...Re,...Ue,...Xe,...Ye,...Te,...ze,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String};function Ft(){return{...jt,options:{...jt.options,type:Array,default:()=>[]}}}function It(t,l,a){const o=ct(),n=e(()=>{if(o&&o.defaults.value?.[t])return o.defaults.value[t]});return e(()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l},{})})}function Dt(e,t){const{focused:l}=ve(e);return S(l,l=>{t(l?"focus":"blur",n(e))}),{focused:l}}function Mt(e){const{options:t,labelKey:l,valueKey:a,disabledKey:o}=u(e);return{options:t,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof l.value?l.value(e):String(l.value?ye(e,l.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):a.value?ye(e,a.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof o.value?o.value(e):!!o.value&&Boolean(ye(e,o.value))),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}const qt=["for"],zt={class:"vv-select__wrapper"},Kt={key:0,class:"vv-select__input-before"},Tt={class:"vv-select__inner"},Wt=["id"],Gt=["disabled","hidden"],Jt=["disabled","value"],Rt=["disabled","label"],Ut=["disabled","value"],Qt={key:2,class:"vv-select__input-after"},Xt=/* @__PURE__ */l({name:"VvSelect",props:Ft(),emits:["update:modelValue","focus","blur","clear"],setup(l,{emit:a}){const o=l,i=a,y=_(),g=It("VvSelect",Ft(),o),h=r(),{HintSlot:L,hasHintLabelOrSlot:k,hasInvalidLabelOrSlot:$,hintSlotScope:w}=vt(g,y),{focused:V}=Dt(h,i);function B(e){return"string"!=typeof e&&e.options?.length}const{id:N,modifiers:P,disabled:F,readonly:I,loading:D,icon:K,iconPosition:T,invalid:W,valid:G,floating:J,multiple:R}=u(o),U=kt(N),Q=e(()=>`${U.value}-hint`),X=e(()=>o.disabled||o.readonly),Y=e(()=>X.value?-1:o.tabindex),Z=e({get:()=>o.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter(e=>void 0!==e)).length&&!o.unselectable&&h.value?h.value.value=String(o.modelValue):i("update:modelValue",e)}}),ee=e(()=>Array.isArray(Z.value)?Z.value.length>0:void 0!==Z.value&&null!==Z.value),te=e(()=>!X.value&&o.unselectable),le=ce(h);S(le,e=>{e&&o.autofocus&&(V.value=!0)});const{hasIconBefore:ae,hasIconAfter:oe}=bt(K,T),ne=e(()=>!0===o.invalid||!0!==o.valid&&void 0),ie=ft("vv-select",P,e(()=>({valid:G.value,invalid:W.value,loading:D.value,disabled:F.value,readonly:I.value,"icon-before":void 0!==ae.value,"icon-after":void 0!==oe.value,dirty:ee.value,focus:V.value&&!X.value,floating:J.value,multiple:R.value}))),{getOptionLabel:re,getOptionValue:ue,isOptionDisabled:se,getOptionGrouped:de}=Mt(o);function ve(){Array.isArray(Z.value)?Z.value=[]:Z.value=void 0,i("clear")}S(()=>o.options,e=>{if(e?.length&&o.autoselectFirst&&!ee.value){const t=ue(e[0]);Z.value=o.multiple?[t]:t}},{immediate:!0});const fe=e(()=>({name:o.name,tabindex:Y.value,disabled:X.value,required:o.required,size:o.size,autocomplete:o.autocomplete,multiple:o.multiple,"aria-invalid":ne.value,"aria-describedby":k.value?Q.value:void 0,"aria-errormessage":$.value?Q.value:void 0})),pe=e(()=>({valid:o.valid,invalid:o.invalid,modelValue:o.modelValue}));return(e,l)=>(v(),f("div",{class:p(n(ie))},[e.label?(v(),f("label",{key:0,for:n(U)},m(e.label),9,qt)):d("v-if",!0),j("div",zt,[e.$slots.before?(v(),f("div",Kt,[b(e.$slots,"before",C(H(n(pe))))])):d("v-if",!0),j("div",Tt,[n(ae)?(v(),s(pt,c({key:0},n(ae),{class:"vv-select__icon"}),null,16)):d("v-if",!0),E(j("select",c({id:n(U),ref_key:"selectEl",ref:h},n(fe),{"onUpdate:modelValue":l[0]||(l[0]=e=>t(Z)?Z.value=e:null)}),[e.placeholder?(v(),f("option",{key:0,value:void 0,disabled:!n(te),hidden:!n(te)},m(e.placeholder),9,Gt)):d("v-if",!0),(v(!0),f(x,null,M(e.options,(e,t)=>(v(),f(x,null,[B(e)?(v(),f("optgroup",{key:`group-${t}`,disabled:n(se)(e),label:n(re)(e)},[(v(!0),f(x,null,M(n(de)(e),(e,l)=>(v(),f("option",{key:`group-${t}-item-${l}`,disabled:n(se)(e),value:n(ue)(e)},m(n(re)(e)),9,Ut))),128))],8,Rt)):(v(),f("option",{key:t,disabled:n(se)(e),value:n(ue)(e)},m(n(re)(e)),9,Jt))],64))),256))],16,Wt),[[q,n(Z)]]),n(oe)?(v(),s(pt,c({key:1},n(oe),{class:"vv-select__icon vv-select__icon-after"}),null,16)):d("v-if",!0)]),n(te)&&n(g).showClearAction?(v(),s(n(yt),{key:1,"input-type":"select",label:e.labelClear,icon:e.iconClear,disabled:!n(ee),onClear:ve},null,8,["label","icon","disabled"])):d("v-if",!0),e.$slots.after?(v(),f("div",Qt,[b(e.$slots,"after",C(H(n(pe))))])):d("v-if",!0)]),A(n(L),{id:n(Q),class:"vv-select__hint"},z({_:2},[e.$slots.hint?{name:"hint",fn:O(()=>[b(e.$slots,"hint",C(H(n(w))))]),key:"0"}:void 0,e.$slots.loading?{name:"loading",fn:O(()=>[b(e.$slots,"loading",C(H(n(w))))]),key:"1"}:void 0,e.$slots.valid?{name:"valid",fn:O(()=>[b(e.$slots,"valid",C(H(n(w))))]),key:"2"}:void 0,e.$slots.invalid?{name:"invalid",fn:O(()=>[b(e.$slots,"invalid",C(H(n(w))))]),key:"3"}:void 0]),1032,["id"])],2))}}),Yt=["id"],Zt=["id","for"],el=["id","aria-controls","placeholder"],tl={key:0,class:"vv-select__input-before"},ll={class:"vv-select__inner"},al=["aria-controls","aria-expanded","aria-labelledby","aria-describedby","aria-errormessage","tabindex"],ol={key:0,class:"vv-select__value"},nl=["aria-label","onClick"],il={key:2,class:"vv-select__input-after"},rl=/* @__PURE__ */l({...{name:"VvCombobox",components:{VvDropdown:At,VvDropdownOption:Et,VvDropdownOptgroup:Ht,VvButton:wt}},props:/* @__PURE__ */K(it(),{search:{type:String,default:"",required:!1},searchModifiers:{}}),emits:/* @__PURE__ */K(["update:modelValue","update:search","update:options","focus","blur","clear","change:search"],["update:search"]),setup(l,{emit:a}){const o=l,i=a,g=_(),h=It("VvCombobox",it(),o),L=r(null),k=r(null),$=r(null),w=r(),{HintSlot:V,hasHintLabelOrSlot:B,hasInvalidLabelOrSlot:N,hintSlotScope:P}=vt(h,g),{focused:F}=Dt(L,i),{focused:I}=ue($);S(F,e=>{o.autoOpen&&(!e||K.value?e||!K.value||I.value||Q():U())}),S(I,e=>{F.value||e||!K.value||Q()});const D=T(l,"search"),q=fe(D,e(()=>Number(o.debounceSearch)));S(q,()=>{i("update:search",q.value),i("change:search",q.value)});const K=r(!1);function R(){Se.value||(K.value=!K.value)}function U(){Se.value||K.value||(K.value=!0)}function Q(){!Se.value&&K.value&&(K.value=!1)}function X(){h.value.searchable&&k.value&&k.value.focus({preventScroll:!0})}function Y(){h.value.keepSearch||(D.value="")}function Z(e){return"string"!=typeof e&&e.options?.length}const{id:ee,icon:te,iconPosition:le,modifiers:ae,disabled:oe,required:ne,readonly:ie,loading:re,valid:se,invalid:ve,floating:ce}=u(o),be=kt(ee),ye=e(()=>`${be.value}-hint`),me=e(()=>`${be.value}-dropdown`),ge=e(()=>`${be.value}-search`),he=e(()=>`${be.value}-label`),Se=e(()=>o.disabled||o.readonly),Le=e(()=>Se.value?-1:o.tabindex),ke=e({get:()=>Array.isArray(o.modelValue)?o.modelValue:void 0!==o.modelValue&&null!==o.modelValue?[o.modelValue]:[],set:e=>{i("update:modelValue",o.multiple||Array.isArray(o.modelValue)?e:e.pop())}}),Oe=e(()=>ke.value.length),$e=e(()=>Oe.value>0),we=e(()=>o.multiple?void 0===o.maxValues?1/0:Number(o.maxValues):1),xe=e(()=>!Se.value&&(!!o.unselectable&&(0===Number(o.minValues)||Oe.value>Number(o.minValues)))),Ve=e(()=>!Se.value&&(!o.multiple||Oe.value<we.value)),Be=r(!1),Ae=e(()=>Be.value||re.value),{hasIconBefore:Ce,hasIconAfter:He}=bt(te,le),Ne=ft("vv-select",ae,e(()=>({disabled:oe.value,required:ne.value,loading:Ae.value,readonly:ie.value,"icon-before":void 0!==Ce.value,"icon-after":void 0!==He.value,valid:se.value,invalid:ve.value,dirty:$e.value,focus:(F.value||I.value||K.value)&&!Se.value,floating:ce.value,badges:o.badges}))),Pe=r(/* @__PURE__ */new Set),{getOptionLabel:Ee,getOptionValue:je,getOptionGrouped:Fe,isOptionDisabled:Ie}=Mt(o),De=e(()=>{const e=[...Pe.value];for(const t of o.options)Z(t)?e.push(...Fe(t)):e.push(t);return e}),Me=e(()=>{const e=[...o.options,...Pe.value];for(const t of ke.value)De.value.some(e=>{const l=je(e);return"object"==typeof l&&"object"==typeof t?JSON.stringify(l)===JSON.stringify(t):l===t})||e.push(t);return e});function qe(e){return Ie(e)||!Ve.value&&!Ke(e)}S(Pe,e=>{e.size>0&&i("update:options",Me.value)});const ze=pe(async()=>{if(h.value.searchFunction){Be.value=!0;const e=await Promise.resolve(h.value.searchFunction(q.value,Me.value));return Be.value=!1,e}const e=q.value.toLowerCase().trim();return e?Me.value?.reduce((t,l)=>{if(Z(l)){const a=Ee(l).toLowerCase(),o=Fe(l).filter(t=>Ee(t).toLowerCase().includes(e));if(a.includes(e))t.push(l);else if(o.length>0){const e="object"==typeof l?{...l,options:o}:l;t.push(e)}return t}return Ee(l).toLowerCase().includes(e)&&t.push(l),t},[]):Me.value});function Ke(e){const t=je(e);return"object"==typeof t?ke.value.some(e=>"object"==typeof e&&JSON.stringify(e)===JSON.stringify(t)):ke.value.includes(t)}const Te=e(()=>Me.value.reduce((e,t)=>Z(t)?[...e,...Fe(t)]:[...e,t],[]).filter(e=>Ke(e))),We=e(()=>Te.value.map(e=>Ee(e)).join(o.separator));function Ge(){o.autoOpen?U():R()}function Je(e){const t=Ke(e),l=je(e);t&&xe.value?ke.value=ke.value.filter(e=>"object"==typeof l&&"object"==typeof e?JSON.stringify(e)!==JSON.stringify(l):e!==l):!t&&Ve.value&&(o.multiple?ke.value=[...ke.value,l]:ke.value=[l]),o.multiple||o.keepOpen||Q()}function Re(){ke.value=[],i("update:search",""),i("clear")}S(Me,e=>{if(e?.length&&o.autoselectFirst&&!$e.value){const t=e.find(e=>!Z(e));if(t)return void Je(t);const l=e.find(e=>Z(e));if(l){const e=Fe(l);e.length&&Je(e[0])}}},{immediate:!0});const Ue=e(()=>({id:be.value,name:o.name,tabindex:Le.value,valid:se.value,validLabel:h.value.validLabel,invalid:ve.value,invalidLabel:h.value.invalidLabel,hintLabel:h.value.hintLabel,loading:Ae.value,loadingLabel:h.value.loadingLabel,disabled:oe.value,readonly:ie.value,modifiers:h.value.modifiers,options:h.value.options,labelKey:h.value.labelKey,valueKey:h.value.valueKey,icon:h.value.icon,iconPosition:h.value.iconPosition,floating:h.value.floating,unselectable:xe.value,autoselectFirst:h.value.autoselectFirst,multiple:h.value.multiple,label:h.value.label,placeholder:h.value.placeholder,modelValue:o.modelValue})),Qe=e(()=>({id:me.value,reference:$.value,placement:h.value.placement,strategy:h.value.strategy,transitionName:h.value.transitionName,offset:h.value.offset,shift:h.value.shift,flip:h.value.flip,autoPlacement:h.value.autoPlacement,arrow:h.value.arrow,autofocusFirst:!!h.value.searchable||h.value.autofocusFirst,triggerWidth:h.value.triggerWidth,modifiers:h.value.dropdownModifiers})),Xe=e(()=>({valid:o.valid,invalid:o.invalid,modelValue:o.modelValue}));function Ye(){if(ze.value?.length){if(1===ze.value.length){const e=ze.value[0];if(Z(e)){const t=Fe(e);return void(t.length&&Je(t[0]))}return void Je(e)}w.value?.focusFirstListElement()}else if(h.value.addable){const e=D.value.trim();if(!e)return;if(De.value.some(t=>Ee(t).toLowerCase()===e.toLowerCase()))return;Pe.value.add(e),Je(e)}}return de([" ","Enter"],e=>{o.autoOpen||!K.value&&F.value&&(e.preventDefault(),e.stopImmediatePropagation(),R())},{target:L}),(e,l)=>e.native?(v(),s(Xt,c({key:1},n(Ue),{"onUpdate:modelValue":l[3]||(l[3]=e=>i("update:modelValue",e))}),null,16)):(v(),f("div",{key:0,id:n(be),class:p(n(Ne))},[e.label?(v(),f("label",{key:0,id:n(he),for:n(h).searchable?n(ge):void 0},m(e.label),9,Zt)):d("v-if",!0),j("div",{ref_key:"wrapperEl",ref:$,class:"vv-select__wrapper"},[A(At,c({ref_key:"dropdownEl",ref:w,modelValue:n(K),"onUpdate:modelValue":l[2]||(l[2]=e=>t(K)?K.value=e:null)},n(Qe),{role:n(_e).listbox,onAfterExpand:X,onAfterCollapse:Y}),z({default:O(({aria:t})=>[e.$slots.before?(v(),f("div",tl,[b(e.$slots,"before",C(H(n(Xe))))])):d("v-if",!0),j("div",ll,[n(Ce)?(v(),s(pt,c({key:0},n(Ce),{class:"vv-select__icon"}),null,16)):d("v-if",!0),j("div",c({ref_key:"inputEl",ref:L},t,{class:"vv-select__input",role:"combobox","aria-controls":n(me),"aria-expanded":n(K),"aria-labelledby":n(he),"aria-describedby":n(B)?n(ye):void 0,"aria-errormessage":n(N)?n(ye):void 0,tabindex:n(Le),onClickPassive:Ge}),[n(We)?b(e.$slots,"value",C(c({key:0},{selectedOptions:n(Te),onInput:Je})),()=>[e.badges?(v(!0),f(x,{key:1},M(n(Te),(t,l)=>(v(),s(gt,{key:l,modifiers:e.badgeModifiers,class:"vv-select__badge"},{default:O(()=>[y(m(n(Ee)(t))+" ",1),n(xe)?(v(),f("button",{key:0,"aria-label":n(h).deselectActionLabel,type:"button",onClick:W(e=>Je(t),["stop"])},[A(pt,{name:"close"})],8,nl)):d("v-if",!0)]),_:2},1032,["modifiers"]))),128)):(v(),f("div",ol,m(n(We)),1))]):b(e.$slots,"placeholder",{key:1},()=>[y(m(e.placeholder),1)])],16,al),n(He)?(v(),s(pt,c({key:1},n(He),{class:"vv-select__icon vv-select__icon-after"}),null,16)):d("v-if",!0)]),n(xe)&&n(h).showClearAction?(v(),s(n(yt),{key:1,"input-type":"select",label:e.labelClear,icon:e.iconClear,disabled:!n($e),onClear:Re},null,8,["label","icon","disabled"])):d("v-if",!0),e.$slots.after?(v(),f("div",il,[b(e.$slots,"after",C(H(n(Xe))))])):d("v-if",!0)]),items:O(()=>[!n(oe)&&n(ze)?.length?(v(!0),f(x,{key:0},M(n(ze),(t,l)=>(v(),f(x,{key:l},[Z(t)?(v(),f(x,{key:0},[A(Ht,{label:n(Ee)(t)},{default:O(()=>[b(e.$slots,"option-group",c({ref_for:!0},{option:t,selectedOptions:n(Te)}),()=>[y(m(n(Ee)(t)),1)])]),_:2},1032,["label"]),(v(!0),f(x,null,M(n(Fe)(t),(t,l)=>(v(),s(Et,c({ref_for:!0},{selected:Ke(t),disabled:qe(t),unselectable:n(xe),deselectHintLabel:n(h).deselectHintLabel,selectHintLabel:n(h).selectHintLabel,selectedHintLabel:n(h).selectedHintLabel,focusOnHover:e.focusOnHover},{key:l,class:"vv-dropdown-option",onClickPassive:e=>Je(t)}),{default:O(()=>[b(e.$slots,"option",c({ref_for:!0},{option:t,selectedOptions:n(Te),selected:Ke(t),disabled:qe(t)}),()=>[y(m(n(Ee)(t)),1)])]),_:2},1040,["onClickPassive"]))),128))],64)):(v(),s(Et,c({key:1,ref_for:!0},{selected:Ke(t),disabled:qe(t),unselectable:n(xe),deselectHintLabel:n(h).deselectHintLabel,selectHintLabel:n(h).selectHintLabel,selectedHintLabel:n(h).selectedHintLabel,focusOnHover:e.focusOnHover},{class:"vv-dropdown-option",onClickPassive:e=>Je(t)}),{default:O(()=>[b(e.$slots,"option",c({ref_for:!0},{option:t,selectedOptions:n(Te),selected:Ke(t),disabled:qe(t)}),()=>[y(m(n(Ee)(t)),1)])]),_:2},1040,["onClickPassive"]))],64))),128)):e.options.length?(v(),s(Et,{key:2,modifiers:"inert"},{default:O(()=>[b(e.$slots,"no-results",{},()=>[y(m(n(h).addable?n(h).addOptionHintLabel:n(h).noResultsLabel),1)])]),_:3})):(v(),s(Et,{key:1,modifiers:"inert"},{default:O(()=>[b(e.$slots,"no-options",{},()=>[y(m(n(h).addable&&D.value.length?n(h).addOptionHintLabel:n(h).noOptionsLabel),1)])]),_:3}))]),after:O(()=>[b(e.$slots,"dropdown::after",{},()=>[n(w)?.customPosition?(v(),s(wt,{key:0,label:n(h).closeLabel,modifiers:"secondary",onClick:l[1]||(l[1]=e=>n(w).hide())},null,8,["label"])):d("v-if",!0)])]),_:2},[n(h).searchable||e.$slots["dropdown::before"]?{name:"before",fn:O(()=>[b(e.$slots,"dropdown::before"),n(h).searchable&&!n(oe)?E((v(),f("input",{key:0,id:n(ge),ref_key:"inputSearchEl",ref:k,"onUpdate:modelValue":l[0]||(l[0]=e=>D.value=e),"aria-autocomplete":"list","aria-controls":n(me),autocomplete:"off",spellcheck:"false",type:"search",class:"vv-dropdown__search",placeholder:n(h).searchPlaceholder,onKeyup:G(Ye,["enter"])},null,40,el)),[[J,D.value]]):d("v-if",!0)]),key:"0"}:void 0]),1040,["modelValue","role"])],512),A(n(V),{id:n(ye),class:"vv-select__hint"},z({_:2},[e.$slots.hint?{name:"hint",fn:O(()=>[b(e.$slots,"hint",C(H(n(P))))]),key:"0"}:void 0,e.$slots.loading?{name:"loading",fn:O(()=>[b(e.$slots,"loading",C(H(n(P))))]),key:"1"}:void 0,e.$slots.valid?{name:"valid",fn:O(()=>[b(e.$slots,"valid",C(H(n(P))))]),key:"2"}:void 0,e.$slots.invalid?{name:"invalid",fn:O(()=>[b(e.$slots,"invalid",C(H(n(P))))]),key:"3"}:void 0]),1032,["id"])],10,Yt))}});export{rl as default};