@tonyarbor/components 0.1.0 → 0.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/Banner.d.mts +59 -0
- package/dist/Banner.d.ts +59 -0
- package/dist/Banner.js +222 -0
- package/dist/Banner.js.map +1 -0
- package/dist/Banner.mjs +7 -0
- package/dist/Banner.mjs.map +1 -0
- package/dist/Checkbox.d.mts +52 -0
- package/dist/Checkbox.d.ts +52 -0
- package/dist/Checkbox.js +194 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Checkbox.mjs.map +1 -0
- package/dist/Combobox.d.mts +67 -0
- package/dist/Combobox.d.ts +67 -0
- package/dist/Combobox.js +329 -0
- package/dist/Combobox.js.map +1 -0
- package/dist/Combobox.mjs +7 -0
- package/dist/Combobox.mjs.map +1 -0
- package/dist/DatePicker.d.mts +68 -0
- package/dist/DatePicker.d.ts +68 -0
- package/dist/DatePicker.js +490 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.mjs +7 -0
- package/dist/DatePicker.mjs.map +1 -0
- package/dist/NumericInput.d.mts +68 -0
- package/dist/NumericInput.d.ts +68 -0
- package/dist/NumericInput.js +319 -0
- package/dist/NumericInput.js.map +1 -0
- package/dist/NumericInput.mjs +7 -0
- package/dist/NumericInput.mjs.map +1 -0
- package/dist/Pagination.d.mts +36 -0
- package/dist/Pagination.d.ts +36 -0
- package/dist/Pagination.js +301 -0
- package/dist/Pagination.js.map +1 -0
- package/dist/Pagination.mjs +7 -0
- package/dist/Pagination.mjs.map +1 -0
- package/dist/Radio.d.mts +48 -0
- package/dist/Radio.d.ts +48 -0
- package/dist/Radio.js +194 -0
- package/dist/Radio.js.map +1 -0
- package/dist/Radio.mjs +7 -0
- package/dist/Radio.mjs.map +1 -0
- package/dist/Table.d.mts +80 -0
- package/dist/Table.d.ts +80 -0
- package/dist/Table.js +347 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.mjs +8 -0
- package/dist/Table.mjs.map +1 -0
- package/dist/TableControls.d.mts +76 -0
- package/dist/TableControls.d.ts +76 -0
- package/dist/TableControls.js +461 -0
- package/dist/TableControls.js.map +1 -0
- package/dist/TableControls.mjs +7 -0
- package/dist/TableControls.mjs.map +1 -0
- package/dist/TableFooterPagination.d.mts +56 -0
- package/dist/TableFooterPagination.d.ts +56 -0
- package/dist/TableFooterPagination.js +499 -0
- package/dist/TableFooterPagination.js.map +1 -0
- package/dist/TableFooterPagination.mjs +7 -0
- package/dist/TableFooterPagination.mjs.map +1 -0
- package/dist/Tabs.d.mts +50 -0
- package/dist/Tabs.d.ts +50 -0
- package/dist/Tabs.js +187 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.mjs +7 -0
- package/dist/Tabs.mjs.map +1 -0
- package/dist/TextArea.d.mts +64 -0
- package/dist/TextArea.d.ts +64 -0
- package/dist/TextArea.js +171 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextArea.mjs +7 -0
- package/dist/TextArea.mjs.map +1 -0
- package/dist/Toast.d.mts +48 -0
- package/dist/Toast.d.ts +48 -0
- package/dist/Toast.js +169 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.mjs +7 -0
- package/dist/Toast.mjs.map +1 -0
- package/dist/Toggle.d.mts +48 -0
- package/dist/Toggle.d.ts +48 -0
- package/dist/Toggle.js +291 -0
- package/dist/Toggle.js.map +1 -0
- package/dist/Toggle.mjs +7 -0
- package/dist/Toggle.mjs.map +1 -0
- package/dist/Tooltip.d.mts +32 -0
- package/dist/Tooltip.d.ts +32 -0
- package/dist/Tooltip.js +109 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.mjs +7 -0
- package/dist/Tooltip.mjs.map +1 -0
- package/dist/chunk-52TG3BFX.mjs +463 -0
- package/dist/chunk-52TG3BFX.mjs.map +1 -0
- package/dist/chunk-5BUXFTPW.mjs +283 -0
- package/dist/chunk-5BUXFTPW.mjs.map +1 -0
- package/dist/chunk-7OWLBYNM.mjs +293 -0
- package/dist/chunk-7OWLBYNM.mjs.map +1 -0
- package/dist/chunk-AI2U34CF.mjs +159 -0
- package/dist/chunk-AI2U34CF.mjs.map +1 -0
- package/dist/chunk-C25FFMRQ.mjs +255 -0
- package/dist/chunk-C25FFMRQ.mjs.map +1 -0
- package/dist/chunk-CUTYEIFE.mjs +158 -0
- package/dist/chunk-CUTYEIFE.mjs.map +1 -0
- package/dist/chunk-DULH2KRW.mjs +133 -0
- package/dist/chunk-DULH2KRW.mjs.map +1 -0
- package/dist/chunk-G5NVKF2G.mjs +434 -0
- package/dist/chunk-G5NVKF2G.mjs.map +1 -0
- package/dist/chunk-M6DVBEEL.mjs +158 -0
- package/dist/chunk-M6DVBEEL.mjs.map +1 -0
- package/dist/chunk-MBUMR2XJ.mjs +135 -0
- package/dist/chunk-MBUMR2XJ.mjs.map +1 -0
- package/dist/chunk-MNH2TGUX.mjs +73 -0
- package/dist/chunk-MNH2TGUX.mjs.map +1 -0
- package/dist/chunk-RRMG2SSZ.mjs +265 -0
- package/dist/chunk-RRMG2SSZ.mjs.map +1 -0
- package/dist/chunk-U4JXKZZG.mjs +186 -0
- package/dist/chunk-U4JXKZZG.mjs.map +1 -0
- package/dist/chunk-W55QJIAN.mjs +467 -0
- package/dist/chunk-W55QJIAN.mjs.map +1 -0
- package/dist/chunk-YV4OXFIM.mjs +151 -0
- package/dist/chunk-YV4OXFIM.mjs.map +1 -0
- package/dist/index.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +3559 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -1
- package/package.json +81 -3
package/dist/index.js
CHANGED
|
@@ -30,10 +30,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
Banner: () => Banner,
|
|
33
34
|
Button: () => Button,
|
|
34
35
|
Card: () => Card,
|
|
36
|
+
Checkbox: () => Checkbox,
|
|
37
|
+
Combobox: () => Combobox,
|
|
38
|
+
DatePicker: () => DatePicker,
|
|
35
39
|
Input: () => Input,
|
|
36
|
-
|
|
40
|
+
NumericInput: () => NumericInput,
|
|
41
|
+
Pagination: () => Pagination,
|
|
42
|
+
Radio: () => Radio,
|
|
43
|
+
Table: () => Table,
|
|
44
|
+
TableControls: () => TableControls,
|
|
45
|
+
TableFooterPagination: () => TableFooterPagination,
|
|
46
|
+
Tabs: () => Tabs,
|
|
47
|
+
Tag: () => Tag,
|
|
48
|
+
TextArea: () => TextArea,
|
|
49
|
+
Toast: () => Toast,
|
|
50
|
+
Toggle: () => Toggle,
|
|
51
|
+
Tooltip: () => Tooltip
|
|
37
52
|
});
|
|
38
53
|
module.exports = __toCommonJS(src_exports);
|
|
39
54
|
|
|
@@ -500,11 +515,3553 @@ var Tag = React4.forwardRef(
|
|
|
500
515
|
}
|
|
501
516
|
);
|
|
502
517
|
Tag.displayName = "Tag";
|
|
518
|
+
|
|
519
|
+
// src/Combobox/Combobox.tsx
|
|
520
|
+
var React5 = __toESM(require("react"));
|
|
521
|
+
var import_clsx5 = require("clsx");
|
|
522
|
+
var import_lucide_react = require("lucide-react");
|
|
523
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
524
|
+
var comboboxStyles = {
|
|
525
|
+
base: {
|
|
526
|
+
width: "100%",
|
|
527
|
+
height: "36px",
|
|
528
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
529
|
+
backgroundColor: "#ffffff",
|
|
530
|
+
borderRadius: "8px",
|
|
531
|
+
transition: "all 0.2s ease-in-out",
|
|
532
|
+
outline: "none",
|
|
533
|
+
fontSize: "13px",
|
|
534
|
+
padding: "8px",
|
|
535
|
+
paddingRight: "32px",
|
|
536
|
+
margin: "0",
|
|
537
|
+
display: "flex",
|
|
538
|
+
alignItems: "center",
|
|
539
|
+
cursor: "pointer",
|
|
540
|
+
position: "relative"
|
|
541
|
+
},
|
|
542
|
+
states: {
|
|
543
|
+
default: {
|
|
544
|
+
border: "1px solid #d1d1d1",
|
|
545
|
+
// grey-300
|
|
546
|
+
color: "#2f2f2f"
|
|
547
|
+
// grey-900
|
|
548
|
+
},
|
|
549
|
+
defaultFocus: {
|
|
550
|
+
borderColor: "#3cad51",
|
|
551
|
+
// brand-500
|
|
552
|
+
outline: "3px solid rgba(60, 173, 81, 0.2)"
|
|
553
|
+
},
|
|
554
|
+
error: {
|
|
555
|
+
border: "1px solid #c93232",
|
|
556
|
+
// destructive-500
|
|
557
|
+
color: "#2f2f2f"
|
|
558
|
+
},
|
|
559
|
+
errorFocus: {
|
|
560
|
+
borderColor: "#c93232",
|
|
561
|
+
outline: "3px solid rgba(201, 50, 50, 0.2)"
|
|
562
|
+
},
|
|
563
|
+
success: {
|
|
564
|
+
border: "1px solid #16a33d",
|
|
565
|
+
// success-500
|
|
566
|
+
color: "#2f2f2f"
|
|
567
|
+
},
|
|
568
|
+
successFocus: {
|
|
569
|
+
borderColor: "#16a33d",
|
|
570
|
+
outline: "3px solid rgba(22, 163, 61, 0.2)"
|
|
571
|
+
},
|
|
572
|
+
disabled: {
|
|
573
|
+
backgroundColor: "#f8f8f8",
|
|
574
|
+
// grey-050
|
|
575
|
+
borderColor: "#efefef",
|
|
576
|
+
// grey-100
|
|
577
|
+
color: "#7e7e7e",
|
|
578
|
+
// grey-500
|
|
579
|
+
cursor: "not-allowed"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var labelStyles2 = {
|
|
584
|
+
display: "block",
|
|
585
|
+
fontSize: "13px",
|
|
586
|
+
fontWeight: "600",
|
|
587
|
+
color: "#2f2f2f",
|
|
588
|
+
marginBottom: "4px",
|
|
589
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
590
|
+
};
|
|
591
|
+
var helperTextStyles2 = {
|
|
592
|
+
fontSize: "13px",
|
|
593
|
+
margin: "0",
|
|
594
|
+
marginTop: "2px",
|
|
595
|
+
color: "#595959",
|
|
596
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
597
|
+
lineHeight: "1.4"
|
|
598
|
+
};
|
|
599
|
+
var errorTextStyles2 = {
|
|
600
|
+
...helperTextStyles2,
|
|
601
|
+
color: "#a62323",
|
|
602
|
+
// destructive-600
|
|
603
|
+
display: "flex",
|
|
604
|
+
alignItems: "center",
|
|
605
|
+
gap: "4px"
|
|
606
|
+
};
|
|
607
|
+
var dropdownStyles = {
|
|
608
|
+
position: "absolute",
|
|
609
|
+
top: "calc(100% + 4px)",
|
|
610
|
+
left: "0",
|
|
611
|
+
right: "0",
|
|
612
|
+
backgroundColor: "#ffffff",
|
|
613
|
+
border: "1px solid #d1d1d1",
|
|
614
|
+
borderRadius: "8px",
|
|
615
|
+
maxHeight: "200px",
|
|
616
|
+
overflowY: "auto",
|
|
617
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
618
|
+
zIndex: 1e3
|
|
619
|
+
};
|
|
620
|
+
var optionStyles = {
|
|
621
|
+
padding: "8px 12px",
|
|
622
|
+
fontSize: "13px",
|
|
623
|
+
cursor: "pointer",
|
|
624
|
+
display: "flex",
|
|
625
|
+
alignItems: "center",
|
|
626
|
+
justifyContent: "space-between",
|
|
627
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
628
|
+
color: "#2f2f2f"
|
|
629
|
+
// grey-900
|
|
630
|
+
};
|
|
631
|
+
var Combobox = React5.forwardRef(
|
|
632
|
+
({
|
|
633
|
+
label,
|
|
634
|
+
placeholder = "default-text",
|
|
635
|
+
options,
|
|
636
|
+
value,
|
|
637
|
+
onChange,
|
|
638
|
+
state = "default",
|
|
639
|
+
error,
|
|
640
|
+
helperText,
|
|
641
|
+
disabled = false,
|
|
642
|
+
className,
|
|
643
|
+
style,
|
|
644
|
+
"data-testid": dataTestId
|
|
645
|
+
}, ref) => {
|
|
646
|
+
const [isOpen, setIsOpen] = React5.useState(false);
|
|
647
|
+
const [searchQuery, setSearchQuery] = React5.useState("");
|
|
648
|
+
const [isFocused, setIsFocused] = React5.useState(false);
|
|
649
|
+
const inputRef = React5.useRef(null);
|
|
650
|
+
const dropdownRef = React5.useRef(null);
|
|
651
|
+
const wrapperRef = React5.useRef(null);
|
|
652
|
+
const comboboxId = React5.useId();
|
|
653
|
+
const helperTextId = React5.useId();
|
|
654
|
+
const errorId = React5.useId();
|
|
655
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
656
|
+
const filteredOptions = React5.useMemo(() => {
|
|
657
|
+
if (!searchQuery) return options;
|
|
658
|
+
return options.filter(
|
|
659
|
+
(option) => option.label.toLowerCase().includes(searchQuery.toLowerCase())
|
|
660
|
+
);
|
|
661
|
+
}, [options, searchQuery]);
|
|
662
|
+
React5.useEffect(() => {
|
|
663
|
+
const handleClickOutside = (event) => {
|
|
664
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
665
|
+
setIsOpen(false);
|
|
666
|
+
setSearchQuery("");
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
670
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
671
|
+
}, []);
|
|
672
|
+
const handleInputChange = (e) => {
|
|
673
|
+
setSearchQuery(e.target.value);
|
|
674
|
+
if (!isOpen) setIsOpen(true);
|
|
675
|
+
};
|
|
676
|
+
const handleSelectOption = (optionValue) => {
|
|
677
|
+
onChange?.(optionValue);
|
|
678
|
+
setIsOpen(false);
|
|
679
|
+
setSearchQuery("");
|
|
680
|
+
inputRef.current?.blur();
|
|
681
|
+
};
|
|
682
|
+
const handleClear = (e) => {
|
|
683
|
+
e.stopPropagation();
|
|
684
|
+
onChange?.(void 0);
|
|
685
|
+
setSearchQuery("");
|
|
686
|
+
inputRef.current?.focus();
|
|
687
|
+
};
|
|
688
|
+
const handleInputFocus = () => {
|
|
689
|
+
setIsFocused(true);
|
|
690
|
+
if (!disabled) setIsOpen(true);
|
|
691
|
+
};
|
|
692
|
+
const handleInputBlur = () => {
|
|
693
|
+
setIsFocused(false);
|
|
694
|
+
setTimeout(() => {
|
|
695
|
+
if (!wrapperRef.current?.contains(document.activeElement)) {
|
|
696
|
+
setSearchQuery("");
|
|
697
|
+
}
|
|
698
|
+
}, 200);
|
|
699
|
+
};
|
|
700
|
+
const currentState = error ? "error" : state;
|
|
701
|
+
const stateStyles = comboboxStyles.states[currentState];
|
|
702
|
+
const focusStyles = currentState === "error" ? comboboxStyles.states.errorFocus : currentState === "success" ? comboboxStyles.states.successFocus : comboboxStyles.states.defaultFocus;
|
|
703
|
+
const inputWrapperStyle = {
|
|
704
|
+
...comboboxStyles.base,
|
|
705
|
+
...stateStyles,
|
|
706
|
+
...isFocused && !disabled && focusStyles,
|
|
707
|
+
...disabled && comboboxStyles.states.disabled
|
|
708
|
+
};
|
|
709
|
+
const displayValue = selectedOption ? selectedOption.label : "";
|
|
710
|
+
const showPlaceholder = !selectedOption && !searchQuery && !isFocused;
|
|
711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx5.clsx)("arbor-combobox-wrapper", className), style, ref: wrapperRef, "data-testid": dataTestId, children: [
|
|
712
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: comboboxId, style: labelStyles2, children: label }),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { position: "relative" }, ref, children: [
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: inputWrapperStyle, children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
716
|
+
"input",
|
|
717
|
+
{
|
|
718
|
+
ref: inputRef,
|
|
719
|
+
id: comboboxId,
|
|
720
|
+
type: "text",
|
|
721
|
+
value: searchQuery || displayValue,
|
|
722
|
+
onChange: handleInputChange,
|
|
723
|
+
onFocus: handleInputFocus,
|
|
724
|
+
onBlur: handleInputBlur,
|
|
725
|
+
placeholder: showPlaceholder ? placeholder : "",
|
|
726
|
+
disabled,
|
|
727
|
+
"aria-invalid": error ? "true" : "false",
|
|
728
|
+
"aria-describedby": error ? errorId : helperText ? helperTextId : void 0,
|
|
729
|
+
"aria-expanded": isOpen,
|
|
730
|
+
"aria-autocomplete": "list",
|
|
731
|
+
role: "combobox",
|
|
732
|
+
style: {
|
|
733
|
+
border: "none",
|
|
734
|
+
outline: "none",
|
|
735
|
+
background: "transparent",
|
|
736
|
+
flex: 1,
|
|
737
|
+
fontSize: "13px",
|
|
738
|
+
padding: 0,
|
|
739
|
+
margin: 0,
|
|
740
|
+
color: showPlaceholder ? "#7e7e7e" : "#2f2f2f",
|
|
741
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px", position: "absolute", right: "8px" }, children: [
|
|
746
|
+
selectedOption && !disabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
747
|
+
"button",
|
|
748
|
+
{
|
|
749
|
+
type: "button",
|
|
750
|
+
onClick: handleClear,
|
|
751
|
+
style: {
|
|
752
|
+
border: "none",
|
|
753
|
+
background: "transparent",
|
|
754
|
+
padding: "2px",
|
|
755
|
+
cursor: "pointer",
|
|
756
|
+
display: "flex",
|
|
757
|
+
alignItems: "center",
|
|
758
|
+
color: "#7e7e7e"
|
|
759
|
+
},
|
|
760
|
+
"aria-label": "Clear selection",
|
|
761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.X, { size: 16 })
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
currentState === "success" && !isOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Check, { size: 16, color: "#16a33d" }),
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
766
|
+
import_lucide_react.ChevronDown,
|
|
767
|
+
{
|
|
768
|
+
size: 16,
|
|
769
|
+
color: "#7e7e7e",
|
|
770
|
+
style: {
|
|
771
|
+
transform: isOpen ? "rotate(180deg)" : "rotate(0deg)",
|
|
772
|
+
transition: "transform 0.2s"
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
)
|
|
776
|
+
] })
|
|
777
|
+
] }),
|
|
778
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: dropdownRef, style: dropdownStyles, children: filteredOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { ...optionStyles, color: "#7e7e7e", cursor: "default" }, children: "No options found" }) : filteredOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
779
|
+
"div",
|
|
780
|
+
{
|
|
781
|
+
onClick: () => handleSelectOption(option.value),
|
|
782
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
783
|
+
style: {
|
|
784
|
+
...optionStyles,
|
|
785
|
+
backgroundColor: option.value === value ? "#f8f8f8" : "transparent"
|
|
786
|
+
},
|
|
787
|
+
onMouseEnter: (e) => {
|
|
788
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
789
|
+
},
|
|
790
|
+
onMouseLeave: (e) => {
|
|
791
|
+
e.currentTarget.style.backgroundColor = option.value === value ? "#f8f8f8" : "transparent";
|
|
792
|
+
},
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: option.label }),
|
|
795
|
+
option.value === value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Check, { size: 16, color: "#16a33d" })
|
|
796
|
+
]
|
|
797
|
+
},
|
|
798
|
+
option.value
|
|
799
|
+
)) })
|
|
800
|
+
] }),
|
|
801
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: errorId, style: errorTextStyles2, role: "alert", children: error }),
|
|
802
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: helperTextId, style: helperTextStyles2, children: helperText })
|
|
803
|
+
] });
|
|
804
|
+
}
|
|
805
|
+
);
|
|
806
|
+
Combobox.displayName = "Combobox";
|
|
807
|
+
|
|
808
|
+
// src/NumericInput/NumericInput.tsx
|
|
809
|
+
var React6 = __toESM(require("react"));
|
|
810
|
+
var import_clsx6 = require("clsx");
|
|
811
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
812
|
+
var labelStyles3 = {
|
|
813
|
+
display: "block",
|
|
814
|
+
fontSize: "13px",
|
|
815
|
+
fontWeight: "600",
|
|
816
|
+
color: "#2f2f2f",
|
|
817
|
+
marginBottom: "4px",
|
|
818
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
819
|
+
};
|
|
820
|
+
var helperTextStyles3 = {
|
|
821
|
+
fontSize: "13px",
|
|
822
|
+
margin: "0",
|
|
823
|
+
marginTop: "2px",
|
|
824
|
+
color: "#595959",
|
|
825
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
826
|
+
lineHeight: "1.4"
|
|
827
|
+
};
|
|
828
|
+
var errorTextStyles3 = {
|
|
829
|
+
...helperTextStyles3,
|
|
830
|
+
color: "#a62323",
|
|
831
|
+
// destructive-600
|
|
832
|
+
display: "flex",
|
|
833
|
+
alignItems: "center",
|
|
834
|
+
gap: "4px"
|
|
835
|
+
};
|
|
836
|
+
var containerStyles = {
|
|
837
|
+
base: {
|
|
838
|
+
display: "flex",
|
|
839
|
+
alignItems: "center",
|
|
840
|
+
height: "46px",
|
|
841
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
842
|
+
backgroundColor: "#ffffff",
|
|
843
|
+
borderRadius: "8px",
|
|
844
|
+
transition: "all 0.2s ease-in-out",
|
|
845
|
+
overflow: "hidden"
|
|
846
|
+
},
|
|
847
|
+
states: {
|
|
848
|
+
default: {
|
|
849
|
+
border: "1px solid #d1d1d1"
|
|
850
|
+
// grey-300
|
|
851
|
+
},
|
|
852
|
+
defaultFocus: {
|
|
853
|
+
borderColor: "#3cad51",
|
|
854
|
+
// brand-500
|
|
855
|
+
outline: "3px solid rgba(60, 173, 81, 0.2)"
|
|
856
|
+
},
|
|
857
|
+
error: {
|
|
858
|
+
border: "1px solid #c93232"
|
|
859
|
+
// destructive-500
|
|
860
|
+
},
|
|
861
|
+
errorFocus: {
|
|
862
|
+
borderColor: "#c93232",
|
|
863
|
+
outline: "3px solid rgba(201, 50, 50, 0.2)"
|
|
864
|
+
},
|
|
865
|
+
success: {
|
|
866
|
+
border: "1px solid #16a33d"
|
|
867
|
+
// success-500
|
|
868
|
+
},
|
|
869
|
+
successFocus: {
|
|
870
|
+
borderColor: "#16a33d",
|
|
871
|
+
outline: "3px solid rgba(22, 163, 61, 0.2)"
|
|
872
|
+
},
|
|
873
|
+
disabled: {
|
|
874
|
+
backgroundColor: "#f8f8f8",
|
|
875
|
+
// grey-050
|
|
876
|
+
borderColor: "#efefef",
|
|
877
|
+
// grey-100
|
|
878
|
+
cursor: "not-allowed"
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
var buttonStyles2 = {
|
|
883
|
+
width: "46px",
|
|
884
|
+
height: "100%",
|
|
885
|
+
border: "none",
|
|
886
|
+
background: "transparent",
|
|
887
|
+
cursor: "pointer",
|
|
888
|
+
fontSize: "16px",
|
|
889
|
+
color: "#2f2f2f",
|
|
890
|
+
display: "flex",
|
|
891
|
+
alignItems: "center",
|
|
892
|
+
justifyContent: "center",
|
|
893
|
+
transition: "background-color 0.2s",
|
|
894
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
895
|
+
userSelect: "none"
|
|
896
|
+
};
|
|
897
|
+
var inputStyles2 = {
|
|
898
|
+
flex: 1,
|
|
899
|
+
border: "none",
|
|
900
|
+
outline: "none",
|
|
901
|
+
background: "transparent",
|
|
902
|
+
textAlign: "center",
|
|
903
|
+
fontSize: "13px",
|
|
904
|
+
color: "#2f2f2f",
|
|
905
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
906
|
+
padding: "0 8px",
|
|
907
|
+
appearance: "textfield"
|
|
908
|
+
};
|
|
909
|
+
var NumericInput = React6.forwardRef(
|
|
910
|
+
({
|
|
911
|
+
label,
|
|
912
|
+
value,
|
|
913
|
+
onChange,
|
|
914
|
+
min,
|
|
915
|
+
max,
|
|
916
|
+
step = 1,
|
|
917
|
+
state = "default",
|
|
918
|
+
error,
|
|
919
|
+
helperText,
|
|
920
|
+
disabled = false,
|
|
921
|
+
className,
|
|
922
|
+
style,
|
|
923
|
+
"data-testid": dataTestId
|
|
924
|
+
}, ref) => {
|
|
925
|
+
const [isFocused, setIsFocused] = React6.useState(false);
|
|
926
|
+
const inputRef = React6.useRef(null);
|
|
927
|
+
const inputId = React6.useId();
|
|
928
|
+
const helperTextId = React6.useId();
|
|
929
|
+
const errorId = React6.useId();
|
|
930
|
+
const clampValue = (val) => {
|
|
931
|
+
let clamped = val;
|
|
932
|
+
if (min !== void 0 && clamped < min) clamped = min;
|
|
933
|
+
if (max !== void 0 && clamped > max) clamped = max;
|
|
934
|
+
return clamped;
|
|
935
|
+
};
|
|
936
|
+
const handleIncrement = () => {
|
|
937
|
+
if (disabled) return;
|
|
938
|
+
const currentValue = value ?? 0;
|
|
939
|
+
const newValue = currentValue + step;
|
|
940
|
+
const clampedValue = clampValue(newValue);
|
|
941
|
+
if (clampedValue !== currentValue) {
|
|
942
|
+
onChange?.(clampedValue);
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
const handleDecrement = () => {
|
|
946
|
+
if (disabled) return;
|
|
947
|
+
const currentValue = value ?? 0;
|
|
948
|
+
const newValue = currentValue - step;
|
|
949
|
+
const clampedValue = clampValue(newValue);
|
|
950
|
+
if (clampedValue !== currentValue) {
|
|
951
|
+
onChange?.(clampedValue);
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
const handleInputChange = (e) => {
|
|
955
|
+
const inputValue = e.target.value;
|
|
956
|
+
if (inputValue === "" || inputValue === "-") {
|
|
957
|
+
onChange?.(void 0);
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
const numValue = parseFloat(inputValue);
|
|
961
|
+
if (!isNaN(numValue)) {
|
|
962
|
+
const clampedValue = clampValue(numValue);
|
|
963
|
+
onChange?.(clampedValue);
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
const handleKeyDown = (e) => {
|
|
967
|
+
const allowedKeys = ["Backspace", "Delete", "Tab", "Escape", "Enter", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "-", "."];
|
|
968
|
+
if (allowedKeys.includes(e.key)) {
|
|
969
|
+
if (e.key === "ArrowUp") {
|
|
970
|
+
e.preventDefault();
|
|
971
|
+
handleIncrement();
|
|
972
|
+
} else if (e.key === "ArrowDown") {
|
|
973
|
+
e.preventDefault();
|
|
974
|
+
handleDecrement();
|
|
975
|
+
}
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
if (!/^[0-9]$/.test(e.key)) {
|
|
979
|
+
e.preventDefault();
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
const currentState = error ? "error" : state;
|
|
983
|
+
const stateStyles = containerStyles.states[currentState];
|
|
984
|
+
const focusStyles = currentState === "error" ? containerStyles.states.errorFocus : currentState === "success" ? containerStyles.states.successFocus : containerStyles.states.defaultFocus;
|
|
985
|
+
const containerStyle = {
|
|
986
|
+
...containerStyles.base,
|
|
987
|
+
...stateStyles,
|
|
988
|
+
...isFocused && !disabled && focusStyles,
|
|
989
|
+
...disabled && containerStyles.states.disabled
|
|
990
|
+
};
|
|
991
|
+
const isDecrementDisabled = disabled || min !== void 0 && value !== void 0 && value <= min;
|
|
992
|
+
const isIncrementDisabled = disabled || max !== void 0 && value !== void 0 && value >= max;
|
|
993
|
+
const getButtonStyle = (isDisabled) => {
|
|
994
|
+
const baseStyle = {
|
|
995
|
+
...buttonStyles2,
|
|
996
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
997
|
+
color: isDisabled ? "#7e7e7e" : "#2f2f2f"
|
|
998
|
+
};
|
|
999
|
+
if (currentState === "success" && !isDisabled) {
|
|
1000
|
+
return {
|
|
1001
|
+
...baseStyle,
|
|
1002
|
+
color: "#16a33d",
|
|
1003
|
+
// success-500
|
|
1004
|
+
border: "2px solid #16a33d",
|
|
1005
|
+
borderRadius: "50%",
|
|
1006
|
+
width: "32px",
|
|
1007
|
+
height: "32px"
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
return baseStyle;
|
|
1011
|
+
};
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx6.clsx)("arbor-numeric-input-wrapper", className), style, ref, "data-testid": dataTestId, children: [
|
|
1013
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: inputId, style: labelStyles3, children: label }),
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: containerStyle, children: [
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1016
|
+
"button",
|
|
1017
|
+
{
|
|
1018
|
+
type: "button",
|
|
1019
|
+
onClick: handleDecrement,
|
|
1020
|
+
disabled: isDecrementDisabled,
|
|
1021
|
+
style: getButtonStyle(isDecrementDisabled),
|
|
1022
|
+
onMouseEnter: (e) => {
|
|
1023
|
+
if (!isDecrementDisabled) {
|
|
1024
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1025
|
+
e.currentTarget.style.borderRadius = "99px";
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
onMouseLeave: (e) => {
|
|
1029
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1030
|
+
e.currentTarget.style.borderRadius = currentState === "success" ? "50%" : "0";
|
|
1031
|
+
},
|
|
1032
|
+
"aria-label": "Decrement",
|
|
1033
|
+
children: "\u2212"
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1037
|
+
"input",
|
|
1038
|
+
{
|
|
1039
|
+
ref: inputRef,
|
|
1040
|
+
id: inputId,
|
|
1041
|
+
type: "text",
|
|
1042
|
+
inputMode: "numeric",
|
|
1043
|
+
value: value !== void 0 ? value : "",
|
|
1044
|
+
onChange: handleInputChange,
|
|
1045
|
+
onKeyDown: handleKeyDown,
|
|
1046
|
+
onFocus: () => setIsFocused(true),
|
|
1047
|
+
onBlur: () => setIsFocused(false),
|
|
1048
|
+
disabled,
|
|
1049
|
+
"aria-invalid": error ? "true" : "false",
|
|
1050
|
+
"aria-describedby": error ? errorId : helperText ? helperTextId : void 0,
|
|
1051
|
+
style: {
|
|
1052
|
+
...inputStyles2,
|
|
1053
|
+
color: disabled ? "#7e7e7e" : "#2f2f2f",
|
|
1054
|
+
cursor: disabled ? "not-allowed" : "text"
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
),
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1059
|
+
"button",
|
|
1060
|
+
{
|
|
1061
|
+
type: "button",
|
|
1062
|
+
onClick: handleIncrement,
|
|
1063
|
+
disabled: isIncrementDisabled,
|
|
1064
|
+
style: getButtonStyle(isIncrementDisabled),
|
|
1065
|
+
onMouseEnter: (e) => {
|
|
1066
|
+
if (!isIncrementDisabled) {
|
|
1067
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1068
|
+
e.currentTarget.style.borderRadius = "99px";
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
onMouseLeave: (e) => {
|
|
1072
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1073
|
+
e.currentTarget.style.borderRadius = currentState === "success" ? "50%" : "0";
|
|
1074
|
+
},
|
|
1075
|
+
"aria-label": "Increment",
|
|
1076
|
+
children: "+"
|
|
1077
|
+
}
|
|
1078
|
+
)
|
|
1079
|
+
] }),
|
|
1080
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: errorId, style: errorTextStyles3, children: error }),
|
|
1081
|
+
helperText && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: helperTextId, style: helperTextStyles3, children: helperText })
|
|
1082
|
+
] });
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
NumericInput.displayName = "NumericInput";
|
|
1086
|
+
|
|
1087
|
+
// src/Checkbox/Checkbox.tsx
|
|
1088
|
+
var React7 = __toESM(require("react"));
|
|
1089
|
+
var import_clsx7 = require("clsx");
|
|
1090
|
+
var import_lucide_react2 = require("lucide-react");
|
|
1091
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1092
|
+
var checkboxStyles = {
|
|
1093
|
+
width: "16px",
|
|
1094
|
+
height: "16px",
|
|
1095
|
+
border: "1px solid #7e7e7e",
|
|
1096
|
+
// grey-500
|
|
1097
|
+
borderRadius: "4px",
|
|
1098
|
+
display: "flex",
|
|
1099
|
+
alignItems: "center",
|
|
1100
|
+
justifyContent: "center",
|
|
1101
|
+
cursor: "pointer",
|
|
1102
|
+
transition: "all 0.2s ease-in-out",
|
|
1103
|
+
flexShrink: 0,
|
|
1104
|
+
backgroundColor: "#ffffff"
|
|
1105
|
+
};
|
|
1106
|
+
var checkedStyles = {
|
|
1107
|
+
backgroundColor: "#0e8a0e",
|
|
1108
|
+
// brand-600
|
|
1109
|
+
border: "1px solid #0e8a0e"
|
|
1110
|
+
};
|
|
1111
|
+
var checkedHoverStyles = {
|
|
1112
|
+
backgroundColor: "#005700",
|
|
1113
|
+
// brand-800
|
|
1114
|
+
border: "1px solid #005700"
|
|
1115
|
+
};
|
|
1116
|
+
var uncheckedHoverStyles = {
|
|
1117
|
+
border: "1px solid #474747"
|
|
1118
|
+
// grey-700
|
|
1119
|
+
};
|
|
1120
|
+
var labelStyles4 = {
|
|
1121
|
+
fontSize: "13px",
|
|
1122
|
+
color: "#2f2f2f",
|
|
1123
|
+
cursor: "pointer",
|
|
1124
|
+
userSelect: "none",
|
|
1125
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1126
|
+
};
|
|
1127
|
+
var wrapperStyles = {
|
|
1128
|
+
display: "flex",
|
|
1129
|
+
alignItems: "center",
|
|
1130
|
+
gap: "8px"
|
|
1131
|
+
};
|
|
1132
|
+
var Checkbox = React7.forwardRef(
|
|
1133
|
+
({
|
|
1134
|
+
label,
|
|
1135
|
+
checked = false,
|
|
1136
|
+
onChange,
|
|
1137
|
+
disabled = false,
|
|
1138
|
+
className,
|
|
1139
|
+
style,
|
|
1140
|
+
"data-testid": dataTestId,
|
|
1141
|
+
name,
|
|
1142
|
+
value,
|
|
1143
|
+
indeterminate = false
|
|
1144
|
+
}, ref) => {
|
|
1145
|
+
const [isFocused, setIsFocused] = React7.useState(false);
|
|
1146
|
+
const [isHovered, setIsHovered] = React7.useState(false);
|
|
1147
|
+
const checkboxId = React7.useId();
|
|
1148
|
+
const innerRef = React7.useRef(null);
|
|
1149
|
+
React7.useEffect(() => {
|
|
1150
|
+
const node = innerRef.current;
|
|
1151
|
+
if (node) {
|
|
1152
|
+
node.indeterminate = indeterminate;
|
|
1153
|
+
if (typeof ref === "function") {
|
|
1154
|
+
ref(node);
|
|
1155
|
+
} else if (ref) {
|
|
1156
|
+
ref.current = node;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}, [indeterminate, ref]);
|
|
1160
|
+
const handleChange = (e) => {
|
|
1161
|
+
if (!disabled) {
|
|
1162
|
+
onChange?.(e.target.checked);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
const boxStyle = {
|
|
1166
|
+
...checkboxStyles,
|
|
1167
|
+
...(checked || indeterminate) && !disabled && checkedStyles,
|
|
1168
|
+
...isHovered && !disabled && !(checked || indeterminate) && uncheckedHoverStyles,
|
|
1169
|
+
...isHovered && !disabled && (checked || indeterminate) && checkedHoverStyles,
|
|
1170
|
+
...disabled && !checked && !indeterminate && { backgroundColor: "#efefef", border: "1px solid #b3b3b3" },
|
|
1171
|
+
...disabled && (checked || indeterminate) && { backgroundColor: "#b3b3b3", border: "1px solid #b3b3b3" },
|
|
1172
|
+
...isFocused && !disabled && {
|
|
1173
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
const checkmarkColor = "#ffffff";
|
|
1177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1178
|
+
"div",
|
|
1179
|
+
{
|
|
1180
|
+
className: (0, import_clsx7.clsx)("arbor-checkbox-wrapper", className),
|
|
1181
|
+
style: { ...wrapperStyles, ...style },
|
|
1182
|
+
"data-testid": dataTestId,
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1185
|
+
"input",
|
|
1186
|
+
{
|
|
1187
|
+
ref: innerRef,
|
|
1188
|
+
id: checkboxId,
|
|
1189
|
+
type: "checkbox",
|
|
1190
|
+
checked,
|
|
1191
|
+
onChange: handleChange,
|
|
1192
|
+
onFocus: () => setIsFocused(true),
|
|
1193
|
+
onBlur: () => setIsFocused(false),
|
|
1194
|
+
disabled,
|
|
1195
|
+
name,
|
|
1196
|
+
value,
|
|
1197
|
+
style: {
|
|
1198
|
+
position: "absolute",
|
|
1199
|
+
opacity: 0,
|
|
1200
|
+
width: 0,
|
|
1201
|
+
height: 0
|
|
1202
|
+
},
|
|
1203
|
+
"aria-checked": indeterminate ? "mixed" : checked
|
|
1204
|
+
}
|
|
1205
|
+
),
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1207
|
+
"label",
|
|
1208
|
+
{
|
|
1209
|
+
htmlFor: checkboxId,
|
|
1210
|
+
onMouseEnter: () => !disabled && setIsHovered(true),
|
|
1211
|
+
onMouseLeave: () => !disabled && setIsHovered(false),
|
|
1212
|
+
style: {
|
|
1213
|
+
display: "flex",
|
|
1214
|
+
alignItems: "center",
|
|
1215
|
+
gap: "8px",
|
|
1216
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
1217
|
+
},
|
|
1218
|
+
children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: boxStyle, children: (checked || indeterminate) && (indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Minus, { size: 12, color: checkmarkColor, strokeWidth: 3 }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Check, { size: 16, color: checkmarkColor, strokeWidth: 3 })) }),
|
|
1220
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1221
|
+
"span",
|
|
1222
|
+
{
|
|
1223
|
+
style: {
|
|
1224
|
+
...labelStyles4,
|
|
1225
|
+
color: disabled ? "#7e7e7e" : "#2f2f2f",
|
|
1226
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
1227
|
+
},
|
|
1228
|
+
children: label
|
|
1229
|
+
}
|
|
1230
|
+
)
|
|
1231
|
+
]
|
|
1232
|
+
}
|
|
1233
|
+
)
|
|
1234
|
+
]
|
|
1235
|
+
}
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
);
|
|
1239
|
+
Checkbox.displayName = "Checkbox";
|
|
1240
|
+
|
|
1241
|
+
// src/Radio/Radio.tsx
|
|
1242
|
+
var React8 = __toESM(require("react"));
|
|
1243
|
+
var import_clsx8 = require("clsx");
|
|
1244
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1245
|
+
var radioStyles = {
|
|
1246
|
+
width: "16px",
|
|
1247
|
+
height: "16px",
|
|
1248
|
+
border: "1px solid #7e7e7e",
|
|
1249
|
+
// grey-500
|
|
1250
|
+
borderRadius: "50%",
|
|
1251
|
+
display: "flex",
|
|
1252
|
+
alignItems: "center",
|
|
1253
|
+
justifyContent: "center",
|
|
1254
|
+
cursor: "pointer",
|
|
1255
|
+
transition: "all 0.2s ease-in-out",
|
|
1256
|
+
flexShrink: 0,
|
|
1257
|
+
backgroundColor: "#ffffff"
|
|
1258
|
+
};
|
|
1259
|
+
var checkedStyles2 = {
|
|
1260
|
+
border: "1px solid #0e8a0e"
|
|
1261
|
+
// brand-600
|
|
1262
|
+
};
|
|
1263
|
+
var checkedHoverStyles2 = {
|
|
1264
|
+
border: "1px solid #005700"
|
|
1265
|
+
// brand-800
|
|
1266
|
+
};
|
|
1267
|
+
var uncheckedHoverStyles2 = {
|
|
1268
|
+
border: "1px solid #2f2f2f"
|
|
1269
|
+
// grey-900
|
|
1270
|
+
};
|
|
1271
|
+
var innerDotStyles = {
|
|
1272
|
+
width: "10px",
|
|
1273
|
+
height: "10px",
|
|
1274
|
+
borderRadius: "50%",
|
|
1275
|
+
backgroundColor: "#0e8a0e",
|
|
1276
|
+
// brand-600
|
|
1277
|
+
transition: "all 0.2s ease-in-out"
|
|
1278
|
+
};
|
|
1279
|
+
var innerDotHoverStyles = {
|
|
1280
|
+
backgroundColor: "#005700"
|
|
1281
|
+
// brand-800
|
|
1282
|
+
};
|
|
1283
|
+
var labelStyles5 = {
|
|
1284
|
+
fontSize: "13px",
|
|
1285
|
+
color: "#2f2f2f",
|
|
1286
|
+
cursor: "pointer",
|
|
1287
|
+
userSelect: "none",
|
|
1288
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1289
|
+
};
|
|
1290
|
+
var wrapperStyles2 = {
|
|
1291
|
+
display: "flex",
|
|
1292
|
+
alignItems: "center",
|
|
1293
|
+
gap: "8px"
|
|
1294
|
+
};
|
|
1295
|
+
var Radio = React8.forwardRef(
|
|
1296
|
+
({
|
|
1297
|
+
label,
|
|
1298
|
+
checked = false,
|
|
1299
|
+
onChange,
|
|
1300
|
+
disabled = false,
|
|
1301
|
+
className,
|
|
1302
|
+
style,
|
|
1303
|
+
"data-testid": dataTestId,
|
|
1304
|
+
name,
|
|
1305
|
+
value
|
|
1306
|
+
}, ref) => {
|
|
1307
|
+
const [isFocused, setIsFocused] = React8.useState(false);
|
|
1308
|
+
const [isHovered, setIsHovered] = React8.useState(false);
|
|
1309
|
+
const radioId = React8.useId();
|
|
1310
|
+
const handleChange = (e) => {
|
|
1311
|
+
if (!disabled) {
|
|
1312
|
+
onChange?.(e.target.checked);
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
const circleStyle = {
|
|
1316
|
+
...radioStyles,
|
|
1317
|
+
...checked && !disabled && checkedStyles2,
|
|
1318
|
+
...isHovered && !disabled && !checked && uncheckedHoverStyles2,
|
|
1319
|
+
...isHovered && !disabled && checked && checkedHoverStyles2,
|
|
1320
|
+
...disabled && !checked && { backgroundColor: "#efefef", border: "1px solid #7e7e7e" },
|
|
1321
|
+
...disabled && checked && { backgroundColor: "#efefef", border: "1px solid #7e7e7e" },
|
|
1322
|
+
...isFocused && !disabled && {
|
|
1323
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
const dotStyle = {
|
|
1327
|
+
...innerDotStyles,
|
|
1328
|
+
...isHovered && !disabled && innerDotHoverStyles,
|
|
1329
|
+
...disabled && { backgroundColor: "#7e7e7e" }
|
|
1330
|
+
};
|
|
1331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1332
|
+
"div",
|
|
1333
|
+
{
|
|
1334
|
+
className: (0, import_clsx8.clsx)("arbor-radio-wrapper", className),
|
|
1335
|
+
style: { ...wrapperStyles2, ...style },
|
|
1336
|
+
"data-testid": dataTestId,
|
|
1337
|
+
children: [
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1339
|
+
"input",
|
|
1340
|
+
{
|
|
1341
|
+
ref,
|
|
1342
|
+
id: radioId,
|
|
1343
|
+
type: "radio",
|
|
1344
|
+
checked,
|
|
1345
|
+
onChange: handleChange,
|
|
1346
|
+
onFocus: () => setIsFocused(true),
|
|
1347
|
+
onBlur: () => setIsFocused(false),
|
|
1348
|
+
disabled,
|
|
1349
|
+
name,
|
|
1350
|
+
value,
|
|
1351
|
+
style: {
|
|
1352
|
+
position: "absolute",
|
|
1353
|
+
opacity: 0,
|
|
1354
|
+
width: 0,
|
|
1355
|
+
height: 0
|
|
1356
|
+
},
|
|
1357
|
+
"aria-checked": checked
|
|
1358
|
+
}
|
|
1359
|
+
),
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1361
|
+
"label",
|
|
1362
|
+
{
|
|
1363
|
+
htmlFor: radioId,
|
|
1364
|
+
onMouseEnter: () => !disabled && setIsHovered(true),
|
|
1365
|
+
onMouseLeave: () => !disabled && setIsHovered(false),
|
|
1366
|
+
style: {
|
|
1367
|
+
display: "flex",
|
|
1368
|
+
alignItems: "center",
|
|
1369
|
+
gap: "8px",
|
|
1370
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
1371
|
+
},
|
|
1372
|
+
children: [
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: circleStyle, children: checked && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: dotStyle }) }),
|
|
1374
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1375
|
+
"span",
|
|
1376
|
+
{
|
|
1377
|
+
style: {
|
|
1378
|
+
...labelStyles5,
|
|
1379
|
+
color: disabled ? "#7e7e7e" : "#2f2f2f",
|
|
1380
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
1381
|
+
},
|
|
1382
|
+
children: label
|
|
1383
|
+
}
|
|
1384
|
+
)
|
|
1385
|
+
]
|
|
1386
|
+
}
|
|
1387
|
+
)
|
|
1388
|
+
]
|
|
1389
|
+
}
|
|
1390
|
+
);
|
|
1391
|
+
}
|
|
1392
|
+
);
|
|
1393
|
+
Radio.displayName = "Radio";
|
|
1394
|
+
|
|
1395
|
+
// src/DatePicker/DatePicker.tsx
|
|
1396
|
+
var React9 = __toESM(require("react"));
|
|
1397
|
+
var import_clsx9 = require("clsx");
|
|
1398
|
+
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
1399
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1400
|
+
var import_date_fns = require("date-fns");
|
|
1401
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1402
|
+
var wrapperStyles3 = {
|
|
1403
|
+
display: "flex",
|
|
1404
|
+
flexDirection: "column",
|
|
1405
|
+
gap: "4px"
|
|
1406
|
+
};
|
|
1407
|
+
var labelStyles6 = {
|
|
1408
|
+
fontSize: "11px",
|
|
1409
|
+
fontWeight: 600,
|
|
1410
|
+
color: "#2f2f2f",
|
|
1411
|
+
textTransform: "uppercase",
|
|
1412
|
+
letterSpacing: "0.5px",
|
|
1413
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1414
|
+
};
|
|
1415
|
+
var inputContainerStyles = {
|
|
1416
|
+
position: "relative",
|
|
1417
|
+
display: "flex",
|
|
1418
|
+
alignItems: "center"
|
|
1419
|
+
};
|
|
1420
|
+
var inputStyles3 = {
|
|
1421
|
+
width: "100%",
|
|
1422
|
+
height: "36px",
|
|
1423
|
+
padding: "0 36px 0 12px",
|
|
1424
|
+
fontSize: "13px",
|
|
1425
|
+
border: "1px solid #d1d1d1",
|
|
1426
|
+
borderRadius: "8px",
|
|
1427
|
+
outline: "none",
|
|
1428
|
+
transition: "all 0.2s ease-in-out",
|
|
1429
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1430
|
+
backgroundColor: "#ffffff",
|
|
1431
|
+
color: "#2f2f2f"
|
|
1432
|
+
};
|
|
1433
|
+
var iconButtonStyles = {
|
|
1434
|
+
position: "absolute",
|
|
1435
|
+
right: "8px",
|
|
1436
|
+
display: "flex",
|
|
1437
|
+
alignItems: "center",
|
|
1438
|
+
justifyContent: "center",
|
|
1439
|
+
padding: "4px",
|
|
1440
|
+
cursor: "pointer",
|
|
1441
|
+
color: "#595959",
|
|
1442
|
+
backgroundColor: "transparent",
|
|
1443
|
+
border: "none"
|
|
1444
|
+
};
|
|
1445
|
+
var helperTextStyles4 = {
|
|
1446
|
+
fontSize: "11px",
|
|
1447
|
+
color: "#595959",
|
|
1448
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1449
|
+
};
|
|
1450
|
+
var calendarPopoverStyles = {
|
|
1451
|
+
backgroundColor: "#ffffff",
|
|
1452
|
+
border: "1px solid #efefef",
|
|
1453
|
+
borderRadius: "8px",
|
|
1454
|
+
padding: "16px",
|
|
1455
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
1456
|
+
minWidth: "320px",
|
|
1457
|
+
zIndex: 1e3
|
|
1458
|
+
};
|
|
1459
|
+
var calendarHeaderStyles = {
|
|
1460
|
+
display: "flex",
|
|
1461
|
+
alignItems: "center",
|
|
1462
|
+
justifyContent: "space-between",
|
|
1463
|
+
marginBottom: "16px",
|
|
1464
|
+
gap: "8px"
|
|
1465
|
+
};
|
|
1466
|
+
var monthYearContainerStyles = {
|
|
1467
|
+
display: "flex",
|
|
1468
|
+
gap: "8px",
|
|
1469
|
+
flex: 1
|
|
1470
|
+
};
|
|
1471
|
+
var selectStyles = {
|
|
1472
|
+
padding: "6px 8px",
|
|
1473
|
+
fontSize: "13px",
|
|
1474
|
+
border: "1px solid #d1d1d1",
|
|
1475
|
+
borderRadius: "6px",
|
|
1476
|
+
backgroundColor: "#ffffff",
|
|
1477
|
+
color: "#2f2f2f",
|
|
1478
|
+
cursor: "pointer",
|
|
1479
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1480
|
+
outline: "none"
|
|
1481
|
+
};
|
|
1482
|
+
var navButtonStyles = {
|
|
1483
|
+
display: "flex",
|
|
1484
|
+
alignItems: "center",
|
|
1485
|
+
justifyContent: "center",
|
|
1486
|
+
width: "28px",
|
|
1487
|
+
height: "28px",
|
|
1488
|
+
border: "none",
|
|
1489
|
+
backgroundColor: "transparent",
|
|
1490
|
+
cursor: "pointer",
|
|
1491
|
+
borderRadius: "4px",
|
|
1492
|
+
color: "#2f2f2f",
|
|
1493
|
+
transition: "background-color 0.2s"
|
|
1494
|
+
};
|
|
1495
|
+
var weekDaysStyles = {
|
|
1496
|
+
display: "grid",
|
|
1497
|
+
gridTemplateColumns: "repeat(7, 1fr)",
|
|
1498
|
+
gap: "4px",
|
|
1499
|
+
marginBottom: "8px"
|
|
1500
|
+
};
|
|
1501
|
+
var weekDayStyles = {
|
|
1502
|
+
fontSize: "11px",
|
|
1503
|
+
fontWeight: 600,
|
|
1504
|
+
color: "#7e7e7e",
|
|
1505
|
+
textAlign: "center",
|
|
1506
|
+
padding: "4px",
|
|
1507
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1508
|
+
};
|
|
1509
|
+
var daysGridStyles = {
|
|
1510
|
+
display: "grid",
|
|
1511
|
+
gridTemplateColumns: "repeat(7, 1fr)",
|
|
1512
|
+
gap: "4px"
|
|
1513
|
+
};
|
|
1514
|
+
var dayButtonStyles = {
|
|
1515
|
+
width: "36px",
|
|
1516
|
+
height: "36px",
|
|
1517
|
+
display: "flex",
|
|
1518
|
+
alignItems: "center",
|
|
1519
|
+
justifyContent: "center",
|
|
1520
|
+
border: "none",
|
|
1521
|
+
backgroundColor: "transparent",
|
|
1522
|
+
borderRadius: "50%",
|
|
1523
|
+
cursor: "pointer",
|
|
1524
|
+
fontSize: "13px",
|
|
1525
|
+
color: "#2f2f2f",
|
|
1526
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1527
|
+
transition: "all 0.2s"
|
|
1528
|
+
};
|
|
1529
|
+
var footerStyles = {
|
|
1530
|
+
display: "flex",
|
|
1531
|
+
justifyContent: "flex-end",
|
|
1532
|
+
marginTop: "12px",
|
|
1533
|
+
paddingTop: "12px",
|
|
1534
|
+
borderTop: "1px solid #efefef"
|
|
1535
|
+
};
|
|
1536
|
+
var todayButtonStyles = {
|
|
1537
|
+
padding: "6px 12px",
|
|
1538
|
+
fontSize: "13px",
|
|
1539
|
+
fontWeight: 500,
|
|
1540
|
+
color: "#16a33d",
|
|
1541
|
+
backgroundColor: "transparent",
|
|
1542
|
+
border: "none",
|
|
1543
|
+
cursor: "pointer",
|
|
1544
|
+
borderRadius: "6px",
|
|
1545
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1546
|
+
transition: "background-color 0.2s"
|
|
1547
|
+
};
|
|
1548
|
+
var MONTHS = [
|
|
1549
|
+
"January",
|
|
1550
|
+
"February",
|
|
1551
|
+
"March",
|
|
1552
|
+
"April",
|
|
1553
|
+
"May",
|
|
1554
|
+
"June",
|
|
1555
|
+
"July",
|
|
1556
|
+
"August",
|
|
1557
|
+
"September",
|
|
1558
|
+
"October",
|
|
1559
|
+
"November",
|
|
1560
|
+
"December"
|
|
1561
|
+
];
|
|
1562
|
+
var WEEKDAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
|
|
1563
|
+
var DatePicker = React9.forwardRef(
|
|
1564
|
+
({
|
|
1565
|
+
value,
|
|
1566
|
+
onChange,
|
|
1567
|
+
label,
|
|
1568
|
+
placeholder = "DD/MM/YYYY",
|
|
1569
|
+
helperText,
|
|
1570
|
+
error,
|
|
1571
|
+
state = "default",
|
|
1572
|
+
disabled = false,
|
|
1573
|
+
className,
|
|
1574
|
+
style,
|
|
1575
|
+
"data-testid": dataTestId,
|
|
1576
|
+
minDate,
|
|
1577
|
+
maxDate,
|
|
1578
|
+
dateFormat = "dd/MM/yyyy"
|
|
1579
|
+
}, ref) => {
|
|
1580
|
+
const [open, setOpen] = React9.useState(false);
|
|
1581
|
+
const [inputValue, setInputValue] = React9.useState("");
|
|
1582
|
+
const [viewDate, setViewDate] = React9.useState(value || /* @__PURE__ */ new Date());
|
|
1583
|
+
const inputId = React9.useId();
|
|
1584
|
+
React9.useEffect(() => {
|
|
1585
|
+
if (value && (0, import_date_fns.isValid)(value)) {
|
|
1586
|
+
setInputValue((0, import_date_fns.format)(value, dateFormat));
|
|
1587
|
+
} else {
|
|
1588
|
+
setInputValue("");
|
|
1589
|
+
}
|
|
1590
|
+
}, [value, dateFormat]);
|
|
1591
|
+
React9.useEffect(() => {
|
|
1592
|
+
if (value && (0, import_date_fns.isValid)(value)) {
|
|
1593
|
+
setViewDate(value);
|
|
1594
|
+
}
|
|
1595
|
+
}, [value]);
|
|
1596
|
+
const handleInputChange = (e) => {
|
|
1597
|
+
const newValue = e.target.value;
|
|
1598
|
+
setInputValue(newValue);
|
|
1599
|
+
const parsedDate = (0, import_date_fns.parse)(newValue, dateFormat, /* @__PURE__ */ new Date());
|
|
1600
|
+
if ((0, import_date_fns.isValid)(parsedDate)) {
|
|
1601
|
+
onChange?.(parsedDate);
|
|
1602
|
+
setViewDate(parsedDate);
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
const handleInputBlur = () => {
|
|
1606
|
+
if (value && (0, import_date_fns.isValid)(value)) {
|
|
1607
|
+
setInputValue((0, import_date_fns.format)(value, dateFormat));
|
|
1608
|
+
} else if (!inputValue) {
|
|
1609
|
+
onChange?.(void 0);
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
const handleDateSelect = (date) => {
|
|
1613
|
+
onChange?.(date);
|
|
1614
|
+
setOpen(false);
|
|
1615
|
+
};
|
|
1616
|
+
const handleTodayClick = () => {
|
|
1617
|
+
const today = /* @__PURE__ */ new Date();
|
|
1618
|
+
onChange?.(today);
|
|
1619
|
+
setViewDate(today);
|
|
1620
|
+
setOpen(false);
|
|
1621
|
+
};
|
|
1622
|
+
const handleMonthChange = (e) => {
|
|
1623
|
+
const newMonth = parseInt(e.target.value, 10);
|
|
1624
|
+
const newDate = new Date(viewDate);
|
|
1625
|
+
newDate.setMonth(newMonth);
|
|
1626
|
+
setViewDate(newDate);
|
|
1627
|
+
};
|
|
1628
|
+
const handleYearChange = (e) => {
|
|
1629
|
+
const newYear = parseInt(e.target.value, 10);
|
|
1630
|
+
const newDate = new Date(viewDate);
|
|
1631
|
+
newDate.setFullYear(newYear);
|
|
1632
|
+
setViewDate(newDate);
|
|
1633
|
+
};
|
|
1634
|
+
const handlePrevMonth = () => {
|
|
1635
|
+
setViewDate((0, import_date_fns.subMonths)(viewDate, 1));
|
|
1636
|
+
};
|
|
1637
|
+
const handleNextMonth = () => {
|
|
1638
|
+
setViewDate((0, import_date_fns.addMonths)(viewDate, 1));
|
|
1639
|
+
};
|
|
1640
|
+
const monthStart = (0, import_date_fns.startOfMonth)(viewDate);
|
|
1641
|
+
const monthEnd = (0, import_date_fns.endOfMonth)(viewDate);
|
|
1642
|
+
const startDate = (0, import_date_fns.startOfWeek)(monthStart, { weekStartsOn: 1 });
|
|
1643
|
+
const endDate = (0, import_date_fns.endOfWeek)(monthEnd, { weekStartsOn: 1 });
|
|
1644
|
+
const days = (0, import_date_fns.eachDayOfInterval)({ start: startDate, end: endDate });
|
|
1645
|
+
const isDateDisabled = (date) => {
|
|
1646
|
+
if (minDate && date < minDate) return true;
|
|
1647
|
+
if (maxDate && date > maxDate) return true;
|
|
1648
|
+
return false;
|
|
1649
|
+
};
|
|
1650
|
+
const currentYear = viewDate.getFullYear();
|
|
1651
|
+
const yearOptions = Array.from({ length: 201 }, (_, i) => currentYear - 100 + i);
|
|
1652
|
+
const currentState = error ? "error" : state;
|
|
1653
|
+
const getInputStyles = () => {
|
|
1654
|
+
const styles = { ...inputStyles3 };
|
|
1655
|
+
if (disabled) {
|
|
1656
|
+
styles.backgroundColor = "#f8f8f8";
|
|
1657
|
+
styles.borderColor = "#efefef";
|
|
1658
|
+
styles.color = "#7e7e7e";
|
|
1659
|
+
styles.cursor = "not-allowed";
|
|
1660
|
+
} else if (currentState === "error") {
|
|
1661
|
+
styles.borderColor = "#e02f1d";
|
|
1662
|
+
} else if (currentState === "success") {
|
|
1663
|
+
styles.borderColor = "#16a33d";
|
|
1664
|
+
}
|
|
1665
|
+
return styles;
|
|
1666
|
+
};
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1668
|
+
"div",
|
|
1669
|
+
{
|
|
1670
|
+
className: (0, import_clsx9.clsx)("arbor-datepicker-wrapper", className),
|
|
1671
|
+
style: { ...wrapperStyles3, ...style },
|
|
1672
|
+
"data-testid": dataTestId,
|
|
1673
|
+
children: [
|
|
1674
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { htmlFor: inputId, style: labelStyles6, children: label }),
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover.Root, { open, onOpenChange: setOpen, children: [
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: inputContainerStyles, children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1678
|
+
"input",
|
|
1679
|
+
{
|
|
1680
|
+
ref,
|
|
1681
|
+
id: inputId,
|
|
1682
|
+
type: "text",
|
|
1683
|
+
value: inputValue,
|
|
1684
|
+
onChange: handleInputChange,
|
|
1685
|
+
onBlur: handleInputBlur,
|
|
1686
|
+
placeholder,
|
|
1687
|
+
disabled,
|
|
1688
|
+
style: getInputStyles(),
|
|
1689
|
+
"aria-label": label || "Date picker"
|
|
1690
|
+
}
|
|
1691
|
+
),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1693
|
+
"button",
|
|
1694
|
+
{
|
|
1695
|
+
type: "button",
|
|
1696
|
+
style: {
|
|
1697
|
+
...iconButtonStyles,
|
|
1698
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
1699
|
+
},
|
|
1700
|
+
disabled,
|
|
1701
|
+
"aria-label": "Open calendar",
|
|
1702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Calendar, { size: 16 })
|
|
1703
|
+
}
|
|
1704
|
+
) })
|
|
1705
|
+
] }),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1707
|
+
Popover.Content,
|
|
1708
|
+
{
|
|
1709
|
+
align: "start",
|
|
1710
|
+
sideOffset: 4,
|
|
1711
|
+
style: calendarPopoverStyles,
|
|
1712
|
+
children: [
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: calendarHeaderStyles, children: [
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1715
|
+
"button",
|
|
1716
|
+
{
|
|
1717
|
+
type: "button",
|
|
1718
|
+
onClick: handlePrevMonth,
|
|
1719
|
+
style: navButtonStyles,
|
|
1720
|
+
onMouseEnter: (e) => {
|
|
1721
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1722
|
+
},
|
|
1723
|
+
onMouseLeave: (e) => {
|
|
1724
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1725
|
+
},
|
|
1726
|
+
"aria-label": "Previous month",
|
|
1727
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, { size: 16 })
|
|
1728
|
+
}
|
|
1729
|
+
),
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: monthYearContainerStyles, children: [
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1732
|
+
"select",
|
|
1733
|
+
{
|
|
1734
|
+
value: viewDate.getMonth(),
|
|
1735
|
+
onChange: handleMonthChange,
|
|
1736
|
+
style: selectStyles,
|
|
1737
|
+
"aria-label": "Select month",
|
|
1738
|
+
children: MONTHS.map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: index, children: month }, month))
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1742
|
+
"select",
|
|
1743
|
+
{
|
|
1744
|
+
value: viewDate.getFullYear(),
|
|
1745
|
+
onChange: handleYearChange,
|
|
1746
|
+
style: selectStyles,
|
|
1747
|
+
"aria-label": "Select year",
|
|
1748
|
+
children: yearOptions.map((year) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: year, children: year }, year))
|
|
1749
|
+
}
|
|
1750
|
+
)
|
|
1751
|
+
] }),
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1753
|
+
"button",
|
|
1754
|
+
{
|
|
1755
|
+
type: "button",
|
|
1756
|
+
onClick: handleNextMonth,
|
|
1757
|
+
style: navButtonStyles,
|
|
1758
|
+
onMouseEnter: (e) => {
|
|
1759
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1760
|
+
},
|
|
1761
|
+
onMouseLeave: (e) => {
|
|
1762
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1763
|
+
},
|
|
1764
|
+
"aria-label": "Next month",
|
|
1765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { size: 16 })
|
|
1766
|
+
}
|
|
1767
|
+
)
|
|
1768
|
+
] }),
|
|
1769
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: weekDaysStyles, children: WEEKDAYS.map((day) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: weekDayStyles, children: day }, day)) }),
|
|
1770
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: daysGridStyles, children: days.map((day) => {
|
|
1771
|
+
const isCurrentMonth = day.getMonth() === viewDate.getMonth();
|
|
1772
|
+
const isSelected = value && (0, import_date_fns.isSameDay)(day, value);
|
|
1773
|
+
const isTodayDate = (0, import_date_fns.isToday)(day);
|
|
1774
|
+
const isDayDisabled = isDateDisabled(day);
|
|
1775
|
+
const getDayButtonStyles = () => {
|
|
1776
|
+
const styles = { ...dayButtonStyles };
|
|
1777
|
+
if (!isCurrentMonth) {
|
|
1778
|
+
styles.color = "#d1d1d1";
|
|
1779
|
+
}
|
|
1780
|
+
if (isDayDisabled) {
|
|
1781
|
+
styles.color = "#d1d1d1";
|
|
1782
|
+
styles.cursor = "not-allowed";
|
|
1783
|
+
}
|
|
1784
|
+
if (isSelected) {
|
|
1785
|
+
styles.backgroundColor = "#3cad51";
|
|
1786
|
+
styles.color = "#ffffff";
|
|
1787
|
+
} else if (isTodayDate && !isDayDisabled) {
|
|
1788
|
+
styles.fontWeight = 600;
|
|
1789
|
+
styles.color = "#16a33d";
|
|
1790
|
+
}
|
|
1791
|
+
return styles;
|
|
1792
|
+
};
|
|
1793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1794
|
+
"button",
|
|
1795
|
+
{
|
|
1796
|
+
type: "button",
|
|
1797
|
+
onClick: () => !isDayDisabled && handleDateSelect(day),
|
|
1798
|
+
disabled: isDayDisabled,
|
|
1799
|
+
style: getDayButtonStyles(),
|
|
1800
|
+
onMouseEnter: (e) => {
|
|
1801
|
+
if (!isSelected && !isDayDisabled && isCurrentMonth) {
|
|
1802
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1803
|
+
}
|
|
1804
|
+
},
|
|
1805
|
+
onMouseLeave: (e) => {
|
|
1806
|
+
if (!isSelected) {
|
|
1807
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
"aria-label": (0, import_date_fns.format)(day, "MMMM d, yyyy"),
|
|
1811
|
+
"aria-selected": isSelected,
|
|
1812
|
+
children: (0, import_date_fns.format)(day, "d")
|
|
1813
|
+
},
|
|
1814
|
+
day.toISOString()
|
|
1815
|
+
);
|
|
1816
|
+
}) }),
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: footerStyles, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1818
|
+
"button",
|
|
1819
|
+
{
|
|
1820
|
+
type: "button",
|
|
1821
|
+
onClick: handleTodayClick,
|
|
1822
|
+
style: todayButtonStyles,
|
|
1823
|
+
onMouseEnter: (e) => {
|
|
1824
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
1825
|
+
},
|
|
1826
|
+
onMouseLeave: (e) => {
|
|
1827
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1828
|
+
},
|
|
1829
|
+
children: "Today"
|
|
1830
|
+
}
|
|
1831
|
+
) })
|
|
1832
|
+
]
|
|
1833
|
+
}
|
|
1834
|
+
) })
|
|
1835
|
+
] }),
|
|
1836
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { ...helperTextStyles4, color: "#e02f1d" }, children: error }),
|
|
1837
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: helperTextStyles4, children: helperText })
|
|
1838
|
+
]
|
|
1839
|
+
}
|
|
1840
|
+
);
|
|
1841
|
+
}
|
|
1842
|
+
);
|
|
1843
|
+
DatePicker.displayName = "DatePicker";
|
|
1844
|
+
|
|
1845
|
+
// src/Toast/Toast.tsx
|
|
1846
|
+
var React10 = __toESM(require("react"));
|
|
1847
|
+
var import_clsx10 = require("clsx");
|
|
1848
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1849
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1850
|
+
var baseToastStyles = {
|
|
1851
|
+
width: "360px",
|
|
1852
|
+
padding: "16px",
|
|
1853
|
+
borderRadius: "8px",
|
|
1854
|
+
border: "1px solid",
|
|
1855
|
+
display: "flex",
|
|
1856
|
+
alignItems: "center",
|
|
1857
|
+
gap: "12px",
|
|
1858
|
+
boxShadow: "0px 4px 12px 0px rgba(32, 32, 32, 0.08)",
|
|
1859
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1860
|
+
};
|
|
1861
|
+
var messageStyles = {
|
|
1862
|
+
fontSize: "13px",
|
|
1863
|
+
fontWeight: 600,
|
|
1864
|
+
flex: 1
|
|
1865
|
+
};
|
|
1866
|
+
var closeButtonStyles = {
|
|
1867
|
+
width: "24px",
|
|
1868
|
+
height: "24px",
|
|
1869
|
+
borderRadius: "50%",
|
|
1870
|
+
border: "none",
|
|
1871
|
+
background: "transparent",
|
|
1872
|
+
cursor: "pointer",
|
|
1873
|
+
display: "flex",
|
|
1874
|
+
alignItems: "center",
|
|
1875
|
+
justifyContent: "center",
|
|
1876
|
+
flexShrink: 0,
|
|
1877
|
+
transition: "background-color 0.2s ease-in-out"
|
|
1878
|
+
};
|
|
1879
|
+
var variantConfig = {
|
|
1880
|
+
information: {
|
|
1881
|
+
backgroundColor: "#f5fbff",
|
|
1882
|
+
borderColor: "#2c8bca",
|
|
1883
|
+
textColor: "#053a61",
|
|
1884
|
+
icon: import_lucide_react4.Info,
|
|
1885
|
+
iconColor: "#2c8bca",
|
|
1886
|
+
closeHoverBg: "#e0f3ff"
|
|
1887
|
+
},
|
|
1888
|
+
danger: {
|
|
1889
|
+
backgroundColor: "#fff5f5",
|
|
1890
|
+
borderColor: "#c93232",
|
|
1891
|
+
textColor: "#610202",
|
|
1892
|
+
icon: import_lucide_react4.AlertCircle,
|
|
1893
|
+
iconColor: "#c93232",
|
|
1894
|
+
closeHoverBg: "#ffe0e0"
|
|
1895
|
+
},
|
|
1896
|
+
warning: {
|
|
1897
|
+
backgroundColor: "#fffaf5",
|
|
1898
|
+
borderColor: "#e4720d",
|
|
1899
|
+
textColor: "#611f00",
|
|
1900
|
+
icon: import_lucide_react4.AlertTriangle,
|
|
1901
|
+
iconColor: "#e4720d",
|
|
1902
|
+
closeHoverBg: "#ffedd5"
|
|
1903
|
+
},
|
|
1904
|
+
success: {
|
|
1905
|
+
backgroundColor: "#f0faf3",
|
|
1906
|
+
borderColor: "#5ec171",
|
|
1907
|
+
textColor: "#024002",
|
|
1908
|
+
icon: import_lucide_react4.CheckCircle,
|
|
1909
|
+
iconColor: "#5ec171",
|
|
1910
|
+
closeHoverBg: "#d9f2df"
|
|
1911
|
+
},
|
|
1912
|
+
caution: {
|
|
1913
|
+
backgroundColor: "#fffdf5",
|
|
1914
|
+
borderColor: "#edae06",
|
|
1915
|
+
textColor: "#613f00",
|
|
1916
|
+
icon: import_lucide_react4.AlertOctagon,
|
|
1917
|
+
iconColor: "#edae06",
|
|
1918
|
+
closeHoverBg: "#fff8d5"
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
var Toast = React10.forwardRef(
|
|
1922
|
+
({
|
|
1923
|
+
variant,
|
|
1924
|
+
message,
|
|
1925
|
+
onClose,
|
|
1926
|
+
className,
|
|
1927
|
+
style,
|
|
1928
|
+
"data-testid": dataTestId
|
|
1929
|
+
}, ref) => {
|
|
1930
|
+
const [isCloseHovered, setIsCloseHovered] = React10.useState(false);
|
|
1931
|
+
const config = variantConfig[variant];
|
|
1932
|
+
const IconComponent = config.icon;
|
|
1933
|
+
const toastStyle = {
|
|
1934
|
+
...baseToastStyles,
|
|
1935
|
+
backgroundColor: config.backgroundColor,
|
|
1936
|
+
borderColor: config.borderColor,
|
|
1937
|
+
...style
|
|
1938
|
+
};
|
|
1939
|
+
const closeStyle = {
|
|
1940
|
+
...closeButtonStyles,
|
|
1941
|
+
...isCloseHovered && { backgroundColor: config.closeHoverBg }
|
|
1942
|
+
};
|
|
1943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1944
|
+
"div",
|
|
1945
|
+
{
|
|
1946
|
+
ref,
|
|
1947
|
+
className: (0, import_clsx10.clsx)("arbor-toast", `arbor-toast-${variant}`, className),
|
|
1948
|
+
style: toastStyle,
|
|
1949
|
+
"data-testid": dataTestId,
|
|
1950
|
+
role: "alert",
|
|
1951
|
+
"aria-live": "polite",
|
|
1952
|
+
children: [
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconComponent, { size: 16, color: config.iconColor, style: { flexShrink: 0 } }),
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { ...messageStyles, color: config.textColor }, children: message }),
|
|
1955
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1956
|
+
"button",
|
|
1957
|
+
{
|
|
1958
|
+
onClick: onClose,
|
|
1959
|
+
onMouseEnter: () => setIsCloseHovered(true),
|
|
1960
|
+
onMouseLeave: () => setIsCloseHovered(false),
|
|
1961
|
+
style: closeStyle,
|
|
1962
|
+
"aria-label": "Close notification",
|
|
1963
|
+
type: "button",
|
|
1964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: "18px", lineHeight: 1, color: "#595959", fontWeight: "bold" }, children: "\xD7" })
|
|
1965
|
+
}
|
|
1966
|
+
)
|
|
1967
|
+
]
|
|
1968
|
+
}
|
|
1969
|
+
);
|
|
1970
|
+
}
|
|
1971
|
+
);
|
|
1972
|
+
Toast.displayName = "Toast";
|
|
1973
|
+
|
|
1974
|
+
// src/Tooltip/Tooltip.tsx
|
|
1975
|
+
var React11 = __toESM(require("react"));
|
|
1976
|
+
var import_clsx11 = require("clsx");
|
|
1977
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1978
|
+
var tooltipStyles = {
|
|
1979
|
+
position: "absolute",
|
|
1980
|
+
bottom: "calc(100% + 8px)",
|
|
1981
|
+
left: "50%",
|
|
1982
|
+
transform: "translateX(-50%)",
|
|
1983
|
+
backgroundColor: "#2f2f2f",
|
|
1984
|
+
color: "#ffffff",
|
|
1985
|
+
padding: "12px",
|
|
1986
|
+
borderRadius: "8px",
|
|
1987
|
+
boxShadow: "0px 4px 12px 0px rgba(32, 32, 32, 0.08)",
|
|
1988
|
+
fontSize: "13px",
|
|
1989
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1990
|
+
fontWeight: 400,
|
|
1991
|
+
lineHeight: 1.5,
|
|
1992
|
+
whiteSpace: "nowrap",
|
|
1993
|
+
pointerEvents: "none",
|
|
1994
|
+
zIndex: 1e3,
|
|
1995
|
+
opacity: 0,
|
|
1996
|
+
transition: "opacity 0.2s ease-in-out"
|
|
1997
|
+
};
|
|
1998
|
+
var wrapperStyles4 = {
|
|
1999
|
+
position: "relative",
|
|
2000
|
+
display: "inline-block"
|
|
2001
|
+
};
|
|
2002
|
+
var Tooltip = React11.forwardRef(
|
|
2003
|
+
({
|
|
2004
|
+
content,
|
|
2005
|
+
children,
|
|
2006
|
+
className,
|
|
2007
|
+
style,
|
|
2008
|
+
"data-testid": dataTestId
|
|
2009
|
+
}, ref) => {
|
|
2010
|
+
const [isVisible, setIsVisible] = React11.useState(false);
|
|
2011
|
+
const visibleTooltipStyles = {
|
|
2012
|
+
...tooltipStyles,
|
|
2013
|
+
opacity: isVisible ? 1 : 0,
|
|
2014
|
+
...style
|
|
2015
|
+
};
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2017
|
+
"div",
|
|
2018
|
+
{
|
|
2019
|
+
ref,
|
|
2020
|
+
style: wrapperStyles4,
|
|
2021
|
+
onMouseEnter: () => setIsVisible(true),
|
|
2022
|
+
onMouseLeave: () => setIsVisible(false),
|
|
2023
|
+
"data-testid": dataTestId,
|
|
2024
|
+
children: [
|
|
2025
|
+
children,
|
|
2026
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2027
|
+
"div",
|
|
2028
|
+
{
|
|
2029
|
+
className: (0, import_clsx11.clsx)("arbor-tooltip", className),
|
|
2030
|
+
style: visibleTooltipStyles,
|
|
2031
|
+
role: "tooltip",
|
|
2032
|
+
"aria-hidden": !isVisible,
|
|
2033
|
+
children: content
|
|
2034
|
+
}
|
|
2035
|
+
)
|
|
2036
|
+
]
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
2039
|
+
}
|
|
2040
|
+
);
|
|
2041
|
+
Tooltip.displayName = "Tooltip";
|
|
2042
|
+
|
|
2043
|
+
// src/Toggle/Toggle.tsx
|
|
2044
|
+
var React12 = __toESM(require("react"));
|
|
2045
|
+
var import_clsx12 = require("clsx");
|
|
2046
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2047
|
+
var toggleContainerStyles = {
|
|
2048
|
+
width: "40px",
|
|
2049
|
+
height: "24px",
|
|
2050
|
+
borderRadius: "16px",
|
|
2051
|
+
border: "1px solid",
|
|
2052
|
+
position: "relative",
|
|
2053
|
+
cursor: "pointer",
|
|
2054
|
+
transition: "all 0.2s ease-in-out"
|
|
2055
|
+
};
|
|
2056
|
+
var knobStyles = {
|
|
2057
|
+
width: "18px",
|
|
2058
|
+
height: "18px",
|
|
2059
|
+
borderRadius: "50%",
|
|
2060
|
+
position: "absolute",
|
|
2061
|
+
top: "50%",
|
|
2062
|
+
transform: "translateY(-50%)",
|
|
2063
|
+
transition: "all 0.2s ease-in-out"
|
|
2064
|
+
};
|
|
2065
|
+
var labelStyles7 = {
|
|
2066
|
+
fontSize: "13px",
|
|
2067
|
+
color: "#2f2f2f",
|
|
2068
|
+
cursor: "pointer",
|
|
2069
|
+
userSelect: "none",
|
|
2070
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
2071
|
+
};
|
|
2072
|
+
var wrapperStyles5 = {
|
|
2073
|
+
display: "flex",
|
|
2074
|
+
alignItems: "center",
|
|
2075
|
+
gap: "8px"
|
|
2076
|
+
};
|
|
2077
|
+
var Toggle = React12.forwardRef(
|
|
2078
|
+
({
|
|
2079
|
+
label,
|
|
2080
|
+
checked = false,
|
|
2081
|
+
onChange,
|
|
2082
|
+
disabled = false,
|
|
2083
|
+
className,
|
|
2084
|
+
style,
|
|
2085
|
+
"data-testid": dataTestId,
|
|
2086
|
+
name,
|
|
2087
|
+
value
|
|
2088
|
+
}, ref) => {
|
|
2089
|
+
const [isFocused, setIsFocused] = React12.useState(false);
|
|
2090
|
+
const [isHovered, setIsHovered] = React12.useState(false);
|
|
2091
|
+
const [isActive, setIsActive] = React12.useState(false);
|
|
2092
|
+
const toggleId = React12.useId();
|
|
2093
|
+
const handleChange = (e) => {
|
|
2094
|
+
if (!disabled) {
|
|
2095
|
+
onChange?.(e.target.checked);
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
const getContainerStyles = () => {
|
|
2099
|
+
if (disabled) {
|
|
2100
|
+
return {
|
|
2101
|
+
...toggleContainerStyles,
|
|
2102
|
+
backgroundColor: checked ? "#d1d1d1" : "#ffffff",
|
|
2103
|
+
borderColor: checked ? "#d1d1d1" : "#d1d1d1",
|
|
2104
|
+
cursor: "not-allowed"
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
if (checked) {
|
|
2108
|
+
if (isActive && isFocused) {
|
|
2109
|
+
return {
|
|
2110
|
+
...toggleContainerStyles,
|
|
2111
|
+
backgroundColor: "#024002",
|
|
2112
|
+
borderColor: "#024002",
|
|
2113
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
if (isActive) {
|
|
2117
|
+
return {
|
|
2118
|
+
...toggleContainerStyles,
|
|
2119
|
+
backgroundColor: "#024002",
|
|
2120
|
+
borderColor: "#024002"
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2123
|
+
if (isHovered) {
|
|
2124
|
+
return {
|
|
2125
|
+
...toggleContainerStyles,
|
|
2126
|
+
backgroundColor: "#005700",
|
|
2127
|
+
borderColor: "#005700"
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
if (isFocused) {
|
|
2131
|
+
return {
|
|
2132
|
+
...toggleContainerStyles,
|
|
2133
|
+
backgroundColor: "#0b800b",
|
|
2134
|
+
borderColor: "#0b800b",
|
|
2135
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
return {
|
|
2139
|
+
...toggleContainerStyles,
|
|
2140
|
+
backgroundColor: "#0b800b",
|
|
2141
|
+
borderColor: "#0b800b"
|
|
2142
|
+
};
|
|
2143
|
+
} else {
|
|
2144
|
+
if (isActive && isFocused) {
|
|
2145
|
+
return {
|
|
2146
|
+
...toggleContainerStyles,
|
|
2147
|
+
backgroundColor: "#efefef",
|
|
2148
|
+
borderColor: "#2f2f2f",
|
|
2149
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
if (isActive) {
|
|
2153
|
+
return {
|
|
2154
|
+
...toggleContainerStyles,
|
|
2155
|
+
backgroundColor: "#efefef",
|
|
2156
|
+
borderColor: "#2f2f2f"
|
|
2157
|
+
};
|
|
2158
|
+
}
|
|
2159
|
+
if (isHovered) {
|
|
2160
|
+
return {
|
|
2161
|
+
...toggleContainerStyles,
|
|
2162
|
+
backgroundColor: "#f8f8f8",
|
|
2163
|
+
borderColor: "#595959"
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
if (isFocused) {
|
|
2167
|
+
return {
|
|
2168
|
+
...toggleContainerStyles,
|
|
2169
|
+
backgroundColor: "#ffffff",
|
|
2170
|
+
borderColor: "#7e7e7e",
|
|
2171
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2174
|
+
return {
|
|
2175
|
+
...toggleContainerStyles,
|
|
2176
|
+
backgroundColor: "#ffffff",
|
|
2177
|
+
borderColor: "#7e7e7e"
|
|
2178
|
+
};
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
const getKnobStyles = () => {
|
|
2182
|
+
const baseKnob = {
|
|
2183
|
+
...knobStyles,
|
|
2184
|
+
left: checked ? "18px" : "2px"
|
|
2185
|
+
};
|
|
2186
|
+
if (disabled) {
|
|
2187
|
+
return {
|
|
2188
|
+
...baseKnob,
|
|
2189
|
+
backgroundColor: checked ? "#f8f8f8" : "#d1d1d1"
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
if (checked) {
|
|
2193
|
+
if (isActive) {
|
|
2194
|
+
return {
|
|
2195
|
+
...baseKnob,
|
|
2196
|
+
backgroundColor: "#efefef"
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
if (isHovered) {
|
|
2200
|
+
return {
|
|
2201
|
+
...baseKnob,
|
|
2202
|
+
backgroundColor: "#f8f8f8"
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
2205
|
+
return {
|
|
2206
|
+
...baseKnob,
|
|
2207
|
+
backgroundColor: "#ffffff"
|
|
2208
|
+
};
|
|
2209
|
+
} else {
|
|
2210
|
+
if (isActive) {
|
|
2211
|
+
return {
|
|
2212
|
+
...baseKnob,
|
|
2213
|
+
backgroundColor: "#2f2f2f"
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
if (isHovered) {
|
|
2217
|
+
return {
|
|
2218
|
+
...baseKnob,
|
|
2219
|
+
backgroundColor: "#595959"
|
|
2220
|
+
};
|
|
2221
|
+
}
|
|
2222
|
+
return {
|
|
2223
|
+
...baseKnob,
|
|
2224
|
+
backgroundColor: "#7e7e7e"
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2229
|
+
"div",
|
|
2230
|
+
{
|
|
2231
|
+
className: (0, import_clsx12.clsx)("arbor-toggle-wrapper", className),
|
|
2232
|
+
style: { ...wrapperStyles5, ...style },
|
|
2233
|
+
"data-testid": dataTestId,
|
|
2234
|
+
children: [
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2236
|
+
"input",
|
|
2237
|
+
{
|
|
2238
|
+
ref,
|
|
2239
|
+
id: toggleId,
|
|
2240
|
+
type: "checkbox",
|
|
2241
|
+
checked,
|
|
2242
|
+
onChange: handleChange,
|
|
2243
|
+
onFocus: () => setIsFocused(true),
|
|
2244
|
+
onBlur: () => setIsFocused(false),
|
|
2245
|
+
disabled,
|
|
2246
|
+
name,
|
|
2247
|
+
value,
|
|
2248
|
+
style: {
|
|
2249
|
+
position: "absolute",
|
|
2250
|
+
opacity: 0,
|
|
2251
|
+
width: 0,
|
|
2252
|
+
height: 0
|
|
2253
|
+
},
|
|
2254
|
+
"aria-checked": checked
|
|
2255
|
+
}
|
|
2256
|
+
),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2258
|
+
"label",
|
|
2259
|
+
{
|
|
2260
|
+
htmlFor: toggleId,
|
|
2261
|
+
onMouseEnter: () => !disabled && setIsHovered(true),
|
|
2262
|
+
onMouseLeave: () => !disabled && setIsHovered(false),
|
|
2263
|
+
onMouseDown: () => !disabled && setIsActive(true),
|
|
2264
|
+
onMouseUp: () => !disabled && setIsActive(false),
|
|
2265
|
+
style: {
|
|
2266
|
+
display: "flex",
|
|
2267
|
+
alignItems: "center",
|
|
2268
|
+
gap: "8px",
|
|
2269
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
2270
|
+
},
|
|
2271
|
+
children: [
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: getContainerStyles(), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: getKnobStyles() }) }),
|
|
2273
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2274
|
+
"span",
|
|
2275
|
+
{
|
|
2276
|
+
style: {
|
|
2277
|
+
...labelStyles7,
|
|
2278
|
+
color: disabled ? "#7e7e7e" : "#2f2f2f",
|
|
2279
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
2280
|
+
},
|
|
2281
|
+
children: label
|
|
2282
|
+
}
|
|
2283
|
+
)
|
|
2284
|
+
]
|
|
2285
|
+
}
|
|
2286
|
+
)
|
|
2287
|
+
]
|
|
2288
|
+
}
|
|
2289
|
+
);
|
|
2290
|
+
}
|
|
2291
|
+
);
|
|
2292
|
+
Toggle.displayName = "Toggle";
|
|
2293
|
+
|
|
2294
|
+
// src/TextArea/TextArea.tsx
|
|
2295
|
+
var React13 = __toESM(require("react"));
|
|
2296
|
+
var import_clsx13 = require("clsx");
|
|
2297
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2298
|
+
var labelStyles8 = {
|
|
2299
|
+
fontSize: "13px",
|
|
2300
|
+
fontWeight: 600,
|
|
2301
|
+
color: "#2f2f2f",
|
|
2302
|
+
marginBottom: "0px",
|
|
2303
|
+
display: "block",
|
|
2304
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
2305
|
+
};
|
|
2306
|
+
var textareaWrapperStyles = {
|
|
2307
|
+
position: "relative",
|
|
2308
|
+
width: "100%"
|
|
2309
|
+
};
|
|
2310
|
+
var textareaStyles = {
|
|
2311
|
+
width: "100%",
|
|
2312
|
+
minHeight: "72px",
|
|
2313
|
+
padding: "8px",
|
|
2314
|
+
fontSize: "13px",
|
|
2315
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
2316
|
+
border: "1px solid",
|
|
2317
|
+
borderRadius: "8px",
|
|
2318
|
+
outline: "none",
|
|
2319
|
+
resize: "vertical",
|
|
2320
|
+
transition: "all 0.2s ease-in-out",
|
|
2321
|
+
lineHeight: "1.5"
|
|
2322
|
+
};
|
|
2323
|
+
var helperTextStyles5 = {
|
|
2324
|
+
fontSize: "13px",
|
|
2325
|
+
marginTop: "4px",
|
|
2326
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
2327
|
+
};
|
|
2328
|
+
var TextArea = React13.forwardRef(
|
|
2329
|
+
({
|
|
2330
|
+
label,
|
|
2331
|
+
placeholder,
|
|
2332
|
+
value,
|
|
2333
|
+
onChange,
|
|
2334
|
+
state = "default",
|
|
2335
|
+
error,
|
|
2336
|
+
helperText,
|
|
2337
|
+
disabled = false,
|
|
2338
|
+
rows = 3,
|
|
2339
|
+
className,
|
|
2340
|
+
style,
|
|
2341
|
+
"data-testid": dataTestId,
|
|
2342
|
+
name
|
|
2343
|
+
}, ref) => {
|
|
2344
|
+
const [isFocused, setIsFocused] = React13.useState(false);
|
|
2345
|
+
const [isHovered, setIsHovered] = React13.useState(false);
|
|
2346
|
+
const textareaId = React13.useId();
|
|
2347
|
+
const actualState = error ? "error" : state;
|
|
2348
|
+
const getBorderColor = () => {
|
|
2349
|
+
if (disabled) {
|
|
2350
|
+
return "#dfdfdf";
|
|
2351
|
+
}
|
|
2352
|
+
if (actualState === "error") {
|
|
2353
|
+
return "#c93232";
|
|
2354
|
+
}
|
|
2355
|
+
if (actualState === "success") {
|
|
2356
|
+
return "#0e8a0e";
|
|
2357
|
+
}
|
|
2358
|
+
if (isFocused) {
|
|
2359
|
+
return "#0e8a0e";
|
|
2360
|
+
}
|
|
2361
|
+
if (isHovered) {
|
|
2362
|
+
return "#7e7e7e";
|
|
2363
|
+
}
|
|
2364
|
+
return "#dfdfdf";
|
|
2365
|
+
};
|
|
2366
|
+
const getBackgroundColor = () => {
|
|
2367
|
+
if (disabled) {
|
|
2368
|
+
return "#efefef";
|
|
2369
|
+
}
|
|
2370
|
+
return "#ffffff";
|
|
2371
|
+
};
|
|
2372
|
+
const getBoxShadow = () => {
|
|
2373
|
+
if (isFocused && !disabled) {
|
|
2374
|
+
if (actualState === "error") {
|
|
2375
|
+
return "0px 0px 0px 3px rgba(201, 50, 50, 0.2)";
|
|
2376
|
+
}
|
|
2377
|
+
return "0px 0px 0px 3px #3cad51";
|
|
2378
|
+
}
|
|
2379
|
+
return void 0;
|
|
2380
|
+
};
|
|
2381
|
+
const textareaStylesCombined = {
|
|
2382
|
+
...textareaStyles,
|
|
2383
|
+
borderColor: getBorderColor(),
|
|
2384
|
+
backgroundColor: getBackgroundColor(),
|
|
2385
|
+
boxShadow: getBoxShadow(),
|
|
2386
|
+
color: disabled ? "#7e7e7e" : "#2f2f2f",
|
|
2387
|
+
cursor: disabled ? "not-allowed" : "text"
|
|
2388
|
+
};
|
|
2389
|
+
const helperColor = error ? "#c93232" : actualState === "success" ? "#0e8a0e" : "#595959";
|
|
2390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2391
|
+
"div",
|
|
2392
|
+
{
|
|
2393
|
+
className: (0, import_clsx13.clsx)("arbor-textarea-wrapper", className),
|
|
2394
|
+
style,
|
|
2395
|
+
"data-testid": dataTestId,
|
|
2396
|
+
children: [
|
|
2397
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: textareaId, style: labelStyles8, children: label }),
|
|
2398
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { height: "8px" } }),
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: textareaWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2400
|
+
"textarea",
|
|
2401
|
+
{
|
|
2402
|
+
ref,
|
|
2403
|
+
id: textareaId,
|
|
2404
|
+
name,
|
|
2405
|
+
placeholder,
|
|
2406
|
+
value,
|
|
2407
|
+
onChange,
|
|
2408
|
+
disabled,
|
|
2409
|
+
rows,
|
|
2410
|
+
onFocus: () => setIsFocused(true),
|
|
2411
|
+
onBlur: () => setIsFocused(false),
|
|
2412
|
+
onMouseEnter: () => setIsHovered(true),
|
|
2413
|
+
onMouseLeave: () => setIsHovered(false),
|
|
2414
|
+
style: textareaStylesCombined
|
|
2415
|
+
}
|
|
2416
|
+
) }),
|
|
2417
|
+
(error || helperText) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { ...helperTextStyles5, color: helperColor }, role: error ? "alert" : void 0, children: error || helperText })
|
|
2418
|
+
]
|
|
2419
|
+
}
|
|
2420
|
+
);
|
|
2421
|
+
}
|
|
2422
|
+
);
|
|
2423
|
+
TextArea.displayName = "TextArea";
|
|
2424
|
+
|
|
2425
|
+
// src/Tabs/Tabs.tsx
|
|
2426
|
+
var React14 = __toESM(require("react"));
|
|
2427
|
+
var import_clsx14 = require("clsx");
|
|
2428
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2429
|
+
var tabsContainerStyles = {
|
|
2430
|
+
display: "flex",
|
|
2431
|
+
alignItems: "flex-start",
|
|
2432
|
+
gap: "12px",
|
|
2433
|
+
borderBottom: "1px solid #f8f8f8",
|
|
2434
|
+
paddingBottom: "1px",
|
|
2435
|
+
width: "100%"
|
|
2436
|
+
};
|
|
2437
|
+
var tabItemWrapperStyles = {
|
|
2438
|
+
display: "flex",
|
|
2439
|
+
flexDirection: "column",
|
|
2440
|
+
alignItems: "center",
|
|
2441
|
+
cursor: "pointer",
|
|
2442
|
+
position: "relative"
|
|
2443
|
+
};
|
|
2444
|
+
var tabItemStyles = {
|
|
2445
|
+
display: "flex",
|
|
2446
|
+
alignItems: "center",
|
|
2447
|
+
justifyContent: "center",
|
|
2448
|
+
gap: "8px",
|
|
2449
|
+
padding: "8px 12px",
|
|
2450
|
+
borderRadius: "8px",
|
|
2451
|
+
fontSize: "14px",
|
|
2452
|
+
lineHeight: "1.5",
|
|
2453
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
2454
|
+
outline: "none",
|
|
2455
|
+
transition: "all 0.2s ease-in-out",
|
|
2456
|
+
userSelect: "none"
|
|
2457
|
+
};
|
|
2458
|
+
var underlineStyles = {
|
|
2459
|
+
width: "100%",
|
|
2460
|
+
height: "2px",
|
|
2461
|
+
borderTopLeftRadius: "4px",
|
|
2462
|
+
borderTopRightRadius: "4px",
|
|
2463
|
+
transition: "background-color 0.2s ease-in-out"
|
|
2464
|
+
};
|
|
2465
|
+
var Tabs = React14.forwardRef(
|
|
2466
|
+
({
|
|
2467
|
+
tabs,
|
|
2468
|
+
activeTab,
|
|
2469
|
+
onTabChange,
|
|
2470
|
+
className,
|
|
2471
|
+
style,
|
|
2472
|
+
"data-testid": dataTestId
|
|
2473
|
+
}, ref) => {
|
|
2474
|
+
const [hoveredTab, setHoveredTab] = React14.useState(null);
|
|
2475
|
+
const [focusedTab, setFocusedTab] = React14.useState(null);
|
|
2476
|
+
const currentActiveTab = activeTab || (tabs.length > 0 ? tabs[0].value : "");
|
|
2477
|
+
const handleTabClick = (value) => {
|
|
2478
|
+
onTabChange?.(value);
|
|
2479
|
+
};
|
|
2480
|
+
const handleKeyDown = (e, value) => {
|
|
2481
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2482
|
+
e.preventDefault();
|
|
2483
|
+
handleTabClick(value);
|
|
2484
|
+
}
|
|
2485
|
+
};
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2487
|
+
"div",
|
|
2488
|
+
{
|
|
2489
|
+
ref,
|
|
2490
|
+
className: (0, import_clsx14.clsx)("arbor-tabs", className),
|
|
2491
|
+
style: { ...tabsContainerStyles, ...style },
|
|
2492
|
+
"data-testid": dataTestId,
|
|
2493
|
+
role: "tablist",
|
|
2494
|
+
children: tabs.map((tab) => {
|
|
2495
|
+
const isActive = tab.value === currentActiveTab;
|
|
2496
|
+
const isHovered = tab.value === hoveredTab;
|
|
2497
|
+
const isFocused = tab.value === focusedTab;
|
|
2498
|
+
const getTextColor = () => {
|
|
2499
|
+
if (isActive) {
|
|
2500
|
+
return "#0e8a0e";
|
|
2501
|
+
}
|
|
2502
|
+
if (isHovered) {
|
|
2503
|
+
return "#202020";
|
|
2504
|
+
}
|
|
2505
|
+
return "#2f2f2f";
|
|
2506
|
+
};
|
|
2507
|
+
const getFontWeight = () => {
|
|
2508
|
+
return isActive ? 600 : 500;
|
|
2509
|
+
};
|
|
2510
|
+
const getUnderlineColor = () => {
|
|
2511
|
+
if (isActive) {
|
|
2512
|
+
return "#0e8a0e";
|
|
2513
|
+
}
|
|
2514
|
+
if (isHovered) {
|
|
2515
|
+
return "#d1d1d1";
|
|
2516
|
+
}
|
|
2517
|
+
return "transparent";
|
|
2518
|
+
};
|
|
2519
|
+
const getBoxShadow = () => {
|
|
2520
|
+
if (isFocused) {
|
|
2521
|
+
return "0px 0px 0px 3px #3cad51";
|
|
2522
|
+
}
|
|
2523
|
+
return void 0;
|
|
2524
|
+
};
|
|
2525
|
+
const tabItemStylesCombined = {
|
|
2526
|
+
...tabItemStyles,
|
|
2527
|
+
color: getTextColor(),
|
|
2528
|
+
fontWeight: getFontWeight(),
|
|
2529
|
+
boxShadow: getBoxShadow(),
|
|
2530
|
+
backgroundColor: isFocused ? "rgba(255, 255, 255, 0.01)" : "transparent"
|
|
2531
|
+
};
|
|
2532
|
+
const underlineStylesCombined = {
|
|
2533
|
+
...underlineStyles,
|
|
2534
|
+
backgroundColor: getUnderlineColor()
|
|
2535
|
+
};
|
|
2536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2537
|
+
"div",
|
|
2538
|
+
{
|
|
2539
|
+
style: tabItemWrapperStyles,
|
|
2540
|
+
onMouseEnter: () => setHoveredTab(tab.value),
|
|
2541
|
+
onMouseLeave: () => setHoveredTab(null),
|
|
2542
|
+
children: [
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2544
|
+
"div",
|
|
2545
|
+
{
|
|
2546
|
+
role: "tab",
|
|
2547
|
+
"aria-selected": isActive,
|
|
2548
|
+
tabIndex: isActive ? 0 : -1,
|
|
2549
|
+
onClick: () => handleTabClick(tab.value),
|
|
2550
|
+
onKeyDown: (e) => handleKeyDown(e, tab.value),
|
|
2551
|
+
onFocus: () => setFocusedTab(tab.value),
|
|
2552
|
+
onBlur: () => setFocusedTab(null),
|
|
2553
|
+
style: tabItemStylesCombined,
|
|
2554
|
+
children: [
|
|
2555
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { display: "flex", alignItems: "center" }, children: tab.icon }),
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: tab.label })
|
|
2557
|
+
]
|
|
2558
|
+
}
|
|
2559
|
+
),
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: underlineStylesCombined })
|
|
2561
|
+
]
|
|
2562
|
+
},
|
|
2563
|
+
tab.value
|
|
2564
|
+
);
|
|
2565
|
+
})
|
|
2566
|
+
}
|
|
2567
|
+
);
|
|
2568
|
+
}
|
|
2569
|
+
);
|
|
2570
|
+
Tabs.displayName = "Tabs";
|
|
2571
|
+
|
|
2572
|
+
// src/Banner/Banner.tsx
|
|
2573
|
+
var React15 = __toESM(require("react"));
|
|
2574
|
+
var import_clsx15 = require("clsx");
|
|
2575
|
+
var import_lucide_react5 = require("lucide-react");
|
|
2576
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2577
|
+
var containerStyles2 = {
|
|
2578
|
+
display: "flex",
|
|
2579
|
+
alignItems: "flex-start",
|
|
2580
|
+
padding: "16px",
|
|
2581
|
+
borderRadius: "8px",
|
|
2582
|
+
border: "1px solid",
|
|
2583
|
+
width: "100%",
|
|
2584
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
2585
|
+
};
|
|
2586
|
+
var iconContainerStyles = {
|
|
2587
|
+
flexShrink: 0,
|
|
2588
|
+
width: "24px",
|
|
2589
|
+
height: "24px",
|
|
2590
|
+
display: "flex",
|
|
2591
|
+
alignItems: "center",
|
|
2592
|
+
justifyContent: "center"
|
|
2593
|
+
};
|
|
2594
|
+
var contentContainerStyles = {
|
|
2595
|
+
flex: 1,
|
|
2596
|
+
display: "flex",
|
|
2597
|
+
flexDirection: "column",
|
|
2598
|
+
minWidth: 0
|
|
2599
|
+
};
|
|
2600
|
+
var titleStyles = {
|
|
2601
|
+
fontSize: "18px",
|
|
2602
|
+
fontWeight: 600,
|
|
2603
|
+
lineHeight: "1.25",
|
|
2604
|
+
marginBottom: "8px"
|
|
2605
|
+
};
|
|
2606
|
+
var messageStyles2 = {
|
|
2607
|
+
fontSize: "13px",
|
|
2608
|
+
fontWeight: 400,
|
|
2609
|
+
lineHeight: "1.5",
|
|
2610
|
+
margin: 0
|
|
2611
|
+
};
|
|
2612
|
+
var actionContainerStyles = {
|
|
2613
|
+
display: "flex",
|
|
2614
|
+
flexDirection: "column",
|
|
2615
|
+
justifyContent: "flex-end",
|
|
2616
|
+
alignItems: "flex-end",
|
|
2617
|
+
alignSelf: "stretch",
|
|
2618
|
+
flexShrink: 0
|
|
2619
|
+
};
|
|
2620
|
+
var actionButtonStyles = {
|
|
2621
|
+
background: "none",
|
|
2622
|
+
border: "none",
|
|
2623
|
+
padding: 0,
|
|
2624
|
+
fontSize: "13px",
|
|
2625
|
+
fontWeight: 600,
|
|
2626
|
+
lineHeight: "1.5",
|
|
2627
|
+
textDecoration: "underline",
|
|
2628
|
+
textUnderlinePosition: "from-font",
|
|
2629
|
+
cursor: "pointer",
|
|
2630
|
+
fontFamily: "inherit"
|
|
2631
|
+
};
|
|
2632
|
+
var closeButtonStyles2 = {
|
|
2633
|
+
background: "none",
|
|
2634
|
+
border: "none",
|
|
2635
|
+
padding: "4px",
|
|
2636
|
+
cursor: "pointer",
|
|
2637
|
+
display: "flex",
|
|
2638
|
+
alignItems: "center",
|
|
2639
|
+
justifyContent: "center",
|
|
2640
|
+
flexShrink: 0,
|
|
2641
|
+
marginLeft: "8px"
|
|
2642
|
+
};
|
|
2643
|
+
var variantConfig2 = {
|
|
2644
|
+
warning: {
|
|
2645
|
+
backgroundColor: "#fffaf5",
|
|
2646
|
+
borderColor: "#e4720d",
|
|
2647
|
+
textColor: "#611f00",
|
|
2648
|
+
actionColor: "#a74102",
|
|
2649
|
+
icon: import_lucide_react5.AlertTriangle
|
|
2650
|
+
},
|
|
2651
|
+
destructive: {
|
|
2652
|
+
backgroundColor: "#fff5f5",
|
|
2653
|
+
borderColor: "#c93232",
|
|
2654
|
+
textColor: "#610202",
|
|
2655
|
+
actionColor: "#920a0a",
|
|
2656
|
+
icon: import_lucide_react5.AlertCircle
|
|
2657
|
+
},
|
|
2658
|
+
information: {
|
|
2659
|
+
backgroundColor: "#f5fbff",
|
|
2660
|
+
borderColor: "#2c8bca",
|
|
2661
|
+
textColor: "#053a61",
|
|
2662
|
+
actionColor: "#024f83",
|
|
2663
|
+
icon: import_lucide_react5.Info
|
|
2664
|
+
},
|
|
2665
|
+
neutral: {
|
|
2666
|
+
backgroundColor: "transparent",
|
|
2667
|
+
borderColor: "#b3b3b3",
|
|
2668
|
+
textColor: "#2f2f2f",
|
|
2669
|
+
actionColor: "#2f2f2f",
|
|
2670
|
+
icon: import_lucide_react5.Info
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
var Banner = React15.forwardRef(
|
|
2674
|
+
({
|
|
2675
|
+
variant = "information",
|
|
2676
|
+
title,
|
|
2677
|
+
message,
|
|
2678
|
+
icon = true,
|
|
2679
|
+
actionLabel,
|
|
2680
|
+
onAction,
|
|
2681
|
+
onClose,
|
|
2682
|
+
className,
|
|
2683
|
+
style,
|
|
2684
|
+
"data-testid": dataTestId
|
|
2685
|
+
}, ref) => {
|
|
2686
|
+
const config = variantConfig2[variant];
|
|
2687
|
+
const DefaultIcon = config.icon;
|
|
2688
|
+
const showIcon = icon !== false;
|
|
2689
|
+
const iconElement = icon === true || icon === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DefaultIcon, { size: 20, strokeWidth: 2 }) : icon;
|
|
2690
|
+
const containerStylesCombined = {
|
|
2691
|
+
...containerStyles2,
|
|
2692
|
+
backgroundColor: config.backgroundColor,
|
|
2693
|
+
borderColor: config.borderColor,
|
|
2694
|
+
color: config.textColor,
|
|
2695
|
+
gap: showIcon ? "16px" : "0px",
|
|
2696
|
+
...style
|
|
2697
|
+
};
|
|
2698
|
+
const titleStylesCombined = {
|
|
2699
|
+
...titleStyles,
|
|
2700
|
+
color: config.textColor
|
|
2701
|
+
};
|
|
2702
|
+
const messageStylesCombined = {
|
|
2703
|
+
...messageStyles2,
|
|
2704
|
+
color: config.textColor
|
|
2705
|
+
};
|
|
2706
|
+
const actionButtonStylesCombined = {
|
|
2707
|
+
...actionButtonStyles,
|
|
2708
|
+
color: config.actionColor
|
|
2709
|
+
};
|
|
2710
|
+
const closeButtonStylesCombined = {
|
|
2711
|
+
...closeButtonStyles2,
|
|
2712
|
+
color: config.textColor
|
|
2713
|
+
};
|
|
2714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2715
|
+
"div",
|
|
2716
|
+
{
|
|
2717
|
+
ref,
|
|
2718
|
+
className: (0, import_clsx15.clsx)("arbor-banner", `arbor-banner--${variant}`, className),
|
|
2719
|
+
style: containerStylesCombined,
|
|
2720
|
+
"data-testid": dataTestId,
|
|
2721
|
+
role: "alert",
|
|
2722
|
+
children: [
|
|
2723
|
+
showIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { ...iconContainerStyles, color: config.textColor }, children: iconElement }),
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: contentContainerStyles, children: [
|
|
2725
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: titleStylesCombined, children: title }),
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { style: messageStylesCombined, children: message })
|
|
2727
|
+
] }),
|
|
2728
|
+
actionLabel && onAction && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: actionContainerStyles, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2729
|
+
"button",
|
|
2730
|
+
{
|
|
2731
|
+
type: "button",
|
|
2732
|
+
onClick: onAction,
|
|
2733
|
+
style: actionButtonStylesCombined,
|
|
2734
|
+
children: actionLabel
|
|
2735
|
+
}
|
|
2736
|
+
) }),
|
|
2737
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2738
|
+
"button",
|
|
2739
|
+
{
|
|
2740
|
+
type: "button",
|
|
2741
|
+
onClick: onClose,
|
|
2742
|
+
style: closeButtonStylesCombined,
|
|
2743
|
+
"aria-label": "Close banner",
|
|
2744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.X, { size: 20 })
|
|
2745
|
+
}
|
|
2746
|
+
)
|
|
2747
|
+
]
|
|
2748
|
+
}
|
|
2749
|
+
);
|
|
2750
|
+
}
|
|
2751
|
+
);
|
|
2752
|
+
Banner.displayName = "Banner";
|
|
2753
|
+
|
|
2754
|
+
// src/Pagination/Pagination.tsx
|
|
2755
|
+
var React16 = __toESM(require("react"));
|
|
2756
|
+
var import_clsx16 = require("clsx");
|
|
2757
|
+
var import_lucide_react6 = require("lucide-react");
|
|
2758
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2759
|
+
var containerStyles3 = {
|
|
2760
|
+
display: "flex",
|
|
2761
|
+
alignItems: "center",
|
|
2762
|
+
gap: "8px",
|
|
2763
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
2764
|
+
};
|
|
2765
|
+
var buttonStyles3 = {
|
|
2766
|
+
width: "24px",
|
|
2767
|
+
height: "24px",
|
|
2768
|
+
borderRadius: "50%",
|
|
2769
|
+
border: "none",
|
|
2770
|
+
background: "transparent",
|
|
2771
|
+
cursor: "pointer",
|
|
2772
|
+
display: "flex",
|
|
2773
|
+
alignItems: "center",
|
|
2774
|
+
justifyContent: "center",
|
|
2775
|
+
padding: 0,
|
|
2776
|
+
transition: "background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out",
|
|
2777
|
+
flexShrink: 0,
|
|
2778
|
+
WebkitTapHighlightColor: "transparent",
|
|
2779
|
+
outline: "none"
|
|
2780
|
+
};
|
|
2781
|
+
var buttonDisabledStyles = {
|
|
2782
|
+
cursor: "not-allowed",
|
|
2783
|
+
opacity: 0.5
|
|
2784
|
+
};
|
|
2785
|
+
var labelStyles9 = {
|
|
2786
|
+
fontSize: "13px",
|
|
2787
|
+
fontWeight: 600,
|
|
2788
|
+
lineHeight: "1.5",
|
|
2789
|
+
color: "#2f2f2f"
|
|
2790
|
+
};
|
|
2791
|
+
var inputWrapperStyles = {
|
|
2792
|
+
display: "flex",
|
|
2793
|
+
alignItems: "center",
|
|
2794
|
+
gap: "8px"
|
|
2795
|
+
};
|
|
2796
|
+
var inputStyles4 = {
|
|
2797
|
+
width: "60px",
|
|
2798
|
+
paddingTop: "12px",
|
|
2799
|
+
paddingBottom: "12px",
|
|
2800
|
+
paddingLeft: "16px",
|
|
2801
|
+
paddingRight: "16px",
|
|
2802
|
+
fontSize: "13px",
|
|
2803
|
+
fontWeight: 400,
|
|
2804
|
+
lineHeight: "1.5",
|
|
2805
|
+
color: "#2f2f2f",
|
|
2806
|
+
backgroundColor: "white",
|
|
2807
|
+
border: "1px solid #dfdfdf",
|
|
2808
|
+
borderRadius: "8px",
|
|
2809
|
+
fontFamily: "inherit",
|
|
2810
|
+
textAlign: "center",
|
|
2811
|
+
outline: "none"
|
|
2812
|
+
};
|
|
2813
|
+
var inputFocusStyles = {
|
|
2814
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
2815
|
+
};
|
|
2816
|
+
var textStyles = {
|
|
2817
|
+
fontSize: "13px",
|
|
2818
|
+
fontWeight: 400,
|
|
2819
|
+
lineHeight: "1.5",
|
|
2820
|
+
color: "#2f2f2f"
|
|
2821
|
+
};
|
|
2822
|
+
var Pagination = React16.forwardRef(
|
|
2823
|
+
({
|
|
2824
|
+
currentPage,
|
|
2825
|
+
totalPages,
|
|
2826
|
+
onPageChange,
|
|
2827
|
+
className,
|
|
2828
|
+
style,
|
|
2829
|
+
"data-testid": dataTestId
|
|
2830
|
+
}, ref) => {
|
|
2831
|
+
const [inputValue, setInputValue] = React16.useState(currentPage.toString());
|
|
2832
|
+
const [focusedButton, setFocusedButton] = React16.useState(null);
|
|
2833
|
+
const [hoveredButton, setHoveredButton] = React16.useState(null);
|
|
2834
|
+
const [activeButton, setActiveButton] = React16.useState(null);
|
|
2835
|
+
const [inputFocused, setInputFocused] = React16.useState(false);
|
|
2836
|
+
React16.useEffect(() => {
|
|
2837
|
+
setInputValue(currentPage.toString());
|
|
2838
|
+
}, [currentPage]);
|
|
2839
|
+
const handleFirstPage = () => {
|
|
2840
|
+
if (currentPage !== 1) {
|
|
2841
|
+
onPageChange(1);
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2844
|
+
const handlePreviousPage = () => {
|
|
2845
|
+
if (currentPage > 1) {
|
|
2846
|
+
onPageChange(currentPage - 1);
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
const handleNextPage = () => {
|
|
2850
|
+
if (currentPage < totalPages) {
|
|
2851
|
+
onPageChange(currentPage + 1);
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
const handleLastPage = () => {
|
|
2855
|
+
if (currentPage !== totalPages) {
|
|
2856
|
+
onPageChange(totalPages);
|
|
2857
|
+
}
|
|
2858
|
+
};
|
|
2859
|
+
const handleInputChange = (e) => {
|
|
2860
|
+
const value = e.target.value;
|
|
2861
|
+
if (value === "" || /^\d+$/.test(value)) {
|
|
2862
|
+
setInputValue(value);
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
const handleInputBlur = () => {
|
|
2866
|
+
setInputFocused(false);
|
|
2867
|
+
const pageNumber = parseInt(inputValue, 10);
|
|
2868
|
+
if (isNaN(pageNumber) || pageNumber < 1) {
|
|
2869
|
+
setInputValue(currentPage.toString());
|
|
2870
|
+
} else if (pageNumber > totalPages) {
|
|
2871
|
+
setInputValue(totalPages.toString());
|
|
2872
|
+
onPageChange(totalPages);
|
|
2873
|
+
} else if (pageNumber !== currentPage) {
|
|
2874
|
+
onPageChange(pageNumber);
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2877
|
+
const handleInputKeyDown = (e) => {
|
|
2878
|
+
if (e.key === "Enter") {
|
|
2879
|
+
handleInputBlur();
|
|
2880
|
+
e.target.blur();
|
|
2881
|
+
}
|
|
2882
|
+
};
|
|
2883
|
+
const getButtonStyle = (buttonName, disabled) => {
|
|
2884
|
+
if (disabled) {
|
|
2885
|
+
return { ...buttonStyles3, ...buttonDisabledStyles };
|
|
2886
|
+
}
|
|
2887
|
+
const isHovered = hoveredButton === buttonName;
|
|
2888
|
+
const isFocused = focusedButton === buttonName;
|
|
2889
|
+
const isActive = activeButton === buttonName;
|
|
2890
|
+
const style2 = {
|
|
2891
|
+
...buttonStyles3
|
|
2892
|
+
};
|
|
2893
|
+
if (isHovered && !isFocused && !isActive) {
|
|
2894
|
+
style2.backgroundColor = "#efefef";
|
|
2895
|
+
}
|
|
2896
|
+
if (isActive && !isFocused) {
|
|
2897
|
+
style2.backgroundColor = "transparent";
|
|
2898
|
+
}
|
|
2899
|
+
if (isFocused) {
|
|
2900
|
+
style2.boxShadow = "0px 0px 0px 3px #3cad51";
|
|
2901
|
+
style2.backgroundColor = "rgba(255, 255, 255, 0.01)";
|
|
2902
|
+
}
|
|
2903
|
+
return style2;
|
|
2904
|
+
};
|
|
2905
|
+
const isFirstDisabled = currentPage === 1;
|
|
2906
|
+
const isPreviousDisabled = currentPage === 1;
|
|
2907
|
+
const isNextDisabled = currentPage === totalPages;
|
|
2908
|
+
const isLastDisabled = currentPage === totalPages;
|
|
2909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2910
|
+
"div",
|
|
2911
|
+
{
|
|
2912
|
+
ref,
|
|
2913
|
+
className: (0, import_clsx16.clsx)("arbor-pagination", className),
|
|
2914
|
+
style: { ...containerStyles3, ...style },
|
|
2915
|
+
"data-testid": dataTestId,
|
|
2916
|
+
children: [
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2918
|
+
"button",
|
|
2919
|
+
{
|
|
2920
|
+
type: "button",
|
|
2921
|
+
onClick: handleFirstPage,
|
|
2922
|
+
disabled: isFirstDisabled,
|
|
2923
|
+
onMouseEnter: () => setHoveredButton("first"),
|
|
2924
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
2925
|
+
onMouseDown: () => setActiveButton("first"),
|
|
2926
|
+
onMouseUp: () => setActiveButton(null),
|
|
2927
|
+
onFocus: () => setFocusedButton("first"),
|
|
2928
|
+
onBlur: () => setFocusedButton(null),
|
|
2929
|
+
style: getButtonStyle("first", isFirstDisabled),
|
|
2930
|
+
"aria-label": "Go to first page",
|
|
2931
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ChevronsLeft, { size: 16, color: "#2f2f2f" })
|
|
2932
|
+
}
|
|
2933
|
+
),
|
|
2934
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2935
|
+
"button",
|
|
2936
|
+
{
|
|
2937
|
+
type: "button",
|
|
2938
|
+
onClick: handlePreviousPage,
|
|
2939
|
+
disabled: isPreviousDisabled,
|
|
2940
|
+
onMouseEnter: () => setHoveredButton("previous"),
|
|
2941
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
2942
|
+
onMouseDown: () => setActiveButton("previous"),
|
|
2943
|
+
onMouseUp: () => setActiveButton(null),
|
|
2944
|
+
onFocus: () => setFocusedButton("previous"),
|
|
2945
|
+
onBlur: () => setFocusedButton(null),
|
|
2946
|
+
style: getButtonStyle("previous", isPreviousDisabled),
|
|
2947
|
+
"aria-label": "Go to previous page",
|
|
2948
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ChevronLeft, { size: 16, color: "#2f2f2f" })
|
|
2949
|
+
}
|
|
2950
|
+
),
|
|
2951
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: inputWrapperStyles, children: [
|
|
2952
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: labelStyles9, children: "Page" }),
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2954
|
+
"input",
|
|
2955
|
+
{
|
|
2956
|
+
type: "text",
|
|
2957
|
+
value: inputValue,
|
|
2958
|
+
onChange: handleInputChange,
|
|
2959
|
+
onBlur: handleInputBlur,
|
|
2960
|
+
onFocus: () => setInputFocused(true),
|
|
2961
|
+
onKeyDown: handleInputKeyDown,
|
|
2962
|
+
style: {
|
|
2963
|
+
...inputStyles4,
|
|
2964
|
+
...inputFocused && inputFocusStyles
|
|
2965
|
+
},
|
|
2966
|
+
"aria-label": `Page ${currentPage} of ${totalPages}`
|
|
2967
|
+
}
|
|
2968
|
+
),
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: textStyles, children: [
|
|
2970
|
+
"of ",
|
|
2971
|
+
totalPages
|
|
2972
|
+
] })
|
|
2973
|
+
] }),
|
|
2974
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2975
|
+
"button",
|
|
2976
|
+
{
|
|
2977
|
+
type: "button",
|
|
2978
|
+
onClick: handleNextPage,
|
|
2979
|
+
disabled: isNextDisabled,
|
|
2980
|
+
onMouseEnter: () => setHoveredButton("next"),
|
|
2981
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
2982
|
+
onMouseDown: () => setActiveButton("next"),
|
|
2983
|
+
onMouseUp: () => setActiveButton(null),
|
|
2984
|
+
onFocus: () => setFocusedButton("next"),
|
|
2985
|
+
onBlur: () => setFocusedButton(null),
|
|
2986
|
+
style: getButtonStyle("next", isNextDisabled),
|
|
2987
|
+
"aria-label": "Go to next page",
|
|
2988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ChevronRight, { size: 16, color: "#2f2f2f" })
|
|
2989
|
+
}
|
|
2990
|
+
),
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2992
|
+
"button",
|
|
2993
|
+
{
|
|
2994
|
+
type: "button",
|
|
2995
|
+
onClick: handleLastPage,
|
|
2996
|
+
disabled: isLastDisabled,
|
|
2997
|
+
onMouseEnter: () => setHoveredButton("last"),
|
|
2998
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
2999
|
+
onMouseDown: () => setActiveButton("last"),
|
|
3000
|
+
onMouseUp: () => setActiveButton(null),
|
|
3001
|
+
onFocus: () => setFocusedButton("last"),
|
|
3002
|
+
onBlur: () => setFocusedButton(null),
|
|
3003
|
+
style: getButtonStyle("last", isLastDisabled),
|
|
3004
|
+
"aria-label": "Go to last page",
|
|
3005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ChevronsRight, { size: 16, color: "#2f2f2f" })
|
|
3006
|
+
}
|
|
3007
|
+
)
|
|
3008
|
+
]
|
|
3009
|
+
}
|
|
3010
|
+
);
|
|
3011
|
+
}
|
|
3012
|
+
);
|
|
3013
|
+
Pagination.displayName = "Pagination";
|
|
3014
|
+
|
|
3015
|
+
// src/TableFooterPagination/TableFooterPagination.tsx
|
|
3016
|
+
var React17 = __toESM(require("react"));
|
|
3017
|
+
var import_clsx17 = require("clsx");
|
|
3018
|
+
var import_lucide_react7 = require("lucide-react");
|
|
3019
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3020
|
+
var containerStyles4 = {
|
|
3021
|
+
display: "flex",
|
|
3022
|
+
alignItems: "center",
|
|
3023
|
+
justifyContent: "space-between",
|
|
3024
|
+
backgroundColor: "white",
|
|
3025
|
+
paddingTop: "4px",
|
|
3026
|
+
paddingBottom: 0,
|
|
3027
|
+
paddingLeft: 0,
|
|
3028
|
+
paddingRight: 0,
|
|
3029
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
3030
|
+
};
|
|
3031
|
+
var textStyles2 = {
|
|
3032
|
+
fontSize: "13px",
|
|
3033
|
+
fontWeight: 400,
|
|
3034
|
+
lineHeight: "1.5",
|
|
3035
|
+
color: "#2f2f2f",
|
|
3036
|
+
minWidth: "165px"
|
|
3037
|
+
};
|
|
3038
|
+
var paginationWrapperStyles = {
|
|
3039
|
+
display: "flex",
|
|
3040
|
+
alignItems: "center",
|
|
3041
|
+
justifyContent: "center",
|
|
3042
|
+
gap: "8px",
|
|
3043
|
+
minWidth: "165px",
|
|
3044
|
+
flexWrap: "wrap"
|
|
3045
|
+
};
|
|
3046
|
+
var paginationButtonStyles = {
|
|
3047
|
+
width: "32px",
|
|
3048
|
+
height: "32px",
|
|
3049
|
+
minWidth: "32px",
|
|
3050
|
+
minHeight: "32px",
|
|
3051
|
+
maxWidth: "32px",
|
|
3052
|
+
maxHeight: "32px",
|
|
3053
|
+
borderRadius: "99px",
|
|
3054
|
+
border: "none",
|
|
3055
|
+
background: "white",
|
|
3056
|
+
cursor: "pointer",
|
|
3057
|
+
display: "flex",
|
|
3058
|
+
alignItems: "center",
|
|
3059
|
+
justifyContent: "center",
|
|
3060
|
+
padding: 0,
|
|
3061
|
+
transition: "background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out",
|
|
3062
|
+
flexShrink: 0,
|
|
3063
|
+
WebkitTapHighlightColor: "transparent",
|
|
3064
|
+
outline: "none"
|
|
3065
|
+
};
|
|
3066
|
+
var paginationButtonDisabledStyles = {
|
|
3067
|
+
cursor: "not-allowed",
|
|
3068
|
+
opacity: 0.5
|
|
3069
|
+
};
|
|
3070
|
+
var paginationLabelStyles = {
|
|
3071
|
+
fontSize: "13px",
|
|
3072
|
+
fontWeight: 400,
|
|
3073
|
+
lineHeight: "1.5",
|
|
3074
|
+
color: "#2f2f2f"
|
|
3075
|
+
};
|
|
3076
|
+
var paginationInputWrapperStyles = {
|
|
3077
|
+
display: "flex",
|
|
3078
|
+
alignItems: "center",
|
|
3079
|
+
gap: "8px"
|
|
3080
|
+
};
|
|
3081
|
+
var paginationInputStyles = {
|
|
3082
|
+
width: "60px",
|
|
3083
|
+
paddingTop: "12px",
|
|
3084
|
+
paddingBottom: "12px",
|
|
3085
|
+
paddingLeft: "16px",
|
|
3086
|
+
paddingRight: "16px",
|
|
3087
|
+
fontSize: "13px",
|
|
3088
|
+
fontWeight: 400,
|
|
3089
|
+
lineHeight: "1.5",
|
|
3090
|
+
color: "#2f2f2f",
|
|
3091
|
+
backgroundColor: "white",
|
|
3092
|
+
border: "1px solid #dfdfdf",
|
|
3093
|
+
borderRadius: "8px",
|
|
3094
|
+
fontFamily: "inherit",
|
|
3095
|
+
textAlign: "center",
|
|
3096
|
+
outline: "none"
|
|
3097
|
+
};
|
|
3098
|
+
var paginationInputFocusStyles = {
|
|
3099
|
+
boxShadow: "0px 0px 0px 3px #3cad51"
|
|
3100
|
+
};
|
|
3101
|
+
var rightAlignedStyles = {
|
|
3102
|
+
display: "flex",
|
|
3103
|
+
gap: "16px",
|
|
3104
|
+
alignItems: "center",
|
|
3105
|
+
justifyContent: "flex-end",
|
|
3106
|
+
minWidth: "165px"
|
|
3107
|
+
};
|
|
3108
|
+
var perPageButtonStyles = {
|
|
3109
|
+
height: "32px",
|
|
3110
|
+
backgroundColor: "white",
|
|
3111
|
+
border: "1px solid #d1d1d1",
|
|
3112
|
+
borderRadius: "8px",
|
|
3113
|
+
display: "flex",
|
|
3114
|
+
alignItems: "center",
|
|
3115
|
+
gap: "8px",
|
|
3116
|
+
paddingLeft: "12px",
|
|
3117
|
+
paddingRight: "8px",
|
|
3118
|
+
paddingTop: "8px",
|
|
3119
|
+
paddingBottom: "8px",
|
|
3120
|
+
cursor: "pointer",
|
|
3121
|
+
transition: "background-color 0.2s ease-in-out",
|
|
3122
|
+
outline: "none"
|
|
3123
|
+
};
|
|
3124
|
+
var perPageTextStyles = {
|
|
3125
|
+
fontSize: "13px",
|
|
3126
|
+
fontWeight: 600,
|
|
3127
|
+
lineHeight: "1.5",
|
|
3128
|
+
color: "#2f2f2f",
|
|
3129
|
+
textAlign: "center"
|
|
3130
|
+
};
|
|
3131
|
+
var expandButtonStyles = {
|
|
3132
|
+
height: "32px",
|
|
3133
|
+
minHeight: "32px",
|
|
3134
|
+
backgroundColor: "#efefef",
|
|
3135
|
+
border: "none",
|
|
3136
|
+
borderRadius: "99px",
|
|
3137
|
+
display: "flex",
|
|
3138
|
+
alignItems: "center",
|
|
3139
|
+
justifyContent: "center",
|
|
3140
|
+
paddingLeft: "16px",
|
|
3141
|
+
paddingRight: "16px",
|
|
3142
|
+
paddingTop: 0,
|
|
3143
|
+
paddingBottom: 0,
|
|
3144
|
+
gap: 0,
|
|
3145
|
+
cursor: "pointer",
|
|
3146
|
+
transition: "background-color 0.2s ease-in-out",
|
|
3147
|
+
outline: "none"
|
|
3148
|
+
};
|
|
3149
|
+
var expandButtonTextStyles = {
|
|
3150
|
+
fontSize: "13px",
|
|
3151
|
+
fontWeight: 600,
|
|
3152
|
+
lineHeight: "1.5",
|
|
3153
|
+
color: "#2f2f2f",
|
|
3154
|
+
textAlign: "center"
|
|
3155
|
+
};
|
|
3156
|
+
var TableFooterPagination = React17.forwardRef(
|
|
3157
|
+
({
|
|
3158
|
+
currentPage,
|
|
3159
|
+
totalPages,
|
|
3160
|
+
onPageChange,
|
|
3161
|
+
totalResults,
|
|
3162
|
+
currentResults,
|
|
3163
|
+
itemsPerPage,
|
|
3164
|
+
onItemsPerPageChange,
|
|
3165
|
+
onExpandTable,
|
|
3166
|
+
className,
|
|
3167
|
+
style,
|
|
3168
|
+
"data-testid": dataTestId
|
|
3169
|
+
}, ref) => {
|
|
3170
|
+
const [inputValue, setInputValue] = React17.useState(currentPage.toString());
|
|
3171
|
+
const [focusedButton, setFocusedButton] = React17.useState(null);
|
|
3172
|
+
const [hoveredButton, setHoveredButton] = React17.useState(null);
|
|
3173
|
+
const [activeButton, setActiveButton] = React17.useState(null);
|
|
3174
|
+
const [inputFocused, setInputFocused] = React17.useState(false);
|
|
3175
|
+
const [perPageHovered, setPerPageHovered] = React17.useState(false);
|
|
3176
|
+
const [expandHovered, setExpandHovered] = React17.useState(false);
|
|
3177
|
+
React17.useEffect(() => {
|
|
3178
|
+
setInputValue(currentPage.toString());
|
|
3179
|
+
}, [currentPage]);
|
|
3180
|
+
const handleFirstPage = () => {
|
|
3181
|
+
if (currentPage !== 1) {
|
|
3182
|
+
onPageChange(1);
|
|
3183
|
+
}
|
|
3184
|
+
};
|
|
3185
|
+
const handlePreviousPage = () => {
|
|
3186
|
+
if (currentPage > 1) {
|
|
3187
|
+
onPageChange(currentPage - 1);
|
|
3188
|
+
}
|
|
3189
|
+
};
|
|
3190
|
+
const handleNextPage = () => {
|
|
3191
|
+
if (currentPage < totalPages) {
|
|
3192
|
+
onPageChange(currentPage + 1);
|
|
3193
|
+
}
|
|
3194
|
+
};
|
|
3195
|
+
const handleLastPage = () => {
|
|
3196
|
+
if (currentPage !== totalPages) {
|
|
3197
|
+
onPageChange(totalPages);
|
|
3198
|
+
}
|
|
3199
|
+
};
|
|
3200
|
+
const handleInputChange = (e) => {
|
|
3201
|
+
const value = e.target.value;
|
|
3202
|
+
if (value === "" || /^\d+$/.test(value)) {
|
|
3203
|
+
setInputValue(value);
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
const handleInputBlur = () => {
|
|
3207
|
+
setInputFocused(false);
|
|
3208
|
+
const pageNumber = parseInt(inputValue, 10);
|
|
3209
|
+
if (isNaN(pageNumber) || pageNumber < 1) {
|
|
3210
|
+
setInputValue(currentPage.toString());
|
|
3211
|
+
} else if (pageNumber > totalPages) {
|
|
3212
|
+
setInputValue(totalPages.toString());
|
|
3213
|
+
onPageChange(totalPages);
|
|
3214
|
+
} else if (pageNumber !== currentPage) {
|
|
3215
|
+
onPageChange(pageNumber);
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
const handleInputKeyDown = (e) => {
|
|
3219
|
+
if (e.key === "Enter") {
|
|
3220
|
+
handleInputBlur();
|
|
3221
|
+
e.target.blur();
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
const getButtonStyle = (buttonName, disabled) => {
|
|
3225
|
+
if (disabled) {
|
|
3226
|
+
return { ...paginationButtonStyles, ...paginationButtonDisabledStyles };
|
|
3227
|
+
}
|
|
3228
|
+
const isHovered = hoveredButton === buttonName;
|
|
3229
|
+
const isFocused = focusedButton === buttonName;
|
|
3230
|
+
const isActive = activeButton === buttonName;
|
|
3231
|
+
const style2 = {
|
|
3232
|
+
...paginationButtonStyles
|
|
3233
|
+
};
|
|
3234
|
+
if (isHovered && !isFocused && !isActive) {
|
|
3235
|
+
style2.backgroundColor = "#efefef";
|
|
3236
|
+
}
|
|
3237
|
+
if (isActive && !isFocused) {
|
|
3238
|
+
style2.backgroundColor = "transparent";
|
|
3239
|
+
}
|
|
3240
|
+
if (isFocused) {
|
|
3241
|
+
style2.boxShadow = "0px 0px 0px 3px #3cad51";
|
|
3242
|
+
style2.backgroundColor = "rgba(255, 255, 255, 0.01)";
|
|
3243
|
+
}
|
|
3244
|
+
return style2;
|
|
3245
|
+
};
|
|
3246
|
+
const isFirstDisabled = currentPage === 1;
|
|
3247
|
+
const isPreviousDisabled = currentPage === 1;
|
|
3248
|
+
const isNextDisabled = currentPage === totalPages;
|
|
3249
|
+
const isLastDisabled = currentPage === totalPages;
|
|
3250
|
+
const resultText = currentResults === totalResults ? `Showing ${totalResults} results` : `Showing ${currentResults} of ${totalResults} results`;
|
|
3251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3252
|
+
"div",
|
|
3253
|
+
{
|
|
3254
|
+
ref,
|
|
3255
|
+
className: (0, import_clsx17.clsx)("arbor-table-footer-pagination", className),
|
|
3256
|
+
style: { ...containerStyles4, ...style },
|
|
3257
|
+
"data-testid": dataTestId,
|
|
3258
|
+
children: [
|
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: textStyles2, children: resultText }),
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: paginationWrapperStyles, children: [
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3262
|
+
"button",
|
|
3263
|
+
{
|
|
3264
|
+
type: "button",
|
|
3265
|
+
onClick: handleFirstPage,
|
|
3266
|
+
disabled: isFirstDisabled,
|
|
3267
|
+
onMouseEnter: () => setHoveredButton("first"),
|
|
3268
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3269
|
+
onMouseDown: () => setActiveButton("first"),
|
|
3270
|
+
onMouseUp: () => setActiveButton(null),
|
|
3271
|
+
onFocus: () => setFocusedButton("first"),
|
|
3272
|
+
onBlur: () => setFocusedButton(null),
|
|
3273
|
+
style: getButtonStyle("first", isFirstDisabled),
|
|
3274
|
+
"aria-label": "Go to first page",
|
|
3275
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3276
|
+
"svg",
|
|
3277
|
+
{
|
|
3278
|
+
width: "16",
|
|
3279
|
+
height: "16",
|
|
3280
|
+
viewBox: "0 0 16 16",
|
|
3281
|
+
fill: "none",
|
|
3282
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3284
|
+
"path",
|
|
3285
|
+
{
|
|
3286
|
+
d: "M7 12L3 8L7 4M11 12L7 8L11 4",
|
|
3287
|
+
stroke: "#2f2f2f",
|
|
3288
|
+
strokeWidth: "1.5",
|
|
3289
|
+
strokeLinecap: "round",
|
|
3290
|
+
strokeLinejoin: "round"
|
|
3291
|
+
}
|
|
3292
|
+
)
|
|
3293
|
+
}
|
|
3294
|
+
)
|
|
3295
|
+
}
|
|
3296
|
+
),
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3298
|
+
"button",
|
|
3299
|
+
{
|
|
3300
|
+
type: "button",
|
|
3301
|
+
onClick: handlePreviousPage,
|
|
3302
|
+
disabled: isPreviousDisabled,
|
|
3303
|
+
onMouseEnter: () => setHoveredButton("previous"),
|
|
3304
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3305
|
+
onMouseDown: () => setActiveButton("previous"),
|
|
3306
|
+
onMouseUp: () => setActiveButton(null),
|
|
3307
|
+
onFocus: () => setFocusedButton("previous"),
|
|
3308
|
+
onBlur: () => setFocusedButton(null),
|
|
3309
|
+
style: getButtonStyle("previous", isPreviousDisabled),
|
|
3310
|
+
"aria-label": "Go to previous page",
|
|
3311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3312
|
+
"svg",
|
|
3313
|
+
{
|
|
3314
|
+
width: "16",
|
|
3315
|
+
height: "16",
|
|
3316
|
+
viewBox: "0 0 16 16",
|
|
3317
|
+
fill: "none",
|
|
3318
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3319
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3320
|
+
"path",
|
|
3321
|
+
{
|
|
3322
|
+
d: "M10 12L6 8L10 4",
|
|
3323
|
+
stroke: "#2f2f2f",
|
|
3324
|
+
strokeWidth: "1.5",
|
|
3325
|
+
strokeLinecap: "round",
|
|
3326
|
+
strokeLinejoin: "round"
|
|
3327
|
+
}
|
|
3328
|
+
)
|
|
3329
|
+
}
|
|
3330
|
+
)
|
|
3331
|
+
}
|
|
3332
|
+
),
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: paginationInputWrapperStyles, children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: paginationLabelStyles, children: "Page" }),
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3336
|
+
"input",
|
|
3337
|
+
{
|
|
3338
|
+
type: "text",
|
|
3339
|
+
value: inputValue,
|
|
3340
|
+
onChange: handleInputChange,
|
|
3341
|
+
onBlur: handleInputBlur,
|
|
3342
|
+
onFocus: () => setInputFocused(true),
|
|
3343
|
+
onKeyDown: handleInputKeyDown,
|
|
3344
|
+
style: {
|
|
3345
|
+
...paginationInputStyles,
|
|
3346
|
+
...inputFocused && paginationInputFocusStyles
|
|
3347
|
+
},
|
|
3348
|
+
"aria-label": `Page ${currentPage} of ${totalPages}`
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: paginationLabelStyles, children: [
|
|
3352
|
+
"of ",
|
|
3353
|
+
totalPages
|
|
3354
|
+
] })
|
|
3355
|
+
] }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3357
|
+
"button",
|
|
3358
|
+
{
|
|
3359
|
+
type: "button",
|
|
3360
|
+
onClick: handleNextPage,
|
|
3361
|
+
disabled: isNextDisabled,
|
|
3362
|
+
onMouseEnter: () => setHoveredButton("next"),
|
|
3363
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3364
|
+
onMouseDown: () => setActiveButton("next"),
|
|
3365
|
+
onMouseUp: () => setActiveButton(null),
|
|
3366
|
+
onFocus: () => setFocusedButton("next"),
|
|
3367
|
+
onBlur: () => setFocusedButton(null),
|
|
3368
|
+
style: getButtonStyle("next", isNextDisabled),
|
|
3369
|
+
"aria-label": "Go to next page",
|
|
3370
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3371
|
+
"svg",
|
|
3372
|
+
{
|
|
3373
|
+
width: "16",
|
|
3374
|
+
height: "16",
|
|
3375
|
+
viewBox: "0 0 16 16",
|
|
3376
|
+
fill: "none",
|
|
3377
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3379
|
+
"path",
|
|
3380
|
+
{
|
|
3381
|
+
d: "M6 4L10 8L6 12",
|
|
3382
|
+
stroke: "#2f2f2f",
|
|
3383
|
+
strokeWidth: "1.5",
|
|
3384
|
+
strokeLinecap: "round",
|
|
3385
|
+
strokeLinejoin: "round"
|
|
3386
|
+
}
|
|
3387
|
+
)
|
|
3388
|
+
}
|
|
3389
|
+
)
|
|
3390
|
+
}
|
|
3391
|
+
),
|
|
3392
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3393
|
+
"button",
|
|
3394
|
+
{
|
|
3395
|
+
type: "button",
|
|
3396
|
+
onClick: handleLastPage,
|
|
3397
|
+
disabled: isLastDisabled,
|
|
3398
|
+
onMouseEnter: () => setHoveredButton("last"),
|
|
3399
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3400
|
+
onMouseDown: () => setActiveButton("last"),
|
|
3401
|
+
onMouseUp: () => setActiveButton(null),
|
|
3402
|
+
onFocus: () => setFocusedButton("last"),
|
|
3403
|
+
onBlur: () => setFocusedButton(null),
|
|
3404
|
+
style: getButtonStyle("last", isLastDisabled),
|
|
3405
|
+
"aria-label": "Go to last page",
|
|
3406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3407
|
+
"svg",
|
|
3408
|
+
{
|
|
3409
|
+
width: "16",
|
|
3410
|
+
height: "16",
|
|
3411
|
+
viewBox: "0 0 16 16",
|
|
3412
|
+
fill: "none",
|
|
3413
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3415
|
+
"path",
|
|
3416
|
+
{
|
|
3417
|
+
d: "M9 4L13 8L9 12M5 4L9 8L5 12",
|
|
3418
|
+
stroke: "#2f2f2f",
|
|
3419
|
+
strokeWidth: "1.5",
|
|
3420
|
+
strokeLinecap: "round",
|
|
3421
|
+
strokeLinejoin: "round"
|
|
3422
|
+
}
|
|
3423
|
+
)
|
|
3424
|
+
}
|
|
3425
|
+
)
|
|
3426
|
+
}
|
|
3427
|
+
)
|
|
3428
|
+
] }),
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: rightAlignedStyles, children: [
|
|
3430
|
+
onItemsPerPageChange && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3431
|
+
"button",
|
|
3432
|
+
{
|
|
3433
|
+
type: "button",
|
|
3434
|
+
onClick: () => onItemsPerPageChange(itemsPerPage),
|
|
3435
|
+
onMouseEnter: () => setPerPageHovered(true),
|
|
3436
|
+
onMouseLeave: () => setPerPageHovered(false),
|
|
3437
|
+
style: {
|
|
3438
|
+
...perPageButtonStyles,
|
|
3439
|
+
backgroundColor: perPageHovered ? "#f5f5f5" : "white"
|
|
3440
|
+
},
|
|
3441
|
+
"aria-label": "Items per page",
|
|
3442
|
+
children: [
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { style: perPageTextStyles, children: [
|
|
3444
|
+
itemsPerPage,
|
|
3445
|
+
" per page"
|
|
3446
|
+
] }),
|
|
3447
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ChevronDown, { size: 16, color: "#2f2f2f" })
|
|
3448
|
+
]
|
|
3449
|
+
}
|
|
3450
|
+
),
|
|
3451
|
+
onExpandTable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3452
|
+
"button",
|
|
3453
|
+
{
|
|
3454
|
+
type: "button",
|
|
3455
|
+
onClick: onExpandTable,
|
|
3456
|
+
onMouseEnter: () => setExpandHovered(true),
|
|
3457
|
+
onMouseLeave: () => setExpandHovered(false),
|
|
3458
|
+
style: {
|
|
3459
|
+
...expandButtonStyles,
|
|
3460
|
+
backgroundColor: expandHovered ? "#e5e5e5" : "#efefef"
|
|
3461
|
+
},
|
|
3462
|
+
"aria-label": "Expand table",
|
|
3463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: expandButtonTextStyles, children: "Expand table" })
|
|
3464
|
+
}
|
|
3465
|
+
)
|
|
3466
|
+
] })
|
|
3467
|
+
]
|
|
3468
|
+
}
|
|
3469
|
+
);
|
|
3470
|
+
}
|
|
3471
|
+
);
|
|
3472
|
+
TableFooterPagination.displayName = "TableFooterPagination";
|
|
3473
|
+
|
|
3474
|
+
// src/TableControls/TableControls.tsx
|
|
3475
|
+
var React18 = __toESM(require("react"));
|
|
3476
|
+
var import_clsx18 = require("clsx");
|
|
3477
|
+
var Popover2 = __toESM(require("@radix-ui/react-popover"));
|
|
3478
|
+
var import_lucide_react8 = require("lucide-react");
|
|
3479
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3480
|
+
var containerStyles5 = {
|
|
3481
|
+
display: "flex",
|
|
3482
|
+
alignItems: "center",
|
|
3483
|
+
justifyContent: "space-between",
|
|
3484
|
+
paddingTop: "8px",
|
|
3485
|
+
paddingBottom: "8px",
|
|
3486
|
+
paddingLeft: 0,
|
|
3487
|
+
paddingRight: 0,
|
|
3488
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
3489
|
+
};
|
|
3490
|
+
var actions1Styles = {
|
|
3491
|
+
display: "flex",
|
|
3492
|
+
gap: "12px",
|
|
3493
|
+
alignItems: "center"
|
|
3494
|
+
};
|
|
3495
|
+
var actions2Styles = {
|
|
3496
|
+
display: "flex",
|
|
3497
|
+
gap: "12px",
|
|
3498
|
+
alignItems: "center",
|
|
3499
|
+
justifyContent: "flex-end",
|
|
3500
|
+
flexGrow: 1,
|
|
3501
|
+
paddingRight: "4px"
|
|
3502
|
+
};
|
|
3503
|
+
var dropdownButtonStyles = {
|
|
3504
|
+
height: "32px",
|
|
3505
|
+
backgroundColor: "white",
|
|
3506
|
+
border: "1px solid #d1d1d1",
|
|
3507
|
+
borderRadius: "8px",
|
|
3508
|
+
display: "flex",
|
|
3509
|
+
alignItems: "center",
|
|
3510
|
+
justifyContent: "center",
|
|
3511
|
+
gap: "8px",
|
|
3512
|
+
paddingLeft: "12px",
|
|
3513
|
+
paddingRight: "8px",
|
|
3514
|
+
paddingTop: 0,
|
|
3515
|
+
paddingBottom: 0,
|
|
3516
|
+
cursor: "pointer",
|
|
3517
|
+
transition: "background-color 0.2s ease-in-out",
|
|
3518
|
+
outline: "none"
|
|
3519
|
+
};
|
|
3520
|
+
var dropdownTextStyles = {
|
|
3521
|
+
fontSize: "13px",
|
|
3522
|
+
fontWeight: 600,
|
|
3523
|
+
lineHeight: "1.5",
|
|
3524
|
+
color: "#2f2f2f",
|
|
3525
|
+
textAlign: "center"
|
|
3526
|
+
};
|
|
3527
|
+
var iconButtonStyles2 = {
|
|
3528
|
+
width: "32px",
|
|
3529
|
+
height: "32px",
|
|
3530
|
+
borderRadius: "99px",
|
|
3531
|
+
border: "none",
|
|
3532
|
+
backgroundColor: "white",
|
|
3533
|
+
cursor: "pointer",
|
|
3534
|
+
display: "flex",
|
|
3535
|
+
alignItems: "center",
|
|
3536
|
+
justifyContent: "center",
|
|
3537
|
+
padding: 0,
|
|
3538
|
+
transition: "background-color 0.2s ease-in-out",
|
|
3539
|
+
flexShrink: 0,
|
|
3540
|
+
outline: "none"
|
|
3541
|
+
};
|
|
3542
|
+
var iconButtonDisabledStyles = {
|
|
3543
|
+
cursor: "not-allowed",
|
|
3544
|
+
opacity: 0.5
|
|
3545
|
+
};
|
|
3546
|
+
var popoverContentStyles = {
|
|
3547
|
+
backgroundColor: "white",
|
|
3548
|
+
border: "1px solid #d1d1d1",
|
|
3549
|
+
borderRadius: "8px",
|
|
3550
|
+
padding: "8px",
|
|
3551
|
+
minWidth: "180px",
|
|
3552
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3553
|
+
zIndex: 1e3
|
|
3554
|
+
};
|
|
3555
|
+
var menuItemStyles = {
|
|
3556
|
+
padding: "8px 12px",
|
|
3557
|
+
fontSize: "13px",
|
|
3558
|
+
color: "#2f2f2f",
|
|
3559
|
+
cursor: "pointer",
|
|
3560
|
+
borderRadius: "4px",
|
|
3561
|
+
border: "none",
|
|
3562
|
+
backgroundColor: "white",
|
|
3563
|
+
width: "100%",
|
|
3564
|
+
textAlign: "left",
|
|
3565
|
+
transition: "background-color 0.2s ease-in-out"
|
|
3566
|
+
};
|
|
3567
|
+
var TableControls = React18.forwardRef(
|
|
3568
|
+
({
|
|
3569
|
+
selectedCount = 0,
|
|
3570
|
+
onActionsClick,
|
|
3571
|
+
onUndoClick,
|
|
3572
|
+
onRedoClick,
|
|
3573
|
+
onHideColumnsClick,
|
|
3574
|
+
onSearchClick,
|
|
3575
|
+
onDownloadClick,
|
|
3576
|
+
onTooltipsClick,
|
|
3577
|
+
tooltipsEnabled = false,
|
|
3578
|
+
onSettingsClick,
|
|
3579
|
+
onExpandClick,
|
|
3580
|
+
undoDisabled = false,
|
|
3581
|
+
redoDisabled = false,
|
|
3582
|
+
className,
|
|
3583
|
+
style,
|
|
3584
|
+
"data-testid": dataTestId
|
|
3585
|
+
}, ref) => {
|
|
3586
|
+
const [hoveredButton, setHoveredButton] = React18.useState(null);
|
|
3587
|
+
const [focusedButton, setFocusedButton] = React18.useState(null);
|
|
3588
|
+
const [actionsOpen, setActionsOpen] = React18.useState(false);
|
|
3589
|
+
const [hideColumnsOpen, setHideColumnsOpen] = React18.useState(false);
|
|
3590
|
+
const getIconButtonStyle = (buttonName, disabled = false) => {
|
|
3591
|
+
if (disabled) {
|
|
3592
|
+
return { ...iconButtonStyles2, ...iconButtonDisabledStyles };
|
|
3593
|
+
}
|
|
3594
|
+
const isHovered = hoveredButton === buttonName;
|
|
3595
|
+
const isFocused = focusedButton === buttonName;
|
|
3596
|
+
return {
|
|
3597
|
+
...iconButtonStyles2,
|
|
3598
|
+
backgroundColor: isHovered ? "#f5f5f5" : "white",
|
|
3599
|
+
boxShadow: isFocused ? "0 0 0 3px #3cad51" : "none"
|
|
3600
|
+
};
|
|
3601
|
+
};
|
|
3602
|
+
const getDropdownButtonStyle = (buttonName) => {
|
|
3603
|
+
const isHovered = hoveredButton === buttonName;
|
|
3604
|
+
const isFocused = focusedButton === buttonName;
|
|
3605
|
+
return {
|
|
3606
|
+
...dropdownButtonStyles,
|
|
3607
|
+
backgroundColor: isHovered ? "#f5f5f5" : "white",
|
|
3608
|
+
boxShadow: isFocused ? "0 0 0 3px #3cad51" : "none"
|
|
3609
|
+
};
|
|
3610
|
+
};
|
|
3611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3612
|
+
"div",
|
|
3613
|
+
{
|
|
3614
|
+
ref,
|
|
3615
|
+
className: (0, import_clsx18.clsx)("arbor-table-controls", className),
|
|
3616
|
+
style: { ...containerStyles5, ...style },
|
|
3617
|
+
"data-testid": dataTestId,
|
|
3618
|
+
children: [
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: actions1Styles, children: [
|
|
3620
|
+
onActionsClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Popover2.Root, { open: actionsOpen, onOpenChange: setActionsOpen, children: [
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3622
|
+
"button",
|
|
3623
|
+
{
|
|
3624
|
+
type: "button",
|
|
3625
|
+
onClick: () => {
|
|
3626
|
+
setActionsOpen(!actionsOpen);
|
|
3627
|
+
onActionsClick();
|
|
3628
|
+
},
|
|
3629
|
+
onMouseEnter: () => setHoveredButton("actions"),
|
|
3630
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3631
|
+
onFocus: () => setFocusedButton("actions"),
|
|
3632
|
+
onBlur: () => setFocusedButton(null),
|
|
3633
|
+
style: getDropdownButtonStyle("actions"),
|
|
3634
|
+
"aria-label": "Actions",
|
|
3635
|
+
children: [
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: dropdownTextStyles, children: [
|
|
3637
|
+
"Actions (",
|
|
3638
|
+
selectedCount,
|
|
3639
|
+
")"
|
|
3640
|
+
] }),
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { size: 16, color: "#2f2f2f" })
|
|
3642
|
+
]
|
|
3643
|
+
}
|
|
3644
|
+
) }),
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3646
|
+
Popover2.Content,
|
|
3647
|
+
{
|
|
3648
|
+
style: popoverContentStyles,
|
|
3649
|
+
sideOffset: 4,
|
|
3650
|
+
align: "start",
|
|
3651
|
+
children: [
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3653
|
+
"button",
|
|
3654
|
+
{
|
|
3655
|
+
style: menuItemStyles,
|
|
3656
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3657
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3658
|
+
onClick: () => {
|
|
3659
|
+
console.log("Edit selected items");
|
|
3660
|
+
setActionsOpen(false);
|
|
3661
|
+
},
|
|
3662
|
+
children: "Edit selected items"
|
|
3663
|
+
}
|
|
3664
|
+
),
|
|
3665
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3666
|
+
"button",
|
|
3667
|
+
{
|
|
3668
|
+
style: menuItemStyles,
|
|
3669
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3670
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3671
|
+
onClick: () => {
|
|
3672
|
+
console.log("Delete selected items");
|
|
3673
|
+
setActionsOpen(false);
|
|
3674
|
+
},
|
|
3675
|
+
children: "Delete selected items"
|
|
3676
|
+
}
|
|
3677
|
+
),
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3679
|
+
"button",
|
|
3680
|
+
{
|
|
3681
|
+
style: menuItemStyles,
|
|
3682
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3683
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3684
|
+
onClick: () => {
|
|
3685
|
+
console.log("Export selected items");
|
|
3686
|
+
setActionsOpen(false);
|
|
3687
|
+
},
|
|
3688
|
+
children: "Export selected items"
|
|
3689
|
+
}
|
|
3690
|
+
)
|
|
3691
|
+
]
|
|
3692
|
+
}
|
|
3693
|
+
) })
|
|
3694
|
+
] }),
|
|
3695
|
+
onUndoClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3696
|
+
"button",
|
|
3697
|
+
{
|
|
3698
|
+
type: "button",
|
|
3699
|
+
onClick: onUndoClick,
|
|
3700
|
+
disabled: undoDisabled,
|
|
3701
|
+
onMouseEnter: () => setHoveredButton("undo"),
|
|
3702
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3703
|
+
onFocus: () => setFocusedButton("undo"),
|
|
3704
|
+
onBlur: () => setFocusedButton(null),
|
|
3705
|
+
style: getIconButtonStyle("undo", undoDisabled),
|
|
3706
|
+
"aria-label": "Undo",
|
|
3707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Undo2, { size: 16, color: "#2f2f2f" })
|
|
3708
|
+
}
|
|
3709
|
+
),
|
|
3710
|
+
onRedoClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3711
|
+
"button",
|
|
3712
|
+
{
|
|
3713
|
+
type: "button",
|
|
3714
|
+
onClick: onRedoClick,
|
|
3715
|
+
disabled: redoDisabled,
|
|
3716
|
+
onMouseEnter: () => setHoveredButton("redo"),
|
|
3717
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3718
|
+
onFocus: () => setFocusedButton("redo"),
|
|
3719
|
+
onBlur: () => setFocusedButton(null),
|
|
3720
|
+
style: getIconButtonStyle("redo", redoDisabled),
|
|
3721
|
+
"aria-label": "Redo",
|
|
3722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Redo2, { size: 16, color: "#2f2f2f" })
|
|
3723
|
+
}
|
|
3724
|
+
),
|
|
3725
|
+
onHideColumnsClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Popover2.Root, { open: hideColumnsOpen, onOpenChange: setHideColumnsOpen, children: [
|
|
3726
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3727
|
+
"button",
|
|
3728
|
+
{
|
|
3729
|
+
type: "button",
|
|
3730
|
+
onClick: () => {
|
|
3731
|
+
setHideColumnsOpen(!hideColumnsOpen);
|
|
3732
|
+
onHideColumnsClick();
|
|
3733
|
+
},
|
|
3734
|
+
onMouseEnter: () => setHoveredButton("hideColumns"),
|
|
3735
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3736
|
+
onFocus: () => setFocusedButton("hideColumns"),
|
|
3737
|
+
onBlur: () => setFocusedButton(null),
|
|
3738
|
+
style: getDropdownButtonStyle("hideColumns"),
|
|
3739
|
+
"aria-label": "Hide Columns",
|
|
3740
|
+
children: [
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: dropdownTextStyles, children: "Hide Columns" }),
|
|
3742
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { size: 16, color: "#2f2f2f" })
|
|
3743
|
+
]
|
|
3744
|
+
}
|
|
3745
|
+
) }),
|
|
3746
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3747
|
+
Popover2.Content,
|
|
3748
|
+
{
|
|
3749
|
+
style: popoverContentStyles,
|
|
3750
|
+
sideOffset: 4,
|
|
3751
|
+
align: "start",
|
|
3752
|
+
children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3754
|
+
"button",
|
|
3755
|
+
{
|
|
3756
|
+
style: menuItemStyles,
|
|
3757
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3758
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3759
|
+
onClick: () => {
|
|
3760
|
+
console.log("Hide Name column");
|
|
3761
|
+
setHideColumnsOpen(false);
|
|
3762
|
+
},
|
|
3763
|
+
children: "Name"
|
|
3764
|
+
}
|
|
3765
|
+
),
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3767
|
+
"button",
|
|
3768
|
+
{
|
|
3769
|
+
style: menuItemStyles,
|
|
3770
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3771
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3772
|
+
onClick: () => {
|
|
3773
|
+
console.log("Hide Email column");
|
|
3774
|
+
setHideColumnsOpen(false);
|
|
3775
|
+
},
|
|
3776
|
+
children: "Email"
|
|
3777
|
+
}
|
|
3778
|
+
),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3780
|
+
"button",
|
|
3781
|
+
{
|
|
3782
|
+
style: menuItemStyles,
|
|
3783
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3784
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3785
|
+
onClick: () => {
|
|
3786
|
+
console.log("Hide Status column");
|
|
3787
|
+
setHideColumnsOpen(false);
|
|
3788
|
+
},
|
|
3789
|
+
children: "Status"
|
|
3790
|
+
}
|
|
3791
|
+
),
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3793
|
+
"button",
|
|
3794
|
+
{
|
|
3795
|
+
style: menuItemStyles,
|
|
3796
|
+
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#f5f5f5",
|
|
3797
|
+
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "white",
|
|
3798
|
+
onClick: () => {
|
|
3799
|
+
console.log("Hide Date column");
|
|
3800
|
+
setHideColumnsOpen(false);
|
|
3801
|
+
},
|
|
3802
|
+
children: "Date"
|
|
3803
|
+
}
|
|
3804
|
+
)
|
|
3805
|
+
]
|
|
3806
|
+
}
|
|
3807
|
+
) })
|
|
3808
|
+
] })
|
|
3809
|
+
] }),
|
|
3810
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: actions2Styles, children: [
|
|
3811
|
+
onSearchClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3812
|
+
"button",
|
|
3813
|
+
{
|
|
3814
|
+
type: "button",
|
|
3815
|
+
onClick: onSearchClick,
|
|
3816
|
+
onMouseEnter: () => setHoveredButton("search"),
|
|
3817
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3818
|
+
onFocus: () => setFocusedButton("search"),
|
|
3819
|
+
onBlur: () => setFocusedButton(null),
|
|
3820
|
+
style: getIconButtonStyle("search"),
|
|
3821
|
+
"aria-label": "Search",
|
|
3822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Search, { size: 16, color: "#2f2f2f" })
|
|
3823
|
+
}
|
|
3824
|
+
),
|
|
3825
|
+
onDownloadClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3826
|
+
"button",
|
|
3827
|
+
{
|
|
3828
|
+
type: "button",
|
|
3829
|
+
onClick: onDownloadClick,
|
|
3830
|
+
onMouseEnter: () => setHoveredButton("download"),
|
|
3831
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3832
|
+
onFocus: () => setFocusedButton("download"),
|
|
3833
|
+
onBlur: () => setFocusedButton(null),
|
|
3834
|
+
style: getIconButtonStyle("download"),
|
|
3835
|
+
"aria-label": "Download",
|
|
3836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Download, { size: 16, color: "#2f2f2f" })
|
|
3837
|
+
}
|
|
3838
|
+
),
|
|
3839
|
+
onTooltipsClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3840
|
+
"button",
|
|
3841
|
+
{
|
|
3842
|
+
type: "button",
|
|
3843
|
+
onClick: onTooltipsClick,
|
|
3844
|
+
onMouseEnter: () => setHoveredButton("tooltips"),
|
|
3845
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3846
|
+
onFocus: () => setFocusedButton("tooltips"),
|
|
3847
|
+
onBlur: () => setFocusedButton(null),
|
|
3848
|
+
style: getIconButtonStyle("tooltips"),
|
|
3849
|
+
"aria-label": tooltipsEnabled ? "Disable tooltips" : "Enable tooltips",
|
|
3850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3851
|
+
import_lucide_react8.MessageSquare,
|
|
3852
|
+
{
|
|
3853
|
+
size: 16,
|
|
3854
|
+
color: "#2f2f2f"
|
|
3855
|
+
}
|
|
3856
|
+
)
|
|
3857
|
+
}
|
|
3858
|
+
),
|
|
3859
|
+
onSettingsClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3860
|
+
"button",
|
|
3861
|
+
{
|
|
3862
|
+
type: "button",
|
|
3863
|
+
onClick: onSettingsClick,
|
|
3864
|
+
onMouseEnter: () => setHoveredButton("settings"),
|
|
3865
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3866
|
+
onFocus: () => setFocusedButton("settings"),
|
|
3867
|
+
onBlur: () => setFocusedButton(null),
|
|
3868
|
+
style: getIconButtonStyle("settings"),
|
|
3869
|
+
"aria-label": "Settings",
|
|
3870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Settings, { size: 16, color: "#2f2f2f" })
|
|
3871
|
+
}
|
|
3872
|
+
),
|
|
3873
|
+
onExpandClick && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3874
|
+
"button",
|
|
3875
|
+
{
|
|
3876
|
+
type: "button",
|
|
3877
|
+
onClick: onExpandClick,
|
|
3878
|
+
onMouseEnter: () => setHoveredButton("expand"),
|
|
3879
|
+
onMouseLeave: () => setHoveredButton(null),
|
|
3880
|
+
onFocus: () => setFocusedButton("expand"),
|
|
3881
|
+
onBlur: () => setFocusedButton(null),
|
|
3882
|
+
style: getIconButtonStyle("expand"),
|
|
3883
|
+
"aria-label": "Expand",
|
|
3884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Expand, { size: 16, color: "#2f2f2f" })
|
|
3885
|
+
}
|
|
3886
|
+
)
|
|
3887
|
+
] })
|
|
3888
|
+
]
|
|
3889
|
+
}
|
|
3890
|
+
);
|
|
3891
|
+
}
|
|
3892
|
+
);
|
|
3893
|
+
TableControls.displayName = "TableControls";
|
|
3894
|
+
|
|
3895
|
+
// src/Table/Table.tsx
|
|
3896
|
+
var React19 = __toESM(require("react"));
|
|
3897
|
+
var import_clsx19 = require("clsx");
|
|
3898
|
+
var import_lucide_react9 = require("lucide-react");
|
|
3899
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3900
|
+
var tableStyles = {
|
|
3901
|
+
width: "100%",
|
|
3902
|
+
borderCollapse: "separate",
|
|
3903
|
+
borderSpacing: 0,
|
|
3904
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
3905
|
+
};
|
|
3906
|
+
var headerCellStyles = {
|
|
3907
|
+
height: "44px",
|
|
3908
|
+
paddingLeft: "16px",
|
|
3909
|
+
paddingRight: "16px",
|
|
3910
|
+
paddingTop: 0,
|
|
3911
|
+
paddingBottom: 0,
|
|
3912
|
+
backgroundColor: "#f8f8f8",
|
|
3913
|
+
borderBottom: "1px solid #efefef",
|
|
3914
|
+
fontSize: "13px",
|
|
3915
|
+
fontWeight: 600,
|
|
3916
|
+
color: "#2f2f2f",
|
|
3917
|
+
textAlign: "left",
|
|
3918
|
+
position: "relative"
|
|
3919
|
+
};
|
|
3920
|
+
var checkboxCellStyles = {
|
|
3921
|
+
width: "48px",
|
|
3922
|
+
paddingLeft: "16px",
|
|
3923
|
+
paddingRight: "8px"
|
|
3924
|
+
};
|
|
3925
|
+
var bodyCellStyles = {
|
|
3926
|
+
height: "41px",
|
|
3927
|
+
paddingLeft: "16px",
|
|
3928
|
+
paddingRight: "16px",
|
|
3929
|
+
paddingTop: "8px",
|
|
3930
|
+
paddingBottom: "8px",
|
|
3931
|
+
borderBottom: "1px solid #efefef",
|
|
3932
|
+
fontSize: "13px",
|
|
3933
|
+
color: "#2f2f2f"
|
|
3934
|
+
};
|
|
3935
|
+
var menuButtonStyles = {
|
|
3936
|
+
width: "24px",
|
|
3937
|
+
height: "24px",
|
|
3938
|
+
border: "none",
|
|
3939
|
+
backgroundColor: "transparent",
|
|
3940
|
+
cursor: "pointer",
|
|
3941
|
+
display: "inline-flex",
|
|
3942
|
+
alignItems: "center",
|
|
3943
|
+
justifyContent: "center",
|
|
3944
|
+
padding: 0,
|
|
3945
|
+
marginLeft: "8px",
|
|
3946
|
+
borderRadius: "4px",
|
|
3947
|
+
transition: "background-color 0.2s ease-in-out"
|
|
3948
|
+
};
|
|
3949
|
+
var rowStyles = {
|
|
3950
|
+
transition: "background-color 0.1s ease-in-out"
|
|
3951
|
+
};
|
|
3952
|
+
var Table = React19.forwardRef(
|
|
3953
|
+
({
|
|
3954
|
+
columns,
|
|
3955
|
+
rows,
|
|
3956
|
+
onRowSelectionChange,
|
|
3957
|
+
onSelectAllChange,
|
|
3958
|
+
allSelected = false,
|
|
3959
|
+
someSelected = false,
|
|
3960
|
+
className,
|
|
3961
|
+
style,
|
|
3962
|
+
"data-testid": dataTestId
|
|
3963
|
+
}, ref) => {
|
|
3964
|
+
const [hoveredRow, setHoveredRow] = React19.useState(null);
|
|
3965
|
+
const [hoveredMenuButton, setHoveredMenuButton] = React19.useState(null);
|
|
3966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3967
|
+
"table",
|
|
3968
|
+
{
|
|
3969
|
+
ref,
|
|
3970
|
+
className: (0, import_clsx19.clsx)("arbor-table", className),
|
|
3971
|
+
style: { ...tableStyles, ...style },
|
|
3972
|
+
"data-testid": dataTestId,
|
|
3973
|
+
children: [
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("tr", { children: [
|
|
3975
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { style: { ...headerCellStyles, ...checkboxCellStyles }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3976
|
+
Checkbox,
|
|
3977
|
+
{
|
|
3978
|
+
checked: allSelected,
|
|
3979
|
+
indeterminate: someSelected && !allSelected,
|
|
3980
|
+
onChange: onSelectAllChange,
|
|
3981
|
+
"aria-label": "Select all rows"
|
|
3982
|
+
}
|
|
3983
|
+
) }),
|
|
3984
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3985
|
+
"th",
|
|
3986
|
+
{
|
|
3987
|
+
style: {
|
|
3988
|
+
...headerCellStyles,
|
|
3989
|
+
...column.width ? { width: column.width } : {}
|
|
3990
|
+
},
|
|
3991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
3992
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: column.label }),
|
|
3993
|
+
column.showMenu !== false && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3994
|
+
"button",
|
|
3995
|
+
{
|
|
3996
|
+
type: "button",
|
|
3997
|
+
onMouseEnter: () => setHoveredMenuButton(`header-${column.key}`),
|
|
3998
|
+
onMouseLeave: () => setHoveredMenuButton(null),
|
|
3999
|
+
style: {
|
|
4000
|
+
...menuButtonStyles,
|
|
4001
|
+
backgroundColor: hoveredMenuButton === `header-${column.key}` ? "#f5f5f5" : "transparent"
|
|
4002
|
+
},
|
|
4003
|
+
"aria-label": `${column.label} options`,
|
|
4004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.MoreVertical, { size: 16, color: "#595959" })
|
|
4005
|
+
}
|
|
4006
|
+
)
|
|
4007
|
+
] })
|
|
4008
|
+
},
|
|
4009
|
+
column.key
|
|
4010
|
+
))
|
|
4011
|
+
] }) }),
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: rows.map((row, index) => {
|
|
4013
|
+
const isOdd = index % 2 === 0;
|
|
4014
|
+
const isHovered = hoveredRow === row.id;
|
|
4015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4016
|
+
"tr",
|
|
4017
|
+
{
|
|
4018
|
+
onMouseEnter: () => setHoveredRow(row.id),
|
|
4019
|
+
onMouseLeave: () => setHoveredRow(null),
|
|
4020
|
+
style: {
|
|
4021
|
+
...rowStyles,
|
|
4022
|
+
backgroundColor: isHovered ? "#fafafa" : isOdd ? "white" : "#f8f8f8"
|
|
4023
|
+
},
|
|
4024
|
+
children: [
|
|
4025
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { style: { ...bodyCellStyles, ...checkboxCellStyles }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4026
|
+
Checkbox,
|
|
4027
|
+
{
|
|
4028
|
+
checked: row.selected || false,
|
|
4029
|
+
onChange: (checked) => onRowSelectionChange?.(row.id, checked),
|
|
4030
|
+
"aria-label": `Select row ${row.id}`
|
|
4031
|
+
}
|
|
4032
|
+
) }),
|
|
4033
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { style: bodyCellStyles, children: row.cells[column.key] }, column.key))
|
|
4034
|
+
]
|
|
4035
|
+
},
|
|
4036
|
+
row.id
|
|
4037
|
+
);
|
|
4038
|
+
}) })
|
|
4039
|
+
]
|
|
4040
|
+
}
|
|
4041
|
+
);
|
|
4042
|
+
}
|
|
4043
|
+
);
|
|
4044
|
+
Table.displayName = "Table";
|
|
503
4045
|
// Annotate the CommonJS export names for ESM import in node:
|
|
504
4046
|
0 && (module.exports = {
|
|
4047
|
+
Banner,
|
|
505
4048
|
Button,
|
|
506
4049
|
Card,
|
|
4050
|
+
Checkbox,
|
|
4051
|
+
Combobox,
|
|
4052
|
+
DatePicker,
|
|
507
4053
|
Input,
|
|
508
|
-
|
|
4054
|
+
NumericInput,
|
|
4055
|
+
Pagination,
|
|
4056
|
+
Radio,
|
|
4057
|
+
Table,
|
|
4058
|
+
TableControls,
|
|
4059
|
+
TableFooterPagination,
|
|
4060
|
+
Tabs,
|
|
4061
|
+
Tag,
|
|
4062
|
+
TextArea,
|
|
4063
|
+
Toast,
|
|
4064
|
+
Toggle,
|
|
4065
|
+
Tooltip
|
|
509
4066
|
});
|
|
510
4067
|
//# sourceMappingURL=index.js.map
|