@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,28 +1,28 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "cn";
|
|
4
|
-
|
|
5
|
-
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
6
|
-
return (
|
|
7
|
-
<kbd
|
|
8
|
-
data-slot="kbd"
|
|
9
|
-
className={cn(
|
|
10
|
-
"pointer-events-none inline-flex h-5.5 w-fit min-w-5.5 items-center justify-center gap-1 rounded-lg bg-muted px-1.5 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=input-group]:bg-input in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
|
|
11
|
-
className,
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
-
return (
|
|
20
|
-
<kbd
|
|
21
|
-
data-slot="kbd-group"
|
|
22
|
-
className={cn("inline-flex items-center gap-1", className)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { Kbd, KbdGroup };
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
|
|
5
|
+
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
6
|
+
return (
|
|
7
|
+
<kbd
|
|
8
|
+
data-slot="kbd"
|
|
9
|
+
className={cn(
|
|
10
|
+
"pointer-events-none inline-flex h-5.5 w-fit min-w-5.5 items-center justify-center gap-1 rounded-lg bg-muted px-1.5 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=input-group]:bg-input in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
|
|
11
|
+
className,
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<kbd
|
|
21
|
+
data-slot="kbd-group"
|
|
22
|
+
className={cn("inline-flex items-center gap-1", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Kbd, KbdGroup };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cn } from "cn";
|
|
5
|
-
|
|
6
|
-
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
7
|
-
return (
|
|
8
|
-
<label
|
|
9
|
-
data-slot="label"
|
|
10
|
-
className={cn(
|
|
11
|
-
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
12
|
-
className,
|
|
13
|
-
)}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Label };
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
|
|
6
|
+
function Label({ className, ...props }: React.ComponentProps<"label">) {
|
|
7
|
+
return (
|
|
8
|
+
<label
|
|
9
|
+
data-slot="label"
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Label };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
MessageScroller as MessageScrollerPrimitive,
|
|
6
|
+
useMessageScroller,
|
|
7
|
+
useMessageScrollerScrollable,
|
|
8
|
+
useMessageScrollerVisibility,
|
|
9
|
+
} from "@shadcn/react/message-scroller";
|
|
10
|
+
import { cn } from "cn";
|
|
11
|
+
|
|
12
|
+
import { Button } from "./button";
|
|
13
|
+
import { ArrowDownIcon } from "lucide-react";
|
|
14
|
+
import { useUiMessages } from "../../lib/i18n";
|
|
15
|
+
|
|
16
|
+
function MessageScrollerProvider(
|
|
17
|
+
props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>,
|
|
18
|
+
) {
|
|
19
|
+
return <MessageScrollerPrimitive.Provider {...props} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function MessageScroller({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
|
|
26
|
+
return (
|
|
27
|
+
<MessageScrollerPrimitive.Root
|
|
28
|
+
data-slot="message-scroller"
|
|
29
|
+
className={cn(
|
|
30
|
+
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function MessageScrollerViewport({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
|
|
42
|
+
const messages = useUiMessages();
|
|
43
|
+
return (
|
|
44
|
+
<MessageScrollerPrimitive.Viewport
|
|
45
|
+
data-slot="message-scroller-viewport"
|
|
46
|
+
aria-label={messages.messages}
|
|
47
|
+
className={cn(
|
|
48
|
+
"size-full min-h-0 min-w-0 scroll-fade-b overflow-y-auto overscroll-contain [scrollbar-gutter:stable] contain-content data-autoscrolling:[scrollbar-color:transparent_transparent] data-pending-scroll:invisible",
|
|
49
|
+
className,
|
|
50
|
+
)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function MessageScrollerContent({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
|
|
60
|
+
return (
|
|
61
|
+
<MessageScrollerPrimitive.Content
|
|
62
|
+
data-slot="message-scroller-content"
|
|
63
|
+
// Majapi UI: p-2 makes room for the items' paint margin (below), so it
|
|
64
|
+
// never overflows the viewport sideways.
|
|
65
|
+
className={cn("flex h-max min-h-full flex-col gap-8 p-2", className)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function MessageScrollerItem({
|
|
72
|
+
className,
|
|
73
|
+
scrollAnchor = false,
|
|
74
|
+
...props
|
|
75
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
|
|
76
|
+
return (
|
|
77
|
+
<MessageScrollerPrimitive.Item
|
|
78
|
+
data-slot="message-scroller-item"
|
|
79
|
+
scrollAnchor={scrollAnchor}
|
|
80
|
+
// Majapi UI: content-visibility:auto always applies paint containment,
|
|
81
|
+
// which clips shadows and focus rings at the row's edges. -m-2 p-2
|
|
82
|
+
// gives every row an 8px paint margin without moving its content.
|
|
83
|
+
className={cn(
|
|
84
|
+
"-m-2 min-w-0 shrink-0 p-2 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
85
|
+
className,
|
|
86
|
+
)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function MessageScrollerButton({
|
|
93
|
+
direction = "end",
|
|
94
|
+
className,
|
|
95
|
+
children,
|
|
96
|
+
render,
|
|
97
|
+
variant = "secondary",
|
|
98
|
+
size = "icon-sm",
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
|
|
101
|
+
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
102
|
+
const messages = useUiMessages();
|
|
103
|
+
return (
|
|
104
|
+
<MessageScrollerPrimitive.Button
|
|
105
|
+
data-slot="message-scroller-button"
|
|
106
|
+
data-direction={direction}
|
|
107
|
+
data-variant={variant}
|
|
108
|
+
data-size={size}
|
|
109
|
+
direction={direction}
|
|
110
|
+
className={cn(
|
|
111
|
+
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
112
|
+
className,
|
|
113
|
+
)}
|
|
114
|
+
render={render ?? <Button variant={variant} size={size} />}
|
|
115
|
+
{...props}
|
|
116
|
+
>
|
|
117
|
+
{children ?? (
|
|
118
|
+
<>
|
|
119
|
+
<ArrowDownIcon />
|
|
120
|
+
<span className="sr-only">
|
|
121
|
+
{direction === "end"
|
|
122
|
+
? messages.scrollToEnd
|
|
123
|
+
: messages.scrollToStart}
|
|
124
|
+
</span>
|
|
125
|
+
</>
|
|
126
|
+
)}
|
|
127
|
+
</MessageScrollerPrimitive.Button>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Width of the viewport's reserved scrollbar gutter (from Numa). Content
|
|
133
|
+
* outside the viewport, such as a composer, pads its inline end by this
|
|
134
|
+
* amount to stay aligned with the transcript.
|
|
135
|
+
*/
|
|
136
|
+
function useMessageScrollerGutterWidth(
|
|
137
|
+
viewportRef: React.RefObject<HTMLElement | null>,
|
|
138
|
+
) {
|
|
139
|
+
const [width, setWidth] = React.useState(0);
|
|
140
|
+
|
|
141
|
+
React.useEffect(() => {
|
|
142
|
+
const viewport = viewportRef.current;
|
|
143
|
+
if (!viewport) return;
|
|
144
|
+
const sync = () =>
|
|
145
|
+
setWidth(Math.max(0, viewport.offsetWidth - viewport.clientWidth));
|
|
146
|
+
sync();
|
|
147
|
+
const observer = new ResizeObserver(sync);
|
|
148
|
+
observer.observe(viewport);
|
|
149
|
+
return () => observer.disconnect();
|
|
150
|
+
}, [viewportRef]);
|
|
151
|
+
|
|
152
|
+
return width;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
MessageScrollerProvider,
|
|
157
|
+
MessageScroller,
|
|
158
|
+
MessageScrollerViewport,
|
|
159
|
+
MessageScrollerContent,
|
|
160
|
+
MessageScrollerItem,
|
|
161
|
+
MessageScrollerButton,
|
|
162
|
+
useMessageScroller,
|
|
163
|
+
useMessageScrollerGutterWidth,
|
|
164
|
+
useMessageScrollerScrollable,
|
|
165
|
+
useMessageScrollerVisibility,
|
|
166
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
|
|
6
|
+
function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
data-slot="message-group"
|
|
10
|
+
className={cn("flex min-w-0 flex-col gap-2", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function Message({
|
|
17
|
+
className,
|
|
18
|
+
align = "start",
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
data-slot="message"
|
|
24
|
+
data-align={align}
|
|
25
|
+
className={cn(
|
|
26
|
+
"group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="message-avatar"
|
|
38
|
+
className={cn(
|
|
39
|
+
"flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
data-slot="message-content"
|
|
51
|
+
className={cn(
|
|
52
|
+
"flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
|
|
53
|
+
className,
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
data-slot="message-header"
|
|
64
|
+
className={cn(
|
|
65
|
+
"flex max-w-full min-w-0 items-center px-3.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="message-footer"
|
|
77
|
+
className={cn(
|
|
78
|
+
"flex max-w-full min-w-0 items-center px-3.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
MessageGroup,
|
|
88
|
+
Message,
|
|
89
|
+
MessageAvatar,
|
|
90
|
+
MessageContent,
|
|
91
|
+
MessageFooter,
|
|
92
|
+
MessageHeader,
|
|
93
|
+
};
|