@eqtylab/equality 3.1.0 → 3.2.1
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 +120 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +120 -68
- package/dist/index.js.map +1 -1
- package/dist/input.module.module.css.module.css +44 -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>>;
|
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>>;
|
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, ChevronsLeft, ChevronsRight, ArrowUp, ArrowDown, ArrowUpDown
|
|
6
|
+
import { Check, ChevronRight, Search, Circle, TriangleAlert, ChevronDown, ChevronUp, X, SearchIcon, CalendarDays, ChevronLeft, Grid3X3, List, AlertOctagon, Home, ChevronsLeft, ChevronsRight, ArrowUp, ArrowDown, ArrowUpDown } 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(TriangleAlert, { 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 = ({
|