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