@andreagiugni/tailwind-dashboard-ui 1.0.28 → 1.0.30
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/dist/index.cjs +31 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +31 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -687,4 +687,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
687
687
|
}
|
|
688
688
|
declare const Slider: React.FC<SliderProps>;
|
|
689
689
|
|
|
690
|
-
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, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, 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 SelectOption, 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 };
|
|
690
|
+
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, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, 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 SelectOption, 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 ToastPosition, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.d.ts
CHANGED
|
@@ -687,4 +687,4 @@ interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
687
687
|
}
|
|
688
688
|
declare const Slider: React.FC<SliderProps>;
|
|
689
689
|
|
|
690
|
-
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, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, 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 SelectOption, 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 };
|
|
690
|
+
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, PollResults, type PollResultsColor, type PollResultsOption, type PollResultsProps, type PollResultsSeries, type PollResultsSize, type PollResultsTextColor, type PollResultsTextSize, type PollResultsTextWeight, 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 SelectOption, 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 ToastPosition, type ToastProps, type ToastVariant, Tooltip, type TooltipPlacement, type TooltipProps, cn };
|
package/dist/index.js
CHANGED
|
@@ -538,36 +538,48 @@ var justifyByAlign = {
|
|
|
538
538
|
center: "justify-center",
|
|
539
539
|
right: "justify-end"
|
|
540
540
|
};
|
|
541
|
+
var getPaginationItems = (currentPage, totalPages) => {
|
|
542
|
+
const total = Math.max(1, totalPages);
|
|
543
|
+
const current = Math.min(Math.max(currentPage, 1), total);
|
|
544
|
+
if (total <= 3) {
|
|
545
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
546
|
+
}
|
|
547
|
+
if (current === 1) {
|
|
548
|
+
return [1, 2, "ellipsis", total];
|
|
549
|
+
}
|
|
550
|
+
if (current === total) {
|
|
551
|
+
return [1, "ellipsis", total - 1, total];
|
|
552
|
+
}
|
|
553
|
+
return [current - 1, current, current + 1];
|
|
554
|
+
};
|
|
541
555
|
var Pagination = ({
|
|
542
556
|
currentPage,
|
|
543
557
|
totalPages,
|
|
544
558
|
onPageChange,
|
|
545
559
|
align
|
|
546
560
|
}) => {
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
);
|
|
561
|
+
const total = Math.max(1, totalPages);
|
|
562
|
+
const current = Math.min(Math.max(currentPage, 1), total);
|
|
563
|
+
const paginationItems = getPaginationItems(current, total);
|
|
551
564
|
const prev = /* @__PURE__ */ jsx(
|
|
552
565
|
"button",
|
|
553
566
|
{
|
|
554
|
-
onClick: () => onPageChange(
|
|
555
|
-
disabled:
|
|
567
|
+
onClick: () => onPageChange(current - 1),
|
|
568
|
+
disabled: current === 1,
|
|
556
569
|
"aria-label": "Previous",
|
|
557
570
|
className: navButton,
|
|
558
571
|
children: "Previous"
|
|
559
572
|
}
|
|
560
573
|
);
|
|
561
|
-
const indices = /* @__PURE__ */
|
|
562
|
-
|
|
563
|
-
pagesAroundCurrent.map((page) => /* @__PURE__ */ jsx(
|
|
574
|
+
const indices = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: paginationItems.map(
|
|
575
|
+
(item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx("span", { className: "px-2 text-gray-500 dark:text-gray-400", children: "..." }, `ellipsis-${index}`) : /* @__PURE__ */ jsx(
|
|
564
576
|
"button",
|
|
565
577
|
{
|
|
566
|
-
onClick: () => onPageChange(
|
|
567
|
-
"aria-current":
|
|
578
|
+
onClick: () => onPageChange(item),
|
|
579
|
+
"aria-current": current === item ? "page" : void 0,
|
|
568
580
|
className: cn(
|
|
569
|
-
"flex w-10 items-center justify-center
|
|
570
|
-
|
|
581
|
+
"flex h-10 w-10 items-center justify-center rounded-lg text-sm font-medium",
|
|
582
|
+
current === item ? (
|
|
571
583
|
// active page keeps its color on hover (no hover restyle)
|
|
572
584
|
"bg-brand-500 text-white"
|
|
573
585
|
) : (
|
|
@@ -575,17 +587,16 @@ var Pagination = ({
|
|
|
575
587
|
"text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
|
|
576
588
|
)
|
|
577
589
|
),
|
|
578
|
-
children:
|
|
590
|
+
children: item
|
|
579
591
|
},
|
|
580
|
-
|
|
581
|
-
)
|
|
582
|
-
|
|
583
|
-
] });
|
|
592
|
+
item
|
|
593
|
+
)
|
|
594
|
+
) });
|
|
584
595
|
const next = /* @__PURE__ */ jsx(
|
|
585
596
|
"button",
|
|
586
597
|
{
|
|
587
|
-
onClick: () => onPageChange(
|
|
588
|
-
disabled:
|
|
598
|
+
onClick: () => onPageChange(current + 1),
|
|
599
|
+
disabled: current === total,
|
|
589
600
|
"aria-label": "Next",
|
|
590
601
|
className: navButton,
|
|
591
602
|
children: "Next"
|