intelicoreact 2.0.11 → 2.0.12

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.
@@ -0,0 +1,989 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/router-ui.ts
30
+ var router_ui_exports = {};
31
+ __export(router_ui_exports, {
32
+ Accordion: () => Accordion_default2,
33
+ ButtonsBar: () => ButtonsBar_default2,
34
+ MainMenu: () => MainMenu_default,
35
+ NavLine: () => NavLine_default2
36
+ });
37
+ module.exports = __toCommonJS(router_ui_exports);
38
+
39
+ // src/Atomic/UI/Accordion/Accordion.tsx
40
+ var import_classnames3 = __toESM(require("classnames"), 1);
41
+ var import_react3 = require("react");
42
+ var Icons2 = __toESM(require("react-feather"), 1);
43
+ var import_react_router_dom = require("react-router-dom");
44
+
45
+ // src/Functions/utils.js
46
+ var import_react = require("react");
47
+ var import_moment_timezone = __toESM(require("moment-timezone"), 1);
48
+
49
+ // src/Constants/index.constants.js
50
+ var KEYBOARD_KEY_CODES = {
51
+ Backspace: 8,
52
+ Delete: 46,
53
+ ARROW_LEFT: 37,
54
+ ARROW_RIGHT: 39
55
+ };
56
+
57
+ // src/Functions/utils.js
58
+ var handleObjectChange = (updateObject, updateFunction) => (data, prop = "", isNumber) => {
59
+ let value;
60
+ if (data?.target) {
61
+ value = data.target.type === "checkbox" ? data.target.checked : data.target.value;
62
+ } else value = data;
63
+ value = isNumber ? Number(value) : value;
64
+ const props = prop.split(".");
65
+ const currentObject = props.reduce((res, chapter, index) => {
66
+ if (props.length !== index + 1) res = res[chapter];
67
+ return res;
68
+ }, updateObject);
69
+ currentObject[props.pop()] = value;
70
+ updateFunction();
71
+ };
72
+ String.prototype.longerThan = function(compareWith) {
73
+ return this?.length > compareWith?.length;
74
+ };
75
+ String.prototype.lastIndexEqualsTo = function(index) {
76
+ return this?.length - 1 === index;
77
+ };
78
+
79
+ // src/Atomic/UI/Accordion/AccordionItem.tsx
80
+ var import_classnames2 = __toESM(require("classnames"), 1);
81
+ var import_react2 = require("react");
82
+ var Icons = __toESM(require("react-feather"), 1);
83
+
84
+ // src/Atomic/UI/Status/Status.tsx
85
+ var import_classnames = __toESM(require("classnames"), 1);
86
+ var import_jsx_runtime = require("react/jsx-runtime");
87
+ function defaultOnClick() {
88
+ }
89
+ var Status = ({
90
+ icon,
91
+ value,
92
+ label,
93
+ status,
94
+ disabled,
95
+ type,
96
+ active = 0,
97
+ pause = 0,
98
+ className,
99
+ noBackground,
100
+ children,
101
+ testId = "status",
102
+ onClick = defaultOnClick
103
+ }) => {
104
+ if (!status) return null;
105
+ const text = children && typeof children === "string" ? children : value || label || status;
106
+ const formattedLabel = text?.[0].toUpperCase() + text?.slice(1);
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { onClick, "data-testid": testId, className: (0, import_classnames.default)({ disabled }, className), children: type === "number" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: active === 0 && pause === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "status status--error", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: active }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "status status--warning", children: [
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "status--number-active", children: active }),
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "color--gray-gull", children: " / " }),
110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: pause > 0 ? "color--froly" : "color--gray-gull", children: pause })
111
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
112
+ "div",
113
+ {
114
+ className: (0, import_classnames.default)(
115
+ "status",
116
+ `status--${status}`,
117
+ {
118
+ "status--no-bg": noBackground && status === "pause",
119
+ "color--gray-gull": noBackground && status === "pause" && !className,
120
+ "j4": !!icon
121
+ },
122
+ className
123
+ ),
124
+ children: [
125
+ icon,
126
+ formattedLabel
127
+ ]
128
+ }
129
+ ) });
130
+ };
131
+ var Status_default = Status;
132
+
133
+ // src/Atomic/UI/Status/index.ts
134
+ var Status_default2 = Status_default;
135
+
136
+ // src/Atomic/UI/Accordion/AccordionItem.tsx
137
+ var import_jsx_runtime2 = require("react/jsx-runtime");
138
+ var DefaultLink = ({ to, className, children }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: to, className, children });
139
+ var AccordionItem = ({
140
+ item,
141
+ onClick,
142
+ isOpen,
143
+ className,
144
+ children,
145
+ noChevron,
146
+ linkComponent: LinkComponent = DefaultLink,
147
+ testId = "accordion-item"
148
+ }) => {
149
+ const Icon = Icons[item.icon];
150
+ const [maxHeight, setMaxHeight] = (0, import_react2.useState)(0);
151
+ const ref = (0, import_react2.useRef)(null);
152
+ const getItemsHeight = () => {
153
+ let itemHeight = 0;
154
+ ref.current?.childNodes.forEach((el) => {
155
+ itemHeight += el.offsetHeight;
156
+ });
157
+ return itemHeight + 20;
158
+ };
159
+ (0, import_react2.useEffect)(() => {
160
+ setMaxHeight(isOpen ? getItemsHeight() : 0);
161
+ }, [isOpen]);
162
+ const calculateStatusCount = () => {
163
+ return item?.rows?.reduce(
164
+ (acc, row) => {
165
+ const result = row.cols.reduce(
166
+ (accum, col) => ({
167
+ active: accum.active + (col.status === "active" ? 1 : 0),
168
+ pause: accum.pause + (col.status === "pause" ? 1 : 0)
169
+ }),
170
+ { active: 0, pause: 0 }
171
+ );
172
+ return {
173
+ active: acc.active + result.active,
174
+ pause: acc.pause + result.pause
175
+ };
176
+ },
177
+ { active: 0, pause: 0 }
178
+ );
179
+ };
180
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
181
+ "div",
182
+ {
183
+ "data-testid": testId,
184
+ className: (0, import_classnames2.default)("accordion--item", className),
185
+ role: "region",
186
+ "aria-labelledby": `accordion-title-${item.title}`,
187
+ children: [
188
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
189
+ "div",
190
+ {
191
+ className: (0, import_classnames2.default)("accordion--title-box", {
192
+ "accordion--title-open": isOpen
193
+ }),
194
+ onClick: () => onClick(!isOpen),
195
+ id: `accordion-title-${item.title}`,
196
+ role: "button",
197
+ "aria-expanded": isOpen,
198
+ "aria-controls": `accordion-content-${item.title}`,
199
+ tabIndex: 0,
200
+ children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "j4 no-wrap", children: [
202
+ item?.icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: (0, import_classnames2.default)("mr5", item?.className), "aria-hidden": "true" }),
203
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "accordion--title", children: item.title || "Menu Chapter" })
204
+ ] }),
205
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "j6 accordion-title__right-box", children: [
206
+ item.status && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mr5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
207
+ Status_default2,
208
+ {
209
+ type: item?.status.type,
210
+ value: item?.status.value,
211
+ status: item?.status.status,
212
+ active: calculateStatusCount()?.active,
213
+ pause: calculateStatusCount()?.pause
214
+ }
215
+ ) }),
216
+ !noChevron && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
217
+ Icons.ChevronRight,
218
+ {
219
+ "aria-hidden": "true",
220
+ className: (0, import_classnames2.default)("accordion--title-chevron", {
221
+ "accordion--title-chevron-open": isOpen
222
+ })
223
+ }
224
+ )
225
+ ] })
226
+ ]
227
+ }
228
+ ),
229
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
230
+ "div",
231
+ {
232
+ ref,
233
+ style: { maxHeight },
234
+ className: (0, import_classnames2.default)("accordion--content", {
235
+ "accordion--content-is-open": isOpen
236
+ }),
237
+ id: `accordion-content-${item.title}`,
238
+ role: "region",
239
+ "aria-labelledby": `accordion-title-${item.title}`,
240
+ children: item.children ? item.children.map((el) => {
241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LinkComponent, { to: el.link, className: "accordion--content-item accordion--menu-link", children: el?.title || "Menu item" }, el.id);
242
+ }) : children
243
+ }
244
+ )
245
+ ]
246
+ }
247
+ );
248
+ };
249
+ var AccordionItem_default = AccordionItem;
250
+
251
+ // src/Atomic/UI/Accordion/Accordion.tsx
252
+ var import_jsx_runtime3 = require("react/jsx-runtime");
253
+ var CN = "accordion";
254
+ var Accordion = ({
255
+ items,
256
+ className,
257
+ itemClassName,
258
+ isMenuHovered,
259
+ isOpen,
260
+ testId = CN
261
+ }) => {
262
+ const [data, setData] = (0, import_react3.useState)(items);
263
+ const onChange = handleObjectChange(setData, () => setData([...data]));
264
+ const handleArrayChange = (e, index, prop) => {
265
+ data[index][prop] = e;
266
+ onChange(data);
267
+ };
268
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_classnames3.default)(CN, className), "data-testid": testId, role: "list", "aria-label": "Accordion list", children: items?.map((item, index) => {
269
+ const Icon = Icons2[item.icon];
270
+ return item.link ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
271
+ import_react_router_dom.NavLink,
272
+ {
273
+ "data-testid": `${testId}-link-${index}`,
274
+ to: item.link,
275
+ className: (0, import_classnames3.default)("main-menu--item main-menu--items-box-title"),
276
+ children: [
277
+ item?.icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: (0, import_classnames3.default)("mr5", item?.className) }),
278
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_classnames3.default)({ hidden: !isOpen && !isMenuHovered }), children: item?.title || "Link" })
279
+ ]
280
+ },
281
+ index
282
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
283
+ AccordionItem_default,
284
+ {
285
+ testId: `${testId}-item-${index}`,
286
+ className: itemClassName,
287
+ item,
288
+ isOpen: !!item.isOpen,
289
+ onClick: (value) => handleArrayChange(value, index, "isOpen"),
290
+ linkComponent: import_react_router_dom.NavLink
291
+ },
292
+ index
293
+ );
294
+ }) });
295
+ };
296
+ var Accordion_default = Accordion;
297
+
298
+ // src/Atomic/UI/Accordion/index.ts
299
+ var Accordion_default2 = Accordion_default;
300
+
301
+ // src/Atomic/UI/ButtonsBar/ButtonsBar.tsx
302
+ var import_classnames5 = __toESM(require("classnames"), 1);
303
+ var import_react_router_dom2 = require("react-router-dom");
304
+
305
+ // src/Atomic/UI/Button/Button.tsx
306
+ var import_classnames4 = __toESM(require("classnames"), 1);
307
+ var import_jsx_runtime4 = require("react/jsx-runtime");
308
+ var RC = "button";
309
+ var Button = ({
310
+ label,
311
+ onClick,
312
+ disabled,
313
+ icon,
314
+ className,
315
+ children,
316
+ style,
317
+ noIcon,
318
+ isIconRight,
319
+ testId = "button",
320
+ tabIndex = 0,
321
+ variant = "primary",
322
+ isTextEllipsis = false,
323
+ ...props
324
+ }) => {
325
+ const noRenderIcon = noIcon || variant === "ellipse-apply" || variant === "ellipse-cancel";
326
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
327
+ "button",
328
+ {
329
+ "data-testid": testId,
330
+ tabIndex,
331
+ style,
332
+ className: (0, import_classnames4.default)(
333
+ RC,
334
+ {
335
+ [`${RC}_${variant}`]: variant,
336
+ "button_icon-left": icon && !isIconRight,
337
+ "button_icon-right": icon && isIconRight
338
+ },
339
+ className
340
+ ),
341
+ onClick,
342
+ disabled,
343
+ type: "button",
344
+ ...props,
345
+ children: [
346
+ !noRenderIcon && icon,
347
+ label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_classnames4.default)("button__text", { "text-ellipsis": isTextEllipsis }), children: label }),
348
+ !label && children ? children : null
349
+ ]
350
+ }
351
+ );
352
+ };
353
+ var Button_default = Button;
354
+
355
+ // src/Atomic/UI/ButtonsBar/ButtonsBar.tsx
356
+ var import_jsx_runtime5 = require("react/jsx-runtime");
357
+ var ButtonsBar = ({
358
+ className,
359
+ rejectBtnLabel,
360
+ rejectBtnIcon,
361
+ isRejectBtnIconRight,
362
+ rejectBtnVariant,
363
+ rejectBtnClass,
364
+ isRejectBtnDisabled,
365
+ rejectLink,
366
+ onReject,
367
+ confirmBtnLabel,
368
+ confirmBtnIcon,
369
+ isConfirmBtnIconRight,
370
+ confirmBtnVariant,
371
+ confirmBtnClass,
372
+ isConfirmBtnDisabled,
373
+ onConfirm,
374
+ testIdFirstBtn = "button-bar-first-item",
375
+ testIdSecondBtn = "button-bar-second-item"
376
+ }) => {
377
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames5.default)("button-bar", className), children: [
378
+ rejectLink ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_router_dom2.Link, { className: "text-decoration-none", to: rejectLink, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
379
+ Button_default,
380
+ {
381
+ testId: testIdFirstBtn,
382
+ label: rejectBtnLabel,
383
+ variant: rejectBtnVariant,
384
+ onClick: onReject,
385
+ disabled: isRejectBtnDisabled,
386
+ icon: rejectBtnIcon,
387
+ isIconRight: isRejectBtnIconRight,
388
+ className: (0, import_classnames5.default)(rejectBtnClass, { mr5: confirmBtnLabel })
389
+ }
390
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
391
+ Button_default,
392
+ {
393
+ testId: testIdFirstBtn,
394
+ label: rejectBtnLabel,
395
+ variant: rejectBtnVariant,
396
+ onClick: onReject,
397
+ disabled: isRejectBtnDisabled,
398
+ icon: rejectBtnIcon,
399
+ isIconRight: isRejectBtnIconRight,
400
+ className: (0, import_classnames5.default)(rejectBtnClass, { mr5: confirmBtnLabel })
401
+ }
402
+ ),
403
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
404
+ Button_default,
405
+ {
406
+ testId: testIdSecondBtn,
407
+ label: confirmBtnLabel,
408
+ variant: confirmBtnVariant,
409
+ onClick: onConfirm,
410
+ disabled: isConfirmBtnDisabled,
411
+ icon: confirmBtnIcon,
412
+ isIconRight: isConfirmBtnIconRight,
413
+ className: confirmBtnClass
414
+ }
415
+ )
416
+ ] });
417
+ };
418
+ var ButtonsBar_default = ButtonsBar;
419
+
420
+ // src/Atomic/UI/ButtonsBar/index.ts
421
+ var ButtonsBar_default2 = ButtonsBar_default;
422
+
423
+ // src/Atomic/Layout/MainMenu/MainMenu.tsx
424
+ var import_classnames6 = __toESM(require("classnames"), 1);
425
+ var import_react4 = require("react");
426
+ var Icons3 = __toESM(require("react-feather"), 1);
427
+ var import_react_router_dom3 = require("react-router-dom");
428
+
429
+ // src/Langs.js
430
+ var Langs = {
431
+ en: {
432
+ auth: {},
433
+ settings: {},
434
+ labels: {
435
+ industries: "Industries",
436
+ includedLenders: "Included Lenders",
437
+ admin: "Administrator",
438
+ user: "User",
439
+ help: "Help",
440
+ description: "Description",
441
+ value: "Value",
442
+ paramName: "Parameter name(key)",
443
+ active: "Active",
444
+ pause: "Pause",
445
+ error: "Error",
446
+ sold: "Sold",
447
+ processing: "Processing",
448
+ home: "Home",
449
+ goods: "Goods",
450
+ improvement: "Improvement",
451
+ jewelry: "Jewelry",
452
+ firstName: "First Name",
453
+ lastName: "Last Name",
454
+ dateOfBirth: "Date of Birth",
455
+ militaryStatus: "Military status",
456
+ ssn: "SSN",
457
+ lengthAtAddress: "Length At Address",
458
+ rentOrOwn: "Rent or Own",
459
+ zip: "ZIP",
460
+ city: "City",
461
+ state: "State",
462
+ address: "Address",
463
+ email: "E-mail",
464
+ homePhone: "Home Phone",
465
+ cellPhone: "Cell Phone",
466
+ contactTime: "Contact Time",
467
+ dlState: "DL state",
468
+ dlNumber: "DL number",
469
+ ownCar: "Do you own a car?",
470
+ tcpaOptin: "TCPA OPTIN",
471
+ incomeSource: "Income Source",
472
+ timeEmployed: "Time Employed",
473
+ jobTitle: "Job Title",
474
+ currentEmployer: "Current Employer",
475
+ employersPhone: "Employer's Phone",
476
+ netMonthlyIncome: "Net monthly income",
477
+ howOftenIsPaid: "How often is paid",
478
+ nextPayDate: "Next Pay Date",
479
+ secondPayDate: "Second Pay Date",
480
+ loanAmount: "Loan amount",
481
+ ip: "IP",
482
+ storyName: "Story name",
483
+ channelName: "Channel name",
484
+ employmentInfo: "Employment Information",
485
+ personalDetails: "Personal Details",
486
+ offer: "Offer",
487
+ offers: "Offers",
488
+ status: "Status",
489
+ name: "Name",
490
+ from: "From",
491
+ to: "to",
492
+ periodMonths: "Period (months)",
493
+ loansSent: "Loans Sent",
494
+ approved: "Approved",
495
+ rejected: "Rejected",
496
+ loanAmountApproved: "Loan Amount Approved ($)",
497
+ loanAmountRejected: "Loan Amount Rejected ($)",
498
+ approveRate: "Approve Rate (%)",
499
+ actions: "Actions",
500
+ locations: "Locations",
501
+ score: "Score",
502
+ priority: "Priority",
503
+ lender: "Lender",
504
+ weight: "Weight",
505
+ selectLender: "Select lender"
506
+ },
507
+ singulars: {},
508
+ titles: {
509
+ pingTree: "Ping tree",
510
+ edit: "Edit",
511
+ create: "Create",
512
+ add: "Add",
513
+ consumerInfo: "Consumer info",
514
+ personalDetails: "Personal Details",
515
+ employmentInfo: "Employment Information",
516
+ tools: "Tools",
517
+ lenders: "Lenders",
518
+ settings: "Settings",
519
+ dashboard: "Dashboard",
520
+ consumers: "Consumers",
521
+ ticketDesk: "Ticket desk",
522
+ accounting: "Accounting",
523
+ users: "Users",
524
+ merchants: "Merchants",
525
+ lenderPingTree: "Lender Ping Tree",
526
+ reports: "Reports",
527
+ leads: "Leads",
528
+ location: "Location",
529
+ mainMenu: "Main menu",
530
+ partners: "Partners",
531
+ other: "Other",
532
+ homeGoodsAndInteriorDesign: "Home Goods and Interior Design"
533
+ },
534
+ placeholders: {
535
+ typeName: "Type name",
536
+ params: "Params placeholder",
537
+ value: "Value placeholder",
538
+ description: "Description placeholder"
539
+ },
540
+ hints: {
541
+ landerNotIncluded: "Lender is not included in Ping Tree by the \u201CHome Goods\u201D industry",
542
+ noMerchants: "No Merchants for the \u201CHome Goods\u201D industry"
543
+ },
544
+ buttons: {
545
+ create: "Create",
546
+ edit: "Edit",
547
+ add: "Add",
548
+ close: "Close",
549
+ apply: "Apply",
550
+ pingTree: "Ping tree",
551
+ addRow: "Add row",
552
+ consumerInfo: "Consumer Info",
553
+ deletePingTree: "Delete Ping Tree",
554
+ cancel: "Cancel"
555
+ },
556
+ radioButtons: {},
557
+ weekDays: {
558
+ su: "Su",
559
+ mo: "Mo",
560
+ tu: "Tu",
561
+ we: "We",
562
+ th: "Th",
563
+ fr: "Fr",
564
+ sa: "Sa"
565
+ },
566
+ alerts: {
567
+ lendersWillBeRemoved: "lenders will be removed"
568
+ },
569
+ checkboxes: {
570
+ homeGoods: "Home Goods",
571
+ travel: "Travel",
572
+ energyImprovement: "Energy Improvement",
573
+ jewelryIncluded: "Jewelry (included in PingTree name 2)",
574
+ jewelry: "Jewelry",
575
+ autoRepair: "Auto Repair",
576
+ cosmetics: "Cosmetics",
577
+ health: "Health"
578
+ },
579
+ errors: {},
580
+ texts: {},
581
+ tabs: {
582
+ general: "General",
583
+ payments: "Payments",
584
+ filters: "Filters",
585
+ offers: "Offers",
586
+ merchants: "Merchants",
587
+ integration: "Integration",
588
+ customDetails: "Custom details",
589
+ customerDetails: "Customer details",
590
+ postsLog: "Posts log"
591
+ },
592
+ toasts: {}
593
+ }
594
+ };
595
+ var Langs_default = Langs;
596
+
597
+ // src/Atomic/Layout/MainMenu/MainMenu.tsx
598
+ var import_jsx_runtime6 = require("react/jsx-runtime");
599
+ function MainMenu(props) {
600
+ const { items, className } = props;
601
+ const lng = globalThis.lng;
602
+ const txt = Langs_default[lng];
603
+ const [isOpen, setIsOpen] = (0, import_react4.useState)(true);
604
+ const [isMenuHovered, setIsMenuHovered] = (0, import_react4.useState)(false);
605
+ const [isMenuIconHovered, setIsMenuIconHovered] = (0, import_react4.useState)(false);
606
+ const chapterClass = (0, import_classnames6.default)("main-menu--items-box-chapter", {
607
+ "main-menu--items-box-chapter-hidden": !isOpen && !isMenuHovered
608
+ });
609
+ const accordionClass = (0, import_classnames6.default)("main-menu--accordion", {
610
+ "main-menu--accordion-hidden": !isOpen && !isMenuHovered
611
+ });
612
+ const itemsBoxClass = (0, import_classnames6.default)("main-menu--items-box", {
613
+ "main-menu--items-box-closed": !isOpen && !isMenuHovered
614
+ });
615
+ const mainMenuClass = (0, import_classnames6.default)("main-menu", className, {
616
+ "main-menu--closed": !isOpen && !isMenuHovered
617
+ });
618
+ const onMenuHover = () => {
619
+ if (!isOpen) {
620
+ setIsMenuHovered(!isMenuHovered);
621
+ items.mainMenu.forEach((item) => {
622
+ item.isOpen = false;
623
+ });
624
+ items.partners.forEach((item) => {
625
+ item.isOpen = false;
626
+ });
627
+ items.other.forEach((item) => {
628
+ item.isOpen = false;
629
+ });
630
+ }
631
+ };
632
+ const onCloseMenu = () => {
633
+ setIsOpen(!isOpen);
634
+ items.mainMenu.forEach((item) => {
635
+ item.isOpen = false;
636
+ });
637
+ items.partners.forEach((item) => {
638
+ item.isOpen = false;
639
+ });
640
+ items.other.forEach((item) => {
641
+ item.isOpen = false;
642
+ });
643
+ };
644
+ const changeMenuIcon = () => {
645
+ if (isOpen && !isMenuIconHovered) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icons3.Menu, {});
646
+ if (isOpen && isMenuIconHovered) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icons3.ChevronLeft, {});
647
+ if (!isOpen && isMenuHovered) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icons3.ChevronRight, {});
648
+ if (!isOpen) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "main-menu--logo-close" });
649
+ return null;
650
+ };
651
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
652
+ "div",
653
+ {
654
+ className: mainMenuClass,
655
+ onMouseEnter: () => onMenuHover(),
656
+ onMouseLeave: () => setIsMenuHovered(false),
657
+ children: [
658
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
659
+ "div",
660
+ {
661
+ className: (0, import_classnames6.default)("main-menu--header", {
662
+ "main-menu--header-closed": !isOpen && !isMenuHovered
663
+ }),
664
+ children: [
665
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
666
+ "div",
667
+ {
668
+ className: (0, import_classnames6.default)("main-menu--logo", {
669
+ "main-menu--logo-none": !isOpen && !isMenuHovered
670
+ })
671
+ }
672
+ ),
673
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "data-testid": "main-menu--header-btn", className: "main-menu--header-btn", onClick: () => onCloseMenu(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
674
+ "div",
675
+ {
676
+ className: "j5",
677
+ onMouseEnter: () => setIsMenuIconHovered(true),
678
+ onMouseLeave: () => setIsMenuIconHovered(false),
679
+ children: changeMenuIcon()
680
+ }
681
+ ) })
682
+ ]
683
+ }
684
+ ),
685
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: itemsBoxClass, children: [
686
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: (0, import_classnames6.default)("main-menu--items-box-main"), children: items.main.map((item, index) => {
687
+ const Icon = Icons3[item.icon];
688
+ return item.link ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
689
+ import_react_router_dom3.NavLink,
690
+ {
691
+ to: item.link,
692
+ className: (0, import_classnames6.default)("main-menu--items-box-title"),
693
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "main-menu--item", children: [
694
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "df", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: (0, import_classnames6.default)("mr5", item.className) }) }),
695
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_classnames6.default)({ hidden: !isOpen && !isMenuHovered }), children: item?.title || "Link" })
696
+ ] })
697
+ },
698
+ index
699
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
700
+ "span",
701
+ {
702
+ className: (0, import_classnames6.default)("main-menu--items-box-title", {
703
+ hidden: !isOpen && !isMenuHovered
704
+ }),
705
+ children: txt?.titles[item?.title]
706
+ },
707
+ index
708
+ );
709
+ }) }),
710
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: chapterClass, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Main menu" }) }),
711
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
712
+ Accordion_default,
713
+ {
714
+ className: accordionClass,
715
+ items: items.mainMenu
716
+ }
717
+ ),
718
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: chapterClass, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Partners" }) }),
719
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
720
+ Accordion_default,
721
+ {
722
+ isOpen,
723
+ isMenuHovered,
724
+ className: accordionClass,
725
+ items: items.partners
726
+ }
727
+ ),
728
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: chapterClass, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Other" }) }),
729
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
730
+ Accordion_default,
731
+ {
732
+ className: accordionClass,
733
+ isOpen,
734
+ isMenuHovered,
735
+ items: items.other
736
+ }
737
+ )
738
+ ] })
739
+ ]
740
+ }
741
+ );
742
+ }
743
+ var MainMenu_default = MainMenu;
744
+
745
+ // src/Atomic/UI/NavLine/NavLine.tsx
746
+ var import_classnames7 = __toESM(require("classnames"), 1);
747
+ var import_react5 = require("react");
748
+ var Icons4 = __toESM(require("react-feather"), 1);
749
+ var import_react_router_dom4 = require("react-router-dom");
750
+ var import_jsx_runtime7 = require("react/jsx-runtime");
751
+ var CN2 = "nav-line";
752
+ function checkedRef(ref) {
753
+ if (!ref) return null;
754
+ return typeof ref === "function" ? (node) => ref(node) : ref;
755
+ }
756
+ var NavLine = ({
757
+ root = "",
758
+ activeTab,
759
+ variant,
760
+ onChange,
761
+ className,
762
+ items,
763
+ children,
764
+ isLocal = false,
765
+ mode,
766
+ isNavigateByKeys,
767
+ isTabLoading,
768
+ scrollMode = false,
769
+ testId = CN2
770
+ }) => {
771
+ const [navLineItems, setNavLineItems] = (0, import_react5.useState)([]);
772
+ const wrapperRef = (0, import_react5.useRef)(null);
773
+ const wrapperInnerRef = (0, import_react5.useRef)(null);
774
+ const [showScrollButtons, setShowScrollButtons] = (0, import_react5.useState)(false);
775
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react5.useState)(false);
776
+ const [canScrollRight, setCanScrollRight] = (0, import_react5.useState)(false);
777
+ const [isScrollBlocked, setIsScrollBlocked] = (0, import_react5.useState)(false);
778
+ const checkScroll = (0, import_react5.useCallback)(() => {
779
+ const inner = wrapperInnerRef.current;
780
+ if (!inner) return;
781
+ const hasOverflow = inner.scrollWidth > inner.clientWidth;
782
+ const canScrollLeft2 = inner.scrollLeft > 0;
783
+ const canScrollRight2 = inner.scrollLeft < inner.scrollWidth - inner.clientWidth;
784
+ setShowScrollButtons(hasOverflow);
785
+ setCanScrollLeft(canScrollLeft2);
786
+ setCanScrollRight(canScrollRight2);
787
+ }, []);
788
+ const scroll = (0, import_react5.useCallback)(
789
+ (direction) => {
790
+ if (isScrollBlocked || !wrapperInnerRef.current) return;
791
+ setIsScrollBlocked(true);
792
+ const scrollAmount = 100;
793
+ const offset = direction === "left" ? -scrollAmount : scrollAmount;
794
+ try {
795
+ wrapperInnerRef.current.scrollBy({
796
+ left: offset,
797
+ behavior: "smooth"
798
+ });
799
+ } catch (error) {
800
+ console.error("scrollBy is not supported", error);
801
+ if (wrapperInnerRef.current) {
802
+ wrapperInnerRef.current.scrollLeft += offset;
803
+ }
804
+ }
805
+ setTimeout(() => {
806
+ setIsScrollBlocked(false);
807
+ checkScroll();
808
+ }, 300);
809
+ },
810
+ [isScrollBlocked, checkScroll]
811
+ );
812
+ const handleWheel = (0, import_react5.useCallback)(
813
+ (e) => {
814
+ if (!scrollMode) return;
815
+ e.preventDefault();
816
+ if (e.deltaY > 0) {
817
+ scroll("right");
818
+ } else {
819
+ scroll("left");
820
+ }
821
+ },
822
+ [scroll, scrollMode]
823
+ );
824
+ const onTabChange = (0, import_react5.useCallback)(
825
+ (item) => {
826
+ if (!item.disabled && !(mode === "create" && item.tabId !== "general")) {
827
+ onChange(item.tabId);
828
+ }
829
+ },
830
+ [mode, onChange]
831
+ );
832
+ const navigateByKeys = (0, import_react5.useCallback)(
833
+ (event) => {
834
+ if (event.repeat) return;
835
+ const activeTabIndex = items.findIndex((tab) => tab.tabId === activeTab);
836
+ const nextTabID = items[activeTabIndex + 1]?.tabId;
837
+ const prevTabID = items[activeTabIndex - 1]?.tabId;
838
+ if (event.keyCode === KEYBOARD_KEY_CODES.ARROW_RIGHT && nextTabID) {
839
+ onChange(nextTabID);
840
+ } else if (event.keyCode === KEYBOARD_KEY_CODES.ARROW_LEFT && prevTabID) {
841
+ onChange(prevTabID);
842
+ }
843
+ },
844
+ [activeTab, items, onChange]
845
+ );
846
+ (0, import_react5.useEffect)(() => {
847
+ setNavLineItems(
848
+ items.map((item) => ({
849
+ ...item,
850
+ ref: (0, import_react5.createRef)()
851
+ }))
852
+ );
853
+ }, [items]);
854
+ (0, import_react5.useEffect)(() => {
855
+ if (isNavigateByKeys && !isTabLoading) {
856
+ document.addEventListener("keydown", navigateByKeys);
857
+ }
858
+ return () => document.removeEventListener("keydown", navigateByKeys);
859
+ }, [isNavigateByKeys, isTabLoading, navigateByKeys]);
860
+ (0, import_react5.useEffect)(() => {
861
+ if (!scrollMode) return;
862
+ const inner = wrapperInnerRef.current;
863
+ if (!inner) return;
864
+ const resizeObserver = new ResizeObserver(checkScroll);
865
+ resizeObserver.observe(inner);
866
+ inner.addEventListener("scroll", checkScroll);
867
+ inner.addEventListener("wheel", handleWheel, { passive: false });
868
+ checkScroll();
869
+ return () => {
870
+ resizeObserver.disconnect();
871
+ inner.removeEventListener("scroll", checkScroll);
872
+ inner.removeEventListener("wheel", handleWheel);
873
+ };
874
+ }, [scrollMode, checkScroll, handleWheel]);
875
+ const renderNavItem = (item) => {
876
+ const Icon = item.icon ? Icons4[item.icon] : null;
877
+ const isDisabled = item.disabled || mode === "create" && item.tabId !== "general";
878
+ const commonProps = {
879
+ "title": item.title,
880
+ "className": (0, import_classnames7.default)(
881
+ { "nav-line__item": !variant },
882
+ { "nav-line--simple__item": variant === "simple" },
883
+ { active: activeTab === item.tabId },
884
+ { disabled: isDisabled },
885
+ { "nav-line__item--hidden": item.isHidden }
886
+ ),
887
+ "role": "tab",
888
+ "aria-selected": activeTab === item.tabId,
889
+ "aria-disabled": isDisabled,
890
+ "tabIndex": isDisabled ? -1 : 0
891
+ };
892
+ const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "nav-line__content", children: [
893
+ Icon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "nav-line__item--icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, {}) }),
894
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: (0, import_classnames7.default)({ "nav-line__item--label": variant !== "simple" }), children: item.label }),
895
+ item.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "nav-line-count", "aria-label": `${item.count} items`, children: [
896
+ "(",
897
+ item.count,
898
+ ")"
899
+ ] })
900
+ ] });
901
+ if (isLocal) {
902
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
903
+ "span",
904
+ {
905
+ ...commonProps,
906
+ ref: checkedRef(item.ref),
907
+ onClick: () => !isDisabled && onTabChange(item),
908
+ onKeyPress: (e) => {
909
+ if (!isDisabled && (e.key === "Enter" || e.key === " ")) {
910
+ e.preventDefault();
911
+ onTabChange(item);
912
+ }
913
+ },
914
+ children: content
915
+ },
916
+ `tab__${item.tabId}`
917
+ );
918
+ }
919
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
920
+ import_react_router_dom4.NavLink,
921
+ {
922
+ ...commonProps,
923
+ to: `${root}${item?.linkChapter || item.tabId}/`,
924
+ onClick: (e) => {
925
+ if (isDisabled) {
926
+ e.preventDefault();
927
+ }
928
+ },
929
+ children: content
930
+ },
931
+ `tab__${item.tabId}`
932
+ );
933
+ };
934
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "nav-line-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
935
+ "div",
936
+ {
937
+ "data-testid": testId,
938
+ className: (0, import_classnames7.default)(
939
+ { [CN2]: !variant },
940
+ { [`${CN2}--simple`]: variant === "simple" },
941
+ { [`${CN2}--scroll-mode`]: scrollMode },
942
+ className
943
+ ),
944
+ ref: wrapperRef,
945
+ children: [
946
+ scrollMode && showScrollButtons && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
947
+ "button",
948
+ {
949
+ type: "button",
950
+ "data-testid": "nav-line-scroll-prev",
951
+ className: "nav-line--simple__arrow nav-line--simple__arrow--prev",
952
+ onClick: () => scroll("left"),
953
+ "aria-label": "Scroll previous",
954
+ disabled: !canScrollLeft,
955
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icons4.ChevronLeft, {})
956
+ }
957
+ ),
958
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
959
+ "div",
960
+ {
961
+ ref: wrapperInnerRef,
962
+ className: (0, import_classnames7.default)({ "nav-line__inner": !variant }, { "nav-line--simple__inner": variant === "simple" }),
963
+ role: "tablist",
964
+ "aria-orientation": "horizontal",
965
+ children: navLineItems.map(renderNavItem)
966
+ }
967
+ ),
968
+ scrollMode && showScrollButtons && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
969
+ "button",
970
+ {
971
+ type: "button",
972
+ "data-testid": "nav-line-scroll-next",
973
+ className: "nav-line--simple__arrow nav-line--simple__arrow--next",
974
+ onClick: () => scroll("right"),
975
+ "aria-label": "Scroll next",
976
+ disabled: !canScrollRight,
977
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icons4.ChevronRight, {})
978
+ }
979
+ ),
980
+ children && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "nav-line__body", role: "tabpanel", children })
981
+ ]
982
+ }
983
+ ) });
984
+ };
985
+ var NavLine_default = NavLine;
986
+
987
+ // src/Atomic/UI/NavLine/index.ts
988
+ var NavLine_default2 = NavLine_default;
989
+ //# sourceMappingURL=router-ui.cjs.map