@dmsi/wedgekit-react 0.0.87 → 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
@@ -0,0 +1,2132 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/components/PaymentOnAccountModal.tsx
60
+ var PaymentOnAccountModal_exports = {};
61
+ __export(PaymentOnAccountModal_exports, {
62
+ PaymentOnAccountModal: () => PaymentOnAccountModal
63
+ });
64
+ module.exports = __toCommonJS(PaymentOnAccountModal_exports);
65
+
66
+ // src/components/Modal.tsx
67
+ var import_clsx9 = __toESM(require("clsx"), 1);
68
+ var import_react5 = require("react");
69
+
70
+ // src/components/Heading.tsx
71
+ var import_clsx2 = __toESM(require("clsx"), 1);
72
+
73
+ // src/classNames.ts
74
+ var import_clsx = __toESM(require("clsx"), 1);
75
+ var typography = {
76
+ display1: (0, import_clsx.default)(
77
+ "font-sans font-semibold",
78
+ "text-display-1-mobile desktop:text-display-1-desktop compact:text-display-1-desktop-compact",
79
+ "leading-display-1-mobile desktop:leading-display-1-desktop"
80
+ ),
81
+ display2: (0, import_clsx.default)(
82
+ "font-sans font-bold",
83
+ "text-display-2-mobile desktop:text-display-2-desktop compact:text-display-2-desktop-compact",
84
+ "leading-display-2-mobile desktop:leading-display-2-desktop"
85
+ ),
86
+ heading1: (0, import_clsx.default)(
87
+ "font-sans font-semibold",
88
+ "text-heading-1-mobile desktop:text-heading-1-desktop compact:text-heading-1-desktop-compact",
89
+ "leading-heading-1-mobile desktop:leading-heading-1-desktop"
90
+ ),
91
+ heading2: (0, import_clsx.default)(
92
+ "font-sans font-normal",
93
+ "text-heading-2-mobile desktop:text-heading-2-desktop compact:text-heading-2-desktop-compact",
94
+ "leading-heading-2-mobile desktop:leading-heading-2-desktop"
95
+ ),
96
+ heading3: (0, import_clsx.default)(
97
+ "font-sans font-semibold",
98
+ "text-heading-3-mobile desktop:text-heading-3-desktop compact:text-heading-3-desktop-compact",
99
+ "leading-heading-3-mobile desktop:leading-heading-3-desktop"
100
+ ),
101
+ subheader: (0, import_clsx.default)(
102
+ "font-sans font-semibold",
103
+ "text-subheader-mobile desktop:text-subheader-desktop compact:text-subheader-desktop-compact",
104
+ "leading-subheader-mobile desktop:leading-subheader-desktop"
105
+ ),
106
+ link: (0, import_clsx.default)(
107
+ "font-sans font-normal",
108
+ "text-link-mobile desktop:text-link-desktop compact:text-link-desktop-compact",
109
+ "leading-link-mobile desktop:leading-link-desktop"
110
+ ),
111
+ buttonLabel: (0, import_clsx.default)(
112
+ "font-sans font-semibold",
113
+ "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
114
+ "leading-label-mobile desktop:leading-label-desktop"
115
+ ),
116
+ label: (0, import_clsx.default)(
117
+ "font-sans font-semibold",
118
+ "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
119
+ "leading-label-mobile desktop:leading-label-desktop"
120
+ ),
121
+ paragraph: (0, import_clsx.default)(
122
+ "font-sans font-normal",
123
+ "text-paragraph-mobile desktop:text-paragraph-desktop compact:text-paragraph-desktop-compact",
124
+ "leading-paragraph-mobile desktop:leading-paragraph-desktop"
125
+ ),
126
+ caption: (0, import_clsx.default)(
127
+ "font-sans font-normal",
128
+ "text-caption-mobile desktop:text-caption-desktop compact:text-caption-desktop-compact",
129
+ "leading-caption-mobile desktop:leading-caption-desktop"
130
+ )
131
+ };
132
+ var baseTransition = (0, import_clsx.default)(
133
+ "transition-colors duration-100 ease-in-out"
134
+ );
135
+ var componentGap = (0, import_clsx.default)(
136
+ "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-desktop-compact-component-gap"
137
+ );
138
+ var paddingUsingComponentGap = (0, import_clsx.default)(
139
+ "p-mobile-component-gap desktop:p-desktop-component-gap compact:p-desktop-compact-component-gap"
140
+ );
141
+ var paddingXUsingLayoutGroupGap = (0, import_clsx.default)(
142
+ "px-mobile-layout-group-gap desktop:px-desktop-layout-group-gap compact:px-desktop-compact-layout-group-gap"
143
+ );
144
+ var paddingYUsingLayoutGroupGap = (0, import_clsx.default)(
145
+ "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
146
+ );
147
+ var componentPadding = (0, import_clsx.default)(
148
+ "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding"
149
+ );
150
+ var componentPaddingBottom = (0, import_clsx.default)(
151
+ "pb-mobile-component-padding desktop:pb-desktop-component-padding compact:pb-desktop-compact-component-padding"
152
+ );
153
+ var componentPaddingX = (0, import_clsx.default)(
154
+ "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding"
155
+ );
156
+ var componentPaddingY = (0, import_clsx.default)(
157
+ "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding"
158
+ );
159
+ var componentPaddingXUsingComponentGap = (0, import_clsx.default)(
160
+ "px-mobile-component-gap desktop:px-desktop-component-gap compact:px-desktop-compact-component-gap"
161
+ );
162
+ var componentPaddingYUsingComponentGap = (0, import_clsx.default)(
163
+ "py-mobile-component-gap desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap"
164
+ );
165
+ var componentPaddingMinusBorder = (0, import_clsx.default)(
166
+ "p-[calc(var(--spacing-mobile-component-padding)_-_1px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_1px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_1px)]"
167
+ );
168
+ var componentPaddingMinus2pxBorder = (0, import_clsx.default)(
169
+ "p-[calc(var(--spacing-mobile-component-padding)_-_2px)] desktop:p-[calc(var(--spacing-desktop-component-padding)_-_2px)] compact:p-[calc(var(--spacing-desktop-compact-component-padding)_-_2px)]"
170
+ );
171
+ var layoutPaddding = (0, import_clsx.default)(
172
+ "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding"
173
+ );
174
+ var layoutPaddingBottom = (0, import_clsx.default)(
175
+ "pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding"
176
+ );
177
+ var layoutPaddingY = (0, import_clsx.default)(
178
+ "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding"
179
+ );
180
+ var containerPaddingX = (0, import_clsx.default)(
181
+ "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding"
182
+ );
183
+ var containerPaddingY = (0, import_clsx.default)(
184
+ "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding"
185
+ );
186
+ var layoutGroupGapPaddingY = (0, import_clsx.default)(
187
+ "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
188
+ );
189
+ var layoutGroupGap = (0, import_clsx.default)(
190
+ "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-desktop-compact-layout-group-gap"
191
+ );
192
+ var layoutGap = (0, import_clsx.default)(
193
+ "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-desktop-compact-layout-gap"
194
+ );
195
+ var gapUsingContainerPadding = (0, import_clsx.default)(
196
+ "gap-mobile-container-padding desktop:gap-desktop-container-padding compact:gap-desktop-compact-container-padding"
197
+ );
198
+
199
+ // src/components/Heading.tsx
200
+ var import_jsx_runtime = require("react/jsx-runtime");
201
+ var Heading = (_a) => {
202
+ var _b = _a, {
203
+ className,
204
+ children,
205
+ as,
206
+ color,
207
+ align,
208
+ variant = "heading1",
209
+ id
210
+ } = _b, props = __objRest(_b, [
211
+ "className",
212
+ "children",
213
+ "as",
214
+ "color",
215
+ "align",
216
+ "variant",
217
+ "id"
218
+ ]);
219
+ const defaultElement = variant === "heading1" ? "h1" : variant === "heading2" ? "h2" : "h3";
220
+ const Element = as != null ? as : defaultElement;
221
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
222
+ Element,
223
+ __spreadProps(__spreadValues({
224
+ id,
225
+ className: (0, import_clsx2.default)(
226
+ typography[variant],
227
+ className,
228
+ align === "left" && "text-left",
229
+ align === "center" && "text-center",
230
+ align === "right" && "text-right"
231
+ ),
232
+ style: __spreadProps(__spreadValues({}, props.style), {
233
+ color: color ? `var(--color-${color})` : void 0
234
+ })
235
+ }, props), {
236
+ children
237
+ })
238
+ );
239
+ };
240
+ Heading.displayName = "Heading";
241
+ var Heading1 = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading1" }));
242
+ var Heading2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading2" }));
243
+ var Heading3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Heading, __spreadProps(__spreadValues({}, props), { variant: "heading3" }));
244
+ Heading1.displayName = "Heading1";
245
+ Heading2.displayName = "Heading2";
246
+ Heading3.displayName = "Heading3";
247
+
248
+ // src/components/Button.tsx
249
+ var import_clsx3 = __toESM(require("clsx"), 1);
250
+ var import_jsx_runtime2 = require("react/jsx-runtime");
251
+ var Button = (_a) => {
252
+ var _b = _a, {
253
+ variant = "primary",
254
+ as = "button",
255
+ block,
256
+ leftIcon,
257
+ rightIcon,
258
+ className,
259
+ classNameLabel,
260
+ disabled = false,
261
+ children,
262
+ iconOnly = false,
263
+ colorClassName,
264
+ href,
265
+ id
266
+ } = _b, props = __objRest(_b, [
267
+ "variant",
268
+ "as",
269
+ "block",
270
+ "leftIcon",
271
+ "rightIcon",
272
+ "className",
273
+ "classNameLabel",
274
+ "disabled",
275
+ "children",
276
+ "iconOnly",
277
+ "colorClassName",
278
+ "href",
279
+ "id"
280
+ ]);
281
+ const primaryVariantStyles = variant === "primary" && (0, import_clsx3.default)(
282
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
283
+ "bg-background-action-primary-normal border-background-action-primary-normal",
284
+ "hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
285
+ "focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
286
+ "active:bg-background-action-primary-active active:border-background-action-primary-active",
287
+ "disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled"
288
+ );
289
+ const secondaryVariantStyles = variant === "secondary" && (0, import_clsx3.default)(
290
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
291
+ "bg-background-action-secondary-normal border-border-action-normal",
292
+ "hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
293
+ "focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
294
+ "active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
295
+ "disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled"
296
+ );
297
+ const tertiaryVariantStyles = variant === "tertiary" && (0, import_clsx3.default)(
298
+ "bg-transparent border-transparent",
299
+ iconOnly ? (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-icon-action-primary-normal" : (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
300
+ "bg-transparent border-transparent",
301
+ "hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
302
+ "focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
303
+ "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
304
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
305
+ );
306
+ const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx3.default)(
307
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
308
+ "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
309
+ "hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
310
+ "focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
311
+ "active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
312
+ "disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled"
313
+ );
314
+ const secondaryCriticalVariantStyles = variant === "secondary-critical" && (0, import_clsx3.default)(
315
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
316
+ "bg-background-action-critical-secondary-normal border-border-action-critical-normal",
317
+ "hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
318
+ "focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
319
+ "active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
320
+ "disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled"
321
+ );
322
+ const tertiaryCriticalVariantStyles = variant === "tertiary-critical" && (0, import_clsx3.default)(
323
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
324
+ "bg-transparent border-transparent text-text-action-critical-normal",
325
+ "hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
326
+ "focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
327
+ "active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
328
+ "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled"
329
+ );
330
+ const navigationVarianStyles = variant === "navigation" && (0, import_clsx3.default)(
331
+ (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
332
+ "bg-transparent",
333
+ "hover:bg-background-on-action-secondary-hover hover:text-brand-text-action-primary-hover",
334
+ // "hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover", // Will use this once colors are finalized
335
+ "focus:bg-background-on-action-secondary-hover focus:text-brand-text-action-primary-hover focus:outline-0",
336
+ // "focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover", // Will use this once colors are finalized
337
+ "active:bg-background-on-action-secondary-active active:text-brand-text-action-primary-active",
338
+ // "active:bg-background-action-secondary-active active:text-text-action-primary-active", // Will use this once colors are finalized
339
+ "disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
340
+ "flex-col",
341
+ paddingUsingComponentGap
342
+ );
343
+ const notNavigationVariantStyles = variant !== "navigation" && (0, import_clsx3.default)("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
344
+ const buttonClasses = (0, import_clsx3.default)(
345
+ disabled ? "cursor-default" : "cursor-pointer",
346
+ block ? "w-full" : "w-fit",
347
+ baseTransition,
348
+ "rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
349
+ primaryVariantStyles,
350
+ secondaryVariantStyles,
351
+ tertiaryVariantStyles,
352
+ primaryCriticalVariantStyles,
353
+ secondaryCriticalVariantStyles,
354
+ tertiaryCriticalVariantStyles,
355
+ navigationVarianStyles,
356
+ notNavigationVariantStyles,
357
+ className
358
+ );
359
+ const labelClasses = (0, import_clsx3.default)(
360
+ "min-h-6 flex items-center justify-center",
361
+ classNameLabel,
362
+ componentPaddingXUsingComponentGap,
363
+ typography.buttonLabel
364
+ );
365
+ const Element = href && !as ? "a" : as;
366
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
367
+ Element,
368
+ __spreadProps(__spreadValues({
369
+ id,
370
+ type: Element === "button" ? "button" : void 0,
371
+ className: buttonClasses
372
+ }, props), {
373
+ onClick: props.onClick,
374
+ disabled,
375
+ href,
376
+ children: [
377
+ leftIcon && leftIcon,
378
+ !iconOnly && children && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { id: id ? `${id}-label` : void 0, className: labelClasses, children }),
379
+ rightIcon && rightIcon
380
+ ]
381
+ })
382
+ );
383
+ };
384
+ Button.displayName = "Button";
385
+
386
+ // src/components/Icon.tsx
387
+ var import_clsx4 = __toESM(require("clsx"), 1);
388
+ var import_jsx_runtime3 = require("react/jsx-runtime");
389
+ function Icon(_a) {
390
+ var _b = _a, {
391
+ name,
392
+ size = 24,
393
+ variant = "outline"
394
+ } = _b, props = __objRest(_b, [
395
+ "name",
396
+ "size",
397
+ "variant"
398
+ ]);
399
+ const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
400
+ const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
401
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
402
+ "span",
403
+ __spreadProps(__spreadValues({}, props), {
404
+ className: (0, import_clsx4.default)(
405
+ "icon",
406
+ `icon-${size}`,
407
+ // size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
408
+ props.className
409
+ ),
410
+ style: __spreadValues({
411
+ fontVariationSettings: variantStyle + `, ${weightStyle}`
412
+ }, props.style),
413
+ children: name
414
+ })
415
+ );
416
+ }
417
+
418
+ // src/components/ModalHeader.tsx
419
+ var import_clsx5 = __toESM(require("clsx"), 1);
420
+ var import_jsx_runtime4 = require("react/jsx-runtime");
421
+ var ModalHeader = ({
422
+ title,
423
+ hideCloseIcon,
424
+ headerIcon,
425
+ onClose,
426
+ id
427
+ }) => {
428
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
429
+ "div",
430
+ {
431
+ id,
432
+ className: (0, import_clsx5.default)(
433
+ "flex justify-between items-center",
434
+ layoutPaddding,
435
+ layoutGroupGap
436
+ ),
437
+ children: [
438
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx5.default)("flex items-center", layoutGroupGap), children: [
439
+ headerIcon,
440
+ title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Heading2, { id: id ? `${id}-title` : void 0, as: "p", children: title })
441
+ ] }),
442
+ !hideCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
443
+ Button,
444
+ {
445
+ id: id ? `${id}-close-button` : void 0,
446
+ iconOnly: true,
447
+ variant: "tertiary",
448
+ onClick: onClose,
449
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "close", size: 24 }) })
450
+ }
451
+ )
452
+ ]
453
+ }
454
+ );
455
+ };
456
+ ModalHeader.displayName = "ModalHeader";
457
+
458
+ // src/components/ModalContent.tsx
459
+ var import_clsx6 = __toESM(require("clsx"), 1);
460
+ var import_jsx_runtime5 = require("react/jsx-runtime");
461
+ function ModalContent({
462
+ fixedHeightScrolling,
463
+ children,
464
+ id
465
+ }) {
466
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
467
+ "div",
468
+ {
469
+ id,
470
+ className: (0, import_clsx6.default)(
471
+ "flex-grow desktop:flex-grow-0",
472
+ layoutPaddding,
473
+ fixedHeightScrolling && "overflow-auto"
474
+ ),
475
+ children
476
+ }
477
+ );
478
+ }
479
+ ModalContent.displayName = "ModalContent";
480
+
481
+ // src/components/ModalButtons.tsx
482
+ var import_clsx7 = __toESM(require("clsx"), 1);
483
+ var import_jsx_runtime6 = require("react/jsx-runtime");
484
+ var ModalButtons = ({
485
+ onClose,
486
+ onContinue,
487
+ customActions,
488
+ id
489
+ }) => {
490
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
491
+ "div",
492
+ {
493
+ id,
494
+ className: (0, import_clsx7.default)(
495
+ "border-t border-neutral-300 flex justify-end",
496
+ layoutPaddding,
497
+ layoutGroupGap
498
+ ),
499
+ children: customActions != null ? customActions : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
500
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
501
+ Button,
502
+ {
503
+ id: id ? `${id}-close-button` : void 0,
504
+ variant: "secondary",
505
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "close", size: 24 }),
506
+ onClick: onClose,
507
+ className: "max-sm:w-full",
508
+ children: "Close"
509
+ }
510
+ ),
511
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
512
+ Button,
513
+ {
514
+ id: id ? `${id}-continue-button` : void 0,
515
+ variant: "primary",
516
+ leftIcon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "check", size: 24 }),
517
+ className: "max-sm:w-full",
518
+ onClick: onContinue,
519
+ children: "Continue"
520
+ }
521
+ )
522
+ ] })
523
+ }
524
+ );
525
+ };
526
+ ModalButtons.displayName = "ModalButtons";
527
+
528
+ // src/components/ModalScrim.tsx
529
+ var import_clsx8 = __toESM(require("clsx"), 1);
530
+ var import_jsx_runtime7 = require("react/jsx-runtime");
531
+ var ModalScrim = ({
532
+ show = false,
533
+ size = "small",
534
+ children,
535
+ onClick,
536
+ ref,
537
+ id
538
+ }) => {
539
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
540
+ "div",
541
+ {
542
+ id,
543
+ className: (0, import_clsx8.default)(
544
+ "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",
545
+ !show && " pointer-events-none",
546
+ size === "small" && "p-4",
547
+ "inset-0 z-50"
548
+ ),
549
+ onMouseDown: onClick,
550
+ ref,
551
+ children
552
+ }
553
+ );
554
+ };
555
+ ModalScrim.displayName = "ModalScrim";
556
+
557
+ // src/components/Modal.tsx
558
+ var import_react_dom = require("react-dom");
559
+
560
+ // src/utils.ts
561
+ function findDocumentRoot(element) {
562
+ if (typeof window === "undefined" || typeof document === "undefined") {
563
+ throw new Error(
564
+ "findDocumentRoot can only be used in a browser environment."
565
+ );
566
+ }
567
+ if (!element || !(element instanceof Node)) {
568
+ return window.document.body;
569
+ }
570
+ var currentElement = element;
571
+ while (currentElement && currentElement.parentNode) {
572
+ if (currentElement.parentNode === document) {
573
+ return document.body;
574
+ } else if (currentElement.parentNode instanceof DocumentFragment) {
575
+ return currentElement.parentNode;
576
+ } else {
577
+ currentElement = currentElement.parentNode;
578
+ }
579
+ }
580
+ return window.document.body;
581
+ }
582
+
583
+ // src/components/Modal.tsx
584
+ var import_react_use = require("react-use");
585
+
586
+ // src/hooks/useKeydown.ts
587
+ var import_react = require("react");
588
+
589
+ // src/hooks/useInfiniteScroll.tsx
590
+ var import_react2 = require("react");
591
+
592
+ // src/hooks/useMatchesMedia.ts
593
+ var import_react3 = require("react");
594
+ var useMatchesMedia = (query) => {
595
+ const [matches, setMatches] = (0, import_react3.useState)();
596
+ (0, import_react3.useLayoutEffect)(() => {
597
+ const mediaQueryList = window.matchMedia(query);
598
+ const listener = () => setMatches(mediaQueryList.matches);
599
+ listener();
600
+ mediaQueryList.addEventListener("change", listener);
601
+ return () => mediaQueryList.removeEventListener("change", listener);
602
+ }, [query]);
603
+ return matches;
604
+ };
605
+ var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
606
+
607
+ // src/components/useMounted.tsx
608
+ var import_react4 = require("react");
609
+ var useMounted = () => {
610
+ const [isMounted, setIsMounted] = (0, import_react4.useState)(false);
611
+ (0, import_react4.useEffect)(() => {
612
+ setIsMounted(true);
613
+ return () => setIsMounted(false);
614
+ }, []);
615
+ return isMounted;
616
+ };
617
+
618
+ // src/components/Modal.tsx
619
+ var import_jsx_runtime8 = require("react/jsx-runtime");
620
+ var fadeInScale = (element, duration = 300) => element.animate(
621
+ [
622
+ { opacity: 0, transform: "scale(0.95)" },
623
+ { opacity: 1, transform: "scale(1)" }
624
+ ],
625
+ {
626
+ duration,
627
+ easing: "cubic-bezier(0.4, 0, 0.2, 1)",
628
+ fill: "both"
629
+ }
630
+ );
631
+ var fadeOutScale = (element, duration = 200) => element.animate(
632
+ [
633
+ { opacity: 1, transform: "scale(1)" },
634
+ { opacity: 0, transform: "scale(0.95)" }
635
+ ],
636
+ {
637
+ duration,
638
+ easing: "ease-in-out",
639
+ fill: "both"
640
+ }
641
+ );
642
+ var bgFadeIn = (element, duration = 300) => element.animate([{ opacity: 0 }, { opacity: 1 }], {
643
+ duration,
644
+ easing: "cubic-bezier(0.4, 0, 0.2, 1)",
645
+ fill: "both"
646
+ });
647
+ var bgFadeOut = (element, duration = 200) => element.animate([{ opacity: 1 }, { opacity: 0 }], {
648
+ duration,
649
+ easing: "ease-in-out",
650
+ fill: "both"
651
+ });
652
+ var whenAllAnimationsFinish = (animations, callback) => {
653
+ let finishedCount = 0;
654
+ animations.forEach((animation) => {
655
+ animation.onfinish = () => {
656
+ finishedCount += 1;
657
+ if (finishedCount === animations.length) {
658
+ callback();
659
+ }
660
+ };
661
+ });
662
+ };
663
+ var sizes = {
664
+ small: {
665
+ sizeClass: "max-h-screen desktop:max-w-120 rounded-sm"
666
+ },
667
+ medium: {
668
+ sizeClass: "desktop:max-w-180 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
669
+ },
670
+ large: {
671
+ sizeClass: "desktop:max-w-240 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
672
+ },
673
+ "x-large": {
674
+ sizeClass: "desktop:max-w-300 w-screen desktop:h-fit h-screen desktop:w-full max-w-240"
675
+ }
676
+ };
677
+ var Modal = ({
678
+ id,
679
+ title,
680
+ open = false,
681
+ size = "small",
682
+ className,
683
+ children,
684
+ onClose,
685
+ onContinue,
686
+ closeOnBackdropClick = true,
687
+ showButtons = false,
688
+ hideCloseIcon = false,
689
+ headerIcon,
690
+ fixedHeightScrolling = false,
691
+ customActions
692
+ }) => {
693
+ var _a;
694
+ const mounted = useMounted();
695
+ const modalRef = (0, import_react5.useRef)(null);
696
+ const bgRef = (0, import_react5.useRef)(null);
697
+ const wasOpen = (0, import_react_use.usePrevious)(open);
698
+ const isMobile = useMatchesMobile();
699
+ const computedFixedHeightScrolling = isMobile || fixedHeightScrolling;
700
+ (0, import_react5.useEffect)(() => {
701
+ if (!mounted) return;
702
+ if (!modalRef.current || !bgRef.current) {
703
+ console.error("Modal or background reference is not set.");
704
+ return;
705
+ }
706
+ if (wasOpen === void 0) return;
707
+ if (wasOpen && !open) {
708
+ const modalAnimation = fadeOutScale(modalRef.current);
709
+ const bgAnimation = bgFadeOut(bgRef.current);
710
+ whenAllAnimationsFinish([modalAnimation, bgAnimation], () => {
711
+ if (onClose) {
712
+ onClose();
713
+ }
714
+ });
715
+ } else if (!wasOpen && open) {
716
+ fadeInScale(modalRef.current);
717
+ bgFadeIn(bgRef.current);
718
+ }
719
+ }, [mounted, open]);
720
+ const handleKeyDown = (0, import_react5.useCallback)(
721
+ (e) => {
722
+ if (e.key === "Escape") {
723
+ if (onClose) {
724
+ e.preventDefault();
725
+ onClose();
726
+ }
727
+ }
728
+ },
729
+ [onClose, bgRef, modalRef]
730
+ );
731
+ const handleClose = (0, import_react5.useCallback)(() => {
732
+ if (onClose) {
733
+ onClose();
734
+ }
735
+ }, [onClose]);
736
+ (0, import_react5.useEffect)(() => {
737
+ if (open) {
738
+ document.addEventListener("keyup", handleKeyDown);
739
+ }
740
+ return () => {
741
+ document.removeEventListener("keyup", handleKeyDown);
742
+ };
743
+ }, [open, handleKeyDown]);
744
+ (0, import_react5.useEffect)(() => {
745
+ if (!open) return;
746
+ const scrollY = window.scrollY;
747
+ const body = document.body;
748
+ body.style.position = "fixed";
749
+ body.style.top = `-${scrollY}px`;
750
+ body.style.left = "0";
751
+ body.style.right = "0";
752
+ body.style.overflow = "hidden";
753
+ body.style.width = "100%";
754
+ return () => {
755
+ body.style.position = "";
756
+ body.style.top = "";
757
+ body.style.left = "";
758
+ body.style.right = "";
759
+ body.style.overflow = "";
760
+ body.style.width = "";
761
+ window.scrollTo(0, scrollY);
762
+ };
763
+ }, [open]);
764
+ const { sizeClass } = (_a = sizes[size]) != null ? _a : sizes.small;
765
+ const backgroundClickHandler = (0, import_react5.useCallback)(
766
+ (e) => {
767
+ const target = e.target;
768
+ const currentTarget = e.currentTarget;
769
+ if (currentTarget.contains(target) && currentTarget !== target) {
770
+ e.stopPropagation();
771
+ return;
772
+ }
773
+ if (open && closeOnBackdropClick) {
774
+ handleClose();
775
+ }
776
+ },
777
+ [open, closeOnBackdropClick, handleClose]
778
+ );
779
+ if (!mounted) {
780
+ return null;
781
+ }
782
+ return (0, import_react_dom.createPortal)(
783
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
784
+ ModalScrim,
785
+ {
786
+ id: id ? `${id}-scrim` : void 0,
787
+ size,
788
+ ref: bgRef,
789
+ show: open,
790
+ onClick: backgroundClickHandler,
791
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
792
+ "div",
793
+ {
794
+ id,
795
+ ref: modalRef,
796
+ className: (0, import_clsx9.default)(
797
+ "bg-white shadow-md rounded-sm flex flex-col overflow-hidden w-full opacity-0 h-fit",
798
+ computedFixedHeightScrolling && "desktop:max-h-[calc(100vh-32px)] desktop:h-auto",
799
+ className,
800
+ sizeClass
801
+ ),
802
+ onClick: (e) => e.stopPropagation(),
803
+ children: [
804
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
805
+ ModalHeader,
806
+ {
807
+ id: id ? `${id}-header` : void 0,
808
+ title,
809
+ onClose: handleClose,
810
+ hideCloseIcon,
811
+ headerIcon
812
+ }
813
+ ),
814
+ children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
815
+ ModalContent,
816
+ {
817
+ id: id ? `${id}-content` : void 0,
818
+ fixedHeightScrolling: computedFixedHeightScrolling,
819
+ children
820
+ }
821
+ ),
822
+ showButtons && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
823
+ ModalButtons,
824
+ {
825
+ id: id ? `${id}-buttons` : void 0,
826
+ onClose: handleClose,
827
+ onContinue,
828
+ customActions
829
+ }
830
+ )
831
+ ]
832
+ }
833
+ )
834
+ }
835
+ ),
836
+ findDocumentRoot(bgRef.current)
837
+ );
838
+ };
839
+ Modal.displayName = "Modal";
840
+
841
+ // src/components/Stack.tsx
842
+ var import_clsx10 = __toESM(require("clsx"), 1);
843
+ var import_jsx_runtime9 = require("react/jsx-runtime");
844
+ var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx10.default)(
845
+ "flex",
846
+ items === "start" && "items-start",
847
+ grow && "grow",
848
+ items === "start" && "items-start",
849
+ items === "center" && "items-center",
850
+ items === "end" && "items-end",
851
+ items === "start-center" && "items-start desktop:items-center",
852
+ justify === "start" && "justify-start",
853
+ justify === "center" && "justify-center",
854
+ justify === "end" && "justify-end",
855
+ justify === "end" && "justify-end",
856
+ justify === "between" && "justify-between",
857
+ justify === "around" && "justify-around"
858
+ );
859
+ var useGapClassNames = (sizing) => {
860
+ return (0, import_clsx10.default)(
861
+ sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
862
+ sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
863
+ sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
864
+ sizing === "component" && "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap"
865
+ );
866
+ };
867
+ var Stack = (_a) => {
868
+ var _b = _a, {
869
+ children,
870
+ items,
871
+ justify,
872
+ grow,
873
+ padding,
874
+ paddingX,
875
+ paddingY,
876
+ margin,
877
+ marginX,
878
+ marginY,
879
+ horizontal,
880
+ horizontalMobile,
881
+ elevation = 0,
882
+ rounded,
883
+ centered,
884
+ width,
885
+ minHeight,
886
+ maxWidth,
887
+ minWidth,
888
+ height,
889
+ maxHeight,
890
+ borderColor,
891
+ backgroundColor,
892
+ sizing = "none",
893
+ overflowY = "inherit",
894
+ overflowX = "inherit",
895
+ flexShrink,
896
+ flexGrow,
897
+ position,
898
+ top,
899
+ left,
900
+ id,
901
+ noGap,
902
+ marginTop,
903
+ marginBottom
904
+ } = _b, props = __objRest(_b, [
905
+ "children",
906
+ "items",
907
+ "justify",
908
+ "grow",
909
+ "padding",
910
+ "paddingX",
911
+ "paddingY",
912
+ "margin",
913
+ "marginX",
914
+ "marginY",
915
+ "horizontal",
916
+ "horizontalMobile",
917
+ "elevation",
918
+ "rounded",
919
+ "centered",
920
+ "width",
921
+ "minHeight",
922
+ "maxWidth",
923
+ "minWidth",
924
+ "height",
925
+ "maxHeight",
926
+ "borderColor",
927
+ "backgroundColor",
928
+ "sizing",
929
+ "overflowY",
930
+ "overflowX",
931
+ "flexShrink",
932
+ "flexGrow",
933
+ "position",
934
+ "top",
935
+ "left",
936
+ "id",
937
+ "noGap",
938
+ "marginTop",
939
+ "marginBottom"
940
+ ]);
941
+ const flexClassNames = getFlexClassNames({ items, justify, grow });
942
+ const gapClassNames = useGapClassNames(sizing);
943
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
944
+ "div",
945
+ __spreadProps(__spreadValues({
946
+ id
947
+ }, props), {
948
+ style: {
949
+ height: height === "full" ? "100%" : height !== void 0 ? `${height}px` : void 0,
950
+ maxHeight: maxHeight !== void 0 ? `${maxHeight}px` : void 0,
951
+ minHeight: minHeight !== void 0 ? `${minHeight}px` : void 0,
952
+ maxWidth: maxWidth !== void 0 ? `${maxWidth}px` : void 0,
953
+ width: width !== void 0 && typeof width === "number" ? `${width}px` : void 0,
954
+ minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
955
+ border: borderColor ? `1px solid var(--color-${borderColor})` : void 0,
956
+ backgroundColor: backgroundColor ? `var(--color-${backgroundColor})` : void 0,
957
+ flexGrow: flexGrow !== void 0 ? flexGrow : void 0,
958
+ flexShrink: flexShrink !== void 0 ? flexShrink : void 0,
959
+ position: position !== void 0 ? position : void 0,
960
+ top: top !== void 0 ? `${top}px` : void 0,
961
+ left: left !== void 0 ? `${left}px` : void 0
962
+ },
963
+ className: (0, import_clsx10.default)(
964
+ "scrollbar-thin",
965
+ "max-w-screen",
966
+ width !== "fit" && "w-full",
967
+ width === "full" && "w-full",
968
+ width === "max" && "w-max",
969
+ centered && "mx-auto",
970
+ overflowY == "auto" && "overflow-y-auto",
971
+ overflowY == "hidden" && "overflow-y-hidden",
972
+ overflowY == "scroll" && "overflow-y-scroll",
973
+ overflowX == "auto" && "overflow-x-auto",
974
+ overflowX == "hidden" && "overflow-x-hidden",
975
+ overflowX == "scroll" && "overflow-x-scroll",
976
+ padding && sizing === "container" && "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
977
+ padding && sizing === "layout" && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
978
+ padding && sizing === "layout-group" && "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
979
+ padding && sizing === "component" && "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
980
+ paddingX && sizing === "container" && "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding",
981
+ paddingX && sizing === "layout" && "px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
982
+ paddingX && sizing === "layout-group" && "px-mobile-layout-group-padding desktop:px-desktop-layout-group-padding compact:px-desktop-compact-layout-group-padding",
983
+ paddingX && sizing === "component" && "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
984
+ paddingY && sizing === "container" && "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding",
985
+ paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
986
+ paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
987
+ paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
988
+ margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
989
+ marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
990
+ marginTop && sizing === "container" && "mt-mobile-container-padding desktop:mt-desktop-container-padding compact:mt-compact-container-padding",
991
+ marginBottom && sizing === "container" && "mb-mobile-container-padding desktop:mb-desktop-container-padding compact:mb-compact-container-padding",
992
+ marginY && sizing === "container" && "my-mobile-container-padding desktop:my-desktop-container-padding compact:my-compact-container-padding",
993
+ horizontal ? "desktop:flex-row" : "desktop:flex-col",
994
+ horizontalMobile ? "flex-row" : "flex-col",
995
+ flexClassNames,
996
+ !noGap && gapClassNames,
997
+ elevation === 0 && "shadow-none",
998
+ elevation === 2 && "shadow-2",
999
+ elevation === 4 && "shadow-4",
1000
+ elevation === 16 && "shadow-16",
1001
+ rounded && "rounded"
1002
+ ),
1003
+ children
1004
+ })
1005
+ );
1006
+ };
1007
+
1008
+ // src/components/Paragraph.tsx
1009
+ var import_clsx11 = __toESM(require("clsx"), 1);
1010
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1011
+ var Paragraph = (_a) => {
1012
+ var _b = _a, {
1013
+ className,
1014
+ color,
1015
+ padded,
1016
+ align = "left",
1017
+ tall,
1018
+ addOverflow,
1019
+ children,
1020
+ as = "p",
1021
+ id
1022
+ } = _b, props = __objRest(_b, [
1023
+ "className",
1024
+ "color",
1025
+ "padded",
1026
+ "align",
1027
+ "tall",
1028
+ "addOverflow",
1029
+ "children",
1030
+ "as",
1031
+ "id"
1032
+ ]);
1033
+ const Element = as;
1034
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1035
+ Element,
1036
+ __spreadProps(__spreadValues({
1037
+ id
1038
+ }, props), {
1039
+ className: (0, import_clsx11.default)(
1040
+ typography.paragraph,
1041
+ className,
1042
+ padded && componentPaddingXUsingComponentGap,
1043
+ align === "left" && "text-left",
1044
+ align === "center" && "text-center",
1045
+ align === "right" && "text-right",
1046
+ tall && "!leading-6",
1047
+ addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
1048
+ ),
1049
+ style: __spreadProps(__spreadValues({}, props.style), {
1050
+ color: color ? `var(--color-${color})` : void 0
1051
+ }),
1052
+ children
1053
+ })
1054
+ );
1055
+ };
1056
+ Paragraph.displayName = "Paragraph";
1057
+
1058
+ // src/components/Input.tsx
1059
+ var import_react6 = require("react");
1060
+ var import_clsx13 = __toESM(require("clsx"), 1);
1061
+
1062
+ // src/components/Label.tsx
1063
+ var import_clsx12 = __toESM(require("clsx"), 1);
1064
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1065
+ var Label = (_a) => {
1066
+ var _b = _a, {
1067
+ as = "span",
1068
+ padded,
1069
+ className,
1070
+ color,
1071
+ align,
1072
+ id
1073
+ } = _b, props = __objRest(_b, [
1074
+ "as",
1075
+ "padded",
1076
+ "className",
1077
+ "color",
1078
+ "align",
1079
+ "id"
1080
+ ]);
1081
+ const Element = as;
1082
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1083
+ Element,
1084
+ __spreadProps(__spreadValues({
1085
+ id,
1086
+ className: (0, import_clsx12.default)(
1087
+ typography.label,
1088
+ align === "left" && "text-left",
1089
+ align === "center" && "text-center",
1090
+ align === "right" && "text-right",
1091
+ className,
1092
+ padded && componentPaddingXUsingComponentGap
1093
+ )
1094
+ }, props), {
1095
+ style: __spreadProps(__spreadValues({}, props.style), {
1096
+ color: color ? `var(--color-${color})` : void 0
1097
+ })
1098
+ })
1099
+ );
1100
+ };
1101
+ Label.displayName = "Label";
1102
+
1103
+ // src/utils/formatting.tsx
1104
+ function getDecimalPlaceholder(decimals) {
1105
+ if (!decimals || decimals <= 0) {
1106
+ return {};
1107
+ }
1108
+ return {
1109
+ placeholder: `0.${"0".repeat(decimals)}`
1110
+ };
1111
+ }
1112
+ function formatDecimalValue(value, decimals) {
1113
+ if (!value || value === "") {
1114
+ return "";
1115
+ }
1116
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
1117
+ if (isNaN(numValue)) {
1118
+ return "";
1119
+ }
1120
+ if (!decimals || decimals <= 0) {
1121
+ return String(Math.round(numValue));
1122
+ }
1123
+ return numValue.toFixed(decimals);
1124
+ }
1125
+ function formatCurrencyDisplay(value) {
1126
+ if (!value || value === "") {
1127
+ return "";
1128
+ }
1129
+ const parts = value.split(".");
1130
+ const integerPart = parts[0];
1131
+ const decimalPart = parts[1];
1132
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1133
+ return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
1134
+ }
1135
+
1136
+ // src/components/Input.tsx
1137
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1138
+ var InputBase = (_a) => {
1139
+ var _b = _a, {
1140
+ id,
1141
+ before,
1142
+ after,
1143
+ type,
1144
+ label,
1145
+ error,
1146
+ className,
1147
+ align = "left",
1148
+ caption,
1149
+ required,
1150
+ selectOnFocus,
1151
+ removeRoundness,
1152
+ inputContainerRef,
1153
+ removeBorder,
1154
+ wrapperClassName,
1155
+ focus,
1156
+ fullWidth = true
1157
+ } = _b, props = __objRest(_b, [
1158
+ "id",
1159
+ "before",
1160
+ "after",
1161
+ "type",
1162
+ "label",
1163
+ "error",
1164
+ "className",
1165
+ "align",
1166
+ "caption",
1167
+ "required",
1168
+ "selectOnFocus",
1169
+ "removeRoundness",
1170
+ "inputContainerRef",
1171
+ "removeBorder",
1172
+ "wrapperClassName",
1173
+ "focus",
1174
+ "fullWidth"
1175
+ ]);
1176
+ const attributes = {
1177
+ "data-error": error && !focus || null,
1178
+ "data-focus": focus || null
1179
+ };
1180
+ const inputRef = (0, import_react6.useRef)(null);
1181
+ const inputId = id ? `${id}-input` : void 0;
1182
+ (0, import_react6.useEffect)(() => {
1183
+ var _a2;
1184
+ const input = inputRef.current;
1185
+ const focusHandler = () => {
1186
+ input == null ? void 0 : input.select();
1187
+ };
1188
+ if (selectOnFocus) {
1189
+ (_a2 = inputRef.current) == null ? void 0 : _a2.addEventListener("focus", focusHandler);
1190
+ return () => {
1191
+ input == null ? void 0 : input.removeEventListener("focus", focusHandler);
1192
+ };
1193
+ }
1194
+ }, [selectOnFocus]);
1195
+ const inputBaseClass = (0, import_clsx13.default)(
1196
+ fullWidth ? "w-full" : "w-fit",
1197
+ "flex flex-row items-center",
1198
+ "bg-background-action-secondary-normal caret-icon-on-action-secondary-normal",
1199
+ componentGap,
1200
+ baseTransition,
1201
+ "outline-transparent outline-2 -outline-offset-2",
1202
+ componentPaddingMinusBorder,
1203
+ !removeRoundness && "rounded-base",
1204
+ !removeBorder && "border border-border-primary-normal",
1205
+ "relative"
1206
+ );
1207
+ const inputFocusClass = (0, import_clsx13.default)(
1208
+ "has-[[data-focus]]:border-transparent has-[[data-focus]]:outline-border-primary-focus focus-within:border-transparent focus-within:outline-border-primary-focus"
1209
+ );
1210
+ const inputDisabledClass = (0, import_clsx13.default)(
1211
+ "has-disabled:bg-background-action-secondary-disabled"
1212
+ );
1213
+ const inputReadOnlyClass = (0, import_clsx13.default)(
1214
+ "has-[input:not(:disabled):read-only]:outline-none has-[input:not(:disabled):read-only]:bg-transparent has-[input:not(:disabled):read-only]:border-transparent has-[input:not(:disabled):read-only]:pl-0"
1215
+ );
1216
+ const inputInvalidClass = (0, import_clsx13.default)(
1217
+ "has-[[data-error]]:border-transparent has-[[data-error]]:not-focus-within:outline-border-primary-error has-[[data-error]]:not-focus-within:outline-1"
1218
+ );
1219
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1220
+ "label",
1221
+ {
1222
+ id,
1223
+ htmlFor: inputId,
1224
+ ref: inputContainerRef,
1225
+ className: (0, import_clsx13.default)(
1226
+ "w-full flex flex-col",
1227
+ "block",
1228
+ "text-text-primary-normal has-disabled:text-text-primary-disabled",
1229
+ componentGap
1230
+ ),
1231
+ style: __spreadValues({}, props.style),
1232
+ children: [
1233
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_clsx13.default)("flex items-center", componentGap), children: [
1234
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1235
+ Label,
1236
+ {
1237
+ id: id ? `${id}-label` : void 0,
1238
+ className: (0, import_clsx13.default)(
1239
+ props.disabled || props.readOnly ? "cursor-default" : "cursor-pointer"
1240
+ ),
1241
+ children: label
1242
+ }
1243
+ ),
1244
+ required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1245
+ "span",
1246
+ {
1247
+ className: (0, import_clsx13.default)(typography.label, "text-text-critical-normal"),
1248
+ children: "*"
1249
+ }
1250
+ )
1251
+ ] }),
1252
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1253
+ "div",
1254
+ {
1255
+ className: (0, import_clsx13.default)(
1256
+ inputBaseClass,
1257
+ !props.disabled && inputInvalidClass,
1258
+ inputFocusClass,
1259
+ inputDisabledClass,
1260
+ inputReadOnlyClass,
1261
+ wrapperClassName
1262
+ ),
1263
+ children: [
1264
+ before,
1265
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1266
+ "input",
1267
+ __spreadProps(__spreadValues(__spreadValues({
1268
+ ref: (el) => {
1269
+ inputRef.current = el;
1270
+ },
1271
+ type,
1272
+ required
1273
+ }, props), attributes), {
1274
+ id: inputId,
1275
+ className: (0, import_clsx13.default)(
1276
+ "flex-1 outline-none w-full max-w-full min-h-6 min-w-0",
1277
+ "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",
1278
+ "placeholder:text-text-secondary-normal disabled:text-text-secondary-disabled",
1279
+ align === "right" && "text-right",
1280
+ align === "center" && "text-center",
1281
+ componentPaddingXUsingComponentGap,
1282
+ typography.paragraph,
1283
+ className,
1284
+ props.readOnly && !props.disabled && "!px-0"
1285
+ )
1286
+ })
1287
+ ),
1288
+ after
1289
+ ]
1290
+ }
1291
+ ),
1292
+ caption && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { id: id ? `${id}-caption` : void 0, children: caption })
1293
+ ]
1294
+ }
1295
+ );
1296
+ };
1297
+ var Input = (_a) => {
1298
+ var _b = _a, {
1299
+ variant = "default",
1300
+ decimals,
1301
+ uom,
1302
+ removeSearchIcon,
1303
+ value: propValue,
1304
+ onChange,
1305
+ onBlur,
1306
+ onClear,
1307
+ id
1308
+ } = _b, props = __objRest(_b, [
1309
+ "variant",
1310
+ "decimals",
1311
+ "uom",
1312
+ "removeSearchIcon",
1313
+ "value",
1314
+ "onChange",
1315
+ "onBlur",
1316
+ "onClear",
1317
+ "id"
1318
+ ]);
1319
+ const [internalValue, setInternalValue] = (0, import_react6.useState)("");
1320
+ const [displayValue, setDisplayValue] = (0, import_react6.useState)("");
1321
+ (0, import_react6.useEffect)(() => {
1322
+ var _a2;
1323
+ const stringValue = (_a2 = propValue == null ? void 0 : propValue.toString()) != null ? _a2 : "";
1324
+ if (variant === "currency") {
1325
+ if (propValue === void 0 || propValue === "" || typeof propValue === "number" && isNaN(propValue)) {
1326
+ setInternalValue("");
1327
+ setDisplayValue("");
1328
+ } else {
1329
+ const numValue = typeof propValue === "string" ? parseFloat(propValue) : propValue;
1330
+ if (!isNaN(numValue)) {
1331
+ const formatted = numValue.toFixed(decimals != null ? decimals : 2);
1332
+ setInternalValue(formatted);
1333
+ setDisplayValue(formatCurrencyDisplay(formatted));
1334
+ }
1335
+ }
1336
+ } else {
1337
+ setInternalValue(stringValue);
1338
+ setDisplayValue(stringValue);
1339
+ }
1340
+ }, [propValue, decimals, variant]);
1341
+ const getInputProps = () => {
1342
+ var _a2;
1343
+ const baseProps = __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, props), {
1344
+ id
1345
+ }), getDecimalPlaceholder(decimals)), {
1346
+ value: propValue
1347
+ });
1348
+ switch (variant) {
1349
+ case "search":
1350
+ return __spreadProps(__spreadValues({}, baseProps), {
1351
+ placeholder: (_a2 = props.placeholder) != null ? _a2 : "Search",
1352
+ className: "!mr-6",
1353
+ value: displayValue
1354
+ });
1355
+ case "finder":
1356
+ return baseProps;
1357
+ case "currency":
1358
+ return __spreadProps(__spreadValues({}, baseProps), {
1359
+ align: "right",
1360
+ type: "text",
1361
+ value: displayValue
1362
+ });
1363
+ case "percentage":
1364
+ case "uom":
1365
+ return __spreadProps(__spreadValues({}, baseProps), {
1366
+ type: "number",
1367
+ align: "right"
1368
+ });
1369
+ default:
1370
+ return baseProps;
1371
+ }
1372
+ };
1373
+ const getBeforeElement = () => {
1374
+ if (props.before) return props.before;
1375
+ switch (variant) {
1376
+ case "search":
1377
+ return !removeSearchIcon ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "search" }) }) : null;
1378
+ case "currency":
1379
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "attach_money" }) });
1380
+ default:
1381
+ return null;
1382
+ }
1383
+ };
1384
+ const getAfterElement = () => {
1385
+ if (props.after) return props.after;
1386
+ switch (variant) {
1387
+ case "search": {
1388
+ const hasValue = displayValue.length > 0;
1389
+ return hasValue && !props.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1390
+ Icon,
1391
+ {
1392
+ id: id ? `${id}-clear-button` : void 0,
1393
+ name: "close",
1394
+ onClick: handleSearchReset,
1395
+ className: "cursor-pointer absolute right-2 bottom-2/4 translate-y-2/4"
1396
+ }
1397
+ ) : null;
1398
+ }
1399
+ case "finder":
1400
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "search" });
1401
+ case "uom":
1402
+ return uom ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-text-secondary-normal uppercase", children: uom.slice(0, 4) }) : null;
1403
+ case "percentage":
1404
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: "percent" }) });
1405
+ default:
1406
+ return null;
1407
+ }
1408
+ };
1409
+ const handleSearchReset = () => {
1410
+ setInternalValue("");
1411
+ setDisplayValue("");
1412
+ if (onChange) {
1413
+ const syntheticEvent = {
1414
+ target: { value: "" }
1415
+ };
1416
+ if (typeof onChange === "function") {
1417
+ onChange(syntheticEvent);
1418
+ }
1419
+ }
1420
+ onClear == null ? void 0 : onClear();
1421
+ };
1422
+ const handleChange = (e) => {
1423
+ const rawValue = e.target.value;
1424
+ if (variant === "search") {
1425
+ setInternalValue(rawValue);
1426
+ setDisplayValue(rawValue);
1427
+ if (typeof onChange === "function") {
1428
+ onChange(e);
1429
+ }
1430
+ return;
1431
+ }
1432
+ if (variant === "currency") {
1433
+ const raw = rawValue.replace(/,/g, "");
1434
+ if (raw === "") {
1435
+ setInternalValue("");
1436
+ setDisplayValue("");
1437
+ if (onChange) {
1438
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
1439
+ target: __spreadProps(__spreadValues({}, e.target), { value: "" })
1440
+ });
1441
+ onChange(syntheticEvent);
1442
+ }
1443
+ return;
1444
+ }
1445
+ const regex = /^\d*\.?\d*$/;
1446
+ if (!regex.test(raw)) return;
1447
+ const parts = raw.split(".");
1448
+ const currentDecimals = decimals != null ? decimals : 2;
1449
+ if (parts.length === 2 && parts[1].length > currentDecimals) return;
1450
+ setInternalValue(raw);
1451
+ setDisplayValue(formatCurrencyDisplay(raw));
1452
+ const asNumber = Number(raw);
1453
+ if (!isNaN(asNumber) && onChange) {
1454
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
1455
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
1456
+ });
1457
+ onChange(syntheticEvent);
1458
+ }
1459
+ return;
1460
+ }
1461
+ setInternalValue(rawValue);
1462
+ setDisplayValue(rawValue);
1463
+ if (typeof onChange === "function") {
1464
+ onChange(e);
1465
+ }
1466
+ };
1467
+ const handleBlur = (e) => {
1468
+ if (variant === "currency") {
1469
+ const formatted = formatDecimalValue(internalValue, decimals != null ? decimals : 2);
1470
+ setInternalValue(formatted);
1471
+ setDisplayValue(formatCurrencyDisplay(formatted));
1472
+ const asNumber = Number(formatted);
1473
+ if (!isNaN(asNumber) && onChange) {
1474
+ const syntheticEvent = __spreadProps(__spreadValues({}, e), {
1475
+ target: __spreadProps(__spreadValues({}, e.target), { value: asNumber.toString() })
1476
+ });
1477
+ onChange(syntheticEvent);
1478
+ }
1479
+ } else if (variant === "uom" || variant === "percentage") {
1480
+ const formattedValue = formatDecimalValue(e.target.value, decimals);
1481
+ e.target.value = formattedValue;
1482
+ }
1483
+ onBlur == null ? void 0 : onBlur(e);
1484
+ };
1485
+ const inputProps = getInputProps();
1486
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1487
+ InputBase,
1488
+ __spreadProps(__spreadValues({}, inputProps), {
1489
+ before: getBeforeElement(),
1490
+ after: getAfterElement(),
1491
+ onChange: handleChange,
1492
+ onBlur: handleBlur
1493
+ })
1494
+ );
1495
+ };
1496
+ Input.displayName = "Input";
1497
+ var Finder = (props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "finder" }));
1498
+ var UOM = (props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "uom" }));
1499
+ var Currency = (props) => {
1500
+ var _a;
1501
+ const handleCurrencyChange = (e) => {
1502
+ var _a2;
1503
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, e);
1504
+ };
1505
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1506
+ Input,
1507
+ __spreadProps(__spreadValues({}, props), {
1508
+ variant: "currency",
1509
+ decimals: (_a = props.decimals) != null ? _a : 2,
1510
+ onChange: handleCurrencyChange
1511
+ })
1512
+ );
1513
+ };
1514
+ var Percentage = (props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input, __spreadProps(__spreadValues({}, props), { variant: "percentage" }));
1515
+ Finder.displayName = "Finder";
1516
+ UOM.displayName = "UOM";
1517
+ Currency.displayName = "Currency";
1518
+ Percentage.displayName = "Percentage";
1519
+
1520
+ // src/components/Card.tsx
1521
+ var import_clsx14 = __toESM(require("clsx"), 1);
1522
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1523
+ function Card(props) {
1524
+ const _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1526
+ "div",
1527
+ __spreadProps(__spreadValues({}, rest), {
1528
+ className: (0, import_clsx14.default)(
1529
+ "border rounded-sm border-border-primary-normal p-desktop-layout-padding",
1530
+ rest.className
1531
+ ),
1532
+ children
1533
+ })
1534
+ );
1535
+ }
1536
+
1537
+ // src/components/PaymentOnAccountModal.tsx
1538
+ var import_react8 = require("react");
1539
+
1540
+ // src/components/SelectPaymentMethod.tsx
1541
+ var import_react7 = require("react");
1542
+
1543
+ // src/components/Accordion.tsx
1544
+ var import_clsx15 = __toESM(require("clsx"), 1);
1545
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1546
+ function Accordion(props) {
1547
+ const { isOpen, onClick, className } = props;
1548
+ const {
1549
+ title,
1550
+ before,
1551
+ after = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1552
+ Icon,
1553
+ {
1554
+ name: "expand_more",
1555
+ className: (0, import_clsx15.default)(
1556
+ "text-icon-primary-normal transform transition-all duration-300 ease-in-out",
1557
+ isOpen ? "rotate-180" : "rotate-0"
1558
+ )
1559
+ }
1560
+ ),
1561
+ children
1562
+ } = props;
1563
+ function handleClick(e) {
1564
+ e.stopPropagation();
1565
+ e.preventDefault();
1566
+ onClick == null ? void 0 : onClick();
1567
+ }
1568
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1569
+ Card,
1570
+ {
1571
+ className: (0, import_clsx15.default)(
1572
+ "overflow-hidden select-none cursor-pointer",
1573
+ className,
1574
+ isOpen && "border-2 !border-border-primary-focus"
1575
+ ),
1576
+ onClick: handleClick,
1577
+ children: [
1578
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
1579
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
1580
+ before,
1581
+ typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Paragraph, { className: "text-text-primary-normal", children: title }) : title
1582
+ ] }),
1583
+ after
1584
+ ] }),
1585
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1586
+ "div",
1587
+ {
1588
+ className: (0, import_clsx15.default)("grid transition-all duration-300 ease-in-out"),
1589
+ style: {
1590
+ gridTemplateRows: isOpen ? "1fr" : "0fr"
1591
+ },
1592
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1593
+ "div",
1594
+ {
1595
+ className: (0, import_clsx15.default)(
1596
+ typography.paragraph,
1597
+ "text-text-primary-normal desktop:pt-desktop-layout-gap",
1598
+ "flex flex-col gap-desktop-layout-gap"
1599
+ ),
1600
+ onClick: (e) => e.stopPropagation(),
1601
+ children
1602
+ }
1603
+ ) })
1604
+ }
1605
+ )
1606
+ ]
1607
+ }
1608
+ );
1609
+ }
1610
+
1611
+ // src/components/Radio.tsx
1612
+ var import_clsx16 = __toESM(require("clsx"), 1);
1613
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1614
+ var Radio = (_a) => {
1615
+ var _b = _a, {
1616
+ className,
1617
+ label,
1618
+ error,
1619
+ disabled,
1620
+ checked,
1621
+ readOnly,
1622
+ id
1623
+ } = _b, props = __objRest(_b, [
1624
+ "className",
1625
+ "label",
1626
+ "error",
1627
+ "disabled",
1628
+ "checked",
1629
+ "readOnly",
1630
+ "id"
1631
+ ]);
1632
+ const radioId = id;
1633
+ const paragraphColor = disabled ? "text-primary-disabled" : error ? "text-primary-error" : "text-primary-normal";
1634
+ const defaultClassName = (0, import_clsx16.default)(
1635
+ !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"
1636
+ );
1637
+ const errorClassName = (0, import_clsx16.default)(
1638
+ 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 "
1639
+ );
1640
+ const disabledClassName = (0, import_clsx16.default)(
1641
+ disabled && "peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0"
1642
+ );
1643
+ const readonlyClassName = (0, import_clsx16.default)(
1644
+ readOnly && "peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0"
1645
+ );
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1647
+ "label",
1648
+ {
1649
+ htmlFor: radioId,
1650
+ className: (0, import_clsx16.default)(
1651
+ "flex items-center",
1652
+ componentGap,
1653
+ disabled ? "cursor-default" : "cursor-pointer",
1654
+ className
1655
+ ),
1656
+ children: [
1657
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative", children: [
1658
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1659
+ "input",
1660
+ __spreadValues({
1661
+ id: radioId,
1662
+ type: "radio",
1663
+ className: "sr-only peer",
1664
+ disabled,
1665
+ checked,
1666
+ readOnly
1667
+ }, props)
1668
+ ),
1669
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1670
+ "div",
1671
+ {
1672
+ className: (0, import_clsx16.default)(
1673
+ "size-6 rounded-full border flex items-center justify-center",
1674
+ baseTransition,
1675
+ defaultClassName,
1676
+ errorClassName,
1677
+ disabledClassName,
1678
+ readonlyClassName
1679
+ ),
1680
+ children: checked && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1681
+ RadioIcon,
1682
+ {
1683
+ className: (0, import_clsx16.default)(
1684
+ "transition-colors",
1685
+ !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",
1686
+ 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",
1687
+ disabled && "text-icon-on-action-secondary-disabled",
1688
+ readOnly && "text-icon-on-action-secondary-disabled"
1689
+ )
1690
+ }
1691
+ )
1692
+ }
1693
+ )
1694
+ ] }),
1695
+ label && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Paragraph, { id: `${radioId}-label`, padded: true, color: paragraphColor, children: label })
1696
+ ]
1697
+ }
1698
+ );
1699
+ };
1700
+ Radio.displayName = "Radio";
1701
+ var RadioIcon = ({ className }) => {
1702
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1703
+ "svg",
1704
+ {
1705
+ className,
1706
+ xmlns: "http://www.w3.org/2000/svg",
1707
+ width: "24",
1708
+ height: "24",
1709
+ viewBox: "0 0 24 24",
1710
+ fill: "none",
1711
+ children: [
1712
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1713
+ "rect",
1714
+ {
1715
+ x: "1",
1716
+ y: "1",
1717
+ width: "22",
1718
+ height: "22",
1719
+ rx: "11",
1720
+ stroke: "currentColor",
1721
+ strokeWidth: "2"
1722
+ }
1723
+ ),
1724
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "currentColor" })
1725
+ ]
1726
+ }
1727
+ );
1728
+ };
1729
+ RadioIcon.displayName = "RadioIcon";
1730
+
1731
+ // src/components/SelectPaymentMethod.tsx
1732
+ var import_clsx19 = __toESM(require("clsx"), 1);
1733
+
1734
+ // src/components/Checkbox.tsx
1735
+ var import_clsx17 = __toESM(require("clsx"), 1);
1736
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1737
+ var Checkbox = (_a) => {
1738
+ var _b = _a, {
1739
+ label,
1740
+ error,
1741
+ disabled,
1742
+ readOnly,
1743
+ checked,
1744
+ onChange,
1745
+ indeterminate,
1746
+ paragraphClassName,
1747
+ id
1748
+ } = _b, props = __objRest(_b, [
1749
+ "label",
1750
+ "error",
1751
+ "disabled",
1752
+ "readOnly",
1753
+ "checked",
1754
+ "onChange",
1755
+ "indeterminate",
1756
+ "paragraphClassName",
1757
+ "id"
1758
+ ]);
1759
+ const selected = indeterminate || checked;
1760
+ const normalClassName = (0, import_clsx17.default)(
1761
+ !selected && !error && !disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-normal peer-hover:border-border-action-hover peer-hover:bg-background-action-secondary-hover peer-active:border-border-action-active peer-active:bg-background-action-secondary-active"
1762
+ );
1763
+ const normalSelectedClassName = (0, import_clsx17.default)(
1764
+ selected && !error && !disabled && !readOnly && "bg-background-action-primary-normal border-background-action-primary-normal peer-hover:bg-background-action-primary-hover peer-hover:border-background-action-primary-hover peer-active:bg-background-action-primary-active peer-active:border-background-action-primary-active"
1765
+ );
1766
+ const errorClassName = (0, import_clsx17.default)(
1767
+ error && !selected && "bg-background-action-critical-secondary-normal border-border-action-critical-normal peer-hover:border-border-action-critical-hover peer-hover:bg-background-action-critical-secondary-hover peer-active:border-border-action-critical-active peer-active:bg-background-action-secondary-active"
1768
+ );
1769
+ const errorSelectedClassName = (0, import_clsx17.default)(
1770
+ error && selected && "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal peer-hover:bg-background-action-critical-primary-hover peer-hover:border-background-action-critical-primary-hover peer-active:bg-background-action-critical-primary-active peer-active:border-background-action-critical-primary-active"
1771
+ );
1772
+ const disabledClassName = (0, import_clsx17.default)(
1773
+ disabled && !readOnly && "border-border-primary-normal bg-background-action-secondary-disabled peer-checked:bg-icon-on-action-primary-disabled peer-checked:border-icon-on-action-primary-disabled"
1774
+ );
1775
+ const readOnlyClassName = (0, import_clsx17.default)(
1776
+ readOnly && "border-transparent bg-transparent peer-checked:bg-transparent peer-checked:border-transparent"
1777
+ );
1778
+ const checkColor = (0, import_clsx17.default)(
1779
+ selected && !disabled && !readOnly && "color-icon-on-action-primary-normal peer-hover:color-icon-on-action-primary-hover peer-active:color-icon-on-action-primary-active",
1780
+ selected && disabled && "color-background-action-primary-disabled"
1781
+ );
1782
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1783
+ "label",
1784
+ {
1785
+ id,
1786
+ htmlFor: id ? `${id}-input` : void 0,
1787
+ className: (0, import_clsx17.default)(
1788
+ "flex items-center",
1789
+ componentGap,
1790
+ (disabled || readOnly && error || readOnly) && "cursor-default",
1791
+ !(readOnly && error) && !disabled && !readOnly && "cursor-pointer"
1792
+ ),
1793
+ children: [
1794
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative", children: [
1795
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1796
+ "input",
1797
+ __spreadValues({
1798
+ id: id ? `${id}-input` : void 0,
1799
+ type: "checkbox",
1800
+ className: "sr-only peer",
1801
+ disabled,
1802
+ checked: selected,
1803
+ onChange: handleOnChange,
1804
+ "data-indeterminate": indeterminate
1805
+ }, props)
1806
+ ),
1807
+ error && (readOnly || disabled) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_clsx17.default)("size-6", "flex items-center justify-center"), children: selected ? indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "question_mark" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "close" }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1808
+ "div",
1809
+ {
1810
+ className: (0, import_clsx17.default)(
1811
+ "size-6 border rounded-base",
1812
+ "flex items-center justify-center",
1813
+ baseTransition,
1814
+ normalClassName,
1815
+ normalSelectedClassName,
1816
+ errorClassName,
1817
+ errorSelectedClassName,
1818
+ disabledClassName,
1819
+ readOnlyClassName,
1820
+ checkColor
1821
+ ),
1822
+ children: selected ? indeterminate ? readOnly ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "question_mark" }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "remove", className: "pointer-events-none" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "close" }) })
1823
+ }
1824
+ )
1825
+ ] }),
1826
+ label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1827
+ Paragraph,
1828
+ {
1829
+ id: id ? `${id}-label` : void 0,
1830
+ as: "span",
1831
+ padded: true,
1832
+ className: (0, import_clsx17.default)(
1833
+ "text-nowrap",
1834
+ disabled && !error && "!text-text-primary-disabled",
1835
+ error && !disabled && !readOnly && "!text-text-primary-error",
1836
+ paragraphClassName
1837
+ ),
1838
+ children: label
1839
+ }
1840
+ )
1841
+ ]
1842
+ }
1843
+ );
1844
+ function handleOnChange(e) {
1845
+ if (disabled || readOnly || readOnly && error || !onChange) {
1846
+ return;
1847
+ }
1848
+ onChange(e);
1849
+ }
1850
+ };
1851
+ Checkbox.displayName = "Checkbox";
1852
+
1853
+ // src/components/Subheader.tsx
1854
+ var import_clsx18 = __toESM(require("clsx"), 1);
1855
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1856
+ var Subheader = (_a) => {
1857
+ var _b = _a, {
1858
+ className,
1859
+ children,
1860
+ as = "span",
1861
+ align,
1862
+ color,
1863
+ tall,
1864
+ id
1865
+ } = _b, props = __objRest(_b, [
1866
+ "className",
1867
+ "children",
1868
+ "as",
1869
+ "align",
1870
+ "color",
1871
+ "tall",
1872
+ "id"
1873
+ ]);
1874
+ const Element = as;
1875
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1876
+ Element,
1877
+ __spreadProps(__spreadValues({
1878
+ id,
1879
+ className: (0, import_clsx18.default)(
1880
+ typography.subheader,
1881
+ className,
1882
+ align === "left" && "text-left",
1883
+ align === "center" && "text-center",
1884
+ align === "right" && "text-right",
1885
+ tall && "!leading-6"
1886
+ ),
1887
+ style: __spreadProps(__spreadValues({}, props.style), {
1888
+ color: color ? `var(--color-${color})` : void 0
1889
+ })
1890
+ }, props), {
1891
+ children
1892
+ })
1893
+ );
1894
+ };
1895
+ Subheader.displayName = "Subheader";
1896
+
1897
+ // src/components/HorizontalDivider.tsx
1898
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1899
+ function HorizontalDivider({ id }) {
1900
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("hr", { id, className: "w-full border-t border-border-primary-normal" });
1901
+ }
1902
+
1903
+ // src/components/SelectPaymentMethod.tsx
1904
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1905
+ function SelectPaymentMethod(props) {
1906
+ const {
1907
+ selectedMethod,
1908
+ onSelectMethod,
1909
+ selectedCredits,
1910
+ allCredits,
1911
+ allowedMethods,
1912
+ selectedACHBankGuid,
1913
+ setSelectedACHBankGuid,
1914
+ customerBanks,
1915
+ onPay,
1916
+ isPayLoading
1917
+ } = props;
1918
+ function handleToggle(method) {
1919
+ onSelectMethod(method);
1920
+ }
1921
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
1922
+ !!(allCredits == null ? void 0 : allCredits.length) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1923
+ CreditsSelector,
1924
+ {
1925
+ selectedCredits: selectedCredits || [],
1926
+ allCredits: allCredits || [],
1927
+ setSelectedCredits: props.setSelectedCredits || (() => {
1928
+ })
1929
+ }
1930
+ ),
1931
+ (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1932
+ ACHSelector,
1933
+ {
1934
+ selectedMethod,
1935
+ handleToggle,
1936
+ selectedBankGuid: selectedACHBankGuid || null,
1937
+ setSelectedBankGuid: setSelectedACHBankGuid || (() => {
1938
+ }),
1939
+ customerBanks: customerBanks || [],
1940
+ onPay,
1941
+ isPayLoading: isPayLoading || false
1942
+ }
1943
+ ),
1944
+ (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1945
+ Accordion,
1946
+ {
1947
+ isOpen: selectedMethod === "CCPayment",
1948
+ title: "Pay by Credit/Debit Card",
1949
+ before: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Radio, { checked: selectedMethod === "CCPayment", readOnly: true }),
1950
+ onClick: () => handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment"),
1951
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Proceed to Payment" })
1952
+ }
1953
+ )
1954
+ ] });
1955
+ }
1956
+ function ACHSelector(props) {
1957
+ var _a;
1958
+ const {
1959
+ selectedMethod,
1960
+ handleToggle,
1961
+ selectedBankGuid,
1962
+ setSelectedBankGuid,
1963
+ customerBanks,
1964
+ onPay,
1965
+ isPayLoading
1966
+ } = props;
1967
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
1968
+ (0, import_react7.useEffect)(() => {
1969
+ if (selectedMethod === "CCPayment") return setIsOpen(false);
1970
+ }, [selectedMethod]);
1971
+ (0, import_react7.useEffect)(() => {
1972
+ if (isOpen) {
1973
+ if (!selectedBankGuid) {
1974
+ setSelectedBankGuid(customerBanks[0].CustBankGUID);
1975
+ }
1976
+ handleToggle("ACHPayment");
1977
+ return;
1978
+ }
1979
+ }, [isOpen]);
1980
+ function handleBankSelect(e, bankGuid) {
1981
+ e.stopPropagation();
1982
+ setSelectedBankGuid(bankGuid);
1983
+ handleToggle("ACHPayment");
1984
+ }
1985
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1986
+ Accordion,
1987
+ {
1988
+ isOpen,
1989
+ title: selectedBankGuid ? (_a = customerBanks.find((bank) => bank.CustBankGUID === selectedBankGuid)) == null ? void 0 : _a.AccountDisplayString : "Select a Bank",
1990
+ before: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1991
+ Radio,
1992
+ {
1993
+ checked: !!selectedBankGuid && selectedMethod === "ACHPayment",
1994
+ readOnly: true
1995
+ }
1996
+ ),
1997
+ onClick: () => setIsOpen((prev) => !prev),
1998
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
1999
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2000
+ Stack,
2001
+ {
2002
+ sizing: "layout-group",
2003
+ width: "full",
2004
+ overflowY: "auto",
2005
+ maxHeight: 200,
2006
+ children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2007
+ Card,
2008
+ {
2009
+ className: (0, import_clsx19.default)(
2010
+ "transition-colors duration-300 py-desktop-compact-layout-padding cursor-pointer hover:bg-background-secondary-normal/30",
2011
+ selectedBankGuid === bank.CustBankGUID && "bg-background-secondary-normal/20"
2012
+ ),
2013
+ onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
2014
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Stack, { horizontal: true, items: "center", justify: "between", children: [
2015
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
2016
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "question_mark" }),
2017
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Paragraph, { children: bank.AccountDisplayString })
2018
+ ] }),
2019
+ selectedBankGuid === bank.CustBankGUID && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "check" })
2020
+ ] })
2021
+ },
2022
+ bank.CustBankGUID
2023
+ ))
2024
+ }
2025
+ ),
2026
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { className: "w-full", onClick: onPay, disabled: isPayLoading, children: isPayLoading ? "Processing..." : "Submit Payment" })
2027
+ ] })
2028
+ }
2029
+ );
2030
+ }
2031
+ function CreditsSelector(props) {
2032
+ const { selectedCredits, allCredits, setSelectedCredits } = props;
2033
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(true);
2034
+ const handleCreditSelect = (credit) => {
2035
+ if (setSelectedCredits) {
2036
+ setSelectedCredits(
2037
+ (prev) => prev.includes(credit) ? prev.filter((c) => c !== credit) : [...prev, credit]
2038
+ );
2039
+ }
2040
+ };
2041
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2042
+ Accordion,
2043
+ {
2044
+ isOpen,
2045
+ title: "Available Credits",
2046
+ onClick: () => setIsOpen((prev) => !prev),
2047
+ children: [
2048
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HorizontalDivider, {}),
2049
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2050
+ Stack,
2051
+ {
2052
+ sizing: "layout-group",
2053
+ width: "full",
2054
+ overflowY: "auto",
2055
+ maxHeight: 300,
2056
+ children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2057
+ Stack,
2058
+ {
2059
+ horizontal: true,
2060
+ justify: "between",
2061
+ items: "center",
2062
+ sizing: "layout-group",
2063
+ children: [
2064
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2065
+ Stack,
2066
+ {
2067
+ horizontal: true,
2068
+ items: "center",
2069
+ sizing: "layout-group",
2070
+ onClick: () => handleCreditSelect(credits),
2071
+ paddingY: true,
2072
+ children: [
2073
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2074
+ Checkbox,
2075
+ {
2076
+ checked: selectedCredits == null ? void 0 : selectedCredits.includes(credits),
2077
+ onChange: () => handleCreditSelect(credits)
2078
+ }
2079
+ ),
2080
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Paragraph, { children: credits.InvoiceNumber })
2081
+ ]
2082
+ }
2083
+ ),
2084
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Subheader, { className: " pr-desktop-component-padding", children: [
2085
+ "$",
2086
+ formatCurrencyDisplay(`${Math.abs(credits.InvoiceBalance)}`)
2087
+ ] })
2088
+ ]
2089
+ },
2090
+ credits.AROpenGUID
2091
+ ))
2092
+ }
2093
+ ) })
2094
+ ]
2095
+ }
2096
+ );
2097
+ }
2098
+
2099
+ // src/components/PaymentOnAccountModal.tsx
2100
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2101
+ function PaymentOnAccountModal(props) {
2102
+ const { isOpen, paymentProps, onClose } = props;
2103
+ const [amount, setAmount] = (0, import_react8.useState)(paymentProps.amountToPay);
2104
+ (0, import_react8.useEffect)(() => {
2105
+ setAmount(paymentProps.amountToPay);
2106
+ }, [paymentProps.amountToPay]);
2107
+ function handleAmountChange(event) {
2108
+ const value = event.target.value.replace(/[^0-9.-]+/g, "");
2109
+ setAmount(+value || 0);
2110
+ }
2111
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Modal, { open: isOpen, onClose, title: "Payment on Account", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Stack, { sizing: "layout-group", width: "full", children: [
2112
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Card, { className: "py-desktop-component-padding", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Stack, { sizing: "component", justify: "between", items: "center", horizontal: true, children: [
2113
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Paragraph, { className: "w-full", children: "Amount to Pay" }),
2114
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2115
+ Input,
2116
+ {
2117
+ type: "number",
2118
+ placeholder: "$0.00",
2119
+ align: "right",
2120
+ value: amount === 0 ? "" : amount,
2121
+ onChange: handleAmountChange,
2122
+ before: "$"
2123
+ }
2124
+ ) })
2125
+ ] }) }),
2126
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectPaymentMethod, __spreadValues({}, paymentProps))
2127
+ ] }) });
2128
+ }
2129
+ // Annotate the CommonJS export names for ESM import in node:
2130
+ 0 && (module.exports = {
2131
+ PaymentOnAccountModal
2132
+ });