@nuxt/ui 4.6.1 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/cli/package.json +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/components/Accordion.d.vue.ts +6 -1
- package/dist/runtime/components/Accordion.vue +1 -1
- package/dist/runtime/components/Accordion.vue.d.ts +6 -1
- package/dist/runtime/components/AuthForm.d.vue.ts +22 -29
- package/dist/runtime/components/AuthForm.vue +8 -6
- package/dist/runtime/components/AuthForm.vue.d.ts +22 -29
- package/dist/runtime/components/Button.vue +1 -0
- package/dist/runtime/components/Calendar.vue +4 -4
- package/dist/runtime/components/Card.d.vue.ts +4 -0
- package/dist/runtime/components/Card.vue +16 -2
- package/dist/runtime/components/Card.vue.d.ts +4 -0
- package/dist/runtime/components/ChatMessage.d.vue.ts +27 -17
- package/dist/runtime/components/ChatMessage.vue +10 -16
- package/dist/runtime/components/ChatMessage.vue.d.ts +27 -17
- package/dist/runtime/components/ChatMessages.d.vue.ts +27 -21
- package/dist/runtime/components/ChatMessages.vue +22 -23
- package/dist/runtime/components/ChatMessages.vue.d.ts +27 -21
- package/dist/runtime/components/ChatPromptSubmit.vue +3 -1
- package/dist/runtime/components/Checkbox.vue +5 -3
- package/dist/runtime/components/CommandPalette.d.vue.ts +18 -3
- package/dist/runtime/components/CommandPalette.vue +11 -7
- package/dist/runtime/components/CommandPalette.vue.d.ts +18 -3
- package/dist/runtime/components/ContextMenuContent.vue +68 -65
- package/dist/runtime/components/DashboardSearch.d.vue.ts +8 -37
- package/dist/runtime/components/DashboardSearch.vue +11 -10
- package/dist/runtime/components/DashboardSearch.vue.d.ts +8 -37
- package/dist/runtime/components/DashboardSidebar.vue +1 -5
- package/dist/runtime/components/Drawer.vue +44 -41
- package/dist/runtime/components/DropdownMenuContent.vue +90 -87
- package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +1 -1
- package/dist/runtime/components/EditorEmojiMenu.vue +2 -0
- package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +1 -1
- package/dist/runtime/components/EditorMentionMenu.d.vue.ts +1 -1
- package/dist/runtime/components/EditorMentionMenu.vue +2 -0
- package/dist/runtime/components/EditorMentionMenu.vue.d.ts +1 -1
- package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +1 -1
- package/dist/runtime/components/EditorSuggestionMenu.vue +2 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +1 -1
- package/dist/runtime/components/FileUpload.vue +7 -5
- package/dist/runtime/components/FormField.d.vue.ts +1 -1
- package/dist/runtime/components/FormField.vue.d.ts +1 -1
- package/dist/runtime/components/Header.vue +1 -5
- package/dist/runtime/components/Input.vue +2 -2
- package/dist/runtime/components/InputDate.vue +6 -6
- package/dist/runtime/components/InputMenu.d.vue.ts +3 -3
- package/dist/runtime/components/InputMenu.vue +40 -38
- package/dist/runtime/components/InputMenu.vue.d.ts +3 -3
- package/dist/runtime/components/InputNumber.vue +2 -2
- package/dist/runtime/components/InputTags.vue +2 -2
- package/dist/runtime/components/InputTime.vue +2 -2
- package/dist/runtime/components/Link.d.vue.ts +10 -1
- package/dist/runtime/components/Link.vue +74 -9
- package/dist/runtime/components/Link.vue.d.ts +10 -1
- package/dist/runtime/components/Listbox.d.vue.ts +228 -0
- package/dist/runtime/components/Listbox.vue +242 -0
- package/dist/runtime/components/Listbox.vue.d.ts +228 -0
- package/dist/runtime/components/Modal.vue +13 -10
- package/dist/runtime/components/Popover.vue +7 -4
- package/dist/runtime/components/PricingTable.vue +60 -58
- package/dist/runtime/components/RadioGroup.vue +5 -3
- package/dist/runtime/components/Select.d.vue.ts +1 -1
- package/dist/runtime/components/Select.vue +84 -73
- package/dist/runtime/components/Select.vue.d.ts +1 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +3 -3
- package/dist/runtime/components/SelectMenu.vue +54 -52
- package/dist/runtime/components/SelectMenu.vue.d.ts +3 -3
- package/dist/runtime/components/Sidebar.vue +1 -4
- package/dist/runtime/components/Slideover.vue +67 -64
- package/dist/runtime/components/Table.d.vue.ts +1 -2
- package/dist/runtime/components/Table.vue +17 -29
- package/dist/runtime/components/Table.vue.d.ts +1 -2
- package/dist/runtime/components/Tabs.d.vue.ts +5 -1
- package/dist/runtime/components/Tabs.vue +2 -2
- package/dist/runtime/components/Tabs.vue.d.ts +5 -1
- package/dist/runtime/components/Textarea.d.vue.ts +1 -0
- package/dist/runtime/components/Textarea.vue +2 -1
- package/dist/runtime/components/Textarea.vue.d.ts +1 -0
- package/dist/runtime/components/Tooltip.vue +12 -9
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +19 -35
- package/dist/runtime/components/content/ContentSearch.vue +10 -9
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +19 -35
- package/dist/runtime/components/content/ContentToc.vue +19 -9
- package/dist/runtime/components/prose/Img.vue +7 -1
- package/dist/runtime/components/prose/Pre.vue +8 -3
- package/dist/runtime/components/prose/Prompt.d.vue.ts +32 -0
- package/dist/runtime/components/prose/Prompt.vue +88 -0
- package/dist/runtime/components/prose/Prompt.vue.d.ts +32 -0
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useContentSearch.js +19 -5
- package/dist/runtime/composables/useEditorMenu.d.ts +5 -0
- package/dist/runtime/composables/useEditorMenu.js +3 -1
- package/dist/runtime/composables/useFieldGroup.d.ts +3 -0
- package/dist/runtime/composables/useFieldGroup.js +11 -1
- package/dist/runtime/composables/useResolvedVariants.d.ts +21 -0
- package/dist/runtime/composables/useResolvedVariants.js +14 -0
- package/dist/runtime/locale/ar.js +9 -0
- package/dist/runtime/locale/az.js +9 -0
- package/dist/runtime/locale/be.js +9 -0
- package/dist/runtime/locale/bg.js +9 -0
- package/dist/runtime/locale/bn.js +9 -0
- package/dist/runtime/locale/ca.js +9 -0
- package/dist/runtime/locale/ckb.js +10 -1
- package/dist/runtime/locale/cs.js +9 -0
- package/dist/runtime/locale/da.js +9 -0
- package/dist/runtime/locale/de.js +9 -0
- package/dist/runtime/locale/de_ch.js +9 -0
- package/dist/runtime/locale/el.js +9 -0
- package/dist/runtime/locale/en.js +10 -1
- package/dist/runtime/locale/es.js +9 -0
- package/dist/runtime/locale/et.js +9 -0
- package/dist/runtime/locale/eu.js +11 -2
- package/dist/runtime/locale/fa_ir.js +9 -0
- package/dist/runtime/locale/fi.js +9 -0
- package/dist/runtime/locale/fr.js +9 -0
- package/dist/runtime/locale/gl.js +9 -0
- package/dist/runtime/locale/he.js +9 -0
- package/dist/runtime/locale/hi.js +9 -0
- package/dist/runtime/locale/hr.js +9 -0
- package/dist/runtime/locale/hu.js +9 -0
- package/dist/runtime/locale/hy.js +9 -0
- package/dist/runtime/locale/id.js +9 -0
- package/dist/runtime/locale/is.js +9 -0
- package/dist/runtime/locale/it.js +9 -0
- package/dist/runtime/locale/ja.js +9 -0
- package/dist/runtime/locale/ka.js +9 -0
- package/dist/runtime/locale/kk.js +9 -0
- package/dist/runtime/locale/km.js +9 -0
- package/dist/runtime/locale/ko.js +9 -0
- package/dist/runtime/locale/ky.js +9 -0
- package/dist/runtime/locale/lb.js +11 -2
- package/dist/runtime/locale/lo.js +15 -6
- package/dist/runtime/locale/lt.js +9 -0
- package/dist/runtime/locale/mn.js +9 -0
- package/dist/runtime/locale/ms.js +9 -0
- package/dist/runtime/locale/nb_no.js +9 -0
- package/dist/runtime/locale/nl.js +9 -0
- package/dist/runtime/locale/pl.js +9 -0
- package/dist/runtime/locale/pt.js +9 -0
- package/dist/runtime/locale/pt_br.js +9 -0
- package/dist/runtime/locale/ro.js +9 -0
- package/dist/runtime/locale/ru.js +9 -0
- package/dist/runtime/locale/sk.js +9 -0
- package/dist/runtime/locale/sl.js +9 -0
- package/dist/runtime/locale/sq.js +9 -0
- package/dist/runtime/locale/sv.js +9 -0
- package/dist/runtime/locale/th.js +9 -0
- package/dist/runtime/locale/tj.js +9 -0
- package/dist/runtime/locale/tr.js +9 -0
- package/dist/runtime/locale/ug_cn.js +9 -0
- package/dist/runtime/locale/uk.js +9 -0
- package/dist/runtime/locale/ur.js +9 -0
- package/dist/runtime/locale/uz.js +9 -0
- package/dist/runtime/locale/vi.js +9 -0
- package/dist/runtime/locale/zh_cn.js +9 -0
- package/dist/runtime/locale/zh_tw.js +9 -0
- package/dist/runtime/plugins/colors.js +1 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +9 -0
- package/dist/runtime/types/prose.d.ts +1 -0
- package/dist/runtime/types/prose.js +1 -0
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/vue/overrides/inertia/Link.vue +3 -3
- package/dist/runtime/vue/overrides/none/Link.vue +3 -2
- package/dist/runtime/vue/overrides/vue-router/Link.vue +27 -31
- package/dist/shared/{ui.DJUbBpE2.mjs → ui.C6mn7iap.mjs} +189 -37
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +49 -40
|
@@ -46,80 +46,82 @@ const [DefineFeatureTemplate, ReuseFeatureTemplate] = createReusableTemplate({
|
|
|
46
46
|
|
|
47
47
|
<template>
|
|
48
48
|
<DefineTierTemplate v-slot="{ tier }">
|
|
49
|
-
<slot :
|
|
50
|
-
<slot name="tier" :tier="tier">
|
|
51
|
-
<
|
|
52
|
-
<div data-slot="
|
|
53
|
-
<slot :
|
|
54
|
-
<slot name="tier-title" :tier="tier">
|
|
55
|
-
|
|
49
|
+
<div data-slot="tierWrapper" :class="ui.tierWrapper({ class: uiProp?.tierWrapper })">
|
|
50
|
+
<slot :name="tier.id" :tier="tier">
|
|
51
|
+
<slot name="tier" :tier="tier">
|
|
52
|
+
<div data-slot="tierTitleWrapper" :class="ui.tierTitleWrapper({ class: uiProp?.tierTitleWrapper })">
|
|
53
|
+
<div data-slot="tierTitle" :class="ui.tierTitle({ class: uiProp?.tierTitle })">
|
|
54
|
+
<slot :name="`${tier.id}-title`" :tier="tier">
|
|
55
|
+
<slot name="tier-title" :tier="tier">
|
|
56
|
+
{{ tier.title }}
|
|
57
|
+
</slot>
|
|
56
58
|
</slot>
|
|
57
|
-
</
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<slot :name="`${tier.id}-badge`" :tier="tier">
|
|
61
|
-
<slot name="tier-badge" :tier="tier">
|
|
62
|
-
<UBadge
|
|
63
|
-
v-if="tier.badge"
|
|
64
|
-
color="primary"
|
|
65
|
-
variant="subtle"
|
|
66
|
-
v-bind="typeof tier.badge === 'string' ? { label: tier.badge } : tier.badge"
|
|
67
|
-
data-slot="tierBadge"
|
|
68
|
-
:class="ui.tierBadge({ class: uiProp?.tierBadge })"
|
|
69
|
-
/>
|
|
70
|
-
</slot>
|
|
71
|
-
</slot>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<div v-if="tier.description || !!slots['tier-description'] || !!slots[`${tier.id}-description`]" data-slot="tierDescription" :class="ui.tierDescription({ class: uiProp?.tierDescription })">
|
|
75
|
-
<slot :name="`${tier.id}-description`" :tier="tier">
|
|
76
|
-
<slot name="tier-description" :tier="tier">
|
|
77
|
-
{{ tier.description }}
|
|
78
|
-
</slot>
|
|
79
|
-
</slot>
|
|
80
|
-
</div>
|
|
59
|
+
</div>
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
<slot :name="`${tier.id}-badge`" :tier="tier">
|
|
62
|
+
<slot name="tier-badge" :tier="tier">
|
|
63
|
+
<UBadge
|
|
64
|
+
v-if="tier.badge"
|
|
65
|
+
color="primary"
|
|
66
|
+
variant="subtle"
|
|
67
|
+
v-bind="typeof tier.badge === 'string' ? { label: tier.badge } : tier.badge"
|
|
68
|
+
data-slot="tierBadge"
|
|
69
|
+
:class="ui.tierBadge({ class: uiProp?.tierBadge })"
|
|
70
|
+
/>
|
|
87
71
|
</slot>
|
|
88
72
|
</slot>
|
|
89
73
|
</div>
|
|
90
74
|
|
|
91
|
-
<div
|
|
92
|
-
<slot :name="`${tier.id}-
|
|
93
|
-
<slot name="tier-
|
|
94
|
-
{{ tier.
|
|
75
|
+
<div data-slot="tierDescription" :class="ui.tierDescription({ class: uiProp?.tierDescription })">
|
|
76
|
+
<slot :name="`${tier.id}-description`" :tier="tier">
|
|
77
|
+
<slot name="tier-description" :tier="tier">
|
|
78
|
+
{{ tier.description }}
|
|
95
79
|
</slot>
|
|
96
80
|
</slot>
|
|
97
81
|
</div>
|
|
98
82
|
|
|
99
|
-
<div
|
|
100
|
-
<
|
|
101
|
-
<slot name="tier-
|
|
102
|
-
<
|
|
103
|
-
{{ tier.
|
|
104
|
-
</
|
|
83
|
+
<div data-slot="tierPriceWrapper" :class="ui.tierPriceWrapper({ class: uiProp?.tierPriceWrapper })">
|
|
84
|
+
<div v-if="tier.discount && tier.price || !!slots[`${tier.id}-discount`] || !!slots['tier-discount']" data-slot="tierDiscount" :class="ui.tierDiscount({ class: uiProp?.tierDiscount })">
|
|
85
|
+
<slot :name="`${tier.id}-discount`" :tier="tier">
|
|
86
|
+
<slot name="tier-discount" :tier="tier">
|
|
87
|
+
{{ tier.price }}
|
|
88
|
+
</slot>
|
|
89
|
+
</slot>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div v-if="tier.discount || tier.price || !!slots[`${tier.id}-price`] || !!slots['tier-price']" data-slot="tierPrice" :class="ui.tierPrice({ class: uiProp?.tierPrice })">
|
|
93
|
+
<slot :name="`${tier.id}-price`" :tier="tier">
|
|
94
|
+
<slot name="tier-price" :tier="tier">
|
|
95
|
+
{{ tier.discount || tier.price }}
|
|
96
|
+
</slot>
|
|
97
|
+
</slot>
|
|
98
|
+
</div>
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
<div v-if="tier.billingCycle || tier.billingPeriod || !!slots[`${tier.id}-billing`] || !!slots['tier-billing']" data-slot="tierBilling" :class="ui.tierBilling({ class: uiProp?.tierBilling })">
|
|
101
|
+
<slot :name="`${tier.id}-billing`" :tier="tier">
|
|
102
|
+
<slot name="tier-billing" :tier="tier">
|
|
103
|
+
<span data-slot="tierBillingPeriod" :class="ui.tierBillingPeriod({ class: uiProp?.tierBillingPeriod })">
|
|
104
|
+
{{ tier.billingPeriod || "\xA0" }}
|
|
105
|
+
</span>
|
|
106
|
+
|
|
107
|
+
<span v-if="tier.billingCycle" data-slot="tierBillingCycle" :class="ui.tierBillingCycle({ class: uiProp?.tierBillingCycle })">
|
|
108
|
+
{{ tier.billingCycle }}
|
|
109
|
+
</span>
|
|
110
|
+
</slot>
|
|
109
111
|
</slot>
|
|
110
|
-
</
|
|
112
|
+
</div>
|
|
111
113
|
</div>
|
|
112
|
-
</div>
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
<div v-if="!!slots[`${tier.id}-button`] || !!slots['tier-button'] || tier.button" data-slot="tierButton" :class="ui.tierButton({ class: uiProp?.tierButton })">
|
|
116
|
+
<slot :name="`${tier.id}-button`" :tier="tier">
|
|
117
|
+
<slot name="tier-button" :tier="tier">
|
|
118
|
+
<UButton v-if="tier.button" block size="lg" v-bind="tier.button" />
|
|
119
|
+
</slot>
|
|
118
120
|
</slot>
|
|
119
|
-
</
|
|
120
|
-
</
|
|
121
|
+
</div>
|
|
122
|
+
</slot>
|
|
121
123
|
</slot>
|
|
122
|
-
</
|
|
124
|
+
</div>
|
|
123
125
|
</DefineTierTemplate>
|
|
124
126
|
|
|
125
127
|
<DefineFeatureTemplate v-slot="{ feature, tier }">
|
|
@@ -8,6 +8,7 @@ import { RadioGroupRoot, RadioGroupItem as RRadioGroupItem, RadioGroupIndicator,
|
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
10
|
import { useComponentUI } from "../composables/useComponentUI";
|
|
11
|
+
import { useResolvedVariants } from "../composables/useResolvedVariants";
|
|
11
12
|
import { useFormField } from "../composables/useFormField";
|
|
12
13
|
import { get } from "../utils";
|
|
13
14
|
import { tv } from "../utils/tv";
|
|
@@ -39,13 +40,14 @@ const uiProp = useComponentUI("radioGroup", props);
|
|
|
39
40
|
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "loop", "required"), emits);
|
|
40
41
|
const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled, ariaAttrs } = useFormField(props, { bind: false });
|
|
41
42
|
const id = _id.value ?? useId();
|
|
43
|
+
const { variant } = useResolvedVariants("radioGroup", props, theme, ["variant"]);
|
|
42
44
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.radioGroup || {} })({
|
|
43
45
|
size: size.value,
|
|
44
46
|
color: color.value,
|
|
45
47
|
disabled: disabled.value,
|
|
46
48
|
required: props.required,
|
|
47
49
|
orientation: props.orientation,
|
|
48
|
-
variant:
|
|
50
|
+
variant: variant.value,
|
|
49
51
|
indicator: props.indicator
|
|
50
52
|
}));
|
|
51
53
|
function normalizeItem(item) {
|
|
@@ -108,7 +110,7 @@ function onUpdate(value) {
|
|
|
108
110
|
</slot>
|
|
109
111
|
</legend>
|
|
110
112
|
|
|
111
|
-
<component :is="
|
|
113
|
+
<component :is="variant === 'list' ? 'div' : Label" v-for="item in normalizedItems" :key="item.value" data-slot="item" :class="ui.item({ class: [uiProp?.item, item.ui?.item, item.class], disabled: item.disabled || disabled })">
|
|
112
114
|
<div data-slot="container" :class="ui.container({ class: [uiProp?.container, item.ui?.container] })">
|
|
113
115
|
<RRadioGroupItem
|
|
114
116
|
:id="item.id"
|
|
@@ -122,7 +124,7 @@ function onUpdate(value) {
|
|
|
122
124
|
</div>
|
|
123
125
|
|
|
124
126
|
<div v-if="item.label || !!slots.label || (item.description || !!slots.description)" data-slot="wrapper" :class="ui.wrapper({ class: [uiProp?.wrapper, item.ui?.wrapper] })">
|
|
125
|
-
<component :is="
|
|
127
|
+
<component :is="variant === 'list' ? Label : 'p'" v-if="item.label || !!slots.label" :for="item.id" data-slot="label" :class="ui.label({ class: [uiProp?.label, item.ui?.label], disabled: item.disabled || disabled })">
|
|
126
128
|
<slot name="label" :item="item" :model-value="modelValue">
|
|
127
129
|
{{ item.label }}
|
|
128
130
|
</slot>
|
|
@@ -183,7 +183,7 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectItem>, VK extends Get
|
|
|
183
183
|
} ? P : {});
|
|
184
184
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
185
185
|
triggerRef: Readonly<import("vue").Ref<HTMLButtonElement, HTMLButtonElement>>;
|
|
186
|
-
viewportRef: Readonly<import("vue").Ref<
|
|
186
|
+
viewportRef: Readonly<import("vue").Ref<HTMLElement | null, HTMLElement | null>>;
|
|
187
187
|
}>) => void;
|
|
188
188
|
attrs: any;
|
|
189
189
|
slots: SelectSlots<T, VK, M, Mod, NestedItem<T>>;
|
|
@@ -4,12 +4,13 @@ import theme from "#build/ui/select";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { useTemplateRef, computed, onMounted, toRef } from "vue";
|
|
7
|
-
import { SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectLabel, SelectGroup, SelectItem as RSelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
|
|
7
|
+
import { SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectValue as RSelectValue, SelectLabel, SelectGroup, SelectItem as RSelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { reactivePick } from "@vueuse/core";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useComponentUI } from "../composables/useComponentUI";
|
|
12
|
-
import {
|
|
12
|
+
import { useResolvedVariants } from "../composables/useResolvedVariants";
|
|
13
|
+
import { useFieldGroup, FieldGroupReset } from "../composables/useFieldGroup";
|
|
13
14
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
14
15
|
import { useFormField } from "../composables/useFormField";
|
|
15
16
|
import { usePortal } from "../composables/usePortal";
|
|
@@ -63,12 +64,16 @@ const appConfig = useAppConfig();
|
|
|
63
64
|
const uiProp = useComponentUI("select", props);
|
|
64
65
|
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "disabled", "autocomplete", "required", "multiple"), emits);
|
|
65
66
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
66
|
-
const
|
|
67
|
+
const { position } = useResolvedVariants("select", props, theme, ["position"], {
|
|
68
|
+
position: () => props.content?.position
|
|
69
|
+
});
|
|
70
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: position.value }));
|
|
67
71
|
const arrowProps = toRef(() => defu(props.arrow, { rounded: true }));
|
|
68
|
-
const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size:
|
|
72
|
+
const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formFieldSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
69
73
|
const { orientation, size: fieldGroupSize } = useFieldGroup(props);
|
|
70
74
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })));
|
|
71
|
-
const selectSize = computed(() => fieldGroupSize.value ||
|
|
75
|
+
const selectSize = computed(() => fieldGroupSize.value || formFieldSize.value);
|
|
76
|
+
const isItemAligned = computed(() => position.value === "item-aligned");
|
|
72
77
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.select || {} })({
|
|
73
78
|
color: color.value,
|
|
74
79
|
variant: props.variant,
|
|
@@ -77,7 +82,8 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.select || {}
|
|
|
77
82
|
highlight: highlight.value,
|
|
78
83
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
79
84
|
trailing: isTrailing.value || !!slots.trailing,
|
|
80
|
-
fieldGroup: orientation.value
|
|
85
|
+
fieldGroup: orientation.value,
|
|
86
|
+
position: position.value
|
|
81
87
|
}));
|
|
82
88
|
const groups = computed(
|
|
83
89
|
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
@@ -144,7 +150,10 @@ function isSelectItem(item) {
|
|
|
144
150
|
const viewportRef = useTemplateRef("viewportRef");
|
|
145
151
|
defineExpose({
|
|
146
152
|
triggerRef: toRef(() => triggerRef.value?.$el),
|
|
147
|
-
viewportRef: toRef(() =>
|
|
153
|
+
viewportRef: toRef(() => {
|
|
154
|
+
const instance = viewportRef.value;
|
|
155
|
+
return instance && typeof instance === "object" && "$el" in instance ? instance.$el : instance;
|
|
156
|
+
})
|
|
148
157
|
});
|
|
149
158
|
</script>
|
|
150
159
|
|
|
@@ -174,16 +183,16 @@ defineExpose({
|
|
|
174
183
|
</slot>
|
|
175
184
|
</span>
|
|
176
185
|
|
|
177
|
-
<
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<
|
|
183
|
-
{{ placeholder ?? "\xA0" }}
|
|
184
|
-
</
|
|
185
|
-
</
|
|
186
|
-
</
|
|
186
|
+
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
187
|
+
<RSelectValue
|
|
188
|
+
:data-slot="displayedModelValue != null ? 'value' : 'placeholder'"
|
|
189
|
+
:class="displayedModelValue != null ? ui.value({ class: uiProp?.value }) : ui.placeholder({ class: uiProp?.placeholder })"
|
|
190
|
+
>
|
|
191
|
+
<slot :model-value="modelValue" :open="open" :ui="ui">
|
|
192
|
+
{{ displayedModelValue ?? (placeholder ?? "\xA0") }}
|
|
193
|
+
</slot>
|
|
194
|
+
</RSelectValue>
|
|
195
|
+
</template>
|
|
187
196
|
|
|
188
197
|
<span v-if="isTrailing || !!slots.trailing" data-slot="trailing" :class="ui.trailing({ class: uiProp?.trailing })">
|
|
189
198
|
<slot name="trailing" :model-value="modelValue" :open="open" :ui="ui">
|
|
@@ -193,72 +202,74 @@ defineExpose({
|
|
|
193
202
|
</SelectTrigger>
|
|
194
203
|
|
|
195
204
|
<SelectPortal v-bind="portalProps">
|
|
196
|
-
<
|
|
197
|
-
<slot
|
|
205
|
+
<FieldGroupReset>
|
|
206
|
+
<SelectContent data-slot="content" :class="ui.content({ class: uiProp?.content })" v-bind="contentProps">
|
|
207
|
+
<slot name="content-top" />
|
|
198
208
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
<component :is="isItemAligned ? SelectViewport : 'div'" ref="viewportRef" role="presentation" data-slot="viewport" :class="ui.viewport({ class: uiProp?.viewport })">
|
|
210
|
+
<SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" data-slot="group" :class="ui.group({ class: uiProp?.group })">
|
|
211
|
+
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
212
|
+
<SelectLabel v-if="isSelectItem(item) && item.type === 'label'" data-slot="label" :class="ui.label({ class: [uiProp?.label, item.ui?.label, item.class] })">
|
|
213
|
+
{{ get(item, props.labelKey) }}
|
|
214
|
+
</SelectLabel>
|
|
205
215
|
|
|
206
|
-
|
|
216
|
+
<SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" data-slot="separator" :class="ui.separator({ class: [uiProp?.separator, item.ui?.separator, item.class] })" />
|
|
207
217
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
218
|
+
<RSelectItem
|
|
219
|
+
v-else
|
|
220
|
+
data-slot="item"
|
|
221
|
+
:class="ui.item({ class: [uiProp?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] })"
|
|
222
|
+
:disabled="isSelectItem(item) && item.disabled"
|
|
223
|
+
:value="isSelectItem(item) ? get(item, props.valueKey) : item"
|
|
224
|
+
@select="isSelectItem(item) && item.onSelect?.($event)"
|
|
225
|
+
>
|
|
226
|
+
<slot name="item" :item="item" :index="index" :ui="ui">
|
|
227
|
+
<slot name="item-leading" :item="item" :index="index" :ui="ui">
|
|
228
|
+
<UIcon v-if="isSelectItem(item) && item.icon" :name="item.icon" data-slot="itemLeadingIcon" :class="ui.itemLeadingIcon({ class: [uiProp?.itemLeadingIcon, item.ui?.itemLeadingIcon] })" />
|
|
229
|
+
<UAvatar v-else-if="isSelectItem(item) && item.avatar" :size="item.ui?.itemLeadingAvatarSize || uiProp?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" data-slot="itemLeadingAvatar" :class="ui.itemLeadingAvatar({ class: [uiProp?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })" />
|
|
230
|
+
<UChip
|
|
231
|
+
v-else-if="isSelectItem(item) && item.chip"
|
|
232
|
+
:size="item.ui?.itemLeadingChipSize || uiProp?.itemLeadingChipSize || ui.itemLeadingChipSize()"
|
|
233
|
+
inset
|
|
234
|
+
standalone
|
|
235
|
+
v-bind="item.chip"
|
|
236
|
+
data-slot="itemLeadingChip"
|
|
237
|
+
:class="ui.itemLeadingChip({ class: [uiProp?.itemLeadingChip, item.ui?.itemLeadingChip] })"
|
|
238
|
+
/>
|
|
239
|
+
</slot>
|
|
230
240
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
<span data-slot="itemWrapper" :class="ui.itemWrapper({ class: [uiProp?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })">
|
|
242
|
+
<SelectItemText data-slot="itemLabel" :class="ui.itemLabel({ class: [uiProp?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })">
|
|
243
|
+
<slot name="item-label" :item="item" :index="index">
|
|
244
|
+
{{ isSelectItem(item) ? get(item, props.labelKey) : item }}
|
|
245
|
+
</slot>
|
|
246
|
+
</SelectItemText>
|
|
237
247
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
248
|
+
<span v-if="isSelectItem(item) && (get(item, props.descriptionKey) || !!slots['item-description'])" data-slot="itemDescription" :class="ui.itemDescription({ class: [uiProp?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })">
|
|
249
|
+
<slot name="item-description" :item="item" :index="index">
|
|
250
|
+
{{ get(item, props.descriptionKey) }}
|
|
251
|
+
</slot>
|
|
252
|
+
</span>
|
|
242
253
|
</span>
|
|
243
|
-
</span>
|
|
244
254
|
|
|
245
|
-
|
|
246
|
-
|
|
255
|
+
<span data-slot="itemTrailing" :class="ui.itemTrailing({ class: [uiProp?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })">
|
|
256
|
+
<slot name="item-trailing" :item="item" :index="index" :ui="ui" />
|
|
247
257
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
<SelectItemIndicator as-child>
|
|
259
|
+
<UIcon :name="selectedIcon || appConfig.ui.icons.check" data-slot="itemTrailingIcon" :class="ui.itemTrailingIcon({ class: [uiProp?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })" />
|
|
260
|
+
</SelectItemIndicator>
|
|
261
|
+
</span>
|
|
262
|
+
</slot>
|
|
263
|
+
</RSelectItem>
|
|
264
|
+
</template>
|
|
265
|
+
</SelectGroup>
|
|
266
|
+
</component>
|
|
257
267
|
|
|
258
|
-
|
|
268
|
+
<slot name="content-bottom" />
|
|
259
269
|
|
|
260
|
-
|
|
261
|
-
|
|
270
|
+
<SelectArrow v-if="!!arrow" v-bind="arrowProps" data-slot="arrow" :class="ui.arrow({ class: uiProp?.arrow })" />
|
|
271
|
+
</SelectContent>
|
|
272
|
+
</FieldGroupReset>
|
|
262
273
|
</SelectPortal>
|
|
263
274
|
</SelectRoot>
|
|
264
275
|
</template>
|
|
@@ -183,7 +183,7 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectItem>, VK extends Get
|
|
|
183
183
|
} ? P : {});
|
|
184
184
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
185
185
|
triggerRef: Readonly<import("vue").Ref<HTMLButtonElement, HTMLButtonElement>>;
|
|
186
|
-
viewportRef: Readonly<import("vue").Ref<
|
|
186
|
+
viewportRef: Readonly<import("vue").Ref<HTMLElement | null, HTMLElement | null>>;
|
|
187
187
|
}>) => void;
|
|
188
188
|
attrs: any;
|
|
189
189
|
slots: SelectSlots<T, VK, M, Mod, NestedItem<T>>;
|
|
@@ -225,7 +225,6 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectMenuItem>, VK extends
|
|
|
225
225
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(SelectMenuProps<T, VK, M, Mod, C> & {
|
|
226
226
|
searchTerm?: string;
|
|
227
227
|
}) & {
|
|
228
|
-
onClear?: (() => any) | undefined;
|
|
229
228
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
230
229
|
onChange?: ((event: Event) => any) | undefined;
|
|
231
230
|
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
@@ -253,6 +252,7 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectMenuItem>, VK extends
|
|
|
253
252
|
nullable: true;
|
|
254
253
|
} ? GetModelValue<T, VK, M, ExcludeItem> | null : GetModelValue<T, VK, M, ExcludeItem>) | IsClearUsed<M, C>;
|
|
255
254
|
} | undefined) => any) | undefined;
|
|
255
|
+
onClear?: (() => any) | undefined;
|
|
256
256
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
257
257
|
onCreate?: ((item: string) => any) | undefined;
|
|
258
258
|
"onUpdate:modelValue"?: ((value: (Mod extends {
|
|
@@ -286,7 +286,7 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectMenuItem>, VK extends
|
|
|
286
286
|
}>) => void;
|
|
287
287
|
attrs: any;
|
|
288
288
|
slots: SelectMenuSlots<T, VK, M, Mod, C, NestedItem<T>>;
|
|
289
|
-
emit: (((evt: "
|
|
289
|
+
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "highlight", payload: {
|
|
290
290
|
ref: HTMLElement;
|
|
291
291
|
value: (Mod extends {
|
|
292
292
|
number: true;
|
|
@@ -309,7 +309,7 @@ declare const __VLS_export: <T extends ArrayOrNested<SelectMenuItem>, VK extends
|
|
|
309
309
|
} ? GetModelValue<T, VK, M, ExcludeItem> | null : GetModelValue<T, VK, M, ExcludeItem>) | undefined : Mod extends {
|
|
310
310
|
nullable: true;
|
|
311
311
|
} ? GetModelValue<T, VK, M, ExcludeItem> | null : GetModelValue<T, VK, M, ExcludeItem>) | IsClearUsed<M, C>;
|
|
312
|
-
} | undefined) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "create", item: string) => void) & ((evt: "update:modelValue", value: (Mod extends {
|
|
312
|
+
} | undefined) => void) & ((evt: "clear") => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "create", item: string) => void) & ((evt: "update:modelValue", value: (Mod extends {
|
|
313
313
|
number: true;
|
|
314
314
|
} ? (Mod extends {
|
|
315
315
|
optional: true;
|
|
@@ -9,7 +9,7 @@ import { defu } from "defu";
|
|
|
9
9
|
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
10
10
|
import { useAppConfig } from "#imports";
|
|
11
11
|
import { useComponentUI } from "../composables/useComponentUI";
|
|
12
|
-
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
12
|
+
import { useFieldGroup, FieldGroupReset } from "../composables/useFieldGroup";
|
|
13
13
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
14
14
|
import { useFormField } from "../composables/useFormField";
|
|
15
15
|
import { useFilter } from "../composables/useFilter";
|
|
@@ -92,10 +92,10 @@ const virtualizerProps = toRef(() => {
|
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), variant: "none" }));
|
|
95
|
-
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size:
|
|
95
|
+
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formFieldSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
96
96
|
const { orientation, size: fieldGroupSize } = useFieldGroup(props);
|
|
97
97
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })));
|
|
98
|
-
const selectSize = computed(() => fieldGroupSize.value ||
|
|
98
|
+
const selectSize = computed(() => fieldGroupSize.value || formFieldSize.value);
|
|
99
99
|
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
100
100
|
const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
|
|
101
101
|
props: {
|
|
@@ -377,67 +377,69 @@ defineExpose({
|
|
|
377
377
|
</ComboboxAnchor>
|
|
378
378
|
|
|
379
379
|
<ComboboxPortal v-bind="portalProps">
|
|
380
|
-
<
|
|
381
|
-
<
|
|
382
|
-
<slot
|
|
380
|
+
<FieldGroupReset>
|
|
381
|
+
<ComboboxContent data-slot="content" :class="ui.content({ class: uiProp?.content })" v-bind="contentProps">
|
|
382
|
+
<FocusScope trapped data-slot="focusScope" :class="ui.focusScope({ class: uiProp?.focusScope })">
|
|
383
|
+
<slot name="content-top" />
|
|
383
384
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
385
|
+
<ComboboxInput v-if="!!searchInput" v-model="searchTerm" :display-value="() => searchTerm" as-child>
|
|
386
|
+
<UInput
|
|
387
|
+
autofocus
|
|
388
|
+
autocomplete="off"
|
|
389
|
+
:size="selectSize"
|
|
390
|
+
v-bind="searchInputProps"
|
|
391
|
+
:model-modifiers="{
|
|
391
392
|
trim: modelModifiers?.trim
|
|
392
393
|
}"
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
data-slot="input"
|
|
395
|
+
:class="ui.input({ class: uiProp?.input })"
|
|
396
|
+
@change.stop
|
|
397
|
+
/>
|
|
398
|
+
</ComboboxInput>
|
|
398
399
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
<ComboboxEmpty data-slot="empty" :class="ui.empty({ class: uiProp?.empty })">
|
|
401
|
+
<slot name="empty" :search-term="searchTerm">
|
|
402
|
+
{{ searchTerm ? t("selectMenu.noMatch", { searchTerm }) : t("selectMenu.noData") }}
|
|
403
|
+
</slot>
|
|
404
|
+
</ComboboxEmpty>
|
|
404
405
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
<div ref="viewportRef" role="presentation" data-slot="viewport" :class="ui.viewport({ class: uiProp?.viewport })">
|
|
407
|
+
<template v-if="!!virtualize">
|
|
408
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'top'" />
|
|
408
409
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
410
|
+
<ComboboxVirtualizer
|
|
411
|
+
v-slot="{ option: item, virtualItem }"
|
|
412
|
+
:options="filteredItems"
|
|
413
|
+
:text-content="(item2) => isSelectItem(item2) ? get(item2, props.labelKey) : String(item2)"
|
|
414
|
+
v-bind="virtualizerProps"
|
|
415
|
+
>
|
|
416
|
+
<ReuseItemTemplate :item="item" :index="virtualItem.index" />
|
|
417
|
+
</ComboboxVirtualizer>
|
|
417
418
|
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
420
|
+
</template>
|
|
420
421
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
422
|
+
<template v-else>
|
|
423
|
+
<ComboboxGroup v-if="createItem && createItemPosition === 'top'" data-slot="group" :class="ui.group({ class: uiProp?.group })">
|
|
424
|
+
<ReuseCreateItemTemplate />
|
|
425
|
+
</ComboboxGroup>
|
|
425
426
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" data-slot="group" :class="ui.group({ class: uiProp?.group })">
|
|
428
|
+
<ReuseItemTemplate v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`" :item="item" :index="index" />
|
|
429
|
+
</ComboboxGroup>
|
|
429
430
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
<ComboboxGroup v-if="createItem && createItemPosition === 'bottom'" data-slot="group" :class="ui.group({ class: uiProp?.group })">
|
|
432
|
+
<ReuseCreateItemTemplate />
|
|
433
|
+
</ComboboxGroup>
|
|
434
|
+
</template>
|
|
435
|
+
</div>
|
|
435
436
|
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
<slot name="content-bottom" />
|
|
438
|
+
</FocusScope>
|
|
438
439
|
|
|
439
|
-
|
|
440
|
-
|
|
440
|
+
<ComboboxArrow v-if="!!arrow" v-bind="arrowProps" data-slot="arrow" :class="ui.arrow({ class: uiProp?.arrow })" />
|
|
441
|
+
</ComboboxContent>
|
|
442
|
+
</FieldGroupReset>
|
|
441
443
|
</ComboboxPortal>
|
|
442
444
|
</ComboboxRoot>
|
|
443
445
|
</template>
|