@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
|
@@ -2,8 +2,9 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
|
2
2
|
import UiFileItem from './UiFileItem.vue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* UiFileItem is a row primitive that represents a
|
|
6
|
-
*
|
|
5
|
+
* `UiFileItem` is a single-row primitive that represents a file with
|
|
6
|
+
* optional progress, error, and a remove control. Use it inside file-upload
|
|
7
|
+
* flows or attachment lists; for the full uploader, see `UiFileUpload` pattern.
|
|
7
8
|
*/
|
|
8
9
|
const meta: Meta<typeof UiFileItem> = {
|
|
9
10
|
title: 'Components/UiFileItem',
|
|
@@ -16,192 +17,391 @@ const meta: Meta<typeof UiFileItem> = {
|
|
|
16
17
|
progress: null,
|
|
17
18
|
error: '',
|
|
18
19
|
disabled: false,
|
|
20
|
+
removable: true,
|
|
19
21
|
removeLabel: 'Remove file',
|
|
22
|
+
progressLabel: undefined,
|
|
23
|
+
size: 'default',
|
|
24
|
+
mediaTone: undefined,
|
|
25
|
+
mediaIcon: undefined,
|
|
20
26
|
},
|
|
21
27
|
argTypes: {
|
|
22
|
-
filename: { control: 'text' },
|
|
23
|
-
typeLabel: { control: 'text' },
|
|
24
|
-
sizeLabel: { control: 'text' },
|
|
25
28
|
progress: { control: { type: 'number', min: 0, max: 100 } },
|
|
26
29
|
error: {
|
|
27
30
|
control: 'text',
|
|
28
31
|
description:
|
|
29
|
-
'Error text
|
|
32
|
+
'Error text. When non-empty the row enters the error state and replaces the type/size meta.',
|
|
33
|
+
},
|
|
34
|
+
removable: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
description:
|
|
37
|
+
'When false, the close icon is not rendered. Use for read-only previews.',
|
|
38
|
+
},
|
|
39
|
+
size: {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: ['default', 'small'],
|
|
42
|
+
description:
|
|
43
|
+
'`default` (12px padding, 14px title) for stand-alone uploader rows; `small` (8px padding, 12px title) for compact attachments next to a chat message.',
|
|
44
|
+
},
|
|
45
|
+
mediaTone: {
|
|
46
|
+
control: 'select',
|
|
47
|
+
options: [
|
|
48
|
+
undefined,
|
|
49
|
+
'default',
|
|
50
|
+
'accent-pink',
|
|
51
|
+
'accent-soft',
|
|
52
|
+
'accent-yellow',
|
|
53
|
+
],
|
|
54
|
+
description:
|
|
55
|
+
'Color tone of the round media badge. Leave undefined to auto-derive from the filename extension (pdf/docx/txt → pink, html/md → soft, csv/xls/tsv → yellow); pass an explicit value to force a tone.',
|
|
56
|
+
},
|
|
57
|
+
mediaIcon: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description:
|
|
60
|
+
'Lucide icon name rendered inside the media badge. Leave empty to auto-derive from the filename extension. Ignored in the error state.',
|
|
30
61
|
},
|
|
31
|
-
disabled: { control: 'boolean' },
|
|
32
|
-
removeLabel: { control: 'text' },
|
|
33
62
|
},
|
|
63
|
+
decorators: [
|
|
64
|
+
() => ({
|
|
65
|
+
template: '<div class="max-w-md p-4"><story /></div>',
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
34
68
|
};
|
|
35
69
|
|
|
36
70
|
export default meta;
|
|
37
71
|
type Story = StoryObj<typeof UiFileItem>;
|
|
38
72
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
73
|
+
const renderArgs = (args: Story['args']) => ({
|
|
74
|
+
components: { UiFileItem },
|
|
75
|
+
setup() {
|
|
76
|
+
function onRemove() {}
|
|
77
|
+
const normalized = {
|
|
78
|
+
...args,
|
|
79
|
+
mediaIcon: args?.mediaIcon || undefined,
|
|
80
|
+
mediaTone: args?.mediaTone || undefined,
|
|
81
|
+
};
|
|
82
|
+
return { args: normalized, onRemove };
|
|
83
|
+
},
|
|
84
|
+
template: '<UiFileItem v-bind="args" @remove="onRemove" />',
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const defaultTemplateSource = `<script setup lang="ts">
|
|
88
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
89
|
+
|
|
90
|
+
function onRemove() {}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<UiFileItem
|
|
95
|
+
filename="document.pdf"
|
|
96
|
+
type-label="PDF"
|
|
97
|
+
size-label="1.2 MB"
|
|
98
|
+
@remove="onRemove"
|
|
99
|
+
/>
|
|
100
|
+
</template>`;
|
|
101
|
+
|
|
102
|
+
/** Interactive playground; toggle controls to switch between states and sizes. */
|
|
42
103
|
export const Default: Story = {
|
|
43
|
-
render:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return { args, onRemove };
|
|
48
|
-
},
|
|
49
|
-
template:
|
|
50
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
51
|
-
}),
|
|
104
|
+
render: renderArgs,
|
|
105
|
+
parameters: {
|
|
106
|
+
docs: { source: { code: defaultTemplateSource } },
|
|
107
|
+
},
|
|
52
108
|
};
|
|
53
109
|
|
|
110
|
+
const defaultWithProgressTemplateSource = `<script setup lang="ts">
|
|
111
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
112
|
+
|
|
113
|
+
function onRemove() {}
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<template>
|
|
117
|
+
<UiFileItem
|
|
118
|
+
filename="Filename.pdf"
|
|
119
|
+
:progress="30"
|
|
120
|
+
@remove="onRemove"
|
|
121
|
+
/>
|
|
122
|
+
</template>`;
|
|
123
|
+
|
|
54
124
|
/** Upload in progress (0–100). */
|
|
55
|
-
export const
|
|
125
|
+
export const DefaultWithProgress: Story = {
|
|
56
126
|
args: {
|
|
57
|
-
filename: '
|
|
58
|
-
typeLabel:
|
|
59
|
-
sizeLabel:
|
|
127
|
+
filename: 'Filename.pdf',
|
|
128
|
+
typeLabel: undefined,
|
|
129
|
+
sizeLabel: undefined,
|
|
60
130
|
progress: 30,
|
|
61
131
|
error: '',
|
|
62
|
-
|
|
132
|
+
size: 'default',
|
|
133
|
+
},
|
|
134
|
+
render: renderArgs,
|
|
135
|
+
parameters: {
|
|
136
|
+
docs: { source: { code: defaultWithProgressTemplateSource } },
|
|
63
137
|
},
|
|
64
|
-
render: (args) => ({
|
|
65
|
-
components: { UiFileItem },
|
|
66
|
-
setup() {
|
|
67
|
-
function onRemove() {}
|
|
68
|
-
return { args, onRemove };
|
|
69
|
-
},
|
|
70
|
-
template:
|
|
71
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
72
|
-
}),
|
|
73
138
|
};
|
|
74
139
|
|
|
75
|
-
|
|
76
|
-
|
|
140
|
+
const defaultSuccessTemplateSource = `<script setup lang="ts">
|
|
141
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
142
|
+
|
|
143
|
+
function onRemove() {}
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<UiFileItem
|
|
148
|
+
filename="Filename.pdf"
|
|
149
|
+
type-label="PDF"
|
|
150
|
+
size-label="12 MB"
|
|
151
|
+
@remove="onRemove"
|
|
152
|
+
/>
|
|
153
|
+
</template>`;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Default size · success. The pink media + `PDF | 12 MB` meta line are
|
|
157
|
+
* driven entirely by the `.pdf` extension auto-detection.
|
|
158
|
+
*/
|
|
159
|
+
export const DefaultSuccess: Story = {
|
|
77
160
|
args: {
|
|
78
|
-
filename: '
|
|
79
|
-
typeLabel: '
|
|
80
|
-
sizeLabel: '
|
|
81
|
-
progress:
|
|
161
|
+
filename: 'Filename.pdf',
|
|
162
|
+
typeLabel: 'PDF',
|
|
163
|
+
sizeLabel: '12 MB',
|
|
164
|
+
progress: null,
|
|
82
165
|
error: '',
|
|
83
|
-
|
|
166
|
+
size: 'default',
|
|
167
|
+
},
|
|
168
|
+
render: renderArgs,
|
|
169
|
+
parameters: {
|
|
170
|
+
docs: { source: { code: defaultSuccessTemplateSource } },
|
|
84
171
|
},
|
|
85
|
-
render: (args) => ({
|
|
86
|
-
components: { UiFileItem },
|
|
87
|
-
setup() {
|
|
88
|
-
function onRemove() {}
|
|
89
|
-
return { args, onRemove };
|
|
90
|
-
},
|
|
91
|
-
template:
|
|
92
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
93
|
-
}),
|
|
94
172
|
};
|
|
95
173
|
|
|
96
|
-
|
|
97
|
-
|
|
174
|
+
const defaultErrorTemplateSource = `<script setup lang="ts">
|
|
175
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
176
|
+
|
|
177
|
+
function onRemove() {}
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<template>
|
|
181
|
+
<UiFileItem
|
|
182
|
+
filename="Filename.pdf"
|
|
183
|
+
error="Upload failed"
|
|
184
|
+
@remove="onRemove"
|
|
185
|
+
/>
|
|
186
|
+
</template>`;
|
|
187
|
+
|
|
188
|
+
/** Default size · error. CircleAlert media + destructive subtitle text. */
|
|
189
|
+
export const DefaultError: Story = {
|
|
98
190
|
args: {
|
|
99
|
-
filename: '
|
|
100
|
-
typeLabel:
|
|
101
|
-
sizeLabel:
|
|
191
|
+
filename: 'Filename.pdf',
|
|
192
|
+
typeLabel: undefined,
|
|
193
|
+
sizeLabel: undefined,
|
|
102
194
|
progress: null,
|
|
103
|
-
error: '
|
|
104
|
-
|
|
195
|
+
error: 'Upload failed',
|
|
196
|
+
size: 'default',
|
|
197
|
+
},
|
|
198
|
+
render: renderArgs,
|
|
199
|
+
parameters: {
|
|
200
|
+
docs: { source: { code: defaultErrorTemplateSource } },
|
|
105
201
|
},
|
|
106
|
-
render: (args) => ({
|
|
107
|
-
components: { UiFileItem },
|
|
108
|
-
setup() {
|
|
109
|
-
function onRemove() {}
|
|
110
|
-
return { args, onRemove };
|
|
111
|
-
},
|
|
112
|
-
template:
|
|
113
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
114
|
-
}),
|
|
115
202
|
};
|
|
116
203
|
|
|
117
|
-
|
|
118
|
-
|
|
204
|
+
const smallWithProgressTemplateSource = `<script setup lang="ts">
|
|
205
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
206
|
+
|
|
207
|
+
function onRemove() {}
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<template>
|
|
211
|
+
<UiFileItem
|
|
212
|
+
size="small"
|
|
213
|
+
filename="Filename.pdf"
|
|
214
|
+
:progress="30"
|
|
215
|
+
@remove="onRemove"
|
|
216
|
+
/>
|
|
217
|
+
</template>`;
|
|
218
|
+
|
|
219
|
+
/** Small size · progress at 30%. */
|
|
220
|
+
export const SmallWithProgress: Story = {
|
|
119
221
|
args: {
|
|
120
|
-
filename: '
|
|
222
|
+
filename: 'Filename.pdf',
|
|
223
|
+
typeLabel: undefined,
|
|
224
|
+
sizeLabel: undefined,
|
|
225
|
+
progress: 30,
|
|
226
|
+
error: '',
|
|
227
|
+
size: 'small',
|
|
228
|
+
},
|
|
229
|
+
render: renderArgs,
|
|
230
|
+
parameters: {
|
|
231
|
+
docs: { source: { code: smallWithProgressTemplateSource } },
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const smallSuccessTemplateSource = `<script setup lang="ts">
|
|
236
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
237
|
+
|
|
238
|
+
function onRemove() {}
|
|
239
|
+
</script>
|
|
240
|
+
|
|
241
|
+
<template>
|
|
242
|
+
<UiFileItem
|
|
243
|
+
size="small"
|
|
244
|
+
filename="Filename.pdf"
|
|
245
|
+
type-label="PDF"
|
|
246
|
+
size-label="12 MB"
|
|
247
|
+
@remove="onRemove"
|
|
248
|
+
/>
|
|
249
|
+
</template>`;
|
|
250
|
+
|
|
251
|
+
/** Small size · success. Pink media is derived from the `.pdf` filename. */
|
|
252
|
+
export const SmallSuccess: Story = {
|
|
253
|
+
args: {
|
|
254
|
+
filename: 'Filename.pdf',
|
|
121
255
|
typeLabel: 'PDF',
|
|
122
|
-
sizeLabel: '
|
|
256
|
+
sizeLabel: '12 MB',
|
|
123
257
|
progress: null,
|
|
124
258
|
error: '',
|
|
125
|
-
|
|
259
|
+
size: 'small',
|
|
260
|
+
},
|
|
261
|
+
render: renderArgs,
|
|
262
|
+
parameters: {
|
|
263
|
+
docs: { source: { code: smallSuccessTemplateSource } },
|
|
126
264
|
},
|
|
127
|
-
render: (args) => ({
|
|
128
|
-
components: { UiFileItem },
|
|
129
|
-
setup() {
|
|
130
|
-
function onRemove() {}
|
|
131
|
-
return { args, onRemove };
|
|
132
|
-
},
|
|
133
|
-
template:
|
|
134
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
135
|
-
}),
|
|
136
265
|
};
|
|
137
266
|
|
|
138
|
-
|
|
139
|
-
|
|
267
|
+
const smallErrorTemplateSource = `<script setup lang="ts">
|
|
268
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
269
|
+
|
|
270
|
+
function onRemove() {}
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<template>
|
|
274
|
+
<UiFileItem
|
|
275
|
+
size="small"
|
|
276
|
+
filename="Filename.pdf"
|
|
277
|
+
error="Upload failed"
|
|
278
|
+
@remove="onRemove"
|
|
279
|
+
/>
|
|
280
|
+
</template>`;
|
|
281
|
+
|
|
282
|
+
/** Small size · error. CircleAlert media + destructive subtitle. */
|
|
283
|
+
export const SmallError: Story = {
|
|
140
284
|
args: {
|
|
141
|
-
filename: '
|
|
142
|
-
typeLabel:
|
|
143
|
-
sizeLabel:
|
|
285
|
+
filename: 'Filename.pdf',
|
|
286
|
+
typeLabel: undefined,
|
|
287
|
+
sizeLabel: undefined,
|
|
144
288
|
progress: null,
|
|
145
|
-
error: 'Upload failed
|
|
146
|
-
|
|
289
|
+
error: 'Upload failed',
|
|
290
|
+
size: 'small',
|
|
291
|
+
},
|
|
292
|
+
render: renderArgs,
|
|
293
|
+
parameters: {
|
|
294
|
+
docs: { source: { code: smallErrorTemplateSource } },
|
|
147
295
|
},
|
|
148
|
-
render: (args) => ({
|
|
149
|
-
components: { UiFileItem },
|
|
150
|
-
setup() {
|
|
151
|
-
function onRemove() {}
|
|
152
|
-
return { args, onRemove };
|
|
153
|
-
},
|
|
154
|
-
template:
|
|
155
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
156
|
-
}),
|
|
157
296
|
};
|
|
158
297
|
|
|
159
|
-
|
|
160
|
-
|
|
298
|
+
const nonRemovableTemplateSource = `<script setup lang="ts">
|
|
299
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
300
|
+
</script>
|
|
301
|
+
|
|
302
|
+
<template>
|
|
303
|
+
<UiFileItem
|
|
304
|
+
filename="sent.pdf"
|
|
305
|
+
type-label="PDF"
|
|
306
|
+
size-label="2 MB"
|
|
307
|
+
:removable="false"
|
|
308
|
+
/>
|
|
309
|
+
</template>`;
|
|
310
|
+
|
|
311
|
+
/** Read-only preview: no close icon. */
|
|
312
|
+
export const NonRemovable: Story = {
|
|
161
313
|
args: {
|
|
162
|
-
filename: '
|
|
163
|
-
typeLabel: '
|
|
164
|
-
sizeLabel: '
|
|
165
|
-
progress:
|
|
166
|
-
error: '
|
|
314
|
+
filename: 'sent.pdf',
|
|
315
|
+
typeLabel: 'PDF',
|
|
316
|
+
sizeLabel: '2 MB',
|
|
317
|
+
progress: null,
|
|
318
|
+
error: '',
|
|
167
319
|
disabled: false,
|
|
320
|
+
removable: false,
|
|
321
|
+
},
|
|
322
|
+
render: renderArgs,
|
|
323
|
+
parameters: {
|
|
324
|
+
docs: { source: { code: nonRemovableTemplateSource } },
|
|
168
325
|
},
|
|
169
|
-
render: (args) => ({
|
|
170
|
-
components: { UiFileItem },
|
|
171
|
-
setup() {
|
|
172
|
-
function onRemove() {}
|
|
173
|
-
return { args, onRemove };
|
|
174
|
-
},
|
|
175
|
-
template:
|
|
176
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
177
|
-
}),
|
|
178
326
|
};
|
|
179
327
|
|
|
180
|
-
|
|
181
|
-
|
|
328
|
+
const disabledTemplateSource = `<script setup lang="ts">
|
|
329
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
330
|
+
|
|
331
|
+
function onRemove() {}
|
|
332
|
+
</script>
|
|
333
|
+
|
|
334
|
+
<template>
|
|
335
|
+
<UiFileItem
|
|
336
|
+
filename="locked.pdf"
|
|
337
|
+
type-label="PDF"
|
|
338
|
+
size-label="2 MB"
|
|
339
|
+
disabled
|
|
340
|
+
@remove="onRemove"
|
|
341
|
+
/>
|
|
342
|
+
</template>`;
|
|
343
|
+
|
|
344
|
+
/** Disabled row: inert + 50% opacity, remove control disabled. */
|
|
345
|
+
export const Disabled: Story = {
|
|
182
346
|
args: {
|
|
183
|
-
filename: '
|
|
184
|
-
typeLabel:
|
|
185
|
-
sizeLabel:
|
|
347
|
+
filename: 'locked.pdf',
|
|
348
|
+
typeLabel: 'PDF',
|
|
349
|
+
sizeLabel: '2 MB',
|
|
186
350
|
progress: null,
|
|
187
351
|
error: '',
|
|
188
|
-
disabled:
|
|
352
|
+
disabled: true,
|
|
353
|
+
},
|
|
354
|
+
render: renderArgs,
|
|
355
|
+
parameters: {
|
|
356
|
+
docs: { source: { code: disabledTemplateSource } },
|
|
189
357
|
},
|
|
190
|
-
render: (args) => ({
|
|
191
|
-
components: { UiFileItem },
|
|
192
|
-
setup() {
|
|
193
|
-
function onRemove() {}
|
|
194
|
-
return { args, onRemove };
|
|
195
|
-
},
|
|
196
|
-
template:
|
|
197
|
-
'<div class="max-w-md"><UiFileItem v-bind="args" @remove="onRemove" /></div>',
|
|
198
|
-
}),
|
|
199
358
|
};
|
|
200
359
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
360
|
+
const allVariantsTemplateSource = `<script setup lang="ts">
|
|
361
|
+
import { UiFileItem } from '@aleph-alpha/ui-library'
|
|
362
|
+
|
|
363
|
+
function onRemove() {}
|
|
364
|
+
</script>
|
|
365
|
+
|
|
366
|
+
<template>
|
|
367
|
+
<div class="flex flex-wrap gap-8">
|
|
368
|
+
<div class="flex max-w-md flex-1 flex-col gap-3">
|
|
369
|
+
<p class="label-12-medium text-content-on-surface-muted">Default size</p>
|
|
370
|
+
<UiFileItem filename="Filename.pdf" :progress="30" @remove="onRemove" />
|
|
371
|
+
<UiFileItem
|
|
372
|
+
filename="Filename.pdf"
|
|
373
|
+
type-label="PDF"
|
|
374
|
+
size-label="12 MB"
|
|
375
|
+
@remove="onRemove"
|
|
376
|
+
/>
|
|
377
|
+
<UiFileItem filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
|
|
378
|
+
</div>
|
|
379
|
+
<div class="flex max-w-64 flex-1 flex-col gap-3">
|
|
380
|
+
<p class="label-12-medium text-content-on-surface-muted">Small size</p>
|
|
381
|
+
<UiFileItem size="small" filename="Filename.pdf" :progress="30" @remove="onRemove" />
|
|
382
|
+
<UiFileItem
|
|
383
|
+
size="small"
|
|
384
|
+
filename="Filename.pdf"
|
|
385
|
+
type-label="PDF"
|
|
386
|
+
size-label="12 MB"
|
|
387
|
+
@remove="onRemove"
|
|
388
|
+
/>
|
|
389
|
+
<UiFileItem size="small" filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
</template>`;
|
|
393
|
+
|
|
394
|
+
/** All variants in one column for quick visual comparison. */
|
|
395
|
+
export const AllVariants: Story = {
|
|
396
|
+
parameters: {
|
|
397
|
+
controls: { disable: true },
|
|
398
|
+
docs: { source: { code: allVariantsTemplateSource } },
|
|
399
|
+
},
|
|
400
|
+
decorators: [
|
|
401
|
+
() => ({
|
|
402
|
+
template: '<div class="p-6"><story /></div>',
|
|
403
|
+
}),
|
|
404
|
+
],
|
|
205
405
|
render: () => ({
|
|
206
406
|
components: { UiFileItem },
|
|
207
407
|
setup() {
|
|
@@ -209,70 +409,29 @@ export const AllStates: Story = {
|
|
|
209
409
|
return { onRemove };
|
|
210
410
|
},
|
|
211
411
|
template: `
|
|
212
|
-
<div class="flex
|
|
213
|
-
<div class="flex flex-col gap-
|
|
214
|
-
<p class="label-12-medium text-content-on-surface-muted">Default</p>
|
|
412
|
+
<div class="flex flex-wrap gap-8">
|
|
413
|
+
<div class="flex max-w-md flex-1 flex-col gap-3">
|
|
414
|
+
<p class="label-12-medium text-content-on-surface-muted">Default size</p>
|
|
415
|
+
<UiFileItem filename="Filename.pdf" :progress="30" @remove="onRemove" />
|
|
215
416
|
<UiFileItem
|
|
216
|
-
filename="
|
|
417
|
+
filename="Filename.pdf"
|
|
217
418
|
type-label="PDF"
|
|
218
|
-
size-label="1.2 MB"
|
|
219
|
-
@remove="onRemove"
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
222
|
-
<div class="flex flex-col gap-1">
|
|
223
|
-
<p class="label-12-medium text-content-on-surface-muted">Uploading</p>
|
|
224
|
-
<UiFileItem
|
|
225
|
-
filename="uploading.bin"
|
|
226
|
-
type-label="BIN"
|
|
227
419
|
size-label="12 MB"
|
|
228
|
-
:progress="30"
|
|
229
420
|
@remove="onRemove"
|
|
230
421
|
/>
|
|
422
|
+
<UiFileItem filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
|
|
231
423
|
</div>
|
|
232
|
-
<div class="flex flex-col gap-
|
|
233
|
-
<p class="label-12-medium text-content-on-surface-muted">
|
|
424
|
+
<div class="flex max-w-64 flex-1 flex-col gap-3">
|
|
425
|
+
<p class="label-12-medium text-content-on-surface-muted">Small size</p>
|
|
426
|
+
<UiFileItem size="small" filename="Filename.pdf" :progress="30" @remove="onRemove" />
|
|
234
427
|
<UiFileItem
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
size-label="4 MB"
|
|
238
|
-
:progress="100"
|
|
239
|
-
@remove="onRemove"
|
|
240
|
-
/>
|
|
241
|
-
</div>
|
|
242
|
-
<div class="flex flex-col gap-1">
|
|
243
|
-
<p class="label-12-medium text-content-on-surface-muted">Error</p>
|
|
244
|
-
<UiFileItem
|
|
245
|
-
filename="bad.exe"
|
|
246
|
-
type-label="EXE"
|
|
247
|
-
size-label="1 MB"
|
|
248
|
-
error="Unsupported file type"
|
|
249
|
-
@remove="onRemove"
|
|
250
|
-
/>
|
|
251
|
-
</div>
|
|
252
|
-
<div class="flex flex-col gap-1">
|
|
253
|
-
<p class="label-12-medium text-content-on-surface-muted">Disabled</p>
|
|
254
|
-
<UiFileItem
|
|
255
|
-
filename="locked.pdf"
|
|
428
|
+
size="small"
|
|
429
|
+
filename="Filename.pdf"
|
|
256
430
|
type-label="PDF"
|
|
257
|
-
size-label="
|
|
258
|
-
disabled
|
|
259
|
-
@remove="onRemove"
|
|
260
|
-
/>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="flex flex-col gap-1">
|
|
263
|
-
<p class="label-12-medium text-content-on-surface-muted">Disabled + error</p>
|
|
264
|
-
<UiFileItem
|
|
265
|
-
filename="stuck.tmp"
|
|
266
|
-
type-label="TMP"
|
|
267
|
-
size-label="512 KB"
|
|
268
|
-
error="Upload failed — try again later"
|
|
269
|
-
disabled
|
|
431
|
+
size-label="12 MB"
|
|
270
432
|
@remove="onRemove"
|
|
271
433
|
/>
|
|
272
|
-
|
|
273
|
-
<div class="flex flex-col gap-1">
|
|
274
|
-
<p class="label-12-medium text-content-on-surface-muted">Filename only</p>
|
|
275
|
-
<UiFileItem filename="readme.md" @remove="onRemove" />
|
|
434
|
+
<UiFileItem size="small" filename="Filename.pdf" error="Upload failed" @remove="onRemove" />
|
|
276
435
|
</div>
|
|
277
436
|
</div>
|
|
278
437
|
`,
|