@aleph-alpha/ui-library 2.4.3 → 2.5.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/config.d.ts +13 -0
- package/config.js +156 -12
- package/dist/system/components/UiAvatar/UiAvatar.vue.d.ts +4 -1
- package/dist/system/components/UiAvatar/UiAvatarGroup.vue.d.ts +18 -0
- package/dist/system/components/UiAvatar/index.d.ts +1 -0
- package/dist/system/components/UiAvatar/types.d.ts +12 -1
- package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +6 -1
- package/dist/system/components/UiFileItem/types.d.ts +30 -10
- package/dist/system/components/UiFileType/UiFileType.vue.d.ts +8 -0
- package/dist/system/components/UiFileType/index.d.ts +2 -0
- package/dist/system/components/UiFileType/types.d.ts +33 -0
- package/dist/system/components/UiItem/UiItem.vue.d.ts +8 -1
- package/dist/system/components/UiItem/constants.d.ts +4 -3
- package/dist/system/components/UiItem/index.d.ts +1 -1
- package/dist/system/components/UiItem/types.d.ts +53 -13
- package/dist/system/components/core/avatar/Avatar.vue.d.ts +2 -0
- package/dist/system/components/core/avatar/index.d.ts +1 -0
- package/dist/system/components/core/item/Item.vue.d.ts +1 -1
- package/dist/system/components/core/item/ItemAction.vue.d.ts +25 -0
- package/dist/system/components/core/item/index.d.ts +8 -4
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib/activeIndicator.d.ts +1 -0
- package/dist/system/lib.js +6574 -6357
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -15
- package/docs/public-docs/quick-start.md +2 -1
- package/package.json +1 -1
- package/src/components/UiAvatar/UiAvatar.stories.ts +103 -12
- package/src/components/UiAvatar/UiAvatar.vue +6 -1
- package/src/components/UiAvatar/UiAvatarGroup.vue +16 -0
- package/src/components/UiAvatar/UiAvatarImage.vue +1 -1
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +86 -0
- package/src/components/UiAvatar/index.ts +1 -0
- package/src/components/UiAvatar/types.ts +15 -1
- package/src/components/UiButton/UiButton.stories.ts +60 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +1 -1
- package/src/components/UiFileItem/UiFileItem.stories.ts +344 -185
- package/src/components/UiFileItem/UiFileItem.vue +110 -70
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +64 -3
- package/src/components/UiFileItem/types.ts +33 -10
- package/src/components/UiFileType/UiFileType.stories.ts +134 -0
- package/src/components/UiFileType/UiFileType.vue +116 -0
- package/src/components/UiFileType/__tests__/UiFileType.test.ts +41 -0
- package/src/components/UiFileType/index.ts +2 -0
- package/src/components/UiFileType/types.ts +38 -0
- package/src/components/UiItem/UiItem.stories.ts +555 -855
- package/src/components/UiItem/UiItem.vue +59 -4
- package/src/components/UiItem/UiItemMedia.vue +1 -1
- package/src/components/UiItem/__tests__/UiItem.test.ts +432 -26
- package/src/components/UiItem/constants.ts +16 -2
- package/src/components/UiItem/index.ts +1 -1
- package/src/components/UiItem/types.ts +64 -13
- package/src/components/UiKbd/UiKbd.stories.ts +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +4 -4
- package/src/components/UiSelect/__tests__/UiSelectGroup.test.ts +2 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +4 -2
- package/src/components/core/avatar/Avatar.vue +17 -1
- package/src/components/core/avatar/AvatarFallback.vue +1 -1
- package/src/components/core/{item/ItemActions.vue → avatar/AvatarGroup.vue} +7 -2
- package/src/components/core/avatar/index.ts +1 -0
- package/src/components/core/button/index.ts +1 -1
- package/src/components/core/drawer/DrawerContent.vue +1 -1
- package/src/components/core/item/Item.vue +2 -2
- package/src/components/core/item/ItemAction.vue +30 -0
- package/src/components/core/item/ItemContent.vue +1 -1
- package/src/components/core/item/ItemDescription.vue +1 -1
- package/src/components/core/item/ItemGroup.vue +0 -1
- package/src/components/core/item/index.ts +32 -9
- package/src/components/core/kbd/Kbd.vue +1 -1
- package/src/components/core/skeleton/Skeleton.vue +3 -1
- package/src/components/core/slider/Slider.vue +1 -1
- package/src/components/core/table/TableFooter.vue +4 -1
- package/src/components/core/table/TableRow.vue +1 -1
- package/src/components/index.ts +1 -0
- package/src/lib/activeIndicator.ts +1 -0
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +2 -2
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +2 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuButton.test.ts +33 -0
- package/src/patterns/UiSidebar/activeIndicator.ts +1 -16
- package/src/theme/BorderRadius.stories.ts +115 -0
- /package/dist/system/components/core/{item/ItemActions.vue.d.ts → avatar/AvatarGroup.vue.d.ts} +0 -0
|
@@ -7,15 +7,18 @@ import {
|
|
|
7
7
|
UiItemContent,
|
|
8
8
|
UiItemTitle,
|
|
9
9
|
UiItemDescription,
|
|
10
|
-
|
|
11
|
-
UiItemHeader,
|
|
12
|
-
UiItemFooter,
|
|
10
|
+
UiItemAction,
|
|
13
11
|
} from './index';
|
|
14
12
|
|
|
15
13
|
import { ItemVariants, ItemSizes } from './constants';
|
|
16
14
|
import { UiIcon } from '../UiIcon';
|
|
17
15
|
import { UiButton } from '../UiButton';
|
|
18
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
UiAvatar,
|
|
18
|
+
UiAvatarFallback,
|
|
19
|
+
UiAvatarGroup,
|
|
20
|
+
UiAvatarImage,
|
|
21
|
+
} from '../UiAvatar';
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* UiItem is a composable list/row primitive with title, description, leading/trailing slots, and actions.
|
|
@@ -31,9 +34,7 @@ const meta: Meta<typeof UiItem> = {
|
|
|
31
34
|
UiItemContent,
|
|
32
35
|
UiItemTitle,
|
|
33
36
|
UiItemDescription,
|
|
34
|
-
|
|
35
|
-
UiItemHeader,
|
|
36
|
-
UiItemFooter,
|
|
37
|
+
UiItemAction,
|
|
37
38
|
},
|
|
38
39
|
tags: ['autodocs'],
|
|
39
40
|
argTypes: {
|
|
@@ -41,24 +42,45 @@ const meta: Meta<typeof UiItem> = {
|
|
|
41
42
|
control: 'select',
|
|
42
43
|
options: ItemVariants,
|
|
43
44
|
description:
|
|
44
|
-
'The visual style of the item. Use `default` for
|
|
45
|
+
'The visual style of the item. Use `default` for static content, `active` for the current row indicator, `outline` for bordered appearance, `hover` for hover feedback, or `hover-action` for rows with separate actions.',
|
|
45
46
|
},
|
|
46
47
|
size: {
|
|
47
48
|
control: 'select',
|
|
48
49
|
options: ItemSizes,
|
|
49
50
|
description:
|
|
50
|
-
'The size of the item. Use `default` for standard spacing
|
|
51
|
+
'The size of the item. Use `default` for standard spacing, `sm` for compact dense layouts, or `minimal` for the smallest action affordance.',
|
|
52
|
+
},
|
|
53
|
+
title: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'Convenience title rendered with UiItemTitle.',
|
|
56
|
+
},
|
|
57
|
+
description: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description: 'Convenience description rendered with UiItemDescription.',
|
|
60
|
+
},
|
|
61
|
+
desc: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
description: 'Alias for `description`.',
|
|
51
64
|
},
|
|
52
65
|
asChild: {
|
|
53
66
|
control: 'boolean',
|
|
54
67
|
description:
|
|
55
|
-
'Whether to render as a child element using Radix asChild pattern. Useful for rendering as links or custom components while preserving
|
|
68
|
+
'Whether to render as a child element using Radix asChild pattern. Useful for rendering as links or custom components while preserving variant/focus states.',
|
|
69
|
+
},
|
|
70
|
+
withListSemantics: {
|
|
71
|
+
control: 'boolean',
|
|
72
|
+
description:
|
|
73
|
+
'Adds role="listitem" for use inside a parent with role="list".',
|
|
56
74
|
},
|
|
57
75
|
},
|
|
58
76
|
args: {
|
|
59
77
|
variant: 'default',
|
|
60
78
|
size: 'default',
|
|
79
|
+
title: 'Basic Item',
|
|
80
|
+
description: 'A simple item with title and description.',
|
|
81
|
+
desc: undefined,
|
|
61
82
|
asChild: false,
|
|
83
|
+
withListSemantics: false,
|
|
62
84
|
},
|
|
63
85
|
};
|
|
64
86
|
|
|
@@ -66,968 +88,646 @@ export default meta;
|
|
|
66
88
|
|
|
67
89
|
type Story = StoryObj<typeof UiItem>;
|
|
68
90
|
|
|
91
|
+
const createSource = (
|
|
92
|
+
imports: string[],
|
|
93
|
+
template: string,
|
|
94
|
+
) => `<script setup lang="ts">
|
|
95
|
+
import { ${imports.join(', ')} } from '@aleph-alpha/ui-library'
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
${template.trim()}
|
|
100
|
+
</template>`;
|
|
101
|
+
|
|
102
|
+
const defaultTemplate = `
|
|
103
|
+
<div class="w-full max-w-md">
|
|
104
|
+
<UiItem
|
|
105
|
+
variant="hover-action"
|
|
106
|
+
title="Basic Item"
|
|
107
|
+
description="A simple item with title and description."
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
`;
|
|
111
|
+
|
|
112
|
+
const variantsTemplate = `
|
|
113
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
114
|
+
<UiItem
|
|
115
|
+
title="Default"
|
|
116
|
+
description="Static row with the default trailing action."
|
|
117
|
+
/>
|
|
118
|
+
<UiItem
|
|
119
|
+
variant="active"
|
|
120
|
+
title="Active"
|
|
121
|
+
description="Current row with the shared active indicator."
|
|
122
|
+
/>
|
|
123
|
+
<UiItem
|
|
124
|
+
variant="outline"
|
|
125
|
+
title="Outline"
|
|
126
|
+
description="Visual outline without changing row height."
|
|
127
|
+
/>
|
|
128
|
+
<UiItem
|
|
129
|
+
variant="hover"
|
|
130
|
+
title="Hover"
|
|
131
|
+
description="Row-level hover feedback only."
|
|
132
|
+
/>
|
|
133
|
+
<UiItem
|
|
134
|
+
variant="hover-action"
|
|
135
|
+
title="Hover Action"
|
|
136
|
+
description="Separate row and action hover states."
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const sizesTemplate = `
|
|
142
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
143
|
+
<UiItem
|
|
144
|
+
title="Default Size"
|
|
145
|
+
description="Comfortable spacing and an icon-sm default action."
|
|
146
|
+
/>
|
|
147
|
+
<UiItem
|
|
148
|
+
size="sm"
|
|
149
|
+
title="Small Size"
|
|
150
|
+
description="Compact spacing with the same icon-sm default action."
|
|
151
|
+
/>
|
|
152
|
+
<UiItem
|
|
153
|
+
size="minimal"
|
|
154
|
+
title="Minimal Size"
|
|
155
|
+
description="Description is hidden and the default action uses icon-xs."
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
const customSlotsTemplate = `
|
|
161
|
+
<div class="w-full max-w-md">
|
|
162
|
+
<UiItem variant="hover-action">
|
|
163
|
+
<template #icon>
|
|
164
|
+
<UiAvatar>
|
|
165
|
+
<UiAvatarImage src="https://i.pravatar.cc/150?u=ui-item" />
|
|
166
|
+
<UiAvatarFallback>AR</UiAvatarFallback>
|
|
167
|
+
</UiAvatar>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<template #content>
|
|
171
|
+
<div class="flex items-center gap-2">
|
|
172
|
+
<span class="body-14-medium">Custom Content</span>
|
|
173
|
+
<span class="rounded-sm bg-background-surface-muted px-1.5 label-12-medium text-content-on-surface-muted">
|
|
174
|
+
Beta
|
|
175
|
+
</span>
|
|
176
|
+
</div>
|
|
177
|
+
<p class="body-14-regular text-content-on-surface-muted">
|
|
178
|
+
Content, media, and action slots can be fully composed.
|
|
179
|
+
</p>
|
|
180
|
+
</template>
|
|
181
|
+
|
|
182
|
+
<template #action>
|
|
183
|
+
<UiButton variant="ghost" size="icon-sm" aria-label="Open item">
|
|
184
|
+
<UiIcon name="external-link" />
|
|
185
|
+
</UiButton>
|
|
186
|
+
</template>
|
|
187
|
+
</UiItem>
|
|
188
|
+
</div>
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
const withIconTemplate = `
|
|
192
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
193
|
+
<UiItem
|
|
194
|
+
variant="hover"
|
|
195
|
+
title="Security"
|
|
196
|
+
description="Icon slot rendered through the convenience API."
|
|
197
|
+
>
|
|
198
|
+
<template #icon>
|
|
199
|
+
<UiIcon name="shield-check" size="s" />
|
|
200
|
+
</template>
|
|
201
|
+
</UiItem>
|
|
202
|
+
<UiItem
|
|
203
|
+
variant="hover"
|
|
204
|
+
size="minimal"
|
|
205
|
+
title="Minimal Icon Row"
|
|
206
|
+
>
|
|
207
|
+
<template #icon>
|
|
208
|
+
<UiIcon name="bell" size="s" />
|
|
209
|
+
</template>
|
|
210
|
+
</UiItem>
|
|
211
|
+
</div>
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
const actionsTemplate = `
|
|
215
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
216
|
+
<UiItem
|
|
217
|
+
title="Default Action"
|
|
218
|
+
description="Uses the built-in ghost action and emits the action event."
|
|
219
|
+
@action="() => {}"
|
|
220
|
+
/>
|
|
221
|
+
<UiItem
|
|
222
|
+
variant="hover"
|
|
223
|
+
title="Row Hover Only"
|
|
224
|
+
description="The action stays transparent so only the row hover is visible."
|
|
225
|
+
/>
|
|
226
|
+
<UiItem
|
|
227
|
+
variant="hover-action"
|
|
228
|
+
title="Custom Action"
|
|
229
|
+
description="Hover-action keeps separate row and button hover states."
|
|
230
|
+
>
|
|
231
|
+
<template #action>
|
|
232
|
+
<UiButton variant="ghost" size="icon-sm" aria-label="Archive">
|
|
233
|
+
<UiIcon name="archive" />
|
|
234
|
+
</UiButton>
|
|
235
|
+
</template>
|
|
236
|
+
</UiItem>
|
|
237
|
+
</div>
|
|
238
|
+
`;
|
|
239
|
+
|
|
240
|
+
const actionTooltipTemplate = `
|
|
241
|
+
<div class="w-full max-w-md">
|
|
242
|
+
<UiItem variant="hover-action" title="Tooltip Action" description="The custom action explains itself on hover or focus.">
|
|
243
|
+
<template #action>
|
|
244
|
+
<UiItemAction tooltip="Archive item">
|
|
245
|
+
<UiButton variant="ghost" size="icon-sm" aria-label="Archive">
|
|
246
|
+
<UiIcon name="archive" />
|
|
247
|
+
</UiButton>
|
|
248
|
+
</UiItemAction>
|
|
249
|
+
</template>
|
|
250
|
+
</UiItem>
|
|
251
|
+
</div>
|
|
252
|
+
`;
|
|
253
|
+
|
|
254
|
+
const mediaTemplate = `
|
|
255
|
+
<div class="flex w-full max-w-md flex-col gap-3">
|
|
256
|
+
<UiItem variant="hover" title="Icon Media" description="Convenience icon slot.">
|
|
257
|
+
<template #icon>
|
|
258
|
+
<UiIcon name="shield-check" size="s" />
|
|
259
|
+
</template>
|
|
260
|
+
</UiItem>
|
|
261
|
+
|
|
262
|
+
<UiItem variant="hover">
|
|
263
|
+
<UiItemMedia>
|
|
264
|
+
<UiAvatar>
|
|
265
|
+
<UiAvatarImage src="https://i.pravatar.cc/150?u=media-avatar" />
|
|
266
|
+
<UiAvatarFallback>MA</UiAvatarFallback>
|
|
267
|
+
</UiAvatar>
|
|
268
|
+
</UiItemMedia>
|
|
269
|
+
<UiItemContent>
|
|
270
|
+
<UiItemTitle>Avatar Media</UiItemTitle>
|
|
271
|
+
<UiItemDescription>Composed media slot with an avatar.</UiItemDescription>
|
|
272
|
+
</UiItemContent>
|
|
273
|
+
</UiItem>
|
|
274
|
+
|
|
275
|
+
<UiItem variant="hover">
|
|
276
|
+
<UiItemMedia variant="image">
|
|
277
|
+
<UiAvatar>
|
|
278
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
279
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
280
|
+
</UiAvatar>
|
|
281
|
+
</UiItemMedia>
|
|
282
|
+
<UiItemContent>
|
|
283
|
+
<UiItemTitle>Avatar Media</UiItemTitle>
|
|
284
|
+
<UiItemDescription>Image media sizes a single avatar.</UiItemDescription>
|
|
285
|
+
</UiItemContent>
|
|
286
|
+
</UiItem>
|
|
287
|
+
|
|
288
|
+
<UiItem variant="hover">
|
|
289
|
+
<UiItemMedia variant="avatar-group">
|
|
290
|
+
<UiAvatarGroup>
|
|
291
|
+
<UiAvatar>
|
|
292
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
293
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
294
|
+
</UiAvatar>
|
|
295
|
+
<UiAvatar>
|
|
296
|
+
<UiAvatarImage src="https://github.com/leerob.png" alt="@leerob" />
|
|
297
|
+
<UiAvatarFallback>LR</UiAvatarFallback>
|
|
298
|
+
</UiAvatar>
|
|
299
|
+
<UiAvatar>
|
|
300
|
+
<UiAvatarImage src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
301
|
+
<UiAvatarFallback>ER</UiAvatarFallback>
|
|
302
|
+
</UiAvatar>
|
|
303
|
+
</UiAvatarGroup>
|
|
304
|
+
</UiItemMedia>
|
|
305
|
+
<UiItemContent>
|
|
306
|
+
<UiItemTitle>Avatar Group Media</UiItemTitle>
|
|
307
|
+
<UiItemDescription>Stacked avatars use UiAvatarGroup.</UiItemDescription>
|
|
308
|
+
</UiItemContent>
|
|
309
|
+
</UiItem>
|
|
310
|
+
|
|
311
|
+
<UiItem variant="hover">
|
|
312
|
+
<UiItemContent>
|
|
313
|
+
<UiItemTitle>Text Action</UiItemTitle>
|
|
314
|
+
<UiItemDescription>Muted label actions align with trailing content.</UiItemDescription>
|
|
315
|
+
</UiItemContent>
|
|
316
|
+
<UiItemAction variant="text">NEW</UiItemAction>
|
|
317
|
+
</UiItem>
|
|
318
|
+
|
|
319
|
+
<UiItem variant="hover-action">
|
|
320
|
+
<UiItemContent>
|
|
321
|
+
<UiItemTitle>Button Action</UiItemTitle>
|
|
322
|
+
<UiItemDescription>Compact button-like action affordance.</UiItemDescription>
|
|
323
|
+
</UiItemContent>
|
|
324
|
+
<UiItemAction variant="button">
|
|
325
|
+
<UiIcon name="plus" size="s" />
|
|
326
|
+
</UiItemAction>
|
|
327
|
+
</UiItem>
|
|
328
|
+
</div>
|
|
329
|
+
`;
|
|
330
|
+
|
|
331
|
+
const groupTemplate = `
|
|
332
|
+
<div class="w-full max-w-md">
|
|
333
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
334
|
+
<UiItem variant="hover" title="Profile" description="Manage account details.">
|
|
335
|
+
<template #icon>
|
|
336
|
+
<UiIcon name="user" size="s" />
|
|
337
|
+
</template>
|
|
338
|
+
</UiItem>
|
|
339
|
+
<UiItemSeparator />
|
|
340
|
+
<UiItem variant="hover" title="Notifications" description="Configure alert preferences.">
|
|
341
|
+
<template #icon>
|
|
342
|
+
<UiIcon name="bell" size="s" />
|
|
343
|
+
</template>
|
|
344
|
+
</UiItem>
|
|
345
|
+
<UiItemSeparator />
|
|
346
|
+
<UiItem variant="hover-action" title="Billing" description="Review invoices and payment methods.">
|
|
347
|
+
<template #icon>
|
|
348
|
+
<UiIcon name="credit-card" size="s" />
|
|
349
|
+
</template>
|
|
350
|
+
</UiItem>
|
|
351
|
+
</UiItemGroup>
|
|
352
|
+
</div>
|
|
353
|
+
`;
|
|
354
|
+
|
|
355
|
+
const asLinkTemplate = `
|
|
356
|
+
<div class="w-full max-w-md">
|
|
357
|
+
<UiItem variant="hover" as-child>
|
|
358
|
+
<a href="#" class="flex items-center gap-3">
|
|
359
|
+
<UiItemContent>
|
|
360
|
+
<UiItemTitle>Documentation</UiItemTitle>
|
|
361
|
+
<UiItemDescription>
|
|
362
|
+
Render the item as a semantic anchor while keeping row styles.
|
|
363
|
+
</UiItemDescription>
|
|
364
|
+
</UiItemContent>
|
|
365
|
+
<UiItemAction>
|
|
366
|
+
<UiIcon name="arrow-up-right" size="s" />
|
|
367
|
+
</UiItemAction>
|
|
368
|
+
</a>
|
|
369
|
+
</UiItem>
|
|
370
|
+
</div>
|
|
371
|
+
`;
|
|
372
|
+
|
|
373
|
+
const allVariantsTemplate = `
|
|
374
|
+
<div class="flex w-full flex-row justify-between gap-6">
|
|
375
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
376
|
+
<div class="label-12-medium text-content-on-surface-muted">Default Variant</div>
|
|
377
|
+
<UiItem title="Default size" description="Standard spacing without row hover." />
|
|
378
|
+
<UiItemSeparator />
|
|
379
|
+
<UiItem size="sm" title="Small size" description="Compact spacing without row hover." />
|
|
380
|
+
<UiItemSeparator />
|
|
381
|
+
<UiItem size="minimal" title="Minimal size" description="Description is omitted." />
|
|
382
|
+
</UiItemGroup>
|
|
383
|
+
|
|
384
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
385
|
+
<div class="label-12-medium text-content-on-surface-muted">Active Variant</div>
|
|
386
|
+
<UiItem variant="active" title="Default size" description="Active indicator and background." />
|
|
387
|
+
<UiItemSeparator />
|
|
388
|
+
<UiItem variant="active" size="sm" title="Small size" description="Compact active row." />
|
|
389
|
+
<UiItemSeparator />
|
|
390
|
+
<UiItem variant="active" size="minimal" title="Minimal size" description="Description is omitted." />
|
|
391
|
+
</UiItemGroup>
|
|
392
|
+
|
|
393
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
394
|
+
<div class="label-12-medium text-content-on-surface-muted">Outline Variant</div>
|
|
395
|
+
<UiItem variant="outline" title="Default size" description="Inset outline keeps height stable." />
|
|
396
|
+
<UiItemSeparator />
|
|
397
|
+
<UiItem variant="outline" size="sm" title="Small size" description="Compact outlined row." />
|
|
398
|
+
<UiItemSeparator />
|
|
399
|
+
<UiItem variant="outline" size="minimal" title="Minimal size" description="Description is omitted." />
|
|
400
|
+
</UiItemGroup>
|
|
401
|
+
|
|
402
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
403
|
+
<div class="label-12-medium text-content-on-surface-muted">Hover Variant</div>
|
|
404
|
+
<UiItem variant="hover" title="Default size" description="Only row hover feedback." />
|
|
405
|
+
<UiItemSeparator />
|
|
406
|
+
<UiItem variant="hover" size="sm" title="Small size" description="Compact row hover feedback." />
|
|
407
|
+
<UiItemSeparator />
|
|
408
|
+
<UiItem variant="hover" size="minimal" title="Minimal size" description="Description is omitted." />
|
|
409
|
+
</UiItemGroup>
|
|
410
|
+
|
|
411
|
+
<UiItemGroup class="flex flex-col gap-2">
|
|
412
|
+
<div class="label-12-medium text-content-on-surface-muted">Hover Action Variant</div>
|
|
413
|
+
<UiItem variant="hover-action" title="Default size" description="Row hover plus action hover." />
|
|
414
|
+
<UiItemSeparator />
|
|
415
|
+
<UiItem variant="hover-action" size="sm" title="Small size" description="Compact row and action hover." />
|
|
416
|
+
<UiItemSeparator />
|
|
417
|
+
<UiItem variant="hover-action" size="minimal" title="Minimal size" description="Description is omitted." />
|
|
418
|
+
</UiItemGroup>
|
|
419
|
+
</div>
|
|
420
|
+
`;
|
|
421
|
+
|
|
69
422
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* - `
|
|
78
|
-
* -
|
|
79
|
-
* -
|
|
80
|
-
* - `
|
|
423
|
+
* Default item for common rows that need title, description, and the built-in
|
|
424
|
+
* trailing action. Use this as the starting point for settings or list rows.
|
|
425
|
+
*
|
|
426
|
+
* Key features demonstrated:
|
|
427
|
+
*
|
|
428
|
+
* - Convenience props: `title`, `description`, and `desc`
|
|
429
|
+
* - Visual variants: `default`, `active`, `outline`, `hover`, and `hover-action`
|
|
430
|
+
* - Sizes: `default`, `sm`, and `minimal`
|
|
431
|
+
* - Built-in default action with the `action` emit
|
|
432
|
+
* - Slots: `#icon`, `#content`, `#action`, and the default slot for full composition
|
|
433
|
+
* - Primitive composition through `UiItemMedia`, `UiItemContent`, `UiItemTitle`, `UiItemDescription`, and `UiItemAction`
|
|
434
|
+
* - `asChild` rendering for semantic links or custom interactive roots
|
|
435
|
+
* - Optional list semantics through `withListSemantics` when used inside a `role="list"` parent
|
|
81
436
|
*/
|
|
82
437
|
export const Basic: Story = {
|
|
83
438
|
render: (args) => ({
|
|
84
439
|
components: {
|
|
85
440
|
UiItem,
|
|
86
|
-
UiItemContent,
|
|
87
|
-
UiItemTitle,
|
|
88
|
-
UiItemDescription,
|
|
89
|
-
UiItemActions,
|
|
90
|
-
UiButton,
|
|
91
441
|
},
|
|
92
442
|
setup() {
|
|
93
443
|
return { args };
|
|
94
444
|
},
|
|
95
445
|
template: `
|
|
96
446
|
<div class="w-full max-w-md">
|
|
97
|
-
<UiItem v-bind="args"
|
|
98
|
-
<UiItemContent>
|
|
99
|
-
<UiItemTitle>Basic Item</UiItemTitle>
|
|
100
|
-
<UiItemDescription>
|
|
101
|
-
A simple item with title and description.
|
|
102
|
-
</UiItemDescription>
|
|
103
|
-
</UiItemContent>
|
|
104
|
-
<UiItemActions>
|
|
105
|
-
<UiButton variant="outline" size="sm">Action</UiButton>
|
|
106
|
-
</UiItemActions>
|
|
107
|
-
</UiItem>
|
|
447
|
+
<UiItem v-bind="args" />
|
|
108
448
|
</div>
|
|
109
449
|
`,
|
|
110
450
|
}),
|
|
451
|
+
parameters: {
|
|
452
|
+
docs: {
|
|
453
|
+
source: {
|
|
454
|
+
code: createSource(['UiItem'], defaultTemplate),
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
111
458
|
};
|
|
112
459
|
|
|
113
460
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* The Item component supports three visual variants to match different UI contexts:
|
|
117
|
-
*
|
|
118
|
-
* - **Default**: Standard styling with subtle background. Best for primary content areas.
|
|
119
|
-
* - **Outline**: Clear bordered style with transparent background. Ideal for lists and menus.
|
|
120
|
-
* - **Muted**: Subdued appearance for secondary or less important content.
|
|
121
|
-
*
|
|
122
|
-
* Choose the variant that best fits your design context and content hierarchy.
|
|
461
|
+
* Shows each visual variant and when to choose it. Use this to compare static,
|
|
462
|
+
* current, outlined, row-hover, and separate action-hover rows.
|
|
123
463
|
*/
|
|
124
464
|
export const Variants: Story = {
|
|
125
465
|
render: () => ({
|
|
126
466
|
components: {
|
|
127
467
|
UiItem,
|
|
128
|
-
UiItemContent,
|
|
129
|
-
UiItemTitle,
|
|
130
|
-
UiItemDescription,
|
|
131
|
-
UiItemActions,
|
|
132
|
-
UiButton,
|
|
133
468
|
},
|
|
134
|
-
template:
|
|
135
|
-
<div class="flex flex-col gap-4 w-full max-w-lg">
|
|
136
|
-
<UiItem>
|
|
137
|
-
<UiItemContent>
|
|
138
|
-
<UiItemTitle>Default Variant</UiItemTitle>
|
|
139
|
-
<UiItemDescription>
|
|
140
|
-
Standard styling with subtle background and borders.
|
|
141
|
-
</UiItemDescription>
|
|
142
|
-
</UiItemContent>
|
|
143
|
-
<UiItemActions>
|
|
144
|
-
<UiButton variant="outline" size="sm">Open</UiButton>
|
|
145
|
-
</UiItemActions>
|
|
146
|
-
</UiItem>
|
|
147
|
-
|
|
148
|
-
<UiItem variant="outline">
|
|
149
|
-
<UiItemContent>
|
|
150
|
-
<UiItemTitle>Outline Variant</UiItemTitle>
|
|
151
|
-
<UiItemDescription>
|
|
152
|
-
Outlined style with clear borders and transparent background.
|
|
153
|
-
</UiItemDescription>
|
|
154
|
-
</UiItemContent>
|
|
155
|
-
<UiItemActions>
|
|
156
|
-
<UiButton variant="outline" size="sm">Open</UiButton>
|
|
157
|
-
</UiItemActions>
|
|
158
|
-
</UiItem>
|
|
159
|
-
|
|
160
|
-
<UiItem variant="muted">
|
|
161
|
-
<UiItemContent>
|
|
162
|
-
<UiItemTitle>Muted Variant</UiItemTitle>
|
|
163
|
-
<UiItemDescription>
|
|
164
|
-
Subdued appearance with muted colors for secondary content.
|
|
165
|
-
</UiItemDescription>
|
|
166
|
-
</UiItemContent>
|
|
167
|
-
<UiItemActions>
|
|
168
|
-
<UiButton variant="outline" size="sm">Open</UiButton>
|
|
169
|
-
</UiItemActions>
|
|
170
|
-
</UiItem>
|
|
171
|
-
</div>
|
|
172
|
-
`,
|
|
469
|
+
template: variantsTemplate,
|
|
173
470
|
}),
|
|
471
|
+
parameters: {
|
|
472
|
+
docs: {
|
|
473
|
+
source: {
|
|
474
|
+
code: createSource(['UiItem'], variantsTemplate),
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
},
|
|
174
478
|
};
|
|
175
479
|
|
|
176
480
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* The Item component supports two sizes for different layout needs:
|
|
180
|
-
*
|
|
181
|
-
* - **Default**: Standard size with comfortable padding (p-3). Use for primary content.
|
|
182
|
-
* - **Small (sm)**: Compact size with reduced padding (p-2). Perfect for dense lists,
|
|
183
|
-
* menus, or when space is limited.
|
|
184
|
-
*
|
|
185
|
-
* The small size is particularly useful for notification items, dropdown menus,
|
|
186
|
-
* or navigation lists where you need to display many items in a limited space.
|
|
481
|
+
* Compares item density across the available sizes. Use `minimal` for one-line
|
|
482
|
+
* compact rows where the description should be omitted.
|
|
187
483
|
*/
|
|
188
484
|
export const Sizes: Story = {
|
|
189
485
|
render: () => ({
|
|
190
486
|
components: {
|
|
191
487
|
UiItem,
|
|
192
|
-
UiItemContent,
|
|
193
|
-
UiItemTitle,
|
|
194
|
-
UiItemDescription,
|
|
195
|
-
UiItemActions,
|
|
196
|
-
UiItemMedia,
|
|
197
|
-
UiButton,
|
|
198
|
-
UiIcon,
|
|
199
488
|
},
|
|
200
|
-
template:
|
|
201
|
-
<div class="flex flex-col gap-4 w-full max-w-md">
|
|
202
|
-
<UiItem variant="outline">
|
|
203
|
-
<UiItemContent>
|
|
204
|
-
<UiItemTitle>Default Size Item</UiItemTitle>
|
|
205
|
-
<UiItemDescription>
|
|
206
|
-
Standard padding for comfortable spacing.
|
|
207
|
-
</UiItemDescription>
|
|
208
|
-
</UiItemContent>
|
|
209
|
-
<UiItemActions>
|
|
210
|
-
<UiButton variant="outline" size="sm">Action</UiButton>
|
|
211
|
-
</UiItemActions>
|
|
212
|
-
</UiItem>
|
|
213
|
-
|
|
214
|
-
<UiItem variant="outline" size="sm">
|
|
215
|
-
<UiItemMedia variant="icon">
|
|
216
|
-
<UiIcon name="badge-check" :size="20" />
|
|
217
|
-
</UiItemMedia>
|
|
218
|
-
<UiItemContent>
|
|
219
|
-
<UiItemTitle>Small Size Item</UiItemTitle>
|
|
220
|
-
</UiItemContent>
|
|
221
|
-
<UiItemActions>
|
|
222
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
223
|
-
</UiItemActions>
|
|
224
|
-
</UiItem>
|
|
225
|
-
</div>
|
|
226
|
-
`,
|
|
489
|
+
template: sizesTemplate,
|
|
227
490
|
}),
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
* Use `UiItemMedia` with `variant="icon"` to display an icon at the start of the item.
|
|
234
|
-
* This is perfect for notification items, settings entries, or any content that
|
|
235
|
-
* benefits from visual categorization.
|
|
236
|
-
*
|
|
237
|
-
* **Best practices:**
|
|
238
|
-
* - Use meaningful icons that reinforce the content
|
|
239
|
-
* - Keep icon colors consistent with the design system
|
|
240
|
-
* - Consider using different icon variants (outlined/filled) for visual hierarchy
|
|
241
|
-
*/
|
|
242
|
-
export const WithIcon: Story = {
|
|
243
|
-
render: () => ({
|
|
244
|
-
components: {
|
|
245
|
-
UiItem,
|
|
246
|
-
UiItemContent,
|
|
247
|
-
UiItemTitle,
|
|
248
|
-
UiItemDescription,
|
|
249
|
-
UiItemActions,
|
|
250
|
-
UiItemMedia,
|
|
251
|
-
UiButton,
|
|
252
|
-
UiIcon,
|
|
491
|
+
parameters: {
|
|
492
|
+
docs: {
|
|
493
|
+
source: {
|
|
494
|
+
code: createSource(['UiItem'], sizesTemplate),
|
|
495
|
+
},
|
|
253
496
|
},
|
|
254
|
-
|
|
255
|
-
<div class="w-full max-w-lg">
|
|
256
|
-
<UiItem variant="outline">
|
|
257
|
-
<UiItemMedia variant="icon">
|
|
258
|
-
<UiIcon name="shield-alert" :size="20" />
|
|
259
|
-
</UiItemMedia>
|
|
260
|
-
<UiItemContent>
|
|
261
|
-
<UiItemTitle>Security Alert</UiItemTitle>
|
|
262
|
-
<UiItemDescription>
|
|
263
|
-
New login detected from unknown device.
|
|
264
|
-
</UiItemDescription>
|
|
265
|
-
</UiItemContent>
|
|
266
|
-
<UiItemActions>
|
|
267
|
-
<UiButton size="sm" variant="outline">Review</UiButton>
|
|
268
|
-
</UiItemActions>
|
|
269
|
-
</UiItem>
|
|
270
|
-
</div>
|
|
271
|
-
`,
|
|
272
|
-
}),
|
|
497
|
+
},
|
|
273
498
|
};
|
|
274
499
|
|
|
275
500
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* Use `UiItemMedia` with the default variant to display avatars or profile images.
|
|
279
|
-
* This pattern is ideal for user lists, contact directories, or any content
|
|
280
|
-
* that represents a person or entity.
|
|
281
|
-
*
|
|
282
|
-
* **Use cases:**
|
|
283
|
-
* - User/team member lists
|
|
284
|
-
* - Contact directories
|
|
285
|
-
* - Comment threads
|
|
286
|
-
* - Notification items showing who triggered an action
|
|
501
|
+
* Demonstrates full slot composition for media, content, and custom action
|
|
502
|
+
* controls. Use slots when the convenience props are too limited.
|
|
287
503
|
*/
|
|
288
|
-
export const
|
|
504
|
+
export const CustomSlots: Story = {
|
|
289
505
|
render: () => ({
|
|
290
506
|
components: {
|
|
291
|
-
UiItem,
|
|
292
|
-
UiItemContent,
|
|
293
|
-
UiItemTitle,
|
|
294
|
-
UiItemDescription,
|
|
295
|
-
UiItemMedia,
|
|
296
507
|
UiAvatar,
|
|
297
|
-
UiAvatarImage,
|
|
298
508
|
UiAvatarFallback,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
<UiItem variant="outline">
|
|
303
|
-
<UiItemMedia>
|
|
304
|
-
<UiAvatar>
|
|
305
|
-
<UiAvatarImage src="https://github.com/shadcn.png" />
|
|
306
|
-
<UiAvatarFallback>SC</UiAvatarFallback>
|
|
307
|
-
</UiAvatar>
|
|
308
|
-
</UiItemMedia>
|
|
309
|
-
<UiItemContent>
|
|
310
|
-
<UiItemTitle>shadcn</UiItemTitle>
|
|
311
|
-
<UiItemDescription>Last seen 5 months ago</UiItemDescription>
|
|
312
|
-
</UiItemContent>
|
|
313
|
-
</UiItem>
|
|
314
|
-
</div>
|
|
315
|
-
`,
|
|
316
|
-
}),
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* ## With Image
|
|
321
|
-
*
|
|
322
|
-
* Use `UiItemMedia` with `variant="image"` to display images or thumbnails.
|
|
323
|
-
* The image variant provides appropriate sizing and rounded corners for
|
|
324
|
-
* visual content.
|
|
325
|
-
*
|
|
326
|
-
* **Use cases:**
|
|
327
|
-
* - Product listings
|
|
328
|
-
* - Media galleries
|
|
329
|
-
* - Article/blog post previews
|
|
330
|
-
* - File browser with thumbnails
|
|
331
|
-
*/
|
|
332
|
-
export const WithImage: Story = {
|
|
333
|
-
render: () => ({
|
|
334
|
-
components: {
|
|
509
|
+
UiAvatarImage,
|
|
510
|
+
UiButton,
|
|
511
|
+
UiIcon,
|
|
335
512
|
UiItem,
|
|
336
|
-
UiItemContent,
|
|
337
|
-
UiItemTitle,
|
|
338
|
-
UiItemDescription,
|
|
339
|
-
UiItemMedia,
|
|
340
513
|
},
|
|
341
|
-
template:
|
|
342
|
-
<div class="w-full max-w-md">
|
|
343
|
-
<UiItem variant="outline">
|
|
344
|
-
<UiItemMedia variant="image">
|
|
345
|
-
<img
|
|
346
|
-
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=100&h=100&fit=crop"
|
|
347
|
-
alt="Mountain landscape"
|
|
348
|
-
class="size-full object-cover"
|
|
349
|
-
/>
|
|
350
|
-
</UiItemMedia>
|
|
351
|
-
<UiItemContent>
|
|
352
|
-
<UiItemTitle>Mountain Expedition</UiItemTitle>
|
|
353
|
-
<UiItemDescription>
|
|
354
|
-
Explore the breathtaking alpine landscapes.
|
|
355
|
-
</UiItemDescription>
|
|
356
|
-
</UiItemContent>
|
|
357
|
-
</UiItem>
|
|
358
|
-
</div>
|
|
359
|
-
`,
|
|
514
|
+
template: customSlotsTemplate,
|
|
360
515
|
}),
|
|
516
|
+
parameters: {
|
|
517
|
+
docs: {
|
|
518
|
+
source: {
|
|
519
|
+
code: createSource(
|
|
520
|
+
[
|
|
521
|
+
'UiAvatar',
|
|
522
|
+
'UiAvatarFallback',
|
|
523
|
+
'UiAvatarImage',
|
|
524
|
+
'UiButton',
|
|
525
|
+
'UiIcon',
|
|
526
|
+
'UiItem',
|
|
527
|
+
],
|
|
528
|
+
customSlotsTemplate,
|
|
529
|
+
),
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
},
|
|
361
533
|
};
|
|
362
534
|
|
|
363
535
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* Use `UiItemGroup` to group related items together with consistent styling.
|
|
367
|
-
* Add `UiItemSeparator` between items to create visual separation.
|
|
368
|
-
*
|
|
369
|
-
* **Key features:**
|
|
370
|
-
* - `UiItemGroup` provides consistent spacing between items
|
|
371
|
-
* - `UiItemSeparator` creates a subtle divider line
|
|
372
|
-
* - Great for settings panels, menus, and navigation lists
|
|
373
|
-
*
|
|
374
|
-
* **Best practices:**
|
|
375
|
-
* - Group logically related items together
|
|
376
|
-
* - Use separators sparingly to avoid visual clutter
|
|
377
|
-
* - Consider using headers to label different groups
|
|
536
|
+
* Uses the convenience `#icon` slot for lightweight leading icons. Prefer this
|
|
537
|
+
* when the media content is decorative or directly supports the row label.
|
|
378
538
|
*/
|
|
379
|
-
export const
|
|
539
|
+
export const WithIcon: Story = {
|
|
380
540
|
render: () => ({
|
|
381
541
|
components: {
|
|
382
|
-
UiItem,
|
|
383
|
-
UiItemGroup,
|
|
384
|
-
UiItemSeparator,
|
|
385
|
-
UiItemContent,
|
|
386
|
-
UiItemTitle,
|
|
387
|
-
UiItemDescription,
|
|
388
|
-
UiItemMedia,
|
|
389
|
-
UiItemActions,
|
|
390
542
|
UiIcon,
|
|
543
|
+
UiItem,
|
|
391
544
|
},
|
|
392
|
-
template:
|
|
393
|
-
<div class="w-full max-w-md">
|
|
394
|
-
<UiItemGroup class="rounded-lg border p-2">
|
|
395
|
-
<UiItem>
|
|
396
|
-
<UiItemMedia variant="icon">
|
|
397
|
-
<UiIcon name="user" :size="20" />
|
|
398
|
-
</UiItemMedia>
|
|
399
|
-
<UiItemContent>
|
|
400
|
-
<UiItemTitle>Profile</UiItemTitle>
|
|
401
|
-
<UiItemDescription>Manage your profile settings</UiItemDescription>
|
|
402
|
-
</UiItemContent>
|
|
403
|
-
<UiItemActions>
|
|
404
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
405
|
-
</UiItemActions>
|
|
406
|
-
</UiItem>
|
|
407
|
-
|
|
408
|
-
<UiItemSeparator />
|
|
409
|
-
|
|
410
|
-
<UiItem>
|
|
411
|
-
<UiItemMedia variant="icon">
|
|
412
|
-
<UiIcon name="bell" :size="20" />
|
|
413
|
-
</UiItemMedia>
|
|
414
|
-
<UiItemContent>
|
|
415
|
-
<UiItemTitle>Notifications</UiItemTitle>
|
|
416
|
-
<UiItemDescription>Configure notification preferences</UiItemDescription>
|
|
417
|
-
</UiItemContent>
|
|
418
|
-
<UiItemActions>
|
|
419
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
420
|
-
</UiItemActions>
|
|
421
|
-
</UiItem>
|
|
422
|
-
|
|
423
|
-
<UiItemSeparator />
|
|
424
|
-
|
|
425
|
-
<UiItem>
|
|
426
|
-
<UiItemMedia variant="icon">
|
|
427
|
-
<UiIcon name="settings" :size="20" />
|
|
428
|
-
</UiItemMedia>
|
|
429
|
-
<UiItemContent>
|
|
430
|
-
<UiItemTitle>Settings</UiItemTitle>
|
|
431
|
-
<UiItemDescription>App preferences and configuration</UiItemDescription>
|
|
432
|
-
</UiItemContent>
|
|
433
|
-
<UiItemActions>
|
|
434
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
435
|
-
</UiItemActions>
|
|
436
|
-
</UiItem>
|
|
437
|
-
</UiItemGroup>
|
|
438
|
-
</div>
|
|
439
|
-
`,
|
|
545
|
+
template: withIconTemplate,
|
|
440
546
|
}),
|
|
547
|
+
parameters: {
|
|
548
|
+
docs: {
|
|
549
|
+
source: {
|
|
550
|
+
code: createSource(['UiIcon', 'UiItem'], withIconTemplate),
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
},
|
|
441
554
|
};
|
|
442
555
|
|
|
443
556
|
/**
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
* Use `UiItemHeader` and `UiItemFooter` to add contextual information above
|
|
447
|
-
* and below the main content. This is useful for categorization, metadata,
|
|
448
|
-
* or additional details.
|
|
449
|
-
*
|
|
450
|
-
* **Use cases:**
|
|
451
|
-
* - File listings with type labels and metadata
|
|
452
|
-
* - Activity feeds with timestamps
|
|
453
|
-
* - Product cards with category and price info
|
|
454
|
-
* - Notification items with time and source
|
|
557
|
+
* Shows the built-in default action and a custom action slot. Use
|
|
558
|
+
* `hover-action` when the action needs its own hover feedback.
|
|
455
559
|
*/
|
|
456
|
-
export const
|
|
560
|
+
export const Actions: Story = {
|
|
457
561
|
render: () => ({
|
|
458
562
|
components: {
|
|
459
|
-
|
|
460
|
-
UiItemContent,
|
|
461
|
-
UiItemTitle,
|
|
462
|
-
UiItemDescription,
|
|
463
|
-
UiItemHeader,
|
|
464
|
-
UiItemFooter,
|
|
465
|
-
UiItemMedia,
|
|
563
|
+
UiButton,
|
|
466
564
|
UiIcon,
|
|
565
|
+
UiItem,
|
|
467
566
|
},
|
|
468
|
-
template:
|
|
469
|
-
<div class="w-full max-w-md">
|
|
470
|
-
<UiItem variant="outline">
|
|
471
|
-
<UiItemMedia variant="icon">
|
|
472
|
-
<UiIcon name="file-text" :size="20" />
|
|
473
|
-
</UiItemMedia>
|
|
474
|
-
<UiItemContent>
|
|
475
|
-
<UiItemHeader>DOCUMENT</UiItemHeader>
|
|
476
|
-
<UiItemTitle>Project Proposal.pdf</UiItemTitle>
|
|
477
|
-
<UiItemDescription>
|
|
478
|
-
Final version of the Q4 project proposal
|
|
479
|
-
</UiItemDescription>
|
|
480
|
-
<UiItemFooter>Updated 2 hours ago • 2.4 MB</UiItemFooter>
|
|
481
|
-
</UiItemContent>
|
|
482
|
-
</UiItem>
|
|
483
|
-
</div>
|
|
484
|
-
`,
|
|
567
|
+
template: actionsTemplate,
|
|
485
568
|
}),
|
|
569
|
+
parameters: {
|
|
570
|
+
docs: {
|
|
571
|
+
source: {
|
|
572
|
+
code: createSource(['UiButton', 'UiIcon', 'UiItem'], actionsTemplate),
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
},
|
|
486
576
|
};
|
|
487
577
|
|
|
488
578
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
* Use the `as-child` prop to render the item as a custom element like an anchor tag.
|
|
492
|
-
* The hover and focus states will be applied to the anchor element, making
|
|
493
|
-
* the entire item clickable.
|
|
494
|
-
*
|
|
495
|
-
* **Key benefits:**
|
|
496
|
-
* - Semantic HTML with proper `<a>` tags
|
|
497
|
-
* - Full keyboard navigation support
|
|
498
|
-
* - Screen reader friendly
|
|
499
|
-
* - Proper link behavior (right-click, cmd+click, etc.)
|
|
500
|
-
*
|
|
501
|
-
* **Use cases:**
|
|
502
|
-
* - Navigation menus
|
|
503
|
-
* - Resource links
|
|
504
|
-
* - External links (with appropriate icons)
|
|
579
|
+
* Adds tooltip copy to a custom item action. Use this when an icon-only action
|
|
580
|
+
* needs additional explanation beyond its accessible label.
|
|
505
581
|
*/
|
|
506
|
-
export const
|
|
582
|
+
export const ActionTooltip: Story = {
|
|
507
583
|
render: () => ({
|
|
508
584
|
components: {
|
|
509
|
-
|
|
510
|
-
UiItemContent,
|
|
511
|
-
UiItemTitle,
|
|
512
|
-
UiItemDescription,
|
|
513
|
-
UiItemActions,
|
|
585
|
+
UiButton,
|
|
514
586
|
UiIcon,
|
|
587
|
+
UiItem,
|
|
588
|
+
UiItemAction,
|
|
515
589
|
},
|
|
516
|
-
template:
|
|
517
|
-
<div class="flex flex-col gap-4 w-full max-w-md">
|
|
518
|
-
<UiItem as-child>
|
|
519
|
-
<a href="#">
|
|
520
|
-
<UiItemContent>
|
|
521
|
-
<UiItemTitle>Visit our documentation</UiItemTitle>
|
|
522
|
-
<UiItemDescription>
|
|
523
|
-
Learn how to get started with our components.
|
|
524
|
-
</UiItemDescription>
|
|
525
|
-
</UiItemContent>
|
|
526
|
-
<UiItemActions>
|
|
527
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
528
|
-
</UiItemActions>
|
|
529
|
-
</a>
|
|
530
|
-
</UiItem>
|
|
531
|
-
|
|
532
|
-
<UiItem variant="outline" as-child>
|
|
533
|
-
<a href="#" target="_blank" rel="noopener noreferrer">
|
|
534
|
-
<UiItemContent>
|
|
535
|
-
<UiItemTitle>External resource</UiItemTitle>
|
|
536
|
-
<UiItemDescription>
|
|
537
|
-
Opens in a new tab with security attributes.
|
|
538
|
-
</UiItemDescription>
|
|
539
|
-
</UiItemContent>
|
|
540
|
-
<UiItemActions>
|
|
541
|
-
<UiIcon name="external-link" :size="16" />
|
|
542
|
-
</UiItemActions>
|
|
543
|
-
</a>
|
|
544
|
-
</UiItem>
|
|
545
|
-
</div>
|
|
546
|
-
`,
|
|
590
|
+
template: actionTooltipTemplate,
|
|
547
591
|
}),
|
|
592
|
+
parameters: {
|
|
593
|
+
docs: {
|
|
594
|
+
source: {
|
|
595
|
+
code: createSource(
|
|
596
|
+
['UiButton', 'UiIcon', 'UiItem', 'UiItemAction'],
|
|
597
|
+
actionTooltipTemplate,
|
|
598
|
+
),
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
},
|
|
548
602
|
};
|
|
549
603
|
|
|
550
604
|
/**
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
* A practical example showing a list of team members with avatars.
|
|
554
|
-
* This pattern combines avatars with user information and action buttons.
|
|
555
|
-
*
|
|
556
|
-
* **Common variations:**
|
|
557
|
-
* - Add online/offline status indicators
|
|
558
|
-
* - Include role badges
|
|
559
|
-
* - Add dropdown menus for more actions
|
|
560
|
-
* - Show last activity time
|
|
605
|
+
* Shows the available media patterns: icon, avatar, image, text label, and
|
|
606
|
+
* compact button media. Use the composed media primitive for richer leading content.
|
|
561
607
|
*/
|
|
562
|
-
export const
|
|
608
|
+
export const Media: Story = {
|
|
563
609
|
render: () => ({
|
|
564
610
|
components: {
|
|
611
|
+
UiAvatar,
|
|
612
|
+
UiAvatarFallback,
|
|
613
|
+
UiAvatarGroup,
|
|
614
|
+
UiAvatarImage,
|
|
615
|
+
UiIcon,
|
|
565
616
|
UiItem,
|
|
566
|
-
|
|
617
|
+
UiItemAction,
|
|
567
618
|
UiItemContent,
|
|
568
|
-
UiItemTitle,
|
|
569
619
|
UiItemDescription,
|
|
570
620
|
UiItemMedia,
|
|
571
|
-
|
|
572
|
-
UiAvatar,
|
|
573
|
-
UiAvatarImage,
|
|
574
|
-
UiAvatarFallback,
|
|
575
|
-
UiButton,
|
|
576
|
-
},
|
|
577
|
-
setup() {
|
|
578
|
-
const teamMembers = [
|
|
579
|
-
{
|
|
580
|
-
name: 'Sarah Chen',
|
|
581
|
-
role: 'Engineering Lead',
|
|
582
|
-
avatar: 'https://i.pravatar.cc/150?u=sarah',
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
name: 'Marcus Johnson',
|
|
586
|
-
role: 'Senior Developer',
|
|
587
|
-
avatar: 'https://i.pravatar.cc/150?u=marcus',
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
name: 'Emily Rodriguez',
|
|
591
|
-
role: 'UX Designer',
|
|
592
|
-
avatar: 'https://i.pravatar.cc/150?u=emily',
|
|
593
|
-
},
|
|
594
|
-
];
|
|
595
|
-
return { teamMembers };
|
|
621
|
+
UiItemTitle,
|
|
596
622
|
},
|
|
597
|
-
template:
|
|
598
|
-
<div class="w-full max-w-md">
|
|
599
|
-
<UiItemGroup class="rounded-lg border">
|
|
600
|
-
<UiItem v-for="member in teamMembers" :key="member.name" size="sm" class="p-3">
|
|
601
|
-
<UiItemMedia>
|
|
602
|
-
<UiAvatar>
|
|
603
|
-
<UiAvatarImage :src="member.avatar" />
|
|
604
|
-
<UiAvatarFallback>{{ member.name.split(' ').map(n => n[0]).join('') }}</UiAvatarFallback>
|
|
605
|
-
</UiAvatar>
|
|
606
|
-
</UiItemMedia>
|
|
607
|
-
<UiItemContent>
|
|
608
|
-
<UiItemTitle>{{ member.name }}</UiItemTitle>
|
|
609
|
-
<UiItemDescription>{{ member.role }}</UiItemDescription>
|
|
610
|
-
</UiItemContent>
|
|
611
|
-
<UiItemActions>
|
|
612
|
-
<UiButton variant="outline" size="sm">Message</UiButton>
|
|
613
|
-
</UiItemActions>
|
|
614
|
-
</UiItem>
|
|
615
|
-
</UiItemGroup>
|
|
616
|
-
</div>
|
|
617
|
-
`,
|
|
623
|
+
template: mediaTemplate,
|
|
618
624
|
}),
|
|
625
|
+
parameters: {
|
|
626
|
+
docs: {
|
|
627
|
+
source: {
|
|
628
|
+
code: createSource(
|
|
629
|
+
[
|
|
630
|
+
'UiAvatar',
|
|
631
|
+
'UiAvatarFallback',
|
|
632
|
+
'UiAvatarGroup',
|
|
633
|
+
'UiAvatarImage',
|
|
634
|
+
'UiIcon',
|
|
635
|
+
'UiItem',
|
|
636
|
+
'UiItemAction',
|
|
637
|
+
'UiItemContent',
|
|
638
|
+
'UiItemDescription',
|
|
639
|
+
'UiItemMedia',
|
|
640
|
+
'UiItemTitle',
|
|
641
|
+
],
|
|
642
|
+
mediaTemplate,
|
|
643
|
+
),
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
},
|
|
619
647
|
};
|
|
620
648
|
|
|
621
649
|
/**
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* A notification center pattern showing different types of notifications
|
|
625
|
-
* with color-coded icons, timestamps, and read/unread states.
|
|
626
|
-
*
|
|
627
|
-
* **Features demonstrated:**
|
|
628
|
-
* - Color-coded icons for different notification types
|
|
629
|
-
* - Footer with timestamps
|
|
630
|
-
* - Muted variant for read notifications
|
|
631
|
-
* - Separators between items
|
|
650
|
+
* Groups related items with separator lines only. Use this for simple lists
|
|
651
|
+
* where the surrounding layout owns spacing and surface treatment.
|
|
632
652
|
*/
|
|
633
|
-
export const
|
|
653
|
+
export const Group: Story = {
|
|
634
654
|
render: () => ({
|
|
635
655
|
components: {
|
|
656
|
+
UiIcon,
|
|
636
657
|
UiItem,
|
|
637
658
|
UiItemGroup,
|
|
638
659
|
UiItemSeparator,
|
|
639
|
-
UiItemContent,
|
|
640
|
-
UiItemTitle,
|
|
641
|
-
UiItemDescription,
|
|
642
|
-
UiItemMedia,
|
|
643
|
-
UiItemFooter,
|
|
644
|
-
UiIcon,
|
|
645
660
|
},
|
|
646
|
-
template:
|
|
647
|
-
<div class="w-full max-w-md">
|
|
648
|
-
<UiItemGroup class="rounded-lg border p-2">
|
|
649
|
-
<UiItem>
|
|
650
|
-
<UiItemMedia variant="icon" class="text-blue-500">
|
|
651
|
-
<UiIcon name="mail" :size="20" />
|
|
652
|
-
</UiItemMedia>
|
|
653
|
-
<UiItemContent>
|
|
654
|
-
<UiItemTitle>New message from Sarah</UiItemTitle>
|
|
655
|
-
<UiItemDescription>Hey, can you review the latest PR?</UiItemDescription>
|
|
656
|
-
<UiItemFooter>2 minutes ago</UiItemFooter>
|
|
657
|
-
</UiItemContent>
|
|
658
|
-
</UiItem>
|
|
659
|
-
|
|
660
|
-
<UiItemSeparator />
|
|
661
|
-
|
|
662
|
-
<UiItem>
|
|
663
|
-
<UiItemMedia variant="icon" class="text-yellow-500">
|
|
664
|
-
<UiIcon name="alert-circle" :size="20" />
|
|
665
|
-
</UiItemMedia>
|
|
666
|
-
<UiItemContent>
|
|
667
|
-
<UiItemTitle>System warning</UiItemTitle>
|
|
668
|
-
<UiItemDescription>Your storage is almost full (95% used)</UiItemDescription>
|
|
669
|
-
<UiItemFooter>1 hour ago</UiItemFooter>
|
|
670
|
-
</UiItemContent>
|
|
671
|
-
</UiItem>
|
|
672
|
-
|
|
673
|
-
<UiItemSeparator />
|
|
674
|
-
|
|
675
|
-
<UiItem variant="muted">
|
|
676
|
-
<UiItemMedia variant="icon" class="text-green-500">
|
|
677
|
-
<UiIcon name="check-circle" :size="20" />
|
|
678
|
-
</UiItemMedia>
|
|
679
|
-
<UiItemContent>
|
|
680
|
-
<UiItemTitle>Deployment successful</UiItemTitle>
|
|
681
|
-
<UiItemDescription>v2.4.1 deployed to production</UiItemDescription>
|
|
682
|
-
<UiItemFooter>Yesterday</UiItemFooter>
|
|
683
|
-
</UiItemContent>
|
|
684
|
-
</UiItem>
|
|
685
|
-
</UiItemGroup>
|
|
686
|
-
</div>
|
|
687
|
-
`,
|
|
661
|
+
template: groupTemplate,
|
|
688
662
|
}),
|
|
663
|
+
parameters: {
|
|
664
|
+
docs: {
|
|
665
|
+
source: {
|
|
666
|
+
code: createSource(
|
|
667
|
+
['UiIcon', 'UiItem', 'UiItemGroup', 'UiItemSeparator'],
|
|
668
|
+
groupTemplate,
|
|
669
|
+
),
|
|
670
|
+
},
|
|
671
|
+
},
|
|
672
|
+
},
|
|
689
673
|
};
|
|
690
674
|
|
|
691
675
|
/**
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
* An empty state pattern using the Item component. Perfect for showing
|
|
695
|
-
* a call-to-action when a list is empty.
|
|
696
|
-
*
|
|
697
|
-
* **Use cases:**
|
|
698
|
-
* - Empty team member lists
|
|
699
|
-
* - No notifications state
|
|
700
|
-
* - Empty file lists
|
|
701
|
-
* - First-time user experiences
|
|
676
|
+
* Renders the item as a semantic link while preserving item layout and hover
|
|
677
|
+
* styles. Use `asChild` when the row should navigate.
|
|
702
678
|
*/
|
|
703
|
-
export const
|
|
679
|
+
export const AsLink: Story = {
|
|
704
680
|
render: () => ({
|
|
705
681
|
components: {
|
|
682
|
+
UiIcon,
|
|
706
683
|
UiItem,
|
|
684
|
+
UiItemAction,
|
|
707
685
|
UiItemContent,
|
|
708
|
-
UiItemTitle,
|
|
709
686
|
UiItemDescription,
|
|
710
|
-
|
|
711
|
-
UiItemActions,
|
|
712
|
-
UiButton,
|
|
713
|
-
UiAvatar,
|
|
714
|
-
UiAvatarFallback,
|
|
715
|
-
UiIcon,
|
|
687
|
+
UiItemTitle,
|
|
716
688
|
},
|
|
717
|
-
template:
|
|
718
|
-
<div class="w-full max-w-md">
|
|
719
|
-
<UiItem variant="outline">
|
|
720
|
-
<UiItemMedia>
|
|
721
|
-
<UiAvatar class="bg-muted">
|
|
722
|
-
<UiAvatarFallback>
|
|
723
|
-
<UiIcon name="users" :size="20" class="text-muted-foreground" />
|
|
724
|
-
</UiAvatarFallback>
|
|
725
|
-
</UiAvatar>
|
|
726
|
-
</UiItemMedia>
|
|
727
|
-
<UiItemContent>
|
|
728
|
-
<UiItemTitle>No Team Members</UiItemTitle>
|
|
729
|
-
<UiItemDescription>
|
|
730
|
-
Invite your team to collaborate on this project.
|
|
731
|
-
</UiItemDescription>
|
|
732
|
-
</UiItemContent>
|
|
733
|
-
<UiItemActions>
|
|
734
|
-
<UiButton size="sm">Invite</UiButton>
|
|
735
|
-
</UiItemActions>
|
|
736
|
-
</UiItem>
|
|
737
|
-
</div>
|
|
738
|
-
`,
|
|
689
|
+
template: asLinkTemplate,
|
|
739
690
|
}),
|
|
691
|
+
parameters: {
|
|
692
|
+
docs: {
|
|
693
|
+
source: {
|
|
694
|
+
code: createSource(
|
|
695
|
+
[
|
|
696
|
+
'UiIcon',
|
|
697
|
+
'UiItem',
|
|
698
|
+
'UiItemAction',
|
|
699
|
+
'UiItemContent',
|
|
700
|
+
'UiItemDescription',
|
|
701
|
+
'UiItemTitle',
|
|
702
|
+
],
|
|
703
|
+
asLinkTemplate,
|
|
704
|
+
),
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
},
|
|
740
708
|
};
|
|
741
709
|
|
|
742
710
|
/**
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
* A comprehensive showcase of all Item component states and variations
|
|
746
|
-
* in a single view. This is useful for:
|
|
747
|
-
*
|
|
748
|
-
* - **Visual QA**: Quickly verify all states look correct
|
|
749
|
-
* - **Design review**: See all variations side by side
|
|
750
|
-
* - **Documentation**: Reference for available options
|
|
751
|
-
*
|
|
752
|
-
* ### Variants
|
|
753
|
-
* - Default, Outline, Muted
|
|
754
|
-
*
|
|
755
|
-
* ### Sizes
|
|
756
|
-
* - Default, Small
|
|
757
|
-
*
|
|
758
|
-
* ### Media Variants
|
|
759
|
-
* - Default (avatar), Icon, Image
|
|
760
|
-
*
|
|
761
|
-
* ### Sub-components
|
|
762
|
-
* - UiItemGroup, UiItemSeparator
|
|
763
|
-
* - UiItemMedia, UiItemContent
|
|
764
|
-
* - UiItemTitle, UiItemDescription
|
|
765
|
-
* - UiItemActions, UiItemHeader, UiItemFooter
|
|
711
|
+
* Overview of every visual variant with every size in one place. Use this for
|
|
712
|
+
* visual QA rather than as copy-paste guidance for a single use case.
|
|
766
713
|
*/
|
|
767
|
-
export const
|
|
714
|
+
export const AllVariants: Story = {
|
|
768
715
|
render: () => ({
|
|
769
716
|
components: {
|
|
770
717
|
UiItem,
|
|
771
718
|
UiItemGroup,
|
|
772
719
|
UiItemSeparator,
|
|
773
|
-
UiItemContent,
|
|
774
|
-
UiItemTitle,
|
|
775
|
-
UiItemDescription,
|
|
776
|
-
UiItemMedia,
|
|
777
|
-
UiItemActions,
|
|
778
|
-
UiItemHeader,
|
|
779
|
-
UiItemFooter,
|
|
780
|
-
UiButton,
|
|
781
|
-
UiAvatar,
|
|
782
|
-
UiAvatarImage,
|
|
783
|
-
UiAvatarFallback,
|
|
784
|
-
UiIcon,
|
|
785
720
|
},
|
|
786
|
-
template:
|
|
787
|
-
<div class="flex flex-col gap-8 w-full max-w-2xl">
|
|
788
|
-
<!-- VARIANTS SECTION -->
|
|
789
|
-
<section>
|
|
790
|
-
<h3 class="heading-s mb-4">Variants</h3>
|
|
791
|
-
<div class="flex flex-col gap-3">
|
|
792
|
-
<UiItem>
|
|
793
|
-
<UiItemContent>
|
|
794
|
-
<UiItemTitle>Default Variant</UiItemTitle>
|
|
795
|
-
<UiItemDescription>Standard styling with subtle background</UiItemDescription>
|
|
796
|
-
</UiItemContent>
|
|
797
|
-
</UiItem>
|
|
798
|
-
|
|
799
|
-
<UiItem variant="outline">
|
|
800
|
-
<UiItemContent>
|
|
801
|
-
<UiItemTitle>Outline Variant</UiItemTitle>
|
|
802
|
-
<UiItemDescription>Bordered style with transparent background</UiItemDescription>
|
|
803
|
-
</UiItemContent>
|
|
804
|
-
</UiItem>
|
|
805
|
-
|
|
806
|
-
<UiItem variant="muted">
|
|
807
|
-
<UiItemContent>
|
|
808
|
-
<UiItemTitle>Muted Variant</UiItemTitle>
|
|
809
|
-
<UiItemDescription>Subdued appearance for secondary content</UiItemDescription>
|
|
810
|
-
</UiItemContent>
|
|
811
|
-
</UiItem>
|
|
812
|
-
</div>
|
|
813
|
-
</section>
|
|
814
|
-
|
|
815
|
-
<!-- SIZES SECTION -->
|
|
816
|
-
<section>
|
|
817
|
-
<h3 class="heading-s mb-4">Sizes</h3>
|
|
818
|
-
<div class="flex flex-col gap-3">
|
|
819
|
-
<UiItem variant="outline">
|
|
820
|
-
<UiItemMedia variant="icon">
|
|
821
|
-
<UiIcon name="layout-grid" :size="20" />
|
|
822
|
-
</UiItemMedia>
|
|
823
|
-
<UiItemContent>
|
|
824
|
-
<UiItemTitle>Default Size</UiItemTitle>
|
|
825
|
-
<UiItemDescription>Comfortable padding for primary content</UiItemDescription>
|
|
826
|
-
</UiItemContent>
|
|
827
|
-
</UiItem>
|
|
828
|
-
|
|
829
|
-
<UiItem variant="outline" size="sm">
|
|
830
|
-
<UiItemMedia variant="icon">
|
|
831
|
-
<UiIcon name="layout-list" :size="20" />
|
|
832
|
-
</UiItemMedia>
|
|
833
|
-
<UiItemContent>
|
|
834
|
-
<UiItemTitle>Small Size</UiItemTitle>
|
|
835
|
-
<UiItemDescription>Compact padding for dense layouts</UiItemDescription>
|
|
836
|
-
</UiItemContent>
|
|
837
|
-
</UiItem>
|
|
838
|
-
</div>
|
|
839
|
-
</section>
|
|
840
|
-
|
|
841
|
-
<!-- MEDIA VARIANTS SECTION -->
|
|
842
|
-
<section>
|
|
843
|
-
<h3 class="heading-s mb-4">Media Variants</h3>
|
|
844
|
-
<div class="flex flex-col gap-3">
|
|
845
|
-
<UiItem variant="outline">
|
|
846
|
-
<UiItemMedia>
|
|
847
|
-
<UiAvatar>
|
|
848
|
-
<UiAvatarImage src="https://i.pravatar.cc/150?u=demo" />
|
|
849
|
-
<UiAvatarFallback>DM</UiAvatarFallback>
|
|
850
|
-
</UiAvatar>
|
|
851
|
-
</UiItemMedia>
|
|
852
|
-
<UiItemContent>
|
|
853
|
-
<UiItemTitle>Default Media (Avatar)</UiItemTitle>
|
|
854
|
-
<UiItemDescription>Standard sizing for avatars</UiItemDescription>
|
|
855
|
-
</UiItemContent>
|
|
856
|
-
</UiItem>
|
|
857
|
-
|
|
858
|
-
<UiItem variant="outline">
|
|
859
|
-
<UiItemMedia variant="icon">
|
|
860
|
-
<UiIcon name="star" :size="20" />
|
|
861
|
-
</UiItemMedia>
|
|
862
|
-
<UiItemContent>
|
|
863
|
-
<UiItemTitle>Icon Media</UiItemTitle>
|
|
864
|
-
<UiItemDescription>Compact sizing for icons</UiItemDescription>
|
|
865
|
-
</UiItemContent>
|
|
866
|
-
</UiItem>
|
|
867
|
-
|
|
868
|
-
<UiItem variant="outline">
|
|
869
|
-
<UiItemMedia variant="image">
|
|
870
|
-
<img
|
|
871
|
-
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=100&h=100&fit=crop"
|
|
872
|
-
alt="Demo image"
|
|
873
|
-
class="size-full object-cover"
|
|
874
|
-
/>
|
|
875
|
-
</UiItemMedia>
|
|
876
|
-
<UiItemContent>
|
|
877
|
-
<UiItemTitle>Image Media</UiItemTitle>
|
|
878
|
-
<UiItemDescription>Larger sizing for thumbnails</UiItemDescription>
|
|
879
|
-
</UiItemContent>
|
|
880
|
-
</UiItem>
|
|
881
|
-
</div>
|
|
882
|
-
</section>
|
|
883
|
-
|
|
884
|
-
<!-- WITH ACTIONS SECTION -->
|
|
885
|
-
<section>
|
|
886
|
-
<h3 class="heading-s mb-4">With Actions</h3>
|
|
887
|
-
<div class="flex flex-col gap-3">
|
|
888
|
-
<UiItem variant="outline">
|
|
889
|
-
<UiItemMedia variant="icon">
|
|
890
|
-
<UiIcon name="folder" :size="20" />
|
|
891
|
-
</UiItemMedia>
|
|
892
|
-
<UiItemContent>
|
|
893
|
-
<UiItemTitle>With Button Action</UiItemTitle>
|
|
894
|
-
<UiItemDescription>Click the button to perform an action</UiItemDescription>
|
|
895
|
-
</UiItemContent>
|
|
896
|
-
<UiItemActions>
|
|
897
|
-
<UiButton variant="outline" size="sm">Action</UiButton>
|
|
898
|
-
</UiItemActions>
|
|
899
|
-
</UiItem>
|
|
900
|
-
|
|
901
|
-
<UiItem variant="outline">
|
|
902
|
-
<UiItemMedia variant="icon">
|
|
903
|
-
<UiIcon name="file" :size="20" />
|
|
904
|
-
</UiItemMedia>
|
|
905
|
-
<UiItemContent>
|
|
906
|
-
<UiItemTitle>With Icon Action</UiItemTitle>
|
|
907
|
-
<UiItemDescription>Navigate to see more details</UiItemDescription>
|
|
908
|
-
</UiItemContent>
|
|
909
|
-
<UiItemActions>
|
|
910
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
911
|
-
</UiItemActions>
|
|
912
|
-
</UiItem>
|
|
913
|
-
|
|
914
|
-
<UiItem variant="outline">
|
|
915
|
-
<UiItemMedia variant="icon">
|
|
916
|
-
<UiIcon name="inbox" :size="20" />
|
|
917
|
-
</UiItemMedia>
|
|
918
|
-
<UiItemContent>
|
|
919
|
-
<UiItemTitle>With Multiple Actions</UiItemTitle>
|
|
920
|
-
<UiItemDescription>Multiple buttons in actions area</UiItemDescription>
|
|
921
|
-
</UiItemContent>
|
|
922
|
-
<UiItemActions>
|
|
923
|
-
<UiButton variant="ghost" size="sm">Cancel</UiButton>
|
|
924
|
-
<UiButton size="sm">Confirm</UiButton>
|
|
925
|
-
</UiItemActions>
|
|
926
|
-
</UiItem>
|
|
927
|
-
</div>
|
|
928
|
-
</section>
|
|
929
|
-
|
|
930
|
-
<!-- WITH HEADER AND FOOTER SECTION -->
|
|
931
|
-
<section>
|
|
932
|
-
<h3 class="heading-s mb-4">With Header and Footer</h3>
|
|
933
|
-
<UiItem variant="outline">
|
|
934
|
-
<UiItemMedia variant="icon">
|
|
935
|
-
<UiIcon name="calendar" :size="20" />
|
|
936
|
-
</UiItemMedia>
|
|
937
|
-
<UiItemContent>
|
|
938
|
-
<UiItemHeader>SCHEDULED EVENT</UiItemHeader>
|
|
939
|
-
<UiItemTitle>Team Standup Meeting</UiItemTitle>
|
|
940
|
-
<UiItemDescription>Daily sync with the engineering team</UiItemDescription>
|
|
941
|
-
<UiItemFooter>Tomorrow at 9:00 AM • 30 min</UiItemFooter>
|
|
942
|
-
</UiItemContent>
|
|
943
|
-
<UiItemActions>
|
|
944
|
-
<UiButton variant="outline" size="sm">Join</UiButton>
|
|
945
|
-
</UiItemActions>
|
|
946
|
-
</UiItem>
|
|
947
|
-
</section>
|
|
948
|
-
|
|
949
|
-
<!-- GROUPED ITEMS SECTION -->
|
|
950
|
-
<section>
|
|
951
|
-
<h3 class="heading-s mb-4">Grouped Items with Separator</h3>
|
|
952
|
-
<UiItemGroup class="rounded-lg border p-2">
|
|
953
|
-
<UiItem>
|
|
954
|
-
<UiItemMedia variant="icon">
|
|
955
|
-
<UiIcon name="home" :size="20" />
|
|
956
|
-
</UiItemMedia>
|
|
957
|
-
<UiItemContent>
|
|
958
|
-
<UiItemTitle>Dashboard</UiItemTitle>
|
|
959
|
-
</UiItemContent>
|
|
960
|
-
<UiItemActions>
|
|
961
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
962
|
-
</UiItemActions>
|
|
963
|
-
</UiItem>
|
|
964
|
-
|
|
965
|
-
<UiItemSeparator />
|
|
966
|
-
|
|
967
|
-
<UiItem>
|
|
968
|
-
<UiItemMedia variant="icon">
|
|
969
|
-
<UiIcon name="bar-chart-2" :size="20" />
|
|
970
|
-
</UiItemMedia>
|
|
971
|
-
<UiItemContent>
|
|
972
|
-
<UiItemTitle>Analytics</UiItemTitle>
|
|
973
|
-
</UiItemContent>
|
|
974
|
-
<UiItemActions>
|
|
975
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
976
|
-
</UiItemActions>
|
|
977
|
-
</UiItem>
|
|
978
|
-
|
|
979
|
-
<UiItemSeparator />
|
|
980
|
-
|
|
981
|
-
<UiItem>
|
|
982
|
-
<UiItemMedia variant="icon">
|
|
983
|
-
<UiIcon name="cog" :size="20" />
|
|
984
|
-
</UiItemMedia>
|
|
985
|
-
<UiItemContent>
|
|
986
|
-
<UiItemTitle>Settings</UiItemTitle>
|
|
987
|
-
</UiItemContent>
|
|
988
|
-
<UiItemActions>
|
|
989
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
990
|
-
</UiItemActions>
|
|
991
|
-
</UiItem>
|
|
992
|
-
</UiItemGroup>
|
|
993
|
-
</section>
|
|
994
|
-
|
|
995
|
-
<!-- AS LINK SECTION -->
|
|
996
|
-
<section>
|
|
997
|
-
<h3 class="heading-s mb-4">As Link (as-child)</h3>
|
|
998
|
-
<div class="flex flex-col gap-3">
|
|
999
|
-
<UiItem as-child>
|
|
1000
|
-
<a href="#" class="flex items-center gap-3">
|
|
1001
|
-
<UiItemMedia variant="icon">
|
|
1002
|
-
<UiIcon name="link" :size="20" />
|
|
1003
|
-
</UiItemMedia>
|
|
1004
|
-
<UiItemContent>
|
|
1005
|
-
<UiItemTitle>Internal Link</UiItemTitle>
|
|
1006
|
-
<UiItemDescription>Rendered as an anchor tag</UiItemDescription>
|
|
1007
|
-
</UiItemContent>
|
|
1008
|
-
<UiItemActions>
|
|
1009
|
-
<UiIcon name="chevron-right" :size="16" />
|
|
1010
|
-
</UiItemActions>
|
|
1011
|
-
</a>
|
|
1012
|
-
</UiItem>
|
|
1013
|
-
|
|
1014
|
-
<UiItem variant="outline" as-child>
|
|
1015
|
-
<a href="#" target="_blank" rel="noopener noreferrer" class="flex items-center gap-3">
|
|
1016
|
-
<UiItemMedia variant="icon">
|
|
1017
|
-
<UiIcon name="external-link" :size="20" />
|
|
1018
|
-
</UiItemMedia>
|
|
1019
|
-
<UiItemContent>
|
|
1020
|
-
<UiItemTitle>External Link</UiItemTitle>
|
|
1021
|
-
<UiItemDescription>Opens in new tab</UiItemDescription>
|
|
1022
|
-
</UiItemContent>
|
|
1023
|
-
<UiItemActions>
|
|
1024
|
-
<UiIcon name="arrow-up-right" :size="16" />
|
|
1025
|
-
</UiItemActions>
|
|
1026
|
-
</a>
|
|
1027
|
-
</UiItem>
|
|
1028
|
-
</div>
|
|
1029
|
-
</section>
|
|
1030
|
-
</div>
|
|
1031
|
-
`,
|
|
721
|
+
template: allVariantsTemplate,
|
|
1032
722
|
}),
|
|
723
|
+
parameters: {
|
|
724
|
+
docs: {
|
|
725
|
+
source: {
|
|
726
|
+
code: createSource(
|
|
727
|
+
['UiItem', 'UiItemGroup', 'UiItemSeparator'],
|
|
728
|
+
allVariantsTemplate,
|
|
729
|
+
),
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
},
|
|
1033
733
|
};
|