@majapisoftwares/ui 6.3.0 → 6.5.0
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/AGENTS.md +27 -27
- package/README.md +79 -79
- package/THIRD_PARTY_NOTICES.md +39 -39
- package/components.json +25 -25
- package/docs/MIGRATION-0.2.md +20 -20
- package/docs/MIGRATION-6.0.md +33 -33
- package/docs/NEXT-STARTER-VALIDATION.md +14 -14
- package/docs/STANDARDS.md +65 -51
- package/docs/VALIDATION.md +11 -11
- package/docs/VERSIONING.md +32 -28
- package/docs/validation/preference-titles.md +22 -22
- package/package.json +91 -89
- package/scripts/check-standards.mjs +41 -41
- package/src/components/ui/accordion.tsx +82 -82
- package/src/components/ui/alert-dialog.tsx +187 -187
- package/src/components/ui/alert.tsx +77 -77
- package/src/components/ui/attachment.tsx +209 -0
- package/src/components/ui/avatar.tsx +108 -108
- package/src/components/ui/badge.tsx +55 -55
- package/src/components/ui/breadcrumb.tsx +125 -125
- package/src/components/ui/bubble.tsx +129 -0
- package/src/components/ui/button-group.tsx +89 -89
- package/src/components/ui/button.tsx +59 -59
- package/src/components/ui/card.tsx +101 -101
- package/src/components/ui/checkbox.tsx +27 -27
- package/src/components/ui/collapsible.tsx +21 -21
- package/src/components/ui/context-menu.tsx +271 -271
- package/src/components/ui/dialog.tsx +161 -161
- package/src/components/ui/dropdown-menu.tsx +271 -271
- package/src/components/ui/empty.tsx +105 -105
- package/src/components/ui/field.tsx +238 -238
- package/src/components/ui/hover-card.tsx +50 -50
- package/src/components/ui/input-group.tsx +155 -155
- package/src/components/ui/input.tsx +21 -21
- package/src/components/ui/item.tsx +203 -0
- package/src/components/ui/kbd.tsx +28 -28
- package/src/components/ui/label.tsx +19 -19
- package/src/components/ui/message-scroller.tsx +166 -0
- package/src/components/ui/message.tsx +93 -0
- package/src/components/ui/orb.css +1002 -1002
- package/src/components/ui/orb.tsx +752 -752
- package/src/components/ui/popover.tsx +89 -89
- package/src/components/ui/progress.tsx +82 -82
- package/src/components/ui/radio-group.tsx +37 -37
- package/src/components/ui/scroll-area.tsx +54 -54
- package/src/components/ui/select.tsx +204 -204
- package/src/components/ui/separator.tsx +24 -24
- package/src/components/ui/sheet.tsx +139 -139
- package/src/components/ui/sidebar.tsx +1048 -1048
- package/src/components/ui/skeleton.tsx +15 -15
- package/src/components/ui/slider.tsx +53 -53
- package/src/components/ui/sonner.tsx +44 -44
- package/src/components/ui/spinner.tsx +32 -32
- package/src/components/ui/switch.tsx +31 -31
- package/src/components/ui/table.tsx +121 -121
- package/src/components/ui/tabs.tsx +81 -81
- package/src/components/ui/textarea.tsx +19 -19
- package/src/components/ui/toggle-group.tsx +89 -89
- package/src/components/ui/toggle.tsx +44 -44
- package/src/components/ui/tooltip.tsx +65 -65
- package/src/components/ui/trace.tsx +163 -0
- package/src/hooks/use-mobile.ts +20 -20
- package/src/hooks/use-streamed-text.ts +64 -0
- package/src/lib/i18n.tsx +151 -109
- package/src/lib/utils.ts +1 -1
- package/src/patterns/app-shell.tsx +237 -237
- package/src/patterns/chat-markdown.tsx +72 -0
- package/src/patterns/chat-trace.tsx +200 -0
- package/src/patterns/chat.tsx +317 -0
- package/src/patterns/data-table.tsx +2492 -2492
- package/src/patterns/filter-tabs.tsx +53 -53
- package/src/patterns/majapi-logo.tsx +32 -32
- package/src/patterns/page-header.tsx +62 -62
- package/src/patterns/prompt-input.tsx +374 -0
- package/src/patterns/status-badge.tsx +24 -24
- package/src/patterns/user-menu.tsx +218 -218
- package/src/patterns/workspace-switcher.tsx +176 -176
- package/src/styles.css +170 -165
- package/src/templates/admin-dashboard.tsx +44 -44
- package/src/templates/auth-layout.tsx +30 -30
- package/src/templates/signup-form.tsx +177 -177
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
-
import { cn } from "cn";
|
|
7
|
-
|
|
8
|
-
const badgeVariants = cva(
|
|
9
|
-
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-3xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
success: "bg-success text-success-foreground",
|
|
14
|
-
warning: "bg-warning text-warning-foreground",
|
|
15
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
16
|
-
secondary:
|
|
17
|
-
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
18
|
-
destructive:
|
|
19
|
-
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
20
|
-
outline:
|
|
21
|
-
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
22
|
-
ghost:
|
|
23
|
-
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
24
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
variant: "default",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
function Badge({
|
|
34
|
-
className,
|
|
35
|
-
variant = "default",
|
|
36
|
-
render,
|
|
37
|
-
...props
|
|
38
|
-
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
39
|
-
return useRender({
|
|
40
|
-
defaultTagName: "span",
|
|
41
|
-
props: mergeProps<"span">(
|
|
42
|
-
{
|
|
43
|
-
className: cn(badgeVariants({ variant }), className),
|
|
44
|
-
},
|
|
45
|
-
props,
|
|
46
|
-
),
|
|
47
|
-
render,
|
|
48
|
-
state: {
|
|
49
|
-
slot: "badge",
|
|
50
|
-
variant,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { Badge, badgeVariants };
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { cn } from "cn";
|
|
7
|
+
|
|
8
|
+
const badgeVariants = cva(
|
|
9
|
+
"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-3xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
success: "bg-success text-success-foreground",
|
|
14
|
+
warning: "bg-warning text-warning-foreground",
|
|
15
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
16
|
+
secondary:
|
|
17
|
+
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
18
|
+
destructive:
|
|
19
|
+
"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
20
|
+
outline:
|
|
21
|
+
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
22
|
+
ghost:
|
|
23
|
+
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
24
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "default",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
function Badge({
|
|
34
|
+
className,
|
|
35
|
+
variant = "default",
|
|
36
|
+
render,
|
|
37
|
+
...props
|
|
38
|
+
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
39
|
+
return useRender({
|
|
40
|
+
defaultTagName: "span",
|
|
41
|
+
props: mergeProps<"span">(
|
|
42
|
+
{
|
|
43
|
+
className: cn(badgeVariants({ variant }), className),
|
|
44
|
+
},
|
|
45
|
+
props,
|
|
46
|
+
),
|
|
47
|
+
render,
|
|
48
|
+
state: {
|
|
49
|
+
slot: "badge",
|
|
50
|
+
variant,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { Badge, badgeVariants };
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
-
import { cn } from "cn";
|
|
7
|
-
import { useUiMessages } from "../../lib/i18n";
|
|
8
|
-
import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
9
|
-
|
|
10
|
-
function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
|
|
11
|
-
return (
|
|
12
|
-
<nav
|
|
13
|
-
aria-label="breadcrumb"
|
|
14
|
-
data-slot="breadcrumb"
|
|
15
|
-
className={cn(className)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
22
|
-
return (
|
|
23
|
-
<ol
|
|
24
|
-
data-slot="breadcrumb-list"
|
|
25
|
-
className={cn(
|
|
26
|
-
"flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5",
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
35
|
-
return (
|
|
36
|
-
<li
|
|
37
|
-
data-slot="breadcrumb-item"
|
|
38
|
-
className={cn("inline-flex items-center gap-1.5", className)}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function BreadcrumbLink({
|
|
45
|
-
className,
|
|
46
|
-
render,
|
|
47
|
-
...props
|
|
48
|
-
}: useRender.ComponentProps<"a">) {
|
|
49
|
-
return useRender({
|
|
50
|
-
defaultTagName: "a",
|
|
51
|
-
props: mergeProps<"a">(
|
|
52
|
-
{
|
|
53
|
-
className: cn("transition-colors hover:text-foreground", className),
|
|
54
|
-
},
|
|
55
|
-
props,
|
|
56
|
-
),
|
|
57
|
-
render,
|
|
58
|
-
state: {
|
|
59
|
-
slot: "breadcrumb-link",
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
65
|
-
return (
|
|
66
|
-
<span
|
|
67
|
-
data-slot="breadcrumb-page"
|
|
68
|
-
role="link"
|
|
69
|
-
aria-disabled="true"
|
|
70
|
-
aria-current="page"
|
|
71
|
-
className={cn("font-normal text-foreground", className)}
|
|
72
|
-
{...props}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function BreadcrumbSeparator({
|
|
78
|
-
children,
|
|
79
|
-
className,
|
|
80
|
-
...props
|
|
81
|
-
}: React.ComponentProps<"li">) {
|
|
82
|
-
return (
|
|
83
|
-
<li
|
|
84
|
-
data-slot="breadcrumb-separator"
|
|
85
|
-
role="presentation"
|
|
86
|
-
aria-hidden="true"
|
|
87
|
-
className={cn("[&>svg]:size-3.5", className)}
|
|
88
|
-
{...props}
|
|
89
|
-
>
|
|
90
|
-
{children ?? <ChevronRightIcon />}
|
|
91
|
-
</li>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function BreadcrumbEllipsis({
|
|
96
|
-
className,
|
|
97
|
-
...props
|
|
98
|
-
}: React.ComponentProps<"span">) {
|
|
99
|
-
const messages = useUiMessages();
|
|
100
|
-
return (
|
|
101
|
-
<span
|
|
102
|
-
data-slot="breadcrumb-ellipsis"
|
|
103
|
-
role="presentation"
|
|
104
|
-
aria-hidden="true"
|
|
105
|
-
className={cn(
|
|
106
|
-
"flex size-5 items-center justify-center [&>svg]:size-4",
|
|
107
|
-
className,
|
|
108
|
-
)}
|
|
109
|
-
{...props}
|
|
110
|
-
>
|
|
111
|
-
<MoreHorizontalIcon />
|
|
112
|
-
<span className="sr-only">{messages.more}</span>
|
|
113
|
-
</span>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export {
|
|
118
|
-
Breadcrumb,
|
|
119
|
-
BreadcrumbList,
|
|
120
|
-
BreadcrumbItem,
|
|
121
|
-
BreadcrumbLink,
|
|
122
|
-
BreadcrumbPage,
|
|
123
|
-
BreadcrumbSeparator,
|
|
124
|
-
BreadcrumbEllipsis,
|
|
125
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
import { cn } from "cn";
|
|
7
|
+
import { useUiMessages } from "../../lib/i18n";
|
|
8
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
9
|
+
|
|
10
|
+
function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
|
|
11
|
+
return (
|
|
12
|
+
<nav
|
|
13
|
+
aria-label="breadcrumb"
|
|
14
|
+
data-slot="breadcrumb"
|
|
15
|
+
className={cn(className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
22
|
+
return (
|
|
23
|
+
<ol
|
|
24
|
+
data-slot="breadcrumb-list"
|
|
25
|
+
className={cn(
|
|
26
|
+
"flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
35
|
+
return (
|
|
36
|
+
<li
|
|
37
|
+
data-slot="breadcrumb-item"
|
|
38
|
+
className={cn("inline-flex items-center gap-1.5", className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function BreadcrumbLink({
|
|
45
|
+
className,
|
|
46
|
+
render,
|
|
47
|
+
...props
|
|
48
|
+
}: useRender.ComponentProps<"a">) {
|
|
49
|
+
return useRender({
|
|
50
|
+
defaultTagName: "a",
|
|
51
|
+
props: mergeProps<"a">(
|
|
52
|
+
{
|
|
53
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
54
|
+
},
|
|
55
|
+
props,
|
|
56
|
+
),
|
|
57
|
+
render,
|
|
58
|
+
state: {
|
|
59
|
+
slot: "breadcrumb-link",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
65
|
+
return (
|
|
66
|
+
<span
|
|
67
|
+
data-slot="breadcrumb-page"
|
|
68
|
+
role="link"
|
|
69
|
+
aria-disabled="true"
|
|
70
|
+
aria-current="page"
|
|
71
|
+
className={cn("font-normal text-foreground", className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function BreadcrumbSeparator({
|
|
78
|
+
children,
|
|
79
|
+
className,
|
|
80
|
+
...props
|
|
81
|
+
}: React.ComponentProps<"li">) {
|
|
82
|
+
return (
|
|
83
|
+
<li
|
|
84
|
+
data-slot="breadcrumb-separator"
|
|
85
|
+
role="presentation"
|
|
86
|
+
aria-hidden="true"
|
|
87
|
+
className={cn("[&>svg]:size-3.5", className)}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
{children ?? <ChevronRightIcon />}
|
|
91
|
+
</li>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function BreadcrumbEllipsis({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<"span">) {
|
|
99
|
+
const messages = useUiMessages();
|
|
100
|
+
return (
|
|
101
|
+
<span
|
|
102
|
+
data-slot="breadcrumb-ellipsis"
|
|
103
|
+
role="presentation"
|
|
104
|
+
aria-hidden="true"
|
|
105
|
+
className={cn(
|
|
106
|
+
"flex size-5 items-center justify-center [&>svg]:size-4",
|
|
107
|
+
className,
|
|
108
|
+
)}
|
|
109
|
+
{...props}
|
|
110
|
+
>
|
|
111
|
+
<MoreHorizontalIcon />
|
|
112
|
+
<span className="sr-only">{messages.more}</span>
|
|
113
|
+
</span>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
Breadcrumb,
|
|
119
|
+
BreadcrumbList,
|
|
120
|
+
BreadcrumbItem,
|
|
121
|
+
BreadcrumbLink,
|
|
122
|
+
BreadcrumbPage,
|
|
123
|
+
BreadcrumbSeparator,
|
|
124
|
+
BreadcrumbEllipsis,
|
|
125
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
7
|
+
import { cn } from "cn";
|
|
8
|
+
|
|
9
|
+
function BubbleGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-slot="bubble-group"
|
|
13
|
+
className={cn("flex min-w-0 flex-col gap-2", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const bubbleVariants = cva(
|
|
20
|
+
"group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
default:
|
|
25
|
+
"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
|
|
26
|
+
secondary:
|
|
27
|
+
"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
|
|
28
|
+
muted:
|
|
29
|
+
"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
|
|
30
|
+
tinted:
|
|
31
|
+
"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
|
|
32
|
+
outline:
|
|
33
|
+
"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
|
|
34
|
+
ghost:
|
|
35
|
+
"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
|
|
36
|
+
destructive:
|
|
37
|
+
"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: "default",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
function Bubble({
|
|
47
|
+
variant = "default",
|
|
48
|
+
align = "start",
|
|
49
|
+
className,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<"div"> &
|
|
52
|
+
VariantProps<typeof bubbleVariants> & {
|
|
53
|
+
align?: "start" | "end";
|
|
54
|
+
}) {
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
data-slot="bubble"
|
|
58
|
+
data-variant={variant}
|
|
59
|
+
data-align={align}
|
|
60
|
+
className={cn(bubbleVariants({ variant }), className)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function BubbleContent({
|
|
67
|
+
className,
|
|
68
|
+
render,
|
|
69
|
+
...props
|
|
70
|
+
}: useRender.ComponentProps<"div">) {
|
|
71
|
+
return useRender({
|
|
72
|
+
defaultTagName: "div",
|
|
73
|
+
props: mergeProps<"div">(
|
|
74
|
+
{
|
|
75
|
+
className: cn(
|
|
76
|
+
"w-fit max-w-full min-w-0 overflow-hidden rounded-3xl border border-transparent px-3.5 py-2.5 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/30",
|
|
77
|
+
className,
|
|
78
|
+
),
|
|
79
|
+
},
|
|
80
|
+
props,
|
|
81
|
+
),
|
|
82
|
+
render,
|
|
83
|
+
state: {
|
|
84
|
+
slot: "bubble-content",
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const bubbleReactionsVariants = cva(
|
|
90
|
+
"absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",
|
|
91
|
+
{
|
|
92
|
+
variants: {
|
|
93
|
+
side: {
|
|
94
|
+
top: "top-0 -translate-y-3/4",
|
|
95
|
+
bottom: "bottom-0 translate-y-3/4",
|
|
96
|
+
},
|
|
97
|
+
align: {
|
|
98
|
+
start: "left-3",
|
|
99
|
+
end: "right-3",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
defaultVariants: {
|
|
103
|
+
side: "bottom",
|
|
104
|
+
align: "end",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
function BubbleReactions({
|
|
110
|
+
side = "bottom",
|
|
111
|
+
align = "end",
|
|
112
|
+
className,
|
|
113
|
+
...props
|
|
114
|
+
}: React.ComponentProps<"div"> & {
|
|
115
|
+
align?: "start" | "end";
|
|
116
|
+
side?: "top" | "bottom";
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<div
|
|
120
|
+
data-slot="bubble-reactions"
|
|
121
|
+
data-align={align}
|
|
122
|
+
data-side={side}
|
|
123
|
+
className={cn(bubbleReactionsVariants({ side, align }), className)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { BubbleGroup, Bubble, BubbleContent, BubbleReactions };
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
-
import { cn } from "cn";
|
|
7
|
-
|
|
8
|
-
import { Separator } from "./separator";
|
|
9
|
-
|
|
10
|
-
const buttonGroupVariants = cva(
|
|
11
|
-
"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[>[data-variant=outline]]:*:data-[slot=input-group]:border-border has-[>[data-variant=outline]]:*:data-[slot=select-trigger]:border-border has-[>[data-variant=outline]]:[&>[data-slot=input-group]:has(:focus-visible)]:border-ring has-[>[data-variant=outline]]:[&>[data-slot=select-trigger]:focus-visible]:border-ring has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-4xl [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-variant=outline]]:[&>input]:border-border has-[>[data-variant=outline]]:[&>input:focus-visible]:border-ring",
|
|
12
|
-
{
|
|
13
|
-
variants: {
|
|
14
|
-
orientation: {
|
|
15
|
-
horizontal:
|
|
16
|
-
"*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-4xl! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
17
|
-
vertical:
|
|
18
|
-
"flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-4xl! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
defaultVariants: {
|
|
22
|
-
orientation: "horizontal",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
function ButtonGroup({
|
|
28
|
-
className,
|
|
29
|
-
orientation,
|
|
30
|
-
...props
|
|
31
|
-
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
role="group"
|
|
35
|
-
data-slot="button-group"
|
|
36
|
-
data-orientation={orientation}
|
|
37
|
-
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function ButtonGroupText({
|
|
44
|
-
className,
|
|
45
|
-
render,
|
|
46
|
-
...props
|
|
47
|
-
}: useRender.ComponentProps<"div">) {
|
|
48
|
-
return useRender({
|
|
49
|
-
defaultTagName: "div",
|
|
50
|
-
props: mergeProps<"div">(
|
|
51
|
-
{
|
|
52
|
-
className: cn(
|
|
53
|
-
"flex items-center gap-2 rounded-4xl border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
-
className,
|
|
55
|
-
),
|
|
56
|
-
},
|
|
57
|
-
props,
|
|
58
|
-
),
|
|
59
|
-
render,
|
|
60
|
-
state: {
|
|
61
|
-
slot: "button-group-text",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function ButtonGroupSeparator({
|
|
67
|
-
className,
|
|
68
|
-
orientation = "vertical",
|
|
69
|
-
...props
|
|
70
|
-
}: React.ComponentProps<typeof Separator>) {
|
|
71
|
-
return (
|
|
72
|
-
<Separator
|
|
73
|
-
data-slot="button-group-separator"
|
|
74
|
-
orientation={orientation}
|
|
75
|
-
className={cn(
|
|
76
|
-
"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
|
|
77
|
-
className,
|
|
78
|
-
)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
ButtonGroup,
|
|
86
|
-
ButtonGroupSeparator,
|
|
87
|
-
ButtonGroupText,
|
|
88
|
-
buttonGroupVariants,
|
|
89
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { cn } from "cn";
|
|
7
|
+
|
|
8
|
+
import { Separator } from "./separator";
|
|
9
|
+
|
|
10
|
+
const buttonGroupVariants = cva(
|
|
11
|
+
"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[>[data-variant=outline]]:*:data-[slot=input-group]:border-border has-[>[data-variant=outline]]:*:data-[slot=select-trigger]:border-border has-[>[data-variant=outline]]:[&>[data-slot=input-group]:has(:focus-visible)]:border-ring has-[>[data-variant=outline]]:[&>[data-slot=select-trigger]:focus-visible]:border-ring has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-4xl [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-variant=outline]]:[&>input]:border-border has-[>[data-variant=outline]]:[&>input:focus-visible]:border-ring",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
orientation: {
|
|
15
|
+
horizontal:
|
|
16
|
+
"*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-4xl! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
17
|
+
vertical:
|
|
18
|
+
"flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-4xl! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
orientation: "horizontal",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
function ButtonGroup({
|
|
28
|
+
className,
|
|
29
|
+
orientation,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
role="group"
|
|
35
|
+
data-slot="button-group"
|
|
36
|
+
data-orientation={orientation}
|
|
37
|
+
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function ButtonGroupText({
|
|
44
|
+
className,
|
|
45
|
+
render,
|
|
46
|
+
...props
|
|
47
|
+
}: useRender.ComponentProps<"div">) {
|
|
48
|
+
return useRender({
|
|
49
|
+
defaultTagName: "div",
|
|
50
|
+
props: mergeProps<"div">(
|
|
51
|
+
{
|
|
52
|
+
className: cn(
|
|
53
|
+
"flex items-center gap-2 rounded-4xl border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
+
className,
|
|
55
|
+
),
|
|
56
|
+
},
|
|
57
|
+
props,
|
|
58
|
+
),
|
|
59
|
+
render,
|
|
60
|
+
state: {
|
|
61
|
+
slot: "button-group-text",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function ButtonGroupSeparator({
|
|
67
|
+
className,
|
|
68
|
+
orientation = "vertical",
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
71
|
+
return (
|
|
72
|
+
<Separator
|
|
73
|
+
data-slot="button-group-separator"
|
|
74
|
+
orientation={orientation}
|
|
75
|
+
className={cn(
|
|
76
|
+
"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
|
|
77
|
+
className,
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
ButtonGroup,
|
|
86
|
+
ButtonGroupSeparator,
|
|
87
|
+
ButtonGroupText,
|
|
88
|
+
buttonGroupVariants,
|
|
89
|
+
};
|