@bearmenu/ui 0.7.0 → 0.8.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/dist/{chunk-4JOV7FXW.js → chunk-2DEIXTBN.js} +1 -1
- package/dist/{chunk-UUJVXN2O.js → chunk-66MAPLXS.js} +3 -1
- package/dist/{chunk-Y5D5LP4A.js → chunk-7BWTYWM3.js} +14 -3
- package/dist/{chunk-ZFNOCP6W.js → chunk-H3BV4VAG.js} +15 -1
- package/dist/chunk-LEAYBICI.js +84 -0
- package/dist/{chunk-TL4YU2O5.js → chunk-UKBNQO6Q.js} +2 -2
- package/dist/{chunk-UX6SWAKH.js → chunk-UZ3PCIE5.js} +119 -28
- package/dist/{chunk-YLNYXPIH.js → chunk-VBA45GLP.js} +1 -1
- package/dist/{chunk-A5ONAJCE.js → chunk-VG3PND3D.js} +1 -1
- package/dist/{chunk-ZBBUKXM5.js → chunk-X3WMRKOW.js} +1 -1
- package/dist/{chunk-HCM6LKM5.js → chunk-XNA2INVQ.js} +2 -2
- package/dist/{chunk-AV777R4G.js → chunk-YYGB4G4Q.js} +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/alert.d.ts +2 -2
- package/dist/components/alert.js +1 -1
- package/dist/components/avatar.d.ts +10 -1
- package/dist/components/avatar.js +41 -14
- package/dist/components/badge.d.ts +11 -2
- package/dist/components/badge.js +1 -1
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +3 -3
- package/dist/components/card.d.ts +2 -2
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.js +1 -1
- package/dist/components/circular-progress.js +1 -1
- package/dist/components/combobox.js +3 -3
- package/dist/components/command.d.ts +15 -15
- package/dist/components/command.js +1 -1
- package/dist/components/currency-input.js +2 -2
- package/dist/components/date-input.d.ts +1 -1
- package/dist/components/date-input.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/empty-state.js +2 -2
- package/dist/components/field.js +2 -2
- package/dist/components/filter-category-row.js +2 -2
- package/dist/components/form.js +1 -1
- package/dist/components/haptic-button.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/item.d.ts +2 -2
- package/dist/components/item.js +1 -1
- package/dist/components/kbd.js +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/link-button.js +1 -1
- package/dist/components/multi-select-combobox.js +4 -4
- package/dist/components/pagination.js +1 -1
- package/dist/components/place-about-tab.d.ts +17 -1
- package/dist/components/place-about-tab.js +4 -4
- package/dist/components/place-card.js +2 -2
- package/dist/components/place-details-mobile.js +7 -7
- package/dist/components/place-schedule-week.js +2 -2
- package/dist/components/popover.js +1 -1
- package/dist/components/searchable-select.js +3 -3
- package/dist/components/select.js +2 -2
- package/dist/components/selection-bar.js +1 -1
- package/dist/components/sheet.d.ts +23 -0
- package/dist/components/sheet.js +51 -14
- package/dist/components/sliding-panels.js +5 -1
- package/dist/components/sonner.js +2 -2
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/stepper.js +4 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +3 -26
- package/dist/components/tag-group.js +1 -1
- package/dist/components/tag.d.ts +2 -2
- package/dist/components/tag.js +1 -1
- package/dist/components/text.d.ts +21 -3
- package/dist/components/text.js +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.js +1 -1
- package/dist/lib/card-hover.d.ts +75 -0
- package/dist/lib/card-hover.js +18 -0
- package/dist/lib/motion.d.ts +83 -0
- package/dist/lib/motion.js +2 -0
- package/package.json +1 -1
- package/src/components/accordion.tsx +1 -1
- package/src/components/avatar.stories.tsx +59 -26
- package/src/components/avatar.test.tsx +129 -0
- package/src/components/avatar.tsx +93 -37
- package/src/components/badge.tsx +15 -3
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +16 -1
- package/src/components/calendar.tsx +2 -2
- package/src/components/circular-progress.tsx +1 -1
- package/src/components/command.tsx +2 -2
- package/src/components/currency-input.tsx +1 -1
- package/src/components/description-list.tsx +1 -1
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/field.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/item.tsx +1 -1
- package/src/components/kbd.tsx +1 -1
- package/src/components/label.tsx +1 -1
- package/src/components/place-about-tab.tsx +131 -18
- package/src/components/place-card.tsx +1 -1
- package/src/components/place-details-mobile.tsx +2 -2
- package/src/components/popover.tsx +9 -1
- package/src/components/select.tsx +2 -2
- package/src/components/selection-bar.tsx +1 -1
- package/src/components/sheet.tsx +72 -12
- package/src/components/sliding-panels.stories.tsx +70 -0
- package/src/components/sliding-panels.test.tsx +116 -0
- package/src/components/sliding-panels.tsx +14 -0
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +4 -1
- package/src/components/table.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/tag-group.tsx +1 -1
- package/src/components/tag.tsx +1 -1
- package/src/components/text.test.tsx +37 -3
- package/src/components/text.tsx +32 -3
- package/src/components/toggle.tsx +1 -1
- package/src/globals.css +53 -11
- package/src/lib/card-hover.ts +87 -0
- package/dist/chunk-EBAMCZDW.js +0 -112
- package/dist/chunk-VQNDZVI7.js +0 -106
- package/dist/components/toast.d.ts +0 -18
- package/dist/components/toast.js +0 -3
- package/dist/components/toaster.d.ts +0 -5
- package/dist/components/toaster.js +0 -25
- package/dist/components/use-toast.d.ts +0 -42
- package/dist/components/use-toast.js +0 -2
- package/src/components/toast.stories.tsx +0 -63
- package/src/components/toast.tsx +0 -130
- package/src/components/toaster.tsx +0 -31
- package/src/components/use-toast.ts +0 -180
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Avatar, AvatarFallback, AvatarImage } from "./avatar";
|
|
2
|
+
import { Avatar, AvatarFallback, AvatarGroup, AvatarImage, type AvatarSize } from "./avatar";
|
|
3
|
+
|
|
4
|
+
const sizes: AvatarSize[] = ["xs", "sm", "default", "lg", "xl"];
|
|
5
|
+
|
|
6
|
+
const people = ["AB", "CD", "EF", "GH", "IJ", "KL", "MN"];
|
|
3
7
|
|
|
4
8
|
const meta = {
|
|
5
9
|
title: "Components/Avatar",
|
|
@@ -30,37 +34,66 @@ export const Fallback: Story = {
|
|
|
30
34
|
export const Sizes: Story = {
|
|
31
35
|
render: () => (
|
|
32
36
|
<div className="flex items-center gap-4">
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</Avatar>
|
|
39
|
-
<Avatar className="h-14 w-14">
|
|
40
|
-
<AvatarFallback className="text-lg">LG</AvatarFallback>
|
|
41
|
-
</Avatar>
|
|
42
|
-
<Avatar className="h-20 w-20">
|
|
43
|
-
<AvatarFallback className="text-xl">XL</AvatarFallback>
|
|
44
|
-
</Avatar>
|
|
37
|
+
{sizes.map((size) => (
|
|
38
|
+
<Avatar key={size} size={size}>
|
|
39
|
+
<AvatarFallback>{size.slice(0, 2).toUpperCase()}</AvatarFallback>
|
|
40
|
+
</Avatar>
|
|
41
|
+
))}
|
|
45
42
|
</div>
|
|
46
43
|
),
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
export const Group: Story = {
|
|
50
47
|
render: () => (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
<AvatarGroup max={4} spacing="tight">
|
|
49
|
+
{people.map((initials) => (
|
|
50
|
+
<Avatar key={initials}>
|
|
51
|
+
<AvatarFallback>{initials}</AvatarFallback>
|
|
52
|
+
</Avatar>
|
|
53
|
+
))}
|
|
54
|
+
</AvatarGroup>
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* `AvatarGroup` takes the same `size` union as `Avatar`. It sizes the "+N"
|
|
60
|
+
* overflow chip and is inherited by child avatars, so the row stays one
|
|
61
|
+
* consistent height without per-call-site class overrides.
|
|
62
|
+
*/
|
|
63
|
+
export const GroupSizes: Story = {
|
|
64
|
+
render: () => (
|
|
65
|
+
<div className="flex flex-col gap-6">
|
|
66
|
+
{sizes.map((size) => (
|
|
67
|
+
<div key={size} className="flex items-center gap-4">
|
|
68
|
+
<span className="w-16 text-xs text-muted-foreground">{size}</span>
|
|
69
|
+
<AvatarGroup max={3} spacing="tight" size={size}>
|
|
70
|
+
{people.map((initials) => (
|
|
71
|
+
<Avatar key={initials}>
|
|
72
|
+
<AvatarFallback>{initials}</AvatarFallback>
|
|
73
|
+
</Avatar>
|
|
74
|
+
))}
|
|
75
|
+
</AvatarGroup>
|
|
76
|
+
</div>
|
|
77
|
+
))}
|
|
64
78
|
</div>
|
|
65
79
|
),
|
|
66
80
|
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* An individual `Avatar` can still opt out of the group size — useful for
|
|
84
|
+
* highlighting "you" inside a roster.
|
|
85
|
+
*/
|
|
86
|
+
export const GroupSizeOverride: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<AvatarGroup max={4} spacing="tight" size="sm">
|
|
89
|
+
<Avatar size="lg">
|
|
90
|
+
<AvatarFallback>ME</AvatarFallback>
|
|
91
|
+
</Avatar>
|
|
92
|
+
{people.map((initials) => (
|
|
93
|
+
<Avatar key={initials}>
|
|
94
|
+
<AvatarFallback>{initials}</AvatarFallback>
|
|
95
|
+
</Avatar>
|
|
96
|
+
))}
|
|
97
|
+
</AvatarGroup>
|
|
98
|
+
),
|
|
99
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup } from "./avatar";
|
|
4
|
+
|
|
5
|
+
// Returned as an array, not a fragment: AvatarGroup counts its direct children,
|
|
6
|
+
// and a fragment would collapse the whole set into one child.
|
|
7
|
+
const members = (count: number) =>
|
|
8
|
+
Array.from({ length: count }, (_, i) => (
|
|
9
|
+
<Avatar key={i}>
|
|
10
|
+
<AvatarFallback>{String.fromCharCode(65 + i)}</AvatarFallback>
|
|
11
|
+
</Avatar>
|
|
12
|
+
));
|
|
13
|
+
|
|
14
|
+
const overflowChip = () => document.querySelector('[data-slot="avatar-group-overflow"]');
|
|
15
|
+
const avatars = () => Array.from(document.querySelectorAll('[data-slot="avatar"]'));
|
|
16
|
+
|
|
17
|
+
describe("Avatar", () => {
|
|
18
|
+
it("applies the default size scale when no size is given", () => {
|
|
19
|
+
render(
|
|
20
|
+
<Avatar>
|
|
21
|
+
<AvatarFallback>JD</AvatarFallback>
|
|
22
|
+
</Avatar>
|
|
23
|
+
);
|
|
24
|
+
expect(avatars()[0]).toHaveClass("size-10", "text-sm");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("applies an explicit size variant", () => {
|
|
28
|
+
render(
|
|
29
|
+
<Avatar size="xs">
|
|
30
|
+
<AvatarFallback>JD</AvatarFallback>
|
|
31
|
+
</Avatar>
|
|
32
|
+
);
|
|
33
|
+
expect(avatars()[0]).toHaveClass("size-6", "text-[10px]");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("scales AvatarBadge off the avatar size via context", () => {
|
|
37
|
+
render(
|
|
38
|
+
<Avatar size="xl">
|
|
39
|
+
<AvatarFallback>JD</AvatarFallback>
|
|
40
|
+
<AvatarBadge />
|
|
41
|
+
</Avatar>
|
|
42
|
+
);
|
|
43
|
+
expect(document.querySelector('[data-slot="avatar-badge"]')).toHaveClass("size-4");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("AvatarGroup", () => {
|
|
48
|
+
it("renders no overflow chip when the item count fits within max", () => {
|
|
49
|
+
render(
|
|
50
|
+
<AvatarGroup max={3}>
|
|
51
|
+
{members(3)}
|
|
52
|
+
</AvatarGroup>
|
|
53
|
+
);
|
|
54
|
+
expect(overflowChip()).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("renders a +N overflow chip for the hidden remainder", () => {
|
|
58
|
+
render(
|
|
59
|
+
<AvatarGroup max={2}>
|
|
60
|
+
{members(5)}
|
|
61
|
+
</AvatarGroup>
|
|
62
|
+
);
|
|
63
|
+
expect(screen.getByText("+3")).toBeInTheDocument();
|
|
64
|
+
expect(avatars()).toHaveLength(2);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("keeps the pre-existing chip appearance when no size is passed", () => {
|
|
68
|
+
render(
|
|
69
|
+
<AvatarGroup max={1}>
|
|
70
|
+
{members(3)}
|
|
71
|
+
</AvatarGroup>
|
|
72
|
+
);
|
|
73
|
+
expect(overflowChip()).toHaveClass("size-10", "text-xs");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it.each([
|
|
77
|
+
["xs", "size-6", "text-[9px]"],
|
|
78
|
+
["sm", "size-8", "text-[10px]"],
|
|
79
|
+
["default", "size-10", "text-xs"],
|
|
80
|
+
["lg", "size-12", "text-sm"],
|
|
81
|
+
["xl", "size-16", "text-base"],
|
|
82
|
+
] as const)("sizes the overflow chip to match a %s group", (size, sizeClass, textClass) => {
|
|
83
|
+
render(
|
|
84
|
+
<AvatarGroup max={1} size={size}>
|
|
85
|
+
{members(4)}
|
|
86
|
+
</AvatarGroup>
|
|
87
|
+
);
|
|
88
|
+
expect(overflowChip()).toHaveClass(sizeClass, textClass);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("passes the group size down to child avatars", () => {
|
|
92
|
+
render(
|
|
93
|
+
<AvatarGroup max={2} size="sm">
|
|
94
|
+
{members(4)}
|
|
95
|
+
</AvatarGroup>
|
|
96
|
+
);
|
|
97
|
+
for (const avatar of avatars()) {
|
|
98
|
+
expect(avatar).toHaveClass("size-8");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("lets an individual avatar override the group size", () => {
|
|
103
|
+
render(
|
|
104
|
+
<AvatarGroup size="sm">
|
|
105
|
+
<Avatar>
|
|
106
|
+
<AvatarFallback>A</AvatarFallback>
|
|
107
|
+
</Avatar>
|
|
108
|
+
<Avatar size="lg">
|
|
109
|
+
<AvatarFallback>B</AvatarFallback>
|
|
110
|
+
</Avatar>
|
|
111
|
+
</AvatarGroup>
|
|
112
|
+
);
|
|
113
|
+
const [inherited, overridden] = avatars();
|
|
114
|
+
expect(inherited).toHaveClass("size-8");
|
|
115
|
+
expect(overridden).toHaveClass("size-12");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("scales avatar and chip together so the group reads as one row", () => {
|
|
119
|
+
render(
|
|
120
|
+
<AvatarGroup max={2} size="xs">
|
|
121
|
+
{members(9)}
|
|
122
|
+
</AvatarGroup>
|
|
123
|
+
);
|
|
124
|
+
for (const avatar of avatars()) {
|
|
125
|
+
expect(avatar).toHaveClass("size-6");
|
|
126
|
+
}
|
|
127
|
+
expect(overflowChip()).toHaveClass("size-6");
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -23,22 +23,32 @@ const avatarVariants = cva(
|
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
type AvatarSize = NonNullable<VariantProps<typeof avatarVariants>["size"]>;
|
|
27
|
+
|
|
28
|
+
const AvatarContext = React.createContext<AvatarSize>("default");
|
|
27
29
|
|
|
28
30
|
const Avatar = React.forwardRef<
|
|
29
31
|
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
30
32
|
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> &
|
|
31
33
|
VariantProps<typeof avatarVariants>
|
|
32
|
-
>(({ className, size
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
>(({ className, size, ...props }, ref) => {
|
|
35
|
+
// An explicit `size` always wins; otherwise inherit from the nearest
|
|
36
|
+
// AvatarGroup (context defaults to "default", so a standalone Avatar with no
|
|
37
|
+
// size behaves exactly as before).
|
|
38
|
+
const inheritedSize = React.useContext(AvatarContext);
|
|
39
|
+
const resolvedSize = size ?? inheritedSize;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<AvatarContext.Provider value={resolvedSize}>
|
|
43
|
+
<AvatarPrimitive.Root
|
|
44
|
+
ref={ref}
|
|
45
|
+
data-slot="avatar"
|
|
46
|
+
className={cn(avatarVariants({ size: resolvedSize }), className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
</AvatarContext.Provider>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
42
52
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
43
53
|
|
|
44
54
|
const AvatarImage = React.forwardRef<
|
|
@@ -62,7 +72,7 @@ const AvatarFallback = React.forwardRef<
|
|
|
62
72
|
ref={ref}
|
|
63
73
|
data-slot="avatar-fallback"
|
|
64
74
|
className={cn(
|
|
65
|
-
"flex size-full items-center justify-center rounded-full bg-muted font-
|
|
75
|
+
"flex size-full items-center justify-center rounded-full bg-muted font-semibold text-muted-foreground",
|
|
66
76
|
className
|
|
67
77
|
)}
|
|
68
78
|
{...props}
|
|
@@ -85,14 +95,14 @@ const AvatarBadge = React.forwardRef<
|
|
|
85
95
|
tone?: "success" | "warning" | "destructive" | "muted";
|
|
86
96
|
}
|
|
87
97
|
>(({ className, placement = "bottom-right", tone = "success", ...props }, ref) => {
|
|
88
|
-
const size = React.useContext(AvatarContext)
|
|
98
|
+
const size = React.useContext(AvatarContext);
|
|
89
99
|
return (
|
|
90
100
|
<span
|
|
91
101
|
ref={ref}
|
|
92
102
|
data-slot="avatar-badge"
|
|
93
103
|
className={cn(
|
|
94
104
|
"absolute block rounded-full ring-background",
|
|
95
|
-
badgeOffset[size
|
|
105
|
+
badgeOffset[size],
|
|
96
106
|
placement === "top-right" ? "right-0 top-0" : "bottom-0 right-0",
|
|
97
107
|
tone === "success" && "bg-success",
|
|
98
108
|
tone === "warning" && "bg-warning",
|
|
@@ -106,37 +116,83 @@ const AvatarBadge = React.forwardRef<
|
|
|
106
116
|
});
|
|
107
117
|
AvatarBadge.displayName = "AvatarBadge";
|
|
108
118
|
|
|
119
|
+
// The "+N" chip tracks the group's avatar size. Its label sits one step below
|
|
120
|
+
// the matching Avatar text rung — a two-glyph "+12" needs more room inside the
|
|
121
|
+
// same circle than a one-glyph initial. `default` reproduces the pre-0.8
|
|
122
|
+
// hardcoded appearance (size-10 text-xs) exactly.
|
|
123
|
+
const avatarGroupOverflowVariants = cva(
|
|
124
|
+
"relative inline-flex shrink-0 items-center justify-center rounded-full bg-muted font-semibold text-muted-foreground ring-2 ring-background",
|
|
125
|
+
{
|
|
126
|
+
variants: {
|
|
127
|
+
size: {
|
|
128
|
+
xs: "size-6 text-[9px]",
|
|
129
|
+
sm: "size-8 text-[10px]",
|
|
130
|
+
default: "size-10 text-xs",
|
|
131
|
+
lg: "size-12 text-sm",
|
|
132
|
+
xl: "size-16 text-base",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
defaultVariants: {
|
|
136
|
+
size: "default",
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
|
|
109
141
|
const AvatarGroup = React.forwardRef<
|
|
110
142
|
HTMLDivElement,
|
|
111
|
-
React.HTMLAttributes<HTMLDivElement> & {
|
|
112
|
-
|
|
143
|
+
React.HTMLAttributes<HTMLDivElement> & {
|
|
144
|
+
max?: number;
|
|
145
|
+
spacing?: "tight" | "default" | "loose";
|
|
146
|
+
/**
|
|
147
|
+
* Size for the whole group: sets the "+N" overflow chip and is inherited by
|
|
148
|
+
* child `Avatar`s that don't set their own `size`. Defaults to "default".
|
|
149
|
+
*/
|
|
150
|
+
size?: AvatarSize;
|
|
151
|
+
}
|
|
152
|
+
>(({ className, children, max, spacing = "default", size, ...props }, ref) => {
|
|
153
|
+
const inheritedSize = React.useContext(AvatarContext);
|
|
154
|
+
const resolvedSize = size ?? inheritedSize;
|
|
113
155
|
const items = React.Children.toArray(children);
|
|
114
156
|
const visible = max ? items.slice(0, max) : items;
|
|
115
157
|
const overflow = max ? items.length - max : 0;
|
|
116
158
|
|
|
117
159
|
return (
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
160
|
+
<AvatarContext.Provider value={resolvedSize}>
|
|
161
|
+
<div
|
|
162
|
+
ref={ref}
|
|
163
|
+
data-slot="avatar-group"
|
|
164
|
+
className={cn(
|
|
165
|
+
"flex items-center",
|
|
166
|
+
spacing === "tight" && "-space-x-3",
|
|
167
|
+
spacing === "default" && "-space-x-2",
|
|
168
|
+
spacing === "loose" && "-space-x-1",
|
|
169
|
+
"[&>*]:ring-2 [&>*]:ring-background",
|
|
170
|
+
className
|
|
171
|
+
)}
|
|
172
|
+
{...props}
|
|
173
|
+
>
|
|
174
|
+
{visible}
|
|
175
|
+
{overflow > 0 && (
|
|
176
|
+
<span
|
|
177
|
+
data-slot="avatar-group-overflow"
|
|
178
|
+
className={avatarGroupOverflowVariants({ size: resolvedSize })}
|
|
179
|
+
>
|
|
180
|
+
+{overflow}
|
|
181
|
+
</span>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
</AvatarContext.Provider>
|
|
138
185
|
);
|
|
139
186
|
});
|
|
140
187
|
AvatarGroup.displayName = "AvatarGroup";
|
|
141
188
|
|
|
142
|
-
export {
|
|
189
|
+
export {
|
|
190
|
+
Avatar,
|
|
191
|
+
AvatarImage,
|
|
192
|
+
AvatarFallback,
|
|
193
|
+
AvatarBadge,
|
|
194
|
+
AvatarGroup,
|
|
195
|
+
avatarVariants,
|
|
196
|
+
avatarGroupOverflowVariants,
|
|
197
|
+
};
|
|
198
|
+
export type { AvatarSize };
|
package/src/components/badge.tsx
CHANGED
|
@@ -37,10 +37,22 @@ const badgeVariants = cva(
|
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
export interface BadgeProps
|
|
40
|
-
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
40
|
+
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
41
|
+
/**
|
|
42
|
+
* Element to render. Defaults to `div`.
|
|
43
|
+
*
|
|
44
|
+
* Use `"span"` when the badge sits inside a `<button>` or a `<p>` — their
|
|
45
|
+
* content model is phrasing content, so a `div` in there is invalid HTML.
|
|
46
|
+
* That is the common case for a badge sitting inline with a title on a
|
|
47
|
+
* clickable row.
|
|
48
|
+
*/
|
|
49
|
+
as?: "div" | "span";
|
|
50
|
+
}
|
|
41
51
|
|
|
42
|
-
function Badge({ className, variant, live, ...props }: BadgeProps) {
|
|
43
|
-
return
|
|
52
|
+
function Badge({ className, variant, live, as: Tag = "div", ...props }: BadgeProps) {
|
|
53
|
+
return (
|
|
54
|
+
<Tag data-slot="badge" className={cn(badgeVariants({ variant, live }), className)} {...props} />
|
|
55
|
+
);
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
export { Badge, badgeVariants };
|
|
@@ -59,7 +59,7 @@ function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
|
59
59
|
role="link"
|
|
60
60
|
aria-disabled="true"
|
|
61
61
|
aria-current="page"
|
|
62
|
-
className={cn("font-
|
|
62
|
+
className={cn("font-semibold text-foreground", className)}
|
|
63
63
|
{...props}
|
|
64
64
|
/>
|
|
65
65
|
);
|
|
@@ -6,7 +6,7 @@ import { cn } from "../lib/utils";
|
|
|
6
6
|
import { useHaptic } from "../hooks/use-haptic";
|
|
7
7
|
|
|
8
8
|
const buttonVariants = cva(
|
|
9
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-
|
|
9
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer [@media(pointer:coarse)]:active:scale-95",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
@@ -21,6 +21,21 @@ const buttonVariants = cva(
|
|
|
21
21
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
22
22
|
link: "text-primary underline-offset-4 hover:underline",
|
|
23
23
|
glass: "glass glass-hover text-foreground",
|
|
24
|
+
/**
|
|
25
|
+
* Chrome sitting ON a photo — share, close, favourite over a hero or
|
|
26
|
+
* card image. `glass` is the wrong tool there: it resolves
|
|
27
|
+
* `text-foreground`, which is near-black in light mode and disappears
|
|
28
|
+
* into a dark photo.
|
|
29
|
+
*
|
|
30
|
+
* Deliberately NOT theme-aware, and so deliberately different from
|
|
31
|
+
* `Badge`'s `overlay` (`bg-foreground/70 text-background`, which
|
|
32
|
+
* inverts). A photo is equally a photo in both themes — this chrome has
|
|
33
|
+
* to contrast with the image beneath it, not with the app canvas, so it
|
|
34
|
+
* stays dark-on-light-glyph either way. Reconcile Badge to this, not the
|
|
35
|
+
* reverse, if the two are ever unified.
|
|
36
|
+
*/
|
|
37
|
+
overlay:
|
|
38
|
+
"bg-black/40 text-white backdrop-blur-sm hover:bg-black/60 focus-visible:ring-white/70",
|
|
24
39
|
brown:
|
|
25
40
|
"bg-brown text-brown-foreground shadow-sm hover:bg-brown/85 hover:shadow",
|
|
26
41
|
antagonist:
|
|
@@ -58,7 +58,7 @@ function Calendar({
|
|
|
58
58
|
defaultClassNames.month_caption
|
|
59
59
|
),
|
|
60
60
|
dropdowns: cn(
|
|
61
|
-
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-
|
|
61
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-semibold",
|
|
62
62
|
defaultClassNames.dropdowns
|
|
63
63
|
),
|
|
64
64
|
dropdown_root: cn(
|
|
@@ -67,7 +67,7 @@ function Calendar({
|
|
|
67
67
|
),
|
|
68
68
|
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
69
69
|
caption_label: cn(
|
|
70
|
-
"font-
|
|
70
|
+
"font-semibold select-none",
|
|
71
71
|
captionLayout === "label"
|
|
72
72
|
? "text-sm"
|
|
73
73
|
: "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
@@ -89,7 +89,7 @@ const CircularProgress = React.forwardRef<HTMLDivElement, CircularProgressProps>
|
|
|
89
89
|
/>
|
|
90
90
|
</svg>
|
|
91
91
|
{showLabel && !indeterminate && (
|
|
92
|
-
<span className="absolute text-xs font-
|
|
92
|
+
<span className="absolute text-xs font-semibold tabular-nums text-foreground">
|
|
93
93
|
{Math.round(percent)}%
|
|
94
94
|
</span>
|
|
95
95
|
)}
|
|
@@ -41,7 +41,7 @@ const CommandDialog = ({
|
|
|
41
41
|
<DialogTitle>{title}</DialogTitle>
|
|
42
42
|
<DialogDescription>{description}</DialogDescription>
|
|
43
43
|
</DialogHeader>
|
|
44
|
-
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-
|
|
44
|
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
45
45
|
{children}
|
|
46
46
|
</Command>
|
|
47
47
|
</DialogContent>
|
|
@@ -110,7 +110,7 @@ const CommandGroup = React.forwardRef<
|
|
|
110
110
|
<CommandPrimitive.Group
|
|
111
111
|
ref={ref}
|
|
112
112
|
className={cn(
|
|
113
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-
|
|
113
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
114
114
|
className
|
|
115
115
|
)}
|
|
116
116
|
{...props}
|
|
@@ -139,7 +139,7 @@ const CurrencyInput = React.forwardRef<HTMLInputElement, CurrencyInputProps>(
|
|
|
139
139
|
<div className="relative">
|
|
140
140
|
<span
|
|
141
141
|
aria-hidden
|
|
142
|
-
className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm font-
|
|
142
|
+
className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm font-semibold text-muted-foreground"
|
|
143
143
|
>
|
|
144
144
|
{currency}
|
|
145
145
|
</span>
|
|
@@ -40,7 +40,7 @@ const DescriptionTerm = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLE
|
|
|
40
40
|
<dt
|
|
41
41
|
ref={ref as React.Ref<HTMLElement>}
|
|
42
42
|
data-slot="description-term"
|
|
43
|
-
className={cn("text-xs font-
|
|
43
|
+
className={cn("text-xs font-semibold uppercase tracking-wide text-muted-foreground", className)}
|
|
44
44
|
{...props}
|
|
45
45
|
/>
|
|
46
46
|
)
|
|
@@ -161,7 +161,7 @@ function DropdownMenuLabel({
|
|
|
161
161
|
<DropdownMenuPrimitive.Label
|
|
162
162
|
data-slot="dropdown-menu-label"
|
|
163
163
|
data-inset={inset}
|
|
164
|
-
className={cn("px-2 py-1.5 text-sm font-
|
|
164
|
+
className={cn("px-2 py-1.5 text-sm font-semibold data-[inset]:pl-8", className)}
|
|
165
165
|
{...props}
|
|
166
166
|
/>
|
|
167
167
|
);
|
package/src/components/field.tsx
CHANGED
|
@@ -136,7 +136,7 @@ const FieldLegend = React.forwardRef<HTMLLegendElement, React.HTMLAttributes<HTM
|
|
|
136
136
|
<legend
|
|
137
137
|
ref={ref}
|
|
138
138
|
data-slot="field-legend"
|
|
139
|
-
className={cn("px-1 text-sm font-
|
|
139
|
+
className={cn("px-1 text-sm font-semibold text-foreground", className)}
|
|
140
140
|
{...props}
|
|
141
141
|
/>
|
|
142
142
|
)
|
|
@@ -92,7 +92,7 @@ const InputGroupButton = React.forwardRef<HTMLButtonElement, React.ButtonHTMLAtt
|
|
|
92
92
|
type={type}
|
|
93
93
|
data-slot="input-group-button"
|
|
94
94
|
className={cn(
|
|
95
|
-
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-
|
|
95
|
+
"inline-flex h-7 min-w-7 cursor-pointer items-center justify-center gap-1 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&:has(svg:only-child)]:w-7 [&:has(svg:only-child)]:px-0 [&_svg]:size-4",
|
|
96
96
|
className
|
|
97
97
|
)}
|
|
98
98
|
{...props}
|
package/src/components/input.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "../lib/utils";
|
|
4
4
|
|
|
5
5
|
const inputVariants = cva(
|
|
6
|
-
"flex w-full border border-border bg-input/50 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-
|
|
6
|
+
"flex w-full border border-border bg-input/50 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-semibold file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:bg-input disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/40",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
package/src/components/item.tsx
CHANGED
|
@@ -81,7 +81,7 @@ const ItemTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivE
|
|
|
81
81
|
<div
|
|
82
82
|
ref={ref}
|
|
83
83
|
data-slot="item-title"
|
|
84
|
-
className={cn("truncate text-sm font-
|
|
84
|
+
className={cn("truncate text-sm font-semibold text-foreground", className)}
|
|
85
85
|
{...props}
|
|
86
86
|
/>
|
|
87
87
|
)
|
package/src/components/kbd.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import { cn } from "../lib/utils";
|
|
4
4
|
|
|
5
5
|
const kbdVariants = cva(
|
|
6
|
-
"inline-flex select-none items-center justify-center gap-1 rounded-md border border-border bg-muted font-mono font-
|
|
6
|
+
"inline-flex select-none items-center justify-center gap-1 rounded-md border border-border bg-muted font-mono font-semibold text-muted-foreground shadow-[0_1px_0_0_var(--border)]",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
package/src/components/label.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
6
6
|
import { cn } from "../lib/utils";
|
|
7
7
|
|
|
8
8
|
const labelVariants = cva(
|
|
9
|
-
"text-sm font-
|
|
9
|
+
"text-sm font-semibold leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 transition-all duration-200"
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const Label = React.forwardRef<
|