avt-rct-lib 1.0.1 โ 1.0.2
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 +25 -0
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +25 -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: () => {
|
|
@@ -1278,6 +1302,7 @@ exports.CardDivider = CardDivider;
|
|
|
1278
1302
|
exports.CardFooter = CardFooter;
|
|
1279
1303
|
exports.CardHeader = CardHeader;
|
|
1280
1304
|
exports.CardTitle = CardTitle;
|
|
1305
|
+
exports.DataTable = DataTable;
|
|
1281
1306
|
exports.Drawer = Drawer;
|
|
1282
1307
|
exports.Input = Input;
|
|
1283
1308
|
exports.Menu = MenuRoot;
|
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;
|
|
@@ -295,4 +320,4 @@ declare const colors: {
|
|
|
295
320
|
};
|
|
296
321
|
declare function generateId(): string;
|
|
297
322
|
|
|
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 };
|
|
323
|
+
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, 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;
|
|
@@ -295,4 +320,4 @@ declare const colors: {
|
|
|
295
320
|
};
|
|
296
321
|
declare function generateId(): string;
|
|
297
322
|
|
|
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 };
|
|
323
|
+
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, 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: () => {
|
|
@@ -1263,4 +1287,4 @@ function useClickOutside(ref, handler, enabled = true) {
|
|
|
1263
1287
|
}, [ref, handler, enabled]);
|
|
1264
1288
|
}
|
|
1265
1289
|
|
|
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 };
|
|
1290
|
+
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, 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 };
|