@dmsi/wedgekit-react 0.0.86 → 0.0.88
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/{chunk-S3CQ5VFT.js → chunk-2XOQII4G.js} +1 -1
- package/dist/{chunk-TVDFTRGL.js → chunk-3JRVV6QY.js} +1 -1
- package/dist/{chunk-4N2PED4P.js → chunk-3NWBR3V3.js} +1 -1
- package/dist/chunk-5OHGKW4U.js +9 -0
- package/dist/chunk-5UH6QUFB.js +38 -0
- package/dist/{chunk-QUPHLL7D.js → chunk-6CS5ZBXO.js} +1 -1
- package/dist/{chunk-OW3SZEU5.js → chunk-EO3JJWFW.js} +4 -1
- package/dist/{chunk-SAMX4YGM.js → chunk-IMN6I5NV.js} +1 -1
- package/dist/chunk-JOMM4KBH.js +26 -0
- package/dist/{chunk-MZJS2ZAU.js → chunk-L364HTYC.js} +2 -1
- package/dist/{chunk-CKSDMI2Q.js → chunk-LYVH4YFE.js} +2 -2
- package/dist/{chunk-LP6AZST2.js → chunk-OB3URVCR.js} +1 -1
- package/dist/chunk-QDFQ3B4N.js +87 -0
- package/dist/{chunk-MQWWNAO3.js → chunk-QIHDPSOM.js} +4 -4
- package/dist/{chunk-724LJWFR.js → chunk-R5TLUWDD.js} +5 -35
- package/dist/chunk-RHADESKO.js +57 -0
- package/dist/chunk-SASEP5UE.js +235 -0
- package/dist/chunk-TTO4PL7Y.js +135 -0
- package/dist/{chunk-2BVSUYXU.js → chunk-Y4HUYAI5.js} +1 -1
- package/dist/components/Accordion.cjs +529 -0
- package/dist/components/Accordion.js +13 -0
- package/dist/components/Button.cjs +2 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Card.cjs +83 -0
- package/dist/components/Card.js +7 -0
- package/dist/components/ContentTab.cjs +2 -1
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +2 -1
- package/dist/components/ContentTabs.js +2 -2
- package/dist/components/DataGridCell.js +7 -6
- package/dist/components/DateInput.js +2 -1
- package/dist/components/DateRangeInput.js +2 -1
- package/dist/components/FilterGroup.cjs +2 -1
- package/dist/components/FilterGroup.js +6 -5
- package/dist/components/HorizontalDivider.js +3 -6
- package/dist/components/Input.js +2 -1
- package/dist/components/MenuOption.js +2 -2
- package/dist/components/MobileDataGrid.cjs +134 -133
- package/dist/components/MobileDataGrid.js +4 -4
- package/dist/components/Modal.cjs +2 -1
- package/dist/components/Modal.js +4 -4
- package/dist/components/ModalButtons.cjs +2 -1
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalHeader.cjs +2 -1
- package/dist/components/ModalHeader.js +2 -2
- package/dist/components/NavigationTab.cjs +2 -1
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.cjs +2 -1
- package/dist/components/NavigationTabs.js +2 -2
- package/dist/components/NestedMenu.js +2 -2
- package/dist/components/Notification.cjs +3 -2
- package/dist/components/Notification.js +4 -4
- package/dist/components/OptionPill.cjs +2 -1
- package/dist/components/OptionPill.js +2 -2
- package/dist/components/PDFViewer.cjs +2 -1
- package/dist/components/PDFViewer.js +4 -4
- package/dist/components/Password.js +2 -1
- package/dist/components/PaymentOnAccountModal.cjs +2132 -0
- package/dist/components/PaymentOnAccountModal.js +31 -0
- package/dist/components/Radio.js +5 -130
- package/dist/components/Search.js +3 -2
- package/dist/components/Select.js +3 -2
- package/dist/components/SelectPaymentMethod.cjs +1170 -0
- package/dist/components/SelectPaymentMethod.js +20 -0
- package/dist/components/SideMenuGroup.cjs +1 -1
- package/dist/components/SideMenuGroup.js +3 -3
- package/dist/components/SideMenuItem.cjs +1 -1
- package/dist/components/SideMenuItem.js +1 -1
- package/dist/components/Stack.cjs +132 -4
- package/dist/components/Stack.js +2 -1
- package/dist/components/Stepper.cjs +2 -1
- package/dist/components/Stepper.js +3 -2
- package/dist/components/Swatch.cjs +1 -1
- package/dist/components/Swatch.js +5 -5
- package/dist/components/Time.cjs +1 -1
- package/dist/components/Time.js +5 -4
- package/dist/components/Toast.cjs +2 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/Upload.cjs +2 -1
- package/dist/components/Upload.js +1 -1
- package/dist/components/index.cjs +1053 -1
- package/dist/components/index.js +35 -11
- package/dist/index.css +42 -0
- package/package.json +1 -1
- package/src/components/Accordion.tsx +84 -0
- package/src/components/Button.tsx +2 -1
- package/src/components/Card.tsx +17 -0
- package/src/components/PaymentOnAccountModal.tsx +52 -0
- package/src/components/SelectPaymentMethod.tsx +263 -0
- package/src/components/Stack.tsx +2 -3
- package/src/components/index.ts +3 -0
- package/dist/{chunk-UPBBOZM3.js → chunk-VH3EJNVE.js} +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/components/HorizontalDivider.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function HorizontalDivider({ id }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("hr", { id, className: "w-full border-t border-border-primary-normal" });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
HorizontalDivider
|
|
9
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/utils/formatting.tsx
|
|
2
|
+
function getDecimalPlaceholder(decimals) {
|
|
3
|
+
if (!decimals || decimals <= 0) {
|
|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
placeholder: `0.${"0".repeat(decimals)}`
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function formatDecimalValue(value, decimals) {
|
|
11
|
+
if (!value || value === "") {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
15
|
+
if (isNaN(numValue)) {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
if (!decimals || decimals <= 0) {
|
|
19
|
+
return String(Math.round(numValue));
|
|
20
|
+
}
|
|
21
|
+
return numValue.toFixed(decimals);
|
|
22
|
+
}
|
|
23
|
+
function formatCurrencyDisplay(value) {
|
|
24
|
+
if (!value || value === "") {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
const parts = value.split(".");
|
|
28
|
+
const integerPart = parts[0];
|
|
29
|
+
const decimalPart = parts[1];
|
|
30
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
31
|
+
return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
getDecimalPlaceholder,
|
|
36
|
+
formatDecimalValue,
|
|
37
|
+
formatCurrencyDisplay
|
|
38
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
paddingYUsingLayoutGroupGap
|
|
3
|
+
} from "./chunk-RDLEIAQU.js";
|
|
1
4
|
import {
|
|
2
5
|
__objRest,
|
|
3
6
|
__spreadProps,
|
|
@@ -149,7 +152,7 @@ var Stack = (_a) => {
|
|
|
149
152
|
paddingX && sizing === "component" && "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
|
|
150
153
|
paddingY && sizing === "container" && "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding",
|
|
151
154
|
paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
|
|
152
|
-
paddingY && sizing === "layout-group" &&
|
|
155
|
+
paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
|
|
153
156
|
paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
|
|
154
157
|
margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
|
|
155
158
|
marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-ORMEWXMH.js";
|
|
6
|
+
|
|
7
|
+
// src/components/Card.tsx
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
function Card(props) {
|
|
11
|
+
const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"div",
|
|
14
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
15
|
+
className: clsx(
|
|
16
|
+
"border rounded-sm border-border-primary-normal p-desktop-layout-padding",
|
|
17
|
+
rest.className
|
|
18
|
+
),
|
|
19
|
+
children
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
Card
|
|
26
|
+
};
|
|
@@ -129,7 +129,7 @@ var Button = (_a) => {
|
|
|
129
129
|
componentPaddingXUsingComponentGap,
|
|
130
130
|
typography.buttonLabel
|
|
131
131
|
);
|
|
132
|
-
const Element = href ? "a" : as;
|
|
132
|
+
const Element = href && !as ? "a" : as;
|
|
133
133
|
return /* @__PURE__ */ jsxs(
|
|
134
134
|
Element,
|
|
135
135
|
__spreadProps(__spreadValues({
|
|
@@ -137,6 +137,7 @@ var Button = (_a) => {
|
|
|
137
137
|
type: Element === "button" ? "button" : void 0,
|
|
138
138
|
className: buttonClasses
|
|
139
139
|
}, props), {
|
|
140
|
+
onClick: props.onClick,
|
|
140
141
|
disabled,
|
|
141
142
|
href,
|
|
142
143
|
children: [
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-5GUW4DUY.js";
|
|
7
7
|
import {
|
|
8
8
|
MenuOption
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VH3EJNVE.js";
|
|
10
10
|
import {
|
|
11
11
|
Search
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OB3URVCR.js";
|
|
13
13
|
import {
|
|
14
14
|
CSS
|
|
15
15
|
} from "./chunk-WVUIIBRR.js";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Stack
|
|
3
|
+
} from "./chunk-EO3JJWFW.js";
|
|
4
|
+
import {
|
|
5
|
+
Card
|
|
6
|
+
} from "./chunk-JOMM4KBH.js";
|
|
7
|
+
import {
|
|
8
|
+
Paragraph
|
|
9
|
+
} from "./chunk-VG4EPHJA.js";
|
|
10
|
+
import {
|
|
11
|
+
Icon
|
|
12
|
+
} from "./chunk-IGQVA7SC.js";
|
|
13
|
+
import {
|
|
14
|
+
typography
|
|
15
|
+
} from "./chunk-RDLEIAQU.js";
|
|
16
|
+
|
|
17
|
+
// src/components/Accordion.tsx
|
|
18
|
+
import clsx from "clsx";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
function Accordion(props) {
|
|
21
|
+
const { isOpen, onClick, className } = props;
|
|
22
|
+
const {
|
|
23
|
+
title,
|
|
24
|
+
before,
|
|
25
|
+
after = /* @__PURE__ */ jsx(
|
|
26
|
+
Icon,
|
|
27
|
+
{
|
|
28
|
+
name: "expand_more",
|
|
29
|
+
className: clsx(
|
|
30
|
+
"text-icon-primary-normal transform transition-all duration-300 ease-in-out",
|
|
31
|
+
isOpen ? "rotate-180" : "rotate-0"
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
children
|
|
36
|
+
} = props;
|
|
37
|
+
function handleClick(e) {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
onClick == null ? void 0 : onClick();
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
Card,
|
|
44
|
+
{
|
|
45
|
+
className: clsx(
|
|
46
|
+
"overflow-hidden select-none cursor-pointer",
|
|
47
|
+
className,
|
|
48
|
+
isOpen && "border-2 !border-border-primary-focus"
|
|
49
|
+
),
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxs(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
|
|
54
|
+
before,
|
|
55
|
+
typeof title === "string" ? /* @__PURE__ */ jsx(Paragraph, { className: "text-text-primary-normal", children: title }) : title
|
|
56
|
+
] }),
|
|
57
|
+
after
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: clsx("grid transition-all duration-300 ease-in-out"),
|
|
63
|
+
style: {
|
|
64
|
+
gridTemplateRows: isOpen ? "1fr" : "0fr"
|
|
65
|
+
},
|
|
66
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: clsx(
|
|
70
|
+
typography.paragraph,
|
|
71
|
+
"text-text-primary-normal desktop:pt-desktop-layout-gap",
|
|
72
|
+
"flex flex-col gap-desktop-layout-gap"
|
|
73
|
+
),
|
|
74
|
+
onClick: (e) => e.stopPropagation(),
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
Accordion
|
|
87
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useMounted
|
|
3
3
|
} from "./chunk-4RJKB7LC.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalButtons
|
|
6
|
+
} from "./chunk-6CS5ZBXO.js";
|
|
4
7
|
import {
|
|
5
8
|
ModalContent
|
|
6
9
|
} from "./chunk-FWPJ73IK.js";
|
|
7
10
|
import {
|
|
8
11
|
ModalHeader
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3JRVV6QY.js";
|
|
10
13
|
import {
|
|
11
14
|
ModalScrim
|
|
12
15
|
} from "./chunk-4JLU7TAC.js";
|
|
13
|
-
import {
|
|
14
|
-
ModalButtons
|
|
15
|
-
} from "./chunk-QUPHLL7D.js";
|
|
16
16
|
import {
|
|
17
17
|
useMatchesMobile
|
|
18
18
|
} from "./chunk-WNQ53SVY.js";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatCurrencyDisplay,
|
|
3
|
+
formatDecimalValue,
|
|
4
|
+
getDecimalPlaceholder
|
|
5
|
+
} from "./chunk-5UH6QUFB.js";
|
|
1
6
|
import {
|
|
2
7
|
Label
|
|
3
8
|
} from "./chunk-S5K22XTH.js";
|
|
@@ -24,41 +29,6 @@ import {
|
|
|
24
29
|
useState
|
|
25
30
|
} from "react";
|
|
26
31
|
import clsx from "clsx";
|
|
27
|
-
|
|
28
|
-
// src/utils/formatting.tsx
|
|
29
|
-
function getDecimalPlaceholder(decimals) {
|
|
30
|
-
if (!decimals || decimals <= 0) {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
placeholder: `0.${"0".repeat(decimals)}`
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function formatDecimalValue(value, decimals) {
|
|
38
|
-
if (!value || value === "") {
|
|
39
|
-
return "";
|
|
40
|
-
}
|
|
41
|
-
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
42
|
-
if (isNaN(numValue)) {
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
if (!decimals || decimals <= 0) {
|
|
46
|
-
return String(Math.round(numValue));
|
|
47
|
-
}
|
|
48
|
-
return numValue.toFixed(decimals);
|
|
49
|
-
}
|
|
50
|
-
function formatCurrencyDisplay(value) {
|
|
51
|
-
if (!value || value === "") {
|
|
52
|
-
return "";
|
|
53
|
-
}
|
|
54
|
-
const parts = value.split(".");
|
|
55
|
-
const integerPart = parts[0];
|
|
56
|
-
const decimalPart = parts[1];
|
|
57
|
-
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
58
|
-
return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// src/components/Input.tsx
|
|
62
32
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
63
33
|
var InputBase = (_a) => {
|
|
64
34
|
var _b = _a, {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectPaymentMethod
|
|
3
|
+
} from "./chunk-SASEP5UE.js";
|
|
4
|
+
import {
|
|
5
|
+
Modal
|
|
6
|
+
} from "./chunk-QIHDPSOM.js";
|
|
7
|
+
import {
|
|
8
|
+
Input
|
|
9
|
+
} from "./chunk-R5TLUWDD.js";
|
|
10
|
+
import {
|
|
11
|
+
Stack
|
|
12
|
+
} from "./chunk-EO3JJWFW.js";
|
|
13
|
+
import {
|
|
14
|
+
Card
|
|
15
|
+
} from "./chunk-JOMM4KBH.js";
|
|
16
|
+
import {
|
|
17
|
+
Paragraph
|
|
18
|
+
} from "./chunk-VG4EPHJA.js";
|
|
19
|
+
import {
|
|
20
|
+
__spreadValues
|
|
21
|
+
} from "./chunk-ORMEWXMH.js";
|
|
22
|
+
|
|
23
|
+
// src/components/PaymentOnAccountModal.tsx
|
|
24
|
+
import { useEffect, useState } from "react";
|
|
25
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
function PaymentOnAccountModal(props) {
|
|
27
|
+
const { isOpen, paymentProps, onClose } = props;
|
|
28
|
+
const [amount, setAmount] = useState(paymentProps.amountToPay);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setAmount(paymentProps.amountToPay);
|
|
31
|
+
}, [paymentProps.amountToPay]);
|
|
32
|
+
function handleAmountChange(event) {
|
|
33
|
+
const value = event.target.value.replace(/[^0-9.-]+/g, "");
|
|
34
|
+
setAmount(+value || 0);
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ jsx(Modal, { open: isOpen, onClose, title: "Payment on Account", children: /* @__PURE__ */ jsxs(Stack, { sizing: "layout-group", width: "full", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Card, { className: "py-desktop-component-padding", children: /* @__PURE__ */ jsxs(Stack, { sizing: "component", justify: "between", items: "center", horizontal: true, children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Paragraph, { className: "w-full", children: "Amount to Pay" }),
|
|
39
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
40
|
+
Input,
|
|
41
|
+
{
|
|
42
|
+
type: "number",
|
|
43
|
+
placeholder: "$0.00",
|
|
44
|
+
align: "right",
|
|
45
|
+
value: amount === 0 ? "" : amount,
|
|
46
|
+
onChange: handleAmountChange,
|
|
47
|
+
before: "$"
|
|
48
|
+
}
|
|
49
|
+
) })
|
|
50
|
+
] }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(SelectPaymentMethod, __spreadValues({}, paymentProps))
|
|
52
|
+
] }) });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
PaymentOnAccountModal
|
|
57
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Radio
|
|
3
|
+
} from "./chunk-TTO4PL7Y.js";
|
|
4
|
+
import {
|
|
5
|
+
HorizontalDivider
|
|
6
|
+
} from "./chunk-5OHGKW4U.js";
|
|
7
|
+
import {
|
|
8
|
+
Checkbox
|
|
9
|
+
} from "./chunk-WT5XXW6G.js";
|
|
10
|
+
import {
|
|
11
|
+
formatCurrencyDisplay
|
|
12
|
+
} from "./chunk-5UH6QUFB.js";
|
|
13
|
+
import {
|
|
14
|
+
Subheader
|
|
15
|
+
} from "./chunk-O4M2GISS.js";
|
|
16
|
+
import {
|
|
17
|
+
Accordion
|
|
18
|
+
} from "./chunk-QDFQ3B4N.js";
|
|
19
|
+
import {
|
|
20
|
+
Stack
|
|
21
|
+
} from "./chunk-EO3JJWFW.js";
|
|
22
|
+
import {
|
|
23
|
+
Card
|
|
24
|
+
} from "./chunk-JOMM4KBH.js";
|
|
25
|
+
import {
|
|
26
|
+
Paragraph
|
|
27
|
+
} from "./chunk-VG4EPHJA.js";
|
|
28
|
+
import {
|
|
29
|
+
Button
|
|
30
|
+
} from "./chunk-L364HTYC.js";
|
|
31
|
+
import {
|
|
32
|
+
Icon
|
|
33
|
+
} from "./chunk-IGQVA7SC.js";
|
|
34
|
+
|
|
35
|
+
// src/components/SelectPaymentMethod.tsx
|
|
36
|
+
import { useEffect, useState } from "react";
|
|
37
|
+
import clsx from "clsx";
|
|
38
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
|
+
function SelectPaymentMethod(props) {
|
|
40
|
+
const {
|
|
41
|
+
selectedMethod,
|
|
42
|
+
onSelectMethod,
|
|
43
|
+
selectedCredits,
|
|
44
|
+
allCredits,
|
|
45
|
+
allowedMethods,
|
|
46
|
+
selectedACHBankGuid,
|
|
47
|
+
setSelectedACHBankGuid,
|
|
48
|
+
customerBanks,
|
|
49
|
+
onPay,
|
|
50
|
+
isPayLoading
|
|
51
|
+
} = props;
|
|
52
|
+
function handleToggle(method) {
|
|
53
|
+
onSelectMethod(method);
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ jsxs(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
|
|
56
|
+
!!(allCredits == null ? void 0 : allCredits.length) && /* @__PURE__ */ jsx(
|
|
57
|
+
CreditsSelector,
|
|
58
|
+
{
|
|
59
|
+
selectedCredits: selectedCredits || [],
|
|
60
|
+
allCredits: allCredits || [],
|
|
61
|
+
setSelectedCredits: props.setSelectedCredits || (() => {
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
(allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ jsx(
|
|
66
|
+
ACHSelector,
|
|
67
|
+
{
|
|
68
|
+
selectedMethod,
|
|
69
|
+
handleToggle,
|
|
70
|
+
selectedBankGuid: selectedACHBankGuid || null,
|
|
71
|
+
setSelectedBankGuid: setSelectedACHBankGuid || (() => {
|
|
72
|
+
}),
|
|
73
|
+
customerBanks: customerBanks || [],
|
|
74
|
+
onPay,
|
|
75
|
+
isPayLoading: isPayLoading || false
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
(allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ jsx(
|
|
79
|
+
Accordion,
|
|
80
|
+
{
|
|
81
|
+
isOpen: selectedMethod === "CCPayment",
|
|
82
|
+
title: "Pay by Credit/Debit Card",
|
|
83
|
+
before: /* @__PURE__ */ jsx(Radio, { checked: selectedMethod === "CCPayment", readOnly: true }),
|
|
84
|
+
onClick: () => handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment"),
|
|
85
|
+
children: /* @__PURE__ */ jsx(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Proceed to Payment" })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
function ACHSelector(props) {
|
|
91
|
+
var _a;
|
|
92
|
+
const {
|
|
93
|
+
selectedMethod,
|
|
94
|
+
handleToggle,
|
|
95
|
+
selectedBankGuid,
|
|
96
|
+
setSelectedBankGuid,
|
|
97
|
+
customerBanks,
|
|
98
|
+
onPay,
|
|
99
|
+
isPayLoading
|
|
100
|
+
} = props;
|
|
101
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (selectedMethod === "CCPayment") return setIsOpen(false);
|
|
104
|
+
}, [selectedMethod]);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (isOpen) {
|
|
107
|
+
if (!selectedBankGuid) {
|
|
108
|
+
setSelectedBankGuid(customerBanks[0].CustBankGUID);
|
|
109
|
+
}
|
|
110
|
+
handleToggle("ACHPayment");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}, [isOpen]);
|
|
114
|
+
function handleBankSelect(e, bankGuid) {
|
|
115
|
+
e.stopPropagation();
|
|
116
|
+
setSelectedBankGuid(bankGuid);
|
|
117
|
+
handleToggle("ACHPayment");
|
|
118
|
+
}
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
Accordion,
|
|
121
|
+
{
|
|
122
|
+
isOpen,
|
|
123
|
+
title: selectedBankGuid ? (_a = customerBanks.find((bank) => bank.CustBankGUID === selectedBankGuid)) == null ? void 0 : _a.AccountDisplayString : "Select a Bank",
|
|
124
|
+
before: /* @__PURE__ */ jsx(
|
|
125
|
+
Radio,
|
|
126
|
+
{
|
|
127
|
+
checked: !!selectedBankGuid && selectedMethod === "ACHPayment",
|
|
128
|
+
readOnly: true
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
132
|
+
children: /* @__PURE__ */ jsxs(Stack, { sizing: "layout-group", width: "full", children: [
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
Stack,
|
|
135
|
+
{
|
|
136
|
+
sizing: "layout-group",
|
|
137
|
+
width: "full",
|
|
138
|
+
overflowY: "auto",
|
|
139
|
+
maxHeight: 200,
|
|
140
|
+
children: customerBanks.map((bank) => /* @__PURE__ */ jsx(
|
|
141
|
+
Card,
|
|
142
|
+
{
|
|
143
|
+
className: clsx(
|
|
144
|
+
"transition-colors duration-300 py-desktop-compact-layout-padding cursor-pointer hover:bg-background-secondary-normal/30",
|
|
145
|
+
selectedBankGuid === bank.CustBankGUID && "bg-background-secondary-normal/20"
|
|
146
|
+
),
|
|
147
|
+
onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
|
|
148
|
+
children: /* @__PURE__ */ jsxs(Stack, { horizontal: true, items: "center", justify: "between", children: [
|
|
149
|
+
/* @__PURE__ */ jsxs(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
|
|
150
|
+
/* @__PURE__ */ jsx(Icon, { name: "question_mark" }),
|
|
151
|
+
/* @__PURE__ */ jsx(Paragraph, { children: bank.AccountDisplayString })
|
|
152
|
+
] }),
|
|
153
|
+
selectedBankGuid === bank.CustBankGUID && /* @__PURE__ */ jsx(Icon, { name: "check" })
|
|
154
|
+
] })
|
|
155
|
+
},
|
|
156
|
+
bank.CustBankGUID
|
|
157
|
+
))
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ jsx(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
|
|
161
|
+
] })
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function CreditsSelector(props) {
|
|
166
|
+
const { selectedCredits, allCredits, setSelectedCredits } = props;
|
|
167
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
168
|
+
const handleCreditSelect = (credit) => {
|
|
169
|
+
if (setSelectedCredits) {
|
|
170
|
+
setSelectedCredits(
|
|
171
|
+
(prev) => prev.includes(credit) ? prev.filter((c) => c !== credit) : [...prev, credit]
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
return /* @__PURE__ */ jsxs(
|
|
176
|
+
Accordion,
|
|
177
|
+
{
|
|
178
|
+
isOpen,
|
|
179
|
+
title: "Available Credits",
|
|
180
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsx(HorizontalDivider, {}),
|
|
183
|
+
/* @__PURE__ */ jsx(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ jsx(
|
|
184
|
+
Stack,
|
|
185
|
+
{
|
|
186
|
+
sizing: "layout-group",
|
|
187
|
+
width: "full",
|
|
188
|
+
overflowY: "auto",
|
|
189
|
+
maxHeight: 300,
|
|
190
|
+
children: allCredits.map((credits) => /* @__PURE__ */ jsxs(
|
|
191
|
+
Stack,
|
|
192
|
+
{
|
|
193
|
+
horizontal: true,
|
|
194
|
+
justify: "between",
|
|
195
|
+
items: "center",
|
|
196
|
+
sizing: "layout-group",
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsxs(
|
|
199
|
+
Stack,
|
|
200
|
+
{
|
|
201
|
+
horizontal: true,
|
|
202
|
+
items: "center",
|
|
203
|
+
sizing: "layout-group",
|
|
204
|
+
onClick: () => handleCreditSelect(credits),
|
|
205
|
+
paddingY: true,
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsx(
|
|
208
|
+
Checkbox,
|
|
209
|
+
{
|
|
210
|
+
checked: selectedCredits == null ? void 0 : selectedCredits.includes(credits),
|
|
211
|
+
onChange: () => handleCreditSelect(credits)
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ jsx(Paragraph, { children: credits.InvoiceNumber })
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsxs(Subheader, { className: " pr-desktop-component-padding", children: [
|
|
219
|
+
"$",
|
|
220
|
+
formatCurrencyDisplay(`${Math.abs(credits.InvoiceBalance)}`)
|
|
221
|
+
] })
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
credits.AROpenGUID
|
|
225
|
+
))
|
|
226
|
+
}
|
|
227
|
+
) })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export {
|
|
234
|
+
SelectPaymentMethod
|
|
235
|
+
};
|