@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.
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
@@ -3,7 +3,20 @@ import {
3
3
  } from "../chunk-QZGUMB7T.js";
4
4
  import {
5
5
  Select
6
- } from "../chunk-2BVSUYXU.js";
6
+ } from "../chunk-Y4HUYAI5.js";
7
+ import {
8
+ PaymentOnAccountModal
9
+ } from "../chunk-RHADESKO.js";
10
+ import "../chunk-SASEP5UE.js";
11
+ import "../chunk-TTO4PL7Y.js";
12
+ import "../chunk-QIHDPSOM.js";
13
+ import "../chunk-4RJKB7LC.js";
14
+ import "../chunk-6CS5ZBXO.js";
15
+ import "../chunk-FWPJ73IK.js";
16
+ import "../chunk-3JRVV6QY.js";
17
+ import "../chunk-4JLU7TAC.js";
18
+ import "../chunk-J6LETUNM.js";
19
+ import "../chunk-5OHGKW4U.js";
7
20
  import {
8
21
  Checkbox
9
22
  } from "../chunk-WT5XXW6G.js";
@@ -12,37 +25,45 @@ import {
12
25
  DataGridCell,
13
26
  DragAlongCell,
14
27
  DraggableCellHeader
15
- } from "../chunk-CKSDMI2Q.js";
28
+ } from "../chunk-LYVH4YFE.js";
16
29
  import {
17
30
  Menu
18
31
  } from "../chunk-37TJJQL3.js";
19
32
  import "../chunk-5GUW4DUY.js";
20
33
  import {
21
34
  MenuOption
22
- } from "../chunk-UPBBOZM3.js";
35
+ } from "../chunk-VH3EJNVE.js";
23
36
  import {
24
37
  useInfiniteScroll
25
38
  } from "../chunk-WNQ53SVY.js";
39
+ import "../chunk-4T7F5BZZ.js";
26
40
  import {
27
41
  Search
28
- } from "../chunk-LP6AZST2.js";
29
- import {
30
- Paragraph
31
- } from "../chunk-VG4EPHJA.js";
32
- import "../chunk-WVUIIBRR.js";
33
- import "../chunk-4T7F5BZZ.js";
42
+ } from "../chunk-OB3URVCR.js";
34
43
  import {
35
44
  Input
36
- } from "../chunk-724LJWFR.js";
45
+ } from "../chunk-R5TLUWDD.js";
46
+ import "../chunk-5UH6QUFB.js";
37
47
  import {
38
48
  Label
39
49
  } from "../chunk-S5K22XTH.js";
50
+ import "../chunk-WVUIIBRR.js";
40
51
  import {
41
52
  Subheader
42
53
  } from "../chunk-O4M2GISS.js";
54
+ import {
55
+ Accordion
56
+ } from "../chunk-QDFQ3B4N.js";
57
+ import "../chunk-EO3JJWFW.js";
58
+ import {
59
+ Card
60
+ } from "../chunk-JOMM4KBH.js";
61
+ import {
62
+ Paragraph
63
+ } from "../chunk-VG4EPHJA.js";
43
64
  import {
44
65
  Button
45
- } from "../chunk-MZJS2ZAU.js";
66
+ } from "../chunk-L364HTYC.js";
46
67
  import {
47
68
  Icon
48
69
  } from "../chunk-IGQVA7SC.js";
@@ -1043,7 +1064,9 @@ function adaptTableStateSetter(setter) {
1043
1064
  };
1044
1065
  }
1045
1066
  export {
1067
+ Accordion,
1046
1068
  Button,
1069
+ Card,
1047
1070
  Checkbox,
1048
1071
  DataCellHeader,
1049
1072
  DataGrid,
@@ -1056,6 +1079,7 @@ export {
1056
1079
  Menu,
1057
1080
  MenuOption,
1058
1081
  Paragraph,
1082
+ PaymentOnAccountModal,
1059
1083
  Search,
1060
1084
  Select,
1061
1085
  Subheader,
package/dist/index.css CHANGED
@@ -899,6 +899,9 @@
899
899
  --tw-translate-y: calc(2/4 * 100%);
900
900
  translate: var(--tw-translate-x) var(--tw-translate-y);
901
901
  }
902
+ .rotate-0 {
903
+ rotate: 0deg;
904
+ }
902
905
  .rotate-180 {
903
906
  rotate: 180deg;
904
907
  }
@@ -1016,6 +1019,9 @@
1016
1019
  .gap-desktop-component-gap {
1017
1020
  gap: var(--spacing-desktop-component-gap);
1018
1021
  }
1022
+ .gap-desktop-layout-gap {
1023
+ gap: var(--spacing-desktop-layout-gap);
1024
+ }
1019
1025
  .gap-desktop-layout-padding {
1020
1026
  gap: var(--spacing-desktop-layout-padding);
1021
1027
  }
@@ -1227,6 +1233,9 @@
1227
1233
  --tw-border-style: solid;
1228
1234
  border-style: solid;
1229
1235
  }
