@eslamdevui/ui 4.1.0 → 4.1.1-rc.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/NavigationMenu.vue +100 -82
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -102,86 +102,98 @@ function getAccordionDefaultValue(list, level = 0) {
|
|
|
102
102
|
|
|
103
103
|
<template>
|
|
104
104
|
<DefineLinkTemplate v-slot="{ item, active, index }">
|
|
105
|
-
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="active"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index" :active="active"
|
|
106
|
+
:ui="ui">
|
|
107
|
+
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item"
|
|
108
|
+
:active="active" :index="index" :ui="ui">
|
|
109
|
+
<UAvatar v-if="item.avatar"
|
|
110
|
+
:size="item.ui?.linkLeadingAvatarSize || props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()"
|
|
111
|
+
v-bind="item.avatar"
|
|
112
|
+
:class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active, disabled: !!item.disabled })" />
|
|
113
|
+
<UIcon v-else-if="item.icon" :name="item.icon"
|
|
114
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active, disabled: !!item.disabled })" />
|
|
109
115
|
</slot>
|
|
110
116
|
|
|
111
117
|
<span
|
|
112
118
|
v-if="(!collapsed || orientation !== 'vertical') && (get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label'])"
|
|
113
|
-
:class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
:class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })">
|
|
120
|
+
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item"
|
|
121
|
+
:active="active" :index="index">
|
|
116
122
|
{{ get(item, props.labelKey) }}
|
|
117
123
|
</slot>
|
|
118
124
|
|
|
119
|
-
<UIcon v-if="item.target === '_blank' && externalIcon !== false"
|
|
125
|
+
<UIcon v-if="item.target === '_blank' && externalIcon !== false"
|
|
126
|
+
:name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external"
|
|
127
|
+
:class="ui.linkLabelExternalIcon({ class: [props.ui?.linkLabelExternalIcon, item.ui?.linkLabelExternalIcon], active })" />
|
|
120
128
|
</span>
|
|
121
129
|
|
|
122
|
-
<component :is="orientation === 'vertical' && item.children?.length && !collapsed ? AccordionTrigger : '
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
<component :is="orientation === 'vertical' && item.children?.length && !collapsed ? AccordionTrigger : 'button'"
|
|
131
|
+
v-if="(!collapsed || orientation !== 'vertical') && (item.badge !== void 0 || orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length || item.trailingIcon || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing'])"
|
|
132
|
+
as="button" type="button" :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
|
|
133
|
+
@click.stop.prevent>
|
|
134
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'"
|
|
135
|
+
:item="item" :active="active" :index="index" :ui="ui">
|
|
136
|
+
<UBadge v-if="item.badge !== void 0" color="neutral" variant="outline"
|
|
128
137
|
:size="item.ui?.linkTrailingBadgeSize || props.ui?.linkTrailingBadgeSize || ui.linkTrailingBadgeSize()"
|
|
129
138
|
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
130
|
-
:class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })"
|
|
131
|
-
/>
|
|
139
|
+
:class="ui.linkTrailingBadge({ class: [props.ui?.linkTrailingBadge, item.ui?.linkTrailingBadge] })" />
|
|
132
140
|
|
|
133
|
-
<UIcon
|
|
134
|
-
|
|
141
|
+
<UIcon
|
|
142
|
+
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) || orientation === 'vertical' && item.children?.length"
|
|
143
|
+
:name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown"
|
|
144
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
|
|
145
|
+
<UIcon v-else-if="item.trailingIcon" :name="item.trailingIcon"
|
|
146
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon], active })" />
|
|
135
147
|
</slot>
|
|
136
148
|
</component>
|
|
137
149
|
</slot>
|
|
138
150
|
</DefineLinkTemplate>
|
|
139
151
|
|
|
140
152
|
<DefineItemTemplate v-slot="{ item, index, level = 0 }">
|
|
141
|
-
<component
|
|
142
|
-
:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
>
|
|
146
|
-
<div v-if="orientation === 'vertical' && item.type === 'label' && !collapsed" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
153
|
+
<component :is="orientation === 'vertical' && !collapsed ? AccordionItem : NavigationMenuItem" as="li"
|
|
154
|
+
:value="item.value || (level > 0 ? `item-${level}-${index}` : `item-${index}`)">
|
|
155
|
+
<div v-if="orientation === 'vertical' && item.type === 'label' && !collapsed"
|
|
156
|
+
:class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
|
147
157
|
<ReuseLinkTemplate :item="item" :index="index" />
|
|
148
158
|
</div>
|
|
149
|
-
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }"
|
|
159
|
+
<ULink v-else-if="item.type !== 'label'" v-slot="{ active, ...slotProps }"
|
|
160
|
+
v-bind="orientation === 'vertical' && item.children?.length && !collapsed && item.type === 'trigger' ? {} : pickLinkProps(item)"
|
|
161
|
+
custom>
|
|
150
162
|
<component
|
|
151
163
|
:is="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content']) ? NavigationMenuTrigger : orientation === 'vertical' && item.children?.length && !collapsed && !slotProps.href ? AccordionTrigger : NavigationMenuLink"
|
|
152
|
-
as-child
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
as-child :active="active || item.active" :disabled="item.disabled" @select="item.onSelect">
|
|
165
|
+
<UPopover
|
|
166
|
+
v-if="orientation === 'vertical' && collapsed && item.children?.length && (!!props.popover || !!item.popover)"
|
|
167
|
+
v-bind="{ ...popoverProps, ...typeof item.popover === 'boolean' ? {} : item.popover || {} }"
|
|
168
|
+
:ui="{ content: ui.content({ class: [props.ui?.content, item.ui?.content] }) }">
|
|
169
|
+
<ULinkBase v-bind="slotProps"
|
|
170
|
+
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
159
171
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
160
172
|
</ULinkBase>
|
|
161
173
|
|
|
162
174
|
<template #content="{ close }">
|
|
163
|
-
<slot
|
|
164
|
-
:
|
|
165
|
-
:item="item"
|
|
166
|
-
:active="active || item.active"
|
|
167
|
-
:index="index"
|
|
168
|
-
:ui="ui"
|
|
169
|
-
:close="close"
|
|
170
|
-
>
|
|
175
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'"
|
|
176
|
+
:item="item" :active="active || item.active" :index="index" :ui="ui" :close="close">
|
|
171
177
|
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
172
178
|
<li :class="ui.childLabel({ class: [props.ui?.childLabel, item.ui?.childLabel] })">
|
|
173
179
|
{{ get(item, props.labelKey) }}
|
|
174
180
|
</li>
|
|
175
|
-
<li v-for="(childItem, childIndex) in item.children" :key="childIndex"
|
|
181
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex"
|
|
182
|
+
:class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
176
183
|
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
177
184
|
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
178
|
-
<ULinkBase v-bind="childSlotProps"
|
|
179
|
-
|
|
185
|
+
<ULinkBase v-bind="childSlotProps"
|
|
186
|
+
:class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
|
|
187
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon"
|
|
188
|
+
:class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
|
|
180
189
|
|
|
181
|
-
<span
|
|
190
|
+
<span
|
|
191
|
+
:class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
|
|
182
192
|
{{ get(childItem, props.labelKey) }}
|
|
183
193
|
|
|
184
|
-
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false"
|
|
194
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false"
|
|
195
|
+
:name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external"
|
|
196
|
+
:class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
|
|
185
197
|
</span>
|
|
186
198
|
</ULinkBase>
|
|
187
199
|
</NavigationMenuLink>
|
|
@@ -191,32 +203,47 @@ function getAccordionDefaultValue(list, level = 0) {
|
|
|
191
203
|
</slot>
|
|
192
204
|
</template>
|
|
193
205
|
</UPopover>
|
|
194
|
-
<UTooltip v-else-if="orientation === 'vertical' && collapsed && (!!props.tooltip || !!item.tooltip)"
|
|
195
|
-
|
|
206
|
+
<UTooltip v-else-if="orientation === 'vertical' && collapsed && (!!props.tooltip || !!item.tooltip)"
|
|
207
|
+
:text="get(item, props.labelKey)"
|
|
208
|
+
v-bind="{ ...tooltipProps, ...typeof item.tooltip === 'boolean' ? {} : item.tooltip || {} }">
|
|
209
|
+
<ULinkBase v-bind="slotProps"
|
|
210
|
+
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: level > 0 })">
|
|
196
211
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
197
212
|
</ULinkBase>
|
|
198
213
|
</UTooltip>
|
|
199
|
-
<ULinkBase v-else v-bind="slotProps"
|
|
214
|
+
<ULinkBase v-else v-bind="slotProps"
|
|
215
|
+
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: active || item.active, disabled: !!item.disabled, level: orientation === 'horizontal' || level > 0 })">
|
|
200
216
|
<ReuseLinkTemplate :item="item" :active="active || item.active" :index="index" />
|
|
201
217
|
</ULinkBase>
|
|
202
218
|
</component>
|
|
203
219
|
|
|
204
|
-
<NavigationMenuContent
|
|
205
|
-
|
|
220
|
+
<NavigationMenuContent
|
|
221
|
+
v-if="orientation === 'horizontal' && (item.children?.length || !!slots[item.slot ? `${item.slot}-content` : 'item-content'])"
|
|
222
|
+
v-bind="contentProps" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
|
223
|
+
<slot :name="item.slot ? `${item.slot}-content` : 'item-content'"
|
|
224
|
+
:item="item" :active="active || item.active" :index="index" :ui="ui">
|
|
206
225
|
<ul :class="ui.childList({ class: [props.ui?.childList, item.ui?.childList] })">
|
|
207
|
-
<li v-for="(childItem, childIndex) in item.children" :key="childIndex"
|
|
226
|
+
<li v-for="(childItem, childIndex) in item.children" :key="childIndex"
|
|
227
|
+
:class="ui.childItem({ class: [props.ui?.childItem, item.ui?.childItem] })">
|
|
208
228
|
<ULink v-slot="{ active: childActive, ...childSlotProps }" v-bind="pickLinkProps(childItem)" custom>
|
|
209
229
|
<NavigationMenuLink as-child :active="childActive" @select="childItem.onSelect">
|
|
210
|
-
<ULinkBase v-bind="childSlotProps"
|
|
211
|
-
|
|
230
|
+
<ULinkBase v-bind="childSlotProps"
|
|
231
|
+
:class="ui.childLink({ class: [props.ui?.childLink, item.ui?.childLink, childItem.class], active: childActive })">
|
|
232
|
+
<UIcon v-if="childItem.icon" :name="childItem.icon"
|
|
233
|
+
:class="ui.childLinkIcon({ class: [props.ui?.childLinkIcon, item.ui?.childLinkIcon], active: childActive })" />
|
|
212
234
|
|
|
213
|
-
<div
|
|
214
|
-
|
|
235
|
+
<div
|
|
236
|
+
:class="ui.childLinkWrapper({ class: [props.ui?.childLinkWrapper, item.ui?.childLinkWrapper] })">
|
|
237
|
+
<p
|
|
238
|
+
:class="ui.childLinkLabel({ class: [props.ui?.childLinkLabel, item.ui?.childLinkLabel], active: childActive })">
|
|
215
239
|
{{ get(childItem, props.labelKey) }}
|
|
216
240
|
|
|
217
|
-
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false"
|
|
241
|
+
<UIcon v-if="childItem.target === '_blank' && externalIcon !== false"
|
|
242
|
+
:name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external"
|
|
243
|
+
:class="ui.childLinkLabelExternalIcon({ class: [props.ui?.childLinkLabelExternalIcon, item.ui?.childLinkLabelExternalIcon], active: childActive })" />
|
|
218
244
|
</p>
|
|
219
|
-
<p v-if="childItem.description"
|
|
245
|
+
<p v-if="childItem.description"
|
|
246
|
+
:class="ui.childLinkDescription({ class: [props.ui?.childLinkDescription, item.ui?.childLinkDescription], active: childActive })">
|
|
220
247
|
{{ childItem.description }}
|
|
221
248
|
</p>
|
|
222
249
|
</div>
|
|
@@ -229,45 +256,36 @@ function getAccordionDefaultValue(list, level = 0) {
|
|
|
229
256
|
</NavigationMenuContent>
|
|
230
257
|
</ULink>
|
|
231
258
|
|
|
232
|
-
<AccordionContent v-if="orientation === 'vertical' && item.children?.length && !collapsed"
|
|
233
|
-
|
|
234
|
-
|
|
259
|
+
<AccordionContent v-if="orientation === 'vertical' && item.children?.length && !collapsed"
|
|
260
|
+
:class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
|
261
|
+
<AccordionRoot v-bind="{
|
|
235
262
|
...accordionProps,
|
|
236
263
|
defaultValue: getAccordionDefaultValue(item.children, level + 1)
|
|
237
|
-
}"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<ReuseItemTemplate
|
|
242
|
-
v-for="(childItem, childIndex) in item.children"
|
|
243
|
-
:key="childIndex"
|
|
244
|
-
:item="childItem"
|
|
245
|
-
:index="childIndex"
|
|
246
|
-
:level="level + 1"
|
|
247
|
-
:class="ui.childItem({ class: [props.ui?.childItem, childItem.ui?.childItem] })"
|
|
248
|
-
/>
|
|
264
|
+
}" as="ul" :class="ui.childList({ class: props.ui?.childList })">
|
|
265
|
+
<ReuseItemTemplate v-for="(childItem, childIndex) in item.children" :key="childIndex" :item="childItem"
|
|
266
|
+
:index="childIndex" :level="level + 1"
|
|
267
|
+
:class="ui.childItem({ class: [props.ui?.childItem, childItem.ui?.childItem] })" />
|
|
249
268
|
</AccordionRoot>
|
|
250
269
|
</AccordionContent>
|
|
251
270
|
</component>
|
|
252
271
|
</DefineItemTemplate>
|
|
253
272
|
|
|
254
|
-
<NavigationMenuRoot v-bind="{ ...rootProps, ...$attrs }" :data-collapsed="collapsed"
|
|
273
|
+
<NavigationMenuRoot v-bind="{ ...rootProps, ...$attrs }" :data-collapsed="collapsed"
|
|
274
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
255
275
|
<slot name="list-leading" />
|
|
256
276
|
|
|
257
277
|
<template v-for="(list, listIndex) in lists" :key="`list-${listIndex}`">
|
|
258
|
-
<component
|
|
259
|
-
v-bind="orientation === 'vertical' && !collapsed ? {
|
|
278
|
+
<component v-bind="orientation === 'vertical' && !collapsed ? {
|
|
260
279
|
...accordionProps,
|
|
261
280
|
defaultValue: getAccordionDefaultValue(list)
|
|
262
|
-
} : {}"
|
|
263
|
-
:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
>
|
|
267
|
-
<ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index" :class="ui.item({ class: [props.ui?.item, item.ui?.item] })" />
|
|
281
|
+
} : {}" :is="orientation === 'vertical' && !collapsed ? AccordionRoot : NavigationMenuList" as="ul"
|
|
282
|
+
:class="ui.list({ class: props.ui?.list })">
|
|
283
|
+
<ReuseItemTemplate v-for="(item, index) in list" :key="`list-${listIndex}-${index}`" :item="item" :index="index"
|
|
284
|
+
:class="ui.item({ class: [props.ui?.item, item.ui?.item] })" />
|
|
268
285
|
</component>
|
|
269
286
|
|
|
270
|
-
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1"
|
|
287
|
+
<div v-if="orientation === 'vertical' && listIndex < lists.length - 1"
|
|
288
|
+
:class="ui.separator({ class: props.ui?.separator })" />
|
|
271
289
|
</template>
|
|
272
290
|
|
|
273
291
|
<slot name="list-trailing" />
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslamdevui/ui",
|
|
3
3
|
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
|
4
|
-
"version": "4.1.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "4.1.1-rc.1",
|
|
5
|
+
"packageManager": "pnpm@10.24.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/nuxt/ui.git"
|