@eqtylab/equality 3.0.0 → 3.2.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/dist/index.cjs +166 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +166 -73
- package/dist/index.js.map +1 -1
- package/dist/input.module.module.css.module.css +44 -0
- package/dist/pagination.module.module.css.module.css +79 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -501,10 +501,16 @@ declare const InfoCard: ({ label, description, icon, elevation, className, onCli
|
|
|
501
501
|
type InputProps = Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'suffix'> & {
|
|
502
502
|
prefix?: React$1.ReactNode;
|
|
503
503
|
suffix?: React$1.ReactNode;
|
|
504
|
+
helpText?: React$1.ReactNode;
|
|
505
|
+
errorText?: React$1.ReactNode | string[];
|
|
506
|
+
containerClassName?: string;
|
|
504
507
|
};
|
|
505
508
|
declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix"> & {
|
|
506
509
|
prefix?: React$1.ReactNode;
|
|
507
510
|
suffix?: React$1.ReactNode;
|
|
511
|
+
helpText?: React$1.ReactNode;
|
|
512
|
+
errorText?: React$1.ReactNode | string[];
|
|
513
|
+
containerClassName?: string;
|
|
508
514
|
} & React$1.RefAttributes<HTMLInputElement>>;
|
|
509
515
|
|
|
510
516
|
declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
|
|
@@ -566,12 +572,13 @@ interface PaginationProps {
|
|
|
566
572
|
onItemsPerPageChange?: (itemsPerPage: number) => void;
|
|
567
573
|
itemsPerPageOptions?: number[];
|
|
568
574
|
showInfo?: boolean;
|
|
575
|
+
showFirstLast?: boolean;
|
|
569
576
|
maxVisiblePages?: number;
|
|
570
577
|
className?: string;
|
|
571
578
|
type?: string;
|
|
572
579
|
scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
|
|
573
580
|
}
|
|
574
|
-
declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
|
|
581
|
+
declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
|
|
575
582
|
|
|
576
583
|
interface PanelLabelProps {
|
|
577
584
|
className?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -501,10 +501,16 @@ declare const InfoCard: ({ label, description, icon, elevation, className, onCli
|
|
|
501
501
|
type InputProps = Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'suffix'> & {
|
|
502
502
|
prefix?: React$1.ReactNode;
|
|
503
503
|
suffix?: React$1.ReactNode;
|
|
504
|
+
helpText?: React$1.ReactNode;
|
|
505
|
+
errorText?: React$1.ReactNode | string[];
|
|
506
|
+
containerClassName?: string;
|
|
504
507
|
};
|
|
505
508
|
declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix"> & {
|
|
506
509
|
prefix?: React$1.ReactNode;
|
|
507
510
|
suffix?: React$1.ReactNode;
|
|
511
|
+
helpText?: React$1.ReactNode;
|
|
512
|
+
errorText?: React$1.ReactNode | string[];
|
|
513
|
+
containerClassName?: string;
|
|
508
514
|
} & React$1.RefAttributes<HTMLInputElement>>;
|
|
509
515
|
|
|
510
516
|
declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
|
|
@@ -566,12 +572,13 @@ interface PaginationProps {
|
|
|
566
572
|
onItemsPerPageChange?: (itemsPerPage: number) => void;
|
|
567
573
|
itemsPerPageOptions?: number[];
|
|
568
574
|
showInfo?: boolean;
|
|
575
|
+
showFirstLast?: boolean;
|
|
569
576
|
maxVisiblePages?: number;
|
|
570
577
|
className?: string;
|
|
571
578
|
type?: string;
|
|
572
579
|
scrollTargetRef?: React$1.RefObject<HTMLElement | null> | string;
|
|
573
580
|
}
|
|
574
|
-
declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
|
|
581
|
+
declare const Pagination: ({ currentPage, totalItems, filteredItems, itemsPerPage, onPageChange, onItemsPerPageChange, itemsPerPageOptions, showInfo, showFirstLast, maxVisiblePages, className, type, scrollTargetRef, }: PaginationProps) => react_jsx_runtime.JSX.Element | null;
|
|
575
582
|
|
|
576
583
|
interface PanelLabelProps {
|
|
577
584
|
className?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React15 from 'react';
|
|
2
|
-
import { forwardRef,
|
|
2
|
+
import { forwardRef, useState, useRef, useEffect, useMemo, useSyncExternalStore, useCallback, useLayoutEffect, createElement } from 'react';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import styles2 from './alert.module.module.css.module.css';
|
|
5
5
|
import * as LucideIcons from 'lucide-react';
|
|
6
|
-
import { Check, ChevronRight, Search, Circle, ChevronDown, ChevronUp, X, SearchIcon, CalendarDays, ChevronLeft, Grid3X3, List, AlertOctagon, Home, ArrowUp, ArrowDown, ArrowUpDown, TriangleAlert } from 'lucide-react';
|
|
6
|
+
import { Check, ChevronRight, Search, Circle, CircleAlert, ChevronDown, ChevronUp, X, SearchIcon, CalendarDays, ChevronLeft, Grid3X3, List, AlertOctagon, Home, ChevronsLeft, ChevronsRight, ArrowUp, ArrowDown, ArrowUpDown, TriangleAlert } from 'lucide-react';
|
|
7
7
|
import styles from './icon.module.module.css.module.css';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -49,13 +49,13 @@ import styles26 from './form.module.module.css.module.css';
|
|
|
49
49
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
50
50
|
import styles25 from './label.module.module.css.module.css';
|
|
51
51
|
import styles27 from './info-card.module.module.css.module.css';
|
|
52
|
-
import
|
|
53
|
-
import styles29 from './list-or-grid-view-toggle.module.module.css.module.css';
|
|
54
|
-
import styles31 from './loading-overlay.module.module.css.module.css';
|
|
55
|
-
import styles30 from './spinner.module.module.css.module.css';
|
|
56
|
-
import styles32 from './metric-card.module.module.css.module.css';
|
|
52
|
+
import styles29 from './input.module.module.css.module.css';
|
|
57
53
|
import { AnimatePresence, motion } from 'motion/react';
|
|
58
|
-
import
|
|
54
|
+
import styles28 from './motion-collapsible.module.module.css.module.css';
|
|
55
|
+
import styles30 from './list-or-grid-view-toggle.module.module.css.module.css';
|
|
56
|
+
import styles32 from './loading-overlay.module.module.css.module.css';
|
|
57
|
+
import styles31 from './spinner.module.module.css.module.css';
|
|
58
|
+
import styles33 from './metric-card.module.module.css.module.css';
|
|
59
59
|
import styles34 from './page-not-found.module.module.css.module.css';
|
|
60
60
|
import styles36 from './pagination.module.module.css.module.css';
|
|
61
61
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -2442,12 +2442,96 @@ var InfoCard = ({
|
|
|
2442
2442
|
] })
|
|
2443
2443
|
] }) }) });
|
|
2444
2444
|
};
|
|
2445
|
+
var MotionCollapsibleContent = ({
|
|
2446
|
+
isOpen,
|
|
2447
|
+
children,
|
|
2448
|
+
className
|
|
2449
|
+
}) => {
|
|
2450
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
2451
|
+
const contentRef = useRef(null);
|
|
2452
|
+
useEffect(() => {
|
|
2453
|
+
if (contentRef.current) {
|
|
2454
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
2455
|
+
if (contentRef.current) {
|
|
2456
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
2457
|
+
}
|
|
2458
|
+
});
|
|
2459
|
+
resizeObserver.observe(contentRef.current);
|
|
2460
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
2461
|
+
return () => resizeObserver.disconnect();
|
|
2462
|
+
}
|
|
2463
|
+
}, [children]);
|
|
2464
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: isOpen && /* @__PURE__ */ jsx(
|
|
2465
|
+
motion.div,
|
|
2466
|
+
{
|
|
2467
|
+
initial: { height: 0, opacity: 0 },
|
|
2468
|
+
animate: { height: contentHeight, opacity: 1 },
|
|
2469
|
+
exit: { height: 0, opacity: 0 },
|
|
2470
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
2471
|
+
className: cn(styles28["motion-collapsible"], className),
|
|
2472
|
+
children: /* @__PURE__ */ jsx("div", { ref: contentRef, children })
|
|
2473
|
+
},
|
|
2474
|
+
"motion-content"
|
|
2475
|
+
) });
|
|
2476
|
+
};
|
|
2445
2477
|
var Input = React15.forwardRef(
|
|
2446
|
-
({
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2478
|
+
({
|
|
2479
|
+
className,
|
|
2480
|
+
containerClassName,
|
|
2481
|
+
type,
|
|
2482
|
+
prefix,
|
|
2483
|
+
suffix,
|
|
2484
|
+
helpText,
|
|
2485
|
+
errorText,
|
|
2486
|
+
"aria-describedby": ariaDescribedBy,
|
|
2487
|
+
"aria-invalid": ariaInvalid,
|
|
2488
|
+
...props
|
|
2489
|
+
}, ref) => {
|
|
2490
|
+
const id = React15.useId();
|
|
2491
|
+
const helpTextId = `${id}-help-text`;
|
|
2492
|
+
const errorTextId = `${id}-error-text`;
|
|
2493
|
+
const errorList = Array.isArray(errorText) && errorText.every((message) => typeof message === "string") ? [...new Set(errorText.filter((message) => !!message))] : null;
|
|
2494
|
+
const hasErrorText = errorList ? errorList.length > 0 : !!errorText;
|
|
2495
|
+
const isMarkedInvalid = ariaInvalid !== void 0 && ariaInvalid !== false && ariaInvalid !== "false";
|
|
2496
|
+
const hasError = hasErrorText || isMarkedInvalid;
|
|
2497
|
+
const showHelpText = !!helpText && !hasErrorText;
|
|
2498
|
+
const describedBy = [ariaDescribedBy, showHelpText && helpTextId, hasErrorText && errorTextId].filter(Boolean).join(" ") || void 0;
|
|
2499
|
+
const errorIcon = /* @__PURE__ */ jsx(CircleAlert, { className: styles29["input-error-icon"], "aria-hidden": "true" });
|
|
2500
|
+
const errorMessage = errorList && errorList.length > 1 ? /* @__PURE__ */ jsx("ul", { id: errorTextId, role: "alert", className: styles29["input-error-list"], children: errorList.map((message) => /* @__PURE__ */ jsxs("li", { className: styles29["input-error-text"], children: [
|
|
2501
|
+
errorIcon,
|
|
2502
|
+
/* @__PURE__ */ jsx("span", { children: message })
|
|
2503
|
+
] }, message)) }) : /* @__PURE__ */ jsxs("p", { id: errorTextId, role: "alert", className: styles29["input-error-text"], children: [
|
|
2504
|
+
errorIcon,
|
|
2505
|
+
/* @__PURE__ */ jsx("span", { children: errorList ? errorList[0] : errorText })
|
|
2506
|
+
] });
|
|
2507
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(styles29["input-container"], containerClassName), children: [
|
|
2508
|
+
/* @__PURE__ */ jsxs(
|
|
2509
|
+
"div",
|
|
2510
|
+
{
|
|
2511
|
+
className: cn(
|
|
2512
|
+
styles29["input-wrapper"],
|
|
2513
|
+
hasError && styles29["input-wrapper--error"],
|
|
2514
|
+
className
|
|
2515
|
+
),
|
|
2516
|
+
children: [
|
|
2517
|
+
prefix && /* @__PURE__ */ jsx("span", { className: styles29["input-prefix"], children: prefix }),
|
|
2518
|
+
/* @__PURE__ */ jsx(
|
|
2519
|
+
"input",
|
|
2520
|
+
{
|
|
2521
|
+
type,
|
|
2522
|
+
className: styles29["input-element"],
|
|
2523
|
+
ref,
|
|
2524
|
+
"aria-invalid": isMarkedInvalid ? ariaInvalid : hasErrorText || void 0,
|
|
2525
|
+
"aria-describedby": describedBy,
|
|
2526
|
+
...props
|
|
2527
|
+
}
|
|
2528
|
+
),
|
|
2529
|
+
suffix && /* @__PURE__ */ jsx("span", { className: styles29["input-suffix"], children: suffix })
|
|
2530
|
+
]
|
|
2531
|
+
}
|
|
2532
|
+
),
|
|
2533
|
+
helpText ? hasErrorText && errorMessage : /* @__PURE__ */ jsx(MotionCollapsibleContent, { isOpen: hasErrorText, children: errorMessage }),
|
|
2534
|
+
showHelpText && /* @__PURE__ */ jsx("p", { id: helpTextId, className: styles29["input-help-text"], children: helpText })
|
|
2451
2535
|
] });
|
|
2452
2536
|
}
|
|
2453
2537
|
);
|
|
@@ -2465,7 +2549,7 @@ var ListOrGridViewToggle = ({
|
|
|
2465
2549
|
const handleListClick = () => {
|
|
2466
2550
|
onViewModeChange("list");
|
|
2467
2551
|
};
|
|
2468
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
2552
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(styles30["list-or-grid-view-toggle"], className), children: [
|
|
2469
2553
|
order.map((mode) => {
|
|
2470
2554
|
const currentlyActive = mode === viewMode;
|
|
2471
2555
|
const Icon3 = mode === "grid" ? Grid3X3 : List;
|
|
@@ -2475,8 +2559,8 @@ var ListOrGridViewToggle = ({
|
|
|
2475
2559
|
type: "button",
|
|
2476
2560
|
"aria-label": mode === "grid" ? "Grid view" : "List view",
|
|
2477
2561
|
className: cn(
|
|
2478
|
-
|
|
2479
|
-
currentlyActive ?
|
|
2562
|
+
styles30["icon-button"],
|
|
2563
|
+
currentlyActive ? styles30["icon-button--active"] : styles30["icon-button--inactive"]
|
|
2480
2564
|
),
|
|
2481
2565
|
onClick: mode === "grid" ? handleGridClick : handleListClick,
|
|
2482
2566
|
children: /* @__PURE__ */ jsx(Icon3, { size: 16 })
|
|
@@ -2487,7 +2571,7 @@ var ListOrGridViewToggle = ({
|
|
|
2487
2571
|
/* @__PURE__ */ jsx(
|
|
2488
2572
|
"div",
|
|
2489
2573
|
{
|
|
2490
|
-
className:
|
|
2574
|
+
className: styles30["active-button-indicator"],
|
|
2491
2575
|
style: {
|
|
2492
2576
|
transform: `translateX(${currentActiveIndex * 100}%)`,
|
|
2493
2577
|
width: `${100 / order.length}%`
|
|
@@ -2497,43 +2581,43 @@ var ListOrGridViewToggle = ({
|
|
|
2497
2581
|
] });
|
|
2498
2582
|
};
|
|
2499
2583
|
var Spinner = ({ size = "md", variant = "primary" }) => {
|
|
2500
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
2501
|
-
/* @__PURE__ */ jsx("div", { className: cn(
|
|
2502
|
-
/* @__PURE__ */ jsx("div", { className: cn(
|
|
2584
|
+
return /* @__PURE__ */ jsxs("div", { className: styles31["spinner-container"], children: [
|
|
2585
|
+
/* @__PURE__ */ jsx("div", { className: cn(styles31["spinner"], styles31[size], styles31[variant]) }),
|
|
2586
|
+
/* @__PURE__ */ jsx("div", { className: cn(styles31["spinner-background"], styles31[size]) })
|
|
2503
2587
|
] });
|
|
2504
2588
|
};
|
|
2505
2589
|
function LoadingOverlay({ isVisible, message = "Loading..." }) {
|
|
2506
2590
|
if (!isVisible) return null;
|
|
2507
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
2591
|
+
return /* @__PURE__ */ jsx("div", { className: styles32["loading-overlay"], children: /* @__PURE__ */ jsxs("div", { className: styles32["content"], children: [
|
|
2508
2592
|
/* @__PURE__ */ jsx(Spinner, { variant: "primary" }),
|
|
2509
|
-
/* @__PURE__ */ jsx("p", { className:
|
|
2593
|
+
/* @__PURE__ */ jsx("p", { className: styles32["message"], children: message })
|
|
2510
2594
|
] }) });
|
|
2511
2595
|
}
|
|
2512
2596
|
var metricCardElevationVariants = generateElevationVariants(
|
|
2513
|
-
|
|
2597
|
+
styles33,
|
|
2514
2598
|
"metric-card",
|
|
2515
2599
|
ELEVATION.RAISED
|
|
2516
2600
|
);
|
|
2517
2601
|
var VARIANTS = {
|
|
2518
2602
|
default: {
|
|
2519
|
-
text:
|
|
2520
|
-
iconBg:
|
|
2603
|
+
text: styles33["text-default"],
|
|
2604
|
+
iconBg: styles33["bg-default"]
|
|
2521
2605
|
},
|
|
2522
2606
|
primary: {
|
|
2523
|
-
text:
|
|
2524
|
-
iconBg:
|
|
2607
|
+
text: styles33["text-primary"],
|
|
2608
|
+
iconBg: styles33["bg-primary"]
|
|
2525
2609
|
},
|
|
2526
2610
|
danger: {
|
|
2527
|
-
text:
|
|
2528
|
-
iconBg:
|
|
2611
|
+
text: styles33["text-danger"],
|
|
2612
|
+
iconBg: styles33["bg-danger"]
|
|
2529
2613
|
},
|
|
2530
2614
|
success: {
|
|
2531
|
-
text:
|
|
2532
|
-
iconBg:
|
|
2615
|
+
text: styles33["text-success"],
|
|
2616
|
+
iconBg: styles33["bg-success"]
|
|
2533
2617
|
},
|
|
2534
2618
|
warning: {
|
|
2535
|
-
text:
|
|
2536
|
-
iconBg:
|
|
2619
|
+
text: styles33["text-warning"],
|
|
2620
|
+
iconBg: styles33["bg-warning"]
|
|
2537
2621
|
}
|
|
2538
2622
|
};
|
|
2539
2623
|
var MetricCard = ({
|
|
@@ -2546,8 +2630,8 @@ var MetricCard = ({
|
|
|
2546
2630
|
}) => {
|
|
2547
2631
|
const variantStyles = VARIANTS[variant];
|
|
2548
2632
|
return /* @__PURE__ */ jsxs("div", { className: cn(metricCardElevationVariants({ elevation }), className), children: [
|
|
2549
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
2550
|
-
/* @__PURE__ */ jsx("p", { className: cn(
|
|
2633
|
+
/* @__PURE__ */ jsxs("div", { className: styles33["value-container"], children: [
|
|
2634
|
+
/* @__PURE__ */ jsx("p", { className: cn(styles33.value), children: value }),
|
|
2551
2635
|
icon && /* @__PURE__ */ jsx(
|
|
2552
2636
|
Icon,
|
|
2553
2637
|
{
|
|
@@ -2558,41 +2642,9 @@ var MetricCard = ({
|
|
|
2558
2642
|
}
|
|
2559
2643
|
)
|
|
2560
2644
|
] }),
|
|
2561
|
-
/* @__PURE__ */ jsx("p", { className:
|
|
2645
|
+
/* @__PURE__ */ jsx("p", { className: styles33.label, children: label })
|
|
2562
2646
|
] });
|
|
2563
2647
|
};
|
|
2564
|
-
var MotionCollapsibleContent = ({
|
|
2565
|
-
isOpen,
|
|
2566
|
-
children,
|
|
2567
|
-
className
|
|
2568
|
-
}) => {
|
|
2569
|
-
const [contentHeight, setContentHeight] = useState(0);
|
|
2570
|
-
const contentRef = useRef(null);
|
|
2571
|
-
useEffect(() => {
|
|
2572
|
-
if (contentRef.current) {
|
|
2573
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
2574
|
-
if (contentRef.current) {
|
|
2575
|
-
setContentHeight(contentRef.current.scrollHeight);
|
|
2576
|
-
}
|
|
2577
|
-
});
|
|
2578
|
-
resizeObserver.observe(contentRef.current);
|
|
2579
|
-
setContentHeight(contentRef.current.scrollHeight);
|
|
2580
|
-
return () => resizeObserver.disconnect();
|
|
2581
|
-
}
|
|
2582
|
-
}, [children]);
|
|
2583
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: isOpen && /* @__PURE__ */ jsx(
|
|
2584
|
-
motion.div,
|
|
2585
|
-
{
|
|
2586
|
-
initial: { height: 0, opacity: 0 },
|
|
2587
|
-
animate: { height: contentHeight, opacity: 1 },
|
|
2588
|
-
exit: { height: 0, opacity: 0 },
|
|
2589
|
-
transition: { duration: 0.3, ease: "easeInOut" },
|
|
2590
|
-
className: cn(styles33["motion-collapsible"], className),
|
|
2591
|
-
children: /* @__PURE__ */ jsx("div", { ref: contentRef, children })
|
|
2592
|
-
},
|
|
2593
|
-
"motion-content"
|
|
2594
|
-
) });
|
|
2595
|
-
};
|
|
2596
2648
|
var OctagonAlert = AlertOctagon;
|
|
2597
2649
|
var HomeIcon = Home;
|
|
2598
2650
|
var NotFound = ({
|
|
@@ -2696,6 +2748,8 @@ var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2696
2748
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
2697
2749
|
var ChevronLeftIcon2 = ChevronLeft;
|
|
2698
2750
|
var ChevronRightIcon3 = ChevronRight;
|
|
2751
|
+
var ChevronsLeftIcon = ChevronsLeft;
|
|
2752
|
+
var ChevronsRightIcon = ChevronsRight;
|
|
2699
2753
|
var Pagination = ({
|
|
2700
2754
|
currentPage,
|
|
2701
2755
|
totalItems,
|
|
@@ -2705,6 +2759,7 @@ var Pagination = ({
|
|
|
2705
2759
|
onItemsPerPageChange,
|
|
2706
2760
|
itemsPerPageOptions = [10, 25, 50, 100],
|
|
2707
2761
|
showInfo = true,
|
|
2762
|
+
showFirstLast = true,
|
|
2708
2763
|
maxVisiblePages = 5,
|
|
2709
2764
|
className = "",
|
|
2710
2765
|
type = "",
|
|
@@ -2714,8 +2769,9 @@ var Pagination = ({
|
|
|
2714
2769
|
const startItem = Math.min(filteredItems, 1 + (currentPage - 1) * itemsPerPage);
|
|
2715
2770
|
const endItem = Math.min(currentPage * itemsPerPage, filteredItems);
|
|
2716
2771
|
const hasFilteredItems = filteredItems > 0;
|
|
2717
|
-
const isFirstPage = currentPage
|
|
2718
|
-
const isLastPage = currentPage
|
|
2772
|
+
const isFirstPage = currentPage <= 1;
|
|
2773
|
+
const isLastPage = currentPage >= totalPages;
|
|
2774
|
+
const showFirstLastButtons = showFirstLast && totalPages > maxVisiblePages;
|
|
2719
2775
|
if (totalItems <= itemsPerPageOptions[0]) {
|
|
2720
2776
|
return null;
|
|
2721
2777
|
}
|
|
@@ -2743,12 +2799,18 @@ var Pagination = ({
|
|
|
2743
2799
|
onItemsPerPageChange?.(newItemsPerPage);
|
|
2744
2800
|
onPageChange(1);
|
|
2745
2801
|
};
|
|
2802
|
+
const handleFirstPage = () => {
|
|
2803
|
+
handlePageChange(1);
|
|
2804
|
+
};
|
|
2746
2805
|
const handlePreviousPage = () => {
|
|
2747
2806
|
handlePageChange(Math.max(1, currentPage - 1));
|
|
2748
2807
|
};
|
|
2749
2808
|
const handleNextPage = () => {
|
|
2750
2809
|
handlePageChange(Math.min(totalPages, currentPage + 1));
|
|
2751
2810
|
};
|
|
2811
|
+
const handleLastPage = () => {
|
|
2812
|
+
handlePageChange(totalPages);
|
|
2813
|
+
};
|
|
2752
2814
|
const getVisiblePages = () => {
|
|
2753
2815
|
const pageButtons = [];
|
|
2754
2816
|
let startPage = 1;
|
|
@@ -2761,7 +2823,7 @@ var Pagination = ({
|
|
|
2761
2823
|
startPage = totalPages - maxVisiblePages + 1;
|
|
2762
2824
|
} else {
|
|
2763
2825
|
startPage = currentPage - halfVisible;
|
|
2764
|
-
endPage =
|
|
2826
|
+
endPage = startPage + maxVisiblePages - 1;
|
|
2765
2827
|
}
|
|
2766
2828
|
}
|
|
2767
2829
|
for (let i = startPage; i <= endPage; i++) {
|
|
@@ -2772,6 +2834,8 @@ var Pagination = ({
|
|
|
2772
2834
|
variant: currentPage === i ? "primary" : "tertiary",
|
|
2773
2835
|
size: "sm",
|
|
2774
2836
|
onClick: () => handlePageChange(i),
|
|
2837
|
+
"aria-label": `Page ${i} of ${totalPages}`,
|
|
2838
|
+
"aria-current": currentPage === i ? "page" : void 0,
|
|
2775
2839
|
children: i
|
|
2776
2840
|
},
|
|
2777
2841
|
i
|
|
@@ -2788,7 +2852,14 @@ var Pagination = ({
|
|
|
2788
2852
|
" to"
|
|
2789
2853
|
] }),
|
|
2790
2854
|
onItemsPerPageChange ? /* @__PURE__ */ jsxs(Select, { value: itemsPerPage.toString(), onValueChange: handleItemsPerPageChange, children: [
|
|
2791
|
-
/* @__PURE__ */ jsx(
|
|
2855
|
+
/* @__PURE__ */ jsx(
|
|
2856
|
+
SelectTrigger,
|
|
2857
|
+
{
|
|
2858
|
+
className: styles36["items-per-page-trigger"],
|
|
2859
|
+
"aria-label": "Items per page",
|
|
2860
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
2861
|
+
}
|
|
2862
|
+
),
|
|
2792
2863
|
/* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.toString(), children: option }, option)) })
|
|
2793
2864
|
] }) : /* @__PURE__ */ jsx("span", { children: endItem }),
|
|
2794
2865
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
@@ -2798,7 +2869,18 @@ var Pagination = ({
|
|
|
2798
2869
|
type
|
|
2799
2870
|
] })
|
|
2800
2871
|
] }) }),
|
|
2801
|
-
/* @__PURE__ */ jsxs("
|
|
2872
|
+
/* @__PURE__ */ jsxs("nav", { className: styles36["page-navigation-container"], "aria-label": "Pagination", children: [
|
|
2873
|
+
showFirstLastButtons && /* @__PURE__ */ jsx(
|
|
2874
|
+
Button,
|
|
2875
|
+
{
|
|
2876
|
+
variant: "tertiary",
|
|
2877
|
+
size: "sm",
|
|
2878
|
+
onClick: handleFirstPage,
|
|
2879
|
+
disabled: isFirstPage,
|
|
2880
|
+
"aria-label": "First page",
|
|
2881
|
+
children: /* @__PURE__ */ jsx(ChevronsLeftIcon, {})
|
|
2882
|
+
}
|
|
2883
|
+
),
|
|
2802
2884
|
/* @__PURE__ */ jsx(
|
|
2803
2885
|
Button,
|
|
2804
2886
|
{
|
|
@@ -2821,6 +2903,17 @@ var Pagination = ({
|
|
|
2821
2903
|
"aria-label": "Next page",
|
|
2822
2904
|
children: /* @__PURE__ */ jsx(ChevronRightIcon3, {})
|
|
2823
2905
|
}
|
|
2906
|
+
),
|
|
2907
|
+
showFirstLastButtons && /* @__PURE__ */ jsx(
|
|
2908
|
+
Button,
|
|
2909
|
+
{
|
|
2910
|
+
variant: "tertiary",
|
|
2911
|
+
size: "sm",
|
|
2912
|
+
onClick: handleLastPage,
|
|
2913
|
+
disabled: isLastPage,
|
|
2914
|
+
"aria-label": `Last page (${totalPages})`,
|
|
2915
|
+
children: /* @__PURE__ */ jsx(ChevronsRightIcon, {})
|
|
2916
|
+
}
|
|
2824
2917
|
)
|
|
2825
2918
|
] })
|
|
2826
2919
|
] });
|