infinity-ui-elements 1.5.0 → 1.5.1-beta.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/components/Avatar/Avatar.d.ts +59 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +119 -0
- package/dist/components/Avatar/Avatar.stories.d.ts.map +1 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +26 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.stories.d.ts +102 -0
- package/dist/components/ButtonGroup/ButtonGroup.stories.d.ts.map +1 -0
- package/dist/components/ButtonGroup/index.d.ts +3 -0
- package/dist/components/ButtonGroup/index.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Counter/Counter.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts +4 -0
- package/dist/components/Dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/FormHeader/FormHeader.d.ts.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +78 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.stories.d.ts +20 -0
- package/dist/components/Modal/Modal.stories.d.ts.map +1 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.d.ts +81 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +22 -0
- package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -0
- package/dist/components/Pagination/index.d.ts +3 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts +4 -0
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts +10 -9
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +148 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.stories.d.ts +32 -0
- package/dist/components/Select/Select.stories.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/TabItem/TabItem.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +95 -0
- package/dist/components/Table/Table.d.ts.map +1 -0
- package/dist/components/Table/Table.stories.d.ts +21 -0
- package/dist/components/Table/Table.stories.d.ts.map +1 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/index.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +740 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +751 -40
- package/dist/index.js.map +1 -1
- package/dist/lib/icons.d.ts +4 -1
- package/dist/lib/icons.d.ts.map +1 -1
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var tailwindMerge = require('tailwind-merge');
|
|
|
8
8
|
var reactSlot = require('@radix-ui/react-slot');
|
|
9
9
|
var reactSpinners = require('react-spinners');
|
|
10
10
|
var lucideReact = require('lucide-react');
|
|
11
|
+
var reactDom = require('react-dom');
|
|
12
|
+
var reactTable = require('@tanstack/react-table');
|
|
11
13
|
|
|
12
14
|
function _interopNamespaceDefault(e) {
|
|
13
15
|
var n = Object.create(null);
|
|
@@ -67,6 +69,106 @@ function cn(...inputs) {
|
|
|
67
69
|
return clsx.clsx(mergedStandard, customClasses);
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
// Helper function to get the text utility class name
|
|
73
|
+
function getTextClassName(variant = "body", size = "medium", weight = "regular", color = "default") {
|
|
74
|
+
// Build the base class name
|
|
75
|
+
let baseClass = `text-${variant}`;
|
|
76
|
+
// Add size
|
|
77
|
+
if (size) {
|
|
78
|
+
baseClass += `-${size}`;
|
|
79
|
+
}
|
|
80
|
+
// Add weight
|
|
81
|
+
if (weight) {
|
|
82
|
+
baseClass += `-${weight}`;
|
|
83
|
+
}
|
|
84
|
+
// Add color class separately
|
|
85
|
+
const colorClass = `text-color-${color}`;
|
|
86
|
+
return `${baseClass} ${colorClass}`;
|
|
87
|
+
}
|
|
88
|
+
const Text = React__namespace.forwardRef(({ className, variant = "body", size = "medium", weight = "regular", color = "default", as = "p", children, ...props }, ref) => {
|
|
89
|
+
const Component = as;
|
|
90
|
+
const textClass = getTextClassName(variant, size, weight, color);
|
|
91
|
+
return React__namespace.createElement(Component, {
|
|
92
|
+
className: cn(textClass, className),
|
|
93
|
+
ref,
|
|
94
|
+
...props,
|
|
95
|
+
}, children);
|
|
96
|
+
});
|
|
97
|
+
Text.displayName = "Text";
|
|
98
|
+
|
|
99
|
+
const avatarVariants = classVarianceAuthority.cva("inline-flex items-center justify-center font-medium text-center select-none", {
|
|
100
|
+
variants: {
|
|
101
|
+
color: {
|
|
102
|
+
a1: "bg-avatar-fill-a1-bg text-avatar-fill-a1-on-bg",
|
|
103
|
+
a2: "bg-avatar-fill-a2-bg text-avatar-fill-a2-on-bg",
|
|
104
|
+
a3: "bg-avatar-fill-a3-bg text-avatar-fill-a3-on-bg",
|
|
105
|
+
a4: "bg-avatar-fill-a4-bg text-avatar-fill-a4-on-bg",
|
|
106
|
+
a5: "bg-avatar-fill-a5-bg text-avatar-fill-a5-on-bg",
|
|
107
|
+
},
|
|
108
|
+
size: {
|
|
109
|
+
small: "h-[24px] w-[24px] text-body-medium-regular rounded-large",
|
|
110
|
+
medium: "h-[32px] w-[32px] text-body-medium-regular rounded-xlarge",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
defaultVariants: {
|
|
114
|
+
color: "a1",
|
|
115
|
+
size: "medium",
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
const statusVariants = classVarianceAuthority.cva("absolute flex items-center justify-center rounded-full border-2 border-surface-fill-neutral-intense", {
|
|
119
|
+
variants: {
|
|
120
|
+
size: {
|
|
121
|
+
small: "h-5 w-5 -bottom-0.5 -right-0.5",
|
|
122
|
+
medium: "h-6 w-6 -bottom-1 -right-1",
|
|
123
|
+
},
|
|
124
|
+
statusColor: {
|
|
125
|
+
positive: "bg-action-fill-positive-default",
|
|
126
|
+
negative: "bg-action-fill-negative-default",
|
|
127
|
+
notice: "bg-action-fill-notice-default",
|
|
128
|
+
info: "bg-action-fill-info-default",
|
|
129
|
+
neutral: "bg-action-fill-neutral-default",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: {
|
|
133
|
+
size: "medium",
|
|
134
|
+
statusColor: "notice",
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
const Avatar = React__namespace.forwardRef(({ className, color, size, children, src, alt, showStatus = false, statusColor = "notice", statusIcon, label, trailingComponent, containerClassName, ...props }, ref) => {
|
|
138
|
+
const [imageError, setImageError] = React__namespace.useState(false);
|
|
139
|
+
const handleImageError = () => {
|
|
140
|
+
setImageError(true);
|
|
141
|
+
};
|
|
142
|
+
const getStatusIconSize = () => {
|
|
143
|
+
switch (size) {
|
|
144
|
+
case "small":
|
|
145
|
+
return "h-3.5 w-3.5";
|
|
146
|
+
case "medium":
|
|
147
|
+
return "h-4 w-4";
|
|
148
|
+
default:
|
|
149
|
+
return "h-4 w-4";
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const getTextSize = () => {
|
|
153
|
+
switch (size) {
|
|
154
|
+
case "small":
|
|
155
|
+
return "small";
|
|
156
|
+
case "medium":
|
|
157
|
+
return "medium";
|
|
158
|
+
default:
|
|
159
|
+
return "medium";
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const avatarElement = (jsxRuntime.jsxs("div", { className: "relative inline-block", children: [jsxRuntime.jsx("div", { className: cn(avatarVariants({ color, size }), className), ...props, children: src && !imageError ? (jsxRuntime.jsx("img", { src: src, alt: alt || "Avatar", className: cn("h-full w-full object-cover", size === "small" ? "rounded-large" : "rounded-xlarge"), onError: handleImageError })) : (children) }), showStatus && (jsxRuntime.jsx("div", { className: cn(statusVariants({ size, statusColor })), children: statusIcon && (jsxRuntime.jsx("span", { className: cn("text-action-ink-on-primary-normal", getStatusIconSize()), children: statusIcon })) }))] }));
|
|
163
|
+
// If no label or trailing component, return just the avatar
|
|
164
|
+
if (!label && !trailingComponent) {
|
|
165
|
+
return jsxRuntime.jsx("div", { ref: ref, children: avatarElement });
|
|
166
|
+
}
|
|
167
|
+
// Otherwise, return avatar with label and/or trailing component
|
|
168
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("inline-flex items-center gap-3", containerClassName), children: [avatarElement, label && (jsxRuntime.jsx(Text, { variant: "body", size: getTextSize(), weight: "medium", color: "default", as: "span", children: label })), trailingComponent && (jsxRuntime.jsx("span", { className: "ml-auto", children: trailingComponent }))] }));
|
|
169
|
+
});
|
|
170
|
+
Avatar.displayName = "Avatar";
|
|
171
|
+
|
|
70
172
|
const badgeVariants = classVarianceAuthority.cva("inline-flex items-center whitespace-nowrap transition-colors", {
|
|
71
173
|
variants: {
|
|
72
174
|
variant: {
|
|
@@ -483,32 +585,145 @@ const Button = React__namespace.forwardRef(({ className, variant = "primary", co
|
|
|
483
585
|
});
|
|
484
586
|
Button.displayName = "Button";
|
|
485
587
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
588
|
+
const buttonGroupVariants = classVarianceAuthority.cva("inline-flex", {
|
|
589
|
+
variants: {
|
|
590
|
+
variant: {
|
|
591
|
+
attached: "",
|
|
592
|
+
separated: "",
|
|
593
|
+
},
|
|
594
|
+
orientation: {
|
|
595
|
+
horizontal: "flex-row",
|
|
596
|
+
vertical: "flex-col",
|
|
597
|
+
},
|
|
598
|
+
size: {
|
|
599
|
+
xsmall: "",
|
|
600
|
+
small: "",
|
|
601
|
+
medium: "",
|
|
602
|
+
large: "",
|
|
603
|
+
},
|
|
604
|
+
isFullWidth: {
|
|
605
|
+
true: "w-full",
|
|
606
|
+
false: "w-fit",
|
|
607
|
+
},
|
|
608
|
+
isDisabled: {
|
|
609
|
+
true: "pointer-events-none opacity-50",
|
|
610
|
+
false: "",
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
compoundVariants: [
|
|
614
|
+
{
|
|
615
|
+
variant: "separated",
|
|
616
|
+
orientation: "horizontal",
|
|
617
|
+
class: "gap-2",
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
variant: "separated",
|
|
621
|
+
orientation: "vertical",
|
|
622
|
+
class: "gap-2",
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
defaultVariants: {
|
|
626
|
+
variant: "attached",
|
|
627
|
+
orientation: "horizontal",
|
|
628
|
+
size: "medium",
|
|
629
|
+
isFullWidth: false,
|
|
630
|
+
isDisabled: false,
|
|
631
|
+
},
|
|
510
632
|
});
|
|
511
|
-
|
|
633
|
+
const ButtonGroup = React__namespace.forwardRef(({ className, variant = "attached", orientation = "horizontal", size = "medium", isDisabled = false, isFullWidth = false, value, onChange, children, ...props }, ref) => {
|
|
634
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
635
|
+
const isControlled = value !== undefined && onChange !== undefined;
|
|
636
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: cn(buttonGroupVariants({
|
|
637
|
+
variant,
|
|
638
|
+
orientation,
|
|
639
|
+
size,
|
|
640
|
+
isDisabled,
|
|
641
|
+
isFullWidth,
|
|
642
|
+
}), className), role: "group", ...props, children: childrenArray.map((child, index) => {
|
|
643
|
+
if (!React__namespace.isValidElement(child)) {
|
|
644
|
+
return child;
|
|
645
|
+
}
|
|
646
|
+
const isFirst = index === 0;
|
|
647
|
+
const isLast = index === childrenArray.length - 1;
|
|
648
|
+
const isMiddle = !isFirst && !isLast;
|
|
649
|
+
// Get value from child props for controlled mode
|
|
650
|
+
const childValue = child.props.value;
|
|
651
|
+
const isSelected = isControlled && childValue === value;
|
|
652
|
+
// Build classes to apply border radius removal and borders
|
|
653
|
+
let groupClasses = "";
|
|
654
|
+
// Only apply connected styling for "attached" variant
|
|
655
|
+
if (variant === "attached") {
|
|
656
|
+
if (orientation === "horizontal") {
|
|
657
|
+
if (isFirst) {
|
|
658
|
+
groupClasses = "rounded-r-none border-r-0";
|
|
659
|
+
}
|
|
660
|
+
else if (isLast) {
|
|
661
|
+
groupClasses = "rounded-l-none";
|
|
662
|
+
}
|
|
663
|
+
else if (isMiddle) {
|
|
664
|
+
groupClasses = "rounded-none border-r-0";
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
// vertical
|
|
669
|
+
if (isFirst) {
|
|
670
|
+
groupClasses = "rounded-b-none border-b-0";
|
|
671
|
+
}
|
|
672
|
+
else if (isLast) {
|
|
673
|
+
groupClasses = "rounded-t-none";
|
|
674
|
+
}
|
|
675
|
+
else if (isMiddle) {
|
|
676
|
+
groupClasses = "rounded-none border-b-0";
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
// Determine the variant to use
|
|
681
|
+
const childVariant = child.props.variant;
|
|
682
|
+
const hasExplicitVariant = childVariant !== undefined;
|
|
683
|
+
// For controlled mode with explicit variant, maintain the variant
|
|
684
|
+
// and add styling classes for selected state
|
|
685
|
+
let finalVariant = childVariant;
|
|
686
|
+
let selectedStateClasses = "";
|
|
687
|
+
if (isControlled) {
|
|
688
|
+
if (hasExplicitVariant) {
|
|
689
|
+
// Keep the child's variant and add selected state styling
|
|
690
|
+
if (isSelected && childVariant === "tertiary") {
|
|
691
|
+
selectedStateClasses = "bg-action-fill-primary-faded";
|
|
692
|
+
}
|
|
693
|
+
else if (isSelected && childVariant === "secondary") {
|
|
694
|
+
selectedStateClasses =
|
|
695
|
+
"bg-action-fill-primary-faded border-action-outline-primary-faded";
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
// No explicit variant: use primary for selected, secondary for unselected
|
|
700
|
+
finalVariant = isSelected ? "primary" : "secondary";
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
// Clone child and add our classes and handlers
|
|
704
|
+
return React__namespace.cloneElement(child, {
|
|
705
|
+
...child.props,
|
|
706
|
+
className: cn(child.props.className, groupClasses, isFullWidth && "flex-1",
|
|
707
|
+
// For attached variant, ensure proper layering
|
|
708
|
+
variant === "attached" && "relative", variant === "attached" && !isSelected && "hover:z-10 focus:z-10", variant === "attached" && isSelected && "z-20",
|
|
709
|
+
// Apply selected state classes for explicit variants
|
|
710
|
+
selectedStateClasses),
|
|
711
|
+
disabled: isDisabled || child.props.disabled,
|
|
712
|
+
size: size || child.props.size,
|
|
713
|
+
// If controlled and has value, handle click
|
|
714
|
+
onClick: isControlled && childValue !== undefined
|
|
715
|
+
? (e) => {
|
|
716
|
+
child.props.onClick?.(e);
|
|
717
|
+
if (!isDisabled && !child.props.disabled) {
|
|
718
|
+
onChange(childValue);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
: child.props.onClick,
|
|
722
|
+
variant: finalVariant,
|
|
723
|
+
});
|
|
724
|
+
}) }));
|
|
725
|
+
});
|
|
726
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
512
727
|
|
|
513
728
|
const FormFooter = React__namespace.forwardRef(({ helperText, trailingText, validationState = "default", size = "medium", isDisabled = false, className, helperTextClassName, trailingTextClassName, }, ref) => {
|
|
514
729
|
// Size-based configurations
|
|
@@ -600,17 +815,17 @@ const Icon = ({ name, size = 24, className = "", style = {}, ...props }) => {
|
|
|
600
815
|
console.error(`Invalid SVG content for icon "${String(name)}"`);
|
|
601
816
|
return null;
|
|
602
817
|
}
|
|
603
|
-
//
|
|
818
|
+
// Get the viewBox for proper scaling
|
|
604
819
|
const viewBox = svgElement.getAttribute("viewBox") || "0 0 24 24";
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
//
|
|
608
|
-
|
|
820
|
+
// Get all SVG content as string and replace hardcoded colors with currentColor
|
|
821
|
+
let innerSVG = svgElement.innerHTML;
|
|
822
|
+
// Replace common hardcoded colors with currentColor
|
|
823
|
+
// This allows the icon to inherit text color from parent
|
|
824
|
+
innerSVG = innerSVG
|
|
609
825
|
.replace(/fill="[^"]*"/g, 'fill="currentColor"')
|
|
610
826
|
.replace(/stroke="[^"]*"/g, 'stroke="currentColor"');
|
|
611
|
-
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: viewBox,
|
|
827
|
+
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: viewBox, className: className, style: style, xmlns: "http://www.w3.org/2000/svg", ...props, dangerouslySetInnerHTML: { __html: innerSVG } }));
|
|
612
828
|
};
|
|
613
|
-
Icon.displayName = "Icon";
|
|
614
829
|
/**
|
|
615
830
|
* Get all available icon names from the registry
|
|
616
831
|
* @returns Array of registered icon names
|
|
@@ -1224,7 +1439,7 @@ const Link = React__namespace.forwardRef(({ className, type = "anchor", color =
|
|
|
1224
1439
|
});
|
|
1225
1440
|
Link.displayName = "Link";
|
|
1226
1441
|
|
|
1227
|
-
const DropdownMenu = React__namespace.forwardRef(({ items = [], sectionHeading, isLoading = false, isEmpty = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, showChevron = false, emptyIcon, disableFooter = false, onClose, focusedIndex = -1, className, width = "auto", }, ref) => {
|
|
1442
|
+
const DropdownMenu = React__namespace.forwardRef(({ items = [], sectionHeading, isLoading = false, isEmpty = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, showChevron = false, emptyIcon, disableFooter = false, footerLayout = "horizontal", onClose, focusedIndex = -1, className, width = "auto", }, ref) => {
|
|
1228
1443
|
const renderContent = () => {
|
|
1229
1444
|
if (isLoading) {
|
|
1230
1445
|
return (jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center py-12 px-6", children: jsxRuntime.jsx(lucideReact.Loader2, { className: "w-12 h-12 text-action-ink-primary-normal mb-4 animate-spin" }) }));
|
|
@@ -1238,10 +1453,12 @@ const DropdownMenu = React__namespace.forwardRef(({ items = [], sectionHeading,
|
|
|
1238
1453
|
}, containerClassName: cn(index === focusedIndex && "bg-action-fill-primary-faded") }, item.id))) })] }));
|
|
1239
1454
|
};
|
|
1240
1455
|
const widthClass = width === "full" ? "w-full" : width === "auto" ? "w-auto" : "";
|
|
1241
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("bg-
|
|
1456
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("bg-white rounded-large overflow-hidden", widthClass, className), style: {
|
|
1242
1457
|
boxShadow: "0 1px 2px rgba(25, 25, 30, 0.1), 0 2px 6px rgba(25, 25, 30, 0.06)",
|
|
1243
1458
|
...(width !== "full" && width !== "auto" ? { width } : {}),
|
|
1244
|
-
}, children: [renderContent(), !disableFooter && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsxs("div", { className: "flex
|
|
1459
|
+
}, children: [renderContent(), !disableFooter && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsxs("div", { className: cn("flex gap-3 p-4", footerLayout === "vertical"
|
|
1460
|
+
? "flex-col"
|
|
1461
|
+
: "items-center flex-row"), children: [jsxRuntime.jsx(Button, { variant: "secondary", color: "primary", size: "medium", isFullWidth: true, onClick: onSecondaryClick, children: secondaryButtonText }), jsxRuntime.jsx(Button, { variant: "primary", color: "primary", size: "medium", isFullWidth: true, onClick: onPrimaryClick, children: primaryButtonText })] })] }))] }));
|
|
1245
1462
|
});
|
|
1246
1463
|
DropdownMenu.displayName = "DropdownMenu";
|
|
1247
1464
|
|
|
@@ -1558,10 +1775,370 @@ const FormHeader = React__namespace.forwardRef(({ label, size = "medium", isOpti
|
|
|
1558
1775
|
},
|
|
1559
1776
|
};
|
|
1560
1777
|
const config = sizeConfig[size];
|
|
1561
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [jsxRuntime.jsxs("label", { htmlFor: htmlFor, className: cn("flex items-center", labelClassName), children: [jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold", color: "subtle", children: label }), isRequired && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold",
|
|
1778
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [jsxRuntime.jsxs("label", { htmlFor: htmlFor, className: cn("flex items-center", labelClassName), children: [jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold", color: "subtle", children: label }), isRequired && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "semibold", color: "negative", className: "ml-0.5", children: "*" })), isOptional && (jsxRuntime.jsx(Text, { as: "span", variant: "body", size: config.textSize, weight: "regular", className: "text-surface-ink-neutral-muted italic ml-1", children: "(optional)" }))] }), infoDescription && (jsxRuntime.jsx(Tooltip, { description: infoDescription, heading: infoHeading, children: jsxRuntime.jsxs("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-surface-ink-neutral-muted", children: [jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1" }), jsxRuntime.jsx("path", { d: "M7 6V10M7 4.5V4", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] }) }))] }), linkText && (jsxRuntime.jsx("a", { href: linkHref, onClick: onLinkClick, className: cn("text-surface-ink-primary-normal hover:text-surface-ink-primary-hover transition-colors cursor-pointer font-display font-semibold leading-tight shrink-0", size === "small" && "text-xs", size === "medium" && "text-xs", size === "large" && "text-sm", linkClassName), children: linkText }))] }));
|
|
1562
1779
|
});
|
|
1563
1780
|
FormHeader.displayName = "FormHeader";
|
|
1564
1781
|
|
|
1782
|
+
const Modal = React__namespace.forwardRef(({ isOpen, onClose, title, description, footer, children, size = "medium", showCloseButton = true, closeOnOverlayClick = true, closeOnEscape = true, className, contentClassName, headerClassName, bodyClassName, footerClassName, overlayClassName, ariaLabel, ariaDescribedBy, }, ref) => {
|
|
1783
|
+
const modalRef = React__namespace.useRef(null);
|
|
1784
|
+
const contentRef = ref || modalRef;
|
|
1785
|
+
// Size configurations
|
|
1786
|
+
const sizeConfig = {
|
|
1787
|
+
small: "max-w-sm",
|
|
1788
|
+
medium: "max-w-md",
|
|
1789
|
+
large: "max-w-lg",
|
|
1790
|
+
xlarge: "max-w-2xl",
|
|
1791
|
+
};
|
|
1792
|
+
// Handle escape key
|
|
1793
|
+
React__namespace.useEffect(() => {
|
|
1794
|
+
if (!isOpen || !closeOnEscape)
|
|
1795
|
+
return;
|
|
1796
|
+
const handleEscape = (e) => {
|
|
1797
|
+
if (e.key === "Escape") {
|
|
1798
|
+
onClose();
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
document.addEventListener("keydown", handleEscape);
|
|
1802
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1803
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
1804
|
+
// Prevent body scroll when modal is open
|
|
1805
|
+
React__namespace.useEffect(() => {
|
|
1806
|
+
if (isOpen) {
|
|
1807
|
+
document.body.style.overflow = "hidden";
|
|
1808
|
+
}
|
|
1809
|
+
else {
|
|
1810
|
+
document.body.style.overflow = "";
|
|
1811
|
+
}
|
|
1812
|
+
return () => {
|
|
1813
|
+
document.body.style.overflow = "";
|
|
1814
|
+
};
|
|
1815
|
+
}, [isOpen]);
|
|
1816
|
+
// Handle overlay click
|
|
1817
|
+
const handleOverlayClick = (e) => {
|
|
1818
|
+
if (closeOnOverlayClick && e.target === e.currentTarget) {
|
|
1819
|
+
onClose();
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
// Don't render if not open
|
|
1823
|
+
if (!isOpen)
|
|
1824
|
+
return null;
|
|
1825
|
+
const hasHeader = title || description;
|
|
1826
|
+
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-50 flex items-center justify-center p-4", className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative w-full bg-white rounded-large shadow-xl transition-all", "flex flex-col max-h-[90vh]", sizeConfig[size], contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-4 px-6 pt-6", !description && "pb-4", description && "pb-2", headerClassName), children: [jsxRuntime.jsxs("div", { className: "flex-1", children: [title && (jsxRuntime.jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", children: title })), description && (jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-1", children: description }))] }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", onClick: onClose, className: cn("shrink-0 rounded-medium p-1.5 transition-colors", "text-surface-ink-neutral-muted hover:text-surface-ink-neutral-default", "hover:bg-surface-fill-neutral-faded focus:outline-none focus:ring-2", "focus:ring-action-outline-primary-default focus:ring-offset-2"), "aria-label": "Close modal", children: jsxRuntime.jsx(lucideReact.X, { className: "h-5 w-5" }) }))] })), !hasHeader && showCloseButton && (jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: jsxRuntime.jsx("button", { type: "button", onClick: onClose, className: cn("shrink-0 rounded-medium p-1.5 transition-colors", "text-surface-ink-neutral-muted hover:text-surface-ink-neutral-default", "hover:bg-surface-fill-neutral-faded focus:outline-none focus:ring-2", "focus:ring-action-outline-primary-default focus:ring-offset-2"), "aria-label": "Close modal", children: jsxRuntime.jsx(lucideReact.X, { className: "h-5 w-5" }) }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto px-6", hasHeader ? "py-4" : "pt-6 pb-4", !footer && "pb-6", bodyClassName), children: children }), footer && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
|
|
1827
|
+
});
|
|
1828
|
+
Modal.displayName = "Modal";
|
|
1829
|
+
|
|
1830
|
+
const selectVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-medium transition-all font-display font-size-100 leading-100", {
|
|
1831
|
+
variants: {
|
|
1832
|
+
size: {
|
|
1833
|
+
small: "h-[28px] px-3 text-xs gap-2",
|
|
1834
|
+
medium: "h-[36px] px-4 text-sm gap-2",
|
|
1835
|
+
large: "h-[44px] px-5 text-base gap-3",
|
|
1836
|
+
},
|
|
1837
|
+
validationState: {
|
|
1838
|
+
none: `
|
|
1839
|
+
border-action-outline-neutral-faded
|
|
1840
|
+
hover:border-action-outline-primary-hover
|
|
1841
|
+
focus-within:border-action-outline-primary-hover
|
|
1842
|
+
focus-within:ring-2
|
|
1843
|
+
ring-action-outline-primary-faded-hover`,
|
|
1844
|
+
positive: `
|
|
1845
|
+
border-action-outline-positive-default
|
|
1846
|
+
focus-within:border-action-outline-positive-hover
|
|
1847
|
+
focus-within:ring-2
|
|
1848
|
+
ring-action-outline-positive-faded-hover`,
|
|
1849
|
+
negative: `border-action-outline-negative-default
|
|
1850
|
+
focus-within:border-action-outline-negative-hover
|
|
1851
|
+
focus-within:ring-2
|
|
1852
|
+
ring-action-outline-negative-faded-hover`,
|
|
1853
|
+
},
|
|
1854
|
+
isDisabled: {
|
|
1855
|
+
true: `
|
|
1856
|
+
border-[var(--border-width-thinner)]
|
|
1857
|
+
hover:border-action-outline-neutral-disabled
|
|
1858
|
+
border-action-outline-neutral-disabled
|
|
1859
|
+
bg-surface-fill-neutral-intense cursor-not-allowed opacity-60`,
|
|
1860
|
+
false: "bg-surface-fill-neutral-intense",
|
|
1861
|
+
},
|
|
1862
|
+
},
|
|
1863
|
+
defaultVariants: {
|
|
1864
|
+
size: "medium",
|
|
1865
|
+
validationState: "none",
|
|
1866
|
+
isDisabled: false,
|
|
1867
|
+
},
|
|
1868
|
+
});
|
|
1869
|
+
const Select = React__namespace.forwardRef(({ className, options = [], value: controlledValue, defaultValue, onChange, placeholder = "Select an option", label, helperText, errorText, successText, validationState = "none", isDisabled = false, isRequired = false, isOptional = false, isLoading = false, size = "medium", prefix, suffix, showClearButton = false, onClear, containerClassName, labelClassName, triggerClassName, menuClassName, menuWidth = "full", sectionHeading, emptyTitle = "No options available", emptyDescription = "There are no options to select from.", emptyIcon, infoHeading, infoDescription, linkText, linkHref, onLinkClick, ...props }, ref) => {
|
|
1870
|
+
const [uncontrolledValue, setUncontrolledValue] = React__namespace.useState(defaultValue);
|
|
1871
|
+
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
1872
|
+
const selectRef = React__namespace.useRef(null);
|
|
1873
|
+
const value = controlledValue !== undefined ? controlledValue : uncontrolledValue;
|
|
1874
|
+
// Find the selected option
|
|
1875
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
1876
|
+
const hasValue = value !== undefined && value !== "";
|
|
1877
|
+
// Determine which helper text to show
|
|
1878
|
+
const displayHelperText = errorText || successText || helperText;
|
|
1879
|
+
const currentValidationState = errorText
|
|
1880
|
+
? "negative"
|
|
1881
|
+
: successText
|
|
1882
|
+
? "positive"
|
|
1883
|
+
: validationState;
|
|
1884
|
+
const handleOpenChange = (newOpen) => {
|
|
1885
|
+
if (!isDisabled && !isLoading) {
|
|
1886
|
+
setIsOpen(newOpen);
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
const toggleOpen = () => {
|
|
1890
|
+
handleOpenChange(!isOpen);
|
|
1891
|
+
};
|
|
1892
|
+
const handleSelect = (option) => {
|
|
1893
|
+
if (controlledValue === undefined) {
|
|
1894
|
+
setUncontrolledValue(option.value);
|
|
1895
|
+
}
|
|
1896
|
+
onChange?.(option.value, option);
|
|
1897
|
+
setIsOpen(false);
|
|
1898
|
+
};
|
|
1899
|
+
const handleClear = (e) => {
|
|
1900
|
+
e.stopPropagation();
|
|
1901
|
+
if (onClear) {
|
|
1902
|
+
onClear();
|
|
1903
|
+
}
|
|
1904
|
+
else {
|
|
1905
|
+
if (controlledValue === undefined) {
|
|
1906
|
+
setUncontrolledValue(undefined);
|
|
1907
|
+
}
|
|
1908
|
+
onChange?.("", {});
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
// Close dropdown when clicking outside
|
|
1912
|
+
React__namespace.useEffect(() => {
|
|
1913
|
+
const handleClickOutside = (event) => {
|
|
1914
|
+
if (selectRef.current &&
|
|
1915
|
+
!selectRef.current.contains(event.target)) {
|
|
1916
|
+
handleOpenChange(false);
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
if (isOpen) {
|
|
1920
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1921
|
+
return () => {
|
|
1922
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
}, [isOpen]);
|
|
1926
|
+
// Close on escape key
|
|
1927
|
+
React__namespace.useEffect(() => {
|
|
1928
|
+
const handleEscape = (event) => {
|
|
1929
|
+
if (event.key === "Escape") {
|
|
1930
|
+
handleOpenChange(false);
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
if (isOpen) {
|
|
1934
|
+
document.addEventListener("keydown", handleEscape);
|
|
1935
|
+
return () => {
|
|
1936
|
+
document.removeEventListener("keydown", handleEscape);
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
}, [isOpen]);
|
|
1940
|
+
// Handle keyboard navigation
|
|
1941
|
+
React__namespace.useEffect(() => {
|
|
1942
|
+
const handleKeyDown = (event) => {
|
|
1943
|
+
if (isDisabled || isLoading)
|
|
1944
|
+
return;
|
|
1945
|
+
if (!isOpen && (event.key === "Enter" || event.key === " ")) {
|
|
1946
|
+
event.preventDefault();
|
|
1947
|
+
setIsOpen(true);
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
if (isOpen) {
|
|
1951
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1952
|
+
event.preventDefault();
|
|
1953
|
+
const currentIndex = options.findIndex((opt) => opt.value === value);
|
|
1954
|
+
const nextIndex = event.key === "ArrowDown"
|
|
1955
|
+
? Math.min(currentIndex + 1, options.length - 1)
|
|
1956
|
+
: Math.max(currentIndex - 1, 0);
|
|
1957
|
+
if (options[nextIndex] && !options[nextIndex].isDisabled) {
|
|
1958
|
+
handleSelect(options[nextIndex]);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
if (selectRef.current) {
|
|
1964
|
+
selectRef.current.addEventListener("keydown", handleKeyDown);
|
|
1965
|
+
return () => {
|
|
1966
|
+
selectRef.current?.removeEventListener("keydown", handleKeyDown);
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
}, [isOpen, value, options, isDisabled, isLoading]);
|
|
1970
|
+
// Transform options to dropdown menu items
|
|
1971
|
+
const menuItems = options.map((option) => ({
|
|
1972
|
+
...option,
|
|
1973
|
+
onClick: () => handleSelect(option),
|
|
1974
|
+
}));
|
|
1975
|
+
const widthStyle = menuWidth === "full" ? "100%" : menuWidth === "auto" ? "auto" : menuWidth;
|
|
1976
|
+
const sizeConfig = {
|
|
1977
|
+
small: {
|
|
1978
|
+
gap: "gap-2",
|
|
1979
|
+
},
|
|
1980
|
+
medium: {
|
|
1981
|
+
gap: "gap-2",
|
|
1982
|
+
},
|
|
1983
|
+
large: {
|
|
1984
|
+
gap: "gap-3",
|
|
1985
|
+
},
|
|
1986
|
+
};
|
|
1987
|
+
return (jsxRuntime.jsxs("div", { className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (jsxRuntime.jsx(FormHeader, { label: label, size: size, isRequired: isRequired, isOptional: isOptional, infoHeading: infoHeading, infoDescription: infoDescription, linkText: linkText, linkHref: linkHref, onLinkClick: onLinkClick, htmlFor: props.id, className: "mb-2", labelClassName: labelClassName })), jsxRuntime.jsxs("div", { ref: selectRef, className: cn(selectVariants({
|
|
1988
|
+
size,
|
|
1989
|
+
validationState: currentValidationState,
|
|
1990
|
+
isDisabled,
|
|
1991
|
+
}), "relative w-full cursor-pointer", className), onClick: !isDisabled && !isLoading ? toggleOpen : undefined, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, "aria-disabled": isDisabled, ...props, children: [prefix && (jsxRuntime.jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
|
|
1992
|
+
? "text-surface-ink-neutral-disabled"
|
|
1993
|
+
: currentValidationState === "positive"
|
|
1994
|
+
? "text-feedback-ink-positive-intense"
|
|
1995
|
+
: currentValidationState === "negative"
|
|
1996
|
+
? "text-feedback-ink-negative-subtle"
|
|
1997
|
+
: "text-surface-ink-neutral-muted"), children: prefix })), jsxRuntime.jsx("span", { className: cn("flex-1 text-left truncate", !selectedOption && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: isLoading
|
|
1998
|
+
? "Loading..."
|
|
1999
|
+
: selectedOption?.label || selectedOption?.title || placeholder }), showClearButton && hasValue && !isDisabled && !isLoading && (jsxRuntime.jsx("button", { type: "button", onClick: handleClear, className: "shrink-0 flex items-center justify-center text-surface-ink-neutral-muted hover:text-surface-ink-neutral-normal transition-colors", tabIndex: -1, children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })), suffix && !showClearButton && (jsxRuntime.jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
|
|
2000
|
+
? "text-surface-ink-neutral-disabled"
|
|
2001
|
+
: currentValidationState === "positive"
|
|
2002
|
+
? "text-feedback-ink-positive-intense"
|
|
2003
|
+
: currentValidationState === "negative"
|
|
2004
|
+
? "text-feedback-ink-negative-subtle"
|
|
2005
|
+
: "text-surface-ink-neutral-muted"), children: suffix })), jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("shrink-0 w-4 h-4 transition-transform", isDisabled
|
|
2006
|
+
? "text-surface-ink-neutral-disabled"
|
|
2007
|
+
: currentValidationState === "positive"
|
|
2008
|
+
? "text-feedback-ink-positive-intense"
|
|
2009
|
+
: currentValidationState === "negative"
|
|
2010
|
+
? "text-feedback-ink-negative-subtle"
|
|
2011
|
+
: "text-surface-ink-neutral-muted", isOpen && "transform rotate-180") }), isOpen && !isDisabled && !isLoading && (jsxRuntime.jsx("div", { className: "absolute z-50 left-0 right-0 top-full mt-1", children: jsxRuntime.jsx(DropdownMenu, { ref: ref, items: menuItems, sectionHeading: sectionHeading, isEmpty: options.length === 0, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyIcon: emptyIcon, disableFooter: true, onClose: () => handleOpenChange(false), className: menuClassName, width: widthStyle }) }))] }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
|
|
2012
|
+
? "default"
|
|
2013
|
+
: currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1" })] }));
|
|
2014
|
+
});
|
|
2015
|
+
Select.displayName = "Select";
|
|
2016
|
+
|
|
2017
|
+
const paginationVariants = classVarianceAuthority.cva("flex items-center gap-4 font-display text-body-medium-medium", {
|
|
2018
|
+
variants: {
|
|
2019
|
+
size: {
|
|
2020
|
+
small: "text-xs gap-2",
|
|
2021
|
+
medium: "text-sm gap-4",
|
|
2022
|
+
large: "text-base gap-5",
|
|
2023
|
+
},
|
|
2024
|
+
},
|
|
2025
|
+
defaultVariants: {
|
|
2026
|
+
size: "medium",
|
|
2027
|
+
},
|
|
2028
|
+
});
|
|
2029
|
+
const Pagination = React__namespace.forwardRef(({ className, currentPage: controlledCurrentPage, totalPages, rowsPerPage: controlledRowsPerPage, rowsPerPageOptions = [5, 10, 15, 20, 25, 50, 100], showRowsPerPage = true, onPageChange, onRowsPerPageChange, size = "medium", isDisabled = false, rowsPerPageLabel = "Row per page", ofLabel = "of", prevLabel = "Prev", nextLabel = "Next", showPrevNext = true, showPageJumper = true, showPageNumber = true, pageStatus, maxPageButtons = 5, ...props }, ref) => {
|
|
2030
|
+
const [uncontrolledCurrentPage, setUncontrolledCurrentPage] = React__namespace.useState(1);
|
|
2031
|
+
const [uncontrolledRowsPerPage, setUncontrolledRowsPerPage] = React__namespace.useState(rowsPerPageOptions[0] || 10);
|
|
2032
|
+
const currentPage = controlledCurrentPage !== undefined
|
|
2033
|
+
? controlledCurrentPage
|
|
2034
|
+
: uncontrolledCurrentPage;
|
|
2035
|
+
const rowsPerPage = controlledRowsPerPage !== undefined
|
|
2036
|
+
? controlledRowsPerPage
|
|
2037
|
+
: uncontrolledRowsPerPage;
|
|
2038
|
+
// Generate rows per page options
|
|
2039
|
+
const rowsPerPageSelectOptions = rowsPerPageOptions.map((value) => {
|
|
2040
|
+
const valueStr = String(value);
|
|
2041
|
+
// Pad with leading zero if needed (manual implementation for compatibility)
|
|
2042
|
+
const label = valueStr.length < 2 ? "0" + valueStr : valueStr;
|
|
2043
|
+
return {
|
|
2044
|
+
id: `rows-${valueStr}`,
|
|
2045
|
+
value: valueStr,
|
|
2046
|
+
label: label,
|
|
2047
|
+
title: valueStr,
|
|
2048
|
+
};
|
|
2049
|
+
});
|
|
2050
|
+
// Generate page options
|
|
2051
|
+
const pageOptions = Array.from({ length: totalPages }, (_, i) => {
|
|
2052
|
+
const pageNum = i + 1;
|
|
2053
|
+
const pageStr = String(pageNum);
|
|
2054
|
+
return {
|
|
2055
|
+
id: `page-${pageStr}`,
|
|
2056
|
+
value: pageStr,
|
|
2057
|
+
label: pageStr,
|
|
2058
|
+
title: `Page ${pageNum}`,
|
|
2059
|
+
};
|
|
2060
|
+
});
|
|
2061
|
+
const handlePageChange = (newPage) => {
|
|
2062
|
+
if (newPage < 1 || newPage > totalPages)
|
|
2063
|
+
return;
|
|
2064
|
+
if (controlledCurrentPage === undefined) {
|
|
2065
|
+
setUncontrolledCurrentPage(newPage);
|
|
2066
|
+
}
|
|
2067
|
+
onPageChange?.(newPage);
|
|
2068
|
+
};
|
|
2069
|
+
const handleRowsPerPageChange = (value) => {
|
|
2070
|
+
const newRowsPerPage = typeof value === "string" ? parseInt(value) : value;
|
|
2071
|
+
if (controlledRowsPerPage === undefined) {
|
|
2072
|
+
setUncontrolledRowsPerPage(newRowsPerPage);
|
|
2073
|
+
}
|
|
2074
|
+
onRowsPerPageChange?.(newRowsPerPage);
|
|
2075
|
+
// Reset to first page when rows per page changes
|
|
2076
|
+
handlePageChange(1);
|
|
2077
|
+
};
|
|
2078
|
+
const handlePrevPage = () => {
|
|
2079
|
+
handlePageChange(currentPage - 1);
|
|
2080
|
+
};
|
|
2081
|
+
const handleNextPage = () => {
|
|
2082
|
+
handlePageChange(currentPage + 1);
|
|
2083
|
+
};
|
|
2084
|
+
const isPrevDisabled = currentPage <= 1 || isDisabled;
|
|
2085
|
+
const isNextDisabled = currentPage >= totalPages || isDisabled;
|
|
2086
|
+
const selectSize = size === "small" ? "small" : size === "large" ? "large" : "medium";
|
|
2087
|
+
// Map pagination size to button size
|
|
2088
|
+
const buttonSize = size === "small" ? "xsmall" : size === "large" ? "large" : "small";
|
|
2089
|
+
// Generate page numbers to display
|
|
2090
|
+
const getPageNumbers = () => {
|
|
2091
|
+
if (totalPages <= maxPageButtons) {
|
|
2092
|
+
// Show all pages if total is less than max
|
|
2093
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
2094
|
+
}
|
|
2095
|
+
// Determine page status if not provided
|
|
2096
|
+
const effectivePageStatus = pageStatus ||
|
|
2097
|
+
(currentPage <= 2
|
|
2098
|
+
? "first"
|
|
2099
|
+
: currentPage >= totalPages - 1
|
|
2100
|
+
? "last"
|
|
2101
|
+
: "middle");
|
|
2102
|
+
if (effectivePageStatus === "first") {
|
|
2103
|
+
// Show first pages: 1, 2, 3, 4, 5
|
|
2104
|
+
return Array.from({ length: Math.min(maxPageButtons, totalPages) }, (_, i) => i + 1);
|
|
2105
|
+
}
|
|
2106
|
+
else if (effectivePageStatus === "last") {
|
|
2107
|
+
// Show last pages
|
|
2108
|
+
const start = totalPages - maxPageButtons + 1;
|
|
2109
|
+
return Array.from({ length: maxPageButtons }, (_, i) => start + i);
|
|
2110
|
+
}
|
|
2111
|
+
else if (effectivePageStatus === "middle") {
|
|
2112
|
+
// Show pages around current page
|
|
2113
|
+
const halfMax = Math.floor(maxPageButtons / 2);
|
|
2114
|
+
let start = currentPage - halfMax;
|
|
2115
|
+
let end = currentPage + halfMax;
|
|
2116
|
+
// Adjust if at boundaries
|
|
2117
|
+
if (start < 1) {
|
|
2118
|
+
end += 1 - start;
|
|
2119
|
+
start = 1;
|
|
2120
|
+
}
|
|
2121
|
+
if (end > totalPages) {
|
|
2122
|
+
start -= end - totalPages;
|
|
2123
|
+
end = totalPages;
|
|
2124
|
+
}
|
|
2125
|
+
start = Math.max(1, start);
|
|
2126
|
+
end = Math.min(totalPages, end);
|
|
2127
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
2128
|
+
}
|
|
2129
|
+
// pageStatus === "none" - don't show any page numbers
|
|
2130
|
+
return [];
|
|
2131
|
+
};
|
|
2132
|
+
const pageNumbers = getPageNumbers();
|
|
2133
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn(paginationVariants({ size }), className), ...props, children: [showRowsPerPage && (jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [jsxRuntime.jsx("span", { className: "text-surface-ink-neutral-muted whitespace-nowrap", children: rowsPerPageLabel }), jsxRuntime.jsx("div", { className: "w-[80px]", children: jsxRuntime.jsx(Select, { value: rowsPerPage.toString(), options: rowsPerPageSelectOptions, onChange: handleRowsPerPageChange, size: selectSize, isDisabled: isDisabled, menuWidth: "auto" }) })] })), jsxRuntime.jsxs("div", { className: "flex items-center gap-3 ml-auto", children: [showPrevNext && (jsxRuntime.jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handlePrevPage, isDisabled: isPrevDisabled, leadingIcon: jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "w-4 h-4" }), "aria-label": "Previous page", children: prevLabel })), showPageJumper ? (
|
|
2134
|
+
// Show page dropdown selector
|
|
2135
|
+
jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [jsxRuntime.jsx("div", { className: "w-[80px]", children: jsxRuntime.jsx(Select, { value: currentPage.toString(), options: pageOptions, onChange: (value) => handlePageChange(typeof value === "string" ? parseInt(value) : value), size: selectSize, isDisabled: isDisabled, menuWidth: "auto" }) }), jsxRuntime.jsxs("span", { className: "text-surface-ink-neutral-muted whitespace-nowrap", children: [ofLabel, " ", totalPages] })] })) : (
|
|
2136
|
+
// Show numbered page buttons
|
|
2137
|
+
showPageNumber &&
|
|
2138
|
+
pageNumbers.length > 0 && (jsxRuntime.jsx(ButtonGroup, { variant: "separated", size: buttonSize, isDisabled: isDisabled, value: currentPage, onChange: (value) => handlePageChange(value), children: pageNumbers.map((pageNum) => (jsxRuntime.jsx(Button, { value: pageNum, variant: "tertiary", color: "primary", "aria-label": `Page ${pageNum}`, "aria-current": pageNum === currentPage ? "page" : undefined, children: pageNum }, pageNum))) }))), showPrevNext && (jsxRuntime.jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handleNextPage, isDisabled: isNextDisabled, trailingIcon: jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4" }), "aria-label": "Next page", children: nextLabel }))] })] }));
|
|
2139
|
+
});
|
|
2140
|
+
Pagination.displayName = "Pagination";
|
|
2141
|
+
|
|
1565
2142
|
const radioVariants = classVarianceAuthority.cva("relative inline-flex items-center justify-center shrink-0 border transition-all cursor-pointer rounded-full", {
|
|
1566
2143
|
variants: {
|
|
1567
2144
|
size: {
|
|
@@ -1836,13 +2413,30 @@ const defaultFilter = (item, query) => {
|
|
|
1836
2413
|
return (item.title.toLowerCase().includes(searchQuery) ||
|
|
1837
2414
|
(item.description?.toLowerCase().includes(searchQuery) ?? false));
|
|
1838
2415
|
};
|
|
1839
|
-
const SearchableDropdown = React__namespace.forwardRef(({ className, items = [], sectionHeading, isLoading = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, dropdownWidth = "full", showChevron = false, emptyIcon, disableFooter = false, onSearchChange, onItemSelect, filterFunction = defaultFilter, searchValue: controlledSearchValue, defaultSearchValue = "", dropdownClassName, minSearchLength = 0, showOnFocus = true, containerClassName, ...textFieldProps }, ref) => {
|
|
2416
|
+
const SearchableDropdown = React__namespace.forwardRef(({ className, items = [], sectionHeading, isLoading = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, dropdownWidth = "full", showChevron = false, emptyIcon, disableFooter = false, footerLayout = "horizontal", onSearchChange, onItemSelect, filterFunction = defaultFilter, searchValue: controlledSearchValue, defaultSearchValue = "", dropdownClassName, minSearchLength = 0, showOnFocus = true, containerClassName, ...textFieldProps }, ref) => {
|
|
1840
2417
|
const [uncontrolledSearchValue, setUncontrolledSearchValue] = React__namespace.useState(defaultSearchValue);
|
|
1841
2418
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
1842
2419
|
const [focusedIndex, setFocusedIndex] = React__namespace.useState(-1);
|
|
1843
2420
|
const dropdownRef = React__namespace.useRef(null);
|
|
1844
2421
|
const inputRef = React__namespace.useRef(null);
|
|
2422
|
+
const menuRef = React__namespace.useRef(null);
|
|
2423
|
+
const [position, setPosition] = React__namespace.useState({
|
|
2424
|
+
top: 0,
|
|
2425
|
+
left: 0,
|
|
2426
|
+
width: 0,
|
|
2427
|
+
});
|
|
1845
2428
|
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
2429
|
+
// Update position when dropdown opens or window resizes
|
|
2430
|
+
React__namespace.useEffect(() => {
|
|
2431
|
+
if (isOpen && dropdownRef.current) {
|
|
2432
|
+
const rect = dropdownRef.current.getBoundingClientRect();
|
|
2433
|
+
setPosition({
|
|
2434
|
+
top: rect.bottom + window.scrollY,
|
|
2435
|
+
left: rect.left + window.scrollX,
|
|
2436
|
+
width: rect.width,
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
}, [isOpen]);
|
|
1846
2440
|
const searchValue = controlledSearchValue !== undefined
|
|
1847
2441
|
? controlledSearchValue
|
|
1848
2442
|
: uncontrolledSearchValue;
|
|
@@ -1868,7 +2462,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
1868
2462
|
const handleItemSelect = (item) => {
|
|
1869
2463
|
onItemSelect?.(item);
|
|
1870
2464
|
if (controlledSearchValue === undefined) {
|
|
1871
|
-
setUncontrolledSearchValue(item.
|
|
2465
|
+
setUncontrolledSearchValue(item.title);
|
|
1872
2466
|
}
|
|
1873
2467
|
setIsOpen(false);
|
|
1874
2468
|
inputRef.current?.focus();
|
|
@@ -1883,7 +2477,9 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
1883
2477
|
React__namespace.useEffect(() => {
|
|
1884
2478
|
const handleClickOutside = (event) => {
|
|
1885
2479
|
if (dropdownRef.current &&
|
|
1886
|
-
!dropdownRef.current.contains(event.target)
|
|
2480
|
+
!dropdownRef.current.contains(event.target) &&
|
|
2481
|
+
menuRef.current &&
|
|
2482
|
+
!menuRef.current.contains(event.target)) {
|
|
1887
2483
|
setIsOpen(false);
|
|
1888
2484
|
}
|
|
1889
2485
|
};
|
|
@@ -1931,7 +2527,16 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
1931
2527
|
onClick: () => handleItemSelect(item),
|
|
1932
2528
|
}));
|
|
1933
2529
|
const showDropdown = isOpen && searchValue.length >= minSearchLength;
|
|
1934
|
-
|
|
2530
|
+
const dropdownMenu = showDropdown && (jsxRuntime.jsx("div", { ref: menuRef, style: {
|
|
2531
|
+
position: "absolute",
|
|
2532
|
+
top: `${position.top + 8}px`,
|
|
2533
|
+
left: `${position.left}px`,
|
|
2534
|
+
width: dropdownWidth === "full" ? `${position.width}px` : "auto",
|
|
2535
|
+
zIndex: 9999,
|
|
2536
|
+
}, children: jsxRuntime.jsx(DropdownMenu, { items: itemsWithHandlers, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty: filteredItems.length === 0, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyLinkText: emptyLinkText, onEmptyLinkClick: onEmptyLinkClick, primaryButtonText: primaryButtonText, secondaryButtonText: secondaryButtonText, onPrimaryClick: onPrimaryClick, onSecondaryClick: onSecondaryClick, showChevron: showChevron, emptyIcon: emptyIcon, disableFooter: disableFooter, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: dropdownWidth === "full" ? "full" : "auto" }) }));
|
|
2537
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: dropdownRef, className: cn("relative", containerClassName), children: jsxRuntime.jsx(TextField, { ref: inputRef, value: searchValue, onChange: handleSearchChange, onFocus: handleFocus, onKeyDown: handleKeyDown, containerClassName: "mb-0", ...textFieldProps }) }), typeof document !== "undefined" &&
|
|
2538
|
+
dropdownMenu &&
|
|
2539
|
+
reactDom.createPortal(dropdownMenu, document.body)] }));
|
|
1935
2540
|
});
|
|
1936
2541
|
SearchableDropdown.displayName = "SearchableDropdown";
|
|
1937
2542
|
|
|
@@ -2075,6 +2680,99 @@ const Switch = React__namespace.forwardRef(({ label, size = "medium", isDisabled
|
|
|
2075
2680
|
});
|
|
2076
2681
|
Switch.displayName = "Switch";
|
|
2077
2682
|
|
|
2683
|
+
const tableVariants = classVarianceAuthority.cva("w-full border-collapse", {
|
|
2684
|
+
variants: {
|
|
2685
|
+
variant: {
|
|
2686
|
+
default: "border-separate border-spacing-0",
|
|
2687
|
+
bordered: "border-separate border-spacing-0",
|
|
2688
|
+
striped: "border-separate border-spacing-0",
|
|
2689
|
+
},
|
|
2690
|
+
size: {
|
|
2691
|
+
small: "text-body-small-medium",
|
|
2692
|
+
medium: "text-body-medium-medium",
|
|
2693
|
+
large: "text-body-large-medium",
|
|
2694
|
+
},
|
|
2695
|
+
},
|
|
2696
|
+
defaultVariants: {
|
|
2697
|
+
variant: "default",
|
|
2698
|
+
size: "medium",
|
|
2699
|
+
},
|
|
2700
|
+
});
|
|
2701
|
+
const tableHeaderVariants = classVarianceAuthority.cva("text-body-medium-regular text-left text-surface-ink-neutral-normal border-b border-surface-outline-neutral-muted", {
|
|
2702
|
+
variants: {
|
|
2703
|
+
size: {
|
|
2704
|
+
small: "px-3 py-2 h-[32px]",
|
|
2705
|
+
medium: "px-4 py-3 h-[40px]",
|
|
2706
|
+
large: "px-6 py-4 h-[48px]",
|
|
2707
|
+
},
|
|
2708
|
+
},
|
|
2709
|
+
defaultVariants: {
|
|
2710
|
+
size: "medium",
|
|
2711
|
+
},
|
|
2712
|
+
});
|
|
2713
|
+
const tableCellVariants = classVarianceAuthority.cva("text-body-medium-regular border-b border-surface-outline-neutral-muted text-surface-ink-neutral-normal", {
|
|
2714
|
+
variants: {
|
|
2715
|
+
size: {
|
|
2716
|
+
small: "px-3 py-2 h-[40px]",
|
|
2717
|
+
medium: "px-4 py-3 h-[48px]",
|
|
2718
|
+
large: "px-6 py-4 h-[56px]",
|
|
2719
|
+
},
|
|
2720
|
+
},
|
|
2721
|
+
defaultVariants: {
|
|
2722
|
+
size: "medium",
|
|
2723
|
+
},
|
|
2724
|
+
});
|
|
2725
|
+
function TableComponent({ className, wrapperClassName, containerClassName, variant, size, table, enableRowSelection = false, enableSelectAll = false, isLoading = false, loadingComponent, emptyComponent, enableHorizontalScroll = false, stickyHeader = false, maxHeight, showRowHover = true, onRowClick, rowClassName, headerClassName, cellClassName, showHeaderBackground = true, ...props }, ref) {
|
|
2726
|
+
const hasData = table.getRowModel().rows?.length > 0;
|
|
2727
|
+
const getRowClassName = (row) => {
|
|
2728
|
+
if (typeof rowClassName === "function") {
|
|
2729
|
+
return rowClassName(row);
|
|
2730
|
+
}
|
|
2731
|
+
return rowClassName || "";
|
|
2732
|
+
};
|
|
2733
|
+
const renderLoadingState = () => {
|
|
2734
|
+
if (loadingComponent) {
|
|
2735
|
+
return loadingComponent;
|
|
2736
|
+
}
|
|
2737
|
+
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: table.getAllColumns().length, className: "text-center py-12 text-surface-ink-neutral-muted", children: jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2", children: [jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-action-fill-primary-default" }), jsxRuntime.jsx("span", { children: "Loading..." })] }) }) }));
|
|
2738
|
+
};
|
|
2739
|
+
const renderEmptyState = () => {
|
|
2740
|
+
if (emptyComponent) {
|
|
2741
|
+
return emptyComponent;
|
|
2742
|
+
}
|
|
2743
|
+
return (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: table.getAllColumns().length, className: "text-center py-12 text-surface-ink-neutral-muted", children: "No data available" }) }));
|
|
2744
|
+
};
|
|
2745
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsxRuntime.jsx("div", { className: cn("relative", enableHorizontalScroll && "overflow-x-auto", maxHeight && "overflow-y-auto", containerClassName), style: maxHeight ? { maxHeight } : undefined, children: jsxRuntime.jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsxRuntime.jsx("thead", { className: cn(showHeaderBackground && "bg-surface-fill-neutral-moderate", stickyHeader && "sticky top-0 z-10"), children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsxs("tr", { children: [enableRowSelection && enableSelectAll && (jsxRuntime.jsx("th", { className: cn(tableHeaderVariants({ size }), showHeaderBackground &&
|
|
2746
|
+
"bg-surface-fill-neutral-moderate", "w-10 rounded-tl-xlarge rounded-bl-xlarge", headerClassName), children: jsxRuntime.jsx(Checkbox, { checked: table.getIsAllRowsSelected(), isIndeterminate: table.getIsSomeRowsSelected(), onChange: table.getToggleAllRowsSelectedHandler(), "aria-label": "Select all rows" }) })), headerGroup.headers.map((header, index) => (jsxRuntime.jsx("th", { className: cn(tableHeaderVariants({ size }), showHeaderBackground &&
|
|
2747
|
+
"bg-surface-fill-neutral-moderate border-none",
|
|
2748
|
+
// Apply rounded corners to first and last headers
|
|
2749
|
+
!enableRowSelection &&
|
|
2750
|
+
index === 0 &&
|
|
2751
|
+
"rounded-tl-xlarge rounded-bl-xlarge", index === headerGroup.headers.length - 1 &&
|
|
2752
|
+
"rounded-tr-xlarge rounded-br-xlarge", header.column.columnDef.meta?.headerClassName, headerClassName), style: {
|
|
2753
|
+
width: header.getSize(),
|
|
2754
|
+
minWidth: header.column.columnDef.minSize,
|
|
2755
|
+
maxWidth: header.column.columnDef.maxSize,
|
|
2756
|
+
}, children: header.isPlaceholder ? null : (jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", header.column.getCanSort() &&
|
|
2757
|
+
"cursor-pointer select-none"), onClick: header.column.getToggleSortingHandler(), children: [reactTable.flexRender(header.column.columnDef.header, header.getContext()), header.column.getCanSort() && (jsxRuntime.jsx("span", { className: "text-surface-ink-neutral-muted", children: {
|
|
2758
|
+
asc: "↑",
|
|
2759
|
+
desc: "↓",
|
|
2760
|
+
}[header.column.getIsSorted()] ?? "↕" }))] })) }, header.id)))] }, headerGroup.id))) }), jsxRuntime.jsx("tbody", { className: "bg-surface-fill-neutral-intense", children: isLoading
|
|
2761
|
+
? renderLoadingState()
|
|
2762
|
+
: !hasData
|
|
2763
|
+
? renderEmptyState()
|
|
2764
|
+
: table.getRowModel().rows.map((row) => (jsxRuntime.jsxs("tr", { className: cn(variant === "striped" &&
|
|
2765
|
+
row.index % 2 === 1 &&
|
|
2766
|
+
"bg-surface-fill-neutral-moderate", showRowHover && "hover:bg-surface-fill-neutral-moderate", onRowClick && "cursor-pointer", getRowClassName(row.original)), onClick: () => onRowClick?.(row.original), children: [enableRowSelection && (jsxRuntime.jsx("td", { className: cn(tableCellVariants({ size }), "w-10", cellClassName), children: jsxRuntime.jsx(Checkbox, { checked: row.getIsSelected(), isIndeterminate: row.getIsSomeSelected(), onChange: row.getToggleSelectedHandler(), onClick: (e) => e.stopPropagation(), "aria-label": `Select row ${row.id}` }) })), row.getVisibleCells().map((cell) => (jsxRuntime.jsx("td", { className: cn(tableCellVariants({ size }), cell.column.columnDef.meta?.cellClassName, cellClassName), style: {
|
|
2767
|
+
width: cell.column.getSize(),
|
|
2768
|
+
minWidth: cell.column.columnDef.minSize,
|
|
2769
|
+
maxWidth: cell.column.columnDef.maxSize,
|
|
2770
|
+
}, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)))] }, row.id))) })] }) }) }));
|
|
2771
|
+
}
|
|
2772
|
+
// Use React.forwardRef with generic type
|
|
2773
|
+
const Table = React__namespace.forwardRef(TableComponent);
|
|
2774
|
+
Table.displayName = "Table";
|
|
2775
|
+
|
|
2078
2776
|
const tabItemVariants = classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 relative cursor-pointer", {
|
|
2079
2777
|
variants: {
|
|
2080
2778
|
variant: {
|
|
@@ -2277,8 +2975,10 @@ const TextArea = React__namespace.forwardRef(({ label, helperText, errorText, su
|
|
|
2277
2975
|
});
|
|
2278
2976
|
TextArea.displayName = "TextArea";
|
|
2279
2977
|
|
|
2978
|
+
exports.Avatar = Avatar;
|
|
2280
2979
|
exports.Badge = Badge;
|
|
2281
2980
|
exports.Button = Button;
|
|
2981
|
+
exports.ButtonGroup = ButtonGroup;
|
|
2282
2982
|
exports.Checkbox = Checkbox;
|
|
2283
2983
|
exports.Counter = Counter;
|
|
2284
2984
|
exports.Divider = Divider;
|
|
@@ -2289,16 +2989,22 @@ exports.FormHeader = FormHeader;
|
|
|
2289
2989
|
exports.Icon = Icon;
|
|
2290
2990
|
exports.Link = Link;
|
|
2291
2991
|
exports.ListItem = ListItem;
|
|
2992
|
+
exports.Modal = Modal;
|
|
2993
|
+
exports.Pagination = Pagination;
|
|
2292
2994
|
exports.Radio = Radio;
|
|
2293
2995
|
exports.SearchableDropdown = SearchableDropdown;
|
|
2996
|
+
exports.Select = Select;
|
|
2294
2997
|
exports.Switch = Switch;
|
|
2295
2998
|
exports.TabItem = TabItem;
|
|
2999
|
+
exports.Table = Table;
|
|
2296
3000
|
exports.Tabs = Tabs;
|
|
2297
3001
|
exports.Text = Text;
|
|
2298
3002
|
exports.TextArea = TextArea;
|
|
2299
3003
|
exports.TextField = TextField;
|
|
2300
3004
|
exports.Tooltip = Tooltip;
|
|
3005
|
+
exports.avatarVariants = avatarVariants;
|
|
2301
3006
|
exports.badgeVariants = badgeVariants;
|
|
3007
|
+
exports.buttonGroupVariants = buttonGroupVariants;
|
|
2302
3008
|
exports.buttonVariants = buttonVariants;
|
|
2303
3009
|
exports.checkboxVariants = checkboxVariants;
|
|
2304
3010
|
exports.cn = cn;
|
|
@@ -2309,8 +3015,13 @@ exports.hasIcon = hasIcon;
|
|
|
2309
3015
|
exports.iconRegistry = iconRegistry;
|
|
2310
3016
|
exports.linkVariants = linkVariants;
|
|
2311
3017
|
exports.listItemVariants = listItemVariants;
|
|
3018
|
+
exports.paginationVariants = paginationVariants;
|
|
2312
3019
|
exports.radioVariants = radioVariants;
|
|
3020
|
+
exports.selectVariants = selectVariants;
|
|
2313
3021
|
exports.switchVariants = switchVariants;
|
|
3022
|
+
exports.tableCellVariants = tableCellVariants;
|
|
3023
|
+
exports.tableHeaderVariants = tableHeaderVariants;
|
|
3024
|
+
exports.tableVariants = tableVariants;
|
|
2314
3025
|
exports.textAreaVariants = textAreaVariants;
|
|
2315
3026
|
exports.textFieldVariants = textFieldVariants;
|
|
2316
3027
|
exports.tooltipVariants = tooltipVariants;
|