@aleph-alpha/ui-library 2.4.4 → 2.5.2
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 +33 -2
- package/config.js +145 -47
- 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/calendar/Calendar.vue.d.ts +247 -3
- 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/core/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/system/components/core/range-calendar/RangeCalendar.vue.d.ts +139 -2
- package/dist/system/components/index.d.ts +1 -0
- package/dist/system/lib/activeIndicator.d.ts +1 -0
- package/dist/system/lib.js +6700 -6448
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -15
- 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 +7 -2
- package/src/components/UiField/UiField.stories.ts +15 -9
- 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 +193 -0
- package/src/components/UiFileType/UiFileType.vue +114 -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/UiFileUploadBox/UiFileUploadBox.vue +58 -56
- 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/UiListbox/UiListbox.stories.ts +1 -1
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +4 -4
- package/src/components/UiSelect/UiSelectTrigger.vue +8 -2
- package/src/components/UiSelect/__tests__/UiSelectGroup.test.ts +2 -2
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +1 -0
- package/src/components/UiTable/UiTable.stories.ts +6 -2
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +4 -2
- package/src/components/UiTabs/UiTabs.stories.ts +2 -2
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +12 -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/calendar/Calendar.vue +17 -1
- package/src/components/core/checkbox/Checkbox.vue +1 -0
- 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/listbox/ListboxContent.vue +1 -0
- package/src/components/core/native-select/NativeSelect.vue +6 -0
- package/src/components/core/range-calendar/RangeCalendar.vue +19 -0
- package/src/components/core/skeleton/Skeleton.vue +3 -1
- package/src/components/core/slider/Slider.vue +2 -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/directives/vHover.stories.ts +16 -12
- package/src/lib/activeIndicator.ts +1 -0
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +2 -2
- 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/Background.stories.ts +16 -0
- package/src/theme/BorderRadius.stories.ts +12 -12
- package/src/theme/Flex.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +3 -3
- package/tokens.json +4273 -1152
- /package/dist/system/components/core/{item/ItemActions.vue.d.ts → avatar/AvatarGroup.vue.d.ts} +0 -0
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared class string for the left-edge active indicator used by every
|
|
3
|
-
* sidebar row (menu button, sub-menu item, popover trigger, popover menu item).
|
|
4
|
-
*
|
|
5
|
-
* The `::before` pseudo-element is always mounted so CSS has something to
|
|
6
|
-
* transition. At rest it's painted from `scale-x-0` + `opacity-0` with its
|
|
7
|
-
* transform anchored on the left edge (`origin-left`); when the row's
|
|
8
|
-
* `data-active="true"` flips on, the bar paints in from left to right while
|
|
9
|
-
* fading in, using a 200ms linear curve that matches the sidebar collapse
|
|
10
|
-
* and group-content height transitions so all sidebar motion stays in sync.
|
|
11
|
-
*
|
|
12
|
-
* Kept as a string constant (rather than generated via `cn`) so UnoCSS's
|
|
13
|
-
* static scanner picks up every utility class for atomic CSS generation.
|
|
14
|
-
*/
|
|
15
|
-
export declare const SIDEBAR_ACTIVE_INDICATOR_CLASS = "before:absolute before:z-10 before:top-1/2 before:left-0 before:h-1/2 before:w-0.5 before:-translate-y-1/2 before:origin-left before:scale-x-0 before:rounded-full before:bg-background-accent-default before:opacity-0 before:transition-[transform,opacity] before:duration-200 before:ease-linear before:content-[\"\"] data-[active=true]:before:scale-x-100 data-[active=true]:before:opacity-100";
|
|
1
|
+
export { ACTIVE_INDICATOR_CLASS as SIDEBAR_ACTIVE_INDICATOR_CLASS } from '../../lib/activeIndicator';
|
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
UiAvatar,
|
|
4
|
+
UiAvatarFallback,
|
|
5
|
+
UiAvatarGroup,
|
|
6
|
+
UiAvatarImage,
|
|
7
|
+
} from './index';
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* UiAvatar is a small image-based representation of a user or entity, with a graceful text or icon fallback when the image fails to load.
|
|
@@ -9,8 +14,17 @@ const meta: Meta<typeof UiAvatar> = {
|
|
|
9
14
|
title: 'Components/UiAvatar',
|
|
10
15
|
component: UiAvatar,
|
|
11
16
|
tags: ['autodocs'],
|
|
12
|
-
argTypes: {
|
|
13
|
-
|
|
17
|
+
argTypes: {
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: [5, 6, 8, 10, 12],
|
|
21
|
+
description:
|
|
22
|
+
'Avatar width and height token. Maps to `size-5`, `size-6`, `size-8`, `size-10`, or `size-12`.',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
size: 8,
|
|
27
|
+
},
|
|
14
28
|
};
|
|
15
29
|
|
|
16
30
|
export default meta;
|
|
@@ -32,14 +46,17 @@ import { UiAvatar, UiAvatarFallback, UiAvatarImage } from '@aleph-alpha/ui-libra
|
|
|
32
46
|
* Default avatar with image and fallback.
|
|
33
47
|
*/
|
|
34
48
|
export const Default: Story = {
|
|
35
|
-
render: () => ({
|
|
49
|
+
render: (args) => ({
|
|
36
50
|
components: {
|
|
37
51
|
UiAvatar,
|
|
38
52
|
UiAvatarFallback,
|
|
39
53
|
UiAvatarImage,
|
|
40
54
|
},
|
|
55
|
+
setup() {
|
|
56
|
+
return { args };
|
|
57
|
+
},
|
|
41
58
|
template: `
|
|
42
|
-
<UiAvatar>
|
|
59
|
+
<UiAvatar :size="args.size">
|
|
43
60
|
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
44
61
|
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
45
62
|
</UiAvatar>
|
|
@@ -54,6 +71,79 @@ export const Default: Story = {
|
|
|
54
71
|
},
|
|
55
72
|
};
|
|
56
73
|
|
|
74
|
+
const sizesTemplateSource = `<script setup lang="ts">
|
|
75
|
+
import { UiAvatar, UiAvatarFallback, UiAvatarImage } from '@aleph-alpha/ui-library'
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<div class="flex items-center gap-4">
|
|
80
|
+
<UiAvatar :size="5">
|
|
81
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
82
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
83
|
+
</UiAvatar>
|
|
84
|
+
<UiAvatar :size="6">
|
|
85
|
+
<UiAvatarImage src="https://github.com/leerob.png" alt="@leerob" />
|
|
86
|
+
<UiAvatarFallback>LR</UiAvatarFallback>
|
|
87
|
+
</UiAvatar>
|
|
88
|
+
<UiAvatar :size="8">
|
|
89
|
+
<UiAvatarImage src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
90
|
+
<UiAvatarFallback>ER</UiAvatarFallback>
|
|
91
|
+
</UiAvatar>
|
|
92
|
+
<UiAvatar :size="10">
|
|
93
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
94
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
95
|
+
</UiAvatar>
|
|
96
|
+
<UiAvatar :size="12">
|
|
97
|
+
<UiAvatarImage src="https://github.com/leerob.png" alt="@leerob" />
|
|
98
|
+
<UiAvatarFallback>LR</UiAvatarFallback>
|
|
99
|
+
</UiAvatar>
|
|
100
|
+
</div>
|
|
101
|
+
</template>`;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Available avatar sizes.
|
|
105
|
+
*/
|
|
106
|
+
export const Sizes: Story = {
|
|
107
|
+
render: () => ({
|
|
108
|
+
components: {
|
|
109
|
+
UiAvatar,
|
|
110
|
+
UiAvatarFallback,
|
|
111
|
+
UiAvatarImage,
|
|
112
|
+
},
|
|
113
|
+
template: `
|
|
114
|
+
<div class="flex items-center gap-4">
|
|
115
|
+
<UiAvatar :size="5">
|
|
116
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
117
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
118
|
+
</UiAvatar>
|
|
119
|
+
<UiAvatar :size="6">
|
|
120
|
+
<UiAvatarImage src="https://github.com/leerob.png" alt="@leerob" />
|
|
121
|
+
<UiAvatarFallback>LR</UiAvatarFallback>
|
|
122
|
+
</UiAvatar>
|
|
123
|
+
<UiAvatar :size="8">
|
|
124
|
+
<UiAvatarImage src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
125
|
+
<UiAvatarFallback>ER</UiAvatarFallback>
|
|
126
|
+
</UiAvatar>
|
|
127
|
+
<UiAvatar :size="10">
|
|
128
|
+
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
129
|
+
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
130
|
+
</UiAvatar>
|
|
131
|
+
<UiAvatar :size="12">
|
|
132
|
+
<UiAvatarImage src="https://github.com/leerob.png" alt="@leerob" />
|
|
133
|
+
<UiAvatarFallback>LR</UiAvatarFallback>
|
|
134
|
+
</UiAvatar>
|
|
135
|
+
</div>
|
|
136
|
+
`,
|
|
137
|
+
}),
|
|
138
|
+
parameters: {
|
|
139
|
+
docs: {
|
|
140
|
+
source: {
|
|
141
|
+
code: sizesTemplateSource,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
57
147
|
const fallbackTemplateSource = `<script setup lang="ts">
|
|
58
148
|
import { UiAvatar, UiAvatarFallback, UiAvatarImage } from '@aleph-alpha/ui-library'
|
|
59
149
|
</script>
|
|
@@ -141,11 +231,11 @@ export const Multiple: Story = {
|
|
|
141
231
|
};
|
|
142
232
|
|
|
143
233
|
const stackedTemplateSource = `<script setup lang="ts">
|
|
144
|
-
import { UiAvatar, UiAvatarFallback, UiAvatarImage } from '@aleph-alpha/ui-library'
|
|
234
|
+
import { UiAvatar, UiAvatarFallback, UiAvatarGroup, UiAvatarImage } from '@aleph-alpha/ui-library'
|
|
145
235
|
</script>
|
|
146
236
|
|
|
147
237
|
<template>
|
|
148
|
-
<
|
|
238
|
+
<UiAvatarGroup>
|
|
149
239
|
<UiAvatar>
|
|
150
240
|
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
151
241
|
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
@@ -158,21 +248,22 @@ import { UiAvatar, UiAvatarFallback, UiAvatarImage } from '@aleph-alpha/ui-libra
|
|
|
158
248
|
<UiAvatarImage src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
159
249
|
<UiAvatarFallback>ER</UiAvatarFallback>
|
|
160
250
|
</UiAvatar>
|
|
161
|
-
</
|
|
251
|
+
</UiAvatarGroup>
|
|
162
252
|
</template>`;
|
|
163
253
|
|
|
164
254
|
/**
|
|
165
|
-
*
|
|
255
|
+
* Avatar group with stacked avatars.
|
|
166
256
|
*/
|
|
167
|
-
export const
|
|
257
|
+
export const AvatarGroup: Story = {
|
|
168
258
|
render: () => ({
|
|
169
259
|
components: {
|
|
170
260
|
UiAvatar,
|
|
171
261
|
UiAvatarFallback,
|
|
262
|
+
UiAvatarGroup,
|
|
172
263
|
UiAvatarImage,
|
|
173
264
|
},
|
|
174
265
|
template: `
|
|
175
|
-
<
|
|
266
|
+
<UiAvatarGroup>
|
|
176
267
|
<UiAvatar>
|
|
177
268
|
<UiAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
178
269
|
<UiAvatarFallback>CN</UiAvatarFallback>
|
|
@@ -185,7 +276,7 @@ export const Stacked: Story = {
|
|
|
185
276
|
<UiAvatarImage src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
186
277
|
<UiAvatarFallback>ER</UiAvatarFallback>
|
|
187
278
|
</UiAvatar>
|
|
188
|
-
</
|
|
279
|
+
</UiAvatarGroup>
|
|
189
280
|
`,
|
|
190
281
|
}),
|
|
191
282
|
parameters: {
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Avatar as ShadcnAvatar } from '@/components/core/avatar';
|
|
3
|
+
import type { UiAvatarProps } from './types';
|
|
3
4
|
|
|
4
5
|
defineOptions({
|
|
5
6
|
name: 'UiAvatar',
|
|
6
7
|
});
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<UiAvatarProps>(), {
|
|
10
|
+
size: 8,
|
|
11
|
+
});
|
|
7
12
|
</script>
|
|
8
13
|
|
|
9
14
|
<template>
|
|
10
|
-
<ShadcnAvatar>
|
|
15
|
+
<ShadcnAvatar :size="props.size" :class="props.class">
|
|
11
16
|
<slot />
|
|
12
17
|
</ShadcnAvatar>
|
|
13
18
|
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { AvatarGroup as ShadcnAvatarGroup } from '@/components/core/avatar';
|
|
3
|
+
import type { UiAvatarGroupProps } from './types';
|
|
4
|
+
|
|
5
|
+
defineOptions({
|
|
6
|
+
name: 'UiAvatarGroup',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const props = defineProps<UiAvatarGroupProps>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<ShadcnAvatarGroup v-bind="props">
|
|
14
|
+
<slot />
|
|
15
|
+
</ShadcnAvatarGroup>
|
|
16
|
+
</template>
|
|
@@ -4,6 +4,7 @@ import { h } from 'vue';
|
|
|
4
4
|
import UiAvatar from '../UiAvatar.vue';
|
|
5
5
|
import UiAvatarImage from '../UiAvatarImage.vue';
|
|
6
6
|
import UiAvatarFallback from '../UiAvatarFallback.vue';
|
|
7
|
+
import UiAvatarGroup from '../UiAvatarGroup.vue';
|
|
7
8
|
|
|
8
9
|
describe('UiAvatar', () => {
|
|
9
10
|
test('renders image with src and alt attributes', () => {
|
|
@@ -35,4 +36,89 @@ describe('UiAvatar', () => {
|
|
|
35
36
|
).toBeInTheDocument();
|
|
36
37
|
expect(getByText('AB')).toBeInTheDocument();
|
|
37
38
|
});
|
|
39
|
+
|
|
40
|
+
test('renders default size', () => {
|
|
41
|
+
const { container } = render(UiAvatar, {
|
|
42
|
+
slots: {
|
|
43
|
+
default: () => h(UiAvatarFallback, null, () => 'AB'),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect(container.querySelector('[data-slot="avatar"]')).toHaveClass(
|
|
48
|
+
'size-8',
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test.each([
|
|
53
|
+
[5, 'size-5'],
|
|
54
|
+
[6, 'size-6'],
|
|
55
|
+
[8, 'size-8'],
|
|
56
|
+
[10, 'size-10'],
|
|
57
|
+
[12, 'size-12'],
|
|
58
|
+
['12', 'size-12'],
|
|
59
|
+
])('renders size %s as %s', (size, sizeClass) => {
|
|
60
|
+
const { container } = render(UiAvatar, {
|
|
61
|
+
props: {
|
|
62
|
+
size,
|
|
63
|
+
},
|
|
64
|
+
slots: {
|
|
65
|
+
default: () => h(UiAvatarFallback, null, () => 'AB'),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
expect(container.querySelector('[data-slot="avatar"]')).toHaveClass(
|
|
70
|
+
sizeClass,
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('forwards custom class to avatar root', () => {
|
|
75
|
+
const { container } = render(UiAvatar, {
|
|
76
|
+
props: {
|
|
77
|
+
class: 'ring-1',
|
|
78
|
+
},
|
|
79
|
+
slots: {
|
|
80
|
+
default: () => h(UiAvatarFallback, null, () => 'AB'),
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(container.querySelector('[data-slot="avatar"]')).toHaveClass(
|
|
85
|
+
'ring-1',
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('renders grouped avatars', () => {
|
|
90
|
+
const { container } = render(UiAvatarGroup, {
|
|
91
|
+
slots: {
|
|
92
|
+
default: () => [
|
|
93
|
+
h(UiAvatar, null, () => h(UiAvatarFallback, null, () => 'AB')),
|
|
94
|
+
h(UiAvatar, null, () => h(UiAvatarFallback, null, () => 'CD')),
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const group = container.querySelector('[data-slot="avatar-group"]');
|
|
100
|
+
expect(group).toBeInTheDocument();
|
|
101
|
+
expect(group?.querySelectorAll('[data-slot="avatar"]')).toHaveLength(2);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('applies avatar group stacking styles and custom classes', () => {
|
|
105
|
+
const { container } = render(UiAvatarGroup, {
|
|
106
|
+
props: {
|
|
107
|
+
class: 'custom-group',
|
|
108
|
+
},
|
|
109
|
+
slots: {
|
|
110
|
+
default: () =>
|
|
111
|
+
h(UiAvatar, null, () => h(UiAvatarFallback, null, () => 'AB')),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const group = container.querySelector('[data-slot="avatar-group"]');
|
|
116
|
+
expect(group).toHaveClass('flex');
|
|
117
|
+
expect(group).toHaveClass('items-center');
|
|
118
|
+
expect(group).toHaveClass('custom-group');
|
|
119
|
+
expect(group?.className).toContain('[&>*+*]:-ml-2');
|
|
120
|
+
expect(group?.className).toContain(
|
|
121
|
+
'*:data-[slot=avatar]:ring-background-surface-primary',
|
|
122
|
+
);
|
|
123
|
+
});
|
|
38
124
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as UiAvatar } from './UiAvatar.vue';
|
|
2
2
|
export { default as UiAvatarFallback } from './UiAvatarFallback.vue';
|
|
3
|
+
export { default as UiAvatarGroup } from './UiAvatarGroup.vue';
|
|
3
4
|
export { default as UiAvatarImage } from './UiAvatarImage.vue';
|
|
4
5
|
export type * from './types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { ImgHTMLAttributes } from 'vue';
|
|
1
|
+
import type { HTMLAttributes, ImgHTMLAttributes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type UiAvatarSize = 5 | 6 | 8 | 10 | 12 | '5' | '6' | '8' | '10' | '12';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* A circular image for representing users or entities. Use for
|
|
@@ -8,6 +10,13 @@ import { ImgHTMLAttributes } from 'vue';
|
|
|
8
10
|
* @keywords avatar, image, profile, picture, user, photo, initials
|
|
9
11
|
* @related UiBadge
|
|
10
12
|
*/
|
|
13
|
+
export type UiAvatarProps = {
|
|
14
|
+
/** Avatar width and height token. Maps to `size-{value}` utilities. */
|
|
15
|
+
size?: UiAvatarSize;
|
|
16
|
+
/** Additional classes for the avatar root. */
|
|
17
|
+
class?: HTMLAttributes['class'];
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
export type UiAvatarImageProps = {
|
|
12
21
|
/** The source URL of the avatar image. */
|
|
13
22
|
src: string;
|
|
@@ -18,3 +27,8 @@ export type UiAvatarImageProps = {
|
|
|
18
27
|
/** The CORS setting for the image request. */
|
|
19
28
|
crossOrigin?: ImgHTMLAttributes['crossorigin'];
|
|
20
29
|
};
|
|
30
|
+
|
|
31
|
+
export type UiAvatarGroupProps = {
|
|
32
|
+
/** Additional classes for the avatar group container. */
|
|
33
|
+
class?: HTMLAttributes['class'];
|
|
34
|
+
};
|
|
@@ -556,6 +556,66 @@ export const AllVariants: Story = {
|
|
|
556
556
|
},
|
|
557
557
|
};
|
|
558
558
|
|
|
559
|
+
const disabledHoverBleedTemplateSource = `<script setup lang="ts">
|
|
560
|
+
import { UiButton } from '@aleph-alpha/ui-library'
|
|
561
|
+
</script>
|
|
562
|
+
|
|
563
|
+
<template>
|
|
564
|
+
<div class="flex flex-col gap-6">
|
|
565
|
+
<p class="body-14-regular text-muted-foreground max-w-xl">
|
|
566
|
+
Hover or move quickly over the disabled buttons. Any hover layer should
|
|
567
|
+
stay within the visual button bounds.
|
|
568
|
+
</p>
|
|
569
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
570
|
+
<UiButton disabled>Disabled default</UiButton>
|
|
571
|
+
</div>
|
|
572
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
573
|
+
<UiButton variant="secondary" disabled>Disabled secondary</UiButton>
|
|
574
|
+
</div>
|
|
575
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
576
|
+
<UiButton variant="destructive" disabled>Disabled destructive</UiButton>
|
|
577
|
+
</div>
|
|
578
|
+
</div>
|
|
579
|
+
</template>`;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Reproduction story for disabled-button hover layers bleeding outside the
|
|
583
|
+
* visual button bounds.
|
|
584
|
+
*/
|
|
585
|
+
export const DisabledHoverBleed: Story = {
|
|
586
|
+
render: () => ({
|
|
587
|
+
components: { UiButton },
|
|
588
|
+
template: `
|
|
589
|
+
<div class="flex flex-col gap-6">
|
|
590
|
+
<p class="body-14-regular text-muted-foreground max-w-xl">
|
|
591
|
+
Hover or move quickly over the disabled buttons. Any hover layer should
|
|
592
|
+
stay within the visual button bounds.
|
|
593
|
+
</p>
|
|
594
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
595
|
+
<UiButton disabled>Disabled default</UiButton>
|
|
596
|
+
</div>
|
|
597
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
598
|
+
<UiButton variant="secondary" disabled>Disabled secondary</UiButton>
|
|
599
|
+
</div>
|
|
600
|
+
<div class="w-96 border border-dashed border-border-surface-default p-6">
|
|
601
|
+
<UiButton variant="destructive" disabled>Disabled destructive</UiButton>
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
`,
|
|
605
|
+
}),
|
|
606
|
+
parameters: {
|
|
607
|
+
docs: {
|
|
608
|
+
description: {
|
|
609
|
+
story:
|
|
610
|
+
'Use this story to reproduce hover-layer bleed on disabled buttons. The dashed containers make any misplaced absolute hover layer visible.',
|
|
611
|
+
},
|
|
612
|
+
source: {
|
|
613
|
+
code: disabledHoverBleedTemplateSource,
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
};
|
|
618
|
+
|
|
559
619
|
const iconSizesTemplateSource = `<script setup lang="ts">
|
|
560
620
|
import { UiButton, UiIcon } from '@aleph-alpha/ui-library'
|
|
561
621
|
</script>
|
|
@@ -105,7 +105,7 @@ onUnmounted(() => {
|
|
|
105
105
|
>
|
|
106
106
|
<div
|
|
107
107
|
v-if="showHeader"
|
|
108
|
-
class="flex items-center justify-between border-b border-border bg-muted px-4 py-2"
|
|
108
|
+
class="flex items-center justify-between border-b border-border bg-background-surface-muted px-4 py-2"
|
|
109
109
|
>
|
|
110
110
|
<span class="font-mono text-sm text-muted-foreground">
|
|
111
111
|
{{ headerLabel !== 'text' ? headerLabel : '' }}
|
|
@@ -121,7 +121,12 @@ onUnmounted(() => {
|
|
|
121
121
|
</UiButton>
|
|
122
122
|
</div>
|
|
123
123
|
|
|
124
|
-
<div
|
|
124
|
+
<div
|
|
125
|
+
class="overflow-auto"
|
|
126
|
+
:style="maxHeight ? { maxHeight } : undefined"
|
|
127
|
+
:tabindex="maxHeight ? 0 : undefined"
|
|
128
|
+
:aria-label="maxHeight ? 'Scrollable code block' : undefined"
|
|
129
|
+
>
|
|
125
130
|
<!--
|
|
126
131
|
`highlightedHtml` is produced by Shiki, which emits a sanitized
|
|
127
132
|
`<pre><code>` tree from the raw `code` string. No user HTML is ever
|
|
@@ -1634,7 +1634,7 @@ export const PaymentMethodForm: Story = {
|
|
|
1634
1634
|
<UiFieldDescription>The billing address associated with your payment method.</UiFieldDescription>
|
|
1635
1635
|
<UiFieldGroup>
|
|
1636
1636
|
<UiField orientation="responsive">
|
|
1637
|
-
<UiCheckbox id="same-as-shipping" v-model="sameAsShipping"
|
|
1637
|
+
<UiCheckbox id="same-as-shipping" v-model="sameAsShipping" />
|
|
1638
1638
|
<UiFieldLabel for="same-as-shipping" class="font-normal">Same as shipping address</UiFieldLabel>
|
|
1639
1639
|
</UiField>
|
|
1640
1640
|
</UiFieldGroup>
|
|
@@ -1654,7 +1654,9 @@ export const PaymentMethodForm: Story = {
|
|
|
1654
1654
|
</div>
|
|
1655
1655
|
`,
|
|
1656
1656
|
}),
|
|
1657
|
-
parameters: {
|
|
1657
|
+
parameters: {
|
|
1658
|
+
controls: { disable: true },
|
|
1659
|
+
},
|
|
1658
1660
|
};
|
|
1659
1661
|
|
|
1660
1662
|
/**
|
|
@@ -1747,17 +1749,17 @@ export const ProfileSettingsForm: Story = {
|
|
|
1747
1749
|
<UiField orientation="responsive" description-placement="under-label">
|
|
1748
1750
|
<UiFieldLabel for="email-notif">Email notifications</UiFieldLabel>
|
|
1749
1751
|
<UiFieldDescription>Receive emails about new products, features, and more. If you don't want to receive these emails, you can turn them off.</UiFieldDescription>
|
|
1750
|
-
<UiSwitch id="email-notif" v-model="emailNotifications"
|
|
1752
|
+
<UiSwitch id="email-notif" v-model="emailNotifications" />
|
|
1751
1753
|
</UiField>
|
|
1752
1754
|
|
|
1753
1755
|
<UiField orientation="responsive">
|
|
1754
1756
|
<UiFieldLabel for="push-notif">Push notifications</UiFieldLabel>
|
|
1755
|
-
<UiSwitch id="push-notif" v-model="pushNotifications"
|
|
1757
|
+
<UiSwitch id="push-notif" v-model="pushNotifications" />
|
|
1756
1758
|
</UiField>
|
|
1757
1759
|
|
|
1758
1760
|
<UiField orientation="responsive">
|
|
1759
1761
|
<UiFieldLabel for="marketing">Marketing emails</UiFieldLabel>
|
|
1760
|
-
<UiSwitch id="marketing" v-model="marketingEmails"
|
|
1762
|
+
<UiSwitch id="marketing" v-model="marketingEmails" />
|
|
1761
1763
|
</UiField>
|
|
1762
1764
|
</UiFieldGroup>
|
|
1763
1765
|
</UiFieldSet>
|
|
@@ -1768,7 +1770,7 @@ export const ProfileSettingsForm: Story = {
|
|
|
1768
1770
|
<UiFieldLegend>Privacy Settings</UiFieldLegend>
|
|
1769
1771
|
<UiFieldDescription>Choose who can see your profile and what they can see.</UiFieldDescription>
|
|
1770
1772
|
|
|
1771
|
-
<UiRadioGroup v-model="privacy"
|
|
1773
|
+
<UiRadioGroup v-model="privacy">
|
|
1772
1774
|
<UiField orientation="responsive">
|
|
1773
1775
|
<UiRadioGroupItem id="privacy-everyone" value="everyone" />
|
|
1774
1776
|
<UiFieldContent>
|
|
@@ -1802,7 +1804,9 @@ export const ProfileSettingsForm: Story = {
|
|
|
1802
1804
|
</div>
|
|
1803
1805
|
`,
|
|
1804
1806
|
}),
|
|
1805
|
-
parameters: {
|
|
1807
|
+
parameters: {
|
|
1808
|
+
controls: { disable: true },
|
|
1809
|
+
},
|
|
1806
1810
|
};
|
|
1807
1811
|
|
|
1808
1812
|
/**
|
|
@@ -1856,7 +1860,7 @@ export const PersonalInformationForm: Story = {
|
|
|
1856
1860
|
</UiFieldSet>
|
|
1857
1861
|
|
|
1858
1862
|
<UiField orientation="responsive" data-invalid="true">
|
|
1859
|
-
<UiCheckbox id="agree-terms" v-model="agreeTerms"
|
|
1863
|
+
<UiCheckbox id="agree-terms" v-model="agreeTerms" />
|
|
1860
1864
|
<UiFieldContent>
|
|
1861
1865
|
<UiFieldLabel for="agree-terms" class="font-normal">I agree to the terms and conditions</UiFieldLabel>
|
|
1862
1866
|
</UiFieldContent>
|
|
@@ -1871,5 +1875,7 @@ export const PersonalInformationForm: Story = {
|
|
|
1871
1875
|
</div>
|
|
1872
1876
|
`,
|
|
1873
1877
|
}),
|
|
1874
|
-
parameters: {
|
|
1878
|
+
parameters: {
|
|
1879
|
+
controls: { disable: true },
|
|
1880
|
+
},
|
|
1875
1881
|
};
|