@dmsi/wedgekit-react 0.0.87 → 0.0.89

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.
Files changed (92) hide show
  1. package/dist/{chunk-S3CQ5VFT.js → chunk-2XOQII4G.js} +1 -1
  2. package/dist/{chunk-TVDFTRGL.js → chunk-3JRVV6QY.js} +1 -1
  3. package/dist/{chunk-4N2PED4P.js → chunk-3NWBR3V3.js} +1 -1
  4. package/dist/chunk-5OHGKW4U.js +9 -0
  5. package/dist/chunk-5UH6QUFB.js +38 -0
  6. package/dist/{chunk-QUPHLL7D.js → chunk-6CS5ZBXO.js} +1 -1
  7. package/dist/{chunk-OW3SZEU5.js → chunk-EO3JJWFW.js} +4 -1
  8. package/dist/{chunk-SAMX4YGM.js → chunk-IMN6I5NV.js} +1 -1
  9. package/dist/chunk-JOMM4KBH.js +26 -0
  10. package/dist/{chunk-MZJS2ZAU.js → chunk-L364HTYC.js} +2 -1
  11. package/dist/{chunk-CKSDMI2Q.js → chunk-LYVH4YFE.js} +2 -2
  12. package/dist/{chunk-LP6AZST2.js → chunk-OB3URVCR.js} +1 -1
  13. package/dist/chunk-QDFQ3B4N.js +87 -0
  14. package/dist/{chunk-MQWWNAO3.js → chunk-QIHDPSOM.js} +4 -4
  15. package/dist/{chunk-724LJWFR.js → chunk-R5TLUWDD.js} +5 -35
  16. package/dist/chunk-RHADESKO.js +57 -0
  17. package/dist/chunk-SASEP5UE.js +235 -0
  18. package/dist/chunk-TTO4PL7Y.js +135 -0
  19. package/dist/{chunk-2BVSUYXU.js → chunk-Y4HUYAI5.js} +1 -1
  20. package/dist/components/Accordion.cjs +529 -0
  21. package/dist/components/Accordion.js +13 -0
  22. package/dist/components/Button.cjs +2 -1
  23. package/dist/components/Button.js +1 -1
  24. package/dist/components/Card.cjs +83 -0
  25. package/dist/components/Card.js +7 -0
  26. package/dist/components/ContentTab.cjs +2 -1
  27. package/dist/components/ContentTab.js +2 -2
  28. package/dist/components/ContentTabs.cjs +2 -1
  29. package/dist/components/ContentTabs.js +2 -2
  30. package/dist/components/DataGridCell.js +7 -6
  31. package/dist/components/DateInput.js +2 -1
  32. package/dist/components/DateRangeInput.js +2 -1
  33. package/dist/components/FilterGroup.cjs +2 -1
  34. package/dist/components/FilterGroup.js +6 -5
  35. package/dist/components/HorizontalDivider.js +3 -6
  36. package/dist/components/Input.js +2 -1
  37. package/dist/components/MenuOption.js +2 -2
  38. package/dist/components/MobileDataGrid.cjs +134 -133
  39. package/dist/components/MobileDataGrid.js +4 -4
  40. package/dist/components/Modal.cjs +2 -1
  41. package/dist/components/Modal.js +4 -4
  42. package/dist/components/ModalButtons.cjs +2 -1
  43. package/dist/components/ModalButtons.js +2 -2
  44. package/dist/components/ModalHeader.cjs +2 -1
  45. package/dist/components/ModalHeader.js +2 -2
  46. package/dist/components/NavigationTab.cjs +2 -1
  47. package/dist/components/NavigationTab.js +2 -2
  48. package/dist/components/NavigationTabs.cjs +2 -1
  49. package/dist/components/NavigationTabs.js +2 -2
  50. package/dist/components/NestedMenu.js +2 -2
  51. package/dist/components/Notification.cjs +3 -2
  52. package/dist/components/Notification.js +4 -4
  53. package/dist/components/OptionPill.cjs +2 -1
  54. package/dist/components/OptionPill.js +2 -2
  55. package/dist/components/PDFViewer.cjs +2 -1
  56. package/dist/components/PDFViewer.js +4 -4
  57. package/dist/components/Password.js +2 -1
  58. package/dist/components/PaymentOnAccountModal.cjs +2132 -0
  59. package/dist/components/PaymentOnAccountModal.js +31 -0
  60. package/dist/components/Radio.js +5 -130
  61. package/dist/components/Search.js +3 -2
  62. package/dist/components/Select.js +3 -2
  63. package/dist/components/SelectPaymentMethod.cjs +1170 -0
  64. package/dist/components/SelectPaymentMethod.js +20 -0
  65. package/dist/components/SideMenuGroup.cjs +1 -1
  66. package/dist/components/SideMenuGroup.js +3 -3
  67. package/dist/components/SideMenuItem.cjs +1 -1
  68. package/dist/components/SideMenuItem.js +1 -1
  69. package/dist/components/Stack.cjs +132 -4
  70. package/dist/components/Stack.js +2 -1
  71. package/dist/components/Stepper.cjs +2 -1
  72. package/dist/components/Stepper.js +3 -2
  73. package/dist/components/Swatch.cjs +1 -1
  74. package/dist/components/Swatch.js +5 -5
  75. package/dist/components/Time.cjs +1 -1
  76. package/dist/components/Time.js +5 -4
  77. package/dist/components/Toast.cjs +2 -1
  78. package/dist/components/Toast.js +1 -1
  79. package/dist/components/Upload.cjs +2 -1
  80. package/dist/components/Upload.js +1 -1
  81. package/dist/components/index.cjs +1053 -1
  82. package/dist/components/index.js +35 -11
  83. package/dist/index.css +42 -0
  84. package/package.json +1 -1
  85. package/src/components/Accordion.tsx +84 -0
  86. package/src/components/Button.tsx +2 -1
  87. package/src/components/Card.tsx +17 -0
  88. package/src/components/PaymentOnAccountModal.tsx +52 -0
  89. package/src/components/SelectPaymentMethod.tsx +263 -0
  90. package/src/components/Stack.tsx +2 -3
  91. package/src/components/index.ts +3 -0
  92. package/dist/{chunk-UPBBOZM3.js → chunk-VH3EJNVE.js} +3 -3
