@andreagiugni/tailwind-dashboard-ui 0.3.0 → 0.5.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 +16 -3
- package/dist/chunk-3T6AZMUZ.cjs +158 -0
- package/dist/chunk-3T6AZMUZ.cjs.map +1 -0
- package/dist/chunk-AGRX5ZR6.js +156 -0
- package/dist/chunk-AGRX5ZR6.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.cjs +14 -0
- package/dist/components/ColorPicker/ColorPicker.cjs.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.cts +23 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +23 -0
- package/dist/components/ColorPicker/ColorPicker.js +5 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/index.cjs +108 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -9
- package/dist/index.d.ts +26 -9
- package/dist/index.js +104 -50
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -7,9 +7,11 @@ export { BarChart, BarChartProps } from './components/Charts/BarChart.cjs';
|
|
|
7
7
|
export { LineChart, LineChartProps } from './components/Charts/LineChart.cjs';
|
|
8
8
|
export { Calendar, CalendarProps } from './components/Calendar/Calendar.cjs';
|
|
9
9
|
export { CountryMap, CountryMapProps } from './components/Map/CountryMap.cjs';
|
|
10
|
+
export { ColorPicker, ColorPickerFormat, ColorPickerProps } from './components/ColorPicker/ColorPicker.cjs';
|
|
10
11
|
import '@tiptap/react';
|
|
11
12
|
import 'apexcharts';
|
|
12
13
|
import '@fullcalendar/core';
|
|
14
|
+
import 'react-beautiful-color';
|
|
13
15
|
|
|
14
16
|
declare function cn(...inputs: ClassValue[]): string;
|
|
15
17
|
|
|
@@ -137,6 +139,22 @@ interface DropzoneProps {
|
|
|
137
139
|
/** Drag-and-drop file upload area — dependency-free (native HTML5 drag/drop). */
|
|
138
140
|
declare const Dropzone: React.FC<DropzoneProps>;
|
|
139
141
|
|
|
142
|
+
type PaginationAlign = "left" | "center" | "right" | "full";
|
|
143
|
+
interface PaginationProps {
|
|
144
|
+
currentPage: number;
|
|
145
|
+
totalPages: number;
|
|
146
|
+
onPageChange: (page: number) => void;
|
|
147
|
+
/**
|
|
148
|
+
* How the controls are laid out within the available width:
|
|
149
|
+
* - `left` / `center` / `right`: the compact group is left/center/right aligned.
|
|
150
|
+
* - `full`: stretches full width with Previous/Next pinned to the edges and the
|
|
151
|
+
* page indices centered between them.
|
|
152
|
+
* When omitted the controls shrink to their content (legacy behavior).
|
|
153
|
+
*/
|
|
154
|
+
align?: PaginationAlign;
|
|
155
|
+
}
|
|
156
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
157
|
+
|
|
140
158
|
type SortDirection = "asc" | "desc";
|
|
141
159
|
interface TableColumn<T> {
|
|
142
160
|
/** Key into the row object — also the value used for sorting/searching. */
|
|
@@ -168,6 +186,12 @@ interface TableProps<T = Record<string, unknown>> extends Omit<React.TableHTMLAt
|
|
|
168
186
|
rowsPerPageOptions?: number[];
|
|
169
187
|
/** Render pagination controls + the entry counter. Default: true. */
|
|
170
188
|
pagination?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Alignment of the pagination controls: `left` / `center` / `right`, or `full`
|
|
191
|
+
* (full width with Previous/Next pinned to the edges and the page indices
|
|
192
|
+
* centered). Default: `right`.
|
|
193
|
+
*/
|
|
194
|
+
paginationAlign?: PaginationAlign;
|
|
171
195
|
/** Render the "Show N entries" selector (only when pagination is on). Default: true. */
|
|
172
196
|
showSizeSelector?: boolean;
|
|
173
197
|
/**
|
|
@@ -199,14 +223,7 @@ interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
|
199
223
|
isHeader?: boolean;
|
|
200
224
|
}
|
|
201
225
|
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>;
|
|
226
|
+
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
227
|
|
|
211
228
|
interface BreadcrumbItem {
|
|
212
229
|
label: string;
|
|
@@ -609,4 +626,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
609
626
|
}
|
|
610
627
|
declare const Slider: React.FC<SliderProps>;
|
|
611
628
|
|
|
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 };
|
|
629
|
+
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
|
@@ -7,9 +7,11 @@ export { BarChart, BarChartProps } from './components/Charts/BarChart.js';
|
|
|
7
7
|
export { LineChart, LineChartProps } from './components/Charts/LineChart.js';
|
|
8
8
|
export { Calendar, CalendarProps } from './components/Calendar/Calendar.js';
|
|
9
9
|
export { CountryMap, CountryMapProps } from './components/Map/CountryMap.js';
|
|
10
|
+
export { ColorPicker, ColorPickerFormat, ColorPickerProps } from './components/ColorPicker/ColorPicker.js';
|
|
10
11
|
import '@tiptap/react';
|
|
11
12
|
import 'apexcharts';
|
|
12
13
|
import '@fullcalendar/core';
|
|
14
|
+
import 'react-beautiful-color';
|
|
13
15
|
|
|
14
16
|
declare function cn(...inputs: ClassValue[]): string;
|
|
15
17
|
|
|
@@ -137,6 +139,22 @@ interface DropzoneProps {
|
|
|
137
139
|
/** Drag-and-drop file upload area — dependency-free (native HTML5 drag/drop). */
|
|
138
140
|
declare const Dropzone: React.FC<DropzoneProps>;
|
|
139
141
|
|
|
142
|
+
type PaginationAlign = "left" | "center" | "right" | "full";
|
|
143
|
+
interface PaginationProps {
|
|
144
|
+
currentPage: number;
|
|
145
|
+
totalPages: number;
|
|
146
|
+
onPageChange: (page: number) => void;
|
|
147
|
+
/**
|
|
148
|
+
* How the controls are laid out within the available width:
|
|
149
|
+
* - `left` / `center` / `right`: the compact group is left/center/right aligned.
|
|
150
|
+
* - `full`: stretches full width with Previous/Next pinned to the edges and the
|
|
151
|
+
* page indices centered between them.
|
|
152
|
+
* When omitted the controls shrink to their content (legacy behavior).
|
|
153
|
+
*/
|
|
154
|
+
align?: PaginationAlign;
|
|
155
|
+
}
|
|
156
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
157
|
+
|
|
140
158
|
type SortDirection = "asc" | "desc";
|
|
141
159
|
interface TableColumn<T> {
|
|
142
160
|
/** Key into the row object — also the value used for sorting/searching. */
|
|
@@ -168,6 +186,12 @@ interface TableProps<T = Record<string, unknown>> extends Omit<React.TableHTMLAt
|
|
|
168
186
|
rowsPerPageOptions?: number[];
|
|
169
187
|
/** Render pagination controls + the entry counter. Default: true. */
|
|
170
188
|
pagination?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Alignment of the pagination controls: `left` / `center` / `right`, or `full`
|
|
191
|
+
* (full width with Previous/Next pinned to the edges and the page indices
|
|
192
|
+
* centered). Default: `right`.
|
|
193
|
+
*/
|
|
194
|
+
paginationAlign?: PaginationAlign;
|
|
171
195
|
/** Render the "Show N entries" selector (only when pagination is on). Default: true. */
|
|
172
196
|
showSizeSelector?: boolean;
|
|
173
197
|
/**
|
|
@@ -199,14 +223,7 @@ interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
|
199
223
|
isHeader?: boolean;
|
|
200
224
|
}
|
|
201
225
|
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>;
|
|
226
|
+
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
227
|
|
|
211
228
|
interface BreadcrumbItem {
|
|
212
229
|
label: string;
|
|
@@ -609,4 +626,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
609
626
|
}
|
|
610
627
|
declare const Slider: React.FC<SliderProps>;
|
|
611
628
|
|
|
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 };
|
|
629
|
+
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
|
@@ -4,6 +4,7 @@ export { LineChart } from './chunk-MEU4PMP5.js';
|
|
|
4
4
|
export { Calendar, Modal } from './chunk-7OWZKV75.js';
|
|
5
5
|
export { CountryMap } from './chunk-R66LONPQ.js';
|
|
6
6
|
export { Editor } from './chunk-4OETC46A.js';
|
|
7
|
+
export { ColorPicker } from './chunk-AGRX5ZR6.js';
|
|
7
8
|
import { cn } from './chunk-ZLIYUUA4.js';
|
|
8
9
|
export { cn } from './chunk-ZLIYUUA4.js';
|
|
9
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -25,7 +26,7 @@ function styleOverride({
|
|
|
25
26
|
}
|
|
26
27
|
var sizeClasses = {
|
|
27
28
|
sm: "px-4 py-3 text-sm",
|
|
28
|
-
md: "px-5 py-
|
|
29
|
+
md: "px-5 py-2.5 text-sm"
|
|
29
30
|
};
|
|
30
31
|
var variantClasses = {
|
|
31
32
|
primary: "bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600 disabled:bg-brand-300",
|
|
@@ -546,64 +547,87 @@ var Dropzone = ({
|
|
|
546
547
|
}
|
|
547
548
|
);
|
|
548
549
|
};
|
|
550
|
+
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]";
|
|
551
|
+
var justifyByAlign = {
|
|
552
|
+
left: "justify-start",
|
|
553
|
+
center: "justify-center",
|
|
554
|
+
right: "justify-end"
|
|
555
|
+
};
|
|
549
556
|
var Pagination = ({
|
|
550
557
|
currentPage,
|
|
551
558
|
totalPages,
|
|
552
|
-
onPageChange
|
|
559
|
+
onPageChange,
|
|
560
|
+
align
|
|
553
561
|
}) => {
|
|
554
562
|
const pagesAroundCurrent = Array.from(
|
|
555
563
|
{ length: Math.min(3, totalPages) },
|
|
556
564
|
(_, i) => i + Math.max(currentPage - 1, 1)
|
|
557
565
|
);
|
|
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(
|
|
566
|
+
const prev = /* @__PURE__ */ jsx(
|
|
567
|
+
"button",
|
|
568
|
+
{
|
|
569
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
570
|
+
disabled: currentPage === 1,
|
|
571
|
+
"aria-label": "Previous",
|
|
572
|
+
className: navButton,
|
|
573
|
+
children: "Previous"
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
const indices = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
577
|
+
currentPage > 3 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." }),
|
|
578
|
+
pagesAroundCurrent.map((page) => /* @__PURE__ */ jsx(
|
|
595
579
|
"button",
|
|
596
580
|
{
|
|
597
|
-
onClick: () => onPageChange(
|
|
598
|
-
|
|
599
|
-
"aria-label": "Next",
|
|
581
|
+
onClick: () => onPageChange(page),
|
|
582
|
+
"aria-current": currentPage === page ? "page" : void 0,
|
|
600
583
|
className: cn(
|
|
601
|
-
"
|
|
584
|
+
"flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
|
|
585
|
+
currentPage === page ? (
|
|
586
|
+
// active page keeps its color on hover (no hover restyle)
|
|
587
|
+
"bg-brand-500 text-white"
|
|
588
|
+
) : (
|
|
589
|
+
// hover effect applies only to non-active page indices
|
|
590
|
+
"text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
|
|
591
|
+
)
|
|
602
592
|
),
|
|
603
|
-
children:
|
|
604
|
-
}
|
|
605
|
-
|
|
593
|
+
children: page
|
|
594
|
+
},
|
|
595
|
+
page
|
|
596
|
+
)),
|
|
597
|
+
currentPage < totalPages - 2 && /* @__PURE__ */ jsx("span", { className: "px-2", children: "..." })
|
|
606
598
|
] });
|
|
599
|
+
const next = /* @__PURE__ */ jsx(
|
|
600
|
+
"button",
|
|
601
|
+
{
|
|
602
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
603
|
+
disabled: currentPage === totalPages,
|
|
604
|
+
"aria-label": "Next",
|
|
605
|
+
className: navButton,
|
|
606
|
+
children: "Next"
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
if (align === "full") {
|
|
610
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
611
|
+
prev,
|
|
612
|
+
indices,
|
|
613
|
+
next
|
|
614
|
+
] });
|
|
615
|
+
}
|
|
616
|
+
return /* @__PURE__ */ jsxs(
|
|
617
|
+
"div",
|
|
618
|
+
{
|
|
619
|
+
className: cn(
|
|
620
|
+
"flex items-center gap-2.5",
|
|
621
|
+
align && "w-full",
|
|
622
|
+
align && justifyByAlign[align]
|
|
623
|
+
),
|
|
624
|
+
children: [
|
|
625
|
+
prev,
|
|
626
|
+
indices,
|
|
627
|
+
next
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
);
|
|
607
631
|
};
|
|
608
632
|
var Input = ({
|
|
609
633
|
className,
|
|
@@ -669,6 +693,7 @@ function DataDrivenTable({
|
|
|
669
693
|
rowsPerPage = 10,
|
|
670
694
|
rowsPerPageOptions = [5, 10, 25, 50],
|
|
671
695
|
pagination = true,
|
|
696
|
+
paginationAlign = "right",
|
|
672
697
|
showSizeSelector = true,
|
|
673
698
|
searchKeys,
|
|
674
699
|
searchPlaceholder = "Search...",
|
|
@@ -720,6 +745,7 @@ function DataDrivenTable({
|
|
|
720
745
|
const sizeOptions = rowsPerPageOptions.length ? rowsPerPageOptions : [];
|
|
721
746
|
const showSelector = pagination && showSizeSelector && sizeOptions.length > 1;
|
|
722
747
|
const showControls = showSearch || showSelector;
|
|
748
|
+
const counterText = total === 0 ? "Showing 0 entries" : `Showing ${start + 1} to ${Math.min(start + pageSize, total)} of ${total} entries`;
|
|
723
749
|
return /* @__PURE__ */ jsxs(
|
|
724
750
|
"div",
|
|
725
751
|
{
|
|
@@ -818,10 +844,36 @@ function DataDrivenTable({
|
|
|
818
844
|
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
845
|
] })
|
|
820
846
|
] }) }),
|
|
821
|
-
pagination && /* @__PURE__ */
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
847
|
+
pagination && /* @__PURE__ */ jsx("div", { className: "p-4", children: paginationAlign === "right" ? (
|
|
848
|
+
// Default layout: entry counter on the left, controls on the right.
|
|
849
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
850
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: counterText }),
|
|
851
|
+
totalPages > 1 && /* @__PURE__ */ jsx(Pagination, { currentPage: current, totalPages, onPageChange: setPage })
|
|
852
|
+
] })
|
|
853
|
+
) : (
|
|
854
|
+
// Aligned layout: controls aligned/stretched, counter underneath.
|
|
855
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
856
|
+
totalPages > 1 && /* @__PURE__ */ jsx(
|
|
857
|
+
Pagination,
|
|
858
|
+
{
|
|
859
|
+
align: paginationAlign,
|
|
860
|
+
currentPage: current,
|
|
861
|
+
totalPages,
|
|
862
|
+
onPageChange: setPage
|
|
863
|
+
}
|
|
864
|
+
),
|
|
865
|
+
/* @__PURE__ */ jsx(
|
|
866
|
+
"p",
|
|
867
|
+
{
|
|
868
|
+
className: cn(
|
|
869
|
+
"text-sm text-gray-500 dark:text-gray-400",
|
|
870
|
+
paginationAlign === "center" && "text-center"
|
|
871
|
+
),
|
|
872
|
+
children: counterText
|
|
873
|
+
}
|
|
874
|
+
)
|
|
875
|
+
] })
|
|
876
|
+
) })
|
|
825
877
|
]
|
|
826
878
|
}
|
|
827
879
|
);
|
|
@@ -833,6 +885,7 @@ function Table({
|
|
|
833
885
|
rowsPerPage,
|
|
834
886
|
rowsPerPageOptions,
|
|
835
887
|
pagination,
|
|
888
|
+
paginationAlign,
|
|
836
889
|
showSizeSelector,
|
|
837
890
|
searchKeys,
|
|
838
891
|
searchPlaceholder,
|
|
@@ -853,6 +906,7 @@ function Table({
|
|
|
853
906
|
rowsPerPage,
|
|
854
907
|
rowsPerPageOptions,
|
|
855
908
|
pagination,
|
|
909
|
+
paginationAlign,
|
|
856
910
|
showSizeSelector,
|
|
857
911
|
searchKeys,
|
|
858
912
|
searchPlaceholder,
|