avt-rct-lib 1.0.1 โ 1.0.3
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 +1 -1
- package/dist/index.cjs +151 -0
- package/dist/index.d.cts +49 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.js +149 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
React component library dengan desain **macOS/iOS**. Hanya butuh **Tailwind CSS** โ tanpa Radix UI, tanpa library komponen lain.
|
|
8
8
|
|
|
9
|
-
๐ฆ [npmjs.com/package/avt-rct-lib](https://www.npmjs.com/package/avt-rct-lib)
|
|
9
|
+
๐ฆ [npmjs.com/package/avt-rct-lib](https://www.npmjs.com/package/avt-rct-lib) ยท ๐ [avt-rct-dashboard.vercel.app](https://avt-rct-dashboard.vercel.app)
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
package/dist/index.cjs
CHANGED
|
@@ -382,6 +382,30 @@ function TablePagination({
|
|
|
382
382
|
}
|
|
383
383
|
);
|
|
384
384
|
}
|
|
385
|
+
function DataTable({
|
|
386
|
+
columns,
|
|
387
|
+
data,
|
|
388
|
+
onChange,
|
|
389
|
+
card = true,
|
|
390
|
+
emptyText = "Tidak ada data untuk ditampilkan",
|
|
391
|
+
className,
|
|
392
|
+
toolbar,
|
|
393
|
+
pagination
|
|
394
|
+
}) {
|
|
395
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Table, { card, className, children: [
|
|
396
|
+
toolbar && /* @__PURE__ */ jsxRuntime.jsx(TableToolbar, { children: toolbar }),
|
|
397
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(TableRow, { className: "hover:bg-transparent", children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: col.header }, String(col.accessor))) }) }),
|
|
398
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: data.length ? data.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: col.cell ? col.cell(row, onChange) : String(row[col.accessor] ?? "") }, String(col.accessor))) }, rowIndex)) : /* @__PURE__ */ jsxRuntime.jsx(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
399
|
+
TableCell,
|
|
400
|
+
{
|
|
401
|
+
colSpan: columns.length,
|
|
402
|
+
className: "py-10 text-center text-[#8E8E93]",
|
|
403
|
+
children: emptyText
|
|
404
|
+
}
|
|
405
|
+
) }) }),
|
|
406
|
+
pagination && /* @__PURE__ */ jsxRuntime.jsx(TablePagination, { ...pagination })
|
|
407
|
+
] });
|
|
408
|
+
}
|
|
385
409
|
var TabsContext = React3.createContext({
|
|
386
410
|
active: "",
|
|
387
411
|
setActive: () => {
|
|
@@ -1188,6 +1212,130 @@ function SidebarItem({
|
|
|
1188
1212
|
}
|
|
1189
1213
|
);
|
|
1190
1214
|
}
|
|
1215
|
+
function SidebarSubMenu({
|
|
1216
|
+
icon,
|
|
1217
|
+
label,
|
|
1218
|
+
badge,
|
|
1219
|
+
defaultOpen = false,
|
|
1220
|
+
open: controlledOpen,
|
|
1221
|
+
onOpenChange,
|
|
1222
|
+
activeChild = false,
|
|
1223
|
+
children,
|
|
1224
|
+
className
|
|
1225
|
+
}) {
|
|
1226
|
+
const { collapsed } = useSidebar();
|
|
1227
|
+
const [internalOpen, setInternalOpen] = React3.useState(defaultOpen);
|
|
1228
|
+
const isOpen = controlledOpen ?? internalOpen;
|
|
1229
|
+
const toggle = () => {
|
|
1230
|
+
const next = !isOpen;
|
|
1231
|
+
setInternalOpen(next);
|
|
1232
|
+
onOpenChange?.(next);
|
|
1233
|
+
};
|
|
1234
|
+
if (collapsed) {
|
|
1235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1236
|
+
"button",
|
|
1237
|
+
{
|
|
1238
|
+
type: "button",
|
|
1239
|
+
title: label,
|
|
1240
|
+
onClick: toggle,
|
|
1241
|
+
className: cn(
|
|
1242
|
+
"mx-auto flex h-10 w-10 min-h-[44px] min-w-[44px] items-center justify-center rounded-xl",
|
|
1243
|
+
"select-none outline-none transition-all duration-150",
|
|
1244
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1245
|
+
activeChild ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.28)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]",
|
|
1246
|
+
className
|
|
1247
|
+
),
|
|
1248
|
+
children: icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", !activeChild && "text-[#8E8E93]"), children: icon })
|
|
1249
|
+
}
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
1252
|
+
const triggerActive = activeChild && !isOpen;
|
|
1253
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-0.5", className), children: [
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1255
|
+
"button",
|
|
1256
|
+
{
|
|
1257
|
+
type: "button",
|
|
1258
|
+
onClick: toggle,
|
|
1259
|
+
className: cn(
|
|
1260
|
+
"flex w-full items-center gap-2.5 rounded-xl px-3 py-2.5 min-h-[44px]",
|
|
1261
|
+
"text-[13px] font-medium select-none outline-none transition-all duration-150",
|
|
1262
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1263
|
+
triggerActive ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.28)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]"
|
|
1264
|
+
),
|
|
1265
|
+
children: [
|
|
1266
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", !triggerActive && "text-[#8E8E93]"), children: icon }),
|
|
1267
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: label }),
|
|
1268
|
+
badge !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1269
|
+
"span",
|
|
1270
|
+
{
|
|
1271
|
+
className: cn(
|
|
1272
|
+
"flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[10px] font-bold",
|
|
1273
|
+
triggerActive ? "bg-white/20 text-white" : "bg-[#E5E5EA] text-[#8E8E93]"
|
|
1274
|
+
),
|
|
1275
|
+
children: badge
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1279
|
+
"svg",
|
|
1280
|
+
{
|
|
1281
|
+
className: cn(
|
|
1282
|
+
"h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200",
|
|
1283
|
+
triggerActive ? "text-white/60" : "text-[#C7C7CC]",
|
|
1284
|
+
isOpen && "rotate-90"
|
|
1285
|
+
),
|
|
1286
|
+
viewBox: "0 0 24 24",
|
|
1287
|
+
fill: "none",
|
|
1288
|
+
stroke: "currentColor",
|
|
1289
|
+
strokeWidth: "2.5",
|
|
1290
|
+
strokeLinecap: "round",
|
|
1291
|
+
strokeLinejoin: "round",
|
|
1292
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 18l6-6-6-6" })
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
]
|
|
1296
|
+
}
|
|
1297
|
+
),
|
|
1298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1299
|
+
"div",
|
|
1300
|
+
{
|
|
1301
|
+
className: cn(
|
|
1302
|
+
"overflow-hidden transition-all duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
1303
|
+
isOpen ? "max-h-96 opacity-100" : "max-h-0 opacity-0 pointer-events-none"
|
|
1304
|
+
),
|
|
1305
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-3 space-y-0.5 border-l border-[#E5E5EA] py-0.5 pl-2", children })
|
|
1306
|
+
}
|
|
1307
|
+
)
|
|
1308
|
+
] });
|
|
1309
|
+
}
|
|
1310
|
+
function SidebarSubMenuItem({
|
|
1311
|
+
icon,
|
|
1312
|
+
label,
|
|
1313
|
+
active = false,
|
|
1314
|
+
href,
|
|
1315
|
+
as: Tag = "button",
|
|
1316
|
+
className,
|
|
1317
|
+
...props
|
|
1318
|
+
}) {
|
|
1319
|
+
const tagProps = href ? { href } : { type: "button" };
|
|
1320
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1321
|
+
Tag,
|
|
1322
|
+
{
|
|
1323
|
+
...tagProps,
|
|
1324
|
+
className: cn(
|
|
1325
|
+
"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 min-h-[36px]",
|
|
1326
|
+
"text-[12px] font-medium select-none outline-none transition-all duration-150",
|
|
1327
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1328
|
+
active ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.20)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]",
|
|
1329
|
+
className
|
|
1330
|
+
),
|
|
1331
|
+
...props,
|
|
1332
|
+
children: [
|
|
1333
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("flex-shrink-0", !active && "text-[#8E8E93]"), children: icon }),
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate text-left", children: label })
|
|
1335
|
+
]
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1191
1339
|
function SidebarFooter({ className, ...props }) {
|
|
1192
1340
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-shrink-0 p-3", className), ...props });
|
|
1193
1341
|
}
|
|
@@ -1278,6 +1426,7 @@ exports.CardDivider = CardDivider;
|
|
|
1278
1426
|
exports.CardFooter = CardFooter;
|
|
1279
1427
|
exports.CardHeader = CardHeader;
|
|
1280
1428
|
exports.CardTitle = CardTitle;
|
|
1429
|
+
exports.DataTable = DataTable;
|
|
1281
1430
|
exports.Drawer = Drawer;
|
|
1282
1431
|
exports.Input = Input;
|
|
1283
1432
|
exports.Menu = MenuRoot;
|
|
@@ -1312,6 +1461,8 @@ exports.SidebarFooter = SidebarFooter;
|
|
|
1312
1461
|
exports.SidebarGroup = SidebarGroup;
|
|
1313
1462
|
exports.SidebarHeader = SidebarHeader;
|
|
1314
1463
|
exports.SidebarItem = SidebarItem;
|
|
1464
|
+
exports.SidebarSubMenu = SidebarSubMenu;
|
|
1465
|
+
exports.SidebarSubMenuItem = SidebarSubMenuItem;
|
|
1315
1466
|
exports.SidebarToggle = SidebarToggle;
|
|
1316
1467
|
exports.SidebarUser = SidebarUser;
|
|
1317
1468
|
exports.Table = Table;
|
package/dist/index.d.cts
CHANGED
|
@@ -74,6 +74,31 @@ declare function TablePagination({ page, pageCount, canPrev, canNext, onPrev, on
|
|
|
74
74
|
className?: string;
|
|
75
75
|
}): react_jsx_runtime.JSX.Element;
|
|
76
76
|
|
|
77
|
+
interface DataTableColumn<T = any> {
|
|
78
|
+
header: string;
|
|
79
|
+
accessor: keyof T | (string & {});
|
|
80
|
+
cell?: (row: T, onChange?: () => void) => React.ReactNode;
|
|
81
|
+
}
|
|
82
|
+
interface DataTablePaginationProps {
|
|
83
|
+
page: number;
|
|
84
|
+
pageCount: number;
|
|
85
|
+
canPrev: boolean;
|
|
86
|
+
canNext: boolean;
|
|
87
|
+
onPrev: () => void;
|
|
88
|
+
onNext: () => void;
|
|
89
|
+
}
|
|
90
|
+
interface DataTableProps<T = any> {
|
|
91
|
+
columns: DataTableColumn<T>[];
|
|
92
|
+
data: T[];
|
|
93
|
+
onChange?: () => void;
|
|
94
|
+
card?: boolean;
|
|
95
|
+
emptyText?: string;
|
|
96
|
+
className?: string;
|
|
97
|
+
toolbar?: React.ReactNode;
|
|
98
|
+
pagination?: DataTablePaginationProps;
|
|
99
|
+
}
|
|
100
|
+
declare function DataTable<T = any>({ columns, data, onChange, card, emptyText, className, toolbar, pagination, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
77
102
|
interface TabsProps {
|
|
78
103
|
defaultValue?: string;
|
|
79
104
|
value?: string;
|
|
@@ -254,6 +279,29 @@ interface SidebarItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
254
279
|
as?: React.ElementType;
|
|
255
280
|
}
|
|
256
281
|
declare function SidebarItem({ icon, label, active, badge, href, as: Tag, className, ...props }: SidebarItemProps): react_jsx_runtime.JSX.Element;
|
|
282
|
+
interface SidebarSubMenuProps {
|
|
283
|
+
icon?: React.ReactNode;
|
|
284
|
+
label: string;
|
|
285
|
+
badge?: string | number;
|
|
286
|
+
/** Initial open state (uncontrolled) */
|
|
287
|
+
defaultOpen?: boolean;
|
|
288
|
+
/** Controlled open state */
|
|
289
|
+
open?: boolean;
|
|
290
|
+
onOpenChange?: (open: boolean) => void;
|
|
291
|
+
/** True when one of the children is the currently active route */
|
|
292
|
+
activeChild?: boolean;
|
|
293
|
+
children: React.ReactNode;
|
|
294
|
+
className?: string;
|
|
295
|
+
}
|
|
296
|
+
declare function SidebarSubMenu({ icon, label, badge, defaultOpen, open: controlledOpen, onOpenChange, activeChild, children, className, }: SidebarSubMenuProps): react_jsx_runtime.JSX.Element;
|
|
297
|
+
interface SidebarSubMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
298
|
+
icon?: React.ReactNode;
|
|
299
|
+
label: string;
|
|
300
|
+
active?: boolean;
|
|
301
|
+
href?: string;
|
|
302
|
+
as?: React.ElementType;
|
|
303
|
+
}
|
|
304
|
+
declare function SidebarSubMenuItem({ icon, label, active, href, as: Tag, className, ...props }: SidebarSubMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
257
305
|
declare function SidebarFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
258
306
|
interface SidebarUserProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
259
307
|
name: string;
|
|
@@ -295,4 +343,4 @@ declare const colors: {
|
|
|
295
343
|
};
|
|
296
344
|
declare function generateId(): string;
|
|
297
345
|
|
|
298
|
-
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, type CardProps, CardTitle, Drawer, Input, type InputProps, MenuRoot as Menu, type MenuAlign, MenuButton, MenuContent, type MenuContentProps, MenuRoot as MenuDropdown, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, type NavbarBrandProps, NavbarCenter, NavbarDivider, NavbarIconButton, type NavbarIconButtonProps, NavbarLeft, type NavbarProps, NavbarRight, NavbarSearch, type NavbarSearchProps, Scrollbar, type ScrollbarProps, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, type SidebarGroupProps, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarToggle, type SidebarToggleProps, SidebarUser, type SidebarUserProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, type TableProps, TableRow, TableToolbar, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastItem, type ToastOptions, type ToastPosition, type ToastVariant, Toaster, type ToasterProps, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|
|
346
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, type CardProps, CardTitle, DataTable, type DataTableColumn, type DataTablePaginationProps, type DataTableProps, Drawer, Input, type InputProps, MenuRoot as Menu, type MenuAlign, MenuButton, MenuContent, type MenuContentProps, MenuRoot as MenuDropdown, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, type NavbarBrandProps, NavbarCenter, NavbarDivider, NavbarIconButton, type NavbarIconButtonProps, NavbarLeft, type NavbarProps, NavbarRight, NavbarSearch, type NavbarSearchProps, Scrollbar, type ScrollbarProps, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, type SidebarGroupProps, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSubMenu, SidebarSubMenuItem, type SidebarSubMenuItemProps, type SidebarSubMenuProps, SidebarToggle, type SidebarToggleProps, SidebarUser, type SidebarUserProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, type TableProps, TableRow, TableToolbar, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastItem, type ToastOptions, type ToastPosition, type ToastVariant, Toaster, type ToasterProps, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,31 @@ declare function TablePagination({ page, pageCount, canPrev, canNext, onPrev, on
|
|
|
74
74
|
className?: string;
|
|
75
75
|
}): react_jsx_runtime.JSX.Element;
|
|
76
76
|
|
|
77
|
+
interface DataTableColumn<T = any> {
|
|
78
|
+
header: string;
|
|
79
|
+
accessor: keyof T | (string & {});
|
|
80
|
+
cell?: (row: T, onChange?: () => void) => React.ReactNode;
|
|
81
|
+
}
|
|
82
|
+
interface DataTablePaginationProps {
|
|
83
|
+
page: number;
|
|
84
|
+
pageCount: number;
|
|
85
|
+
canPrev: boolean;
|
|
86
|
+
canNext: boolean;
|
|
87
|
+
onPrev: () => void;
|
|
88
|
+
onNext: () => void;
|
|
89
|
+
}
|
|
90
|
+
interface DataTableProps<T = any> {
|
|
91
|
+
columns: DataTableColumn<T>[];
|
|
92
|
+
data: T[];
|
|
93
|
+
onChange?: () => void;
|
|
94
|
+
card?: boolean;
|
|
95
|
+
emptyText?: string;
|
|
96
|
+
className?: string;
|
|
97
|
+
toolbar?: React.ReactNode;
|
|
98
|
+
pagination?: DataTablePaginationProps;
|
|
99
|
+
}
|
|
100
|
+
declare function DataTable<T = any>({ columns, data, onChange, card, emptyText, className, toolbar, pagination, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
77
102
|
interface TabsProps {
|
|
78
103
|
defaultValue?: string;
|
|
79
104
|
value?: string;
|
|
@@ -254,6 +279,29 @@ interface SidebarItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
254
279
|
as?: React.ElementType;
|
|
255
280
|
}
|
|
256
281
|
declare function SidebarItem({ icon, label, active, badge, href, as: Tag, className, ...props }: SidebarItemProps): react_jsx_runtime.JSX.Element;
|
|
282
|
+
interface SidebarSubMenuProps {
|
|
283
|
+
icon?: React.ReactNode;
|
|
284
|
+
label: string;
|
|
285
|
+
badge?: string | number;
|
|
286
|
+
/** Initial open state (uncontrolled) */
|
|
287
|
+
defaultOpen?: boolean;
|
|
288
|
+
/** Controlled open state */
|
|
289
|
+
open?: boolean;
|
|
290
|
+
onOpenChange?: (open: boolean) => void;
|
|
291
|
+
/** True when one of the children is the currently active route */
|
|
292
|
+
activeChild?: boolean;
|
|
293
|
+
children: React.ReactNode;
|
|
294
|
+
className?: string;
|
|
295
|
+
}
|
|
296
|
+
declare function SidebarSubMenu({ icon, label, badge, defaultOpen, open: controlledOpen, onOpenChange, activeChild, children, className, }: SidebarSubMenuProps): react_jsx_runtime.JSX.Element;
|
|
297
|
+
interface SidebarSubMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
298
|
+
icon?: React.ReactNode;
|
|
299
|
+
label: string;
|
|
300
|
+
active?: boolean;
|
|
301
|
+
href?: string;
|
|
302
|
+
as?: React.ElementType;
|
|
303
|
+
}
|
|
304
|
+
declare function SidebarSubMenuItem({ icon, label, active, href, as: Tag, className, ...props }: SidebarSubMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
257
305
|
declare function SidebarFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
258
306
|
interface SidebarUserProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
259
307
|
name: string;
|
|
@@ -295,4 +343,4 @@ declare const colors: {
|
|
|
295
343
|
};
|
|
296
344
|
declare function generateId(): string;
|
|
297
345
|
|
|
298
|
-
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, type CardProps, CardTitle, Drawer, Input, type InputProps, MenuRoot as Menu, type MenuAlign, MenuButton, MenuContent, type MenuContentProps, MenuRoot as MenuDropdown, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, type NavbarBrandProps, NavbarCenter, NavbarDivider, NavbarIconButton, type NavbarIconButtonProps, NavbarLeft, type NavbarProps, NavbarRight, NavbarSearch, type NavbarSearchProps, Scrollbar, type ScrollbarProps, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, type SidebarGroupProps, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarToggle, type SidebarToggleProps, SidebarUser, type SidebarUserProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, type TableProps, TableRow, TableToolbar, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastItem, type ToastOptions, type ToastPosition, type ToastVariant, Toaster, type ToasterProps, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|
|
346
|
+
export { Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, type CardProps, CardTitle, DataTable, type DataTableColumn, type DataTablePaginationProps, type DataTableProps, Drawer, Input, type InputProps, MenuRoot as Menu, type MenuAlign, MenuButton, MenuContent, type MenuContentProps, MenuRoot as MenuDropdown, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, type NavbarBrandProps, NavbarCenter, NavbarDivider, NavbarIconButton, type NavbarIconButtonProps, NavbarLeft, type NavbarProps, NavbarRight, NavbarSearch, type NavbarSearchProps, Scrollbar, type ScrollbarProps, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, type SheetHeaderProps, type SheetProps, type SheetSide, SheetTitle, Sidebar, SidebarBrand, type SidebarBrandProps, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, type SidebarGroupProps, SidebarHeader, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSubMenu, SidebarSubMenuItem, type SidebarSubMenuItemProps, type SidebarSubMenuProps, SidebarToggle, type SidebarToggleProps, SidebarUser, type SidebarUserProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, type TableProps, TableRow, TableToolbar, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastItem, type ToastOptions, type ToastPosition, type ToastVariant, Toaster, type ToasterProps, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|
package/dist/index.js
CHANGED
|
@@ -376,6 +376,30 @@ function TablePagination({
|
|
|
376
376
|
}
|
|
377
377
|
);
|
|
378
378
|
}
|
|
379
|
+
function DataTable({
|
|
380
|
+
columns,
|
|
381
|
+
data,
|
|
382
|
+
onChange,
|
|
383
|
+
card = true,
|
|
384
|
+
emptyText = "Tidak ada data untuk ditampilkan",
|
|
385
|
+
className,
|
|
386
|
+
toolbar,
|
|
387
|
+
pagination
|
|
388
|
+
}) {
|
|
389
|
+
return /* @__PURE__ */ jsxs(Table, { card, className, children: [
|
|
390
|
+
toolbar && /* @__PURE__ */ jsx(TableToolbar, { children: toolbar }),
|
|
391
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { className: "hover:bg-transparent", children: columns.map((col) => /* @__PURE__ */ jsx(TableHead, { children: col.header }, String(col.accessor))) }) }),
|
|
392
|
+
/* @__PURE__ */ jsx(TableBody, { children: data.length ? data.map((row, rowIndex) => /* @__PURE__ */ jsx(TableRow, { children: columns.map((col) => /* @__PURE__ */ jsx(TableCell, { children: col.cell ? col.cell(row, onChange) : String(row[col.accessor] ?? "") }, String(col.accessor))) }, rowIndex)) : /* @__PURE__ */ jsx(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx(
|
|
393
|
+
TableCell,
|
|
394
|
+
{
|
|
395
|
+
colSpan: columns.length,
|
|
396
|
+
className: "py-10 text-center text-[#8E8E93]",
|
|
397
|
+
children: emptyText
|
|
398
|
+
}
|
|
399
|
+
) }) }),
|
|
400
|
+
pagination && /* @__PURE__ */ jsx(TablePagination, { ...pagination })
|
|
401
|
+
] });
|
|
402
|
+
}
|
|
379
403
|
var TabsContext = createContext({
|
|
380
404
|
active: "",
|
|
381
405
|
setActive: () => {
|
|
@@ -1182,6 +1206,130 @@ function SidebarItem({
|
|
|
1182
1206
|
}
|
|
1183
1207
|
);
|
|
1184
1208
|
}
|
|
1209
|
+
function SidebarSubMenu({
|
|
1210
|
+
icon,
|
|
1211
|
+
label,
|
|
1212
|
+
badge,
|
|
1213
|
+
defaultOpen = false,
|
|
1214
|
+
open: controlledOpen,
|
|
1215
|
+
onOpenChange,
|
|
1216
|
+
activeChild = false,
|
|
1217
|
+
children,
|
|
1218
|
+
className
|
|
1219
|
+
}) {
|
|
1220
|
+
const { collapsed } = useSidebar();
|
|
1221
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
1222
|
+
const isOpen = controlledOpen ?? internalOpen;
|
|
1223
|
+
const toggle = () => {
|
|
1224
|
+
const next = !isOpen;
|
|
1225
|
+
setInternalOpen(next);
|
|
1226
|
+
onOpenChange?.(next);
|
|
1227
|
+
};
|
|
1228
|
+
if (collapsed) {
|
|
1229
|
+
return /* @__PURE__ */ jsx(
|
|
1230
|
+
"button",
|
|
1231
|
+
{
|
|
1232
|
+
type: "button",
|
|
1233
|
+
title: label,
|
|
1234
|
+
onClick: toggle,
|
|
1235
|
+
className: cn(
|
|
1236
|
+
"mx-auto flex h-10 w-10 min-h-[44px] min-w-[44px] items-center justify-center rounded-xl",
|
|
1237
|
+
"select-none outline-none transition-all duration-150",
|
|
1238
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1239
|
+
activeChild ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.28)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]",
|
|
1240
|
+
className
|
|
1241
|
+
),
|
|
1242
|
+
children: icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", !activeChild && "text-[#8E8E93]"), children: icon })
|
|
1243
|
+
}
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1246
|
+
const triggerActive = activeChild && !isOpen;
|
|
1247
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-0.5", className), children: [
|
|
1248
|
+
/* @__PURE__ */ jsxs(
|
|
1249
|
+
"button",
|
|
1250
|
+
{
|
|
1251
|
+
type: "button",
|
|
1252
|
+
onClick: toggle,
|
|
1253
|
+
className: cn(
|
|
1254
|
+
"flex w-full items-center gap-2.5 rounded-xl px-3 py-2.5 min-h-[44px]",
|
|
1255
|
+
"text-[13px] font-medium select-none outline-none transition-all duration-150",
|
|
1256
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1257
|
+
triggerActive ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.28)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]"
|
|
1258
|
+
),
|
|
1259
|
+
children: [
|
|
1260
|
+
icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", !triggerActive && "text-[#8E8E93]"), children: icon }),
|
|
1261
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: label }),
|
|
1262
|
+
badge !== void 0 && /* @__PURE__ */ jsx(
|
|
1263
|
+
"span",
|
|
1264
|
+
{
|
|
1265
|
+
className: cn(
|
|
1266
|
+
"flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[10px] font-bold",
|
|
1267
|
+
triggerActive ? "bg-white/20 text-white" : "bg-[#E5E5EA] text-[#8E8E93]"
|
|
1268
|
+
),
|
|
1269
|
+
children: badge
|
|
1270
|
+
}
|
|
1271
|
+
),
|
|
1272
|
+
/* @__PURE__ */ jsx(
|
|
1273
|
+
"svg",
|
|
1274
|
+
{
|
|
1275
|
+
className: cn(
|
|
1276
|
+
"h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200",
|
|
1277
|
+
triggerActive ? "text-white/60" : "text-[#C7C7CC]",
|
|
1278
|
+
isOpen && "rotate-90"
|
|
1279
|
+
),
|
|
1280
|
+
viewBox: "0 0 24 24",
|
|
1281
|
+
fill: "none",
|
|
1282
|
+
stroke: "currentColor",
|
|
1283
|
+
strokeWidth: "2.5",
|
|
1284
|
+
strokeLinecap: "round",
|
|
1285
|
+
strokeLinejoin: "round",
|
|
1286
|
+
children: /* @__PURE__ */ jsx("path", { d: "M9 18l6-6-6-6" })
|
|
1287
|
+
}
|
|
1288
|
+
)
|
|
1289
|
+
]
|
|
1290
|
+
}
|
|
1291
|
+
),
|
|
1292
|
+
/* @__PURE__ */ jsx(
|
|
1293
|
+
"div",
|
|
1294
|
+
{
|
|
1295
|
+
className: cn(
|
|
1296
|
+
"overflow-hidden transition-all duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]",
|
|
1297
|
+
isOpen ? "max-h-96 opacity-100" : "max-h-0 opacity-0 pointer-events-none"
|
|
1298
|
+
),
|
|
1299
|
+
children: /* @__PURE__ */ jsx("div", { className: "ml-3 space-y-0.5 border-l border-[#E5E5EA] py-0.5 pl-2", children })
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
] });
|
|
1303
|
+
}
|
|
1304
|
+
function SidebarSubMenuItem({
|
|
1305
|
+
icon,
|
|
1306
|
+
label,
|
|
1307
|
+
active = false,
|
|
1308
|
+
href,
|
|
1309
|
+
as: Tag = "button",
|
|
1310
|
+
className,
|
|
1311
|
+
...props
|
|
1312
|
+
}) {
|
|
1313
|
+
const tagProps = href ? { href } : { type: "button" };
|
|
1314
|
+
return /* @__PURE__ */ jsxs(
|
|
1315
|
+
Tag,
|
|
1316
|
+
{
|
|
1317
|
+
...tagProps,
|
|
1318
|
+
className: cn(
|
|
1319
|
+
"flex w-full items-center gap-2 rounded-lg px-2.5 py-2 min-h-[36px]",
|
|
1320
|
+
"text-[12px] font-medium select-none outline-none transition-all duration-150",
|
|
1321
|
+
"focus-visible:ring-2 focus-visible:ring-[#007AFF]/30",
|
|
1322
|
+
active ? "bg-[#007AFF] text-white shadow-[0_2px_8px_rgba(0,122,255,0.20)]" : "text-[#3C3C43] hover:bg-[#007AFF]/8 hover:text-[#007AFF]",
|
|
1323
|
+
className
|
|
1324
|
+
),
|
|
1325
|
+
...props,
|
|
1326
|
+
children: [
|
|
1327
|
+
icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", !active && "text-[#8E8E93]"), children: icon }),
|
|
1328
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: label })
|
|
1329
|
+
]
|
|
1330
|
+
}
|
|
1331
|
+
);
|
|
1332
|
+
}
|
|
1185
1333
|
function SidebarFooter({ className, ...props }) {
|
|
1186
1334
|
return /* @__PURE__ */ jsx("div", { className: cn("flex-shrink-0 p-3", className), ...props });
|
|
1187
1335
|
}
|
|
@@ -1263,4 +1411,4 @@ function useClickOutside(ref, handler, enabled = true) {
|
|
|
1263
1411
|
}, [ref, handler, enabled]);
|
|
1264
1412
|
}
|
|
1265
1413
|
|
|
1266
|
-
export { Badge, Button, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, CardTitle, Drawer, Input, MenuRoot as Menu, MenuButton, MenuContent, MenuRoot as MenuDropdown, MenuItem, MenuLabel, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, NavbarCenter, NavbarDivider, NavbarIconButton, NavbarLeft, NavbarRight, NavbarSearch, Scrollbar, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarBrand, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, SidebarHeader, SidebarItem, SidebarToggle, SidebarUser, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|
|
1414
|
+
export { Badge, Button, Card, CardContent, CardDescription, CardDivider, CardFooter, CardHeader, CardTitle, DataTable, Drawer, Input, MenuRoot as Menu, MenuButton, MenuContent, MenuRoot as MenuDropdown, MenuItem, MenuLabel, MenuRoot, MenuSeparator, MenuTrigger, Navbar, NavbarBrand, NavbarCenter, NavbarDivider, NavbarIconButton, NavbarLeft, NavbarRight, NavbarSearch, Scrollbar, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarBrand, SidebarContent, SidebarDivider, SidebarFooter, SidebarGroup, SidebarHeader, SidebarItem, SidebarSubMenu, SidebarSubMenuItem, SidebarToggle, SidebarUser, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, cn, colors, dismissToast, generateId, toast, useClickOutside, useKeydown, useToast, withScrollbar };
|