@dmsi/wedgekit-react 0.0.161 → 0.0.162

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.
@@ -1,1355 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __defProps = Object.defineProperties;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
- var __objRest = (source, exclude) => {
27
- var target = {};
28
- for (var prop in source)
29
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
- target[prop] = source[prop];
31
- if (source != null && __getOwnPropSymbols)
32
- for (var prop of __getOwnPropSymbols(source)) {
33
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
- target[prop] = source[prop];
35
- }
36
- return target;
37
- };
38
- var __export = (target, all) => {
39
- for (var name in all)
40
- __defProp(target, name, { get: all[name], enumerable: true });
41
- };
42
- var __copyProps = (to, from, except, desc) => {
43
- if (from && typeof from === "object" || typeof from === "function") {
44
- for (let key of __getOwnPropNames(from))
45
- if (!__hasOwnProp.call(to, key) && key !== except)
46
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
- }
48
- return to;
49
- };
50
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
- // If the importer is in node compatibility mode or this is not an ESM
52
- // file that has been converted to a CommonJS file using a Babel-
53
- // compatible transform (i.e. "__esModule" has not been set), then set
54
- // "default" to the CommonJS "module.exports" for node compatibility.
55
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
- mod
57
- ));
58
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
59
-
60
- // src/components/SelectPaymentMethod.tsx
61
- var SelectPaymentMethod_exports = {};
62
- __export(SelectPaymentMethod_exports, {
63
- SelectPaymentMethod: () => SelectPaymentMethod
64
- });
65
- module.exports = __toCommonJS(SelectPaymentMethod_exports);
66
- var import_react = require("react");
67
-
68
- // src/components/Accordion.tsx
69
- var import_clsx6 = __toESM(require("clsx"), 1);
70
-
71
- // src/classNames.ts
72
- var import_clsx = __toESM(require("clsx"), 1);
73
- var typography = {
74
- display1: (0, import_clsx.default)(
75
- "font-sans font-semibold",
76
- "text-display-1-mobile desktop:text-display-1-desktop compact:text-display-1-desktop-compact",
77
- "leading-display-1-mobile desktop:leading-display-1-desktop"
78
- ),
79
- display2: (0, import_clsx.default)(
80
- "font-sans font-bold",
81
- "text-display-2-mobile desktop:text-display-2-desktop compact:text-display-2-desktop-compact",
82
- "leading-display-2-mobile desktop:leading-display-2-desktop"
83
- ),
84
- heading1: (0, import_clsx.default)(
85
- "font-sans font-semibold",
86
- "text-heading-1-mobile desktop:text-heading-1-desktop compact:text-heading-1-desktop-compact",
87
- "leading-heading-1-mobile desktop:leading-heading-1-desktop"
88
- ),
89
- heading2: (0, import_clsx.default)(
90
- "font-sans font-normal",
91
- "text-heading-2-mobile desktop:text-heading-2-desktop compact:text-heading-2-desktop-compact",
92
- "leading-heading-2-mobile desktop:leading-heading-2-desktop"
93
- ),
94
- heading3: (0, import_clsx.default)(
95
- "font-sans font-semibold",
96
- "text-heading-3-mobile desktop:text-heading-3-desktop compact:text-heading-3-desktop-compact",
97
- "leading-heading-3-mobile desktop:leading-heading-3-desktop"
98
- ),
99
- subheader: (0, import_clsx.default)(
100
- "font-sans font-semibold",
101
- "text-subheader-mobile desktop:text-subheader-desktop compact:text-subheader-desktop-compact",
102
- "leading-subheader-mobile desktop:leading-subheader-desktop"
103
- ),
104
- link: (0, import_clsx.default)(
105
- "font-sans font-normal",
106
- "text-link-mobile desktop:text-link-desktop compact:text-link-desktop-compact",
107
- "leading-link-mobile desktop:leading-link-desktop"
108
- ),
109
- buttonLabel: (0, import_clsx.default)(
110
- "font-sans font-semibold",
111
- "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
112
- "leading-label-mobile desktop:leading-label-desktop"
113
- ),
114
- label: (0, import_clsx.default)(
115
- "font-sans font-semibold",
116
- "text-label-mobile desktop:text-label-desktop compact:text-label-desktop-compact",
117
- "leading-label-mobile desktop:leading-label-desktop"
118
- ),
119
- paragraph: (0, import_clsx.default)(
120
- "font-sans font-normal",
121
- "text-paragraph-mobile desktop:text-paragraph-desktop compact:text-paragraph-desktop-compact",
122
- "leading-paragraph-mobile desktop:leading-paragraph-desktop"
123
- ),
124
- caption: (0, import_clsx.default)(
125
- "font-sans font-normal",
126
- "text-caption-mobile desktop:text-caption-desktop compact:text-caption-desktop-compact",
127
- "leading-caption-mobile desktop:leading-caption-desktop"
128
- )
129
- };
130
- var baseTransition = (0, import_clsx.default)(
131
- "transition-colors duration-100 ease-in-out"
132
- );
133
- var componentGap = (0, import_clsx.default)(
134
- "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-desktop-compact-component-gap"
135
- );
136
- var paddingUsingComponentGap = (0, import_clsx.default)(
137
- "p-mobile-component-gap desktop:p-desktop-component-gap compact:p-desktop-compact-component-gap"
138
- );
139
- var paddingXUsingLayoutGroupGap = (0, import_clsx.default)(
140
- "px-mobile-layout-group-gap desktop:px-desktop-layout-group-gap compact:px-desktop-compact-layout-group-gap"
141
- );
142
- var paddingYUsingLayoutGroupGap = (0, import_clsx.default)(
143
- "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
144
- );
145
- var componentPadding = (0, import_clsx.default)(
146
- "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding"
147
- );
148
- var componentPaddingBottom = (0, import_clsx.default)(
149
- "pb-mobile-component-padding desktop:pb-desktop-component-padding compact:pb-desktop-compact-component-padding"
150
- );
151
- var componentPaddingX = (0, import_clsx.default)(
152
- "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding"
153
- );
154
- var componentPaddingY = (0, import_clsx.default)(
155
- "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding"
156
- );
157
- var componentPaddingXUsingComponentGap = (0, import_clsx.default)(
158
- "px-mobile-component-gap desktop:px-desktop-component-gap compact:px-desktop-compact-component-gap"
159
- );
160
- var componentPaddingYUsingComponentGap = (0, import_clsx.default)(
161
- "py-mobile-component-gap desktop:py-desktop-component-gap compact:py-desktop-compact-component-gap"
162
- );
163
- var componentPaddingMinusBorder = (0, import_clsx.default)(
164
- "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)]"
165
- );
166
- var componentPaddingMinus2pxBorder = (0, import_clsx.default)(
167
- "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)]"
168
- );
169
- var layoutPaddding = (0, import_clsx.default)(
170
- "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding"
171
- );
172
- var layoutPaddingBottom = (0, import_clsx.default)(
173
- "pb-mobile-layout-padding desktop:pb-desktop-layout-padding compact:pb-desktop-compact-layout-padding"
174
- );
175
- var layoutPaddingY = (0, import_clsx.default)(
176
- "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding"
177
- );
178
- var containerPaddingX = (0, import_clsx.default)(
179
- "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding"
180
- );
181
- var containerPaddingY = (0, import_clsx.default)(
182
- "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding"
183
- );
184
- var layoutGroupGapPaddingY = (0, import_clsx.default)(
185
- "py-mobile-layout-group-gap desktop:py-desktop-layout-group-gap compact:py-desktop-compact-layout-group-gap"
186
- );
187
- var layoutGroupGap = (0, import_clsx.default)(
188
- "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-desktop-compact-layout-group-gap"
189
- );
190
- var layoutGap = (0, import_clsx.default)(
191
- "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-desktop-compact-layout-gap"
192
- );
193
- var gapUsingContainerPadding = (0, import_clsx.default)(
194
- "gap-mobile-container-padding desktop:gap-desktop-container-padding compact:gap-desktop-compact-container-padding"
195
- );
196
-
197
- // src/components/Card.tsx
198
- var import_clsx2 = __toESM(require("clsx"), 1);
199
- var import_jsx_runtime = require("react/jsx-runtime");
200
- function Card(props) {
201
- const _a = props, { children, selected, testid } = _a, rest = __objRest(_a, ["children", "selected", "testid"]);
202
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
203
- "div",
204
- __spreadProps(__spreadValues({}, rest), {
205
- "data-testid": testid,
206
- className: (0, import_clsx2.default)(
207
- "rounded-sm p-desktop-layout-padding",
208
- selected ? "border-2 border-border-primary-focus" : "border border-border-primary-normal",
209
- rest.className
210
- ),
211
- children
212
- })
213
- );
214
- }
215
-
216
- // src/components/Icon.tsx
217
- var import_clsx3 = __toESM(require("clsx"), 1);
218
- var import_jsx_runtime2 = require("react/jsx-runtime");
219
- function Icon(_a) {
220
- var _b = _a, {
221
- name,
222
- size = 24,
223
- variant = "outline",
224
- testid
225
- } = _b, props = __objRest(_b, [
226
- "name",
227
- "size",
228
- "variant",
229
- "testid"
230
- ]);
231
- const variantStyle = variant === "filled" ? '"FILL" 1' : '"FILL" 0';
232
- const weightStyle = size === 16 ? '"wght" 400' : '"wght" 300';
233
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
234
- "span",
235
- __spreadProps(__spreadValues({}, props), {
236
- "data-testid": testid,
237
- className: (0, import_clsx3.default)(
238
- "icon",
239
- `icon-${size}`,
240
- // size === 16 ? "font-normal" : "font-light", // size 16 font weight is not working as normal from before
241
- props.className
242
- ),
243
- style: __spreadValues({
244
- fontVariationSettings: variantStyle + `, ${weightStyle}`
245
- }, props.style),
246
- children: name
247
- })
248
- );
249
- }
250
-
251
- // src/components/Stack.tsx
252
- var import_clsx4 = __toESM(require("clsx"), 1);
253
- var import_jsx_runtime3 = require("react/jsx-runtime");
254
- var getFlexClassNames = ({ items, justify, grow }) => (0, import_clsx4.default)(
255
- "flex",
256
- items === "start" && "items-start",
257
- grow && "grow",
258
- items === "start" && "items-start",
259
- items === "center" && "items-center",
260
- items === "end" && "items-end",
261
- items === "start-center" && "items-start desktop:items-center",
262
- justify === "start" && "justify-start",
263
- justify === "center" && "justify-center",
264
- justify === "end" && "justify-end",
265
- justify === "end" && "justify-end",
266
- justify === "between" && "justify-between",
267
- justify === "around" && "justify-around"
268
- );
269
- var useGapClassNames = (sizing) => {
270
- return (0, import_clsx4.default)(
271
- sizing === "layout-group" && "gap-mobile-layout-group-gap desktop:gap-desktop-layout-group-gap compact:gap-compact-layout-group-gap",
272
- sizing === "layout" && "gap-mobile-layout-gap desktop:gap-desktop-layout-gap compact:gap-compact-layout-gap",
273
- sizing === "container" && "gap-mobile-container-gap desktop:gap-desktop-container-gap compact:gap-compact-container-gap",
274
- sizing === "component" && "gap-mobile-component-gap desktop:gap-desktop-component-gap compact:gap-compact-component-gap"
275
- );
276
- };
277
- var Stack = (_a) => {
278
- var _b = _a, {
279
- children,
280
- items,
281
- justify,
282
- grow,
283
- padding,
284
- paddingX,
285
- paddingY,
286
- margin,
287
- marginX,
288
- marginY,
289
- horizontal,
290
- horizontalMobile,
291
- elevation = 0,
292
- rounded,
293
- centered,
294
- width,
295
- minHeight,
296
- maxWidth,
297
- minWidth,
298
- height,
299
- maxHeight,
300
- borderColor,
301
- backgroundColor,
302
- sizing = "none",
303
- overflowY = "inherit",
304
- overflowX = "inherit",
305
- flexShrink,
306
- flexGrow,
307
- position,
308
- top,
309
- left,
310
- id,
311
- noGap,
312
- marginTop,
313
- marginBottom,
314
- testid
315
- } = _b, props = __objRest(_b, [
316
- "children",
317
- "items",
318
- "justify",
319
- "grow",
320
- "padding",
321
- "paddingX",
322
- "paddingY",
323
- "margin",
324
- "marginX",
325
- "marginY",
326
- "horizontal",
327
- "horizontalMobile",
328
- "elevation",
329
- "rounded",
330
- "centered",
331
- "width",
332
- "minHeight",
333
- "maxWidth",
334
- "minWidth",
335
- "height",
336
- "maxHeight",
337
- "borderColor",
338
- "backgroundColor",
339
- "sizing",
340
- "overflowY",
341
- "overflowX",
342
- "flexShrink",
343
- "flexGrow",
344
- "position",
345
- "top",
346
- "left",
347
- "id",
348
- "noGap",
349
- "marginTop",
350
- "marginBottom",
351
- "testid"
352
- ]);
353
- const flexClassNames = getFlexClassNames({ items, justify, grow });
354
- const gapClassNames = useGapClassNames(sizing);
355
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
356
- "div",
357
- __spreadProps(__spreadValues({
358
- id,
359
- "data-testid": testid
360
- }, props), {
361
- style: {
362
- height: height === "full" ? "100%" : height !== void 0 ? `${height}px` : void 0,
363
- maxHeight: maxHeight !== void 0 ? `${maxHeight}px` : void 0,
364
- minHeight: minHeight !== void 0 ? `${minHeight}px` : void 0,
365
- maxWidth: maxWidth !== void 0 ? `${maxWidth}px` : void 0,
366
- width: width !== void 0 && typeof width === "number" ? `${width}px` : void 0,
367
- minWidth: minWidth !== void 0 ? `${minWidth}px` : void 0,
368
- border: borderColor ? `1px solid var(--color-${borderColor})` : void 0,
369
- backgroundColor: backgroundColor ? `var(--color-${backgroundColor})` : void 0,
370
- flexGrow: flexGrow !== void 0 ? flexGrow : void 0,
371
- flexShrink: flexShrink !== void 0 ? flexShrink : void 0,
372
- position: position !== void 0 ? position : void 0,
373
- top: top !== void 0 ? `${top}px` : void 0,
374
- left: left !== void 0 ? `${left}px` : void 0
375
- },
376
- className: (0, import_clsx4.default)(
377
- "scrollbar-thin",
378
- "max-w-screen",
379
- width !== "fit" && "w-full",
380
- width === "full" && "w-full",
381
- width === "max" && "w-max",
382
- centered && "mx-auto",
383
- overflowY == "auto" && "overflow-y-auto",
384
- overflowY == "hidden" && "overflow-y-hidden",
385
- overflowY == "scroll" && "overflow-y-scroll",
386
- overflowX == "auto" && "overflow-x-auto",
387
- overflowX == "hidden" && "overflow-x-hidden",
388
- overflowX == "scroll" && "overflow-x-scroll",
389
- padding && sizing === "container" && "p-mobile-container-padding desktop:p-desktop-container-padding compact:p-desktop-compact-container-padding",
390
- padding && sizing === "layout" && "p-mobile-layout-padding desktop:p-desktop-layout-padding compact:p-desktop-compact-layout-padding",
391
- padding && sizing === "layout-group" && "p-mobile-layout-group-padding desktop:p-desktop-layout-group-padding compact:p-desktop-compact-layout-group-padding",
392
- padding && sizing === "component" && "p-mobile-component-padding desktop:p-desktop-component-padding compact:p-desktop-compact-component-padding",
393
- paddingX && sizing === "container" && "px-mobile-container-padding desktop:px-desktop-container-padding compact:px-desktop-compact-container-padding",
394
- paddingX && sizing === "layout" && "px-mobile-layout-padding desktop:px-desktop-layout-padding compact:px-desktop-compact-layout-padding",
395
- paddingX && sizing === "layout-group" && "px-mobile-layout-group-padding desktop:px-desktop-layout-group-padding compact:px-desktop-compact-layout-group-padding",
396
- paddingX && sizing === "component" && "px-mobile-component-padding desktop:px-desktop-component-padding compact:px-desktop-compact-component-padding",
397
- paddingY && sizing === "container" && "py-mobile-container-padding desktop:py-desktop-container-padding compact:py-desktop-compact-container-padding",
398
- paddingY && sizing === "layout" && "py-mobile-layout-padding desktop:py-desktop-layout-padding compact:py-desktop-compact-layout-padding",
399
- paddingY && sizing === "layout-group" && paddingYUsingLayoutGroupGap,
400
- paddingY && sizing === "component" && "py-mobile-component-padding desktop:py-desktop-component-padding compact:py-desktop-compact-component-padding",
401
- margin && sizing === "container" && "m-mobile-container-padding desktop:m-desktop-container-padding compact:m-compact-container-padding",
402
- marginX && sizing === "container" && "mx-mobile-container-padding desktop:mx-desktop-container-padding compact:mx-compact-container-padding",
403
- marginTop && sizing === "container" && "mt-mobile-container-padding desktop:mt-desktop-container-padding compact:mt-compact-container-padding",
404
- marginBottom && sizing === "container" && "mb-mobile-container-padding desktop:mb-desktop-container-padding compact:mb-compact-container-padding",
405
- marginY && sizing === "container" && "my-mobile-container-padding desktop:my-desktop-container-padding compact:my-compact-container-padding",
406
- horizontal ? "desktop:flex-row" : "desktop:flex-col",
407
- horizontalMobile ? "flex-row" : "flex-col",
408
- flexClassNames,
409
- !noGap && gapClassNames,
410
- elevation === 0 && "shadow-none",
411
- elevation === 2 && "shadow-2",
412
- elevation === 4 && "shadow-4",
413
- elevation === 16 && "shadow-16",
414
- rounded && "rounded"
415
- ),
416
- children
417
- })
418
- );
419
- };
420
-
421
- // src/components/Paragraph.tsx
422
- var import_clsx5 = __toESM(require("clsx"), 1);
423
- var import_jsx_runtime4 = require("react/jsx-runtime");
424
- var Paragraph = (_a) => {
425
- var _b = _a, {
426
- className,
427
- color,
428
- padded,
429
- align = "left",
430
- tall,
431
- addOverflow,
432
- children,
433
- as = "p",
434
- id,
435
- testid
436
- } = _b, props = __objRest(_b, [
437
- "className",
438
- "color",
439
- "padded",
440
- "align",
441
- "tall",
442
- "addOverflow",
443
- "children",
444
- "as",
445
- "id",
446
- "testid"
447
- ]);
448
- const Element = as;
449
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
450
- Element,
451
- __spreadProps(__spreadValues({
452
- id,
453
- "data-testid": testid
454
- }, props), {
455
- className: (0, import_clsx5.default)(
456
- typography.paragraph,
457
- className,
458
- padded && componentPaddingXUsingComponentGap,
459
- align === "left" && "text-left",
460
- align === "center" && "text-center",
461
- align === "right" && "text-right",
462
- tall && "!leading-6",
463
- addOverflow && "whitespace-nowrap text-ellipsis overflow-hidden"
464
- ),
465
- style: __spreadProps(__spreadValues({}, props.style), {
466
- color: color ? `var(--color-${color})` : void 0
467
- }),
468
- children
469
- })
470
- );
471
- };
472
- Paragraph.displayName = "Paragraph";
473
-
474
- // src/components/Accordion.tsx
475
- var import_jsx_runtime5 = require("react/jsx-runtime");
476
- function Accordion(props) {
477
- const { isOpen, onClick, className, disabled, testid } = props;
478
- const {
479
- title,
480
- before,
481
- after = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
482
- Icon,
483
- {
484
- name: "expand_more",
485
- className: (0, import_clsx6.default)(
486
- "text-icon-primary-normal transform transition-all duration-300 ease-in-out",
487
- isOpen ? "rotate-180" : "rotate-0"
488
- )
489
- }
490
- ),
491
- children
492
- } = props;
493
- function handleClick(e) {
494
- e.stopPropagation();
495
- e.preventDefault();
496
- onClick == null ? void 0 : onClick();
497
- }
498
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
499
- Card,
500
- {
501
- className: (0, import_clsx6.default)(
502
- "overflow-hidden select-none",
503
- { "cursor-pointer": !disabled },
504
- className
505
- ),
506
- selected: isOpen,
507
- onClick: handleClick,
508
- testid,
509
- children: [
510
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { sizing: "component", horizontal: true, justify: "between", items: "center", children: [
511
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { sizing: "layout-group", horizontal: true, items: "center", children: [
512
- before,
513
- typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Paragraph, { testid: testid ? `${testid}-title` : void 0, className: "text-text-primary-normal", children: title }) : title
514
- ] }),
515
- after
516
- ] }),
517
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
518
- "div",
519
- {
520
- className: (0, import_clsx6.default)("grid transition-all duration-300 ease-in-out"),
521
- style: {
522
- gridTemplateRows: isOpen ? "1fr" : "0fr"
523
- },
524
- "data-testid": testid ? `${testid}-content-container` : void 0,
525
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
526
- "div",
527
- {
528
- className: (0, import_clsx6.default)(
529
- typography.paragraph,
530
- "text-text-primary-normal desktop:pt-desktop-layout-gap",
531
- "flex flex-col gap-desktop-layout-gap"
532
- ),
533
- onClick: (e) => e.stopPropagation(),
534
- children
535
- }
536
- ) })
537
- }
538
- )
539
- ]
540
- }
541
- );
542
- }
543
-
544
- // src/components/Button.tsx
545
- var import_clsx7 = __toESM(require("clsx"), 1);
546
- var import_jsx_runtime6 = require("react/jsx-runtime");
547
- var Button = (_a) => {
548
- var _b = _a, {
549
- variant = "primary",
550
- as = "button",
551
- block,
552
- leftIcon,
553
- rightIcon,
554
- className,
555
- classNameLabel,
556
- disabled = false,
557
- children,
558
- iconOnly = false,
559
- colorClassName,
560
- href,
561
- id,
562
- testid
563
- } = _b, props = __objRest(_b, [
564
- "variant",
565
- "as",
566
- "block",
567
- "leftIcon",
568
- "rightIcon",
569
- "className",
570
- "classNameLabel",
571
- "disabled",
572
- "children",
573
- "iconOnly",
574
- "colorClassName",
575
- "href",
576
- "id",
577
- "testid"
578
- ]);
579
- const primaryVariantStyles = variant === "primary" && (0, import_clsx7.default)(
580
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
581
- "bg-background-action-primary-normal border-background-action-primary-normal",
582
- "hover:bg-background-action-primary-hover hover:border-background-action-primary-hover",
583
- "focus:bg-background-action-primary-hover focus:border-background-action-primary-hover focus:outline-0",
584
- "active:bg-background-action-primary-active active:border-background-action-primary-active",
585
- "disabled:bg-background-action-primary-disabled disabled:border-background-action-primary-disabled disabled:text-text-on-action-primary-disabled"
586
- );
587
- const secondaryVariantStyles = variant === "secondary" && (0, import_clsx7.default)(
588
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
589
- "bg-background-action-secondary-normal border-border-action-normal",
590
- "hover:bg-background-action-secondary-hover hover:border-border-action-hover hover:text-text-action-primary-hover",
591
- "focus:bg-background-action-secondary-hover focus:border-border-action-hover focus:text-text-action-primary-hover focus:outline-0",
592
- "active:bg-background-action-secondary-active active:border-border-action-active active:text-text-action-primary-active",
593
- "disabled:bg-background-action-primary-disabled disabled:border-border-action-disabled disabled:text-text-action-primary-disabled"
594
- );
595
- const tertiaryVariantStyles = variant === "tertiary" && (0, import_clsx7.default)(
596
- "bg-transparent border-transparent",
597
- 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",
598
- "bg-transparent border-transparent",
599
- "hover:bg-background-action-secondary-hover hover:border-background-action-secondary-hover hover:text-text-action-primary-hover",
600
- "focus:bg-background-action-secondary-hover focus:border-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
601
- "active:bg-background-action-secondary-active active:border-transparent active:text-text-action-primary-active",
602
- "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-primary-disabled"
603
- );
604
- const primaryCriticalVariantStyles = variant === "primary-critical" && (0, import_clsx7.default)(
605
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-on-action-primary-normal",
606
- "bg-background-action-critical-primary-normal border-background-action-critical-primary-normal",
607
- "hover:bg-background-action-critical-primary-hover hover:border-background-action-critical-primary-hover",
608
- "focus:bg-background-action-critical-primary-hover focus:border-background-action-critical-primary-hover focus:outline-0",
609
- "active:bg-background-action-critical-primary-active active:border-background-action-critical-primary-active",
610
- "disabled:bg-background-action-critical-primary-disabled disabled:border-background-action-critical-primary-disabled disabled:text-text-on-action-primary-disabled"
611
- );
612
- const secondaryCriticalVariantStyles = variant === "secondary-critical" && (0, import_clsx7.default)(
613
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
614
- "bg-background-action-critical-secondary-normal border-border-action-critical-normal",
615
- "hover:bg-background-action-critical-secondary-hover hover:border-border-action-critical-hover hover:text-text-action-critical-hover",
616
- "focus:bg-background-action-critical-secondary-hover focus:border-border-action-critical-hover focus:text-text-action-critical-hover focus:outline-0",
617
- "active:bg-background-action-critical-secondary-active active:border-border-action-critical-active active:text-text-action-critical-active",
618
- "disabled:bg-background-action-critical-disabled disabled:border-border-action-critical-disabled disabled:text-text-action-critical-disabled"
619
- );
620
- const tertiaryCriticalVariantStyles = variant === "tertiary-critical" && (0, import_clsx7.default)(
621
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-critical-normal",
622
- "bg-transparent border-transparent text-text-action-critical-normal",
623
- "hover:bg-background-action-critical-secondary-hover hover:border-background-action-critical-secondary-hover hover:text-text-action-critical-hover",
624
- "focus:bg-background-action-critical-secondary-hover focus:border-background-action-critical-secondary-hover focus:text-text-action-critical-hover focus:outline-0",
625
- "active:bg-background-action-critical-secondary-active active:border-background-action-critical-secondary-active active:text-text-action-critical-active",
626
- "disabled:bg-transparent disabled:border-transparent disabled:text-text-action-critical-disabled"
627
- );
628
- const navigationVarianStyles = variant === "navigation" && (0, import_clsx7.default)(
629
- (colorClassName == null ? void 0 : colorClassName.trim()) ? colorClassName : "text-text-action-primary-normal",
630
- "bg-transparent",
631
- "hover:bg-background-action-secondary-hover hover:text-text-action-primary-hover",
632
- "focus:bg-background-action-secondary-hover focus:text-text-action-primary-hover focus:outline-0",
633
- "active:bg-background-action-secondary-active active:text-text-action-primary-active",
634
- "disabled:bg-transparent disabled:text-text-on-action-primary-disabled",
635
- "flex-col",
636
- paddingUsingComponentGap
637
- );
638
- const notNavigationVariantStyles = variant !== "navigation" && (0, import_clsx7.default)("border-2 flex-row", componentPaddingMinus2pxBorder, componentGap);
639
- const buttonClasses = (0, import_clsx7.default)(
640
- disabled ? "cursor-default" : "cursor-pointer",
641
- block ? "w-full" : "w-fit",
642
- baseTransition,
643
- "rounded-sm whitespace-nowrap inline-flex items-center justify-center group/btn",
644
- primaryVariantStyles,
645
- secondaryVariantStyles,
646
- tertiaryVariantStyles,
647
- primaryCriticalVariantStyles,
648
- secondaryCriticalVariantStyles,
649
- tertiaryCriticalVariantStyles,
650
- navigationVarianStyles,
651
- notNavigationVariantStyles,
652
- className
653
- );
654
- const labelClasses = (0, import_clsx7.default)(
655
- "min-h-6 flex items-center justify-center",
656
- classNameLabel,
657
- componentPaddingXUsingComponentGap,
658
- typography.buttonLabel
659
- );
660
- const Element = href && !as ? "a" : as;
661
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
662
- Element,
663
- __spreadProps(__spreadValues({
664
- id,
665
- "data-testid": testid,
666
- type: Element === "button" ? "button" : void 0,
667
- className: buttonClasses
668
- }, props), {
669
- onClick: props.onClick,
670
- disabled,
671
- href,
672
- "data-theme": variant === "navigation" ? "brand" : void 0,
673
- children: [
674
- leftIcon && leftIcon,
675
- !iconOnly && children && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id: id ? `${id}-label` : void 0, "data-testid": testid ? `${testid}-label` : void 0, className: labelClasses, children }),
676
- rightIcon && rightIcon
677
- ]
678
- })
679
- );
680
- };
681
- Button.displayName = "Button";
682
-
683
- // src/components/Radio.tsx
684
- var import_clsx8 = __toESM(require("clsx"), 1);
685
- var import_jsx_runtime7 = require("react/jsx-runtime");
686
- var Radio = (_a) => {
687
- var _b = _a, {
688
- className,
689
- label,
690
- error,
691
- disabled,
692
- checked,
693
- readOnly,
694
- id,
695
- testid
696
- } = _b, props = __objRest(_b, [
697
- "className",
698
- "label",
699
- "error",
700
- "disabled",
701
- "checked",
702
- "readOnly",
703
- "id",
704
- "testid"
705
- ]);
706
- const radioId = id;
707
- const paragraphColor = disabled ? "text-primary-disabled" : error ? "text-primary-error" : "text-primary-normal";
708
- const defaultClassName = (0, import_clsx8.default)(
709
- !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"
710
- );
711
- const errorClassName = (0, import_clsx8.default)(
712
- 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 "
713
- );
714
- const disabledClassName = (0, import_clsx8.default)(
715
- disabled && "peer-disabled:bg-background-action-secondary-disabled peer-disabled:border-border-primary-normal peer-checked:border-0"
716
- );
717
- const readonlyClassName = (0, import_clsx8.default)(
718
- readOnly && "peer-read-only:bg-background-action-secondary-disabled peer-read-only:border-border-primary-normal peer-checked:border-0"
719
- );
720
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
721
- "label",
722
- {
723
- htmlFor: radioId,
724
- className: (0, import_clsx8.default)(
725
- "flex items-center",
726
- componentGap,
727
- disabled ? "cursor-default" : "cursor-pointer",
728
- className
729
- ),
730
- children: [
731
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
732
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
733
- "input",
734
- __spreadValues({
735
- id: radioId,
736
- "data-testid": testid,
737
- type: "radio",
738
- className: "sr-only peer",
739
- disabled,
740
- checked,
741
- readOnly
742
- }, props)
743
- ),
744
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
745
- "div",
746
- {
747
- className: (0, import_clsx8.default)(
748
- "size-6 rounded-full border flex items-center justify-center",
749
- baseTransition,
750
- defaultClassName,
751
- errorClassName,
752
- disabledClassName,
753
- readonlyClassName
754
- ),
755
- children: checked && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
756
- RadioIcon,
757
- {
758
- className: (0, import_clsx8.default)(
759
- "transition-colors",
760
- !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",
761
- 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",
762
- disabled && "text-icon-on-action-secondary-disabled",
763
- readOnly && "text-icon-on-action-secondary-disabled"
764
- )
765
- }
766
- )
767
- }
768
- )
769
- ] }),
770
- label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Paragraph, { id: radioId ? `${radioId}-label` : void 0, testid: testid ? `${testid}-label` : void 0, padded: true, color: paragraphColor, children: label })
771
- ]
772
- }
773
- );
774
- };
775
- Radio.displayName = "Radio";
776
- var RadioIcon = ({ className }) => {
777
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
778
- "svg",
779
- {
780
- className,
781
- xmlns: "http://www.w3.org/2000/svg",
782
- width: "24",
783
- height: "24",
784
- viewBox: "0 0 24 24",
785
- fill: "none",
786
- children: [
787
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
788
- "rect",
789
- {
790
- x: "1",
791
- y: "1",
792
- width: "22",
793
- height: "22",
794
- rx: "11",
795
- stroke: "currentColor",
796
- strokeWidth: "2"
797
- }
798
- ),
799
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "currentColor" })
800
- ]
801
- }
802
- );
803
- };
804
- RadioIcon.displayName = "RadioIcon";
805
-
806
- // src/components/Checkbox.tsx
807
- var import_clsx9 = __toESM(require("clsx"), 1);
808
- var import_jsx_runtime8 = require("react/jsx-runtime");
809
- var Checkbox = (_a) => {
810
- var _b = _a, {
811
- label,
812
- error,
813
- disabled,
814
- readOnly,
815
- checked,
816
- onChange,
817
- indeterminate,
818
- paragraphClassName,
819
- id,
820
- testid
821
- } = _b, props = __objRest(_b, [
822
- "label",
823
- "error",
824
- "disabled",
825
- "readOnly",
826
- "checked",
827
- "onChange",
828
- "indeterminate",
829
- "paragraphClassName",
830
- "id",
831
- "testid"
832
- ]);
833
- const selected = indeterminate || checked;
834
- const normalClassName = (0, import_clsx9.default)(
835
- !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"
836
- );
837
- const normalSelectedClassName = (0, import_clsx9.default)(
838
- 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"
839
- );
840
- const errorClassName = (0, import_clsx9.default)(
841
- 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"
842
- );
843
- const errorSelectedClassName = (0, import_clsx9.default)(
844
- 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"
845
- );
846
- const disabledClassName = (0, import_clsx9.default)(
847
- 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"
848
- );
849
- const readOnlyClassName = (0, import_clsx9.default)(
850
- readOnly && "border-transparent bg-transparent peer-checked:bg-transparent peer-checked:border-transparent"
851
- );
852
- const checkColor = (0, import_clsx9.default)(
853
- 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",
854
- selected && disabled && "color-background-action-primary-disabled"
855
- );
856
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
857
- "label",
858
- {
859
- id,
860
- "data-testid": testid,
861
- htmlFor: id ? `${id}-input` : void 0,
862
- className: (0, import_clsx9.default)(
863
- "flex items-center",
864
- componentGap,
865
- (disabled || readOnly && error || readOnly) && "cursor-default",
866
- !(readOnly && error) && !disabled && !readOnly && "cursor-pointer"
867
- ),
868
- children: [
869
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
870
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
871
- "input",
872
- __spreadValues({
873
- id: id ? `${id}-input` : void 0,
874
- "data-testid": testid ? `${testid}-input` : void 0,
875
- type: "checkbox",
876
- className: "sr-only peer",
877
- disabled,
878
- checked: selected,
879
- onChange: handleOnChange,
880
- "data-indeterminate": indeterminate
881
- }, props)
882
- ),
883
- error && (readOnly || disabled) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_clsx9.default)("size-6", "flex items-center justify-center"), children: selected ? indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "question_mark" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "close" }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
884
- "div",
885
- {
886
- className: (0, import_clsx9.default)(
887
- "size-6 border rounded-base",
888
- "flex items-center justify-center",
889
- baseTransition,
890
- normalClassName,
891
- normalSelectedClassName,
892
- errorClassName,
893
- errorSelectedClassName,
894
- disabledClassName,
895
- readOnlyClassName,
896
- checkColor
897
- ),
898
- children: selected ? indeterminate ? readOnly ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "question_mark" }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "remove", className: "pointer-events-none" }) }) : readOnly ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-success-400 contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check" }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-on-action-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "check", className: "pointer-events-none" }) }) : readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-icon-primary-normal contents", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "close" }) })
899
- }
900
- )
901
- ] }),
902
- label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
903
- Paragraph,
904
- {
905
- id: id ? `${id}-label` : void 0,
906
- testid: testid ? `${testid}-label` : void 0,
907
- as: "span",
908
- padded: true,
909
- className: (0, import_clsx9.default)(
910
- "text-nowrap",
911
- disabled && !error && "!text-text-primary-disabled",
912
- error && !disabled && !readOnly && "!text-text-primary-error",
913
- paragraphClassName
914
- ),
915
- children: label
916
- }
917
- )
918
- ]
919
- }
920
- );
921
- function handleOnChange(e) {
922
- if (disabled || readOnly || readOnly && error || !onChange) {
923
- return;
924
- }
925
- onChange(e);
926
- }
927
- };
928
- Checkbox.displayName = "Checkbox";
929
-
930
- // src/components/Subheader.tsx
931
- var import_clsx10 = __toESM(require("clsx"), 1);
932
- var import_jsx_runtime9 = require("react/jsx-runtime");
933
- var Subheader = (_a) => {
934
- var _b = _a, {
935
- className,
936
- children,
937
- as = "span",
938
- align,
939
- color,
940
- tall,
941
- id,
942
- testid
943
- } = _b, props = __objRest(_b, [
944
- "className",
945
- "children",
946
- "as",
947
- "align",
948
- "color",
949
- "tall",
950
- "id",
951
- "testid"
952
- ]);
953
- const Element = as;
954
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
955
- Element,
956
- __spreadProps(__spreadValues({
957
- id,
958
- "data-testid": testid,
959
- className: (0, import_clsx10.default)(
960
- typography.subheader,
961
- className,
962
- align === "left" && "text-left",
963
- align === "center" && "text-center",
964
- align === "right" && "text-right",
965
- tall && "!leading-6"
966
- ),
967
- style: __spreadProps(__spreadValues({}, props.style), {
968
- color: color ? `var(--color-${color})` : void 0
969
- })
970
- }, props), {
971
- children
972
- })
973
- );
974
- };
975
- Subheader.displayName = "Subheader";
976
-
977
- // src/utils/formatting.tsx
978
- function formatDecimalValue(value, decimals) {
979
- if (!value || value === "") {
980
- return "";
981
- }
982
- const numValue = typeof value === "string" ? parseFloat(value) : value;
983
- if (isNaN(numValue)) {
984
- return "";
985
- }
986
- if (!decimals || decimals <= 0) {
987
- return String(Math.round(numValue));
988
- }
989
- return numValue.toFixed(decimals);
990
- }
991
- function formatCurrencyDisplay(value) {
992
- if (!value || value === "") {
993
- return "";
994
- }
995
- const parts = value.split(".");
996
- const integerPart = parts[0];
997
- const decimalPart = parts[1];
998
- const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
999
- return decimalPart !== void 0 ? `${formattedInteger}.${decimalPart}` : formattedInteger;
1000
- }
1001
-
1002
- // src/components/HorizontalDivider.tsx
1003
- var import_clsx11 = __toESM(require("clsx"), 1);
1004
- var import_jsx_runtime10 = require("react/jsx-runtime");
1005
- function HorizontalDivider({ id, testid, hideOnMobile }) {
1006
- const hideOnMobileStyle = (0, import_clsx11.default)(hideOnMobile && "hidden desktop:block");
1007
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("hr", { id, "data-testid": testid, className: (0, import_clsx11.default)("w-full border-t border-border-primary-normal", hideOnMobileStyle) });
1008
- }
1009
-
1010
- // src/components/Spinner.tsx
1011
- var import_jsx_runtime11 = require("react/jsx-runtime");
1012
- var Spinner = ({ size = "small", testid }) => {
1013
- const dimension = size === "large" ? 48 : 24;
1014
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1015
- "svg",
1016
- {
1017
- "data-testid": testid,
1018
- width: dimension,
1019
- height: dimension,
1020
- viewBox: "0 0 24 24",
1021
- xmlns: "http://www.w3.org/2000/svg",
1022
- fill: "#1D1E1E",
1023
- className: "animate-spin",
1024
- "aria-label": "Loading",
1025
- children: [
1026
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "4", r: "2", opacity: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1027
- "animate",
1028
- {
1029
- attributeName: "opacity",
1030
- begin: "0s",
1031
- dur: "1s",
1032
- from: "1",
1033
- to: "0",
1034
- repeatCount: "indefinite"
1035
- }
1036
- ) }),
1037
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "17.666", cy: "6.334", r: "2", opacity: "0.125", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1038
- "animate",
1039
- {
1040
- attributeName: "opacity",
1041
- begin: "-0.875s",
1042
- dur: "1s",
1043
- from: "1",
1044
- to: "0",
1045
- repeatCount: "indefinite"
1046
- }
1047
- ) }),
1048
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "20", cy: "12", r: "2", opacity: "0.25", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1049
- "animate",
1050
- {
1051
- attributeName: "opacity",
1052
- begin: "-0.75s",
1053
- dur: "1s",
1054
- from: "1",
1055
- to: "0",
1056
- repeatCount: "indefinite"
1057
- }
1058
- ) }),
1059
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "17.666", cy: "17.666", r: "2", opacity: "0.375", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1060
- "animate",
1061
- {
1062
- attributeName: "opacity",
1063
- begin: "-0.625s",
1064
- dur: "1s",
1065
- from: "1",
1066
- to: "0",
1067
- repeatCount: "indefinite"
1068
- }
1069
- ) }),
1070
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "12", cy: "20", r: "2", opacity: "0.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1071
- "animate",
1072
- {
1073
- attributeName: "opacity",
1074
- begin: "-0.5s",
1075
- dur: "1s",
1076
- from: "1",
1077
- to: "0",
1078
- repeatCount: "indefinite"
1079
- }
1080
- ) }),
1081
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "6.334", cy: "17.666", r: "2", opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1082
- "animate",
1083
- {
1084
- attributeName: "opacity",
1085
- begin: "-0.375s",
1086
- dur: "1s",
1087
- from: "1",
1088
- to: "0",
1089
- repeatCount: "indefinite"
1090
- }
1091
- ) }),
1092
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "4", cy: "12", r: "2", opacity: "0.75", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1093
- "animate",
1094
- {
1095
- attributeName: "opacity",
1096
- begin: "-0.25s",
1097
- dur: "1s",
1098
- from: "1",
1099
- to: "0",
1100
- repeatCount: "indefinite"
1101
- }
1102
- ) }),
1103
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: "6.334", cy: "6.334", r: "2", opacity: "0.875", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1104
- "animate",
1105
- {
1106
- attributeName: "opacity",
1107
- begin: "-0.125s",
1108
- dur: "1s",
1109
- from: "1",
1110
- to: "0",
1111
- repeatCount: "indefinite"
1112
- }
1113
- ) })
1114
- ]
1115
- }
1116
- );
1117
- };
1118
- Spinner.displayName = "Spinner";
1119
-
1120
- // src/components/WorldpayIframe.tsx
1121
- var import_jsx_runtime12 = require("react/jsx-runtime");
1122
- function WorldpayIframe({ url }) {
1123
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("iframe", { src: url, style: { width: "100%", height: "100%", flex: 1 } });
1124
- }
1125
-
1126
- // src/components/SelectPaymentMethod.tsx
1127
- var import_jsx_runtime13 = require("react/jsx-runtime");
1128
- function SelectPaymentMethod(props) {
1129
- const {
1130
- amountToPay,
1131
- selectedMethod,
1132
- onSelectMethod,
1133
- selectedCredits,
1134
- allCredits,
1135
- allowedMethods,
1136
- selectedACHBankGuid,
1137
- setSelectedACHBankGuid,
1138
- customerBanks,
1139
- onPay,
1140
- isPayLoading,
1141
- withCredits = false,
1142
- isLoadingCCiframe,
1143
- cardPaymentUrl,
1144
- testid
1145
- } = props;
1146
- const payAllWithCredits = withCredits && amountToPay <= 0;
1147
- (0, import_react.useEffect)(() => {
1148
- if (payAllWithCredits) {
1149
- onSelectMethod("CreditsOnly");
1150
- } else {
1151
- onSelectMethod(null);
1152
- }
1153
- }, [onSelectMethod, payAllWithCredits]);
1154
- function handleToggle(method) {
1155
- onSelectMethod(method);
1156
- }
1157
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Stack, { sizing: "layout-group", width: "full", minWidth: 400, children: [
1158
- !!(allCredits == null ? void 0 : allCredits.length) && withCredits && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1159
- CreditsSelector,
1160
- {
1161
- testid: testid ? `${testid}-credit-selector` : void 0,
1162
- selectedCredits: selectedCredits || [],
1163
- allCredits: allCredits || [],
1164
- setSelectedCredits: props.setSelectedCredits || (() => {
1165
- })
1166
- }
1167
- ),
1168
- (allowedMethods == null ? void 0 : allowedMethods.includes("ACHPayment")) && !!(customerBanks == null ? void 0 : customerBanks.length) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1169
- ACHSelector,
1170
- {
1171
- testid: testid ? `${testid}-ach-selector` : void 0,
1172
- selectedMethod,
1173
- handleToggle,
1174
- selectedBankGuid: selectedACHBankGuid || null,
1175
- setSelectedBankGuid: setSelectedACHBankGuid || (() => {
1176
- }),
1177
- customerBanks: customerBanks || [],
1178
- onPay,
1179
- isPayLoading: isPayLoading || false,
1180
- disabled: payAllWithCredits || !amountToPay
1181
- }
1182
- ),
1183
- (allowedMethods == null ? void 0 : allowedMethods.includes("CCPayment")) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1184
- Accordion,
1185
- {
1186
- testid: testid ? `${testid}-cc-payment` : void 0,
1187
- isOpen: !payAllWithCredits && selectedMethod === "CCPayment",
1188
- title: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1189
- Radio,
1190
- {
1191
- testid: testid ? `${testid}-cc-payment-radio` : void 0,
1192
- label: "Pay by Credit/Debit Card",
1193
- checked: !payAllWithCredits && selectedMethod === "CCPayment",
1194
- onChange: (e) => e.stopPropagation(),
1195
- disabled: payAllWithCredits || !amountToPay
1196
- }
1197
- ),
1198
- onClick: () => {
1199
- if (payAllWithCredits || !amountToPay) return;
1200
- handleToggle(selectedMethod === "CCPayment" ? null : "CCPayment");
1201
- },
1202
- disabled: payAllWithCredits || !amountToPay,
1203
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1204
- Stack,
1205
- {
1206
- sizing: "layout-group",
1207
- width: "full",
1208
- items: "center",
1209
- justify: "center",
1210
- style: {
1211
- flex: 1
1212
- },
1213
- minHeight: 245,
1214
- children: !isLoadingCCiframe && cardPaymentUrl ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(WorldpayIframe, { url: cardPaymentUrl }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Spinner, {})
1215
- }
1216
- )
1217
- }
1218
- ),
1219
- selectedMethod === "ACHPayment" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1220
- Button,
1221
- {
1222
- block: true,
1223
- onClick: onPay,
1224
- disabled: isPayLoading || amountToPay <= 0,
1225
- testid: testid ? `${testid}-submit-payment-button` : void 0,
1226
- children: isPayLoading ? "Processing..." : "Submit Payment"
1227
- }
1228
- ),
1229
- payAllWithCredits && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1230
- Button,
1231
- {
1232
- testid: testid ? `${testid}-submit-payment-button` : void 0,
1233
- block: true,
1234
- onClick: onPay,
1235
- disabled: isPayLoading,
1236
- children: isPayLoading ? "Processing..." : "Submit Payment"
1237
- }
1238
- )
1239
- ] });
1240
- }
1241
- function ACHSelector(props) {
1242
- const {
1243
- selectedMethod,
1244
- handleToggle,
1245
- selectedBankGuid,
1246
- setSelectedBankGuid,
1247
- customerBanks,
1248
- disabled,
1249
- testid
1250
- } = props;
1251
- function handleBankSelect(e, bankGuid) {
1252
- if (disabled) return;
1253
- e.stopPropagation();
1254
- setSelectedBankGuid(bankGuid);
1255
- handleToggle("ACHPayment");
1256
- }
1257
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: customerBanks.map((bank) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1258
- Card,
1259
- {
1260
- testid: testid ? `${testid}-bank-${bank.CustBankGUID}` : void 0,
1261
- onClick: (e) => handleBankSelect(e, bank.CustBankGUID),
1262
- selected: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
1263
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1264
- Radio,
1265
- {
1266
- label: `Pay by ${bank.AccountDisplayString}`,
1267
- checked: !disabled && selectedMethod === "ACHPayment" && selectedBankGuid === bank.CustBankGUID,
1268
- disabled,
1269
- onChange: (e) => e.stopPropagation()
1270
- }
1271
- )
1272
- },
1273
- bank.CustBankGUID
1274
- )) });
1275
- }
1276
- function CreditsSelector(props) {
1277
- const { selectedCredits, allCredits, setSelectedCredits, testid } = props;
1278
- const [isOpen, setIsOpen] = (0, import_react.useState)(true);
1279
- const handleCreditSelect = (credit) => {
1280
- if (setSelectedCredits) {
1281
- setSelectedCredits(
1282
- (prev) => prev.includes(credit) ? prev.filter((c) => c !== credit) : [...prev, credit]
1283
- );
1284
- }
1285
- };
1286
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1287
- Accordion,
1288
- {
1289
- isOpen,
1290
- title: "Available Credits",
1291
- onClick: () => setIsOpen((prev) => !prev),
1292
- testid,
1293
- children: [
1294
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HorizontalDivider, {}),
1295
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Stack, { sizing: "layout-group", width: "full", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1296
- Stack,
1297
- {
1298
- sizing: "layout-group",
1299
- width: "full",
1300
- overflowY: "auto",
1301
- maxHeight: 300,
1302
- children: allCredits.map((credits) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1303
- Stack,
1304
- {
1305
- horizontal: true,
1306
- justify: "between",
1307
- items: "center",
1308
- sizing: "layout-group",
1309
- children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1311
- Stack,
1312
- {
1313
- sizing: "layout-group",
1314
- onClick: () => handleCreditSelect(credits),
1315
- paddingY: true,
1316
- flexGrow: 1,
1317
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}` : void 0,
1318
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1319
- Checkbox,
1320
- {
1321
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-checkbox` : void 0,
1322
- label: credits.InvoiceNumber,
1323
- checked: selectedCredits == null ? void 0 : selectedCredits.includes(credits),
1324
- onChange: () => handleCreditSelect(credits)
1325
- }
1326
- )
1327
- }
1328
- ),
1329
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1330
- Subheader,
1331
- {
1332
- testid: testid ? `${testid}-credit-${credits.InvoiceNumber}-InvoiceBalanceDue` : void 0,
1333
- className: " pr-desktop-component-padding",
1334
- children: [
1335
- "$",
1336
- formatCurrencyDisplay(
1337
- formatDecimalValue(Math.abs(credits.InvoiceBalanceDue), 2)
1338
- )
1339
- ]
1340
- }
1341
- )
1342
- ]
1343
- },
1344
- credits.AROpenGUID
1345
- ))
1346
- }
1347
- ) })
1348
- ]
1349
- }
1350
- );
1351
- }
1352
- // Annotate the CommonJS export names for ESM import in node:
1353
- 0 && (module.exports = {
1354
- SelectPaymentMethod
1355
- });