@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,16 +1,30 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
UiItemVariants,
|
|
3
|
+
UiItemSizes,
|
|
4
|
+
UiItemMediaVariants,
|
|
5
|
+
UiItemActionVariants,
|
|
6
|
+
} from './types';
|
|
2
7
|
|
|
3
8
|
export const ItemVariants = [
|
|
4
9
|
'default',
|
|
10
|
+
'active',
|
|
5
11
|
'outline',
|
|
6
|
-
'
|
|
12
|
+
'hover',
|
|
13
|
+
'hover-action',
|
|
7
14
|
] as const satisfies readonly UiItemVariants[];
|
|
8
15
|
export const ItemSizes = [
|
|
9
16
|
'default',
|
|
10
17
|
'sm',
|
|
18
|
+
'minimal',
|
|
11
19
|
] as const satisfies readonly UiItemSizes[];
|
|
12
20
|
export const ItemMediaVariants = [
|
|
13
21
|
'default',
|
|
14
22
|
'icon',
|
|
15
23
|
'image',
|
|
24
|
+
'avatar-group',
|
|
16
25
|
] as const satisfies readonly UiItemMediaVariants[];
|
|
26
|
+
export const ItemActionVariants = [
|
|
27
|
+
'default',
|
|
28
|
+
'text',
|
|
29
|
+
'button',
|
|
30
|
+
] as const satisfies readonly UiItemActionVariants[];
|
|
@@ -3,7 +3,7 @@ export { default as UiItem } from './UiItem.vue';
|
|
|
3
3
|
export { default as UiItemMedia } from './UiItemMedia.vue';
|
|
4
4
|
|
|
5
5
|
// Simple re-exports - no wrapper needed
|
|
6
|
-
export {
|
|
6
|
+
export { ItemAction as UiItemAction } from '@/components/core/item';
|
|
7
7
|
export { ItemContent as UiItemContent } from '@/components/core/item';
|
|
8
8
|
export { ItemDescription as UiItemDescription } from '@/components/core/item';
|
|
9
9
|
export { ItemFooter as UiItemFooter } from '@/components/core/item';
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Variant types for the UiItem primitive component
|
|
3
3
|
*/
|
|
4
|
-
export type UiItemVariants =
|
|
4
|
+
export type UiItemVariants =
|
|
5
|
+
| 'default'
|
|
6
|
+
| 'active'
|
|
7
|
+
| 'outline'
|
|
8
|
+
| 'hover'
|
|
9
|
+
| 'hover-action';
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* Size types for the UiItem primitive component
|
|
8
13
|
*/
|
|
9
|
-
export type UiItemSizes = 'default' | 'sm';
|
|
14
|
+
export type UiItemSizes = 'default' | 'sm' | 'minimal';
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* Media variant types for the UiItemMedia component
|
|
13
18
|
*/
|
|
14
|
-
export type UiItemMediaVariants = 'default' | 'icon' | 'image';
|
|
19
|
+
export type UiItemMediaVariants = 'default' | 'icon' | 'image' | 'avatar-group';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Action variant types for the UiItemAction component
|
|
23
|
+
*/
|
|
24
|
+
export type UiItemActionVariants = 'default' | 'text' | 'button';
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
27
|
* A versatile component that you can use to display any content.
|
|
@@ -20,15 +30,17 @@ export type UiItemMediaVariants = 'default' | 'icon' | 'image';
|
|
|
20
30
|
* Group it with the ItemGroup component to create a list of items.
|
|
21
31
|
* @category Layout
|
|
22
32
|
* @useCases list item, menu entry, settings row, navigation item, notification, user card
|
|
23
|
-
* @keywords item, list, row, entry, menu, settings, navigation,
|
|
33
|
+
* @keywords item, list, row, entry, menu, settings, navigation, card
|
|
24
34
|
* @related UiCard, UiButton, UiListbox
|
|
25
35
|
*/
|
|
26
36
|
export interface UiItemProps {
|
|
27
37
|
/**
|
|
28
38
|
* Visual variant of the item.
|
|
29
|
-
* - `default`: Standard styling
|
|
39
|
+
* - `default`: Standard styling without interactive affordance
|
|
40
|
+
* - `active`: Active row with a left-edge indicator and active background
|
|
30
41
|
* - `outline`: Outlined style with clear borders and transparent background
|
|
31
|
-
* - `
|
|
42
|
+
* - `hover`: Row with hover feedback
|
|
43
|
+
* - `hover-action`: Actionable row with hover feedback, except while hovering actions
|
|
32
44
|
* @default 'default'
|
|
33
45
|
*/
|
|
34
46
|
variant?: UiItemVariants;
|
|
@@ -37,26 +49,50 @@ export interface UiItemProps {
|
|
|
37
49
|
* Size of the item.
|
|
38
50
|
* - `default`: Standard size with comfortable padding
|
|
39
51
|
* - `sm`: Compact size for dense layouts
|
|
52
|
+
* - `minimal`: Compact size with smaller default action affordance
|
|
40
53
|
* @default 'default'
|
|
41
54
|
*/
|
|
42
55
|
size?: UiItemSizes;
|
|
43
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Convenience title rendered with UiItemTitle.
|
|
59
|
+
*/
|
|
60
|
+
title?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convenience description rendered with UiItemDescription.
|
|
64
|
+
*/
|
|
65
|
+
description?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Alias for `description`.
|
|
69
|
+
*/
|
|
70
|
+
desc?: string;
|
|
71
|
+
|
|
44
72
|
/**
|
|
45
73
|
* Whether to render as a child element (using Radix's asChild pattern).
|
|
46
74
|
* Useful for rendering the item as a link or custom component.
|
|
47
|
-
*
|
|
75
|
+
* Variant and focus styles will be applied to the custom component.
|
|
48
76
|
* @default false
|
|
49
77
|
*/
|
|
50
78
|
asChild?: boolean;
|
|
51
79
|
|
|
52
80
|
/**
|
|
53
|
-
* When true
|
|
54
|
-
*
|
|
55
|
-
*
|
|
81
|
+
* When true, sets `role="listitem"` for use inside a parent with `role="list"`.
|
|
82
|
+
* Keep false when rendering standalone items or when the parent already
|
|
83
|
+
* provides list item semantics (e.g. an `<li>`).
|
|
84
|
+
* @default false
|
|
56
85
|
*/
|
|
57
86
|
withListSemantics?: boolean;
|
|
58
87
|
}
|
|
59
88
|
|
|
89
|
+
export interface UiItemEmits {
|
|
90
|
+
/**
|
|
91
|
+
* Emitted when the built-in default action button is clicked.
|
|
92
|
+
*/
|
|
93
|
+
action: [event: MouseEvent];
|
|
94
|
+
}
|
|
95
|
+
|
|
60
96
|
/**
|
|
61
97
|
* Props for the UiItemGroup component.
|
|
62
98
|
* Container that groups related items together with consistent styling.
|
|
@@ -78,7 +114,8 @@ export interface UiItemMediaProps {
|
|
|
78
114
|
* Visual variant of the media container.
|
|
79
115
|
* - `default`: Standard styling, suitable for avatars
|
|
80
116
|
* - `icon`: Styled for icon display with appropriate sizing
|
|
81
|
-
* - `image`: Styled for image
|
|
117
|
+
* - `image`: Styled for a single avatar or image thumbnail
|
|
118
|
+
* - `avatar-group`: Styled for stacked avatar groups
|
|
82
119
|
* @default 'default'
|
|
83
120
|
*/
|
|
84
121
|
variant?: UiItemMediaVariants;
|
|
@@ -103,10 +140,24 @@ export type UiItemTitleProps = Record<string, never>;
|
|
|
103
140
|
export type UiItemDescriptionProps = Record<string, never>;
|
|
104
141
|
|
|
105
142
|
/**
|
|
106
|
-
* Props for the
|
|
143
|
+
* Props for the UiItemAction component.
|
|
107
144
|
* Displays action buttons or other interactive elements.
|
|
108
145
|
*/
|
|
109
|
-
export
|
|
146
|
+
export interface UiItemActionProps {
|
|
147
|
+
/**
|
|
148
|
+
* Visual variant of the action container.
|
|
149
|
+
* - `default`: Standard flex action layout
|
|
150
|
+
* - `text`: Muted label action
|
|
151
|
+
* - `button`: Compact button-like action affordance
|
|
152
|
+
* @default 'default'
|
|
153
|
+
*/
|
|
154
|
+
variant?: UiItemActionVariants;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Optional tooltip shown when hovering or focusing the action container.
|
|
158
|
+
*/
|
|
159
|
+
tooltip?: string;
|
|
160
|
+
}
|
|
110
161
|
|
|
111
162
|
/**
|
|
112
163
|
* Props for the UiItemHeader component.
|
|
@@ -224,7 +224,7 @@ export const Interactive: Story = {
|
|
|
224
224
|
<p class="body-14-regular text-muted-foreground">Try pressing these keyboard shortcuts:</p>
|
|
225
225
|
</div>
|
|
226
226
|
|
|
227
|
-
<div class="flex flex-col gap-3 rounded-lg border p-4 bg-muted/30">
|
|
227
|
+
<div class="flex flex-col gap-3 rounded-lg border p-4 bg-background-surface-muted/30">
|
|
228
228
|
<div class="flex items-center justify-between gap-8">
|
|
229
229
|
<span class="body-14-regular">Open Command Palette</span>
|
|
230
230
|
<UiKbdGroup>
|
|
@@ -440,7 +440,7 @@ export const Disabled: Story = {
|
|
|
440
440
|
return { selected, fruits };
|
|
441
441
|
},
|
|
442
442
|
template: `
|
|
443
|
-
<UiListbox v-model="selected" disabled class="w-[200px] p-1
|
|
443
|
+
<UiListbox v-model="selected" disabled class="w-[200px] p-1">
|
|
444
444
|
<UiListboxContent>
|
|
445
445
|
<UiListboxItem
|
|
446
446
|
v-for="fruit in fruits"
|
|
@@ -872,7 +872,7 @@ const value = ref('')
|
|
|
872
872
|
|
|
873
873
|
<template>
|
|
874
874
|
<div class="gap-y-4">
|
|
875
|
-
<div class="p-4 bg-muted rounded-md text-sm">
|
|
875
|
+
<div class="p-4 bg-background-surface-muted rounded-md text-sm">
|
|
876
876
|
<p class="font-medium mb-2">Keyboard Navigation:</p>
|
|
877
877
|
<ul class="gap-y-1 text-muted-foreground">
|
|
878
878
|
<li><kbd class="px-1 bg-background rounded">Tab</kbd> - Move focus to/from navigation</li>
|
|
@@ -1004,10 +1004,10 @@ export const ControlledState: Story = {
|
|
|
1004
1004
|
},
|
|
1005
1005
|
template: `<div class="gap-y-4">
|
|
1006
1006
|
<div class="flex gap-2 items-center">
|
|
1007
|
-
<button type="button" @click="openProducts" class="px-3 py-1 text-sm border rounded hover:bg-muted">
|
|
1007
|
+
<button type="button" @click="openProducts" class="px-3 py-1 text-sm border rounded hover:bg-background-surface-muted">
|
|
1008
1008
|
Open Products
|
|
1009
1009
|
</button>
|
|
1010
|
-
<button type="button" @click="closeAll" class="px-3 py-1 text-sm border rounded hover:bg-muted">
|
|
1010
|
+
<button type="button" @click="closeAll" class="px-3 py-1 text-sm border rounded hover:bg-background-surface-muted">
|
|
1011
1011
|
Close All
|
|
1012
1012
|
</button>
|
|
1013
1013
|
<span class="text-sm text-muted-foreground">
|
|
@@ -1091,7 +1091,7 @@ export const KeyboardNavigation: Story = {
|
|
|
1091
1091
|
return { args, value, navigationMenuTriggerStyle };
|
|
1092
1092
|
},
|
|
1093
1093
|
template: `<div class="gap-y-4">
|
|
1094
|
-
<div class="p-4 bg-muted rounded-md text-sm">
|
|
1094
|
+
<div class="p-4 bg-background-surface-muted rounded-md text-sm">
|
|
1095
1095
|
<p class="font-medium mb-2">Keyboard Navigation:</p>
|
|
1096
1096
|
<ul class="gap-y-1 text-muted-foreground">
|
|
1097
1097
|
<li><kbd class="px-1 bg-background rounded">Tab</kbd> - Move focus to/from navigation</li>
|
|
@@ -30,6 +30,12 @@ const isMultiPlaceholder = computed(
|
|
|
30
30
|
ctx.mode === 'multiple' &&
|
|
31
31
|
(ctx.multiple?.selectedValues.value.length ?? 0) === 0,
|
|
32
32
|
);
|
|
33
|
+
const singleAriaLabel = computed(() => props.ariaLabel);
|
|
34
|
+
const multiAriaLabel = computed(
|
|
35
|
+
() =>
|
|
36
|
+
props.ariaLabel ??
|
|
37
|
+
(isMultiPlaceholder.value ? 'Select options' : undefined),
|
|
38
|
+
);
|
|
33
39
|
|
|
34
40
|
// shadcn trigger styles target only SVG icons (`[&_svg]...`) but our icons are spans (`data-slot="icon"`).
|
|
35
41
|
// Add equivalent sizing/behavior + rotate-on-open for the chevron.
|
|
@@ -62,7 +68,7 @@ const multiTriggerClasses = computed(() =>
|
|
|
62
68
|
v-if="ctx.mode === 'single'"
|
|
63
69
|
:disabled="props.disabled"
|
|
64
70
|
:size="props.size"
|
|
65
|
-
:aria-label="
|
|
71
|
+
:aria-label="singleAriaLabel"
|
|
66
72
|
:class="uiIconTriggerClasses"
|
|
67
73
|
>
|
|
68
74
|
<slot />
|
|
@@ -74,7 +80,7 @@ const multiTriggerClasses = computed(() =>
|
|
|
74
80
|
:data-size="props.size"
|
|
75
81
|
:data-placeholder="isMultiPlaceholder ? '' : undefined"
|
|
76
82
|
:disabled="props.disabled"
|
|
77
|
-
:aria-label="
|
|
83
|
+
:aria-label="multiAriaLabel"
|
|
78
84
|
:class="multiTriggerClasses"
|
|
79
85
|
>
|
|
80
86
|
<slot />
|
|
@@ -67,7 +67,7 @@ describe('UiSelectGroup', () => {
|
|
|
67
67
|
<UiSelectValue placeholder="Select" />
|
|
68
68
|
</UiSelectTrigger>
|
|
69
69
|
<UiSelectContent>
|
|
70
|
-
<UiSelectGroup class="bg-muted" data-testid="group">
|
|
70
|
+
<UiSelectGroup class="bg-background-surface-muted" data-testid="group">
|
|
71
71
|
<UiSelectLabel>Fruits</UiSelectLabel>
|
|
72
72
|
<UiSelectItem value="apple">Apple</UiSelectItem>
|
|
73
73
|
</UiSelectGroup>
|
|
@@ -79,7 +79,7 @@ describe('UiSelectGroup', () => {
|
|
|
79
79
|
await user.click(getByRole('combobox'));
|
|
80
80
|
|
|
81
81
|
await waitFor(() => {
|
|
82
|
-
expect(getByRole('group')).toHaveClass('bg-muted');
|
|
82
|
+
expect(getByRole('group')).toHaveClass('bg-background-surface-muted');
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
});
|
|
@@ -230,7 +230,9 @@ const invoices = [
|
|
|
230
230
|
<UiTableHead>Status</UiTableHead>
|
|
231
231
|
<UiTableHead>Method</UiTableHead>
|
|
232
232
|
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
233
|
-
<UiTableHead class="w-[50px]"
|
|
233
|
+
<UiTableHead class="w-[50px]">
|
|
234
|
+
<span class="sr-only">Actions</span>
|
|
235
|
+
</UiTableHead>
|
|
234
236
|
</UiTableRow>
|
|
235
237
|
</UiTableHeader>
|
|
236
238
|
<UiTableBody>
|
|
@@ -269,7 +271,9 @@ const withRowActionsTemplate = `
|
|
|
269
271
|
<UiTableHead>Status</UiTableHead>
|
|
270
272
|
<UiTableHead>Method</UiTableHead>
|
|
271
273
|
<UiTableHead class="text-right">Amount</UiTableHead>
|
|
272
|
-
<UiTableHead class="w-[50px]"
|
|
274
|
+
<UiTableHead class="w-[50px]">
|
|
275
|
+
<span class="sr-only">Actions</span>
|
|
276
|
+
</UiTableHead>
|
|
273
277
|
</UiTableRow>
|
|
274
278
|
</UiTableHeader>
|
|
275
279
|
<UiTableBody>
|
|
@@ -5,11 +5,13 @@ import UiTableRow from '../UiTableRow.vue';
|
|
|
5
5
|
describe('UiTableRow', () => {
|
|
6
6
|
test('applies custom class', () => {
|
|
7
7
|
const { getByRole } = render(UiTableRow, {
|
|
8
|
-
props: { class: 'hover:bg-muted' },
|
|
8
|
+
props: { class: 'hover:bg-background-surface-muted' },
|
|
9
9
|
slots: { default: '<td>Cell</td>' },
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
expect(getByRole('row').className).toContain(
|
|
12
|
+
expect(getByRole('row').className).toContain(
|
|
13
|
+
'hover:bg-background-surface-muted',
|
|
14
|
+
);
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
test('uses muted-subtle hover fill by default', () => {
|
|
@@ -386,7 +386,7 @@ function goToDetails() {
|
|
|
386
386
|
<div class="flex items-center gap-4">
|
|
387
387
|
<p class="text-sm">Current tab: <strong>{{ activeTab }}</strong></p>
|
|
388
388
|
<button
|
|
389
|
-
class="px-3 py-1 text-sm bg-primary rounded-md"
|
|
389
|
+
class="px-3 py-1 text-sm bg-primary text-primary-foreground rounded-md"
|
|
390
390
|
@click="goToDetails"
|
|
391
391
|
>
|
|
392
392
|
Go to Details
|
|
@@ -437,7 +437,7 @@ export const Controlled: Story = {
|
|
|
437
437
|
<div class="flex items-center gap-4">
|
|
438
438
|
<p class="text-sm">Current tab: <strong>{{ activeTab }}</strong></p>
|
|
439
439
|
<button
|
|
440
|
-
class="px-3 py-1 text-sm bg-primary rounded-md"
|
|
440
|
+
class="px-3 py-1 text-sm bg-primary text-primary-foreground rounded-md"
|
|
441
441
|
@click="goToDetails"
|
|
442
442
|
>
|
|
443
443
|
Go to Details
|
|
@@ -208,7 +208,7 @@ export const Disabled: Story = {
|
|
|
208
208
|
return { modelValue };
|
|
209
209
|
},
|
|
210
210
|
template: `
|
|
211
|
-
<UiTagsInput v-model="modelValue" class="w-[300px]" disabled>
|
|
211
|
+
<UiTagsInput v-model="modelValue" class="w-[300px] !opacity-100" disabled>
|
|
212
212
|
<UiTagsInputItem v-for="item in modelValue" :key="item" :value="item">
|
|
213
213
|
<UiTagsInputItemText />
|
|
214
214
|
<UiTagsInputItemDelete />
|
|
@@ -219,6 +219,11 @@ export const Disabled: Story = {
|
|
|
219
219
|
`,
|
|
220
220
|
}),
|
|
221
221
|
parameters: {
|
|
222
|
+
a11y: {
|
|
223
|
+
config: {
|
|
224
|
+
rules: [{ id: 'color-contrast', enabled: false }],
|
|
225
|
+
},
|
|
226
|
+
},
|
|
222
227
|
docs: {
|
|
223
228
|
source: {
|
|
224
229
|
code: disabledTemplateSource,
|
|
@@ -521,7 +526,12 @@ export const WithListbox: Story = {
|
|
|
521
526
|
</UiListboxFilter>
|
|
522
527
|
|
|
523
528
|
<UiPopoverTrigger as-child>
|
|
524
|
-
<UiButton
|
|
529
|
+
<UiButton
|
|
530
|
+
size="icon-sm"
|
|
531
|
+
variant="ghost"
|
|
532
|
+
class="order-last self-start ml-auto"
|
|
533
|
+
aria-label="Open framework suggestions"
|
|
534
|
+
>
|
|
525
535
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
526
536
|
<path d="m6 9 6 6 6-6"/>
|
|
527
537
|
</svg>
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import { computed } from 'vue';
|
|
3
4
|
import { AvatarRoot } from 'reka-ui';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
6
|
|
|
7
|
+
type AvatarSize = 5 | 6 | 8 | 10 | 12 | '5' | '6' | '8' | '10' | '12';
|
|
8
|
+
|
|
6
9
|
const props = defineProps<{
|
|
7
10
|
class?: HTMLAttributes['class'];
|
|
11
|
+
size?: AvatarSize;
|
|
8
12
|
}>();
|
|
13
|
+
|
|
14
|
+
const avatarSizeClass = computed(
|
|
15
|
+
() =>
|
|
16
|
+
({
|
|
17
|
+
5: 'size-5',
|
|
18
|
+
6: 'size-6',
|
|
19
|
+
8: 'size-8',
|
|
20
|
+
10: 'size-10',
|
|
21
|
+
12: 'size-12',
|
|
22
|
+
})[String(props.size ?? 8)],
|
|
23
|
+
);
|
|
9
24
|
</script>
|
|
10
25
|
|
|
11
26
|
<template>
|
|
@@ -13,7 +28,8 @@ const props = defineProps<{
|
|
|
13
28
|
data-slot="avatar"
|
|
14
29
|
:class="
|
|
15
30
|
cn(
|
|
16
|
-
'relative flex
|
|
31
|
+
'relative flex shrink-0 overflow-hidden rounded-full',
|
|
32
|
+
avatarSizeClass,
|
|
17
33
|
props.class,
|
|
18
34
|
)
|
|
19
35
|
"
|
|
@@ -18,7 +18,7 @@ const delegatedProps = reactiveOmit(props, 'class');
|
|
|
18
18
|
v-bind="delegatedProps"
|
|
19
19
|
:class="
|
|
20
20
|
cn(
|
|
21
|
-
'bg-muted flex size-full items-center justify-center rounded-full',
|
|
21
|
+
'bg-background-surface-muted flex size-full items-center justify-center rounded-full',
|
|
22
22
|
props.class,
|
|
23
23
|
)
|
|
24
24
|
"
|
|
@@ -9,8 +9,13 @@ const props = defineProps<{
|
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
11
|
<div
|
|
12
|
-
data-slot="
|
|
13
|
-
:class="
|
|
12
|
+
data-slot="avatar-group"
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'flex items-center [&>*+*]:-ml-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background-surface-primary',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
14
19
|
>
|
|
15
20
|
<slot />
|
|
16
21
|
</div>
|
|
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
|
|
|
4
4
|
export { default as Button } from './Button.vue';
|
|
5
5
|
|
|
6
6
|
export const buttonVariants = cva(
|
|
7
|
-
'inline-flex items-center justify-center whitespace-nowrap border border-transparent transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-border-surface-focus-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
7
|
+
'inline-flex items-center justify-center whitespace-nowrap border border-transparent transition-all relative disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-border-surface-focus-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -6,7 +6,7 @@ import { getLocalTimeZone, today } from '@internationalized/date';
|
|
|
6
6
|
import { createReusableTemplate, reactiveOmit, useVModel } from '@vueuse/core';
|
|
7
7
|
import { CalendarRoot, useDateFormatter, useForwardPropsEmits } from 'reka-ui';
|
|
8
8
|
import { createYear, createYearRange, toDate } from 'reka-ui/date';
|
|
9
|
-
import { computed, toRaw } from 'vue';
|
|
9
|
+
import { computed, nextTick, onMounted, ref, toRaw, watch } from 'vue';
|
|
10
10
|
import { cn } from '@/lib/utils';
|
|
11
11
|
import {
|
|
12
12
|
NativeSelect,
|
|
@@ -81,6 +81,21 @@ const [DefineYearTemplate, ReuseYearTemplate] = createReusableTemplate<{
|
|
|
81
81
|
}>();
|
|
82
82
|
|
|
83
83
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
84
|
+
const calendarRootRef = ref<InstanceType<typeof CalendarRoot> | null>(null);
|
|
85
|
+
|
|
86
|
+
function removeUnsupportedReadonlyAttributes() {
|
|
87
|
+
nextTick(() => {
|
|
88
|
+
const root = calendarRootRef.value?.$el as HTMLElement | undefined;
|
|
89
|
+
root
|
|
90
|
+
?.querySelectorAll('[role="application"][aria-readonly]')
|
|
91
|
+
.forEach((el) => {
|
|
92
|
+
el.removeAttribute('aria-readonly');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onMounted(removeUnsupportedReadonlyAttributes);
|
|
98
|
+
watch(() => props.readonly, removeUnsupportedReadonlyAttributes);
|
|
84
99
|
</script>
|
|
85
100
|
|
|
86
101
|
<template>
|
|
@@ -147,6 +162,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
147
162
|
</DefineYearTemplate>
|
|
148
163
|
|
|
149
164
|
<CalendarRoot
|
|
165
|
+
ref="calendarRootRef"
|
|
150
166
|
#default="{ grid, weekDays, date }"
|
|
151
167
|
v-bind="forwarded"
|
|
152
168
|
v-model:placeholder="placeholder"
|
|
@@ -49,7 +49,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
49
49
|
<div
|
|
50
50
|
v-if="props.showHandle ?? true"
|
|
51
51
|
data-slot="drawer-handle"
|
|
52
|
-
class="bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full"
|
|
52
|
+
class="bg-background-surface-muted mx-auto mt-4 h-2 w-[100px] rounded-full"
|
|
53
53
|
/>
|
|
54
54
|
<slot />
|
|
55
55
|
</DialogContent>
|
|
@@ -12,13 +12,13 @@ const props = withDefaults(
|
|
|
12
12
|
class?: HTMLAttributes['class'];
|
|
13
13
|
variant?: ItemVariants['variant'];
|
|
14
14
|
size?: ItemVariants['size'];
|
|
15
|
-
/** When
|
|
15
|
+
/** When true, sets `role="listitem"` for use inside an element with `role="list"`. */
|
|
16
16
|
withListSemantics?: boolean;
|
|
17
17
|
}
|
|
18
18
|
>(),
|
|
19
19
|
{
|
|
20
20
|
as: 'div',
|
|
21
|
-
withListSemantics:
|
|
21
|
+
withListSemantics: false,
|
|
22
22
|
},
|
|
23
23
|
);
|
|
24
24
|
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type { ItemActionVariants } from '.';
|
|
4
|
+
import { computed } from 'vue';
|
|
5
|
+
import { UiTooltip } from '@/components/UiTooltip';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
import { itemActionVariants } from '.';
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
class?: HTMLAttributes['class'];
|
|
11
|
+
variant?: ItemActionVariants['variant'];
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const actionClass = computed(() =>
|
|
16
|
+
cn(itemActionVariants({ variant: props.variant }), props.class),
|
|
17
|
+
);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<UiTooltip v-if="props.tooltip" :content="props.tooltip" side="right">
|
|
22
|
+
<div data-slot="item-action" :class="actionClass">
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
</UiTooltip>
|
|
26
|
+
|
|
27
|
+
<div v-else data-slot="item-action" :class="actionClass">
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
@@ -12,7 +12,7 @@ const props = defineProps<{
|
|
|
12
12
|
data-slot="item-description"
|
|
13
13
|
:class="
|
|
14
14
|
cn(
|
|
15
|
-
'text-muted
|
|
15
|
+
'text-content-on-surface-muted line-clamp-2 label-12-regular text-balance',
|
|
16
16
|
'[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
|
|
17
17
|
props.class,
|
|
18
18
|
)
|