@andreagiugni/tailwind-dashboard-ui 0.3.0 → 0.4.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/README.md +4 -3
- package/dist/index.cjs +103 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -9
- package/dist/index.d.ts +24 -9
- package/dist/index.js +103 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -137,6 +137,22 @@ interface DropzoneProps {
|
|
|
137
137
|
/** Drag-and-drop file upload area — dependency-free (native HTML5 drag/drop). */
|
|
138
138
|
declare const Dropzone: React.FC<DropzoneProps>;
|
|
139
139
|
|
|
140
|
+
type PaginationAlign = "left" | "center" | "right" | "full";
|
|
141
|
+
interface PaginationProps {
|
|
142
|
+
currentPage: number;
|
|
143
|
+
totalPages: number;
|
|
144
|
+
onPageChange: (page: number) => void;
|
|
145
|
+
/**
|
|
146
|
+
* How the controls are laid out within the available width:
|
|
147
|
+
* - `left` / `center` / `right`: the compact group is left/center/right aligned.
|
|
148
|
+
* - `full`: stretches full width with Previous/Next pinned to the edges and the
|
|
149
|
+
* page indices centered between them.
|
|
150
|
+
* When omitted the controls shrink to their content (legacy behavior).
|
|
151
|
+
*/
|
|
152
|
+
align?: PaginationAlign;
|
|
153
|
+
}
|
|
154
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
155
|
+
|
|
140
156
|
type SortDirection = "asc" | "desc";
|
|
141
157
|
interface TableColumn<T> {
|
|
142
158
|
/** Key into the row object — also the value used for sorting/searching. */
|
|
@@ -168,6 +184,12 @@ interface TableProps<T = Record<string, unknown>> extends Omit<React.TableHTMLAt
|
|
|
168
184
|
rowsPerPageOptions?: number[];
|
|
169
185
|
/** Render pagination controls + the entry counter. Default: true. */
|
|
170
186
|
pagination?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Alignment of the pagination controls: `left` / `center` / `right`, or `full`
|
|
189
|
+
* (full width with Previous/Next pinned to the edges and the page indices
|
|
190
|
+
* centered). Default: `right`.
|
|
191
|
+
*/
|
|
192
|
+
paginationAlign?: PaginationAlign;
|
|
171
193
|
/** Render the "Show N entries" selector (only when pagination is on). Default: true. */
|
|
172
194
|
showSizeSelector?: boolean;
|
|
173
195
|
/**
|
|
@@ -199,14 +221,7 @@ interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
|
199
221
|
isHeader?: boolean;
|
|
200
222
|
}
|
|
201
223
|
declare const TableCell: React.FC<TableCellProps>;
|
|
202
|
-
declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ children, data, columns, rowsPerPage, rowsPerPageOptions, pagination, showSizeSelector, searchKeys, searchPlaceholder, defaultSortKey, defaultSortDirection, getRowId, onRowClick, emptyContent, className, ...rest }: TableProps<T>): React.JSX.Element;
|
|
203
|
-
|
|
204
|
-
interface PaginationProps {
|
|
205
|
-
currentPage: number;
|
|
206
|
-
totalPages: number;
|
|
207
|
-
onPageChange: (page: number) => void;
|
|
208
|
-
}
|
|
209
|
-
declare const Pagination: React.FC<PaginationProps>;
|
|
224
|
+
declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ children, data, columns, rowsPerPage, rowsPerPageOptions, pagination, paginationAlign, showSizeSelector, searchKeys, searchPlaceholder, defaultSortKey, defaultSortDirection, getRowId, onRowClick, emptyContent, className, ...rest }: TableProps<T>): React.JSX.Element;
|
|
210
225
|
|
|
211
226
|
interface BreadcrumbItem {
|
|
212
227
|
label: string;
|
|
@@ -609,4 +624,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
609
624
|
}
|
|
610
625
|
declare const Slider: React.FC<SliderProps>;
|
|
611
626
|
|
|
612
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
|
627
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.d.ts
CHANGED
|
@@ -137,6 +137,22 @@ interface DropzoneProps {
|
|
|
137
137
|
/** Drag-and-drop file upload area — dependency-free (native HTML5 drag/drop). */
|
|
138
138
|
declare const Dropzone: React.FC<DropzoneProps>;
|
|
139
139
|
|
|
140
|
+
type PaginationAlign = "left" | "center" | "right" | "full";
|
|
141
|
+
interface PaginationProps {
|
|
142
|
+
currentPage: number;
|
|
143
|
+
totalPages: number;
|
|
144
|
+
onPageChange: (page: number) => void;
|
|
145
|
+
/**
|
|
146
|
+
* How the controls are laid out within the available width:
|
|
147
|
+
* - `left` / `center` / `right`: the compact group is left/center/right aligned.
|
|
148
|
+
* - `full`: stretches full width with Previous/Next pinned to the edges and the
|
|
149
|
+
* page indices centered between them.
|
|
150
|
+
* When omitted the controls shrink to their content (legacy behavior).
|
|
151
|
+
*/
|
|
152
|
+
align?: PaginationAlign;
|
|
153
|
+
}
|
|
154
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
155
|
+
|
|
140
156
|
type SortDirection = "asc" | "desc";
|
|
141
157
|
interface TableColumn<T> {
|
|
142
158
|
/** Key into the row object — also the value used for sorting/searching. */
|
|
@@ -168,6 +184,12 @@ interface TableProps<T = Record<string, unknown>> extends Omit<React.TableHTMLAt
|
|
|
168
184
|
rowsPerPageOptions?: number[];
|
|
169
185
|
/** Render pagination controls + the entry counter. Default: true. */
|
|
170
186
|
pagination?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Alignment of the pagination controls: `left` / `center` / `right`, or `full`
|
|
189
|
+
* (full width with Previous/Next pinned to the edges and the page indices
|
|
190
|
+
* centered). Default: `right`.
|
|
191
|
+
*/
|
|
192
|
+
paginationAlign?: PaginationAlign;
|
|
171
193
|
/** Render the "Show N entries" selector (only when pagination is on). Default: true. */
|
|
172
194
|
showSizeSelector?: boolean;
|
|
173
195
|
/**
|
|
@@ -199,14 +221,7 @@ interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
|
199
221
|
isHeader?: boolean;
|
|
200
222
|
}
|
|
201
223
|
declare const TableCell: React.FC<TableCellProps>;
|
|
202
|
-
declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ children, data, columns, rowsPerPage, rowsPerPageOptions, pagination, showSizeSelector, searchKeys, searchPlaceholder, defaultSortKey, defaultSortDirection, getRowId, onRowClick, emptyContent, className, ...rest }: TableProps<T>): React.JSX.Element;
|
|
203
|
-
|
|
204
|
-
interface PaginationProps {
|
|
205
|
-
currentPage: number;
|
|
206
|
-
totalPages: number;
|
|
207
|
-
onPageChange: (page: number) => void;
|
|
208
|
-
}
|
|
209
|
-
declare const Pagination: React.FC<PaginationProps>;
|
|
224
|
+
declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ children, data, columns, rowsPerPage, rowsPerPageOptions, pagination, paginationAlign, showSizeSelector, searchKeys, searchPlaceholder, defaultSortKey, defaultSortDirection, getRowId, onRowClick, emptyContent, className, ...rest }: TableProps<T>): React.JSX.Element;
|
|
210
225
|
|
|
211
226
|
interface BreadcrumbItem {
|
|
212
227
|
label: string;
|
|
@@ -609,4 +624,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
609
624
|
}
|
|
610
625
|
declare const Slider: React.FC<SliderProps>;
|
|
611
626
|
|
|
612
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationProps, PasswordInput, type PasswordInputProps, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
|
627
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionSelectionMode, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, AvatarText, type AvatarTextProps, Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipColor, type ChipProps, type ChipSize, type ChipVariant, Code, type CodeColor, type CodeProps, type CodeSize, ColorOverrideProps, DatePicker, type DatePickerProps, DateTimePicker, type DateTimePickerProps, Drawer, type DrawerPlacement, type DrawerProps, Dropdown, DropdownItem, type DropdownItemProps, type DropdownItemVariant, type DropdownProps, Dropzone, type DropzoneProps, FileInput, type FileInputProps, Form, type FormProps, Input, type InputProps, Label, type LabelProps, Modal, type ModalProps, type ModalVariant, MultiSelect, type MultiSelectProps, Pagination, type PaginationAlign, type PaginationProps, PasswordInput, type PasswordInputProps, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressColor, type ProgressProps, type ProgressSize, Radio, type RadioProps, RadioSm, type RadioSmProps, Ribbon, type RibbonColor, type RibbonPosition, type RibbonProps, type RibbonVariant, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderColor, type SliderProps, Snippet, type SnippetProps, type SnippetSize, type SortDirection, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, TableCell, type TableCellProps, type TableColumn, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSectionProps, Tabs, type TabsProps, type TabsVariant, TextArea, type TextAreaProps, ThemeToggleButton, type ThemeToggleButtonProps, Toast, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ function styleOverride({
|
|
|
25
25
|
}
|
|
26
26
|
var sizeClasses = {
|
|
27
27
|
sm: "px-4 py-3 text-sm",
|
|
28
|
-
md: "px-5 py-
|
|
28
|
+
md: "px-5 py-2.5 text-sm"
|
|
29
29
|
};
|
|
30
30
|
var variantClasses = {
|
|
31
31
|
primary: "bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600 disabled:bg-brand-300",
|
|
@@ -546,64 +546,87 @@ var Dropzone = ({
|
|
|
546
546
|
}
|
|
547
547
|
);
|
|
548
548
|
};
|
|
549
|
+
var navButton = "flex h-10 items-center justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-sm text-gray-700 shadow-theme-xs hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03]";
|
|
550
|
+
var justifyByAlign = {
|
|
551
|
+
left: "justify-start",
|
|
552
|
+
center: "justify-center",
|
|
553
|
+
right: "justify-end"
|
|
554
|
+
};
|
|
549
555
|
var Pagination = ({
|
|
550
556
|
currentPage,
|
|
551
557
|
totalPages,
|
|
552
|
-
onPageChange
|
|
558
|
+
onPageChange,
|
|
559
|
+
align
|
|
553
560
|
}) => {
|
|
554
561
|
const pagesAroundCurrent = Array.from(
|
|
555
562
|
{ length: Math.min(3, totalPages) },
|
|
556
563
|
(_, i) => i + Math.max(currentPage - 1, 1)
|
|
557
564
|
);
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
)
|
|
571
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
572
|
-
currentPage > 3 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." }),
|
|
573
|
-
pagesAroundCurrent.map((page) => /* @__PURE__ */ jsx(
|
|
574
|
-
"button",
|
|
575
|
-
{
|
|
576
|
-
onClick: () => onPageChange(page),
|
|
577
|
-
"aria-current": currentPage === page ? "page" : void 0,
|
|
578
|
-
className: cn(
|
|
579
|
-
"flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
|
|
580
|
-
currentPage === page ? (
|
|
581
|
-
// active page keeps its color on hover (no hover restyle)
|
|
582
|
-
"bg-brand-500 text-white"
|
|
583
|
-
) : (
|
|
584
|
-
// hover effect applies only to non-active page indices
|
|
585
|
-
"text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
|
|
586
|
-
)
|
|
587
|
-
),
|
|
588
|
-
children: page
|
|
589
|
-
},
|
|
590
|
-
page
|
|
591
|
-
)),
|
|
592
|
-
currentPage < totalPages - 2 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." })
|
|
593
|
-
] }),
|
|
594
|
-
/* @__PURE__ */ jsx(
|
|
565
|
+
const prev = /* @__PURE__ */ jsx(
|
|
566
|
+
"button",
|
|
567
|
+
{
|
|
568
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
569
|
+
disabled: currentPage === 1,
|
|
570
|
+
"aria-label": "Previous",
|
|
571
|
+
className: navButton,
|
|
572
|
+
children: "Previous"
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
const indices = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
576
|
+
currentPage > 3 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." }),
|
|
577
|
+
pagesAroundCurrent.map((page) => /* @__PURE__ */ jsx(
|
|
595
578
|
"button",
|
|
596
579
|
{
|
|
597
|
-
onClick: () => onPageChange(
|
|
598
|
-
|
|
599
|
-
"aria-label": "Next",
|
|
580
|
+
onClick: () => onPageChange(page),
|
|
581
|
+
"aria-current": currentPage === page ? "page" : void 0,
|
|
600
582
|
className: cn(
|
|
601
|
-
"
|
|
583
|
+
"flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
|
|
584
|
+
currentPage === page ? (
|
|
585
|
+
// active page keeps its color on hover (no hover restyle)
|
|
586
|
+
"bg-brand-500 text-white"
|
|
587
|
+
) : (
|
|
588
|
+
// hover effect applies only to non-active page indices
|
|
589
|
+
"text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
|
|
590
|
+
)
|
|
602
591
|
),
|
|
603
|
-
children:
|
|
604
|
-
}
|
|
605
|
-
|
|
592
|
+
children: page
|
|
593
|
+
},
|
|
594
|
+
page
|
|
595
|
+
)),
|
|
596
|
+
currentPage < totalPages - 2 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." })
|
|
606
597
|
] });
|
|
598
|
+
const next = /* @__PURE__ */ jsx(
|
|
599
|
+
"button",
|
|
600
|
+
{
|
|
601
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
602
|
+
disabled: currentPage === totalPages,
|
|
603
|
+
"aria-label": "Next",
|
|
604
|
+
className: navButton,
|
|
605
|
+
children: "Next"
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
if (align === "full") {
|
|
609
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
610
|
+
prev,
|
|
611
|
+
indices,
|
|
612
|
+
next
|
|
613
|
+
] });
|
|
614
|
+
}
|
|
615
|
+
return /* @__PURE__ */ jsxs(
|
|
616
|
+
"div",
|
|
617
|
+
{
|
|
618
|
+
className: cn(
|
|
619
|
+
"flex items-center gap-2.5",
|
|
620
|
+
align && "w-full",
|
|
621
|
+
align && justifyByAlign[align]
|
|
622
|
+
),
|
|
623
|
+
children: [
|
|
624
|
+
prev,
|
|
625
|
+
indices,
|
|
626
|
+
next
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
);
|
|
607
630
|
};
|
|
608
631
|
var Input = ({
|
|
609
632
|
className,
|
|
@@ -669,6 +692,7 @@ function DataDrivenTable({
|
|
|
669
692
|
rowsPerPage = 10,
|
|
670
693
|
rowsPerPageOptions = [5, 10, 25, 50],
|
|
671
694
|
pagination = true,
|
|
695
|
+
paginationAlign = "right",
|
|
672
696
|
showSizeSelector = true,
|
|
673
697
|
searchKeys,
|
|
674
698
|
searchPlaceholder = "Search...",
|
|
@@ -720,6 +744,7 @@ function DataDrivenTable({
|
|
|
720
744
|
const sizeOptions = rowsPerPageOptions.length ? rowsPerPageOptions : [];
|
|
721
745
|
const showSelector = pagination && showSizeSelector && sizeOptions.length > 1;
|
|
722
746
|
const showControls = showSearch || showSelector;
|
|
747
|
+
const counterText = total === 0 ? "Showing 0 entries" : `Showing ${start + 1} to ${Math.min(start + pageSize, total)} of ${total} entries`;
|
|
723
748
|
return /* @__PURE__ */ jsxs(
|
|
724
749
|
"div",
|
|
725
750
|
{
|
|
@@ -818,10 +843,36 @@ function DataDrivenTable({
|
|
|
818
843
|
pageRows.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columns.length, className: "px-5 py-6 text-center text-sm text-gray-400", children: emptyContent }) })
|
|
819
844
|
] })
|
|
820
845
|
] }) }),
|
|
821
|
-
pagination && /* @__PURE__ */
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
846
|
+
pagination && /* @__PURE__ */ jsx("div", { className: "p-4", children: paginationAlign === "right" ? (
|
|
847
|
+
// Default layout: entry counter on the left, controls on the right.
|
|
848
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
849
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: counterText }),
|
|
850
|
+
totalPages > 1 && /* @__PURE__ */ jsx(Pagination, { currentPage: current, totalPages, onPageChange: setPage })
|
|
851
|
+
] })
|
|
852
|
+
) : (
|
|
853
|
+
// Aligned layout: controls aligned/stretched, counter underneath.
|
|
854
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
855
|
+
totalPages > 1 && /* @__PURE__ */ jsx(
|
|
856
|
+
Pagination,
|
|
857
|
+
{
|
|
858
|
+
align: paginationAlign,
|
|
859
|
+
currentPage: current,
|
|
860
|
+
totalPages,
|
|
861
|
+
onPageChange: setPage
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
/* @__PURE__ */ jsx(
|
|
865
|
+
"p",
|
|
866
|
+
{
|
|
867
|
+
className: cn(
|
|
868
|
+
"text-sm text-gray-500 dark:text-gray-400",
|
|
869
|
+
paginationAlign === "center" && "text-center"
|
|
870
|
+
),
|
|
871
|
+
children: counterText
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
] })
|
|
875
|
+
) })
|
|
825
876
|
]
|
|
826
877
|
}
|
|
827
878
|
);
|
|
@@ -833,6 +884,7 @@ function Table({
|
|
|
833
884
|
rowsPerPage,
|
|
834
885
|
rowsPerPageOptions,
|
|
835
886
|
pagination,
|
|
887
|
+
paginationAlign,
|
|
836
888
|
showSizeSelector,
|
|
837
889
|
searchKeys,
|
|
838
890
|
searchPlaceholder,
|
|
@@ -853,6 +905,7 @@ function Table({
|
|
|
853
905
|
rowsPerPage,
|
|
854
906
|
rowsPerPageOptions,
|
|
855
907
|
pagination,
|
|
908
|
+
paginationAlign,
|
|
856
909
|
showSizeSelector,
|
|
857
910
|
searchKeys,
|
|
858
911
|
searchPlaceholder,
|