@byyuurin/ui 0.3.0 → 0.4.0
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/LICENSE +20 -20
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +43 -43
- package/dist/runtime/components/Alert.vue +65 -64
- package/dist/runtime/components/App.vue +10 -10
- package/dist/runtime/components/Avatar.vue +31 -30
- package/dist/runtime/components/AvatarGroup.vue +6 -5
- package/dist/runtime/components/Badge.vue +36 -35
- package/dist/runtime/components/Breadcrumb.vue +51 -51
- package/dist/runtime/components/Button.vue +54 -55
- package/dist/runtime/components/Calendar.vue +76 -75
- package/dist/runtime/components/Card.vue +43 -42
- package/dist/runtime/components/Carousel.vue +68 -67
- package/dist/runtime/components/Checkbox.vue +50 -48
- package/dist/runtime/components/CheckboxGroup.vue +33 -32
- package/dist/runtime/components/Chip.vue +20 -16
- package/dist/runtime/components/Collapsible.vue +16 -15
- package/dist/runtime/components/Drawer.vue +78 -77
- package/dist/runtime/components/DropdownMenu.vue +29 -29
- package/dist/runtime/components/DropdownMenuContent.vue +152 -152
- package/dist/runtime/components/FieldGroup.vue +5 -4
- package/dist/runtime/components/FileUpload.vue +267 -0
- package/dist/runtime/components/FileUpload.vue.d.ts +178 -0
- package/dist/runtime/components/Form.vue +11 -10
- package/dist/runtime/components/FormField.vue +39 -38
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/Input.vue +52 -52
- package/dist/runtime/components/InputNumber.vue +50 -49
- package/dist/runtime/components/InputTags.vue +55 -55
- package/dist/runtime/components/Kbd.vue +5 -4
- package/dist/runtime/components/Link.vue +25 -24
- package/dist/runtime/components/LinkBase.vue +3 -3
- package/dist/runtime/components/Marquee.vue +7 -6
- package/dist/runtime/components/Modal.vue +76 -75
- package/dist/runtime/components/NavigationMenu.vue +230 -230
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Pagination.vue +49 -48
- package/dist/runtime/components/PinInput.vue +25 -25
- package/dist/runtime/components/Popover.vue +23 -23
- package/dist/runtime/components/Progress.vue +27 -26
- package/dist/runtime/components/RadioGroup.vue +53 -53
- package/dist/runtime/components/ScrollArea.vue +34 -33
- package/dist/runtime/components/Select.vue +203 -203
- package/dist/runtime/components/Separator.vue +32 -31
- package/dist/runtime/components/Skeleton.vue +13 -12
- package/dist/runtime/components/Slider.vue +27 -26
- package/dist/runtime/components/Stepper.vue +53 -52
- package/dist/runtime/components/Stepper.vue.d.ts +2 -2
- package/dist/runtime/components/Switch.vue +33 -34
- package/dist/runtime/components/Table.vue +139 -138
- package/dist/runtime/components/Tabs.vue +76 -76
- package/dist/runtime/components/Textarea.vue +50 -50
- package/dist/runtime/components/Timeline.vue +49 -48
- package/dist/runtime/components/Toast.vue +95 -94
- package/dist/runtime/components/ToastProvider.vue +31 -31
- package/dist/runtime/components/Tooltip.vue +26 -25
- package/dist/runtime/components/Tree.vue +133 -133
- package/dist/runtime/composables/useFileUpload.d.ts +19 -0
- package/dist/runtime/composables/useFileUpload.js +79 -0
- package/dist/runtime/composables/useLocale.d.ts +6 -0
- package/dist/runtime/locale/en.d.ts +3 -0
- package/dist/runtime/locale/en.js +3 -0
- package/dist/runtime/locale/zh_tw.d.ts +3 -0
- package/dist/runtime/locale/zh_tw.js +3 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +3 -0
- package/dist/runtime/types/unocss.d.ts +4 -4
- package/dist/runtime/types/utils.d.ts +1 -1
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/setup.d.mts +1 -1
- package/dist/shared/{ui.D8Bg1HWt.d.mts → ui.CGCKYv7g.d.mts} +4 -2
- package/dist/shared/{ui.9kQouwss.mjs → ui.DYMXCXO6.mjs} +4 -2
- package/dist/shared/{ui.DpkP12cX.mjs → ui.DcEKQd0n.mjs} +230 -5
- package/dist/unocss.mjs +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +10 -10
- package/vue-plugin.d.ts +5 -5
|
@@ -7,7 +7,7 @@ import { reactivePick } from "@vueuse/core";
|
|
|
7
7
|
import { DropdownMenuArrow, DropdownMenuRoot, DropdownMenuTrigger, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { computed, toRef } from "vue";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
|
-
import { omit } from "../utils";
|
|
10
|
+
import { omit, pick } from "../utils";
|
|
11
11
|
import { cv, merge } from "../utils/style";
|
|
12
12
|
import DropdownMenuContent from "./DropdownMenuContent.vue";
|
|
13
13
|
const props = defineProps({
|
|
@@ -37,36 +37,36 @@ const getProxySlots = () => omit(slots, ["default"]);
|
|
|
37
37
|
const appConfig = useAppConfig();
|
|
38
38
|
const ui = computed(() => {
|
|
39
39
|
const styler = cv(merge(theme, appConfig.ui.dropdownMenu));
|
|
40
|
-
return styler(props);
|
|
40
|
+
return styler(pick(props, ["size"]));
|
|
41
41
|
});
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<template>
|
|
45
|
-
<DropdownMenuRoot v-slot="{ open }" v-bind="rootProps">
|
|
46
|
-
<DropdownMenuTrigger v-if="!!slots.default" as-child :class="props.class" :disabled="props.disabled">
|
|
47
|
-
<slot :open="open"></slot>
|
|
48
|
-
</DropdownMenuTrigger>
|
|
49
|
-
|
|
50
|
-
<DropdownMenuContent
|
|
51
|
-
v-bind="contentProps"
|
|
52
|
-
:size="props.size"
|
|
53
|
-
:items="props.items"
|
|
54
|
-
:portal="props.portal"
|
|
55
|
-
:label-key="props.labelKey"
|
|
56
|
-
:description-key="props.descriptionKey"
|
|
57
|
-
:checked-icon="props.checkedIcon"
|
|
58
|
-
:loading-icon="props.loadingIcon"
|
|
59
|
-
:external-icon="props.externalIcon"
|
|
60
|
-
:ui="ui"
|
|
61
|
-
:ui-override="props.ui"
|
|
62
|
-
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
63
|
-
data-part="content"
|
|
64
|
-
>
|
|
65
|
-
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
66
|
-
<slot :name="name" v-bind="slotProps"></slot>
|
|
67
|
-
</template>
|
|
68
|
-
|
|
69
|
-
<DropdownMenuArrow v-if="props.arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
70
|
-
</DropdownMenuContent>
|
|
71
|
-
</DropdownMenuRoot>
|
|
45
|
+
<DropdownMenuRoot v-slot="{ open }" v-bind="rootProps">
|
|
46
|
+
<DropdownMenuTrigger v-if="!!slots.default" as-child :class="props.class" :disabled="props.disabled">
|
|
47
|
+
<slot :open="open"></slot>
|
|
48
|
+
</DropdownMenuTrigger>
|
|
49
|
+
|
|
50
|
+
<DropdownMenuContent
|
|
51
|
+
v-bind="contentProps"
|
|
52
|
+
:size="props.size"
|
|
53
|
+
:items="props.items"
|
|
54
|
+
:portal="props.portal"
|
|
55
|
+
:label-key="props.labelKey"
|
|
56
|
+
:description-key="props.descriptionKey"
|
|
57
|
+
:checked-icon="props.checkedIcon"
|
|
58
|
+
:loading-icon="props.loadingIcon"
|
|
59
|
+
:external-icon="props.externalIcon"
|
|
60
|
+
:ui="ui"
|
|
61
|
+
:ui-override="props.ui"
|
|
62
|
+
:class="ui.content({ class: [props.ui?.content, !slots.default && props.class] })"
|
|
63
|
+
data-part="content"
|
|
64
|
+
>
|
|
65
|
+
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
66
|
+
<slot :name="name" v-bind="slotProps"></slot>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<DropdownMenuArrow v-if="props.arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
70
|
+
</DropdownMenuContent>
|
|
71
|
+
</DropdownMenuRoot>
|
|
72
72
|
</template>
|
|
@@ -66,156 +66,156 @@ const groups = computed(
|
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
<template>
|
|
69
|
-
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
70
|
-
<slot :name="item.slot || 'item'" :item="item" :index="index" :ui="ui">
|
|
71
|
-
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="active" :index="index" :ui="ui">
|
|
72
|
-
<Icon
|
|
73
|
-
v-if="item.loading"
|
|
74
|
-
:name="loadingIcon || appConfig.ui.icons.loading"
|
|
75
|
-
:class="props.ui.itemLeadingIcon({ class: [props.uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item.color, loading: true })"
|
|
76
|
-
data-part="itemLeadingIcon"
|
|
77
|
-
/>
|
|
78
|
-
<Icon
|
|
79
|
-
v-else-if="item.icon"
|
|
80
|
-
:name="item.icon"
|
|
81
|
-
:class="props.ui.itemLeadingIcon({ class: [props.uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item.color, active })"
|
|
82
|
-
data-part="itemLeadingIcon"
|
|
83
|
-
/>
|
|
84
|
-
<Avatar
|
|
85
|
-
v-else-if="item.avatar"
|
|
86
|
-
v-bind="item.avatar"
|
|
87
|
-
:size="item.avatar.size || props.size"
|
|
88
|
-
:class="props.ui.itemLeadingAvatar({ class: [props.uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })"
|
|
89
|
-
data-part="itemLeadingAvatar"
|
|
90
|
-
/>
|
|
91
|
-
</slot>
|
|
92
|
-
|
|
93
|
-
<span
|
|
94
|
-
v-if="get(item, props.labelKey) || !!slots[`${item.slot || 'item'}-label`] || (get(item, props.descriptionKey) || !!slots[`${item.slot || 'item'}-description`])"
|
|
95
|
-
:class="props.ui.itemWrapper({ class: [props.uiOverride?.itemWrapper, item.ui?.itemWrapper] })"
|
|
96
|
-
data-part="itemWrapper"
|
|
97
|
-
>
|
|
98
|
-
<span
|
|
99
|
-
v-if="get(item, props.labelKey) || !!slots[`${item.slot || 'item'}-label`]"
|
|
100
|
-
:class="props.ui.itemLabel({ class: [props.uiOverride?.itemLabel, item.ui?.itemLabel], active })"
|
|
101
|
-
data-part="itemLabel"
|
|
102
|
-
>
|
|
103
|
-
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="active" :index="index">
|
|
104
|
-
{{ get(item, props.labelKey) }}
|
|
105
|
-
</slot>
|
|
106
|
-
|
|
107
|
-
<Icon
|
|
108
|
-
v-if="item.target === '_blank' && props.externalIcon !== false"
|
|
109
|
-
:name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external"
|
|
110
|
-
:class="props.ui.itemLabelExternalIcon({ class: [props.uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item.color, active })"
|
|
111
|
-
data-part="itemLabelExternalIcon"
|
|
112
|
-
/>
|
|
113
|
-
</span>
|
|
114
|
-
|
|
115
|
-
<span v-if="get(item, props.descriptionKey)" :class="props.ui.itemDescription({ class: [props.uiOverride?.itemDescription, item.ui?.itemDescription] })" data-part="itemDescription">
|
|
116
|
-
<slot :name="`${item.slot || 'item'}-description`" :item="item" :active="active" :index="index">
|
|
117
|
-
{{ get(item, props.descriptionKey) }}
|
|
118
|
-
</slot>
|
|
119
|
-
</span>
|
|
120
|
-
</span>
|
|
121
|
-
|
|
122
|
-
<span :class="props.ui.itemTrailing({ class: [props.uiOverride?.itemTrailing, item.ui?.itemTrailing] })" data-part="itemTrailing">
|
|
123
|
-
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="active" :index="index" :ui="ui">
|
|
124
|
-
<Icon v-if="item.children?.length" :name="childrenIcon" :class="props.ui.itemTrailingIcon({ class: [props.uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item.color, active })" data-part="itemTrailingIcon" />
|
|
125
|
-
<span v-else-if="item.kbds?.length" :class="props.ui.itemTrailingKbds({ class: [props.uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })" data-part="itemTrailingKbds">
|
|
126
|
-
<Kbd
|
|
127
|
-
v-for="(kbd, kbdIndex) in item.kbds"
|
|
128
|
-
:key="kbdIndex"
|
|
129
|
-
:size="item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()"
|
|
130
|
-
v-bind="typeof kbd === 'string' ? { value: kbd } : kbd"
|
|
131
|
-
/>
|
|
132
|
-
</span>
|
|
133
|
-
</slot>
|
|
134
|
-
|
|
135
|
-
<DropdownMenu.ItemIndicator as-child>
|
|
136
|
-
<Icon :name="props.checkedIcon || appConfig.ui.icons.check" :class="props.ui.itemTrailingIcon({ class: [props.uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item.color })" data-part="itemTrailingIcon" />
|
|
137
|
-
</DropdownMenu.ItemIndicator>
|
|
138
|
-
</span>
|
|
139
|
-
</slot>
|
|
140
|
-
</DefineItemTemplate>
|
|
141
|
-
|
|
142
|
-
<DropdownMenu.Portal v-bind="portalProps">
|
|
143
|
-
<component :is="props.sub ? DropdownMenu.SubContent : DropdownMenu.Content" v-bind="{ ...contentProps, ...$attrs }" :class="props.class">
|
|
144
|
-
<slot name="content-top" :sub="props.sub ?? false"></slot>
|
|
145
|
-
|
|
146
|
-
<div role="presentation" :class="props.ui.viewport({ class: props.uiOverride?.viewport })" data-part="viewport">
|
|
147
|
-
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="props.ui.group({ class: props.uiOverride?.group })" data-part="group">
|
|
148
|
-
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
149
|
-
<DropdownMenu.Label v-if="item.type === 'label'" :class="props.ui.label({ class: [props.uiOverride?.label, item.ui?.label, item.class] })" data-part="label">
|
|
150
|
-
<ReuseItemTemplate :item="item" :index="index" />
|
|
151
|
-
</DropdownMenu.Label>
|
|
152
|
-
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="props.ui.separator({ class: [props.uiOverride?.separator, item.ui?.separator, item.class] })" data-part="separator" />
|
|
153
|
-
<DropdownMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
|
154
|
-
<DropdownMenu.SubTrigger
|
|
155
|
-
as="button"
|
|
156
|
-
type="button"
|
|
157
|
-
:disabled="item.disabled"
|
|
158
|
-
:text-value="get(item, props.labelKey)"
|
|
159
|
-
:class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color })"
|
|
160
|
-
data-part="item"
|
|
161
|
-
>
|
|
162
|
-
<ReuseItemTemplate :item="item" :index="index" />
|
|
163
|
-
</DropdownMenu.SubTrigger>
|
|
164
|
-
|
|
165
|
-
<DropdownMenuContent
|
|
166
|
-
sub
|
|
167
|
-
:class="props.class"
|
|
168
|
-
:ui="props.ui"
|
|
169
|
-
:ui-override="props.uiOverride"
|
|
170
|
-
:portal="props.portal"
|
|
171
|
-
:items="item.children"
|
|
172
|
-
side="right"
|
|
173
|
-
align="start"
|
|
174
|
-
:align-offset="-4"
|
|
175
|
-
:side-offset="3"
|
|
176
|
-
:label-key="props.labelKey"
|
|
177
|
-
:description-key="props.descriptionKey"
|
|
178
|
-
:checked-icon="props.checkedIcon"
|
|
179
|
-
:loading-icon="props.loadingIcon"
|
|
180
|
-
:external-icon="props.externalIcon"
|
|
181
|
-
v-bind="item.content"
|
|
182
|
-
>
|
|
183
|
-
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
184
|
-
<slot :name="name" v-bind="slotProps"></slot>
|
|
185
|
-
</template>
|
|
186
|
-
</DropdownMenuContent>
|
|
187
|
-
</DropdownMenu.Sub>
|
|
188
|
-
<DropdownMenu.CheckboxItem
|
|
189
|
-
v-else-if="item.type === 'checkbox'"
|
|
190
|
-
:model-value="item.checked"
|
|
191
|
-
:disabled="item.disabled"
|
|
192
|
-
:text-value="get(item, props.labelKey)"
|
|
193
|
-
:class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color })"
|
|
194
|
-
data-part="item"
|
|
195
|
-
@update:model-value="item.onUpdateChecked"
|
|
196
|
-
@select="item.onSelect"
|
|
197
|
-
>
|
|
198
|
-
<ReuseItemTemplate :item="item" :index="index" />
|
|
199
|
-
</DropdownMenu.CheckboxItem>
|
|
200
|
-
<Link v-else v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
201
|
-
<DropdownMenu.Item
|
|
202
|
-
as-child
|
|
203
|
-
:disabled="item.disabled"
|
|
204
|
-
:text-value="get(item, props.labelKey)"
|
|
205
|
-
@select="item.onSelect"
|
|
206
|
-
>
|
|
207
|
-
<LinkBase v-bind="slotProps" :class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color, active })" data-part="item">
|
|
208
|
-
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
209
|
-
</LinkBase>
|
|
210
|
-
</DropdownMenu.Item>
|
|
211
|
-
</Link>
|
|
212
|
-
</template>
|
|
213
|
-
</DropdownMenu.Group>
|
|
214
|
-
</div>
|
|
215
|
-
|
|
216
|
-
<slot></slot>
|
|
217
|
-
|
|
218
|
-
<slot name="content-bottom" :sub="props.sub ?? false"></slot>
|
|
219
|
-
</component>
|
|
220
|
-
</DropdownMenu.Portal>
|
|
69
|
+
<DefineItemTemplate v-slot="{ item, active, index }">
|
|
70
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :ui="ui">
|
|
71
|
+
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="active" :index="index" :ui="ui">
|
|
72
|
+
<Icon
|
|
73
|
+
v-if="item.loading"
|
|
74
|
+
:name="loadingIcon || appConfig.ui.icons.loading"
|
|
75
|
+
:class="props.ui.itemLeadingIcon({ class: [props.uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item.color, loading: true })"
|
|
76
|
+
data-part="itemLeadingIcon"
|
|
77
|
+
/>
|
|
78
|
+
<Icon
|
|
79
|
+
v-else-if="item.icon"
|
|
80
|
+
:name="item.icon"
|
|
81
|
+
:class="props.ui.itemLeadingIcon({ class: [props.uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item.color, active })"
|
|
82
|
+
data-part="itemLeadingIcon"
|
|
83
|
+
/>
|
|
84
|
+
<Avatar
|
|
85
|
+
v-else-if="item.avatar"
|
|
86
|
+
v-bind="item.avatar"
|
|
87
|
+
:size="item.avatar.size || props.size"
|
|
88
|
+
:class="props.ui.itemLeadingAvatar({ class: [props.uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })"
|
|
89
|
+
data-part="itemLeadingAvatar"
|
|
90
|
+
/>
|
|
91
|
+
</slot>
|
|
92
|
+
|
|
93
|
+
<span
|
|
94
|
+
v-if="get(item, props.labelKey) || !!slots[`${item.slot || 'item'}-label`] || (get(item, props.descriptionKey) || !!slots[`${item.slot || 'item'}-description`])"
|
|
95
|
+
:class="props.ui.itemWrapper({ class: [props.uiOverride?.itemWrapper, item.ui?.itemWrapper] })"
|
|
96
|
+
data-part="itemWrapper"
|
|
97
|
+
>
|
|
98
|
+
<span
|
|
99
|
+
v-if="get(item, props.labelKey) || !!slots[`${item.slot || 'item'}-label`]"
|
|
100
|
+
:class="props.ui.itemLabel({ class: [props.uiOverride?.itemLabel, item.ui?.itemLabel], active })"
|
|
101
|
+
data-part="itemLabel"
|
|
102
|
+
>
|
|
103
|
+
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="active" :index="index">
|
|
104
|
+
{{ get(item, props.labelKey) }}
|
|
105
|
+
</slot>
|
|
106
|
+
|
|
107
|
+
<Icon
|
|
108
|
+
v-if="item.target === '_blank' && props.externalIcon !== false"
|
|
109
|
+
:name="typeof props.externalIcon === 'string' ? props.externalIcon : appConfig.ui.icons.external"
|
|
110
|
+
:class="props.ui.itemLabelExternalIcon({ class: [props.uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item.color, active })"
|
|
111
|
+
data-part="itemLabelExternalIcon"
|
|
112
|
+
/>
|
|
113
|
+
</span>
|
|
114
|
+
|
|
115
|
+
<span v-if="get(item, props.descriptionKey)" :class="props.ui.itemDescription({ class: [props.uiOverride?.itemDescription, item.ui?.itemDescription] })" data-part="itemDescription">
|
|
116
|
+
<slot :name="`${item.slot || 'item'}-description`" :item="item" :active="active" :index="index">
|
|
117
|
+
{{ get(item, props.descriptionKey) }}
|
|
118
|
+
</slot>
|
|
119
|
+
</span>
|
|
120
|
+
</span>
|
|
121
|
+
|
|
122
|
+
<span :class="props.ui.itemTrailing({ class: [props.uiOverride?.itemTrailing, item.ui?.itemTrailing] })" data-part="itemTrailing">
|
|
123
|
+
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="active" :index="index" :ui="ui">
|
|
124
|
+
<Icon v-if="item.children?.length" :name="childrenIcon" :class="props.ui.itemTrailingIcon({ class: [props.uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item.color, active })" data-part="itemTrailingIcon" />
|
|
125
|
+
<span v-else-if="item.kbds?.length" :class="props.ui.itemTrailingKbds({ class: [props.uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })" data-part="itemTrailingKbds">
|
|
126
|
+
<Kbd
|
|
127
|
+
v-for="(kbd, kbdIndex) in item.kbds"
|
|
128
|
+
:key="kbdIndex"
|
|
129
|
+
:size="item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()"
|
|
130
|
+
v-bind="typeof kbd === 'string' ? { value: kbd } : kbd"
|
|
131
|
+
/>
|
|
132
|
+
</span>
|
|
133
|
+
</slot>
|
|
134
|
+
|
|
135
|
+
<DropdownMenu.ItemIndicator as-child>
|
|
136
|
+
<Icon :name="props.checkedIcon || appConfig.ui.icons.check" :class="props.ui.itemTrailingIcon({ class: [props.uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item.color })" data-part="itemTrailingIcon" />
|
|
137
|
+
</DropdownMenu.ItemIndicator>
|
|
138
|
+
</span>
|
|
139
|
+
</slot>
|
|
140
|
+
</DefineItemTemplate>
|
|
141
|
+
|
|
142
|
+
<DropdownMenu.Portal v-bind="portalProps">
|
|
143
|
+
<component :is="props.sub ? DropdownMenu.SubContent : DropdownMenu.Content" v-bind="{ ...contentProps, ...$attrs }" :class="props.class">
|
|
144
|
+
<slot name="content-top" :sub="props.sub ?? false"></slot>
|
|
145
|
+
|
|
146
|
+
<div role="presentation" :class="props.ui.viewport({ class: props.uiOverride?.viewport })" data-part="viewport">
|
|
147
|
+
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="props.ui.group({ class: props.uiOverride?.group })" data-part="group">
|
|
148
|
+
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
149
|
+
<DropdownMenu.Label v-if="item.type === 'label'" :class="props.ui.label({ class: [props.uiOverride?.label, item.ui?.label, item.class] })" data-part="label">
|
|
150
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
151
|
+
</DropdownMenu.Label>
|
|
152
|
+
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="props.ui.separator({ class: [props.uiOverride?.separator, item.ui?.separator, item.class] })" data-part="separator" />
|
|
153
|
+
<DropdownMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
|
154
|
+
<DropdownMenu.SubTrigger
|
|
155
|
+
as="button"
|
|
156
|
+
type="button"
|
|
157
|
+
:disabled="item.disabled"
|
|
158
|
+
:text-value="get(item, props.labelKey)"
|
|
159
|
+
:class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color })"
|
|
160
|
+
data-part="item"
|
|
161
|
+
>
|
|
162
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
163
|
+
</DropdownMenu.SubTrigger>
|
|
164
|
+
|
|
165
|
+
<DropdownMenuContent
|
|
166
|
+
sub
|
|
167
|
+
:class="props.class"
|
|
168
|
+
:ui="props.ui"
|
|
169
|
+
:ui-override="props.uiOverride"
|
|
170
|
+
:portal="props.portal"
|
|
171
|
+
:items="item.children"
|
|
172
|
+
side="right"
|
|
173
|
+
align="start"
|
|
174
|
+
:align-offset="-4"
|
|
175
|
+
:side-offset="3"
|
|
176
|
+
:label-key="props.labelKey"
|
|
177
|
+
:description-key="props.descriptionKey"
|
|
178
|
+
:checked-icon="props.checkedIcon"
|
|
179
|
+
:loading-icon="props.loadingIcon"
|
|
180
|
+
:external-icon="props.externalIcon"
|
|
181
|
+
v-bind="item.content"
|
|
182
|
+
>
|
|
183
|
+
<template v-for="(_, name) in getProxySlots()" #[name]="slotProps">
|
|
184
|
+
<slot :name="name" v-bind="slotProps"></slot>
|
|
185
|
+
</template>
|
|
186
|
+
</DropdownMenuContent>
|
|
187
|
+
</DropdownMenu.Sub>
|
|
188
|
+
<DropdownMenu.CheckboxItem
|
|
189
|
+
v-else-if="item.type === 'checkbox'"
|
|
190
|
+
:model-value="item.checked"
|
|
191
|
+
:disabled="item.disabled"
|
|
192
|
+
:text-value="get(item, props.labelKey)"
|
|
193
|
+
:class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color })"
|
|
194
|
+
data-part="item"
|
|
195
|
+
@update:model-value="item.onUpdateChecked"
|
|
196
|
+
@select="item.onSelect"
|
|
197
|
+
>
|
|
198
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
199
|
+
</DropdownMenu.CheckboxItem>
|
|
200
|
+
<Link v-else v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
201
|
+
<DropdownMenu.Item
|
|
202
|
+
as-child
|
|
203
|
+
:disabled="item.disabled"
|
|
204
|
+
:text-value="get(item, props.labelKey)"
|
|
205
|
+
@select="item.onSelect"
|
|
206
|
+
>
|
|
207
|
+
<LinkBase v-bind="slotProps" :class="props.ui.item({ class: [props.uiOverride?.item, item.ui?.item, item.class], color: item.color, active })" data-part="item">
|
|
208
|
+
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
209
|
+
</LinkBase>
|
|
210
|
+
</DropdownMenu.Item>
|
|
211
|
+
</Link>
|
|
212
|
+
</template>
|
|
213
|
+
</DropdownMenu.Group>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<slot></slot>
|
|
217
|
+
|
|
218
|
+
<slot name="content-bottom" :sub="props.sub ?? false"></slot>
|
|
219
|
+
</component>
|
|
220
|
+
</DropdownMenu.Portal>
|
|
221
221
|
</template>
|
|
@@ -7,6 +7,7 @@ import { Primitive } from "reka-ui";
|
|
|
7
7
|
import { computed } from "vue";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import { provideFieldGroup } from "../composables/useFieldGroup";
|
|
10
|
+
import { pick } from "../utils";
|
|
10
11
|
import { cv, merge } from "../utils/style";
|
|
11
12
|
const props = defineProps({
|
|
12
13
|
as: { type: null, required: false },
|
|
@@ -18,7 +19,7 @@ defineSlots();
|
|
|
18
19
|
const appConfig = useAppConfig();
|
|
19
20
|
const ui = computed(() => {
|
|
20
21
|
const styler = cv(merge(theme, appConfig.ui.fieldGroup));
|
|
21
|
-
return styler(props);
|
|
22
|
+
return styler(pick(props, ["orientation", "size"]));
|
|
22
23
|
});
|
|
23
24
|
provideFieldGroup(computed(() => ({
|
|
24
25
|
orientation: props.orientation,
|
|
@@ -27,7 +28,7 @@ provideFieldGroup(computed(() => ({
|
|
|
27
28
|
</script>
|
|
28
29
|
|
|
29
30
|
<template>
|
|
30
|
-
<Primitive :as="props.as" :class="ui.base({ class: props.class })" :data-orientation="props.orientation" data-part="base">
|
|
31
|
-
<slot></slot>
|
|
32
|
-
</Primitive>
|
|
31
|
+
<Primitive :as="props.as" :class="ui.base({ class: props.class })" :data-orientation="props.orientation" data-part="base">
|
|
32
|
+
<slot></slot>
|
|
33
|
+
</Primitive>
|
|
33
34
|
</template>
|