@aleph-alpha/ui-library 2.4.4 → 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.js +78 -9
- 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/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 +12 -12
- /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>
|
|
@@ -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>
|
|
@@ -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
|
});
|
|
@@ -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', () => {
|
|
@@ -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: {
|
|
@@ -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
|
)
|
|
@@ -2,7 +2,7 @@ import type { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
3
|
|
|
4
4
|
export { default as Item } from './Item.vue';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as ItemAction } from './ItemAction.vue';
|
|
6
6
|
export { default as ItemContent } from './ItemContent.vue';
|
|
7
7
|
export { default as ItemDescription } from './ItemDescription.vue';
|
|
8
8
|
export { default as ItemFooter } from './ItemFooter.vue';
|
|
@@ -13,17 +13,23 @@ export { default as ItemSeparator } from './ItemSeparator.vue';
|
|
|
13
13
|
export { default as ItemTitle } from './ItemTitle.vue';
|
|
14
14
|
|
|
15
15
|
export const itemVariants = cva(
|
|
16
|
-
'group/item flex items-center
|
|
16
|
+
'group/item flex items-center text-sm rounded-md transition-[background-color,color,box-shadow] [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50',
|
|
17
17
|
{
|
|
18
18
|
variants: {
|
|
19
19
|
variant: {
|
|
20
20
|
default: 'bg-transparent',
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
active:
|
|
22
|
+
'ui-active-indicator ui-active-indicator-active cursor-pointer bg-background-surface-muted-subtle',
|
|
23
|
+
outline: 'bg-transparent ring-1 ring-inset ring-border-surface-default',
|
|
24
|
+
hover:
|
|
25
|
+
'cursor-pointer bg-transparent hover:bg-background-surface-muted-subtle',
|
|
26
|
+
'hover-action':
|
|
27
|
+
'cursor-pointer bg-transparent hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent has-[[data-slot=item-action]:hover]:hover:bg-transparent',
|
|
23
28
|
},
|
|
24
29
|
size: {
|
|
25
|
-
default: 'p-
|
|
26
|
-
sm: '
|
|
30
|
+
default: 'p-3 gap-4 ',
|
|
31
|
+
sm: 'p-2 gap-2.5',
|
|
32
|
+
minimal: 'p-2 gap-2.5',
|
|
27
33
|
},
|
|
28
34
|
},
|
|
29
35
|
defaultVariants: {
|
|
@@ -34,14 +40,16 @@ export const itemVariants = cva(
|
|
|
34
40
|
);
|
|
35
41
|
|
|
36
42
|
export const itemMediaVariants = cva(
|
|
37
|
-
'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
|
|
43
|
+
'flex shrink-0 rounded-full items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
|
|
38
44
|
{
|
|
39
45
|
variants: {
|
|
40
46
|
variant: {
|
|
41
47
|
default: 'bg-transparent',
|
|
42
|
-
icon: "size-8
|
|
48
|
+
icon: "size-8 bg-background-surface-muted [&_svg:not([class*='size-'])]:size-4",
|
|
43
49
|
image:
|
|
44
|
-
'size-10
|
|
50
|
+
'size-10 overflow-hidden [&_[data-slot=avatar]]:size-full [&_[data-slot=avatar]]:rounded-full [&_img]:size-full [&_img]:object-cover',
|
|
51
|
+
'avatar-group':
|
|
52
|
+
'rounded-none items-center justify-start overflow-visible [&_[data-slot=avatar-group]]:shrink-0',
|
|
45
53
|
},
|
|
46
54
|
},
|
|
47
55
|
defaultVariants: {
|
|
@@ -50,5 +58,20 @@ export const itemMediaVariants = cva(
|
|
|
50
58
|
},
|
|
51
59
|
);
|
|
52
60
|
|
|
61
|
+
export const itemActionVariants = cva('flex items-center gap-2', {
|
|
62
|
+
variants: {
|
|
63
|
+
variant: {
|
|
64
|
+
default: '',
|
|
65
|
+
text: 'label-12-regular text-content-on-surface-muted',
|
|
66
|
+
button:
|
|
67
|
+
"size-6 justify-center rounded-sm text-content-on-surface-primary hover:bg-background-surface-muted-subtle has-[button]:hover:bg-transparent [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: 'default',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
53
75
|
export type ItemVariants = VariantProps<typeof itemVariants>;
|
|
54
76
|
export type ItemMediaVariants = VariantProps<typeof itemMediaVariants>;
|
|
77
|
+
export type ItemActionVariants = VariantProps<typeof itemActionVariants>;
|
|
@@ -10,7 +10,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
|
10
10
|
data-slot="kbd"
|
|
11
11
|
:class="
|
|
12
12
|
cn(
|
|
13
|
-
'pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground',
|
|
13
|
+
'pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-background-surface-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground',
|
|
14
14
|
props.class,
|
|
15
15
|
)
|
|
16
16
|
"
|
|
@@ -8,6 +8,8 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>();
|
|
|
8
8
|
<template>
|
|
9
9
|
<div
|
|
10
10
|
data-slot="skeleton"
|
|
11
|
-
:class="
|
|
11
|
+
:class="
|
|
12
|
+
cn('bg-background-surface-muted animate-pulse rounded-md', props.class)
|
|
13
|
+
"
|
|
12
14
|
/>
|
|
13
15
|
</template>
|
|
@@ -35,7 +35,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
35
35
|
>
|
|
36
36
|
<SliderTrack
|
|
37
37
|
data-slot="slider-track"
|
|
38
|
-
class="bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
38
|
+
class="bg-background-surface-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
39
39
|
>
|
|
40
40
|
<SliderRange
|
|
41
41
|
data-slot="slider-range"
|
|
@@ -11,7 +11,10 @@ const props = defineProps<{
|
|
|
11
11
|
<tfoot
|
|
12
12
|
data-slot="table-footer"
|
|
13
13
|
:class="
|
|
14
|
-
cn(
|
|
14
|
+
cn(
|
|
15
|
+
'bg-background-surface-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
15
18
|
"
|
|
16
19
|
>
|
|
17
20
|
<slot />
|
|
@@ -14,7 +14,7 @@ const props = defineProps<{
|
|
|
14
14
|
:data-state="props.dataState"
|
|
15
15
|
:class="
|
|
16
16
|
cn(
|
|
17
|
-
'hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent data-[state=selected]:bg-muted border-b transition-colors',
|
|
17
|
+
'hover:bg-background-surface-muted-subtle has-[button:hover]:hover:bg-transparent data-[state=selected]:bg-background-surface-muted border-b transition-colors',
|
|
18
18
|
props.class,
|
|
19
19
|
)
|
|
20
20
|
"
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ACTIVE_INDICATOR_CLASS = 'ui-active-indicator';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs, useSlots } from 'vue';
|
|
3
3
|
import { SidebarMenuButton } from '@/components/core/sidebar';
|
|
4
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
6
6
|
import type {
|
|
7
7
|
UiSidebarMenuButtonEmits,
|
|
8
8
|
UiSidebarMenuButtonProps,
|
|
@@ -39,7 +39,7 @@ const containerClass = computed(() =>
|
|
|
39
39
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
40
40
|
// Row hover/active fill for transparent sidebar items.
|
|
41
41
|
'hover:bg-background-surface-muted-subtle data-[active=true]:bg-background-surface-muted-subtle',
|
|
42
|
-
|
|
42
|
+
ACTIVE_INDICATOR_CLASS,
|
|
43
43
|
),
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { computed, useAttrs } from 'vue';
|
|
3
3
|
import { Primitive } from 'reka-ui';
|
|
4
4
|
import { SidebarMenuSubItem as UiSidebarMenuItem } from '@/components/core/sidebar';
|
|
5
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
5
6
|
import { cn } from '@/lib/utils';
|
|
6
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
7
7
|
import type { UiSidebarMenuSubItemProps } from './types';
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
@@ -23,7 +23,7 @@ const containerClass = computed(() =>
|
|
|
23
23
|
// Same hover/active fill as UiSidebarMenuButton so sub-items visually match primary rows.
|
|
24
24
|
'relative flex h-8 w-full min-w-0 items-center gap-2 rounded-md border border-transparent px-2 py-1.5 transition-colors hover:bg-background-surface-muted-subtle data-[active=true]:bg-background-surface-muted-subtle',
|
|
25
25
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
26
|
-
|
|
26
|
+
ACTIVE_INDICATOR_CLASS,
|
|
27
27
|
),
|
|
28
28
|
);
|
|
29
29
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from 'vue';
|
|
3
3
|
import { Primitive } from 'reka-ui';
|
|
4
|
+
import { ACTIVE_INDICATOR_CLASS } from '@/lib/activeIndicator';
|
|
4
5
|
import { cn } from '@/lib/utils';
|
|
5
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
6
6
|
import type { UiSidebarPopoverMenuItemProps } from './types';
|
|
7
7
|
|
|
8
8
|
defineOptions({
|
|
@@ -24,7 +24,7 @@ const containerClass = computed(() =>
|
|
|
24
24
|
'transition-colors hover-layer hover-layer-default',
|
|
25
25
|
// Hover/active tint relative to the `secondary` surface the popover menu sits on.
|
|
26
26
|
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
27
|
-
|
|
27
|
+
ACTIVE_INDICATOR_CLASS,
|
|
28
28
|
),
|
|
29
29
|
);
|
|
30
30
|
|