1236
+ .\!border-border-primary-focus {
1237
+ border-color: var(--color-border-primary-focus) !important;
1238
+ }
1230
1239
  .border-action-400 {
1231
1240
  border-color: var(--color-action-400);
1232
1241
  }
@@ -1374,6 +1383,12 @@
1374
1383
  .bg-background-secondary-normal {
1375
1384
  background-color: var(--color-background-secondary-normal);
1376
1385
  }
1386
+ .bg-background-secondary-normal\/20 {
1387
+ background-color: color-mix(in srgb, #c1c1c1 20%, transparent);
1388
+ @supports (color: color-mix(in lab, red, red)) {
1389
+ background-color: color-mix(in oklab, var(--color-background-secondary-normal) 20%, transparent);
1390
+ }
1391
+ }
1377
1392
  .bg-background-success-normal {
1378
1393
  background-color: var(--color-background-success-normal);
1379
1394
  }
@@ -1785,6 +1800,9 @@
1785
1800
  .p-\[calc\(var\(--spacing-mobile-component-padding\)_-_2px\)\] {
1786
1801
  padding: calc(var(--spacing-mobile-component-padding) - 2px);
1787
1802
  }
1803
+ .p-desktop-layout-padding {
1804
+ padding: var(--spacing-desktop-layout-padding);
1805
+ }
1788
1806
  .p-mobile-component-gap {
1789
1807
  padding: var(--spacing-mobile-component-gap);
1790
1808
  }
@@ -1854,6 +1872,12 @@
1854
1872
  .py-\[calc\(var\(--spacing-mobile-component-padding\)_\+_3px\)\] {
1855
1873
  padding-block: calc(var(--spacing-mobile-component-padding) + 3px);
1856
1874
  }
1875
+ .py-desktop-compact-layout-padding {
1876
+ padding-block: var(--spacing-desktop-compact-layout-padding);
1877
+ }
1878
+ .py-desktop-component-padding {
1879
+ padding-block: var(--spacing-desktop-component-padding);
1880
+ }
1857
1881
  .py-mobile-component-gap {
1858
1882
  padding-block: var(--spacing-mobile-component-gap);
1859
1883
  }
@@ -1872,6 +1896,9 @@
1872
1896
  .pt-\[7px\] {
1873
1897
  padding-top: 7px;
1874
1898
  }
1899
+ .pr-desktop-component-padding {
1900
+ padding-right: var(--spacing-desktop-component-padding);
1901
+ }
1875
1902
  .pb-2 {
1876
1903
  padding-bottom: calc(var(--spacing) * 2);
1877
1904
  }
@@ -2841,6 +2868,16 @@
2841
2868
  }
2842
2869
  }
2843
2870
  }
