@appcorp/shadcn 1.0.10
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/README.md +138 -0
- package/app/layout.d.ts +7 -0
- package/app/layout.js +18 -0
- package/app/page.d.ts +2 -0
- package/app/page.js +16 -0
- package/components/badge.d.ts +9 -0
- package/components/badge.js +82 -0
- package/components/button.d.ts +10 -0
- package/components/button.js +91 -0
- package/components/card.d.ts +9 -0
- package/components/card.js +94 -0
- package/components/carousel.d.ts +19 -0
- package/components/carousel.js +168 -0
- package/components/checkbox.d.ts +9 -0
- package/components/checkbox.js +87 -0
- package/components/combobox.d.ts +70 -0
- package/components/combobox.js +315 -0
- package/components/command.d.ts +18 -0
- package/components/command.js +115 -0
- package/components/context-menu.d.ts +25 -0
- package/components/context-menu.js +148 -0
- package/components/dialog.d.ts +15 -0
- package/components/dialog.js +118 -0
- package/components/drawer.d.ts +13 -0
- package/components/drawer.js +115 -0
- package/components/dropdown-menu.d.ts +25 -0
- package/components/dropdown-menu.js +148 -0
- package/components/enhanced-dropzone.d.ts +21 -0
- package/components/enhanced-dropzone.js +187 -0
- package/components/enhanced-table-footer-action.d.ts +35 -0
- package/components/enhanced-table-footer-action.js +110 -0
- package/components/enhanced-table-footer-page.d.ts +34 -0
- package/components/enhanced-table-footer-page.js +132 -0
- package/components/enhanced-table-footer-pagination.d.ts +38 -0
- package/components/enhanced-table-footer-pagination.js +116 -0
- package/components/enhanced-table-header-action.d.ts +7 -0
- package/components/enhanced-table-header-action.js +21 -0
- package/components/enhanced-table-header-search.d.ts +12 -0
- package/components/enhanced-table-header-search.js +17 -0
- package/components/enhanced-table.d.ts +87 -0
- package/components/enhanced-table.js +221 -0
- package/components/form.d.ts +24 -0
- package/components/form.js +125 -0
- package/components/input.d.ts +8 -0
- package/components/input.js +86 -0
- package/components/label.d.ts +7 -0
- package/components/label.js +68 -0
- package/components/popover.d.ts +7 -0
- package/components/popover.js +82 -0
- package/components/select.d.ts +15 -0
- package/components/select.js +127 -0
- package/components/separator.d.ts +4 -0
- package/components/separator.js +66 -0
- package/components/shadcn-io/color-picker/index.d.ts +43 -0
- package/components/shadcn-io/color-picker/index.js +304 -0
- package/components/shadcn-io/copy-button/index.d.ts +16 -0
- package/components/shadcn-io/copy-button/index.js +121 -0
- package/components/shadcn-io/dropzone/index.d.ts +19 -0
- package/components/shadcn-io/dropzone/index.js +131 -0
- package/components/shadcn-io/gantt/index.d.ts +145 -0
- package/components/shadcn-io/gantt/index.js +767 -0
- package/components/shadcn-io/table/index.d.ts +60 -0
- package/components/shadcn-io/table/index.js +138 -0
- package/components/sonner.d.ts +4 -0
- package/components/sonner.js +54 -0
- package/components/switch.d.ts +9 -0
- package/components/switch.js +89 -0
- package/components/table.d.ts +10 -0
- package/components/table.js +101 -0
- package/components/textarea.d.ts +8 -0
- package/components/textarea.js +86 -0
- package/lib/themes.d.ts +147 -0
- package/lib/themes.js +150 -0
- package/lib/toast-utils.d.ts +44 -0
- package/lib/toast-utils.js +212 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +12 -0
- package/package.json +101 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Cell, Column, ColumnDef, Header, HeaderGroup, Row, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export type { ColumnDef } from "@tanstack/react-table";
|
|
5
|
+
export declare const TableContext: React.Context<{
|
|
6
|
+
data: unknown[];
|
|
7
|
+
columns: ColumnDef<unknown, unknown>[];
|
|
8
|
+
table: Table<unknown> | null;
|
|
9
|
+
}>;
|
|
10
|
+
export type TableProviderProps<TData, TValue> = {
|
|
11
|
+
columns: ColumnDef<TData, TValue>[];
|
|
12
|
+
data: TData[];
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function TableProvider<TData, TValue>({ columns, data, children, className, }: TableProviderProps<TData, TValue>): React.JSX.Element;
|
|
17
|
+
export type TableHeadProps = {
|
|
18
|
+
header: Header<unknown, unknown>;
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const TableHead: React.MemoExoticComponent<({ header, className }: TableHeadProps) => React.JSX.Element>;
|
|
22
|
+
export type TableHeaderGroupProps = {
|
|
23
|
+
headerGroup: HeaderGroup<unknown>;
|
|
24
|
+
children: (props: {
|
|
25
|
+
header: Header<unknown, unknown>;
|
|
26
|
+
}) => ReactNode;
|
|
27
|
+
};
|
|
28
|
+
export declare const TableHeaderGroup: ({ headerGroup, children, }: TableHeaderGroupProps) => React.JSX.Element;
|
|
29
|
+
export type TableHeaderProps = {
|
|
30
|
+
className?: string;
|
|
31
|
+
children: (props: {
|
|
32
|
+
headerGroup: HeaderGroup<unknown>;
|
|
33
|
+
}) => ReactNode;
|
|
34
|
+
};
|
|
35
|
+
export declare const TableHeader: ({ className, children }: TableHeaderProps) => React.JSX.Element;
|
|
36
|
+
export interface TableColumnHeaderProps<TData, TValue> extends HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
column: Column<TData, TValue>;
|
|
38
|
+
title: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function TableColumnHeader<TData, TValue>({ column, title, className, }: TableColumnHeaderProps<TData, TValue>): React.JSX.Element;
|
|
41
|
+
export type TableCellProps = {
|
|
42
|
+
cell: Cell<unknown, unknown>;
|
|
43
|
+
className?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const TableCell: ({ cell, className }: TableCellProps) => React.JSX.Element;
|
|
46
|
+
export type TableRowProps = {
|
|
47
|
+
row: Row<unknown>;
|
|
48
|
+
children: (props: {
|
|
49
|
+
cell: Cell<unknown, unknown>;
|
|
50
|
+
}) => ReactNode;
|
|
51
|
+
className?: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const TableRow: ({ row, children, className }: TableRowProps) => React.JSX.Element;
|
|
54
|
+
export type TableBodyProps = {
|
|
55
|
+
children: (props: {
|
|
56
|
+
row: Row<unknown>;
|
|
57
|
+
}) => ReactNode;
|
|
58
|
+
className?: string;
|
|
59
|
+
};
|
|
60
|
+
export declare const TableBody: ({ children, className }: TableBodyProps) => React.JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TableBody = exports.TableRow = exports.TableCell = exports.TableHeader = exports.TableHeaderGroup = exports.TableHead = exports.TableContext = void 0;
|
|
37
|
+
exports.TableProvider = TableProvider;
|
|
38
|
+
exports.TableColumnHeader = TableColumnHeader;
|
|
39
|
+
var react_table_1 = require("@tanstack/react-table");
|
|
40
|
+
var jotai_1 = require("jotai");
|
|
41
|
+
var lucide_react_1 = require("lucide-react");
|
|
42
|
+
var react_1 = __importStar(require("react"));
|
|
43
|
+
var button_1 = require("../../button");
|
|
44
|
+
var dropdown_menu_1 = require("../../dropdown-menu");
|
|
45
|
+
var table_1 = require("../../table");
|
|
46
|
+
var utils_1 = require("../../../lib/utils");
|
|
47
|
+
var sortingAtom = (0, jotai_1.atom)([]);
|
|
48
|
+
exports.TableContext = (0, react_1.createContext)({
|
|
49
|
+
data: [],
|
|
50
|
+
columns: [],
|
|
51
|
+
table: null,
|
|
52
|
+
});
|
|
53
|
+
function TableProvider(_a) {
|
|
54
|
+
var columns = _a.columns, data = _a.data, children = _a.children, className = _a.className;
|
|
55
|
+
var _b = (0, jotai_1.useAtom)(sortingAtom), sorting = _b[0], setSorting = _b[1];
|
|
56
|
+
var table = (0, react_table_1.useReactTable)({
|
|
57
|
+
data: data,
|
|
58
|
+
columns: columns,
|
|
59
|
+
getCoreRowModel: (0, react_table_1.getCoreRowModel)(),
|
|
60
|
+
getSortedRowModel: (0, react_table_1.getSortedRowModel)(),
|
|
61
|
+
onSortingChange: function (updater) {
|
|
62
|
+
// @ts-expect-error updater is a function that returns a sorting object
|
|
63
|
+
var newSorting = updater(sorting);
|
|
64
|
+
setSorting(newSorting);
|
|
65
|
+
},
|
|
66
|
+
state: {
|
|
67
|
+
sorting: sorting,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return (react_1.default.createElement(exports.TableContext.Provider, { value: {
|
|
71
|
+
data: data,
|
|
72
|
+
columns: columns,
|
|
73
|
+
table: table,
|
|
74
|
+
} },
|
|
75
|
+
react_1.default.createElement(table_1.Table, { className: className }, children)));
|
|
76
|
+
}
|
|
77
|
+
exports.TableHead = (0, react_1.memo)(function (_a) {
|
|
78
|
+
var header = _a.header, className = _a.className;
|
|
79
|
+
return (react_1.default.createElement(table_1.TableHead, { className: className, key: header.id }, header.isPlaceholder
|
|
80
|
+
? null
|
|
81
|
+
: (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext())));
|
|
82
|
+
});
|
|
83
|
+
exports.TableHead.displayName = "TableHead";
|
|
84
|
+
var TableHeaderGroup = function (_a) {
|
|
85
|
+
var headerGroup = _a.headerGroup, children = _a.children;
|
|
86
|
+
return (react_1.default.createElement(table_1.TableRow, { key: headerGroup.id }, headerGroup.headers.map(function (header) { return children({ header: header }); })));
|
|
87
|
+
};
|
|
88
|
+
exports.TableHeaderGroup = TableHeaderGroup;
|
|
89
|
+
var TableHeader = function (_a) {
|
|
90
|
+
var className = _a.className, children = _a.children;
|
|
91
|
+
var table = (0, react_1.useContext)(exports.TableContext).table;
|
|
92
|
+
return (react_1.default.createElement(table_1.TableHeader, { className: className }, table === null || table === void 0 ? void 0 : table.getHeaderGroups().map(function (headerGroup) { return children({ headerGroup: headerGroup }); })));
|
|
93
|
+
};
|
|
94
|
+
exports.TableHeader = TableHeader;
|
|
95
|
+
function TableColumnHeader(_a) {
|
|
96
|
+
var column = _a.column, title = _a.title, className = _a.className;
|
|
97
|
+
// Extract inline event handlers to prevent unnecessary re-renders
|
|
98
|
+
var handleSortAsc = (0, react_1.useCallback)(function () {
|
|
99
|
+
column.toggleSorting(false);
|
|
100
|
+
}, [column]);
|
|
101
|
+
var handleSortDesc = (0, react_1.useCallback)(function () {
|
|
102
|
+
column.toggleSorting(true);
|
|
103
|
+
}, [column]);
|
|
104
|
+
if (!column.getCanSort()) {
|
|
105
|
+
return react_1.default.createElement("div", { className: (0, utils_1.cn)(className) }, title);
|
|
106
|
+
}
|
|
107
|
+
return (react_1.default.createElement("div", { className: (0, utils_1.cn)("flex items-center space-x-2", className) },
|
|
108
|
+
react_1.default.createElement(dropdown_menu_1.DropdownMenu, null,
|
|
109
|
+
react_1.default.createElement(dropdown_menu_1.DropdownMenuTrigger, { asChild: true },
|
|
110
|
+
react_1.default.createElement(button_1.Button, { className: "-ml-3 h-8 data-[state=open]:bg-accent", size: "sm", variant: "ghost" },
|
|
111
|
+
react_1.default.createElement("span", null, title),
|
|
112
|
+
column.getIsSorted() === "desc" ? (react_1.default.createElement(lucide_react_1.ArrowDownIcon, { className: "ml-2 h-4 w-4" })) : column.getIsSorted() === "asc" ? (react_1.default.createElement(lucide_react_1.ArrowUpIcon, { className: "ml-2 h-4 w-4" })) : (react_1.default.createElement(lucide_react_1.ChevronsUpDownIcon, { className: "ml-2 h-4 w-4" })))),
|
|
113
|
+
react_1.default.createElement(dropdown_menu_1.DropdownMenuContent, { align: "start" },
|
|
114
|
+
react_1.default.createElement(dropdown_menu_1.DropdownMenuItem, { onClick: handleSortAsc },
|
|
115
|
+
react_1.default.createElement(lucide_react_1.ArrowUpIcon, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
116
|
+
"Asc"),
|
|
117
|
+
react_1.default.createElement(dropdown_menu_1.DropdownMenuItem, { onClick: handleSortDesc },
|
|
118
|
+
react_1.default.createElement(lucide_react_1.ArrowDownIcon, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
119
|
+
"Desc")))));
|
|
120
|
+
}
|
|
121
|
+
var TableCell = function (_a) {
|
|
122
|
+
var cell = _a.cell, className = _a.className;
|
|
123
|
+
return (react_1.default.createElement(table_1.TableCell, { className: className }, (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext())));
|
|
124
|
+
};
|
|
125
|
+
exports.TableCell = TableCell;
|
|
126
|
+
var TableRow = function (_a) {
|
|
127
|
+
var row = _a.row, children = _a.children, className = _a.className;
|
|
128
|
+
return (react_1.default.createElement(table_1.TableRow, { className: className, "data-state": row.getIsSelected() && "selected", key: row.id }, row.getVisibleCells().map(function (cell) { return children({ cell: cell }); })));
|
|
129
|
+
};
|
|
130
|
+
exports.TableRow = TableRow;
|
|
131
|
+
var TableBody = function (_a) {
|
|
132
|
+
var children = _a.children, className = _a.className;
|
|
133
|
+
var _b = (0, react_1.useContext)(exports.TableContext), columns = _b.columns, table = _b.table;
|
|
134
|
+
var rows = table === null || table === void 0 ? void 0 : table.getRowModel().rows;
|
|
135
|
+
return (react_1.default.createElement(table_1.TableBody, { className: className }, (rows === null || rows === void 0 ? void 0 : rows.length) ? (rows.map(function (row) { return children({ row: row }); })) : (react_1.default.createElement(table_1.TableRow, null,
|
|
136
|
+
react_1.default.createElement(table_1.TableCell, { className: "h-24 text-center", colSpan: columns.length }, "No results.")))));
|
|
137
|
+
};
|
|
138
|
+
exports.TableBody = TableBody;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
15
|
+
var t = {};
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17
|
+
t[p] = s[p];
|
|
18
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
19
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
20
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
21
|
+
t[p[i]] = s[p[i]];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Toaster = void 0;
|
|
30
|
+
var react_1 = __importDefault(require("react"));
|
|
31
|
+
var next_themes_1 = require("next-themes");
|
|
32
|
+
var sonner_1 = require("sonner");
|
|
33
|
+
var Toaster = function (_a) {
|
|
34
|
+
var props = __rest(_a, []);
|
|
35
|
+
var _b = (0, next_themes_1.useTheme)().theme, theme = _b === void 0 ? "system" : _b;
|
|
36
|
+
return (react_1.default.createElement(sonner_1.Toaster, __assign({ theme: theme, position: "bottom-right", expand: true, richColors: true, closeButton: true, className: "toaster group", style: {
|
|
37
|
+
"--normal-bg": "var(--popover)",
|
|
38
|
+
"--normal-text": "var(--popover-foreground)",
|
|
39
|
+
"--normal-border": "var(--border)",
|
|
40
|
+
}, toastOptions: {
|
|
41
|
+
classNames: {
|
|
42
|
+
toast: "group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg group-[.toaster]:backdrop-blur-md group-[.toaster]:bg-opacity-95",
|
|
43
|
+
description: "group-[.toast]:text-muted-foreground group-[.toast]:text-sm",
|
|
44
|
+
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground group-[.toast]:hover:bg-primary/90",
|
|
45
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground group-[.toast]:hover:bg-muted/90",
|
|
46
|
+
closeButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground group-[.toast]:border-border group-[.toast]:hover:bg-destructive group-[.toast]:hover:text-destructive-foreground group-[.toast]:hover:border-destructive group-[.toast]:focus:bg-destructive group-[.toast]:focus:text-destructive-foreground group-[.toast]:focus:border-destructive group-[.toast]:focus:outline-none group-[.toast]:focus:ring-2 group-[.toast]:focus:ring-destructive group-[.toast]:focus:ring-offset-2 group-[.toast]:focus:ring-offset-popover group-[.toast]:transition-all group-[.toast]:duration-200 group-[.toast]:ease-in-out group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:shadow-md group-[.toast]:active:scale-95 group-[.toast]:hover:shadow-lg group-[.toast]:backdrop-blur-sm",
|
|
47
|
+
},
|
|
48
|
+
style: {
|
|
49
|
+
minWidth: "320px",
|
|
50
|
+
maxWidth: "420px",
|
|
51
|
+
},
|
|
52
|
+
} }, props)));
|
|
53
|
+
};
|
|
54
|
+
exports.Toaster = Toaster;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
3
|
+
interface SwitchProps extends React.ComponentProps<typeof SwitchPrimitive.Root> {
|
|
4
|
+
error?: string;
|
|
5
|
+
info?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export { Switch };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.Switch = void 0;
|
|
60
|
+
var React = __importStar(require("react"));
|
|
61
|
+
var SwitchPrimitive = __importStar(require("@radix-ui/react-switch"));
|
|
62
|
+
var utils_1 = require("../lib/utils");
|
|
63
|
+
var label_1 = require("./label");
|
|
64
|
+
var Switch = React.forwardRef(function (_a, ref) {
|
|
65
|
+
var className = _a.className, error = _a.error, info = _a.info, label = _a.label, required = _a.required, id = _a.id, props = __rest(_a, ["className", "error", "info", "label", "required", "id"]);
|
|
66
|
+
// Determine if there's an error (for aria-invalid and styling)
|
|
67
|
+
var hasError = Boolean(error);
|
|
68
|
+
var switchElement = (React.createElement(SwitchPrimitive.Root, __assign({ ref: ref, id: id, "data-slot": "switch", "aria-invalid": hasError, required: required, className: (0, utils_1.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
69
|
+
// Error state styling
|
|
70
|
+
hasError &&
|
|
71
|
+
"data-[state=checked]:bg-destructive data-[state=unchecked]:bg-destructive/20 border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20", className) }, props),
|
|
72
|
+
React.createElement(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: (0, utils_1.cn)("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
|
|
73
|
+
// Error state thumb styling
|
|
74
|
+
hasError && "dark:data-[state=checked]:bg-destructive-foreground") })));
|
|
75
|
+
// If label is provided, render the complete switch with label structure
|
|
76
|
+
if (label) {
|
|
77
|
+
return (React.createElement("div", { className: "w-full space-y-2" },
|
|
78
|
+
React.createElement("div", { className: "flex items-center justify-between space-x-2" },
|
|
79
|
+
React.createElement(label_1.Label, { htmlFor: id, required: required }, label),
|
|
80
|
+
switchElement),
|
|
81
|
+
(error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
|
|
82
|
+
}
|
|
83
|
+
// If no label, render just the switch with messages (backward compatibility)
|
|
84
|
+
return (React.createElement("div", { className: "w-full" },
|
|
85
|
+
switchElement,
|
|
86
|
+
(error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
|
|
87
|
+
});
|
|
88
|
+
exports.Switch = Switch;
|
|
89
|
+
Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.Table = Table;
|
|
60
|
+
exports.TableHeader = TableHeader;
|
|
61
|
+
exports.TableBody = TableBody;
|
|
62
|
+
exports.TableFooter = TableFooter;
|
|
63
|
+
exports.TableHead = TableHead;
|
|
64
|
+
exports.TableRow = TableRow;
|
|
65
|
+
exports.TableCell = TableCell;
|
|
66
|
+
exports.TableCaption = TableCaption;
|
|
67
|
+
var React = __importStar(require("react"));
|
|
68
|
+
var utils_1 = require("../lib/utils");
|
|
69
|
+
function Table(_a) {
|
|
70
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
71
|
+
return (React.createElement("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto" },
|
|
72
|
+
React.createElement("table", __assign({ "data-slot": "table", className: (0, utils_1.cn)("w-full caption-bottom text-sm", className) }, props))));
|
|
73
|
+
}
|
|
74
|
+
function TableHeader(_a) {
|
|
75
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
76
|
+
return (React.createElement("thead", __assign({ "data-slot": "table-header", className: (0, utils_1.cn)("[&_tr]:border-b", className) }, props)));
|
|
77
|
+
}
|
|
78
|
+
function TableBody(_a) {
|
|
79
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
80
|
+
return (React.createElement("tbody", __assign({ "data-slot": "table-body", className: (0, utils_1.cn)("[&_tr:last-child]:border-0", className) }, props)));
|
|
81
|
+
}
|
|
82
|
+
function TableFooter(_a) {
|
|
83
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
84
|
+
return (React.createElement("tfoot", __assign({ "data-slot": "table-footer", className: (0, utils_1.cn)("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className) }, props)));
|
|
85
|
+
}
|
|
86
|
+
function TableRow(_a) {
|
|
87
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
88
|
+
return (React.createElement("tr", __assign({ "data-slot": "table-row", className: (0, utils_1.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className) }, props)));
|
|
89
|
+
}
|
|
90
|
+
function TableHead(_a) {
|
|
91
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
92
|
+
return (React.createElement("th", __assign({ "data-slot": "table-head", className: (0, utils_1.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className) }, props)));
|
|
93
|
+
}
|
|
94
|
+
function TableCell(_a) {
|
|
95
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
96
|
+
return (React.createElement("td", __assign({ "data-slot": "table-cell", className: (0, utils_1.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className) }, props)));
|
|
97
|
+
}
|
|
98
|
+
function TableCaption(_a) {
|
|
99
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
100
|
+
return (React.createElement("caption", __assign({ "data-slot": "table-caption", className: (0, utils_1.cn)("text-muted-foreground mt-4 text-sm", className) }, props)));
|
|
101
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface TextareaProps extends React.ComponentProps<"textarea"> {
|
|
3
|
+
error?: string;
|
|
4
|
+
info?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
8
|
+
export { Textarea };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
47
|
+
var t = {};
|
|
48
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
49
|
+
t[p] = s[p];
|
|
50
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
51
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
52
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
53
|
+
t[p[i]] = s[p[i]];
|
|
54
|
+
}
|
|
55
|
+
return t;
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.Textarea = void 0;
|
|
59
|
+
var React = __importStar(require("react"));
|
|
60
|
+
var utils_1 = require("../lib/utils");
|
|
61
|
+
var label_1 = require("./label");
|
|
62
|
+
var Textarea = React.forwardRef(function (_a, ref) {
|
|
63
|
+
var className = _a.className, error = _a.error, info = _a.info, label = _a.label, required = _a.required, id = _a.id, props = __rest(_a, ["className", "error", "info", "label", "required", "id"]);
|
|
64
|
+
// Determine if there's an error (for aria-invalid and styling)
|
|
65
|
+
var hasError = Boolean(error);
|
|
66
|
+
var textareaElement = (React.createElement("textarea", __assign({ ref: ref, id: id, "data-slot": "textarea", "aria-invalid": hasError, required: required, className: (0, utils_1.cn)("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input min-h-[80px] w-full min-w-0 rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none resize-vertical disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
67
|
+
// Error state styling
|
|
68
|
+
hasError &&
|
|
69
|
+
"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20",
|
|
70
|
+
// Normal state when no error
|
|
71
|
+
!hasError &&
|
|
72
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className) }, props)));
|
|
73
|
+
// If label is provided, render the complete textarea with label structure
|
|
74
|
+
if (label) {
|
|
75
|
+
return (React.createElement("div", { className: "w-full space-y-2" },
|
|
76
|
+
React.createElement(label_1.Label, { htmlFor: id, required: required }, label),
|
|
77
|
+
textareaElement,
|
|
78
|
+
(error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
|
|
79
|
+
}
|
|
80
|
+
// If no label, render just the textarea with messages (backward compatibility)
|
|
81
|
+
return (React.createElement("div", { className: "w-full" },
|
|
82
|
+
textareaElement,
|
|
83
|
+
(error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
|
|
84
|
+
});
|
|
85
|
+
exports.Textarea = Textarea;
|
|
86
|
+
Textarea.displayName = "Textarea";
|