@@ -59,7 +59,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
59
59
  // src/components/index.ts
60
60
  var components_exports = {};
61
61
  __export(components_exports, {
62
+ Accordion: () => Accordion,
62
63
  Button: () => Button,
64
+ Card: () => Card,
63
65
  Checkbox: () => Checkbox,
64
66
  DataCellHeader: () => DataCellHeader,
65
67
  DataGrid: () => DataGrid,
@@ -72,6 +74,7 @@ __export(components_exports, {
72
74
  Menu: () => Menu,
73
75
  MenuOption: () => MenuOption,
74
76
  Paragraph: () => Paragraph,
77
+ PaymentOnAccountModal: () => PaymentOnAccountModal,
75
78
  Search: () => Search,
76
79
  Select: () => Select,
77
80
  Subheader: () => Subheader,
@@ -3459,7 +3462,7 @@ var Button = (_a) => {
3459
3462
  componentPaddingXUsingComponentGap,
3460
3463
  typography.buttonLabel
3461
3464
  );
3462
- const Element = href ? "a" : as;
3465
+ const Element = href && !as ? "a" : as;
3463
3466
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3464
3467
  Element,
3465
3468
  __spreadProps(__spreadValues({
@@ -3467,6 +3470,7 @@ var Button = (_a) => {
3467
3470
  type: Element === "button" ? "button" : void 0,
3468
3471
  className: buttonClasses
3469
3472
  }, props), {
3473
+ onClick: props.onClick,
3470
3474
  disabled,
3471
3475
  href,
3472
3476
  children: [
@@ -3596,9 +3600,1056 @@ var Tooltip = ({
3596
3600
  }
3597
3601
  };
3598
3602
  Tooltip.displayName = "Tooltip";
3603
+
3604
+ // src/components/Modal.tsx
3605
+ var import_clsx24 = __toESM(require("clsx"), 1);
3606
+ var import_react19 = require("react");
3607
+
3608
+ // src/components/Heading.tsx
3609
+ var import_clsx19 = __toESM(require("clsx"), 1);
3610
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3611
+ var Heading = (_a) => {
3612
+ var _b = _a, {
3613
+ className,
3614
+ children,
3615
+ as,
3616
+ color,
3617
+ align,
3618
+ variant = "heading1",
3619
+ id
3620
+ } = _b, props = __objRest(_b, [
3621
+ "className",
3622
+ "children",
3623
+ "as",
3624
+ "color",
3625
+ "align",
3626
+ "variant",
3627
+ "id"
3628
+ ]);
3629
+ const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
3630
+ const Element = as != null ? as : defaultElement;
3631
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3632
+ Element,
3633
+ __spreadProps(__spreadValues({
3634
+ id,
3635
+ className: (0, import_clsx19.default)(
3636
+ typography[variant],
3637
+ className,
3638
+ align === "left" && "text-left",
3639
+ align === "center" && "text-center",
3640
+ align === "right" && "text-right"
3641
+ ),
3642
+ style: __spreadProps(__spreadValues({}, props.style), {
3643
+ color: color ? `var(--color-${color})` : void 0
3644
+ })
3645
+ }, props), {
3646
+ children
3647
+ })
3648
+ );
3649
+ };
3650
+ Heading.displayName = "Heading";
3651
+ var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
3652
+ var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
3653
+ var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
3654
+ Heading1.displayName = "Heading1";
3655
+ Heading2.displayName = "Heading2";
3656
+ Heading3.displayName = "Heading3";
3657
+
3658
+ // src/components/ModalHeader.tsx
3659
+ var import_clsx20 = __toESM(require("clsx"), 1);
3660
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3661
+ var ModalHeader = ({
3662
+ title,
3663
+ hideCloseIcon,
3664
+ headerIcon,
3665
+ onClose,
3666
+ id
3667
+ }) => {
3668
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3669
+ "div",
3670
+ {
3671
+ id,
3672
+ className: (0, import_clsx20.default)(
3673
+ "flex justify-between items-center",
3674
+ layoutPaddding,
3675
+ layoutGroupGap
3676
+ ),
3677
+ children: [
3678
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: (0, import_clsx20.default)("flex items-center", layoutGroupGap), children: [
3679
+ headerIcon,
3680
+ title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Heading2, { id: id ? `${id}-title` : void 0, as: "p", children: title })
3681
+ ] }),
3682
+ !hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3683
+ Button,
3684
+ {
3685
+ id: id ? `${id}-close-button` : void 0,
3686
+ iconOnly: true,
3687
+ variant: "tertiary",
3688
+ onClick: onClose,
3689
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "close", size: 24 }) })
3690
+ }
3691
+ )
3692
+ ]
3693
+ }
3694
+ );
3695
+ };
3696
+ ModalHeader.displayName = "ModalHeader";
3697
+
3698
+ // src/components/ModalContent.tsx
3699
+ var import_clsx21 = __toESM(require("clsx"), 1);
3700
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3701
+ function ModalContent({
3702
+ fixedHeightScrolling,
3703
+ children,
3704
+ id
3705
+ }) {
3706
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3707
+ "div",
3708
+ {
3709
+ id,
3710
+ className: (0, import_clsx21.default)(
3711
+ "flex-grow desktop:flex-grow-0",
3712
+ layoutPaddding,
3713
+ fixedHeightScrolling && "overflow-auto"
3714
+ ),
3715
+ children
3716
+ }
3717
+ );
3718
+ }
3719
+ ModalContent.displayName = "ModalContent";
3720
+
3721
+ // src/components/ModalButtons.tsx
3722
+ var import_clsx22 = __toESM(require("clsx"), 1);
3723
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3724
+ var ModalButtons = ({
3725
+ onClose,
3726
+ onContinue,
3727
+ customActions,
3728
+ id
3729
+ }) => {
3730
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3731
+ "div",
3732
+ {
3733
+ id,
3734
+ className: (0, import_clsx22.default)(
3735
+ "border-t border-neutral-300 flex justify-end",
3736
+ layoutPaddding,
3737
+ layoutGroupGap
3738
+ ),
3739
+ children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3740
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3741
+ Button,
3742
+ {
3743
+ id: id ? `${id}-close-button` : void 0,
3744
+ variant: "secondary",
3745
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "close", size: 24 }),
3746
+ onClick: onClose,
3747
+ className: "max-sm:w-full",
3748
+ children: "Close"
3749
+ }
3750
+ ),
3751
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3752
+ Button,
3753
+ {
3754
+ id: id ? `${id}-continue-button` : void 0,
3755
+ variant: "primary",
3756
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { name: "check", size: 24 }),
3757
+ className: "max-sm:w-full",
3758
+ onClick: onContinue,
3759
+ children: "Continue"
3760
+ }
3761
+ )
3762
+ ] })
3763
+ }
3764
+ );
3765
+ };
3766
+ ModalButtons.displayName = "ModalButtons";
3767
+
3768
+ // src/components/ModalScrim.tsx
3769
+ var import_clsx23 = __toESM(require("clsx"), 1);
3770
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3771
+ var ModalScrim = ({
3772
+ show = false,
3773
+ size = "small",
3774
+ children,
3775
+ onClick,
3776
+ ref,
3777
+ id
3778
+ }) => {
3779
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3780
+ "div",
3781
+ {
3782
+ id,
3783
+ className: (0, import_clsx23.default)(
3784
+ "overflow-y-auto h-screen transition-[visibility,opacity,background] ease-in-out duration-100 grid place-content-center desktop:p-4 group bg-neutral-600/50 fixed opacity-0",
3785
+ !show && " pointer-events-none",
3786
+ size === "small" && "p-4",
3787
+ "inset-0 z-50"
3788
+ ),
3789
+ onMouseDown: onClick,
3790
+ ref,
3791
+ children
3792
+ }
3793
+ );
3794
+ };
3795
+ ModalScrim.displayName = "ModalScrim";
3796
+
3797
+ // src/components/Modal.tsx
3798
+ var import_react_dom3 = require("react-dom");
3799
+ var import_react_use = require("react-use");
3800
+
3801
+ // src/components/useMounted.tsx
3802
+ var import_react18 = require("react");
3803
+ var useMounted = () => {
3804
+ const [isMounted, setIsMounted] = (0, import_react18.useState)(false);
3805
+ (0, import_react18.useEffect)(() => {
3806
+ setIsMounted(true);
3807
+ return () => setIsMounted(false);
3808
+ }, []);
3809
+ return isMounted;
3810
+ };
3811
+
3812
+ // src/components/Modal.tsx
3813
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3814
+ var fadeInScale = (element, duration = 300) => element.animate(
3815
+ [
3816
+ { opacity: 0, transform: "scale(0.95)" },
3817
+ { opacity: 1, transform: "scale(1)" }
3818
+ ],
3819
+ {
3820
+ duration,
3821
+ easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3822
+ fill: "both"
3823
+ }
3824
+ );
3825
+ var fadeOutScale = (element, duration = 200) => element.animate(
3826
+ [
3827
+ { opacity: 1, transform: "scale(1)" },
3828
+ { opacity: 0, transform: "scale(0.95)" }
3829
+ ],
3830
+ {
3831
+ duration,
3832
+ easing: "ease-in-out",
3833
+ fill: "both"
3834
+ }
3835
+ );
3836
+ var bgFadeIn = (element, duration = 300) => element.animate([{ opacity: 0 }, { opacity: 1 }], {
3837
+ duration,
3838
+ easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3839
+ fill: "both"
3840
+ });
3841
+ var bgFadeOut = (element, duration = 200) => element.animate([{ opacity: 1 }, { opacity: 0 }], {
3842
+ duration,
3843
+ easing: "ease-in-out",
3844
+ fill: "both"
3845
+ });
3846
+ var whenAllAnimationsFinish = (animations, callback) => {
3847
+ let finishedCount = 0;
3848
+ animations.forEach((animation) => {
3849
+ animation.onfinish = () => {
3850
+ finishedCount += 1;
3851
+ if (finishedCount === animations.length) {
3852
+ callback();
3853
+ }
3854
+ };
3855
+ });
3856
+ };
3857
+ var sizes = {
3858
+ small: {
3859
+ sizeClass: "max-h-screen desktop:max-w-120 rounded-sm"
3860
+ },
3861
+ medium: {
3862
+ sizeClass: "desktop:max-w-180 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3863
+ },
3864
+ large: {
3865
+ sizeClass: "desktop:max-w-240 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3866
+ },
3867
+ "x-large": {
3868
+ sizeClass: "desktop:max-w-300 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
3869
+ }
3870
+ };
3871
+ var Modal = ({
3872
+ id,
3873
+ title,
3874
+ open = false,
3875
+ size = "small",
3876
+ className,
3877
+ children,
3878
+ onClose,
3879
+ onContinue,
3880
+ closeOnBackdropClick = true,
3881
+ showButtons = false,
3882
+ hideCloseIcon = false,
3883
+ headerIcon,
3884
+ fixedHeightScrolling = false,
3885
+ customActions
3886
+ }) => {
3887
+ var _a;
3888
+ const mounted = useMounted();
3889
+ const modalRef = (0, import_react19.useRef)(null);
3890
+ const bgRef = (0, import_react19.useRef)(null);
3891
+ const wasOpen = (0, import_react_use.usePrevious)(open);
3892
+ const isMobile = useMatchesMobile();
3893
+ const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
3894
+ (0, import_react19.useEffect)(() => {
3895
+ if (!mounted) return;
3896
+ if (!modalRef.current || !bgRef.current) {
3897
+ console.error("Modal or background reference is not set.");
3898
+ return;
3899
+ }
3900
+ if (wasOpen === void 0) return;
3901
+ if (wasOpen && !open) {
3902
+ const modalAnimation = fadeOutScale(modalRef.current);
3903
+ const bgAnimation = bgFadeOut(bgRef.current);
3904
+ whenAllAnimationsFinish([modalAnimation, bgAnimation], () => {
3905
+ if (onClose) {
3906
+ onClose();
3907
+ }
3908
+ });
3909
+ } else if (!wasOpen && open) {
3910
+ fadeInScale(modalRef.current);
3911
+ bgFadeIn(bgRef.current);
3912
+ }
3913
+ }, [mounted, open]);
3914
+ const handleKeyDown = (0, import_react19.useCallback)(
3915
+ (e) => {
3916
+ if (e.key === "Escape") {
3917
+ if (onClose) {
3918
+ e.preventDefault();
3919
+ onClose();
3920
+ }
3921
+ }
3922
+ },
3923
+ [onClose, bgRef, modalRef]
3924
+ );
3925
+ const handleClose = (0, import_react19.useCallback)(() => {
3926
+ if (onClose) {
3927
+ onClose();
3928
+ }
3929
+ }, [onClose]);
3930
+ (0, import_react19.useEffect)(() => {
3931
+ if (open) {
3932
+ document.addEventListener("keyup", handleKeyDown);
3933
+ }
3934
+ return () => {
3935
+ document.removeEventListener("keyup", handleKeyDown);
3936
+ };
3937
+ }, [open, handleKeyDown]);
3938
+ (0, import_react19.useEffect)(() => {
3939
+ if (!open) return;
3940
+ const scrollY = window.scrollY;
3941
+ const body = document.body;
3942
+ body.style.position = "fixed";
3943
+ body.style.top = `-${scrollY}px`;
3944
+ body.style.left = "0";
3945
+ body.style.right = "0";
3946
+ body.style.overflow = "hidden";
3947
+ body.style.width = "100%";
3948
+ return () => {
3949
+ body.style.position = "";
3950
+ body.style.top = "";
3951
+ body.style.left = "";
3952
+ body.style.right = "";
3953
+ body.style.overflow = "";
3954
+ body.style.width = "";
3955
+ window.scrollTo(0, scrollY);
3956
+ };
3957
+ }, [open]);
3958
+ const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
3959
+ const backgroundClickHandler = (0, import_react19.useCallback)(
3960
+ (e) => {
3961
+ const target = e.target;
3962
+ const currentTarget = e.currentTarget;
3963
+ if (currentTarget.contains(target) && currentTarget !== target) {
3964
+ e.stopPropagation();
3965
+ return;
3966
+ }
3967
+ if (open && closeOnBackdropClick) {
3968
+ handleClose();
3969
+ }
3970
+ },
3971
+ [open, closeOnBackdropClick, handleClose]
3972
+ );
3973
+ if (!mounted) {
3974
+ return null;
3975
+ }
3976
+ return (0, import_react_dom3.createPortal)(
3977
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3978
+ ModalScrim,
3979
+ {
3980
+ id: id ? `${id}-scrim` : void 0,
3981
+ size,
3982
+ ref: bgRef,
3983
+ show: open,
3984
+ onClick: backgroundClickHandler,
3985
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3986
+ "div",
3987
+ {
3988
+ id,
3989
+ ref: modalRef,
3990
+ className: (0, import_clsx24.default)(
3991
+ "bg-white shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
3992
+ computedFixedHeightScrolling && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
3993
+ className,
3994
+ sizeClass
3995
+ ),
3996
+ onClick: (e) => e.stopPropagation(),
3997
+ children: [
3998
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3999
+ ModalHeader,
4000
+ {
4001
+ id: id ? `${id}-header` : void 0,
4002
+ title,
4003
+ onClose: handleClose,
4004
+ hideCloseIcon,
4005
+ headerIcon
4006
+ }
4007
+ ),
4008
+ children && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4009
+ ModalContent,
4010
+ {
4011
+ id: id ? `${id}-content` : void 0,
4012
+ fixedHeightScrolling: computedFixedHeightScrolling,
4013
+ children
4014
+ }
4015
+ ),
4016
+ showButtons && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4017
+ ModalButtons,
4018
+ {
4019
+ id: id ? `${id}-buttons` : void 0,
4020
+ onClose: handleClose,
4021
+ onContinue,
4022
+ customActions
4023
+ }
4024
+ )
4025
+ ]
4026
+ }
4027
+ )
4028
+ }
4029
+ ),
4030
+ findDocumentRoot(bgRef.current)
4031
+ );
4032
+ };
4033
+ Modal.displayName = "Modal";
4034
+
4035
+ // src/components/Stack.tsx
4036
+ var import_clsx25 = __toESM(require("clsx"), 1);
4037
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4038
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx25.default)(
4039
+ "flex",
4040
+ items === "start" && "items-start",
4041
+ grow && "grow",
4042
+ items === "start" && "items-start",
4043
+ items === "center" && "items-center",
4044
+ items === "end" && "items-end",
4045
+ items === "start-center" && "items-start desktop:items-center",
4046
+ justify === "start" && "justify-start",
4047
+ justify === "center" && "justify-center",
4048
+ justify === "end" && "justify-end",
4049
+ justify === "end" && "justify-end",
4050
+ justify === "between" && "justify-between",
4051
+ justify === "around" && "justify-around"
4052
+ );
4053
+ var useGapClassNames = (sizing) => {
4054
+ return (0, import_clsx25.default)(
4055
+ sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
4056
+ sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
4057
+ sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
4058
+ sizing === "component" && "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap"
4059
+ );
4060
+ };
4061
+ var Stack = (_a) => {
4062
+ var _b = _a, {
4063
+ children,
4064
+ items,
4065
+ justify,
4066
+ grow,
4067
+ padding,
4068
+ paddingX,
4069
+ paddingY,
4070
+ margin,
4071
+ marginX,
4072
+ marginY,
4073
+ horizontal,
4074
+ horizontalMobile,
4075
+ elevation = 0,
4076
+ rounded,
4077
+ centered,
4078
+ width,
4079
+ minHeight,
4080
+ maxWidth,
4081
+ minWidth,
4082
+ height,
4083
+ maxHeight,
4084
+ borderColor,
4085
+ backgroundColor,
4086
+ sizing = "none",
4087
+ overflowY = "inherit",
4088
+ overflowX = "inherit",
4089
+ flexShrink,
4090
+ flexGrow,
4091
+ position,
4092
+ top,
4093
+ left,
4094
+ id,
4095
+ noGap,
4096
+ marginTop,
4097
+ marginBottom
4098
+ } = _b, props = __objRest(_b, [
4099
+ "children",
4100
+ "items",
4101
+ "justify",
4102
+ "grow",
4103
+ "padding",
4104
+ "paddingX",
4105
+ "paddingY",
4106
+ "margin",
4107
+ "marginX",
4108
+ "marginY",
4109
+ "horizontal",
4110
+ "horizontalMobile",
4111
+ "elevation",
4112
+ "rounded",
4113
+ "centered",
4114
+ "width",
4115
+ "minHeight",
4116
+ "maxWidth",
4117
+ "minWidth",
4118
+ "height",
4119
+ "maxHeight",
4120
+ "borderColor",
4121
+ "backgroundColor",
4122
+ "sizing",
4123
+ "overflowY",
4124
+ "overflowX",
4125
+ "flexShrink",
4126
+ "flexGrow",
4127
+ "position",
4128
+ "top",
4129
+ "left",
4130
+ "id",
4131
+ "noGap",
4132
+ "marginTop",
4133
+ "marginBottom"
4134
+ ]);
4135
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
4136
+ const gapClassNames = useGapClassNames(sizing);
4137
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4138
+ "div",
4139
+ __spreadProps(__spreadValues({
4140
+ id
4141
+ }, props), {
4142
+ style: {
4143
+ height: height === "full" ? "100%" : height !== void 0 ? `${height}px` : void 0,
4144
+ maxHeight: maxHeight !== void 0 ? `${maxHeight}px` : void 0,
4145
+ minHeight: minHeight !== void 0 ? `${minHeight}px` : void 0,
4146
+ maxWidth: maxWidth !== void 0 ? `${maxWidth}px` : void 0,
4147
+ width: width !== void 0 && typeof width === "number" ? `${width}px` : void 0,
4148
+ minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
4149
+ border: borderColor ? `1px solid var(--color-${borderColor})` : void 0,
4150
+ backgroundColor: backgroundColor ? `var(--color-${backgroundColor})` : void 0,
4151
+ flexGrow: flexGrow !== void 0 ? flexGrow : void 0,
4152
+ flexShrink: flexShrink !== void 0 ? flexShrink : void 0,
4153
+ position: position !== void 0 ? position : void 0,
4154
+ top: top !== void 0 ? `${top}px` : void 0,
4155
+ left: left !== void 0 ? `${left}px` : void 0
4156
+ },
4157
+ className: (0, import_clsx25.default)(
4158
+ "scrollbar-thin",
4159
+ "max-w-screen",
4160
+ width !== "fit" && "w-full",
4161
+ width === "full" && "w-full",
4162
+ width === "max" && "w-max",
4163
+ centered && "mx-auto",
4164
+ overflowY == "auto" && "overflow-y-auto",
4165
+ overflowY == "hidden" && "overflow-y-hidden",
4166
+ overflowY == "scroll" && "overflow-y-scroll",
4167
+ overflowX == "auto" && "overflow-x-auto",
4168
+ overflowX == "hidden" && "overflow-x-hidden",
4169
+ overflowX == "scroll" && "overflow-x-scroll",
4170
+ padding && sizing === "container" && "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
4171
+ padding && sizing === "layout" && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
4172
+ padding && sizing === "layout-group" && "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
4173
+ padding && sizing === "component" && "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
4174
+ paddingX && sizing === "container" && "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding",
4175
+ paddingX && sizing === "layout" && "px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
4176
+ paddingX && sizing === "layout-group" && "px-mobile-layout-group-padding desktop:px-desktop-layout-group-padding compact:px-desktop-compact-layout-group-padding",
4177
+ paddingX && sizing === "component" && "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
4178
+ paddingY && sizing === "container" && "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding",
4179
+ paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
4180
+ paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
4181
+ paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
4182
+ margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
4183
+ marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
4184
+ marginTop && sizing === "container" && "mt-mobile-container-padding desktop:mt-desktop-container-padding compact:mt-compact-container-padding",
4185
+ marginBottom && sizing === "container" && "mb-mobile-container-padding desktop:mb-desktop-container-padding compact:mb-compact-container-padding",
4186
+ marginY && sizing === "container" && "my-mobile-container-padding desktop:my-desktop-container-padding compact:my-compact-container-padding",
4187
+ horizontal ? "desktop:flex-row" : "desktop:flex-col",
4188
+ horizontalMobile ? "flex-row" : "flex-col",
4189
+ flexClassNames,
4190
+ !noGap && gapClassNames,
4191
+ elevation === 0 && "shadow-none",
4192
+ elevation === 2 && "shadow-2",
4193
+ elevation === 4 && "shadow-4",
4194
+ elevation === 16 && "shadow-16",
4195
+ rounded && "rounded"
4196
+ ),
4197
+ children
4198
+ })
4199
+ );
4200
+ };
4201
+
4202
+ // src/components/Card.tsx
4203
+ var import_clsx26 = __toESM(require("clsx"), 1);
4204
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4205
+ function Card(props) {
4206
+ const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
4207
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4208
+ "div",
4209
+ __spreadProps(__spreadValues({}, rest), {
4210
+ className: (0, import_clsx26.default)(
4211
+ "border rounded-sm border-border-primary-normal p-desktop-layout-padding",
4212
+ rest.className
4213
+ ),
4214
+ children
4215
+ })
4216
+ );
4217
+ }
4218
+
4219
+ // src/components/PaymentOnAccountModal.tsx
4220
+ var import_react21 = require("react");
4221
+
4222
+ // src/components/SelectPaymentMethod.tsx
4223
+ var import_react20 = require("react");
4224
+
4225
+ // src/components/Accordion.tsx
4226
+ var import_clsx27 = __toESM(require("clsx"), 1);
4227
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4228
+ function Accordion(props) {
4229
+ const { isOpen, onClick, className } = props;
4230
+ const {
4231
+ title,
4232
+ before,
4233
+ after = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4234
+ Icon,
4235
+ {
4236
+ name: "expand_more",
4237
+ className: (0, import_clsx27.default)(
4238
+ "text-icon-primary-normal transform transition-all duration-300 ease-in-out",
4239
+ isOpen ? "rotate-180" : "rotate-0"
4240
+ )
4241
+ }
4242
+ ),
4243
+ children
4244
+ } = props;
4245
+ function handleClick(e) {
4246
+ e.stopPropagation();
4247
+ e.preventDefault();
4248
+ onClick == null ? void 0 : onClick();
4249
+ }
4250
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4251
+ Card,
4252
+ {
4253
+ className: (0, import_clsx27.default)(
4254
+ "overflow-hidden select-none cursor-pointer",
4255
+ className,
4256
+ isOpen && "border-2 !border-border-primary-focus"
4257
+ ),
4258
+ onClick: handleClick,
4259
+ children: [
4260
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
4261
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
4262
+ before,
4263
+ typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Paragraph, { className: "text-text-primary-normal", children: title }) : title
4264
+ ] }),
4265
+ after
4266
+ ] }),
4267
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4268
+ "div",
4269
+ {
4270
+ className: (0, import_clsx27.default)("grid transition-all duration-300 ease-in-out"),
4271
+ style: {
4272
+ gridTemplateRows: isOpen ? "1fr" : "0fr"
4273
+ },
4274
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4275
+ "div",
4276
+ {
4277
+ className: (0, import_clsx27.default)(
4278
+ typography.paragraph,
4279
+ "text-text-primary-normal desktop:pt-desktop-layout-gap",
4280
+ "flex flex-col gap-desktop-layout-gap"
4281
+ ),
4282
+ onClick: (e) => e.stopPropagation(),
4283
+ children
4284
+ }
4285
+ ) })
4286
+ }
4287
+ )
4288
+ ]
4289
+ }
4290
+ );
4291
+ }
4292
+
4293
+ // src/components/Radio.tsx
4294
+ var import_clsx28 = __toESM(require("clsx"), 1);
4295
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4296
+ var Radio = (_a) => {
4297
+ var _b = _a, {
4298
+ className,
4299
+ label,
4300
+ error,
4301
+ disabled,
4302
+ checked,
4303
+ readOnly,
4304
+ id
4305
+ } = _b, props = __objRest(_b, [
4306
+ "className",
4307
+ "label",
4308
+ "error",
4309
+ "disabled",
4310
+ "checked",
4311
+ "readOnly",
4312
+ "id"
4313
+ ]);
4314
+ const radioId = id;
4315
+ const paragraphColor = disabled ? "text-primary-disabled" : error ? "text-primary-error" : "text-primary-normal";
4316
+ const defaultClassName = (0, import_clsx28.default)(
4317
+ !error && !disabled && "border-border-primary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-focus:border-border-action-hover peer-focus:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active peer-checked:border-0 peer-checked:bg-background-action-secondary-hover"
4318
+ );
4319
+ const errorClassName = (0, import_clsx28.default)(
4320
+ error && !disabled && "border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-focus:border-border-action-critical-hover peer-focus:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active peer-checked:bg-background-action-critical-secondary-hover peer-checked:border-0 "
4321
+ );
4322
+ const disabledClassName = (0, import_clsx28.default)(
4323
+ disabled && "peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0"
4324
+ );
4325
+ const readonlyClassName = (0, import_clsx28.default)(
4326
+ readOnly && "peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0"
4327
+ );
4328
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4329
+ "label",
4330
+ {
4331
+ htmlFor: radioId,
4332
+ className: (0, import_clsx28.default)(
4333
+ "flex items-center",
4334
+ componentGap,
4335
+ disabled ? "cursor-default" : "cursor-pointer",
4336
+ className
4337
+ ),
4338
+ children: [
4339
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "relative", children: [
4340
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4341
+ "input",
4342
+ __spreadValues({
4343
+ id: radioId,
4344
+ type: "radio",
4345
+ className: "sr-only peer",
4346
+ disabled,
4347
+ checked,
4348
+ readOnly
4349
+ }, props)
4350
+ ),
4351
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4352
+ "div",
4353
+ {
4354
+ className: (0, import_clsx28.default)(
4355
+ "size-6 rounded-full border flex items-center justify-center",
4356
+ baseTransition,
4357
+ defaultClassName,
4358
+ errorClassName,
4359
+ disabledClassName,
4360
+ readonlyClassName
4361
+ ),
4362
+ children: checked && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4363
+ RadioIcon,
4364
+ {
4365
+ className: (0, import_clsx28.default)(
4366
+ "transition-colors",
4367
+ !error && !disabled && "text-icon-on-action-secondary-normal hover:text-icon-on-action-secondary-hover active:text-icon-on-action-secondary-active peer-hover:text-icon-on-action-secondary-hover peer-focus:text-icon-on-action-secondary-hover peer-active:text-icon-on-action-secondary-active",
4368
+ error && !disabled && "text-icon-action-critical-secondary-normal hover:text-icon-action-critical-secondary-hover active:text-icon-action-critical-secondary-active peer-hover:text-icon-action-critical-secondary-hover peer-focus:text-icon-action-critical-secondary-hover peer-active:text-icon-action-critical-secondary-active",
4369
+ disabled && "text-icon-on-action-secondary-disabled",
4370
+ readOnly && "text-icon-on-action-secondary-disabled"
4371
+ )
4372
+ }
4373
+ )
4374
+ }
4375
+ )
4376
+ ] }),
4377
+ label && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Paragraph, { id: `${radioId}-label`, padded: true, color: paragraphColor, children: label })
4378
+ ]
4379
+ }
4380
+ );
4381
+ };
4382
+ Radio.displayName = "Radio";
4383
+ var RadioIcon = ({ className }) => {
4384
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4385
+ "svg",
4386
+ {
4387
+ className,
4388
+ xmlns: "http://www.w3.org/2000/svg",
4389
+ width: "24",
4390
+ height: "24",
4391
+ viewBox: "0 0 24 24",
4392
+ fill: "none",
4393
+ children: [
4394
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4395
+ "rect",
4396
+ {
4397
+ x: "1",
4398
+ y: "1",
4399
+ width: "22",
4400
+ height: "22",
4401
+ rx: "11",
4402
+ stroke: "currentColor",
4403
+ strokeWidth: "2"
4404
+ }
4405
+ ),
4406
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "currentColor" })
4407
+ ]
4408
+ }
4409
+ );
4410
+ };
4411
+ RadioIcon.displayName = "RadioIcon";
4412
+
4413
+ // src/components/SelectPaymentMethod.tsx
4414
+ var import_clsx29 = __toESM(require("clsx"), 1);
4415
+
4416
+ // src/components/HorizontalDivider.tsx
4417
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4418
+ function HorizontalDivider({ id }) {
4419
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("hr", { id, className: "w-full border-t border-border-primary-normal" });
4420
+ }
4421
+
4422
+ // src/components/SelectPaymentMethod.tsx
4423
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4424
+ function SelectPaymentMethod(props) {
4425
+ const {
4426
+ selectedMethod,
4427
+ onSelectMethod,
4428
+ selectedCredits,
4429
+ allCredits,
4430
+ allowedMethods,
4431
+ selectedACHBankGuid,
4432
+ setSelectedACHBankGuid,
4433
+ customerBanks,
4434
+ onPay,
4435
+ isPayLoading
4436
+ } = props;
4437
+ function handleToggle(method) {
4438
+ onSelectMethod(method);
4439
+ }
4440
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
4441
+ !!(allCredits == null ? void 0 : allCredits.length) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4442
+ CreditsSelector,
4443
+ {
4444
+ selectedCredits: selectedCredits || [],
4445
+ allCredits: allCredits || [],
4446
+ setSelectedCredits: props.setSelectedCredits || (() => {
4447
+ })
4448
+ }
4449
+ ),
4450
+ (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4451
+ ACHSelector,
4452
+ {
4453
+ selectedMethod,
4454
+ handleToggle,
4455
+ selectedBankGuid: selectedACHBankGuid || null,
4456
+ setSelectedBankGuid: setSelectedACHBankGuid || (() => {
4457
+ }),
4458
+ customerBanks: customerBanks || [],
4459
+ onPay,
4460
+ isPayLoading: isPayLoading || false
4461
+ }
4462
+ ),
4463
+ (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4464
+ Accordion,
4465
+ {
4466
+ isOpen: selectedMethod === "CCPayment",
4467
+ title: "Pay by Credit/Debit Card",
4468
+ before: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Radio, { checked: selectedMethod === "CCPayment", readOnly: true }),
4469
+ onClick: () => handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment"),
4470
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Proceed to Payment" })
4471
+ }
4472
+ )
4473
+ ] });
4474
+ }
4475
+ function ACHSelector(props) {
4476
+ var _a;
4477
+ const {
4478
+ selectedMethod,
4479
+ handleToggle,
4480
+ selectedBankGuid,
4481
+ setSelectedBankGuid,
4482
+ customerBanks,
4483
+ onPay,
4484
+ isPayLoading
4485
+ } = props;
4486
+ const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
4487
+ (0, import_react20.useEffect)(() => {
4488
+ if (selectedMethod === "CCPayment") return setIsOpen(false);
4489
+ }, [selectedMethod]);
4490
+ (0, import_react20.useEffect)(() => {
4491
+ if (isOpen) {
4492
+ if (!selectedBankGuid) {
4493
+ setSelectedBankGuid(customerBanks[0].CustBankGUID);
4494
+ }
4495
+ handleToggle("ACHPayment");
4496
+ return;
4497
+ }
4498
+ }, [isOpen]);
4499
+ function handleBankSelect(e, bankGuid) {
4500
+ e.stopPropagation();
4501
+ setSelectedBankGuid(bankGuid);
4502
+ handleToggle("ACHPayment");
4503
+ }
4504
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4505
+ Accordion,
4506
+ {
4507
+ isOpen,
4508
+ title: selectedBankGuid ? (_a = customerBanks.find((bank) => bank.CustBankGUID === selectedBankGuid)) == null ? void 0 : _a.AccountDisplayString : "Select a Bank",
4509
+ before: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4510
+ Radio,
4511
+ {
4512
+ checked: !!selectedBankGuid && selectedMethod === "ACHPayment",
4513
+ readOnly: true
4514
+ }
4515
+ ),
4516
+ onClick: () => setIsOpen((prev) => !prev),
4517
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
4518
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4519
+ Stack,
4520
+ {
4521
+ sizing: "layout-group",
4522
+ width: "full",
4523
+ overflowY: "auto",
4524
+ maxHeight: 200,
4525
+ children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4526
+ Card,
4527
+ {
4528
+ className: (0, import_clsx29.default)(
4529
+ "transition-colors duration-300 py-desktop-compact-layout-padding cursor-pointer hover:bg-background-secondary-normal/30",
4530
+ selectedBankGuid === bank.CustBankGUID && "bg-background-secondary-normal/20"
4531
+ ),
4532
+ onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
4533
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Stack, { horizontal: true, items: "center", justify: "between", children: [
4534
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
4535
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "question_mark" }),
4536
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Paragraph, { children: bank.AccountDisplayString })
4537
+ ] }),
4538
+ selectedBankGuid === bank.CustBankGUID && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "check" })
4539
+ ] })
4540
+ },
4541
+ bank.CustBankGUID
4542
+ ))
4543
+ }
4544
+ ),
4545
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
4546
+ ] })
4547
+ }
4548
+ );
4549
+ }
4550
+ function CreditsSelector(props) {
4551
+ const { selectedCredits, allCredits, setSelectedCredits } = props;
4552
+ const [isOpen, setIsOpen] = (0, import_react20.useState)(true);
4553
+ const handleCreditSelect = (credit) => {
4554
+ if (setSelectedCredits) {
4555
+ setSelectedCredits(
4556
+ (prev) => prev.includes(credit) ? prev.filter((c) => c !== credit) : [...prev, credit]
4557
+ );
4558
+ }
4559
+ };
4560
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4561
+ Accordion,
4562
+ {
4563
+ isOpen,
4564
+ title: "Available Credits",
4565
+ onClick: () => setIsOpen((prev) => !prev),
4566
+ children: [
4567
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HorizontalDivider, {}),
4568
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4569
+ Stack,
4570
+ {
4571
+ sizing: "layout-group",
4572
+ width: "full",
4573
+ overflowY: "auto",
4574
+ maxHeight: 300,
4575
+ children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4576
+ Stack,
4577
+ {
4578
+ horizontal: true,
4579
+ justify: "between",
4580
+ items: "center",
4581
+ sizing: "layout-group",
4582
+ children: [
4583
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4584
+ Stack,
4585
+ {
4586
+ horizontal: true,
4587
+ items: "center",
4588
+ sizing: "layout-group",
4589
+ onClick: () => handleCreditSelect(credits),
4590
+ paddingY: true,
4591
+ children: [
4592
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4593
+ Checkbox,
4594
+ {
4595
+ checked: selectedCredits == null ? void 0 : selectedCredits.includes(credits),
4596
+ onChange: () => handleCreditSelect(credits)
4597
+ }
4598
+ ),
4599
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Paragraph, { children: credits.InvoiceNumber })
4600
+ ]
4601
+ }
4602
+ ),
4603
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Subheader, { className: " pr-desktop-component-padding", children: [
4604
+ "$",
4605
+ formatCurrencyDisplay(`${Math.abs(credits.InvoiceBalance)}`)
4606
+ ] })
4607
+ ]
4608
+ },
4609
+ credits.AROpenGUID
4610
+ ))
4611
+ }
4612
+ ) })
4613
+ ]
4614
+ }
4615
+ );
4616
+ }
4617
+
4618
+ // src/components/PaymentOnAccountModal.tsx
4619
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4620
+ function PaymentOnAccountModal(props) {
4621
+ const { isOpen, paymentProps, onClose } = props;
4622
+ const [amount, setAmount] = (0, import_react21.useState)(paymentProps.amountToPay);
4623
+ (0, import_react21.useEffect)(() => {
4624
+ setAmount(paymentProps.amountToPay);
4625
+ }, [paymentProps.amountToPay]);
4626
+ function handleAmountChange(event) {
4627
+ const value = event.target.value.replace(/[^0-9.-]+/g, "");
4628
+ setAmount(+value || 0);
4629
+ }
4630
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Modal, { open: isOpen, onClose, title: "Payment on Account", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
4631
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Card, { className: "py-desktop-component-padding", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Stack, { sizing: "component", justify: "between", items: "center", horizontal: true, children: [
4632
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Paragraph, { className: "w-full", children: "Amount to Pay" }),
4633
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4634
+ Input,
4635
+ {
4636
+ type: "number",
4637
+ placeholder: "$0.00",
4638
+ align: "right",
4639
+ value: amount === 0 ? "" : amount,
4640
+ onChange: handleAmountChange,
4641
+ before: "$"
4642
+ }
4643
+ ) })
4644
+ ] }) }),
4645
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectPaymentMethod, __spreadValues({}, paymentProps))
4646
+ ] }) });
4647
+ }
3599
4648
  // Annotate the CommonJS export names for ESM import in node:
3600
4649
  0 && (module.exports = {
4650
+ Accordion,
3601
4651
  Button,
4652
+ Card,
3602
4653
  Checkbox,
3603
4654
  DataCellHeader,
3604
4655
  DataGrid,
@@ -3611,6 +4662,7 @@ Tooltip.displayName = "Tooltip";
3611
4662
  Menu,
3612
4663
  MenuOption,
3613
4664
  Paragraph,
4665
+ PaymentOnAccountModal,
3614
4666
  Search,
3615
4667
  Select,
3616
4668
  Subheader,