2871
+ .hover\:bg-background-secondary-normal\/30 {
2872
+ &:hover {
2873
+ @media (hover: hover) {
2874
+ background-color: color-mix(in srgb, #c1c1c1 30%, transparent);
2875
+ @supports (color: color-mix(in lab, red, red)) {
2876
+ background-color: color-mix(in oklab, var(--color-background-secondary-normal) 30%, transparent);
2877
+ }
2878
+ }
2879
+ }
2880
+ }
2844
2881
  .hover\:bg-border-action-hover {
2845
2882
  &:hover {
2846
2883
  @media (hover: hover) {
@@ -4016,6 +4053,11 @@
4016
4053
  padding-block: var(--spacing-desktop-layout-padding);
4017
4054
  }
4018
4055
  }
4056
+ .desktop\:pt-desktop-layout-gap {
4057
+ @container root (width >= 48rem) {
4058
+ padding-top: var(--spacing-desktop-layout-gap);
4059
+ }
4060
+ }
4019
4061
  .desktop\:pb-desktop-component-padding {
4020
4062
  @container root (width >= 48rem) {
4021
4063
  padding-bottom: var(--spacing-desktop-component-padding);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.86",
4
+ "version": "0.0.88",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -0,0 +1,84 @@
1
+ "use client";
2
+
3
+ import clsx from "clsx";
4
+ import { typography } from "../classNames";
5
+ import { Card } from "./Card";
6
+ import { Icon } from "./Icon";
7
+ import { Stack } from "./Stack";
8
+ import { Paragraph } from "./Paragraph";
9
+
10
+ interface AccordionProps {
11
+ title: React.ReactNode;
12
+ children: React.ReactNode;
13
+ isOpen: boolean;
14
+ before?: React.ReactNode;
15
+ after?: React.ReactNode;
16
+ onClick?: () => void;
17
+ className?: string;
18
+ }
19
+
20
+ export function Accordion(props: AccordionProps) {
21
+ const { isOpen, onClick, className } = props;
22
+ const {
23
+ title,
24
+ before,
25
+ after = (
26
+ <Icon
27
+ name="expand_more"
28
+ className={clsx(
29
+ "text-icon-primary-normal transform transition-all duration-300 ease-in-out",
30
+ isOpen ? "rotate-180" : "rotate-0",
31
+ )}
32
+ />
33
+ ),
34
+ children,
35
+ } = props;
36
+
37
+ function handleClick(e: React.MouseEvent<HTMLDivElement>) {
38
+ e.stopPropagation();
39
+ e.preventDefault();
40
+ onClick?.();
41
+ }
42
+
43
+ return (
44
+ <Card
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
+ >
52
+ <Stack sizing="component" horizontal justify="between" items="center">
53
+ <Stack sizing="layout-group" horizontal items="center">
54
+ {before}
55
+ {typeof title === "string" ? (
56
+ <Paragraph className="text-text-primary-normal">{title}</Paragraph>
57
+ ) : (
58
+ title
59
+ )}
60
+ </Stack>
61
+ {after}
62
+ </Stack>
63
+ <div
64
+ className={clsx("grid transition-all duration-300 ease-in-out")}
65
+ style={{
66
+ gridTemplateRows: isOpen ? "1fr" : "0fr",
67
+ }}
68
+ >
69
+ <div className="overflow-hidden">
70
+ <div
71
+ className={clsx(
72
+ typography.paragraph,
73
+ "text-text-primary-normal desktop:pt-desktop-layout-gap",
74
+ "flex flex-col gap-desktop-layout-gap",
75
+ )}
76
+ onClick={(e) => e.stopPropagation()}
77
+ >
78
+ {children}
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </Card>
83
+ );
84
+ }
@@ -187,7 +187,7 @@ export const Button = ({
187
187
  typography.buttonLabel,
188
188
  );
189
189
 
190
- const Element = href ? "a" : as;
190
+ const Element = href && !as ? "a" : as;
191
191
 
192
192
  return (
193
193
  <Element
@@ -195,6 +195,7 @@ export const Button = ({
195
195
  type={Element === "button" ? "button" : undefined}
196
196
  className={buttonClasses}
197
197
  {...props}
198
+ onClick={props.onClick}
198
199
  disabled={disabled}
199
200
  href={href}
200
201
  >
@@ -0,0 +1,17 @@
1
+ import clsx from "clsx";
2
+ import { HTMLProps } from "react";
3
+
4
+ export function Card(props: HTMLProps<HTMLDivElement>) {
5
+ const { children, ...rest } = props;
6
+ return (
7
+ <div
8
+ {...rest}
9
+ className={clsx(
10
+ "border rounded-sm border-border-primary-normal p-desktop-layout-padding",
11
+ rest.className,
12
+ )}
13
+ >
14
+ {children}
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,52 @@
1
+ import { Modal } from "./Modal";
2
+ import { Stack } from "./Stack";
3
+ import { Paragraph } from "./Paragraph";
4
+ import { Input } from "./Input";
5
+ import { Card } from "./Card";
6
+ import { useEffect, useState } from "react";
7
+ import {
8
+ SelectPaymentMethod,
9
+ SelectPaymentMethodProps,
10
+ } from "./SelectPaymentMethod";
11
+
12
+ type PaymentOnAccountModalProps = {
13
+ isOpen: boolean;
14
+ onClose: () => void;
15
+ paymentProps: SelectPaymentMethodProps;
16
+ };
17
+ export function PaymentOnAccountModal(props: PaymentOnAccountModalProps) {
18
+ const { isOpen, paymentProps, onClose } = props;
19
+ const [amount, setAmount] = useState<number>(paymentProps.amountToPay);
20
+
21
+ useEffect(() => {
22
+ setAmount(paymentProps.amountToPay);
23
+ }, [paymentProps.amountToPay]);
24
+
25
+ function handleAmountChange(event: React.ChangeEvent<HTMLInputElement>) {
26
+ const value = event.target.value.replace(/[^0-9.-]+/g, "");
27
+ setAmount(+value || 0);
28
+ }
29
+
30
+ return (
31
+ <Modal open={isOpen} onClose={onClose} title="Payment on Account">
32
+ <Stack sizing="layout-group" width="full">
33
+ <Card className="py-desktop-component-padding">
34
+ <Stack sizing="component" justify="between" items="center" horizontal>
35
+ <Paragraph className="w-full">Amount to Pay</Paragraph>
36
+ <div>
37
+ <Input
38
+ type="number"
39
+ placeholder="$0.00"
40
+ align="right"
41
+ value={amount === 0 ? "" : amount}
42
+ onChange={handleAmountChange}
43
+ before={"$"}
44
+ />
45
+ </div>
46
+ </Stack>
47
+ </Card>
48
+ <SelectPaymentMethod {...paymentProps} />
49
+ </Stack>
50
+ </Modal>
51
+ );
52
+ }
@@ -0,0 +1,263 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+ import { Accordion } from "./Accordion";
5
+ import { Button } from "./Button";
6
+ import { Card } from "./Card";
7
+ import { Icon } from "./Icon";
8
+ import { Paragraph } from "./Paragraph";
9
+ import { Radio } from "./Radio";
10
+ import { Stack } from "./Stack";
11
+ import clsx from "clsx";
12
+ import { Checkbox } from "./Checkbox";
13
+ import { Subheader } from "./Subheader";
14
+ import { formatCurrencyDisplay } from "../utils/formatting";
15
+ import { HorizontalDivider } from "./HorizontalDivider";
16
+
17
+ export type PaymentMethodType = "ACHPayment" | "CCPayment";
18
+ export type CustomerBank = {
19
+ CustBankGUID: string;
20
+ BankName: string;
21
+ AccountDisplayString: string;
22
+ };
23
+
24
+ export type SelectPaymentMethodProps = {
25
+ amountToPay: number;
26
+ selectedMethod: PaymentMethodType | null;
27
+ allowedMethods: PaymentMethodType[];
28
+ selectedCredits?: unknown[];
29
+ selectedACHBankGuid?: string | null;
30
+ customerBanks?: CustomerBank[];
31
+ allCredits?: unknown[];
32
+ isPayLoading?: boolean;
33
+ selectedInvoices?: unknown[];
34
+ allInvoices?: unknown[];
35
+
36
+ onSelectMethod: (method: PaymentMethodType | null) => void;
37
+ onPay?: () => void;
38
+ setSelectedCredits?: React.Dispatch<React.SetStateAction<unknown[]>>;
39
+ setSelectedACHBankGuid?: (guid: string | null) => void;
40
+ };
41
+ // TODO: Create story
42
+ export function SelectPaymentMethod(props: SelectPaymentMethodProps) {
43
+ const {
44
+ selectedMethod,
45
+ onSelectMethod,
46
+ selectedCredits,
47
+ allCredits,
48
+ allowedMethods,
49
+ selectedACHBankGuid,
50
+ setSelectedACHBankGuid,
51
+ customerBanks,
52
+ onPay,
53
+ isPayLoading,
54
+ } = props;
55
+
56
+ function handleToggle(method: PaymentMethodType | null) {
57
+ onSelectMethod(method);
58
+ }
59
+ return (
60
+ <Stack sizing="layout-group" width="full" minWidth={400}>
61
+ {!!allCredits?.length && (
62
+ <CreditsSelector
63
+ selectedCredits={selectedCredits || []}
64
+ allCredits={allCredits || []}
65
+ setSelectedCredits={props.setSelectedCredits || (() => {})}
66
+ />
67
+ )}
68
+ {allowedMethods?.includes("ACHPayment") && !!customerBanks?.length && (
69
+ <ACHSelector
70
+ selectedMethod={selectedMethod}
71
+ handleToggle={handleToggle}
72
+ selectedBankGuid={selectedACHBankGuid || null}
73
+ setSelectedBankGuid={setSelectedACHBankGuid || (() => {})}
74
+ customerBanks={customerBanks || []}
75
+ onPay={onPay}
76
+ isPayLoading={isPayLoading || false}
77
+ />
78
+ )}
79
+ {allowedMethods?.includes("CCPayment") && (
80
+ <Accordion
81
+ isOpen={selectedMethod === "CCPayment"}
82
+ title="Pay by Credit/Debit Card"
83
+ before={<Radio checked={selectedMethod === "CCPayment"} readOnly />}
84
+ onClick={() =>
85
+ handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment")
86
+ }
87
+ >
88
+ <Button className="w-full" onClick={onPay} disabled={isPayLoading}>
89
+ {isPayLoading ? "Processing..." : "Proceed to Payment"}
90
+ </Button>
91
+ </Accordion>
92
+ )}
93
+ </Stack>
94
+ );
95
+ }
96
+
97
+ type ACHSelectorProps = {
98
+ selectedMethod: PaymentMethodType | null;
99
+ handleToggle: (method: PaymentMethodType | null) => void;
100
+ selectedBankGuid: string | null;
101
+ setSelectedBankGuid: (guid: string | null) => void;
102
+ customerBanks: CustomerBank[];
103
+ onPay?: () => void;
104
+ isPayLoading?: boolean;
105
+ };
106
+ function ACHSelector(props: ACHSelectorProps) {
107
+ const {
108
+ selectedMethod,
109
+ handleToggle,
110
+ selectedBankGuid,
111
+ setSelectedBankGuid,
112
+ customerBanks,
113
+ onPay,
114
+ isPayLoading,
115
+ } = props;
116
+ const [isOpen, setIsOpen] = useState<boolean>(false);
117
+
118
+ useEffect(() => {
119
+ if (selectedMethod === "CCPayment") return setIsOpen(false);
120
+ }, [selectedMethod]);
121
+
122
+ useEffect(() => {
123
+ if (isOpen) {
124
+ if (!selectedBankGuid) {
125
+ setSelectedBankGuid(customerBanks[0]!.CustBankGUID);
126
+ }
127
+ handleToggle("ACHPayment");
128
+ return;
129
+ }
130
+ }, [isOpen]);
131
+
132
+ function handleBankSelect(
133
+ e: React.MouseEvent<HTMLDivElement>,
134
+ bankGuid: string | null,
135
+ ) {
136
+ e.stopPropagation();
137
+ setSelectedBankGuid(bankGuid);
138
+ handleToggle("ACHPayment");
139
+ }
140
+
141
+ return (
142
+ <Accordion
143
+ isOpen={isOpen}
144
+ title={
145
+ selectedBankGuid
146
+ ? customerBanks.find((bank) => bank.CustBankGUID === selectedBankGuid)
147
+ ?.AccountDisplayString
148
+ : "Select a Bank"
149
+ }
150
+ before={
151
+ <Radio
152
+ checked={!!selectedBankGuid && selectedMethod === "ACHPayment"}
153
+ readOnly
154
+ />
155
+ }
156
+ onClick={() => setIsOpen((prev) => !prev)}
157
+ >
158
+ <Stack sizing="layout-group" width="full">
159
+ <Stack
160
+ sizing="layout-group"
161
+ width="full"
162
+ overflowY="auto"
163
+ maxHeight={200}
164
+ >
165
+ {customerBanks.map((bank) => (
166
+ <Card
167
+ className={clsx(
168
+ "transition-colors duration-300 py-desktop-compact-layout-padding cursor-pointer hover:bg-background-secondary-normal/30",
169
+ selectedBankGuid === bank.CustBankGUID &&
170
+ "bg-background-secondary-normal/20",
171
+ )}
172
+ key={bank.CustBankGUID}
173
+ onClick={(e) => handleBankSelect(e, bank.CustBankGUID)}
174
+ >
175
+ <Stack horizontal items="center" justify="between">
176
+ <Stack sizing="layout-group" horizontal items="center">
177
+ <Icon name="question_mark" />
178
+ <Paragraph>{bank.AccountDisplayString}</Paragraph>
179
+ </Stack>
180
+ {selectedBankGuid === bank.CustBankGUID && (
181
+ <Icon name="check" />
182
+ )}
183
+ </Stack>
184
+ </Card>
185
+ ))}
186
+ </Stack>
187
+ <Button className="w-full" onClick={onPay} disabled={isPayLoading}>
188
+ {isPayLoading ? "Processing..." : "Submit Payment"}
189
+ </Button>
190
+ </Stack>
191
+ </Accordion>
192
+ );
193
+ }
194
+ type CreditsSelectorProps = {
195
+ selectedCredits: unknown[];
196
+ allCredits: unknown[];
197
+ setSelectedCredits: React.Dispatch<React.SetStateAction<unknown[]>>;
198
+ };
199
+ function CreditsSelector(props: CreditsSelectorProps) {
200
+ const { selectedCredits, allCredits, setSelectedCredits } = props;
201
+ const [isOpen, setIsOpen] = useState<boolean>(true);
202
+
203
+ const handleCreditSelect = (credit: unknown) => {
204
+ if (setSelectedCredits) {
205
+ setSelectedCredits((prev) =>
206
+ prev.includes(credit)
207
+ ? prev.filter((c) => c !== credit)
208
+ : [...prev, credit],
209
+ );
210
+ }
211
+ };
212
+
213
+ return (
214
+ <Accordion
215
+ isOpen={isOpen}
216
+ title="Available Credits"
217
+ onClick={() => setIsOpen((prev) => !prev)}
218
+ >
219
+ <HorizontalDivider />
220
+ <Stack sizing="layout-group" width="full">
221
+ <Stack
222
+ sizing="layout-group"
223
+ width="full"
224
+ overflowY="auto"
225
+ maxHeight={300}
226
+ >
227
+ {(
228
+ allCredits as unknown as {
229
+ InvoiceNumber: string;
230
+ AROpenGUID: string;
231
+ InvoiceBalance: number;
232
+ }[]
233
+ ).map((credits) => (
234
+ <Stack
235
+ horizontal
236
+ justify="between"
237
+ items="center"
238
+ key={credits.AROpenGUID}
239
+ sizing="layout-group"
240
+ >
241
+ <Stack
242
+ horizontal
243
+ items="center"
244
+ sizing="layout-group"
245
+ onClick={() => handleCreditSelect(credits)}
246
+ paddingY
247
+ >
248
+ <Checkbox
249
+ checked={selectedCredits?.includes(credits)}
250
+ onChange={() => handleCreditSelect(credits)}
251
+ />
252
+ <Paragraph>{credits.InvoiceNumber}</Paragraph>
253
+ </Stack>
254
+ <Subheader className=" pr-desktop-component-padding">
255
+ ${formatCurrencyDisplay(`${Math.abs(credits.InvoiceBalance)}`)}
256
+ </Subheader>
257
+ </Stack>
258
+ ))}
259
+ </Stack>
260
+ </Stack>
261
+ </Accordion>
262
+ );
263
+ }
@@ -8,6 +8,7 @@ import {
8
8
  Sizing,
9
9
  } from "../types";
10
10
  import { ComponentProps, CSSProperties } from "react";
11
+ import { paddingYUsingLayoutGroupGap } from "../classNames";
11
12
 
12
13
  type StackProps = {
13
14
  children: React.ReactNode;
@@ -199,9 +200,7 @@ export const Stack = ({
199
200
  paddingY &&
200
201
  sizing === "layout" &&
201
202
  "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
202
- paddingY &&
203
- sizing === "layout-group" &&
204
- "py-mobile-layout-group-padding desktop:py-desktop-layout-group-padding compact:py-desktop-compact-layout-group-padding",
203
+ paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
205
204
  paddingY &&
206
205
  sizing === "component" &&
207
206
  "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
@@ -18,3 +18,6 @@ export { MenuOption } from "./MenuOption";
18
18
  export { Search } from "./Search";
19
19
  export { Tooltip } from "./Tooltip";
20
20
  export { Input } from "./Input";
21
+ export { PaymentOnAccountModal } from "./PaymentOnAccountModal";
22
+ export { Accordion } from "./Accordion";
23
+ export { Card } from "./Card";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useMatchesMobile
3
3
  } from "./chunk-WNQ53SVY.js";
4
- import {
5
- Paragraph
6
- } from "./chunk-VG4EPHJA.js";
7
4
  import {
8
5
  Label
9
6
  } from "./chunk-S5K22XTH.js";
7
+ import {
8
+ Paragraph
9
+ } from "./chunk-VG4EPHJA.js";
10
10
  import {
11
11
  Icon
12
12
  } from "./chunk-IGQVA7SC.js";