@emara/ui 1.1.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/components/ui/.gitkeep +0 -0
- package/components/ui/accordion.stories.tsx +231 -0
- package/components/ui/accordion.tsx +250 -0
- package/components/ui/app-shell.stories.tsx +270 -0
- package/components/ui/app-shell.tsx +491 -0
- package/components/ui/avatar.stories.tsx +174 -0
- package/components/ui/avatar.tsx +257 -0
- package/components/ui/badge.stories.tsx +127 -0
- package/components/ui/badge.tsx +146 -0
- package/components/ui/breadcrumb.stories.tsx +92 -0
- package/components/ui/breadcrumb.tsx +302 -0
- package/components/ui/button.stories.tsx +186 -0
- package/components/ui/button.tsx +128 -0
- package/components/ui/card.stories.tsx +279 -0
- package/components/ui/card.tsx +250 -0
- package/components/ui/checkbox.stories.tsx +93 -0
- package/components/ui/checkbox.tsx +131 -0
- package/components/ui/combobox.stories.tsx +489 -0
- package/components/ui/combobox.tsx +874 -0
- package/components/ui/context-menu.stories.tsx +202 -0
- package/components/ui/context-menu.tsx +309 -0
- package/components/ui/data-table.stories.tsx +227 -0
- package/components/ui/data-table.tsx +539 -0
- package/components/ui/date-picker.stories.tsx +225 -0
- package/components/ui/date-picker.tsx +597 -0
- package/components/ui/dialog.stories.tsx +193 -0
- package/components/ui/dialog.tsx +262 -0
- package/components/ui/divider.stories.tsx +84 -0
- package/components/ui/divider.tsx +135 -0
- package/components/ui/drawer.stories.tsx +218 -0
- package/components/ui/drawer.tsx +329 -0
- package/components/ui/dropdown-menu.stories.tsx +270 -0
- package/components/ui/dropdown-menu.tsx +353 -0
- package/components/ui/empty-state.stories.tsx +121 -0
- package/components/ui/empty-state.tsx +289 -0
- package/components/ui/field-group.stories.tsx +201 -0
- package/components/ui/field-group.tsx +276 -0
- package/components/ui/form.stories.tsx +219 -0
- package/components/ui/form.tsx +542 -0
- package/components/ui/input.stories.tsx +154 -0
- package/components/ui/input.tsx +208 -0
- package/components/ui/label.stories.tsx +84 -0
- package/components/ui/label.tsx +98 -0
- package/components/ui/page-header.stories.tsx +136 -0
- package/components/ui/page-header.tsx +315 -0
- package/components/ui/pagination.stories.tsx +136 -0
- package/components/ui/pagination.tsx +427 -0
- package/components/ui/popover.stories.tsx +212 -0
- package/components/ui/popover.tsx +167 -0
- package/components/ui/radio-group.stories.tsx +96 -0
- package/components/ui/radio-group.tsx +250 -0
- package/components/ui/select.stories.tsx +203 -0
- package/components/ui/select.tsx +318 -0
- package/components/ui/sidebar.stories.tsx +186 -0
- package/components/ui/sidebar.tsx +623 -0
- package/components/ui/skeleton.stories.tsx +131 -0
- package/components/ui/skeleton.tsx +311 -0
- package/components/ui/switch.stories.tsx +74 -0
- package/components/ui/switch.tsx +186 -0
- package/components/ui/table.stories.tsx +107 -0
- package/components/ui/table.tsx +285 -0
- package/components/ui/tabs.stories.tsx +222 -0
- package/components/ui/tabs.tsx +287 -0
- package/components/ui/textarea.stories.tsx +96 -0
- package/components/ui/textarea.tsx +182 -0
- package/components/ui/toast.stories.tsx +169 -0
- package/components/ui/toast.tsx +250 -0
- package/components/ui/tooltip.stories.tsx +146 -0
- package/components/ui/tooltip.tsx +156 -0
- package/components/ui/top-bar.stories.tsx +182 -0
- package/components/ui/top-bar.tsx +155 -0
- package/dist/components/ui/accordion.d.ts +45 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +99 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/app-shell.d.ts +70 -0
- package/dist/components/ui/app-shell.d.ts.map +1 -0
- package/dist/components/ui/app-shell.js +199 -0
- package/dist/components/ui/app-shell.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +41 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +104 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +27 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +65 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +35 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +88 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +26 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +73 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +52 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +96 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +18 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +59 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +194 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +361 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +46 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +95 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/data-table.d.ts +53 -0
- package/dist/components/ui/data-table.d.ts.map +1 -0
- package/dist/components/ui/data-table.js +163 -0
- package/dist/components/ui/data-table.js.map +1 -0
- package/dist/components/ui/date-picker.d.ts +103 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +306 -0
- package/dist/components/ui/date-picker.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +40 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +110 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/divider.d.ts +30 -0
- package/dist/components/ui/divider.d.ts.map +1 -0
- package/dist/components/ui/divider.js +62 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +56 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +147 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +63 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +116 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty-state.d.ts +43 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +128 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/field-group.d.ts +38 -0
- package/dist/components/ui/field-group.d.ts.map +1 -0
- package/dist/components/ui/field-group.js +107 -0
- package/dist/components/ui/field-group.js.map +1 -0
- package/dist/components/ui/form.d.ts +67 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +286 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/input.d.ts +36 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +99 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +37 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +34 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/page-header.d.ts +65 -0
- package/dist/components/ui/page-header.d.ts.map +1 -0
- package/dist/components/ui/page-header.js +140 -0
- package/dist/components/ui/page-header.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +67 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +109 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +28 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +85 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +35 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +103 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/select.d.ts +42 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +86 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +59 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +189 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +77 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +115 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/switch.d.ts +26 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +84 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +52 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +109 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +42 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +163 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +26 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +96 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toast.d.ts +77 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +141 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +31 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +71 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/top-bar.d.ts +30 -0
- package/dist/components/ui/top-bar.d.ts.map +1 -0
- package/dist/components/ui/top-bar.js +64 -0
- package/dist/components/ui/top-bar.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/lib/utils.ts +6 -0
- package/package.json +112 -0
- package/styles/globals.css +685 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, forwardRef, useMemo } from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { RiArrowRightSLine, RiMoreLine } from "@remixicon/react";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./dropdown-menu";
|
|
9
|
+
// Per docs/emara-ui-phase-5-components.md §5.
|
|
10
|
+
// ===========================================================================
|
|
11
|
+
// Primitives (anatomy mirrors shadcn)
|
|
12
|
+
// ===========================================================================
|
|
13
|
+
const breadcrumbVariants = cva("flex items-center w-full", {
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "text-xs",
|
|
17
|
+
md: "text-sm",
|
|
18
|
+
lg: "text-base",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: { size: "md" },
|
|
22
|
+
});
|
|
23
|
+
const Breadcrumb = forwardRef(function Breadcrumb({ className, size, ...props }, ref) {
|
|
24
|
+
return (_jsx("nav", { ref: ref, "aria-label": "Breadcrumb", className: cn(breadcrumbVariants({ size }), className), ...props }));
|
|
25
|
+
});
|
|
26
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
27
|
+
const BreadcrumbList = forwardRef(function BreadcrumbList({ className, ...props }, ref) {
|
|
28
|
+
return (_jsx("ol", { ref: ref, className: cn("flex flex-wrap items-center gap-1.5 text-muted-foreground", className), ...props }));
|
|
29
|
+
});
|
|
30
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
31
|
+
const BreadcrumbItem = forwardRef(function BreadcrumbItem({ className, ...props }, ref) {
|
|
32
|
+
return (_jsx("li", { ref: ref, className: cn("inline-flex items-center gap-1.5", className), ...props }));
|
|
33
|
+
});
|
|
34
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
35
|
+
const BreadcrumbLink = forwardRef(function BreadcrumbLink({ className, asChild = false, ...props }, ref) {
|
|
36
|
+
const Comp = asChild ? Slot : "a";
|
|
37
|
+
return (_jsx(Comp, { ref: ref, className: cn("inline-flex items-center gap-1 transition-colors hover:text-foreground hover:underline underline-offset-2 cursor-pointer", "[&_svg]:size-3.5 [&_svg]:shrink-0", className), ...props }));
|
|
38
|
+
});
|
|
39
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
40
|
+
const BreadcrumbPage = forwardRef(function BreadcrumbPage({ className, ...props }, ref) {
|
|
41
|
+
return (_jsx("span", { ref: ref, role: "link", "aria-disabled": "true", "aria-current": "page", className: cn("inline-flex items-center gap-1 font-medium text-foreground", "[&_svg]:size-3.5 [&_svg]:shrink-0", className), ...props }));
|
|
42
|
+
});
|
|
43
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
44
|
+
const BreadcrumbSeparator = forwardRef(function BreadcrumbSeparator({ className, children, ...props }, ref) {
|
|
45
|
+
return (_jsx("li", { ref: ref, role: "presentation", "aria-hidden": "true", className: cn("[&_svg]:size-3.5 [&_svg]:shrink-0 text-muted-foreground", className), ...props, children: children ?? _jsx(RiArrowRightSLine, { className: "rtl-mirror" }) }));
|
|
46
|
+
});
|
|
47
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
48
|
+
const BreadcrumbEllipsis = forwardRef(function BreadcrumbEllipsis({ className, ...props }, ref) {
|
|
49
|
+
return (_jsxs("span", { ref: ref, role: "presentation", "aria-hidden": "true", className: cn("inline-flex size-6 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0", className), ...props, children: [_jsx(RiMoreLine, {}), _jsx("span", { className: "sr-only", children: "More items" })] }));
|
|
50
|
+
});
|
|
51
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
52
|
+
const Breadcrumbs = forwardRef(function Breadcrumbs({ items, separator, maxItems, itemsBeforeCollapse = 1, itemsAfterCollapse = 1, size, className, }, ref) {
|
|
53
|
+
const shouldCollapse = maxItems !== undefined &&
|
|
54
|
+
items.length > maxItems &&
|
|
55
|
+
items.length > itemsBeforeCollapse + itemsAfterCollapse;
|
|
56
|
+
const { start, hidden, end } = useMemo(() => {
|
|
57
|
+
if (!shouldCollapse) {
|
|
58
|
+
return { start: items, hidden: [], end: [] };
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
start: items.slice(0, itemsBeforeCollapse),
|
|
62
|
+
hidden: items.slice(itemsBeforeCollapse, items.length - itemsAfterCollapse),
|
|
63
|
+
end: items.slice(items.length - itemsAfterCollapse),
|
|
64
|
+
};
|
|
65
|
+
}, [items, itemsBeforeCollapse, itemsAfterCollapse, shouldCollapse]);
|
|
66
|
+
function renderItem(item, isLast) {
|
|
67
|
+
const content = (_jsxs(_Fragment, { children: [item.icon ? _jsx("span", { "aria-hidden": "true", children: item.icon }) : null, _jsx("span", { children: item.label })] }));
|
|
68
|
+
if (!item.href || isLast) {
|
|
69
|
+
return _jsx(BreadcrumbPage, { children: content });
|
|
70
|
+
}
|
|
71
|
+
return _jsx(BreadcrumbLink, { href: item.href, children: content });
|
|
72
|
+
}
|
|
73
|
+
return (_jsx(Breadcrumb, { ref: ref, ...(size !== undefined ? { size } : {}), className: className, children: _jsxs(BreadcrumbList, { children: [start.map((item, idx) => {
|
|
74
|
+
const isLast = !shouldCollapse && idx === items.length - 1;
|
|
75
|
+
const showSeparator = idx < start.length - 1 || shouldCollapse || end.length > 0;
|
|
76
|
+
return (_jsxs(Fragment, { children: [_jsx(BreadcrumbItem, { children: renderItem(item, isLast) }), showSeparator ? (_jsx(BreadcrumbSeparator, { children: separator })) : null] }, `s-${idx}`));
|
|
77
|
+
}), shouldCollapse && hidden.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(BreadcrumbItem, { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { "aria-label": "Show more", className: "inline-flex items-center justify-center rounded p-0.5 cursor-pointer hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(BreadcrumbEllipsis, {}) }), _jsx(DropdownMenuContent, { align: "start", children: hidden.map((item, idx) => (_jsx(DropdownMenuItem, { ...(item.icon ? { icon: item.icon } : {}), onSelect: () => {
|
|
78
|
+
if (item.href && typeof window !== "undefined") {
|
|
79
|
+
window.location.href = item.href;
|
|
80
|
+
}
|
|
81
|
+
}, children: item.label }, idx))) })] }) }), _jsx(BreadcrumbSeparator, { children: separator })] })) : null, end.map((item, idx) => {
|
|
82
|
+
const isLast = idx === end.length - 1;
|
|
83
|
+
return (_jsxs(Fragment, { children: [_jsx(BreadcrumbItem, { children: renderItem(item, isLast) }), !isLast ? _jsx(BreadcrumbSeparator, { children: separator }) : null] }, `e-${idx}`));
|
|
84
|
+
})] }) }));
|
|
85
|
+
});
|
|
86
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
87
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, Breadcrumbs, breadcrumbVariants, };
|
|
88
|
+
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../../components/ui/breadcrumb.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kB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CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,mBAAmB,cAAE,SAAS,GAAuB,CAAC,CAAC,CAAC,IAAI,KAF3D,KAAK,GAAG,EAAE,CAGd,CACZ,CAAC;gBACJ,CAAC,CAAC,IACa,GACN,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,kBAAkB,GACnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
declare const buttonVariants: (props?: ({
|
|
3
|
+
variant?: "default" | "link" | "secondary" | "outline" | "ghost" | "destructive" | "success" | "warning" | "info" | null | undefined;
|
|
4
|
+
size?: "default" | "sm" | "lg" | "icon" | "xs" | "xl" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl" | null | undefined;
|
|
5
|
+
fullWidth?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
8
|
+
type ButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type"> & ButtonVariantProps & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
type?: "button" | "submit" | "reset";
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
loadingText?: string;
|
|
13
|
+
leftIcon?: React.ReactNode;
|
|
14
|
+
rightIcon?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
declare const Button: import("react").ForwardRefExoticComponent<Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type"> & ButtonVariantProps & {
|
|
17
|
+
asChild?: boolean;
|
|
18
|
+
type?: "button" | "submit" | "reset";
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
loadingText?: string;
|
|
21
|
+
leftIcon?: React.ReactNode;
|
|
22
|
+
rightIcon?: React.ReactNode;
|
|
23
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
export { Button, buttonVariants };
|
|
25
|
+
export type { ButtonProps };
|
|
26
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,QAAA,MAAM,cAAc;;;;8EAiDnB,CAAC;AAEF,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAE9D,KAAK,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,GAC5E,kBAAkB,GAAG;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAEJ,QAAA,MAAM,MAAM;cARE,OAAO;WACV,QAAQ,GAAG,QAAQ,GAAG,OAAO;cAC1B,OAAO;kBACH,MAAM;eACT,KAAK,CAAC,SAAS;gBACd,KAAK,CAAC,SAAS;qDAoD7B,CAAC;AAGH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { RiLoader2Line } from "@remixicon/react";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
// Per docs/emara-ui-phase-1-components.md §1.
|
|
9
|
+
const buttonVariants = cva([
|
|
10
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap",
|
|
11
|
+
"rounded-md text-sm font-medium select-none cursor-pointer",
|
|
12
|
+
"transition-colors transition-shadow",
|
|
13
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
14
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
15
|
+
"aria-busy:cursor-progress",
|
|
16
|
+
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
17
|
+
].join(" "), {
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
21
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
22
|
+
outline: "border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
23
|
+
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
24
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
25
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
26
|
+
success: "bg-success text-primary-foreground hover:bg-success/90 focus-visible:ring-success",
|
|
27
|
+
warning: "bg-warning text-primary-foreground hover:bg-warning/90 focus-visible:ring-warning",
|
|
28
|
+
info: "bg-info text-primary-foreground hover:bg-info/90 focus-visible:ring-info",
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
xs: "h-7 px-2.5 text-xs",
|
|
32
|
+
sm: "h-8 px-3 text-xs",
|
|
33
|
+
default: "h-9 px-4 text-sm",
|
|
34
|
+
lg: "h-10 px-5 text-base",
|
|
35
|
+
xl: "h-12 px-6 text-base",
|
|
36
|
+
"icon-xs": "size-7 p-0",
|
|
37
|
+
"icon-sm": "size-8 p-0",
|
|
38
|
+
icon: "size-9 p-0",
|
|
39
|
+
"icon-lg": "size-10 p-0",
|
|
40
|
+
"icon-xl": "size-12 p-0",
|
|
41
|
+
},
|
|
42
|
+
fullWidth: {
|
|
43
|
+
true: "w-full",
|
|
44
|
+
false: "",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: "default",
|
|
49
|
+
size: "default",
|
|
50
|
+
fullWidth: false,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const Button = forwardRef(function Button({ className, variant, size, fullWidth, asChild = false, type = "button", loading = false, loadingText, leftIcon, rightIcon, disabled, children, ...props }, ref) {
|
|
54
|
+
const Comp = asChild ? Slot : "button";
|
|
55
|
+
const isDisabled = disabled || loading;
|
|
56
|
+
// When `asChild` is true, the Slot pattern requires a single child element —
|
|
57
|
+
// so spinners/icons are not injected. Consumers compose those themselves.
|
|
58
|
+
const content = asChild ? (children) : (_jsxs(_Fragment, { children: [loading ? _jsx(RiLoader2Line, { className: "animate-spin" }) : leftIcon, loading && loadingText ? _jsx("span", { children: loadingText }) : children, !loading && rightIcon] }));
|
|
59
|
+
const compProps = asChild
|
|
60
|
+
? { className: cn(buttonVariants({ variant, size, fullWidth }), className), ...props }
|
|
61
|
+
: {
|
|
62
|
+
type,
|
|
63
|
+
disabled: isDisabled,
|
|
64
|
+
"aria-disabled": isDisabled || undefined,
|
|
65
|
+
"aria-busy": loading || undefined,
|
|
66
|
+
className: cn(buttonVariants({ variant, size, fullWidth }), className),
|
|
67
|
+
...props,
|
|
68
|
+
};
|
|
69
|
+
return (_jsx(Comp, { ref: ref, ...compProps, children: content }));
|
|
70
|
+
});
|
|
71
|
+
Button.displayName = "Button";
|
|
72
|
+
export { Button, buttonVariants };
|
|
73
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,8CAA8C;AAE9C,MAAM,cAAc,GAAG,GAAG,CACxB;IACE,iEAAiE;IACjE,2DAA2D;IAC3D,qCAAqC;IACrC,0IAA0I;IAC1I,kDAAkD;IAClD,2BAA2B;IAC3B,iCAAiC;CAClC,CAAC,IAAI,CAAC,GAAG,CAAC,EACX;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,SAAS,EAAE,8DAA8D;YACzE,OAAO,EACL,gGAAgG;YAClG,KAAK,EAAE,8DAA8D;YACrE,WAAW,EAAE,oEAAoE;YACjF,IAAI,EAAE,iDAAiD;YACvD,OAAO,EACL,mFAAmF;YACrF,OAAO,EACL,mFAAmF;YACrF,IAAI,EAAE,0EAA0E;SACjF;QACD,IAAI,EAAE;YACJ,EAAE,EAAE,oBAAoB;YACxB,EAAE,EAAE,kBAAkB;YACtB,OAAO,EAAE,kBAAkB;YAC3B,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,qBAAqB;YACzB,SAAS,EAAE,YAAY;YACvB,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,aAAa;YACxB,SAAS,EAAE,aAAa;SACzB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,EAAE;SACV;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAA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GAAG,KAAK;SACT,CAAC;IAEN,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,OAAO,GACH,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
declare const cardVariants: (props?: ({
|
|
3
|
+
variant?: "default" | "filled" | "outline" | "ghost" | "elevated" | null | undefined;
|
|
4
|
+
padding?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
5
|
+
interactive?: boolean | null | undefined;
|
|
6
|
+
selected?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
type CardVariants = VariantProps<typeof cardVariants>;
|
|
9
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement> & CardVariants & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const Card: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & CardVariants & {
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
type CardHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare const CardHeader: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
type CardTitleAs = "h2" | "h3" | "h4" | "h5" | "h6";
|
|
24
|
+
type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement> & {
|
|
25
|
+
as?: CardTitleAs;
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
};
|
|
28
|
+
declare const CardTitle: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLHeadingElement> & {
|
|
29
|
+
as?: CardTitleAs;
|
|
30
|
+
asChild?: boolean;
|
|
31
|
+
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
32
|
+
type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement> & {
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
};
|
|
35
|
+
declare const CardDescription: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLParagraphElement> & {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
} & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
38
|
+
type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
};
|
|
41
|
+
declare const CardContent: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
|
+
type CardFooterProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
};
|
|
47
|
+
declare const CardFooter: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
|
+
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, cardVariants, };
|
|
51
|
+
export type { CardProps, CardHeaderProps, CardTitleProps, CardDescriptionProps, CardContentProps, CardFooterProps, };
|
|
52
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../components/ui/card.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAY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AAC;CACnB,CAAC;AAEF,QAAA,MAAM,UAAU;cAHJ,OAAO;kDAejB,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAY,GACb,CAAC;AACF,YAAY,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
import { Skeleton } from "./skeleton";
|
|
8
|
+
// Per docs/emara-ui-phase-1-components.md §5.
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
// Card root
|
|
11
|
+
// ----------------------------------------------------------------------------
|
|
12
|
+
const cardVariants = cva("rounded-lg transition-colors transition-shadow", {
|
|
13
|
+
variants: {
|
|
14
|
+
// Spec-faithful per docs/emara-ui-phase-1-components.md §5. Note that
|
|
15
|
+
// `default` carries no border because the spec assumes `--card` differs
|
|
16
|
+
// from `--background` in the host theme. Emara's stock palette has both
|
|
17
|
+
// as white in light mode, so `defaultVariants.variant` (below) is set
|
|
18
|
+
// to `outline` — a bare `<Card>` should still look like a card.
|
|
19
|
+
variant: {
|
|
20
|
+
default: "bg-card text-card-foreground",
|
|
21
|
+
outline: "bg-card text-card-foreground border border-border",
|
|
22
|
+
elevated: "bg-card text-card-foreground shadow-md",
|
|
23
|
+
filled: "bg-muted text-foreground",
|
|
24
|
+
ghost: "bg-transparent text-foreground",
|
|
25
|
+
},
|
|
26
|
+
padding: {
|
|
27
|
+
none: "p-0",
|
|
28
|
+
sm: "p-3",
|
|
29
|
+
md: "p-4",
|
|
30
|
+
lg: "p-6",
|
|
31
|
+
},
|
|
32
|
+
interactive: {
|
|
33
|
+
true: [
|
|
34
|
+
"cursor-pointer",
|
|
35
|
+
// Subtle hover — only the surface tone shifts, text stays put.
|
|
36
|
+
// For the default/outline variants the border also gets slightly
|
|
37
|
+
// stronger so the lift reads even without a background change.
|
|
38
|
+
"hover:bg-accent/40 hover:border-foreground/20",
|
|
39
|
+
"active:bg-accent/60",
|
|
40
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
41
|
+
].join(" "),
|
|
42
|
+
false: "",
|
|
43
|
+
},
|
|
44
|
+
selected: {
|
|
45
|
+
true: "ring-2 ring-primary ring-offset-2 ring-offset-background",
|
|
46
|
+
false: "",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: "outline",
|
|
51
|
+
padding: "md",
|
|
52
|
+
interactive: false,
|
|
53
|
+
selected: false,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const Card = forwardRef(function Card({ className, variant, padding, interactive, selected, asChild = false, loading = false, children, ...props }, ref) {
|
|
57
|
+
const Comp = asChild ? Slot : "div";
|
|
58
|
+
// Loading state mirrors a typical Card: header (title + description), body
|
|
59
|
+
// (3 lines), and a footer action. The container carries `aria-busy` /
|
|
60
|
+
// `aria-live` so assistive tech announces the loading region.
|
|
61
|
+
const loadingContent = (_jsxs("div", { className: "space-y-4", "aria-busy": "true", "aria-live": "polite", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-5 w-2/5" }), _jsx(Skeleton, { className: "h-4 w-3/5" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-full" }), _jsx(Skeleton, { className: "h-4 w-10/12" }), _jsx(Skeleton, { className: "h-4 w-3/5" })] }), _jsx("div", { className: "flex justify-end", children: _jsx(Skeleton, { className: "h-9 w-24" }) })] }));
|
|
62
|
+
return (_jsx(Comp, { ref: ref, "data-selected": selected ? "true" : undefined, className: cn(cardVariants({ variant, padding, interactive, selected }), className), ...props, children: loading ? loadingContent : children }));
|
|
63
|
+
});
|
|
64
|
+
Card.displayName = "Card";
|
|
65
|
+
const CardHeader = forwardRef(function CardHeader({ className, asChild = false, ...props }, ref) {
|
|
66
|
+
const Comp = asChild ? Slot : "div";
|
|
67
|
+
// Block layout with vertical rhythm. `space-y-1` is 4px — tight, but the
|
|
68
|
+
// CardTitle now carries its own `leading-snug` so visually there's already
|
|
69
|
+
// breathing room between title and description.
|
|
70
|
+
return _jsx(Comp, { ref: ref, className: cn("space-y-1", className), ...props });
|
|
71
|
+
});
|
|
72
|
+
CardHeader.displayName = "CardHeader";
|
|
73
|
+
const CardTitle = forwardRef(function CardTitle({ className, as = "h3", asChild = false, ...props }, ref) {
|
|
74
|
+
const Comp = asChild ? Slot : as;
|
|
75
|
+
// 18px / leading-snug / tight letter-spacing — establishes a clear visual
|
|
76
|
+
// step above the 14px CardDescription and 16px body text.
|
|
77
|
+
return (_jsx(Comp, { ref: ref, className: cn("text-lg font-semibold leading-snug tracking-tight", className), ...props }));
|
|
78
|
+
});
|
|
79
|
+
CardTitle.displayName = "CardTitle";
|
|
80
|
+
const CardDescription = forwardRef(function CardDescription({ className, asChild = false, ...props }, ref) {
|
|
81
|
+
const Comp = asChild ? Slot : "p";
|
|
82
|
+
return (_jsx(Comp, { ref: ref, className: cn("text-sm leading-snug text-muted-foreground", className), ...props }));
|
|
83
|
+
});
|
|
84
|
+
CardDescription.displayName = "CardDescription";
|
|
85
|
+
const CardContent = forwardRef(function CardContent({ className, asChild = false, ...props }, ref) {
|
|
86
|
+
const Comp = asChild ? Slot : "div";
|
|
87
|
+
return _jsx(Comp, { ref: ref, className: cn("pt-4 first:pt-0", className), ...props });
|
|
88
|
+
});
|
|
89
|
+
CardContent.displayName = "CardContent";
|
|
90
|
+
const CardFooter = forwardRef(function CardFooter({ className, asChild = false, ...props }, ref) {
|
|
91
|
+
const Comp = asChild ? Slot : "div";
|
|
92
|
+
return (_jsx(Comp, { ref: ref, className: cn("flex items-center pt-4 first:pt-0", className), ...props }));
|
|
93
|
+
});
|
|
94
|
+
CardFooter.displayName = "CardFooter";
|
|
95
|
+
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, cardVariants, };
|
|
96
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../components/ui/card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,8CAA8C;AAE9C,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,YAAY,GAAG,GAAG,CACtB,gDAAgD,EAChD;IACE,QAAQ,EAAE;QACR,sEAAsE;QACtE,wEAAwE;QACxE,wEAAwE;QACxE,sEAAsE;QACtE,gEAAgE;QAChE,OAAO,EAAE;YACP,OAAO,EAAE,8BAA8B;YACvC,OAAO,EAAE,mDAAmD;YAC5D,QAAQ,EAAE,wCAAwC;YAClD,MAAM,EAAE,0BAA0B;YAClC,KAAK,EAAE,gCAAgC;SACxC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,KAAK;YACX,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,KAAK;SACV;QACD,WAAW,EAAE;YACX,IAAI,EAAE;gBACJ,gBAAgB;gBAChB,+DAA+D;gBAC/D,iEAAiE;gBACjE,+DAA+D;gBAC/D,+CAA+C;gBAC/C,qBAAqB;gBACrB,0IAA0I;aAC3I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S,EACT,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const checkboxVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
invalid?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
type CheckboxVariants = VariantProps<typeof checkboxVariants>;
|
|
8
|
+
type CheckboxProps = Omit<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>, "size"> & CheckboxVariants & {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<CheckboxPrimitive.CheckboxProps & import("react").RefAttributes<HTMLButtonElement>, "ref">, "size"> & CheckboxVariants & {
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
export { Checkbox, checkboxVariants };
|
|
17
|
+
export type { CheckboxProps };
|
|
18
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../components/ui/checkbox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,QAAA,MAAM,gBAAgB;;;8EAwBrB,CAAC;AAoBF,KAAK,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,GAC9F,gBAAgB,GAAG;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B,CAAC;AAEJ,QAAA,MAAM,QAAQ;YAJF,KAAK,CAAC,SAAS;kBACT,KAAK,CAAC,SAAS;qDAkEhC,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId } from "react";
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
|
+
import { RiCheckLine, RiSubtractLine } from "@remixicon/react";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
// Per docs/emara-ui-phase-2-components.md §1.
|
|
9
|
+
const checkboxVariants = cva([
|
|
10
|
+
"peer shrink-0 rounded-sm border border-input bg-background",
|
|
11
|
+
"transition-colors",
|
|
12
|
+
"hover:border-foreground/40 data-[state=checked]:hover:bg-primary/90 data-[state=indeterminate]:hover:bg-primary/90",
|
|
13
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
14
|
+
"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-input",
|
|
15
|
+
"data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground",
|
|
16
|
+
"data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground",
|
|
17
|
+
].join(" "), {
|
|
18
|
+
variants: {
|
|
19
|
+
size: {
|
|
20
|
+
sm: "size-4",
|
|
21
|
+
md: "size-5",
|
|
22
|
+
lg: "size-6",
|
|
23
|
+
},
|
|
24
|
+
invalid: {
|
|
25
|
+
true: "border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:border-destructive data-[state=indeterminate]:bg-destructive data-[state=indeterminate]:border-destructive",
|
|
26
|
+
false: "",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { size: "md", invalid: false },
|
|
30
|
+
});
|
|
31
|
+
const indicatorIconSize = {
|
|
32
|
+
sm: "size-3",
|
|
33
|
+
md: "size-3.5",
|
|
34
|
+
lg: "size-4",
|
|
35
|
+
};
|
|
36
|
+
const labelSize = {
|
|
37
|
+
sm: "text-xs",
|
|
38
|
+
md: "text-sm",
|
|
39
|
+
lg: "text-base",
|
|
40
|
+
};
|
|
41
|
+
const descriptionSize = {
|
|
42
|
+
sm: "text-2xs",
|
|
43
|
+
md: "text-xs",
|
|
44
|
+
lg: "text-sm",
|
|
45
|
+
};
|
|
46
|
+
const Checkbox = forwardRef(function Checkbox({ className, size = "md", invalid, label, description, id, ...props }, ref) {
|
|
47
|
+
const reactId = useId();
|
|
48
|
+
const checkboxId = id ?? reactId;
|
|
49
|
+
const descriptionId = description ? `${checkboxId}-description` : undefined;
|
|
50
|
+
const resolvedSize = size ?? "md";
|
|
51
|
+
const checkbox = (_jsx(CheckboxPrimitive.Root, { ref: ref, id: checkboxId, "aria-invalid": invalid || undefined, "aria-describedby": descriptionId, className: cn(checkboxVariants({ size, invalid }), className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: props.checked === "indeterminate" ? (_jsx(RiSubtractLine, { className: indicatorIconSize[resolvedSize] })) : (_jsx(RiCheckLine, { className: indicatorIconSize[resolvedSize] })) }) }));
|
|
52
|
+
if (!label && !description)
|
|
53
|
+
return checkbox;
|
|
54
|
+
// When `label` is provided, render the full row pattern: checkbox + label + description.
|
|
55
|
+
return (_jsxs("div", { className: "inline-flex items-start gap-2", children: [checkbox, _jsxs("div", { className: "space-y-0.5 leading-none", children: [label ? (_jsx("label", { htmlFor: checkboxId, className: cn("cursor-pointer font-medium select-none", labelSize[resolvedSize], props.disabled && "cursor-not-allowed opacity-50"), children: label })) : null, description ? (_jsx("p", { id: descriptionId, className: cn("text-muted-foreground", descriptionSize[resolvedSize], props.disabled && "opacity-50"), children: description })) : null] })] }));
|
|
56
|
+
});
|
|
57
|
+
Checkbox.displayName = "Checkbox";
|
|
58
|
+
export { Checkbox, checkboxVariants };
|
|
59
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../components/ui/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,8CAA8C;AAE9C,MAAM,gBAAgB,GAAG,GAAG,CAC1B;IACE,4DAA4D;IAC5D,mBAAmB;IACnB,oHAAoH;IACpH,0IAA0I;IAC1I,6EAA6E;IAC7E,kHAAkH;IAClH,oIAAoI;CACrI,CAAC,IAAI,CAAC,GAAG,CAAC,EACX;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,QAAQ;SACb;QACD,OAAO,EAAE;YACP,IAAI,EAAE,uNAAuN;YAC7N,KAAK,EAAE,EAAE;SACV;KACF;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,E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