@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,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
const TableContext = createContext(null);
|
|
7
|
+
function useTableContext() {
|
|
8
|
+
// Subcomponents are safe outside <Table> for raw composition.
|
|
9
|
+
return (useContext(TableContext) ?? {
|
|
10
|
+
striped: false,
|
|
11
|
+
bordered: false,
|
|
12
|
+
hoverable: false,
|
|
13
|
+
stickyHeader: false,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
// --- Table (root) -----------------------------------------------------------
|
|
17
|
+
const tableVariants = cva("w-full caption-bottom border-separate border-spacing-0 text-sm", {
|
|
18
|
+
variants: {
|
|
19
|
+
bordered: {
|
|
20
|
+
true: "",
|
|
21
|
+
false: "",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { bordered: false },
|
|
25
|
+
});
|
|
26
|
+
const Table = forwardRef(function Table({ className, density, striped = false, bordered = false, hoverable = false, stickyHeader = false, wrap = true, ...props }, ref) {
|
|
27
|
+
const ctx = useMemo(() => ({
|
|
28
|
+
...(density !== undefined ? { density } : {}),
|
|
29
|
+
striped,
|
|
30
|
+
bordered,
|
|
31
|
+
hoverable,
|
|
32
|
+
stickyHeader,
|
|
33
|
+
}), [density, striped, bordered, hoverable, stickyHeader]);
|
|
34
|
+
const tableElement = (_jsx("table", { ref: ref, "data-density": density, "data-striped": striped || undefined, "data-bordered": bordered || undefined, "data-hoverable": hoverable || undefined, "data-sticky-header": stickyHeader || undefined, className: cn(tableVariants({ bordered }), className), ...props }));
|
|
35
|
+
return (_jsx(TableContext.Provider, { value: ctx, children: wrap ? (_jsx("div", { className: "border-border relative w-full overflow-auto rounded-md border", children: tableElement })) : (tableElement) }));
|
|
36
|
+
});
|
|
37
|
+
Table.displayName = "Table";
|
|
38
|
+
// --- TableHeader ------------------------------------------------------------
|
|
39
|
+
const TableHeader = forwardRef(function TableHeader({ className, ...props }, ref) {
|
|
40
|
+
const { stickyHeader } = useTableContext();
|
|
41
|
+
return (_jsx("thead", { ref: ref, className: cn("bg-muted/50 [&_tr]:border-border [&_tr]:border-b", stickyHeader && "z-sticky bg-background sticky top-0", className), ...props }));
|
|
42
|
+
});
|
|
43
|
+
TableHeader.displayName = "TableHeader";
|
|
44
|
+
// --- TableBody --------------------------------------------------------------
|
|
45
|
+
const TableBody = forwardRef(function TableBody({ className, ...props }, ref) {
|
|
46
|
+
return _jsx("tbody", { ref: ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
|
|
47
|
+
});
|
|
48
|
+
TableBody.displayName = "TableBody";
|
|
49
|
+
// --- TableFooter ------------------------------------------------------------
|
|
50
|
+
const TableFooter = forwardRef(function TableFooter({ className, ...props }, ref) {
|
|
51
|
+
return (_jsx("tfoot", { ref: ref, className: cn("border-border bg-muted/30 border-t font-medium [&_tr]:last:border-b-0", className), ...props }));
|
|
52
|
+
});
|
|
53
|
+
TableFooter.displayName = "TableFooter";
|
|
54
|
+
// --- TableRow ---------------------------------------------------------------
|
|
55
|
+
const TableRow = forwardRef(function TableRow({ className, ...props }, ref) {
|
|
56
|
+
const { striped, hoverable } = useTableContext();
|
|
57
|
+
return (_jsx("tr", { ref: ref, className: cn("border-border border-b transition-colors", striped && "even:bg-muted/30", hoverable && "hover:bg-muted/40", "data-[state=selected]:bg-accent/40", className), ...props }));
|
|
58
|
+
});
|
|
59
|
+
TableRow.displayName = "TableRow";
|
|
60
|
+
// --- TableHead --------------------------------------------------------------
|
|
61
|
+
const tableHeadVariants = cva([
|
|
62
|
+
"text-start align-middle font-medium text-muted-foreground",
|
|
63
|
+
"[&:has([role=checkbox])]:pe-0",
|
|
64
|
+
].join(" "), {
|
|
65
|
+
variants: {
|
|
66
|
+
density: {
|
|
67
|
+
warm: "h-10 px-3",
|
|
68
|
+
dense: "h-8 px-2",
|
|
69
|
+
},
|
|
70
|
+
bordered: {
|
|
71
|
+
true: "border-e border-border last:border-e-0",
|
|
72
|
+
false: "",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: { density: "warm", bordered: false },
|
|
76
|
+
});
|
|
77
|
+
const TableHead = forwardRef(function TableHead({ className, density, ...props }, ref) {
|
|
78
|
+
const { density: ctxDensity, bordered } = useTableContext();
|
|
79
|
+
const resolved = density ?? ctxDensity ?? "warm";
|
|
80
|
+
return (_jsx("th", { ref: ref, className: cn(tableHeadVariants({ density: resolved, bordered }), className), ...props }));
|
|
81
|
+
});
|
|
82
|
+
TableHead.displayName = "TableHead";
|
|
83
|
+
// --- TableCell --------------------------------------------------------------
|
|
84
|
+
const tableCellVariants = cva(["align-middle [&:has([role=checkbox])]:pe-0"].join(" "), {
|
|
85
|
+
variants: {
|
|
86
|
+
density: {
|
|
87
|
+
warm: "px-3 py-2.5",
|
|
88
|
+
dense: "px-2 py-1.5",
|
|
89
|
+
},
|
|
90
|
+
bordered: {
|
|
91
|
+
true: "border-e border-border last:border-e-0",
|
|
92
|
+
false: "",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
defaultVariants: { density: "warm", bordered: false },
|
|
96
|
+
});
|
|
97
|
+
const TableCell = forwardRef(function TableCell({ className, density, ...props }, ref) {
|
|
98
|
+
const { density: ctxDensity, bordered } = useTableContext();
|
|
99
|
+
const resolved = density ?? ctxDensity ?? "warm";
|
|
100
|
+
return (_jsx("td", { ref: ref, className: cn(tableCellVariants({ density: resolved, bordered }), className), ...props }));
|
|
101
|
+
});
|
|
102
|
+
TableCell.displayName = "TableCell";
|
|
103
|
+
// --- TableCaption -----------------------------------------------------------
|
|
104
|
+
const TableCaption = forwardRef(function TableCaption({ className, ...props }, ref) {
|
|
105
|
+
return (_jsx("caption", { ref: ref, className: cn("text-muted-foreground mt-3 text-sm", className), ...props }));
|
|
106
|
+
});
|
|
107
|
+
TableCaption.displayName = "TableCaption";
|
|
108
|
+
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption, tableVariants, tableHeadVariants, tableCellVariants, };
|
|
109
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../components/ui/table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAcjC,MAAM,YAAY,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAEnE,SAAS,eAAe;IACtB,8DAA8D;IAC9D,OAAO,CACL,UAAU,CAAC,YAAY,CAAC,IAAI;QAC1B,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;KACpB,CACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,MAAM,aAAa,GAAG,GAAG,CAAC,gEAAgE,EAAE;IAC1F,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;KACF;IACD,eAAe,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;CACrC,CAAC,CAAC;AAeH,MAAM,KAAK,GAAG,UAAU,CAA+B,SAAS,KAAK,CACnE,EACE,SAAS,EACT,OAAO,EACP,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,YAAY,GAAG,KAAK,EAC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AE,EAChC,GAAG;IAEH,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,eAAe,EAAE,CAAC;IAC5D,MAAM,QAAQ,GAAG,OAAO,IAAI,UAAU,IAAI,MAAM,CAAC;IACjD,OAAO,CACL,aACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,KACxE,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,+EAA+E;AAE/E,MAAM,YAAY,GAAG,UAAU,CAG7B,SAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAClD,OAAO,CACL,kBAAS,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACjG,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
type TabsVariant = "line" | "pill" | "card" | "vertical";
|
|
3
|
+
type TabsSize = "sm" | "md" | "lg";
|
|
4
|
+
type TabsRootProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {
|
|
5
|
+
variant?: TabsVariant;
|
|
6
|
+
size?: TabsSize;
|
|
7
|
+
lazy?: boolean;
|
|
8
|
+
unmountInactive?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const Tabs: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
11
|
+
variant?: TabsVariant;
|
|
12
|
+
size?: TabsSize;
|
|
13
|
+
lazy?: boolean;
|
|
14
|
+
unmountInactive?: boolean;
|
|
15
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const tabsListVariants: (props?: ({
|
|
17
|
+
variant?: "line" | "vertical" | "card" | "pill" | null | undefined;
|
|
18
|
+
scrollable?: boolean | null | undefined;
|
|
19
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
20
|
+
type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
|
|
21
|
+
scrollable?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare const TabsList: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
24
|
+
scrollable?: boolean;
|
|
25
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
declare const tabsTriggerVariants: (props?: ({
|
|
27
|
+
variant?: "line" | "vertical" | "card" | "pill" | null | undefined;
|
|
28
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
29
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
30
|
+
type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
|
|
31
|
+
icon?: React.ReactNode;
|
|
32
|
+
badge?: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
declare const TabsTrigger: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
35
|
+
icon?: React.ReactNode;
|
|
36
|
+
badge?: React.ReactNode;
|
|
37
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
type TabsContentProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>;
|
|
39
|
+
declare const TabsContent: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants, tabsTriggerVariants };
|
|
41
|
+
export type { TabsRootProps, TabsListProps, TabsTriggerProps, TabsContentProps };
|
|
42
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../components/ui/tabs.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAOtD,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AACzD,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAyBnC,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG;IAC/E,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,IAAI;cANE,WAAW;WACd,QAAQ;WACR,OAAO;sBACI,OAAO;kDAkFzB,CAAC;AAKH,QAAA,MAAM,gBAAgB;;;8EAoBpB,CAAC;AAEH,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,QAAQ;iBAHC,OAAO;kDAcrB,CAAC;AAKF,QAAA,MAAM,mBAAmB;;;8EA6CxB,CAAC;AAEF,KAAK,gBAAgB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG;IACrF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,WAAW;WAJR,KAAK,CAAC,SAAS;YACd,KAAK,CAAC,SAAS;qDAmBxB,CAAC;AAKF,KAAK,gBAAgB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAErF,QAAA,MAAM,WAAW,wLAsChB,CAAC;AAGF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;AAC3F,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, forwardRef, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
const TabsContext = createContext(null);
|
|
8
|
+
function useTabsContext() {
|
|
9
|
+
const ctx = useContext(TabsContext);
|
|
10
|
+
if (!ctx) {
|
|
11
|
+
throw new Error("Tabs subcomponents must be used inside <Tabs>");
|
|
12
|
+
}
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
const Tabs = forwardRef(function Tabs({ className, variant = "line", size = "md", lazy = false, unmountInactive = false, orientation, value, defaultValue, onValueChange, ...props }, ref) {
|
|
16
|
+
// `variant="vertical"` implies vertical orientation unless overridden.
|
|
17
|
+
const resolvedOrientation = orientation ?? (variant === "vertical" ? "vertical" : "horizontal");
|
|
18
|
+
const [internalValue, setInternalValue] = useState(typeof defaultValue === "string" ? defaultValue : undefined);
|
|
19
|
+
const isControlled = value !== undefined;
|
|
20
|
+
const currentValue = isControlled ? value : internalValue;
|
|
21
|
+
const [activated, setActivated] = useState(() => {
|
|
22
|
+
const s = new Set();
|
|
23
|
+
if (currentValue)
|
|
24
|
+
s.add(currentValue);
|
|
25
|
+
return s;
|
|
26
|
+
});
|
|
27
|
+
// Track every value that becomes active so `lazy` mounting works.
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!currentValue)
|
|
30
|
+
return;
|
|
31
|
+
setActivated((prev) => {
|
|
32
|
+
if (prev.has(currentValue))
|
|
33
|
+
return prev;
|
|
34
|
+
const next = new Set(prev);
|
|
35
|
+
next.add(currentValue);
|
|
36
|
+
return next;
|
|
37
|
+
});
|
|
38
|
+
}, [currentValue]);
|
|
39
|
+
const handleValueChange = (next) => {
|
|
40
|
+
if (!isControlled)
|
|
41
|
+
setInternalValue(next);
|
|
42
|
+
onValueChange?.(next);
|
|
43
|
+
};
|
|
44
|
+
const ctx = useMemo(() => ({
|
|
45
|
+
variant,
|
|
46
|
+
size,
|
|
47
|
+
lazy,
|
|
48
|
+
unmountInactive,
|
|
49
|
+
activated,
|
|
50
|
+
markActivated: (v) => {
|
|
51
|
+
setActivated((prev) => {
|
|
52
|
+
if (prev.has(v))
|
|
53
|
+
return prev;
|
|
54
|
+
const next = new Set(prev);
|
|
55
|
+
next.add(v);
|
|
56
|
+
return next;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
currentValue,
|
|
60
|
+
}), [variant, size, lazy, unmountInactive, activated, currentValue]);
|
|
61
|
+
return (_jsx(TabsContext.Provider, { value: ctx, children: _jsx(TabsPrimitive.Root, { ref: ref, orientation: resolvedOrientation, ...(currentValue !== undefined ? { value: currentValue } : {}), ...(isControlled || defaultValue === undefined ? {} : { defaultValue }), onValueChange: handleValueChange, className: cn(variant === "vertical" && "flex w-full gap-4", className), ...props }) }));
|
|
62
|
+
});
|
|
63
|
+
Tabs.displayName = "Tabs";
|
|
64
|
+
// --- TabsList ---------------------------------------------------------------
|
|
65
|
+
const tabsListVariants = cva("inline-flex items-center", {
|
|
66
|
+
variants: {
|
|
67
|
+
variant: {
|
|
68
|
+
line: "relative border-b border-border w-full",
|
|
69
|
+
pill: "gap-1 rounded-md bg-muted p-1",
|
|
70
|
+
card: "gap-1",
|
|
71
|
+
vertical: "flex-col gap-1 items-stretch border-e border-border pe-2 min-w-40",
|
|
72
|
+
},
|
|
73
|
+
scrollable: {
|
|
74
|
+
true: "overflow-x-auto scrollbar-thin",
|
|
75
|
+
false: "",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
compoundVariants: [
|
|
79
|
+
{ variant: "vertical", scrollable: true, class: "overflow-x-visible overflow-y-auto" },
|
|
80
|
+
],
|
|
81
|
+
defaultVariants: {
|
|
82
|
+
variant: "line",
|
|
83
|
+
scrollable: false,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
const TabsList = forwardRef(function TabsList({ className, scrollable, ...props }, ref) {
|
|
87
|
+
const { variant } = useTabsContext();
|
|
88
|
+
return (_jsx(TabsPrimitive.List, { ref: ref, className: cn(tabsListVariants({ variant, scrollable }), className), ...props }));
|
|
89
|
+
});
|
|
90
|
+
TabsList.displayName = "TabsList";
|
|
91
|
+
// --- TabsTrigger ------------------------------------------------------------
|
|
92
|
+
const tabsTriggerVariants = cva([
|
|
93
|
+
"inline-flex items-center gap-2 whitespace-nowrap font-medium select-none cursor-pointer",
|
|
94
|
+
"transition-colors",
|
|
95
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
96
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
97
|
+
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
98
|
+
].join(" "), {
|
|
99
|
+
variants: {
|
|
100
|
+
variant: {
|
|
101
|
+
line: [
|
|
102
|
+
"relative px-3 py-2 text-muted-foreground hover:text-foreground",
|
|
103
|
+
"data-[state=active]:text-foreground",
|
|
104
|
+
// Underline indicator (uses pseudo-element so it sits at the bottom of list border)
|
|
105
|
+
"after:absolute after:inset-x-0 after:-bottom-px after:h-0.5",
|
|
106
|
+
"after:bg-transparent after:transition-colors after:duration-normal",
|
|
107
|
+
"data-[state=active]:after:bg-primary",
|
|
108
|
+
].join(" "),
|
|
109
|
+
pill: [
|
|
110
|
+
"rounded-md px-3 py-1.5 text-muted-foreground hover:text-foreground",
|
|
111
|
+
"data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
112
|
+
].join(" "),
|
|
113
|
+
card: [
|
|
114
|
+
"rounded-t-md border border-b-0 border-transparent px-4 py-2 text-muted-foreground",
|
|
115
|
+
"hover:text-foreground",
|
|
116
|
+
"data-[state=active]:border-border data-[state=active]:bg-card data-[state=active]:text-foreground",
|
|
117
|
+
"-mb-px data-[state=active]:z-10",
|
|
118
|
+
].join(" "),
|
|
119
|
+
vertical: [
|
|
120
|
+
"rounded-md px-3 py-2 text-start text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
121
|
+
"data-[state=active]:bg-accent data-[state=active]:text-accent-foreground",
|
|
122
|
+
].join(" "),
|
|
123
|
+
},
|
|
124
|
+
size: {
|
|
125
|
+
sm: "text-xs h-8",
|
|
126
|
+
md: "text-sm h-9",
|
|
127
|
+
lg: "text-base h-10",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
variant: "line",
|
|
132
|
+
size: "md",
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
const TabsTrigger = forwardRef(function TabsTrigger({ className, icon, badge, children, value, ...props }, ref) {
|
|
136
|
+
const { variant, size } = useTabsContext();
|
|
137
|
+
return (_jsxs(TabsPrimitive.Trigger, { ref: ref, value: value, className: cn(tabsTriggerVariants({ variant, size }), className), ...props, children: [icon ? _jsx("span", { "aria-hidden": "true", children: icon }) : null, _jsx("span", { children: children }), badge ? _jsx("span", { className: "ms-1 inline-flex items-center", children: badge }) : null] }));
|
|
138
|
+
});
|
|
139
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
140
|
+
const TabsContent = forwardRef(function TabsContent({ className, value, forceMount, children, ...props }, ref) {
|
|
141
|
+
const { lazy, unmountInactive, activated, currentValue, variant } = useTabsContext();
|
|
142
|
+
const hasMountedRef = useRef(false);
|
|
143
|
+
const valueStr = typeof value === "string" ? value : "";
|
|
144
|
+
const isActive = currentValue === valueStr;
|
|
145
|
+
if (isActive)
|
|
146
|
+
hasMountedRef.current = true;
|
|
147
|
+
// Decide whether to render. `unmountInactive` wins (always render only when
|
|
148
|
+
// active). Otherwise, with `lazy`, render once activated and keep mounted.
|
|
149
|
+
let shouldRender = true;
|
|
150
|
+
if (unmountInactive)
|
|
151
|
+
shouldRender = isActive;
|
|
152
|
+
else if (lazy)
|
|
153
|
+
shouldRender = activated.has(valueStr) || hasMountedRef.current;
|
|
154
|
+
// When kept mounted but inactive, Radix hides via `hidden` attribute
|
|
155
|
+
// automatically; we just need `forceMount` so it stays in the DOM.
|
|
156
|
+
const effectiveForceMount = !unmountInactive ? true : forceMount;
|
|
157
|
+
if (!shouldRender)
|
|
158
|
+
return null;
|
|
159
|
+
return (_jsx(TabsPrimitive.Content, { ref: ref, value: value, ...(effectiveForceMount ? { forceMount: true } : {}), className: cn("focus-visible:ring-ring focus-visible:ring-offset-background outline-none focus-visible:ring-2 focus-visible:ring-offset-2", variant !== "vertical" && "mt-3", variant === "vertical" && "flex-1", className), ...props, children: children }));
|
|
160
|
+
});
|
|
161
|
+
TabsContent.displayName = "TabsContent";
|
|
162
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants, tabsTriggerVariants };
|
|
163
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../components/ui/tabs.tsx"],"names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;IAC5E,2EAA2E;IAC3E,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI,eAAe;QAAE,YAAY,GAAG,QAAQ,CAAC;SACxC,IAAI,IAAI;QAAE,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC;IAE/E,qEAAqE;IACrE,mEAAmE;IACnE,MAAM,mBAAmB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;IAEjE,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE/B,OAAO,CACL,KAAC,aAAa,CAAC,OAAO,IACpB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,KACR,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC9D,SAAS,EAAE,EAAE,CACX,4HAA4H,EAC5H,OAAO,KAAK,UAAU,IAAI,MAAM,EAChC,OAAO,KAAK,UAAU,IAAI,QAAQ,EAClC,SAAS,CACV,KACG,KAAK,YAER,QAAQ,GACa,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
declare const textareaVariants: (props?: ({
|
|
3
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
4
|
+
invalid?: boolean | null | undefined;
|
|
5
|
+
resize?: "none" | "vertical" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
type TextareaVariants = VariantProps<typeof textareaVariants>;
|
|
8
|
+
type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & {
|
|
9
|
+
size?: TextareaVariants["size"];
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
autoResize?: boolean;
|
|
12
|
+
maxRows?: number;
|
|
13
|
+
showCount?: boolean;
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<Omit<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & {
|
|
17
|
+
size?: TextareaVariants["size"];
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
autoResize?: boolean;
|
|
20
|
+
maxRows?: number;
|
|
21
|
+
showCount?: boolean;
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
24
|
+
export { Textarea, textareaVariants };
|
|
25
|
+
export type { TextareaProps };
|
|
26
|
+
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../components/ui/textarea.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,QAAA,MAAM,gBAAgB;;;;8EAgCrB,CAAC;AAEF,KAAK,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,KAAK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,GAAG;IACrF,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAqCF,QAAA,MAAM,QAAQ;WA3CL,gBAAgB,CAAC,MAAM,CAAC;cACrB,OAAO;iBACJ,OAAO;cACV,MAAM;gBACJ,OAAO;cACT,OAAO;uDA6HjB,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
// Per docs/emara-ui-phase-1-components.md §3.
|
|
8
|
+
const textareaVariants = cva([
|
|
9
|
+
"block w-full rounded-md border border-input bg-background text-foreground",
|
|
10
|
+
"ps-3 pe-3 py-2",
|
|
11
|
+
"placeholder:text-muted-foreground",
|
|
12
|
+
"transition-colors",
|
|
13
|
+
"focus: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",
|
|
15
|
+
"read-only:bg-muted",
|
|
16
|
+
].join(" "), {
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
sm: "text-xs leading-5 min-h-16",
|
|
20
|
+
md: "text-sm leading-5 min-h-20",
|
|
21
|
+
lg: "text-base leading-6 min-h-28",
|
|
22
|
+
},
|
|
23
|
+
invalid: {
|
|
24
|
+
true: "border-destructive focus-visible:ring-destructive",
|
|
25
|
+
false: "",
|
|
26
|
+
},
|
|
27
|
+
resize: {
|
|
28
|
+
vertical: "resize-y",
|
|
29
|
+
none: "resize-none",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
size: "md",
|
|
34
|
+
invalid: false,
|
|
35
|
+
resize: "vertical",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// Internal hook — keeps the textarea sized to its content, capped at `maxRows`.
|
|
39
|
+
function useAutoResize(ref, enabled, maxRows, value) {
|
|
40
|
+
const resize = useCallback(() => {
|
|
41
|
+
const node = ref.current;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
node.style.height = "auto";
|
|
45
|
+
const styles = window.getComputedStyle(node);
|
|
46
|
+
// `styles.lineHeight` is normally a `<n>px` string (Tailwind's text-*
|
|
47
|
+
// utilities all set an explicit line-height). For elements that resolve
|
|
48
|
+
// to `normal`, fall back to fontSize × 1.5 — the conventional ratio —
|
|
49
|
+
// and finally to 20px (≈ --text-sm--line-height) if everything fails.
|
|
50
|
+
const lineHeight = parseFloat(styles.lineHeight) || parseFloat(styles.fontSize) * 1.5 || 20;
|
|
51
|
+
const paddingTop = parseFloat(styles.paddingTop) || 0;
|
|
52
|
+
const paddingBottom = parseFloat(styles.paddingBottom) || 0;
|
|
53
|
+
const borderTop = parseFloat(styles.borderTopWidth) || 0;
|
|
54
|
+
const borderBottom = parseFloat(styles.borderBottomWidth) || 0;
|
|
55
|
+
const chrome = paddingTop + paddingBottom + borderTop + borderBottom;
|
|
56
|
+
const contentHeight = node.scrollHeight - chrome;
|
|
57
|
+
const cap = maxRows !== undefined ? maxRows * lineHeight + chrome : Number.POSITIVE_INFINITY;
|
|
58
|
+
const next = Math.min(node.scrollHeight, cap);
|
|
59
|
+
node.style.height = `${next}px`;
|
|
60
|
+
node.style.overflowY = contentHeight + chrome > cap ? "auto" : "hidden";
|
|
61
|
+
}, [ref, maxRows]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!enabled)
|
|
64
|
+
return;
|
|
65
|
+
resize();
|
|
66
|
+
}, [enabled, resize, value]);
|
|
67
|
+
}
|
|
68
|
+
const Textarea = forwardRef(function Textarea({ className, size, invalid = false, autoResize = false, maxRows, showCount = false, rows = 4, maxLength, asChild = false, value, defaultValue, onChange, disabled, readOnly, id, "aria-describedby": ariaDescribedBy, children, ...props }, forwardedRef) {
|
|
69
|
+
const isControlled = value !== undefined;
|
|
70
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(typeof defaultValue === "string" ? defaultValue : "");
|
|
71
|
+
const currentValue = isControlled ? String(value ?? "") : uncontrolledValue;
|
|
72
|
+
const innerRef = useRef(null);
|
|
73
|
+
const setRefs = (node) => {
|
|
74
|
+
innerRef.current = node;
|
|
75
|
+
if (typeof forwardedRef === "function")
|
|
76
|
+
forwardedRef(node);
|
|
77
|
+
else if (forwardedRef)
|
|
78
|
+
forwardedRef.current = node;
|
|
79
|
+
};
|
|
80
|
+
useAutoResize(innerRef, autoResize && !disabled, maxRows, currentValue);
|
|
81
|
+
const reactId = useId();
|
|
82
|
+
const textareaId = id ?? reactId;
|
|
83
|
+
const counterId = showCount ? `${textareaId}-count` : undefined;
|
|
84
|
+
const describedBy = [ariaDescribedBy, counterId].filter(Boolean).join(" ") || undefined;
|
|
85
|
+
const handleChange = (e) => {
|
|
86
|
+
if (!isControlled)
|
|
87
|
+
setUncontrolledValue(e.target.value);
|
|
88
|
+
onChange?.(e);
|
|
89
|
+
};
|
|
90
|
+
const Field = asChild ? Slot : "textarea";
|
|
91
|
+
const showCounter = showCount && maxLength !== undefined;
|
|
92
|
+
return (_jsxs("div", { className: "w-full", children: [_jsx(Field, { ref: setRefs, id: textareaId, rows: rows, maxLength: maxLength, className: cn(textareaVariants({ size, invalid, resize: autoResize ? "none" : "vertical" }), className), disabled: disabled, readOnly: readOnly, "aria-invalid": invalid || undefined, "aria-describedby": describedBy, value: isControlled ? currentValue : undefined, defaultValue: isControlled ? undefined : defaultValue, onChange: handleChange, ...props, children: asChild ? children : null }), showCounter ? (_jsxs("div", { id: counterId, className: cn("text-muted-foreground mt-1 text-end text-xs tabular-nums", currentValue.length >= (maxLength ?? 0) && "text-destructive"), "aria-live": "polite", children: [currentValue.length, "/", maxLength] })) : null] }));
|
|
93
|
+
});
|
|
94
|
+
Textarea.displayName = "Textarea";
|
|
95
|
+
export { Textarea, textareaVariants };
|
|
96
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../components/ui/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,8CAA8C;AAE9C,MAAM,gBAAgB,GAAG,GAAG,CAC1B;IACE,2EAA2E;IAC3E,gBAAgB;IAChB,mCAAmC;IACnC,mBAAmB;IACnB,kIAAkI;IAClI,iDAAiD;IACjD,oBAAoB;CACrB,CAAC,IAAI,CAAC,GAAG,CAAC,EACX;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,4BAA4B;YAChC,EAAE,EAAE,4BAA4B;YAChC,EAAE,EAAE,8BAA8B;SACnC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,mDAAmD;YACzD,KAAK,EAAE,EAAE;SACV;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,aAAa;SACpB;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,UAAU;KACnB;CACF,CACF,CAAC;AAaF,gFAAgF;AAChF,SAAS,aAAa,CACpB,GAAgD,EAChD,OAAgB,EAChB,OAA2B,EAC3B,KAAa;IAEb,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,O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C9C,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EACrD,QAAQ,EAAE,YAAY,KAClB,KAAK,YAER,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GACpB,EACP,WAAW,CAAC,CAAC,CAAC,CACb,eACE,EAAE,EAAE,SAAS,EACb,SAAS,EAAE,EAAE,CACX,0DAA0D,EAC1D,YAAY,CAAC,MAAM,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,kBAAkB,CAC9D,eACS,QAAQ,aAEjB,YAAY,CAAC,MAAM,OAAG,SAAS,IAC5B,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type ToasterProps as SonnerToasterProps } from "sonner";
|
|
2
|
+
type LogicalPosition = "top-start" | "top-end" | "top-center" | "bottom-start" | "bottom-end" | "bottom-center";
|
|
3
|
+
type ToasterProps = Omit<SonnerToasterProps, "position"> & {
|
|
4
|
+
position?: LogicalPosition;
|
|
5
|
+
/**
|
|
6
|
+
* Whether hovering a toast pauses its dismiss timer. Sonner's default
|
|
7
|
+
* is `true`; that matches our spec default. **Known limitation:**
|
|
8
|
+
* Sonner doesn't expose a Toaster-level override today, so flipping
|
|
9
|
+
* this prop to `false` is currently a no-op. Tracked for v1.x.
|
|
10
|
+
*/
|
|
11
|
+
pauseOnHover?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether clicking a toast dismisses it. Spec default `false` matches
|
|
14
|
+
* Sonner's default (click is inert). **Known limitation:** same as
|
|
15
|
+
* `pauseOnHover` — flipping to `true` is currently a no-op.
|
|
16
|
+
*/
|
|
17
|
+
closeOnClick?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether touch-swipe gestures dismiss a toast. Sonner's default is
|
|
20
|
+
* `true` on touch, matching spec. **Known limitation:** flipping
|
|
21
|
+
* to `false` is currently a no-op.
|
|
22
|
+
*/
|
|
23
|
+
swipeToDismiss?: boolean;
|
|
24
|
+
/** Cap on concurrent visible toasts. Maps to Sonner's `visibleToasts`. */
|
|
25
|
+
maxVisible?: number;
|
|
26
|
+
/** Default dismiss timer in ms. */
|
|
27
|
+
defaultDuration?: number;
|
|
28
|
+
};
|
|
29
|
+
declare function Toaster({ position, pauseOnHover, closeOnClick, swipeToDismiss, maxVisible, defaultDuration, expand, gap, richColors, className, toastOptions, ...rest }: ToasterProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
type EmaraToastOptions = {
|
|
31
|
+
id?: string | number;
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
duration?: number;
|
|
34
|
+
icon?: React.ReactNode;
|
|
35
|
+
action?: {
|
|
36
|
+
label: string;
|
|
37
|
+
onClick: () => void;
|
|
38
|
+
};
|
|
39
|
+
cancel?: {
|
|
40
|
+
label: string;
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Show a countdown progress bar. Sonner's underlying option is `closeButton`
|
|
45
|
+
* and built-in progress; we expose the spec name.
|
|
46
|
+
*/
|
|
47
|
+
progress?: boolean;
|
|
48
|
+
dismissible?: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* `toast(message, options)` and its variant-shortcut siblings. Wraps sonner's
|
|
52
|
+
* imperative API so consumers don't import sonner directly.
|
|
53
|
+
*/
|
|
54
|
+
declare function toastBase(message: React.ReactNode, options?: EmaraToastOptions): string | number;
|
|
55
|
+
declare const toast: typeof toastBase & {
|
|
56
|
+
success: (message: React.ReactNode, options?: EmaraToastOptions) => string | number;
|
|
57
|
+
warning: (message: React.ReactNode, options?: EmaraToastOptions) => string | number;
|
|
58
|
+
info: (message: React.ReactNode, options?: EmaraToastOptions) => string | number;
|
|
59
|
+
error: (message: React.ReactNode, options?: EmaraToastOptions) => string | number;
|
|
60
|
+
loading: (message: React.ReactNode, options?: EmaraToastOptions) => string | number;
|
|
61
|
+
promise: <T>(promise: Promise<T> | (() => Promise<T>), msgs: {
|
|
62
|
+
loading: React.ReactNode;
|
|
63
|
+
success: React.ReactNode | ((data: T) => React.ReactNode);
|
|
64
|
+
error: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
65
|
+
}) => (string & {
|
|
66
|
+
unwrap: () => Promise<T>;
|
|
67
|
+
}) | (number & {
|
|
68
|
+
unwrap: () => Promise<T>;
|
|
69
|
+
}) | {
|
|
70
|
+
unwrap: () => Promise<T>;
|
|
71
|
+
};
|
|
72
|
+
dismiss: (id?: string | number) => string | number;
|
|
73
|
+
custom: (jsx: (id: number | string) => React.ReactElement, data?: import("sonner").ExternalToast) => string | number;
|
|
74
|
+
};
|
|
75
|
+
export { Toaster, toast };
|
|
76
|
+
export type { ToasterProps, EmaraToastOptions, LogicalPosition };
|
|
77
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../components/ui/toast.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,YAAY,IAAI,kBAAkB,EACxC,MAAM,QAAQ,CAAC;AAWhB,KAAK,eAAe,GAChB,WAAW,GACX,SAAS,GACT,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,eAAe,CAAC;AAgCpB,KAAK,YAAY,GAAG,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,GAAG;IACzD,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0EAA0E;IAC1E,UAAU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