intelicoreact 2.0.16 → 2.0.17
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.
- package/dist/css/accordion.css +1 -1
- package/dist/css/advanced-status.css +1 -1
- package/dist/css/datepicker.css +1 -1
- package/dist/css/dropdown-live-search.css +1 -1
- package/dist/css/dropdown.css +1 -1
- package/dist/css/input-date-range.css +1 -1
- package/dist/css/main-menu.css +1 -1
- package/dist/css/switcher-radio.css +1 -1
- package/dist/css/switcher-range-list.css +1 -1
- package/dist/css/switcher-tags-dropdown.css +1 -1
- package/dist/css/switcher-textarea.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tags-dropdown.css +1 -1
- package/dist/css/wizard-stepper.css +1 -1
- package/dist/es/_virtual/_rolldown/runtime.js +27 -0
- package/dist/es/charts.js +4 -0
- package/dist/es/classes.js +4 -0
- package/dist/es/form.js +99 -0
- package/dist/es/hooks.js +32 -0
- package/dist/es/icons.js +10 -0
- package/dist/es/icons.js.map +1 -0
- package/dist/es/index.js +71 -0
- package/dist/es/layout.js +3 -0
- package/dist/es/presets.js +6 -0
- package/dist/es/router-ui.js +8 -0
- package/dist/es/sdk.js +1 -0
- package/dist/es/styles/base.css +1 -0
- package/dist/es/types/index.js +2 -0
- package/dist/es/ui.js +42 -0
- package/dist/es/utils.js +6 -0
- package/dist/intelicoreact.css +1 -1
- package/dist/scss/_mixins.scss +2 -2
- package/dist/scss/_vars.scss +1 -1
- package/dist/scss/main.scss +4 -1
- package/package.json +46 -64
- package/charts/package.json +0 -5
- package/classes/package.json +0 -5
- package/dist/charts.cjs +0 -927
- package/dist/charts.cjs.map +0 -7
- package/dist/charts.js +0 -911
- package/dist/charts.js.map +0 -7
- package/dist/classes.cjs +0 -1858
- package/dist/classes.cjs.map +0 -7
- package/dist/classes.js +0 -1836
- package/dist/classes.js.map +0 -7
- package/dist/form.cjs +0 -15167
- package/dist/form.cjs.map +0 -7
- package/dist/form.js +0 -15182
- package/dist/form.js.map +0 -7
- package/dist/hooks.cjs +0 -2330
- package/dist/hooks.cjs.map +0 -7
- package/dist/hooks.js +0 -2298
- package/dist/hooks.js.map +0 -7
- package/dist/icons.cjs +0 -1807
- package/dist/icons.cjs.map +0 -7
- package/dist/icons.js +0 -1785
- package/dist/icons.js.map +0 -7
- package/dist/index.cjs +0 -22917
- package/dist/index.cjs.map +0 -7
- package/dist/index.js +0 -22938
- package/dist/index.js.map +0 -7
- package/dist/layout.cjs +0 -458
- package/dist/layout.cjs.map +0 -7
- package/dist/layout.js +0 -426
- package/dist/layout.js.map +0 -7
- package/dist/presets.cjs +0 -262
- package/dist/presets.cjs.map +0 -7
- package/dist/presets.js +0 -240
- package/dist/presets.js.map +0 -7
- package/dist/router-ui.cjs +0 -989
- package/dist/router-ui.cjs.map +0 -7
- package/dist/router-ui.js +0 -957
- package/dist/router-ui.js.map +0 -7
- package/dist/sdk.cjs +0 -451
- package/dist/sdk.cjs.map +0 -7
- package/dist/sdk.js +0 -429
- package/dist/sdk.js.map +0 -7
- package/dist/types/index.cjs +0 -18
- package/dist/types/index.cjs.map +0 -7
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +0 -7
- package/dist/ui.cjs +0 -4090
- package/dist/ui.cjs.map +0 -7
- package/dist/ui.js +0 -4064
- package/dist/ui.js.map +0 -7
- package/dist/utils.cjs +0 -653
- package/dist/utils.cjs.map +0 -7
- package/dist/utils.js +0 -621
- package/dist/utils.js.map +0 -7
- package/form/package.json +0 -5
- package/hooks/package.json +0 -5
- package/icons/package.json +0 -5
- package/layout/package.json +0 -5
- package/presets/package.json +0 -5
- package/router-ui/package.json +0 -5
- package/sdk/package.json +0 -5
- package/types/package.json +0 -5
- package/ui/package.json +0 -5
- package/utils/package.json +0 -5
package/dist/ui.cjs
DELETED
|
@@ -1,4090 +0,0 @@
|
|
|
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/ui.ts
|
|
30
|
-
var ui_exports = {};
|
|
31
|
-
__export(ui_exports, {
|
|
32
|
-
AccordionTable: () => AccordionTable_default,
|
|
33
|
-
AccordionText: () => AccordionText_default,
|
|
34
|
-
AdvTag: () => AdvTag_default,
|
|
35
|
-
AdvancedTags: () => AdvancedTag_default,
|
|
36
|
-
Alert: () => Alert_default2,
|
|
37
|
-
Arrow: () => Arrow_default,
|
|
38
|
-
Box: () => Box_default,
|
|
39
|
-
Button: () => Button_default,
|
|
40
|
-
CircleProgressBar: () => CircleProgressBar_default,
|
|
41
|
-
DateTime: () => DateTime_default,
|
|
42
|
-
DebugContainer: () => DebugContainer_default,
|
|
43
|
-
DoubleString: () => DoubleString_default2,
|
|
44
|
-
EVENTS: () => EVENTS,
|
|
45
|
-
Hint: () => Hint_default2,
|
|
46
|
-
Modal: () => Modal_default2,
|
|
47
|
-
ModalFooter: () => ModalFooter_default,
|
|
48
|
-
ModalHOC: () => ModalHOC_default,
|
|
49
|
-
ModalTitle: () => ModalTitle_default,
|
|
50
|
-
MonoAccordion: () => MonoAccordion_default2,
|
|
51
|
-
PageTitle: () => PageTitle_default2,
|
|
52
|
-
Price: () => Price_default2,
|
|
53
|
-
PriceRange: () => PriceRange_default2,
|
|
54
|
-
ProgressLine: () => ProgressLine_default2,
|
|
55
|
-
Status: () => Status_default2,
|
|
56
|
-
Table: () => Table_default,
|
|
57
|
-
Tag: () => Tag_default2,
|
|
58
|
-
TagList: () => TagList_default,
|
|
59
|
-
UserBox: () => UserBox_default2,
|
|
60
|
-
WizardStepper: () => WizardStepper_default,
|
|
61
|
-
dispatchEventForModalManagement: () => dispatchEventForModalManagement,
|
|
62
|
-
useDebugContainer: () => useDebugContainer_default,
|
|
63
|
-
useMobileModal: () => useMobileModal
|
|
64
|
-
});
|
|
65
|
-
module.exports = __toCommonJS(ui_exports);
|
|
66
|
-
|
|
67
|
-
// src/Atomic/UI/AccordionTable/AccordionTable.js
|
|
68
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
69
|
-
var import_classnames2 = __toESM(require("classnames"), 1);
|
|
70
|
-
var import_react_feather = require("react-feather");
|
|
71
|
-
|
|
72
|
-
// src/Atomic/UI/MonoAccordion/MonoAccordion.js
|
|
73
|
-
var import_react = __toESM(require("react"), 1);
|
|
74
|
-
var import_classnames = __toESM(require("classnames"), 1);
|
|
75
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
76
|
-
var RC = "mono-accordion";
|
|
77
|
-
var MonoAccordion = ({
|
|
78
|
-
titleJSX,
|
|
79
|
-
icon,
|
|
80
|
-
children,
|
|
81
|
-
isOpen,
|
|
82
|
-
onClick,
|
|
83
|
-
className,
|
|
84
|
-
disabled,
|
|
85
|
-
testId = "mono-accordion",
|
|
86
|
-
datasetProp = {}
|
|
87
|
-
}) => {
|
|
88
|
-
const [maxHeight, setMaxHeight] = (0, import_react.useState)();
|
|
89
|
-
const titleRef = (0, import_react.useRef)();
|
|
90
|
-
const containerRef = (0, import_react.useRef)();
|
|
91
|
-
const setHeight = (value) => {
|
|
92
|
-
if (value !== void 0) setMaxHeight((state) => `${value}px`);
|
|
93
|
-
else
|
|
94
|
-
setMaxHeight(
|
|
95
|
-
(state) => `${Array.from(containerRef.current?.childNodes)?.reduce?.((acc, el) => acc + el.offsetHeight, 0)}px`
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
const handleClick = (e) => {
|
|
99
|
-
if (!Array.from(titleRef.current.childNodes).some(
|
|
100
|
-
(el) => el.contains(e.target)
|
|
101
|
-
)) {
|
|
102
|
-
onClick(e);
|
|
103
|
-
e?.preventDefault();
|
|
104
|
-
e?.stopPropagation();
|
|
105
|
-
} else return e;
|
|
106
|
-
};
|
|
107
|
-
(0, import_react.useEffect)(() => {
|
|
108
|
-
if (!isOpen) setHeight(0);
|
|
109
|
-
else setHeight();
|
|
110
|
-
}, [isOpen, children]);
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
112
|
-
"div",
|
|
113
|
-
{
|
|
114
|
-
...datasetProp,
|
|
115
|
-
"data-testid": testId,
|
|
116
|
-
className: (0, import_classnames.default)(RC, className, {
|
|
117
|
-
[`${RC}_is-open`]: isOpen,
|
|
118
|
-
[`${RC}_disabled`]: disabled
|
|
119
|
-
}),
|
|
120
|
-
children: [
|
|
121
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
className: `${RC}__head`,
|
|
125
|
-
onClick: handleClick,
|
|
126
|
-
children: [
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: titleRef, className: `${RC}__tile-container`, children: titleJSX }),
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${RC}__icon-container`, children: icon })
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
),
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
"div",
|
|
134
|
-
{
|
|
135
|
-
ref: containerRef,
|
|
136
|
-
style: { maxHeight },
|
|
137
|
-
className: (0, import_classnames.default)(`${RC}__container`),
|
|
138
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${RC}__content-wrapper`, children })
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
var MonoAccordion_default = MonoAccordion;
|
|
146
|
-
|
|
147
|
-
// src/Atomic/UI/AccordionTable/AccordionTable.js
|
|
148
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
149
|
-
var AccordionTable = ({
|
|
150
|
-
className,
|
|
151
|
-
header,
|
|
152
|
-
items,
|
|
153
|
-
onChange,
|
|
154
|
-
testId,
|
|
155
|
-
onSort = () => {
|
|
156
|
-
},
|
|
157
|
-
sortParams
|
|
158
|
-
}) => {
|
|
159
|
-
const [accordions, setAccordions] = (0, import_react2.useState)(items);
|
|
160
|
-
const sortedColClassName = (item) => (0, import_classnames2.default)(
|
|
161
|
-
"accordion-table__header-item",
|
|
162
|
-
item.className,
|
|
163
|
-
{
|
|
164
|
-
"accordion-table--sorted-col": sortParams && sortParams.key === item.key
|
|
165
|
-
},
|
|
166
|
-
{ "accordion-table__header-item-sortable": !item.noSort }
|
|
167
|
-
);
|
|
168
|
-
const handle = {
|
|
169
|
-
accordionChange: (key, e) => {
|
|
170
|
-
const newArr = accordions?.map((item) => {
|
|
171
|
-
if (item.key === key) {
|
|
172
|
-
return {
|
|
173
|
-
...item,
|
|
174
|
-
isOpen: !item.isOpen
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return item;
|
|
178
|
-
});
|
|
179
|
-
const isArrowSvg = e?.target?.tagName === "svg";
|
|
180
|
-
const isAccordionElement = e.target.className?.includes?.("accordion-table");
|
|
181
|
-
if (isAccordionElement || isArrowSvg) {
|
|
182
|
-
onChange(newArr);
|
|
183
|
-
setAccordions(newArr);
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
setSort: (key) => {
|
|
187
|
-
let newSorting;
|
|
188
|
-
if (key !== sortParams.key) newSorting = { key, direction: "DESC" };
|
|
189
|
-
else {
|
|
190
|
-
newSorting = {
|
|
191
|
-
key,
|
|
192
|
-
direction: sortParams.direction === "ASC" ? "DESC" : "ASC"
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
onSort(newSorting);
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
const getHeaderItem = (key) => {
|
|
199
|
-
return header?.find((item) => item.key === key);
|
|
200
|
-
};
|
|
201
|
-
const renderTd = (tr) => {
|
|
202
|
-
return Object.entries(tr)?.map(([key, value]) => {
|
|
203
|
-
return key === "promoDetails" || key === "disclosure" ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
204
|
-
"div",
|
|
205
|
-
{
|
|
206
|
-
style: { flexBasis: `${getHeaderItem(key)?.width}%` },
|
|
207
|
-
className: (0, import_classnames2.default)(
|
|
208
|
-
"accordion-table__td",
|
|
209
|
-
`accordion-table__td--${key}`,
|
|
210
|
-
getHeaderItem(key)?.className
|
|
211
|
-
),
|
|
212
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
213
|
-
"p",
|
|
214
|
-
{
|
|
215
|
-
className: "accordion-table__statistics-td-value",
|
|
216
|
-
title: typeof value !== "object" ? value : value.value,
|
|
217
|
-
children: typeof value !== "object" ? value : value.value
|
|
218
|
-
}
|
|
219
|
-
)
|
|
220
|
-
},
|
|
221
|
-
key
|
|
222
|
-
);
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
const renderTr = (rows) => {
|
|
226
|
-
return rows?.map((row, index) => {
|
|
227
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
228
|
-
"div",
|
|
229
|
-
{
|
|
230
|
-
className: (0, import_classnames2.default)(
|
|
231
|
-
"accordion-table__tr",
|
|
232
|
-
{
|
|
233
|
-
"accordion-table__tr-with-promo": row.promoDetails || row.cols?.promoDetails
|
|
234
|
-
},
|
|
235
|
-
row.className
|
|
236
|
-
),
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "df w100", children: renderTd(row.cols || row) }),
|
|
239
|
-
row.promoDetails || row.cols?.promoDetails ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__tr-promo-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "accordion-table__tr-promo", children: [
|
|
240
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_feather.Tag, { className: "tr-promo-icon", width: 16, height: 16 }),
|
|
241
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "tr-promo-label", children: "PROMOTION" }),
|
|
242
|
-
row.promoDetails || row.cols?.promoDetails
|
|
243
|
-
] }) }) : null,
|
|
244
|
-
row.disclosure || row.cols?.disclosure ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__tr-promo-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__tr-promo accordion-table__tr-promo-disclosure", children: row.disclosure || row.cols?.disclosure }) }) : null
|
|
245
|
-
]
|
|
246
|
-
},
|
|
247
|
-
index
|
|
248
|
-
);
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
const defineAccordionTitle = (row) => {
|
|
252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
253
|
-
"div",
|
|
254
|
-
{
|
|
255
|
-
onClick: (e) => handle.accordionChange(row.key, e),
|
|
256
|
-
className: "accordion-table__accordion-label-box",
|
|
257
|
-
children: [
|
|
258
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "accordion-table__accordion-label-wrapper j4", children: [
|
|
259
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
260
|
-
import_react_feather.ChevronDown,
|
|
261
|
-
{
|
|
262
|
-
width: 8,
|
|
263
|
-
height: 4,
|
|
264
|
-
className: (0, import_classnames2.default)("accordion-label-box__icon", {
|
|
265
|
-
"accordion-label-box__icon--open": row.isOpen
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "accordion-label-box__label", children: row.label }),
|
|
270
|
-
row.statistics && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_classnames2.default)("accordion-table__tr", row.className), children: Object.entries(row.statistics).map(([key, value]) => {
|
|
271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
272
|
-
"div",
|
|
273
|
-
{
|
|
274
|
-
style: { width: `${getHeaderItem(key)?.width}%` },
|
|
275
|
-
className: (0, import_classnames2.default)(
|
|
276
|
-
"accordion-table__statistics-td",
|
|
277
|
-
getHeaderItem(key)?.className
|
|
278
|
-
),
|
|
279
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__statistics-td-value-wrapper", children: key === "status" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__statistics-td-value", children: value }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
280
|
-
"p",
|
|
281
|
-
{
|
|
282
|
-
className: "accordion-table__statistics-td-value",
|
|
283
|
-
title: value,
|
|
284
|
-
children: value
|
|
285
|
-
}
|
|
286
|
-
) })
|
|
287
|
-
},
|
|
288
|
-
key
|
|
289
|
-
);
|
|
290
|
-
}) })
|
|
291
|
-
] }),
|
|
292
|
-
row.titleContent
|
|
293
|
-
]
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
};
|
|
297
|
-
(0, import_react2.useEffect)(() => {
|
|
298
|
-
setAccordions(items);
|
|
299
|
-
}, [items]);
|
|
300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: (0, import_classnames2.default)("accordion-table", className), children: [
|
|
301
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__header", children: header?.map((item) => {
|
|
302
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
303
|
-
"div",
|
|
304
|
-
{
|
|
305
|
-
style: { flexBasis: `${item.width}%` },
|
|
306
|
-
className: sortedColClassName(item),
|
|
307
|
-
onClick: () => !item.noSort && handle.setSort(item.key),
|
|
308
|
-
children: [
|
|
309
|
-
sortParams && item.key === sortParams.key && sortParams.key !== "actions" && (sortParams.direction === "DESC" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_feather.ArrowDown, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_feather.ArrowUp, { size: 16 })),
|
|
310
|
-
item.label
|
|
311
|
-
]
|
|
312
|
-
},
|
|
313
|
-
item.key
|
|
314
|
-
);
|
|
315
|
-
}) }),
|
|
316
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "accordion-table__body", children: accordions?.map((accordion) => {
|
|
317
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
318
|
-
MonoAccordion_default,
|
|
319
|
-
{
|
|
320
|
-
testId,
|
|
321
|
-
onClick: (e) => handle.accordionChange(accordion.key, e),
|
|
322
|
-
isOpen: accordion.isOpen,
|
|
323
|
-
className: (0, import_classnames2.default)(
|
|
324
|
-
"accordion-table__body-accordion",
|
|
325
|
-
{
|
|
326
|
-
"accordion-table__body-accordion--closed": !accordion.isOpen
|
|
327
|
-
},
|
|
328
|
-
accordion.className
|
|
329
|
-
),
|
|
330
|
-
titleJSX: defineAccordionTitle(accordion),
|
|
331
|
-
children: accordion.children ?? renderTr(accordion.rows)
|
|
332
|
-
},
|
|
333
|
-
accordion.key
|
|
334
|
-
);
|
|
335
|
-
}) })
|
|
336
|
-
] });
|
|
337
|
-
};
|
|
338
|
-
var AccordionTable_default = AccordionTable;
|
|
339
|
-
|
|
340
|
-
// src/Atomic/UI/AccordionText/AccordionText.js
|
|
341
|
-
var import_react3 = require("react");
|
|
342
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
343
|
-
var import_classnames3 = __toESM(require("classnames"), 1);
|
|
344
|
-
var import_react_feather2 = require("react-feather");
|
|
345
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
346
|
-
var defaultText = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." });
|
|
347
|
-
var AccordionText = ({
|
|
348
|
-
isDefaultOpen = false,
|
|
349
|
-
isOuterOpen = false,
|
|
350
|
-
className,
|
|
351
|
-
text = defaultText,
|
|
352
|
-
shortText = null
|
|
353
|
-
}) => {
|
|
354
|
-
const bodyRef = (0, import_react3.useRef)(null);
|
|
355
|
-
const [isOpen, setIsOpen] = (0, import_react3.useState)(isDefaultOpen);
|
|
356
|
-
const [isNeedTrimText, setIsNeedTrimText] = (0, import_react3.useState)(false);
|
|
357
|
-
(0, import_react3.useEffect)(() => {
|
|
358
|
-
setIsOpen(isOuterOpen);
|
|
359
|
-
}, [isOuterOpen]);
|
|
360
|
-
(0, import_react3.useEffect)(() => {
|
|
361
|
-
const checkEllipsis = () => {
|
|
362
|
-
if (bodyRef.current) {
|
|
363
|
-
setIsNeedTrimText(bodyRef.current.scrollWidth > bodyRef.current.clientWidth);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
367
|
-
checkEllipsis();
|
|
368
|
-
});
|
|
369
|
-
if (bodyRef.current) {
|
|
370
|
-
resizeObserver.observe(bodyRef.current);
|
|
371
|
-
checkEllipsis();
|
|
372
|
-
}
|
|
373
|
-
return () => {
|
|
374
|
-
if (bodyRef.current) {
|
|
375
|
-
resizeObserver.unobserve(bodyRef.current);
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
}, [text]);
|
|
379
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
380
|
-
"div",
|
|
381
|
-
{
|
|
382
|
-
className: (0, import_classnames3.default)("accordion-text", className, {
|
|
383
|
-
"accordion-text--open": isOpen
|
|
384
|
-
}),
|
|
385
|
-
onClick: () => setIsOpen((prevIsOpen) => !prevIsOpen),
|
|
386
|
-
children: [
|
|
387
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
388
|
-
"div",
|
|
389
|
-
{
|
|
390
|
-
className: (0, import_classnames3.default)("accordion-text__body", {
|
|
391
|
-
"accordion-text__body--trim-text": isNeedTrimText && !isOpen
|
|
392
|
-
}),
|
|
393
|
-
ref: bodyRef,
|
|
394
|
-
children: shortText ? isOpen ? text : shortText : text
|
|
395
|
-
}
|
|
396
|
-
),
|
|
397
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "accordion-text__toggle", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_feather2.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_feather2.ChevronDown, {}) })
|
|
398
|
-
]
|
|
399
|
-
}
|
|
400
|
-
);
|
|
401
|
-
};
|
|
402
|
-
var AccordionText_default = AccordionText;
|
|
403
|
-
|
|
404
|
-
// src/Atomic/UI/AdvancedTag/AdvancedTags.tsx
|
|
405
|
-
var import_classnames7 = __toESM(require("classnames"), 1);
|
|
406
|
-
var import_react7 = require("react");
|
|
407
|
-
|
|
408
|
-
// src/Atomic/UI/Tag/Tag.tsx
|
|
409
|
-
var import_classnames5 = __toESM(require("classnames"), 1);
|
|
410
|
-
var import_react5 = require("react");
|
|
411
|
-
var import_react_dom = require("react-dom");
|
|
412
|
-
var import_react_feather3 = require("react-feather");
|
|
413
|
-
|
|
414
|
-
// src/Atomic/Layout/Spinner/Spinner.tsx
|
|
415
|
-
var import_classnames4 = __toESM(require("classnames"), 1);
|
|
416
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
417
|
-
var CN = "loader-box";
|
|
418
|
-
var Spinner = ({ size = null, className, testId = CN }) => {
|
|
419
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
420
|
-
"div",
|
|
421
|
-
{
|
|
422
|
-
role: "status",
|
|
423
|
-
"aria-live": "polite",
|
|
424
|
-
"aria-busy": "true",
|
|
425
|
-
"data-testid": testId,
|
|
426
|
-
className: (0, import_classnames4.default)(
|
|
427
|
-
CN,
|
|
428
|
-
{
|
|
429
|
-
j5: size !== "small",
|
|
430
|
-
j8: size === "small"
|
|
431
|
-
},
|
|
432
|
-
className
|
|
433
|
-
),
|
|
434
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_classnames4.default)("lds-ring", { [`lds-ring_${size}`]: size }), children: [
|
|
435
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", {}),
|
|
436
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", {}),
|
|
437
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", {}),
|
|
438
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", {})
|
|
439
|
-
] })
|
|
440
|
-
}
|
|
441
|
-
);
|
|
442
|
-
};
|
|
443
|
-
var Spinner_default = Spinner;
|
|
444
|
-
|
|
445
|
-
// src/Atomic/Layout/Spinner/index.ts
|
|
446
|
-
var Spinner_default2 = Spinner_default;
|
|
447
|
-
|
|
448
|
-
// src/Atomic/UI/Tag/Tag.tsx
|
|
449
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
450
|
-
var CN2 = "tag";
|
|
451
|
-
function defaultOnClick() {
|
|
452
|
-
}
|
|
453
|
-
var Tag2 = ({
|
|
454
|
-
value,
|
|
455
|
-
className,
|
|
456
|
-
style,
|
|
457
|
-
label,
|
|
458
|
-
warning,
|
|
459
|
-
isWarningHint = true,
|
|
460
|
-
removeItem,
|
|
461
|
-
name,
|
|
462
|
-
isPopup,
|
|
463
|
-
popupInfoContent,
|
|
464
|
-
popupClassName,
|
|
465
|
-
id,
|
|
466
|
-
isUseInTable,
|
|
467
|
-
isNoDismiss = true,
|
|
468
|
-
onClick = defaultOnClick,
|
|
469
|
-
testId = CN2
|
|
470
|
-
}) => {
|
|
471
|
-
const tagRef = (0, import_react5.useRef)(null);
|
|
472
|
-
const [isTagHover, setIsTagHover] = (0, import_react5.useState)(false);
|
|
473
|
-
const [isTagPopupOpened, setIsTagPopupOpened] = (0, import_react5.useState)(false);
|
|
474
|
-
const { x, y, height, width } = tagRef?.current?.getBoundingClientRect() ?? {};
|
|
475
|
-
const { scrollY } = window;
|
|
476
|
-
const tagPopupStyles = (0, import_react5.useMemo)(() => {
|
|
477
|
-
if (!isTagPopupOpened || !tagRef?.current) return {};
|
|
478
|
-
const { x: x2, y: y2, height: height2, width: width2 } = tagRef?.current?.getBoundingClientRect();
|
|
479
|
-
return {
|
|
480
|
-
left: `${x2}px`,
|
|
481
|
-
top: `${y2 + scrollY}px`,
|
|
482
|
-
transform: `translate(calc(-1 * calc(100% - ${width2 / 2 + 22}px)), ${height2 + 10}px)`
|
|
483
|
-
};
|
|
484
|
-
}, [isTagPopupOpened, x, y, width, height, scrollY]);
|
|
485
|
-
const tagLabelStyle = (0, import_react5.useMemo)(() => {
|
|
486
|
-
const styleObj = {};
|
|
487
|
-
const bgColor = style?.backgroundColor ?? style?.background;
|
|
488
|
-
if (bgColor === "#242424") {
|
|
489
|
-
styleObj.color = "#fff";
|
|
490
|
-
}
|
|
491
|
-
return styleObj;
|
|
492
|
-
}, [style]);
|
|
493
|
-
const handle = {
|
|
494
|
-
onTagClick: (event) => {
|
|
495
|
-
if (isUseInTable) {
|
|
496
|
-
event.stopPropagation();
|
|
497
|
-
}
|
|
498
|
-
if (isPopup) {
|
|
499
|
-
setIsTagPopupOpened(!isTagPopupOpened);
|
|
500
|
-
}
|
|
501
|
-
onClick(id, event);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
const handleClickOutside = () => {
|
|
505
|
-
setIsTagPopupOpened(false);
|
|
506
|
-
};
|
|
507
|
-
(0, import_react5.useEffect)(() => {
|
|
508
|
-
document.addEventListener("click", handleClickOutside, true);
|
|
509
|
-
return () => {
|
|
510
|
-
document.removeEventListener("click", handleClickOutside, true);
|
|
511
|
-
};
|
|
512
|
-
}, []);
|
|
513
|
-
(0, import_react5.useEffect)(() => {
|
|
514
|
-
const handleScroll = () => {
|
|
515
|
-
setIsTagPopupOpened(false);
|
|
516
|
-
};
|
|
517
|
-
window.addEventListener("scroll", handleScroll, true);
|
|
518
|
-
return () => {
|
|
519
|
-
window.removeEventListener("scroll", handleScroll, true);
|
|
520
|
-
};
|
|
521
|
-
}, []);
|
|
522
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
523
|
-
"div",
|
|
524
|
-
{
|
|
525
|
-
onMouseEnter: () => setIsTagHover(true),
|
|
526
|
-
onMouseLeave: () => setIsTagHover(false),
|
|
527
|
-
"data-testid": testId,
|
|
528
|
-
role: "listitem",
|
|
529
|
-
"aria-label": `Tag: ${label || name}`,
|
|
530
|
-
className: (0, import_classnames5.default)(CN2, className, { "tag-warn": warning }),
|
|
531
|
-
style: style ?? {},
|
|
532
|
-
onClick: (event) => handle.onTagClick(event),
|
|
533
|
-
ref: tagRef,
|
|
534
|
-
children: [
|
|
535
|
-
warning && typeof warning === "string" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_feather3.AlertTriangle, { className: "advanced-tags--warning-icon mr5", "aria-label": "Warning" }),
|
|
536
|
-
warning && typeof warning === "string" && isTagHover && isWarningHint && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "tag__warn-hint", role: "tooltip", children: warning }),
|
|
537
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "tag__label", style: tagLabelStyle, children: label || name }),
|
|
538
|
-
removeItem && !isNoDismiss && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
539
|
-
"button",
|
|
540
|
-
{
|
|
541
|
-
type: "button",
|
|
542
|
-
onClick: (e) => {
|
|
543
|
-
e?.preventDefault();
|
|
544
|
-
e?.stopPropagation();
|
|
545
|
-
removeItem(value);
|
|
546
|
-
},
|
|
547
|
-
"aria-label": `Remove ${label || name}`,
|
|
548
|
-
className: "tag__button",
|
|
549
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_feather3.X, { className: "color--text" })
|
|
550
|
-
}
|
|
551
|
-
),
|
|
552
|
-
isTagPopupOpened && (0, import_react_dom.createPortal)(
|
|
553
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { id: `tagPopup${value}`, className: (0, import_classnames5.default)("tag__popup", popupClassName), style: tagPopupStyles, children: !popupInfoContent ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner_default2, { size: "small" }) : popupInfoContent }),
|
|
554
|
-
document.getElementById("root")
|
|
555
|
-
)
|
|
556
|
-
]
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
};
|
|
560
|
-
var Tag_default = Tag2;
|
|
561
|
-
|
|
562
|
-
// src/Atomic/UI/AdvancedTag/AdvTag.tsx
|
|
563
|
-
var import_classnames6 = __toESM(require("classnames"), 1);
|
|
564
|
-
var import_react6 = require("react");
|
|
565
|
-
var import_react_feather4 = require("react-feather");
|
|
566
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
567
|
-
var AdvTag = ({
|
|
568
|
-
item,
|
|
569
|
-
className,
|
|
570
|
-
testId = "adv-tag",
|
|
571
|
-
toTop = true
|
|
572
|
-
}) => {
|
|
573
|
-
const {
|
|
574
|
-
labelLeft,
|
|
575
|
-
labelRight,
|
|
576
|
-
active = 0,
|
|
577
|
-
pause = 0,
|
|
578
|
-
merchants,
|
|
579
|
-
warnLeft,
|
|
580
|
-
warnLeftMsg,
|
|
581
|
-
warnRightMsg,
|
|
582
|
-
isEntityAndCounter = false,
|
|
583
|
-
entityAndCounter = {
|
|
584
|
-
nullCounterMessage: "",
|
|
585
|
-
title: "",
|
|
586
|
-
counter: null
|
|
587
|
-
},
|
|
588
|
-
type
|
|
589
|
-
} = item;
|
|
590
|
-
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
591
|
-
const [clickedWarning, setClickedWarning] = (0, import_react6.useState)("");
|
|
592
|
-
const hintRef = (0, import_react6.useRef)(null);
|
|
593
|
-
const activeNumberClass = (0, import_classnames6.default)("strong", {
|
|
594
|
-
"color--pause": active === 0,
|
|
595
|
-
"color--green-haze": active > 0
|
|
596
|
-
});
|
|
597
|
-
const pauseNumberClass = (0, import_classnames6.default)("strong", {
|
|
598
|
-
"color--pause": pause === 0,
|
|
599
|
-
"color--light-red": pause > 0
|
|
600
|
-
});
|
|
601
|
-
const isEmptyEntitys = isEntityAndCounter && (!entityAndCounter?.counter || entityAndCounter.counter === 0) || !isEntityAndCounter && (warnLeft || !merchants);
|
|
602
|
-
const advancedTagClass = (0, import_classnames6.default)("advanced-tags", {
|
|
603
|
-
"advanced-tags--error": isEmptyEntitys
|
|
604
|
-
}, className);
|
|
605
|
-
const onWarningClick = (warn) => {
|
|
606
|
-
setIsOpen(true);
|
|
607
|
-
setClickedWarning(warn);
|
|
608
|
-
};
|
|
609
|
-
const handleClickOutside = (event) => {
|
|
610
|
-
if (hintRef.current && !hintRef.current.contains(event.target)) {
|
|
611
|
-
setIsOpen(false);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
(0, import_react6.useEffect)(() => {
|
|
615
|
-
document.addEventListener("click", handleClickOutside, true);
|
|
616
|
-
return () => {
|
|
617
|
-
document.removeEventListener("click", handleClickOutside, true);
|
|
618
|
-
};
|
|
619
|
-
}, []);
|
|
620
|
-
if (!item) return null;
|
|
621
|
-
const renderClassicTag = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-testid": testId, className: advancedTagClass, ref: hintRef, children: [
|
|
622
|
-
warnLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
623
|
-
"div",
|
|
624
|
-
{
|
|
625
|
-
"data-testid": `${testId}-left`,
|
|
626
|
-
className: "advanced-tags--warning-icon-wrapper",
|
|
627
|
-
onMouseEnter: () => onWarningClick("warnLeft"),
|
|
628
|
-
onMouseLeave: () => setIsOpen(false),
|
|
629
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
630
|
-
import_react_feather4.AlertTriangle,
|
|
631
|
-
{
|
|
632
|
-
width: 16,
|
|
633
|
-
height: 16,
|
|
634
|
-
className: "advanced-tags--warning-icon mr5"
|
|
635
|
-
}
|
|
636
|
-
)
|
|
637
|
-
}
|
|
638
|
-
),
|
|
639
|
-
labelLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr5", children: labelLeft }),
|
|
640
|
-
labelRight && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: labelRight }),
|
|
641
|
-
type !== "simple" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ml5 mr5", children: "|" }),
|
|
642
|
-
type !== "simple" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "df", children: [
|
|
643
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: activeNumberClass, children: active }),
|
|
644
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "strong color--pause", children: "/" }),
|
|
645
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: pauseNumberClass, children: pause })
|
|
646
|
-
] }),
|
|
647
|
-
type !== "simple" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "ml5 mr5", children: "|" }),
|
|
648
|
-
merchants ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: merchants }) : type !== "simple" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
649
|
-
"div",
|
|
650
|
-
{
|
|
651
|
-
"data-testid": `${testId}-right`,
|
|
652
|
-
className: "advanced-tags--warning-icon-wrapper",
|
|
653
|
-
onMouseEnter: () => onWarningClick("warnRight"),
|
|
654
|
-
onMouseLeave: () => setIsOpen(false),
|
|
655
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
656
|
-
import_react_feather4.AlertTriangle,
|
|
657
|
-
{
|
|
658
|
-
width: 16,
|
|
659
|
-
height: 16,
|
|
660
|
-
className: "advanced-tags--warning-icon"
|
|
661
|
-
}
|
|
662
|
-
)
|
|
663
|
-
}
|
|
664
|
-
),
|
|
665
|
-
isOpen && warnLeftMsg && clickedWarning === "warnLeft" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
666
|
-
"span",
|
|
667
|
-
{
|
|
668
|
-
className: (0, import_classnames6.default)(
|
|
669
|
-
"advanced-tags__warn-text advanced-tags__warn-text--warnLeft",
|
|
670
|
-
{ "advanced-tags__warn-text--warnLeft--to-top": toTop }
|
|
671
|
-
),
|
|
672
|
-
children: warnLeftMsg
|
|
673
|
-
}
|
|
674
|
-
),
|
|
675
|
-
isOpen && warnRightMsg && clickedWarning === "warnRight" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
676
|
-
"span",
|
|
677
|
-
{
|
|
678
|
-
className: (0, import_classnames6.default)(
|
|
679
|
-
"advanced-tags__warn-text",
|
|
680
|
-
"advanced-tags__warn-text--warnRight",
|
|
681
|
-
{ "advanced-tags__warn-text--warnRight--to-top": toTop }
|
|
682
|
-
),
|
|
683
|
-
children: warnRightMsg
|
|
684
|
-
}
|
|
685
|
-
)
|
|
686
|
-
] });
|
|
687
|
-
const renderWithEntityAndCounterTag = () => {
|
|
688
|
-
const isNullcounter = entityAndCounter?.counter?.toString() === "0";
|
|
689
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-testid": testId, className: advancedTagClass, ref: hintRef, children: [
|
|
690
|
-
isNullcounter && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
691
|
-
"div",
|
|
692
|
-
{
|
|
693
|
-
"data-testid": `${testId}-left`,
|
|
694
|
-
className: "advanced-tags--warning-icon-wrapper",
|
|
695
|
-
onMouseEnter: () => onWarningClick("warnLeft"),
|
|
696
|
-
onMouseLeave: () => setIsOpen(false),
|
|
697
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
698
|
-
import_react_feather4.AlertTriangle,
|
|
699
|
-
{
|
|
700
|
-
width: 16,
|
|
701
|
-
height: 16,
|
|
702
|
-
className: "advanced-tags--warning-icon mr5"
|
|
703
|
-
}
|
|
704
|
-
)
|
|
705
|
-
}
|
|
706
|
-
),
|
|
707
|
-
isOpen && entityAndCounter?.nullCounterMessage && clickedWarning === "warnLeft" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
708
|
-
"span",
|
|
709
|
-
{
|
|
710
|
-
className: (0, import_classnames6.default)(
|
|
711
|
-
"advanced-tags__warn-text advanced-tags__warn-text--warnLeft",
|
|
712
|
-
{ "advanced-tags__warn-text--warnLeft--to-top": toTop }
|
|
713
|
-
),
|
|
714
|
-
children: entityAndCounter.nullCounterMessage
|
|
715
|
-
}
|
|
716
|
-
),
|
|
717
|
-
entityAndCounter?.title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr5", children: entityAndCounter.title }),
|
|
718
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
719
|
-
"div",
|
|
720
|
-
{
|
|
721
|
-
className: (0, import_classnames6.default)("advanced-tags__counter", {
|
|
722
|
-
"advanced-tags__counter--null": isNullcounter,
|
|
723
|
-
"advanced-tags__counter--bold": !isNullcounter
|
|
724
|
-
}),
|
|
725
|
-
children: entityAndCounter?.counter
|
|
726
|
-
}
|
|
727
|
-
)
|
|
728
|
-
] });
|
|
729
|
-
};
|
|
730
|
-
return !isEntityAndCounter ? renderClassicTag() : renderWithEntityAndCounterTag();
|
|
731
|
-
};
|
|
732
|
-
var AdvTag_default = AdvTag;
|
|
733
|
-
|
|
734
|
-
// src/Atomic/UI/AdvancedTag/AdvancedTags.tsx
|
|
735
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
736
|
-
var AdvancedTags = ({
|
|
737
|
-
items,
|
|
738
|
-
noItemsTagLabel,
|
|
739
|
-
className,
|
|
740
|
-
testId = "advanced-tag-test",
|
|
741
|
-
toTop = true
|
|
742
|
-
}) => {
|
|
743
|
-
const [showedItems, setShowedItems] = (0, import_react7.useState)(items.slice(0, 2));
|
|
744
|
-
const [showMore, setShowMore] = (0, import_react7.useState)(true);
|
|
745
|
-
const onShowMoreClick = () => {
|
|
746
|
-
setShowedItems(showMore ? items : items.slice(0, 2));
|
|
747
|
-
setShowMore(!showMore);
|
|
748
|
-
};
|
|
749
|
-
if ((!items || !items.length) && noItemsTagLabel) {
|
|
750
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
751
|
-
Tag_default,
|
|
752
|
-
{
|
|
753
|
-
label: noItemsTagLabel?.toString(),
|
|
754
|
-
className: (0, import_classnames7.default)(className, "tag-warn")
|
|
755
|
-
}
|
|
756
|
-
);
|
|
757
|
-
}
|
|
758
|
-
if ((!items || !items.length) && !noItemsTagLabel) return null;
|
|
759
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-testid": testId, className: (0, import_classnames7.default)(className, "j4 wrap"), children: [
|
|
760
|
-
showedItems.map((item, index) => {
|
|
761
|
-
if (!item) return null;
|
|
762
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
763
|
-
AdvTag_default,
|
|
764
|
-
{
|
|
765
|
-
toTop,
|
|
766
|
-
item,
|
|
767
|
-
testId: `${testId}-item-${index}`
|
|
768
|
-
},
|
|
769
|
-
index
|
|
770
|
-
);
|
|
771
|
-
}),
|
|
772
|
-
items.length >= 3 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
773
|
-
"span",
|
|
774
|
-
{
|
|
775
|
-
"data-testid": `${testId}-showMore`,
|
|
776
|
-
onClick: onShowMoreClick,
|
|
777
|
-
className: "advanced-tags advanced-tags--showMore",
|
|
778
|
-
children: showMore ? `+${items.length - showedItems.length}` : "..."
|
|
779
|
-
}
|
|
780
|
-
)
|
|
781
|
-
] });
|
|
782
|
-
};
|
|
783
|
-
var AdvancedTags_default = AdvancedTags;
|
|
784
|
-
|
|
785
|
-
// src/Atomic/UI/AdvancedTag/index.ts
|
|
786
|
-
var AdvancedTag_default = AdvancedTags_default;
|
|
787
|
-
|
|
788
|
-
// src/Atomic/UI/Alert/Alert.tsx
|
|
789
|
-
var import_classnames9 = __toESM(require("classnames"), 1);
|
|
790
|
-
var import_react8 = require("react");
|
|
791
|
-
var import_react_feather5 = require("react-feather");
|
|
792
|
-
|
|
793
|
-
// src/Atomic/UI/Button/Button.tsx
|
|
794
|
-
var import_classnames8 = __toESM(require("classnames"), 1);
|
|
795
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
796
|
-
var RC2 = "button";
|
|
797
|
-
var Button = ({
|
|
798
|
-
label,
|
|
799
|
-
onClick,
|
|
800
|
-
disabled,
|
|
801
|
-
icon,
|
|
802
|
-
className,
|
|
803
|
-
children,
|
|
804
|
-
style,
|
|
805
|
-
noIcon,
|
|
806
|
-
isIconRight,
|
|
807
|
-
testId = "button",
|
|
808
|
-
tabIndex = 0,
|
|
809
|
-
variant = "primary",
|
|
810
|
-
isTextEllipsis = false,
|
|
811
|
-
...props
|
|
812
|
-
}) => {
|
|
813
|
-
const noRenderIcon = noIcon || variant === "ellipse-apply" || variant === "ellipse-cancel";
|
|
814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
815
|
-
"button",
|
|
816
|
-
{
|
|
817
|
-
"data-testid": testId,
|
|
818
|
-
tabIndex,
|
|
819
|
-
style,
|
|
820
|
-
className: (0, import_classnames8.default)(
|
|
821
|
-
RC2,
|
|
822
|
-
{
|
|
823
|
-
[`${RC2}_${variant}`]: variant,
|
|
824
|
-
"button_icon-left": icon && !isIconRight,
|
|
825
|
-
"button_icon-right": icon && isIconRight
|
|
826
|
-
},
|
|
827
|
-
className
|
|
828
|
-
),
|
|
829
|
-
onClick,
|
|
830
|
-
disabled,
|
|
831
|
-
type: "button",
|
|
832
|
-
...props,
|
|
833
|
-
children: [
|
|
834
|
-
!noRenderIcon && icon,
|
|
835
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_classnames8.default)("button__text", { "text-ellipsis": isTextEllipsis }), children: label }),
|
|
836
|
-
!label && children ? children : null
|
|
837
|
-
]
|
|
838
|
-
}
|
|
839
|
-
);
|
|
840
|
-
};
|
|
841
|
-
var Button_default = Button;
|
|
842
|
-
|
|
843
|
-
// src/Atomic/UI/Alert/Alert.tsx
|
|
844
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
845
|
-
var Alert = ({
|
|
846
|
-
message,
|
|
847
|
-
icon,
|
|
848
|
-
className,
|
|
849
|
-
children,
|
|
850
|
-
noDismiss,
|
|
851
|
-
testId = "alert",
|
|
852
|
-
isHidden = false,
|
|
853
|
-
variant = "warning",
|
|
854
|
-
isLoading,
|
|
855
|
-
buttonParams
|
|
856
|
-
}) => {
|
|
857
|
-
const [onClose, setOnClose] = (0, import_react8.useState)(false);
|
|
858
|
-
const renderActionsBlock = () => {
|
|
859
|
-
if (buttonParams) {
|
|
860
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "j6 alert__btns-box", children: [
|
|
861
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default, { ...buttonParams }),
|
|
862
|
-
!noDismiss && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "alert__close-btn", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_feather5.X, { "data-testid": `${testId}-close`, onClick: () => setOnClose(!onClose) }) })
|
|
863
|
-
] });
|
|
864
|
-
}
|
|
865
|
-
if (!noDismiss) {
|
|
866
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "alert__close-btn", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_feather5.X, { "data-testid": `${testId}-close`, onClick: () => setOnClose(!onClose) }) });
|
|
867
|
-
} else {
|
|
868
|
-
return null;
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
872
|
-
"div",
|
|
873
|
-
{
|
|
874
|
-
"data-testid": testId,
|
|
875
|
-
className: (0, import_classnames9.default)(className, { hidden: onClose }, `alert alert--${variant}`, {
|
|
876
|
-
"hidden": isHidden,
|
|
877
|
-
"alert--loading": isLoading
|
|
878
|
-
}),
|
|
879
|
-
children: [
|
|
880
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "alert__icon-text-box j4", children: [
|
|
881
|
-
icon,
|
|
882
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: children || message })
|
|
883
|
-
] }),
|
|
884
|
-
renderActionsBlock(),
|
|
885
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner_default, { size: "small", testId: "loader-box" })
|
|
886
|
-
]
|
|
887
|
-
}
|
|
888
|
-
);
|
|
889
|
-
};
|
|
890
|
-
var Alert_default = Alert;
|
|
891
|
-
|
|
892
|
-
// src/Atomic/UI/Alert/index.ts
|
|
893
|
-
var Alert_default2 = Alert_default;
|
|
894
|
-
|
|
895
|
-
// src/Atomic/UI/Arrow/Arrow.tsx
|
|
896
|
-
var import_classnames10 = __toESM(require("classnames"), 1);
|
|
897
|
-
var import_react10 = require("react");
|
|
898
|
-
|
|
899
|
-
// src/Functions/utils.js
|
|
900
|
-
var import_react9 = require("react");
|
|
901
|
-
var import_moment_timezone = __toESM(require("moment-timezone"), 1);
|
|
902
|
-
|
|
903
|
-
// src/Constants/index.constants.js
|
|
904
|
-
var DEFAULT_COLORS = [
|
|
905
|
-
"#D9C1FF",
|
|
906
|
-
"#FFBAF0",
|
|
907
|
-
"#FFB8CE",
|
|
908
|
-
"#FFC3A2",
|
|
909
|
-
"#FFDB7C",
|
|
910
|
-
"#F9F871",
|
|
911
|
-
"#C3FCF1",
|
|
912
|
-
"#F6F2CB",
|
|
913
|
-
"#E0F8D1",
|
|
914
|
-
"#B1DFFB",
|
|
915
|
-
"#8DECFE",
|
|
916
|
-
"#76F7ED",
|
|
917
|
-
"#8AFEC8"
|
|
918
|
-
];
|
|
919
|
-
|
|
920
|
-
// src/Functions/utils.js
|
|
921
|
-
var getIsOnlyAnObject = (input) => {
|
|
922
|
-
return typeof input === "object" && // "отбивает" примитивы и функции
|
|
923
|
-
input instanceof Object && // "отбивает" null
|
|
924
|
-
!Array.isArray(input) && // "отбивает" массивы
|
|
925
|
-
!(input instanceof Set) && // "отбивает" сеты
|
|
926
|
-
!(input instanceof Map);
|
|
927
|
-
};
|
|
928
|
-
var handleObjectChange = (updateObject, updateFunction) => (data, prop = "", isNumber) => {
|
|
929
|
-
let value;
|
|
930
|
-
if (data?.target) {
|
|
931
|
-
value = data.target.type === "checkbox" ? data.target.checked : data.target.value;
|
|
932
|
-
} else value = data;
|
|
933
|
-
value = isNumber ? Number(value) : value;
|
|
934
|
-
const props = prop.split(".");
|
|
935
|
-
const currentObject = props.reduce((res, chapter, index) => {
|
|
936
|
-
if (props.length !== index + 1) res = res[chapter];
|
|
937
|
-
return res;
|
|
938
|
-
}, updateObject);
|
|
939
|
-
currentObject[props.pop()] = value;
|
|
940
|
-
updateFunction();
|
|
941
|
-
};
|
|
942
|
-
var useOutsideToggle = (ref, setOut, open) => {
|
|
943
|
-
function handleClickOutside(event) {
|
|
944
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
945
|
-
setOut(open);
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
(0, import_react9.useEffect)(() => {
|
|
949
|
-
document.addEventListener("mouseup", handleClickOutside);
|
|
950
|
-
return () => {
|
|
951
|
-
document.removeEventListener("mouseup", handleClickOutside);
|
|
952
|
-
};
|
|
953
|
-
}, [ref]);
|
|
954
|
-
};
|
|
955
|
-
var getStyles = (el, prop) => {
|
|
956
|
-
if (!el) return null;
|
|
957
|
-
if (!prop) return window.getComputedStyle(el);
|
|
958
|
-
return window.getComputedStyle(el).getPropertyValue(prop);
|
|
959
|
-
};
|
|
960
|
-
var getColorById = (id, colors) => {
|
|
961
|
-
if (!id) return "#FF7D00";
|
|
962
|
-
const idToArr = Array.from(id);
|
|
963
|
-
const colorsArr = colors && colors.length > 0 ? colors : DEFAULT_COLORS;
|
|
964
|
-
let number = idToArr.reduce((acc, item) => {
|
|
965
|
-
if (Number(item)) {
|
|
966
|
-
return acc + Number(item);
|
|
967
|
-
}
|
|
968
|
-
return acc;
|
|
969
|
-
}, 0);
|
|
970
|
-
while (number >= colorsArr.length) {
|
|
971
|
-
number -= colorsArr.length;
|
|
972
|
-
}
|
|
973
|
-
return colorsArr[number];
|
|
974
|
-
};
|
|
975
|
-
var addBitDepthPoints = (value, step = 3) => {
|
|
976
|
-
const isFraction = value?.includes(".");
|
|
977
|
-
const valueBeforeDot = isFraction ? value?.slice(0, value?.indexOf(".")) : value;
|
|
978
|
-
const intPart = valueBeforeDot.split("").reverse().reduce(
|
|
979
|
-
(acc, item, idx) => idx % step === 0 && idx !== 0 ? [...acc, ",", item] : [...acc, item],
|
|
980
|
-
[]
|
|
981
|
-
).reverse().join("");
|
|
982
|
-
return isFraction ? intPart + value?.slice(value?.indexOf(".")) : intPart;
|
|
983
|
-
};
|
|
984
|
-
var firstLetterCapital = (str) => typeof str === "string" ? `${str.charAt(0).toUpperCase()}${str.slice(1)}` : str;
|
|
985
|
-
var capitalized = firstLetterCapital;
|
|
986
|
-
var checkedRef = (ref) => ref ? typeof ref === "function" ? (node) => ref(node) : ref : null;
|
|
987
|
-
String.prototype.longerThan = function(compareWith) {
|
|
988
|
-
return this?.length > compareWith?.length;
|
|
989
|
-
};
|
|
990
|
-
String.prototype.lastIndexEqualsTo = function(index) {
|
|
991
|
-
return this?.length - 1 === index;
|
|
992
|
-
};
|
|
993
|
-
|
|
994
|
-
// src/Atomic/UI/Arrow/Arrow.tsx
|
|
995
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
996
|
-
function Arrow({ type, className, onClick, disabled, testId, isAlt }) {
|
|
997
|
-
const ref = (0, import_react10.useRef)(null);
|
|
998
|
-
const [color, setColor] = (0, import_react10.useState)("currentColor");
|
|
999
|
-
(0, import_react10.useEffect)(() => {
|
|
1000
|
-
if (ref.current) {
|
|
1001
|
-
setColor(getStyles(ref.current, "color"));
|
|
1002
|
-
}
|
|
1003
|
-
}, [ref.current]);
|
|
1004
|
-
if (!type || type !== "left" && type !== "right") return null;
|
|
1005
|
-
function renderSVG() {
|
|
1006
|
-
if (type === "left") {
|
|
1007
|
-
if (isAlt) {
|
|
1008
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1009
|
-
"svg",
|
|
1010
|
-
{
|
|
1011
|
-
"data-testid": testId,
|
|
1012
|
-
version: "1.1",
|
|
1013
|
-
id: "Layer_1",
|
|
1014
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1015
|
-
width: "16",
|
|
1016
|
-
height: "16",
|
|
1017
|
-
viewBox: "0 0 16 16",
|
|
1018
|
-
children: [
|
|
1019
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1020
|
-
"path",
|
|
1021
|
-
{
|
|
1022
|
-
d: "M12.7,8H3.3",
|
|
1023
|
-
stroke: color,
|
|
1024
|
-
fill: "none",
|
|
1025
|
-
strokeWidth: 1.3333,
|
|
1026
|
-
strokeLinecap: "round",
|
|
1027
|
-
strokeLinejoin: "round"
|
|
1028
|
-
}
|
|
1029
|
-
),
|
|
1030
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1031
|
-
"path",
|
|
1032
|
-
{
|
|
1033
|
-
d: "M8,3.3L3.3,8L8,12.7",
|
|
1034
|
-
stroke: color,
|
|
1035
|
-
fill: "none",
|
|
1036
|
-
strokeWidth: 1.3333,
|
|
1037
|
-
strokeLinecap: "round",
|
|
1038
|
-
strokeLinejoin: "round"
|
|
1039
|
-
}
|
|
1040
|
-
)
|
|
1041
|
-
]
|
|
1042
|
-
}
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1046
|
-
"svg",
|
|
1047
|
-
{
|
|
1048
|
-
"data-testid": testId,
|
|
1049
|
-
width: "24",
|
|
1050
|
-
height: "24",
|
|
1051
|
-
viewBox: "0 0 24 24",
|
|
1052
|
-
fill: "none",
|
|
1053
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1054
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1055
|
-
"path",
|
|
1056
|
-
{
|
|
1057
|
-
d: "M15 18L9 12L15 6",
|
|
1058
|
-
stroke: color,
|
|
1059
|
-
strokeWidth: "2",
|
|
1060
|
-
strokeLinecap: "round",
|
|
1061
|
-
strokeLinejoin: "round"
|
|
1062
|
-
}
|
|
1063
|
-
)
|
|
1064
|
-
}
|
|
1065
|
-
);
|
|
1066
|
-
}
|
|
1067
|
-
if (isAlt) {
|
|
1068
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1069
|
-
"svg",
|
|
1070
|
-
{
|
|
1071
|
-
"data-testid": testId,
|
|
1072
|
-
id: "Layer_1",
|
|
1073
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1074
|
-
width: "16",
|
|
1075
|
-
height: "16",
|
|
1076
|
-
viewBox: "0 0 16 16",
|
|
1077
|
-
children: [
|
|
1078
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1079
|
-
"path",
|
|
1080
|
-
{
|
|
1081
|
-
d: "M3.3,8h9.3",
|
|
1082
|
-
stroke: color,
|
|
1083
|
-
fill: "none",
|
|
1084
|
-
strokeWidth: 1.3333,
|
|
1085
|
-
strokeLinecap: "round",
|
|
1086
|
-
strokeLinejoin: "round"
|
|
1087
|
-
}
|
|
1088
|
-
),
|
|
1089
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1090
|
-
"path",
|
|
1091
|
-
{
|
|
1092
|
-
d: "M8,3.3L12.7,8L8,12.7",
|
|
1093
|
-
stroke: color,
|
|
1094
|
-
fill: "none",
|
|
1095
|
-
strokeWidth: 1.3333,
|
|
1096
|
-
strokeLinecap: "round",
|
|
1097
|
-
strokeLinejoin: "round"
|
|
1098
|
-
}
|
|
1099
|
-
)
|
|
1100
|
-
]
|
|
1101
|
-
}
|
|
1102
|
-
);
|
|
1103
|
-
}
|
|
1104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1105
|
-
"svg",
|
|
1106
|
-
{
|
|
1107
|
-
"data-testid": testId,
|
|
1108
|
-
width: "24",
|
|
1109
|
-
height: "24",
|
|
1110
|
-
viewBox: "0 0 24 24",
|
|
1111
|
-
fill: "none",
|
|
1112
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1113
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1114
|
-
"path",
|
|
1115
|
-
{
|
|
1116
|
-
d: "M9 18L15 12L9 6",
|
|
1117
|
-
stroke: "currentColor",
|
|
1118
|
-
strokeWidth: "2",
|
|
1119
|
-
strokeLinecap: "round",
|
|
1120
|
-
strokeLinejoin: "round"
|
|
1121
|
-
}
|
|
1122
|
-
)
|
|
1123
|
-
}
|
|
1124
|
-
);
|
|
1125
|
-
}
|
|
1126
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1127
|
-
"div",
|
|
1128
|
-
{
|
|
1129
|
-
"data-testid": `arrow--key-${testId}--type-${type}`,
|
|
1130
|
-
ref,
|
|
1131
|
-
className: (0, import_classnames10.default)("arrow", `arrow_${type}`, className, {
|
|
1132
|
-
arrow_disabled: disabled
|
|
1133
|
-
}),
|
|
1134
|
-
onClick,
|
|
1135
|
-
children: renderSVG()
|
|
1136
|
-
}
|
|
1137
|
-
);
|
|
1138
|
-
}
|
|
1139
|
-
var Arrow_default = Arrow;
|
|
1140
|
-
|
|
1141
|
-
// src/Atomic/UI/Box/Box.tsx
|
|
1142
|
-
var import_classnames11 = __toESM(require("classnames"), 1);
|
|
1143
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1144
|
-
var directionVariants = {
|
|
1145
|
-
column: "column",
|
|
1146
|
-
row: "row"
|
|
1147
|
-
};
|
|
1148
|
-
var sizes = {
|
|
1149
|
-
none: "none",
|
|
1150
|
-
xs: "xs",
|
|
1151
|
-
s: "s",
|
|
1152
|
-
m: "m",
|
|
1153
|
-
l: "l",
|
|
1154
|
-
xl: "xl"
|
|
1155
|
-
};
|
|
1156
|
-
function Box({
|
|
1157
|
-
children,
|
|
1158
|
-
paddingVariant = sizes.m,
|
|
1159
|
-
radiiVariant = sizes.s,
|
|
1160
|
-
direction = directionVariants.column,
|
|
1161
|
-
className,
|
|
1162
|
-
...restProps
|
|
1163
|
-
}) {
|
|
1164
|
-
const styles = {
|
|
1165
|
-
flexDirection: direction
|
|
1166
|
-
};
|
|
1167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1168
|
-
"div",
|
|
1169
|
-
{
|
|
1170
|
-
style: styles,
|
|
1171
|
-
"data-testid": "box",
|
|
1172
|
-
className: (0, import_classnames11.default)(
|
|
1173
|
-
"box",
|
|
1174
|
-
`box--padding-${paddingVariant}`,
|
|
1175
|
-
`box--radii-${radiiVariant}`,
|
|
1176
|
-
className,
|
|
1177
|
-
{
|
|
1178
|
-
"df": direction === directionVariants.row,
|
|
1179
|
-
"dfc-jc": direction === directionVariants.column
|
|
1180
|
-
}
|
|
1181
|
-
),
|
|
1182
|
-
...restProps,
|
|
1183
|
-
children
|
|
1184
|
-
}
|
|
1185
|
-
);
|
|
1186
|
-
}
|
|
1187
|
-
var Box_default = Box;
|
|
1188
|
-
|
|
1189
|
-
// src/Atomic/UI/CircleProgressBar/CircleProgressBar.js
|
|
1190
|
-
var import_react11 = __toESM(require("react"), 1);
|
|
1191
|
-
var import_classnames12 = __toESM(require("classnames"), 1);
|
|
1192
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1193
|
-
var CircleProgressBar = ({
|
|
1194
|
-
amount,
|
|
1195
|
-
totalAmount,
|
|
1196
|
-
isReverseType,
|
|
1197
|
-
children,
|
|
1198
|
-
className,
|
|
1199
|
-
colors,
|
|
1200
|
-
isInnerLine,
|
|
1201
|
-
radius = 59,
|
|
1202
|
-
strokeWidth = 2,
|
|
1203
|
-
innerLineStrokeWidth = 2,
|
|
1204
|
-
testId = "circle-progress-bar"
|
|
1205
|
-
}) => {
|
|
1206
|
-
const circumference = Math.round(2 * Math.PI * radius);
|
|
1207
|
-
const amountProgress = amount < totalAmount ? Math.round(amount / totalAmount * 100) : 100;
|
|
1208
|
-
const defaultColors = {
|
|
1209
|
-
start: "#6b81dd",
|
|
1210
|
-
finish: "#f06d8d",
|
|
1211
|
-
meter: "#ffcad6"
|
|
1212
|
-
};
|
|
1213
|
-
const [strokeDashoffset, setStrokeDashoffset] = (0, import_react11.useState)(isReverseType ? String(0) : circumference);
|
|
1214
|
-
(0, import_react11.useEffect)(() => {
|
|
1215
|
-
setStrokeDashoffset(circumference - circumference * amountProgress / 100);
|
|
1216
|
-
}, [amountProgress]);
|
|
1217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1218
|
-
"div",
|
|
1219
|
-
{
|
|
1220
|
-
"data-testid": testId,
|
|
1221
|
-
className: (0, import_classnames12.default)("limit-progress-bar", { "limit-progress-bar--reverse": isReverseType }, className),
|
|
1222
|
-
children: [
|
|
1223
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1224
|
-
"svg",
|
|
1225
|
-
{
|
|
1226
|
-
className: "limit-progress-bar__progress",
|
|
1227
|
-
width: "124",
|
|
1228
|
-
height: "124",
|
|
1229
|
-
viewBox: "0 0 124 124",
|
|
1230
|
-
children: [
|
|
1231
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("defs", { children: isReverseType ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1232
|
-
"linearGradient",
|
|
1233
|
-
{
|
|
1234
|
-
id: "limit-progress-bar-linear-gradient-reverse",
|
|
1235
|
-
x1: "0",
|
|
1236
|
-
y1: "1",
|
|
1237
|
-
x2: "0",
|
|
1238
|
-
y2: "0",
|
|
1239
|
-
children: [
|
|
1240
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1241
|
-
"stop",
|
|
1242
|
-
{
|
|
1243
|
-
offset: "0",
|
|
1244
|
-
stopColor: colors.finish || defaultColors.finish
|
|
1245
|
-
}
|
|
1246
|
-
),
|
|
1247
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1248
|
-
"stop",
|
|
1249
|
-
{
|
|
1250
|
-
offset: "1",
|
|
1251
|
-
stopColor: colors.start || defaultColors.start
|
|
1252
|
-
}
|
|
1253
|
-
)
|
|
1254
|
-
]
|
|
1255
|
-
}
|
|
1256
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1257
|
-
"linearGradient",
|
|
1258
|
-
{
|
|
1259
|
-
id: "limit-progress-bar-linear-gradient",
|
|
1260
|
-
x1: "0",
|
|
1261
|
-
y1: "1",
|
|
1262
|
-
x2: "0",
|
|
1263
|
-
y2: "0",
|
|
1264
|
-
children: [
|
|
1265
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1266
|
-
"stop",
|
|
1267
|
-
{
|
|
1268
|
-
offset: "0",
|
|
1269
|
-
stopColor: colors.start || defaultColors.start
|
|
1270
|
-
}
|
|
1271
|
-
),
|
|
1272
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1273
|
-
"stop",
|
|
1274
|
-
{
|
|
1275
|
-
offset: "1",
|
|
1276
|
-
stopColor: colors.finish || defaultColors.finish
|
|
1277
|
-
}
|
|
1278
|
-
)
|
|
1279
|
-
]
|
|
1280
|
-
}
|
|
1281
|
-
) }),
|
|
1282
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1283
|
-
"circle",
|
|
1284
|
-
{
|
|
1285
|
-
className: "limit-progress-bar__meter",
|
|
1286
|
-
cx: radius,
|
|
1287
|
-
cy: radius,
|
|
1288
|
-
r: radius,
|
|
1289
|
-
stroke: !isInnerLine ? "" : colors.meter || defaultColors.meter,
|
|
1290
|
-
strokeWidth: String(innerLineStrokeWidth)
|
|
1291
|
-
}
|
|
1292
|
-
),
|
|
1293
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1294
|
-
"circle",
|
|
1295
|
-
{
|
|
1296
|
-
className: "limit-progress-bar__value",
|
|
1297
|
-
cx: radius,
|
|
1298
|
-
cy: radius,
|
|
1299
|
-
r: radius,
|
|
1300
|
-
strokeWidth: String(strokeWidth),
|
|
1301
|
-
stroke: `url(#limit-progress-bar-linear-gradient${isReverseType ? "-reverse" : ""})`,
|
|
1302
|
-
style: {
|
|
1303
|
-
strokeDasharray: circumference,
|
|
1304
|
-
strokeDashoffset
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
)
|
|
1308
|
-
]
|
|
1309
|
-
}
|
|
1310
|
-
),
|
|
1311
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "limit-progress-bar__content", children })
|
|
1312
|
-
]
|
|
1313
|
-
}
|
|
1314
|
-
);
|
|
1315
|
-
};
|
|
1316
|
-
var CircleProgressBar_default = CircleProgressBar;
|
|
1317
|
-
|
|
1318
|
-
// src/Atomic/UI/DateTime/DateTime.tsx
|
|
1319
|
-
var import_classnames13 = __toESM(require("classnames"), 1);
|
|
1320
|
-
var import_moment_timezone2 = __toESM(require("moment-timezone"), 1);
|
|
1321
|
-
var import_react12 = require("react");
|
|
1322
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1323
|
-
var RC3 = "date-time";
|
|
1324
|
-
var DEFAULT_DATE_FORMAT = "DD.MM.YYYY";
|
|
1325
|
-
var DEFAULT_TIME_FORMAT = "HH:mm:ss";
|
|
1326
|
-
var DateTime = ({
|
|
1327
|
-
className,
|
|
1328
|
-
value,
|
|
1329
|
-
valueFormat,
|
|
1330
|
-
dateFormat: inputDateFormat,
|
|
1331
|
-
timeFormat: inputTimeFormat,
|
|
1332
|
-
isNoDate,
|
|
1333
|
-
isNoTime,
|
|
1334
|
-
testId = "date-time"
|
|
1335
|
-
}) => {
|
|
1336
|
-
const dateFormat = inputDateFormat ?? DEFAULT_DATE_FORMAT;
|
|
1337
|
-
const timeFormat = inputTimeFormat ?? DEFAULT_TIME_FORMAT;
|
|
1338
|
-
const date = (0, import_react12.useMemo)(() => {
|
|
1339
|
-
return (valueFormat ? (0, import_moment_timezone2.default)(value, valueFormat) : (0, import_moment_timezone2.default)(value)).format(
|
|
1340
|
-
dateFormat
|
|
1341
|
-
);
|
|
1342
|
-
}, [value, valueFormat, dateFormat]);
|
|
1343
|
-
const time = (0, import_react12.useMemo)(() => {
|
|
1344
|
-
return (valueFormat ? (0, import_moment_timezone2.default)(value, valueFormat) : (0, import_moment_timezone2.default)(value)).format(
|
|
1345
|
-
timeFormat
|
|
1346
|
-
);
|
|
1347
|
-
}, [value, valueFormat, timeFormat]);
|
|
1348
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "data-testid": testId, className: (0, import_classnames13.default)(RC3, className), children: [
|
|
1349
|
-
!isNoDate && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-testid": `${testId}-date`, className: `${RC3}__date`, children: date }),
|
|
1350
|
-
!isNoTime && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1351
|
-
"span",
|
|
1352
|
-
{
|
|
1353
|
-
"data-testid": `${testId}-time`,
|
|
1354
|
-
className: (0, import_classnames13.default)(`${RC3}__time`, {
|
|
1355
|
-
[`${RC3}_color--pause`]: !isNoDate
|
|
1356
|
-
}),
|
|
1357
|
-
children: time
|
|
1358
|
-
}
|
|
1359
|
-
)
|
|
1360
|
-
] });
|
|
1361
|
-
};
|
|
1362
|
-
var DateTime_default = DateTime;
|
|
1363
|
-
|
|
1364
|
-
// src/Atomic/UI/DebugContainer/DebugContainer.tsx
|
|
1365
|
-
var import_classnames14 = __toESM(require("classnames"), 1);
|
|
1366
|
-
var import_react13 = require("react");
|
|
1367
|
-
var import_react_feather6 = require("react-feather");
|
|
1368
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1369
|
-
var defaultData = {};
|
|
1370
|
-
var DebugContainer = ({ data = defaultData, children, className }) => {
|
|
1371
|
-
const [isVisible, setIsVisible] = (0, import_react13.useState)(true);
|
|
1372
|
-
const renderData = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("pre", { children: [
|
|
1373
|
-
"{\n",
|
|
1374
|
-
Object.keys(data).map((key) => ` ${key}: ${String(data[key])},
|
|
1375
|
-
`),
|
|
1376
|
-
"}"
|
|
1377
|
-
] });
|
|
1378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_classnames14.default)("debug-container", className), "data-testid": "debug-container", children: [
|
|
1379
|
-
isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "debug-container__body", children: [
|
|
1380
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h5", { children: "Debug:" }),
|
|
1381
|
-
data && Object.keys(data).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "debug-container__body-row", "data-testid": "debug-data", children: renderData() }),
|
|
1382
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "debug-container__body-row", "data-testid": "debug-children", children })
|
|
1383
|
-
] }),
|
|
1384
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1385
|
-
"div",
|
|
1386
|
-
{
|
|
1387
|
-
className: "debug-container__toggler",
|
|
1388
|
-
onClick: () => setIsVisible((v) => !v),
|
|
1389
|
-
"data-testid": "debug-toggler",
|
|
1390
|
-
children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_feather6.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_feather6.ChevronDown, {})
|
|
1391
|
-
}
|
|
1392
|
-
)
|
|
1393
|
-
] });
|
|
1394
|
-
};
|
|
1395
|
-
var DebugContainer_default = DebugContainer;
|
|
1396
|
-
|
|
1397
|
-
// src/Atomic/UI/DebugContainer/useDebugContainer.tsx
|
|
1398
|
-
var import_react14 = require("react");
|
|
1399
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1400
|
-
function useDebugContainer() {
|
|
1401
|
-
const [data, setData] = (0, import_react14.useState)({});
|
|
1402
|
-
return {
|
|
1403
|
-
debugData: data,
|
|
1404
|
-
setDebugData: setData,
|
|
1405
|
-
renderDebugContainer: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DebugContainer_default, { data })
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
var useDebugContainer_default = useDebugContainer;
|
|
1409
|
-
|
|
1410
|
-
// src/Atomic/UI/DoubleString/DoubleString.tsx
|
|
1411
|
-
var import_classnames15 = __toESM(require("classnames"), 1);
|
|
1412
|
-
var import_moment = __toESM(require("moment"), 1);
|
|
1413
|
-
var import_react15 = require("react");
|
|
1414
|
-
var import_react_feather7 = require("react-feather");
|
|
1415
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1416
|
-
var RC4 = "double-string";
|
|
1417
|
-
var DoubleString = ({
|
|
1418
|
-
value,
|
|
1419
|
-
description,
|
|
1420
|
-
subDescription,
|
|
1421
|
-
valuePostfix,
|
|
1422
|
-
className,
|
|
1423
|
-
testId = "double-string",
|
|
1424
|
-
isFormatValueToDate,
|
|
1425
|
-
isUseOnClick,
|
|
1426
|
-
dateFormatSettings: {
|
|
1427
|
-
parseFormat = "MM.DD.YYYY",
|
|
1428
|
-
displayFormat = "MM.DD.YYYY"
|
|
1429
|
-
} = {},
|
|
1430
|
-
revert = false,
|
|
1431
|
-
noTitle,
|
|
1432
|
-
isUseHideMode = false,
|
|
1433
|
-
isShowHiddenValueAvailable = false
|
|
1434
|
-
}) => {
|
|
1435
|
-
const [isValueHidden, setIsValueHidden] = (0, import_react15.useState)(isUseHideMode);
|
|
1436
|
-
const computedValue = isFormatValueToDate ? (0, import_moment.default)(value, parseFormat).format(displayFormat) : value;
|
|
1437
|
-
const valueRef = (0, import_react15.useRef)(null);
|
|
1438
|
-
;
|
|
1439
|
-
const descriptionRef = (0, import_react15.useRef)(null);
|
|
1440
|
-
const [elemsWidth, setElemsWidth] = (0, import_react15.useState)({
|
|
1441
|
-
valueWidth: 0,
|
|
1442
|
-
descriptionWidth: 0
|
|
1443
|
-
});
|
|
1444
|
-
const [isOnClickON, setIsOnClickON] = (0, import_react15.useState)(false);
|
|
1445
|
-
const handle = {
|
|
1446
|
-
click: () => {
|
|
1447
|
-
setIsOnClickON(!isOnClickON);
|
|
1448
|
-
}
|
|
1449
|
-
};
|
|
1450
|
-
(0, import_react15.useEffect)(() => {
|
|
1451
|
-
const valueWidth = valueRef?.current?.clientWidth ?? 0;
|
|
1452
|
-
const descriptionWidth = descriptionRef?.current?.clientWidth ?? 0;
|
|
1453
|
-
setElemsWidth({ valueWidth, descriptionWidth });
|
|
1454
|
-
}, [descriptionRef, valueRef]);
|
|
1455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-testid": testId, className: (0, import_classnames15.default)(RC4, className), children: [
|
|
1456
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1457
|
-
"p",
|
|
1458
|
-
{
|
|
1459
|
-
onClick: () => handle.click(),
|
|
1460
|
-
ref: valueRef,
|
|
1461
|
-
className: (0, import_classnames15.default)(
|
|
1462
|
-
`${RC4}__value`,
|
|
1463
|
-
{
|
|
1464
|
-
"double-string--value-opened": isOnClickON && isUseOnClick
|
|
1465
|
-
},
|
|
1466
|
-
{ pointer: isUseOnClick }
|
|
1467
|
-
),
|
|
1468
|
-
title: !noTitle && elemsWidth.valueWidth > 99 ? computedValue : "",
|
|
1469
|
-
children: !revert ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1470
|
-
isUseHideMode ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: !isValueHidden ? computedValue : "*********" }) : computedValue,
|
|
1471
|
-
isUseHideMode && isShowHiddenValueAvailable && isValueHidden && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_feather7.Eye, { "data-testid": "double-string-eye", className: `${RC4}__hide-mode-icon`, onClick: () => setIsValueHidden(false) }),
|
|
1472
|
-
isUseHideMode && isShowHiddenValueAvailable && !isValueHidden && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_feather7.EyeOff, { "data-testid": "double-string-eyeoff", className: `${RC4}__hide-mode-icon`, onClick: () => setIsValueHidden(true) }),
|
|
1473
|
-
valuePostfix && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: (0, import_classnames15.default)(`${RC4}__value-postfix`), children: valuePostfix })
|
|
1474
|
-
] }) : description
|
|
1475
|
-
}
|
|
1476
|
-
),
|
|
1477
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1478
|
-
"p",
|
|
1479
|
-
{
|
|
1480
|
-
ref: descriptionRef,
|
|
1481
|
-
className: (0, import_classnames15.default)(`${RC4}__description`),
|
|
1482
|
-
title: !noTitle && elemsWidth.descriptionWidth > 99 ? computedValue : "",
|
|
1483
|
-
children: !revert ? description : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1484
|
-
computedValue,
|
|
1485
|
-
valuePostfix && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: (0, import_classnames15.default)(`${RC4}__value-postfix`), children: valuePostfix })
|
|
1486
|
-
] })
|
|
1487
|
-
}
|
|
1488
|
-
),
|
|
1489
|
-
subDescription && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: (0, import_classnames15.default)(`${RC4}__sub-description`), children: subDescription })
|
|
1490
|
-
] });
|
|
1491
|
-
};
|
|
1492
|
-
var DoubleString_default = DoubleString;
|
|
1493
|
-
|
|
1494
|
-
// src/Atomic/UI/DoubleString/index.ts
|
|
1495
|
-
var DoubleString_default2 = DoubleString_default;
|
|
1496
|
-
|
|
1497
|
-
// src/Atomic/UI/Hint/Hint.tsx
|
|
1498
|
-
var import_classnames16 = __toESM(require("classnames"), 1);
|
|
1499
|
-
var import_react16 = require("react");
|
|
1500
|
-
var import_react_dom2 = require("react-dom");
|
|
1501
|
-
var import_react_feather8 = require("react-feather");
|
|
1502
|
-
|
|
1503
|
-
// src/Molecular/CustomIcons/components/HelpCircleFilled.tsx
|
|
1504
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1505
|
-
function HelpCircleFilled(props) {
|
|
1506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1507
|
-
"svg",
|
|
1508
|
-
{
|
|
1509
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1510
|
-
width: 16,
|
|
1511
|
-
height: 16,
|
|
1512
|
-
fill: "none",
|
|
1513
|
-
...props,
|
|
1514
|
-
children: [
|
|
1515
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1516
|
-
"path",
|
|
1517
|
-
{
|
|
1518
|
-
fill: "#9AA0B9",
|
|
1519
|
-
d: "M8 14.667A6.667 6.667 0 1 0 8 1.333a6.667 6.667 0 0 0 0 13.334Z"
|
|
1520
|
-
}
|
|
1521
|
-
),
|
|
1522
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1523
|
-
"path",
|
|
1524
|
-
{
|
|
1525
|
-
stroke: "#fff",
|
|
1526
|
-
d: "M6.06 6a2 2 0 0 1 3.887.667c0 1.333-2 2-2 2M8 11.333h.006"
|
|
1527
|
-
}
|
|
1528
|
-
)
|
|
1529
|
-
]
|
|
1530
|
-
}
|
|
1531
|
-
);
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
// src/Atomic/UI/Hint/partials/_constants.ts
|
|
1535
|
-
var I_AM_OPENED_EVENT_NAME = "hint:i-am-open";
|
|
1536
|
-
var I_AM_OPENED_EVENT_OPTIONS = {
|
|
1537
|
-
bubbles: true,
|
|
1538
|
-
cancelable: true,
|
|
1539
|
-
composed: false
|
|
1540
|
-
};
|
|
1541
|
-
|
|
1542
|
-
// src/Atomic/UI/Hint/partials/_utils.ts
|
|
1543
|
-
var getHintContainerId = (hintId) => `hint-container-for-hint--id-${hintId}`;
|
|
1544
|
-
function getHintContainer(hintId) {
|
|
1545
|
-
return document.getElementById(getHintContainerId(hintId));
|
|
1546
|
-
}
|
|
1547
|
-
function getParentNode() {
|
|
1548
|
-
return document.querySelector("div#root") ?? document.querySelector("div#app") ?? document.body;
|
|
1549
|
-
}
|
|
1550
|
-
function initHintContainer(hintId, hintContainerSettings) {
|
|
1551
|
-
const { className } = hintContainerSettings;
|
|
1552
|
-
const hintContainer = document.createElement("div");
|
|
1553
|
-
hintContainer.setAttribute("id", getHintContainerId(hintId));
|
|
1554
|
-
hintContainer.classList.add("hint__container");
|
|
1555
|
-
if (className) hintContainer.classList.add(className);
|
|
1556
|
-
getParentNode()?.append(hintContainer);
|
|
1557
|
-
}
|
|
1558
|
-
function HandleScrollObj(setIsOpen) {
|
|
1559
|
-
this.setIsOpen = setIsOpen;
|
|
1560
|
-
this.handleEvent = function() {
|
|
1561
|
-
this.setIsOpen(false);
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
function HandleClickOutsideObj(id, setIsOpen) {
|
|
1565
|
-
this.id = id;
|
|
1566
|
-
this.setIsOpen = setIsOpen;
|
|
1567
|
-
this.handleEvent = function(event) {
|
|
1568
|
-
if (getHintContainer(this.id)) {
|
|
1569
|
-
if (!getHintContainer(this.id).contains(event?.target)) {
|
|
1570
|
-
this.setIsOpen(false);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
// src/Atomic/UI/Hint/Hint.tsx
|
|
1577
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1578
|
-
var hintTimeoutMap = /* @__PURE__ */ new Map();
|
|
1579
|
-
var isContentHoveredOuter = false;
|
|
1580
|
-
var DEFAULT_EMPTY_OBJ = {};
|
|
1581
|
-
function DEFAULT_VOID_FN() {
|
|
1582
|
-
}
|
|
1583
|
-
var Hint = ({
|
|
1584
|
-
hint,
|
|
1585
|
-
side = "right",
|
|
1586
|
-
className,
|
|
1587
|
-
hintContainer = DEFAULT_EMPTY_OBJ,
|
|
1588
|
-
label = "",
|
|
1589
|
-
variant = "filled",
|
|
1590
|
-
handleOpenType = "click",
|
|
1591
|
-
onClickCallback,
|
|
1592
|
-
onOpenChange = DEFAULT_VOID_FN,
|
|
1593
|
-
key,
|
|
1594
|
-
id,
|
|
1595
|
-
children,
|
|
1596
|
-
icon,
|
|
1597
|
-
isAccessability = false,
|
|
1598
|
-
testId = "hint",
|
|
1599
|
-
isHoverableContent = false,
|
|
1600
|
-
isLoading,
|
|
1601
|
-
isCloseOnChildrenClick = false
|
|
1602
|
-
}) => {
|
|
1603
|
-
const hintRef = (0, import_react16.useRef)(null);
|
|
1604
|
-
const [hintId] = (0, import_react16.useState)(id ?? key ?? Math.random().toString(16).slice(2));
|
|
1605
|
-
const [iAmOpenedOptions] = (0, import_react16.useState)({ ...I_AM_OPENED_EVENT_OPTIONS, detail: { hintId } });
|
|
1606
|
-
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
1607
|
-
const [isStyleComputed, setIsStyleComputed] = (0, import_react16.useState)(false);
|
|
1608
|
-
const [handleScroll] = (0, import_react16.useState)(new HandleScrollObj(setIsOpen));
|
|
1609
|
-
const [handleClickOutside] = (0, import_react16.useState)(new HandleClickOutsideObj(hintId, setIsOpen));
|
|
1610
|
-
const isCallbackExist = typeof onClickCallback === "function";
|
|
1611
|
-
const handle = {
|
|
1612
|
-
onMouseEnter: () => {
|
|
1613
|
-
const existing = hintTimeoutMap.get(hintId);
|
|
1614
|
-
if (existing) clearTimeout(existing);
|
|
1615
|
-
if (handleOpenType === "hover") {
|
|
1616
|
-
const timer = setTimeout(() => {
|
|
1617
|
-
setIsOpen(true);
|
|
1618
|
-
!isOpen && onClickCallback?.();
|
|
1619
|
-
hintRef.current?.dispatchEvent?.(new CustomEvent(I_AM_OPENED_EVENT_NAME, iAmOpenedOptions));
|
|
1620
|
-
}, 350);
|
|
1621
|
-
hintTimeoutMap.set(hintId, timer);
|
|
1622
|
-
}
|
|
1623
|
-
},
|
|
1624
|
-
onMouseLeave: () => {
|
|
1625
|
-
const existing = hintTimeoutMap.get(hintId);
|
|
1626
|
-
if (existing) clearTimeout(existing);
|
|
1627
|
-
if (!isHoverableContent && handleOpenType === "hover") {
|
|
1628
|
-
const timer = setTimeout(() => {
|
|
1629
|
-
setIsOpen(false);
|
|
1630
|
-
hintTimeoutMap.delete(hintId);
|
|
1631
|
-
}, 1e3);
|
|
1632
|
-
hintTimeoutMap.set(hintId, timer);
|
|
1633
|
-
} else if (isHoverableContent && handleOpenType === "hover") {
|
|
1634
|
-
const timer = setTimeout(() => {
|
|
1635
|
-
if (!isContentHoveredOuter) {
|
|
1636
|
-
setIsOpen(false);
|
|
1637
|
-
}
|
|
1638
|
-
hintTimeoutMap.delete(hintId);
|
|
1639
|
-
}, 100);
|
|
1640
|
-
hintTimeoutMap.set(hintId, timer);
|
|
1641
|
-
}
|
|
1642
|
-
},
|
|
1643
|
-
onMouseLeaveHoverableContent: () => {
|
|
1644
|
-
const existing = hintTimeoutMap.get(hintId);
|
|
1645
|
-
if (existing) clearTimeout(existing);
|
|
1646
|
-
if (isHoverableContent && handleOpenType === "hover") {
|
|
1647
|
-
const timer = setTimeout(() => {
|
|
1648
|
-
setIsOpen(false);
|
|
1649
|
-
isContentHoveredOuter = false;
|
|
1650
|
-
hintTimeoutMap.delete(hintId);
|
|
1651
|
-
}, 100);
|
|
1652
|
-
hintTimeoutMap.set(hintId, timer);
|
|
1653
|
-
}
|
|
1654
|
-
},
|
|
1655
|
-
onClick: isCloseOnChildrenClick ? () => setIsOpen(false) : () => {
|
|
1656
|
-
}
|
|
1657
|
-
};
|
|
1658
|
-
const getHintMarkUp = (className2) => {
|
|
1659
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1660
|
-
"div",
|
|
1661
|
-
{
|
|
1662
|
-
"data-testid": "test-hint-text",
|
|
1663
|
-
className: (0, import_classnames16.default)("hint__text", `hint__text_${side}`, `hint--${className2}__text`),
|
|
1664
|
-
onMouseEnter: () => {
|
|
1665
|
-
if (isHoverableContent) isContentHoveredOuter = true;
|
|
1666
|
-
},
|
|
1667
|
-
onMouseLeave: isHoverableContent ? handle.onMouseLeaveHoverableContent : void 0,
|
|
1668
|
-
onClick: handle.onClick,
|
|
1669
|
-
style: { visibility: isStyleComputed ? "visible" : "hidden" },
|
|
1670
|
-
children: [
|
|
1671
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Spinner_default, { size: "small" }),
|
|
1672
|
-
hint,
|
|
1673
|
-
children
|
|
1674
|
-
]
|
|
1675
|
-
}
|
|
1676
|
-
);
|
|
1677
|
-
};
|
|
1678
|
-
const setHintContainerStyles = () => {
|
|
1679
|
-
const hc = getHintContainer(hintId);
|
|
1680
|
-
if (!hc || !isOpen) return false;
|
|
1681
|
-
const { width = 0, top = 0, left = 0 } = hintRef?.current !== null ? hintRef?.current?.getBoundingClientRect() : {};
|
|
1682
|
-
const { addWidth, addLeft, addTop } = hintContainer ?? {};
|
|
1683
|
-
const windowInnerWidth = document.documentElement.clientWidth;
|
|
1684
|
-
const windowInnerHeight = document.documentElement.clientHeight;
|
|
1685
|
-
const sw = hc.getElementsByClassName("hint__text")[0];
|
|
1686
|
-
const { width: swWidth, height: swHeight } = sw?.getBoundingClientRect() || {};
|
|
1687
|
-
hc.style.width = isOpen ? ((addWidth && !Number.isNaN(+addWidth) ? +addWidth : 0) + width)?.toString().concat("px") : "0";
|
|
1688
|
-
hc.style.left = isOpen ? ((addLeft && !Number.isNaN(+addLeft) ? +addLeft : 0) + left)?.toString().concat("px") : "0";
|
|
1689
|
-
hc.style.top = isOpen ? ((addTop && !Number.isNaN(+addTop) ? +addTop : 0) + top)?.toString().concat("px") : "0";
|
|
1690
|
-
hc.style.maxHeight = isOpen ? swHeight?.toString().concat("px") : "0";
|
|
1691
|
-
const INACCURACY = 20;
|
|
1692
|
-
switch (side) {
|
|
1693
|
-
case "top":
|
|
1694
|
-
case "centeredTop":
|
|
1695
|
-
if (top - swHeight - INACCURACY / 2 < 0) {
|
|
1696
|
-
sw.classList.remove(`hint__text_${side}`);
|
|
1697
|
-
sw.classList.add(`hint__text_${side === "top" ? "bottom" : "centeredBottom"}`);
|
|
1698
|
-
}
|
|
1699
|
-
break;
|
|
1700
|
-
case "bottom":
|
|
1701
|
-
case "centeredBottom":
|
|
1702
|
-
if (top + swHeight + INACCURACY > windowInnerHeight) {
|
|
1703
|
-
sw.classList.remove(`hint__text_${side}`);
|
|
1704
|
-
sw.classList.add(`hint__text_${side === "bottom" ? "top" : "centeredTop"}`);
|
|
1705
|
-
}
|
|
1706
|
-
break;
|
|
1707
|
-
case "left":
|
|
1708
|
-
if (left - swWidth - INACCURACY / 2 < 0) {
|
|
1709
|
-
sw.classList.remove(`hint__text_${side}`);
|
|
1710
|
-
sw.classList.add("hint__text_right");
|
|
1711
|
-
}
|
|
1712
|
-
break;
|
|
1713
|
-
case "right":
|
|
1714
|
-
default:
|
|
1715
|
-
if (left + width + swWidth + INACCURACY / 2 > windowInnerWidth) {
|
|
1716
|
-
sw.classList.remove(`hint__text_${side}`);
|
|
1717
|
-
sw.classList.add("hint__text_left");
|
|
1718
|
-
}
|
|
1719
|
-
break;
|
|
1720
|
-
}
|
|
1721
|
-
setIsStyleComputed(true);
|
|
1722
|
-
};
|
|
1723
|
-
const renderHintContainer = (className2) => {
|
|
1724
|
-
const hc = getHintContainer(hintId);
|
|
1725
|
-
if (!hc) return null;
|
|
1726
|
-
return (0, import_react_dom2.createPortal)(getHintMarkUp(className2), hc);
|
|
1727
|
-
};
|
|
1728
|
-
(0, import_react16.useEffect)(() => {
|
|
1729
|
-
initHintContainer(hintId, hintContainer);
|
|
1730
|
-
const iAmOpenedCallback = (ev) => {
|
|
1731
|
-
const event = ev;
|
|
1732
|
-
if (event?.detail?.hintId !== hintId) {
|
|
1733
|
-
setIsOpen(false);
|
|
1734
|
-
const timer = hintTimeoutMap.get(hintId);
|
|
1735
|
-
if (timer) {
|
|
1736
|
-
clearTimeout(timer);
|
|
1737
|
-
hintTimeoutMap.delete(hintId);
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
return event;
|
|
1741
|
-
};
|
|
1742
|
-
if (hintRef.current) {
|
|
1743
|
-
document.addEventListener(I_AM_OPENED_EVENT_NAME, iAmOpenedCallback);
|
|
1744
|
-
}
|
|
1745
|
-
return () => {
|
|
1746
|
-
document.removeEventListener(I_AM_OPENED_EVENT_NAME, iAmOpenedCallback);
|
|
1747
|
-
const timer = hintTimeoutMap.get(hintId);
|
|
1748
|
-
if (timer) {
|
|
1749
|
-
clearTimeout(timer);
|
|
1750
|
-
hintTimeoutMap.delete(hintId);
|
|
1751
|
-
}
|
|
1752
|
-
};
|
|
1753
|
-
}, []);
|
|
1754
|
-
(0, import_react16.useEffect)(() => {
|
|
1755
|
-
setIsStyleComputed(false);
|
|
1756
|
-
setHintContainerStyles();
|
|
1757
|
-
onOpenChange?.(isOpen);
|
|
1758
|
-
if (isOpen) {
|
|
1759
|
-
document.addEventListener("scroll", handleScroll, true);
|
|
1760
|
-
document.addEventListener("click", handleClickOutside, true);
|
|
1761
|
-
} else {
|
|
1762
|
-
document.removeEventListener("scroll", handleScroll, true);
|
|
1763
|
-
document.removeEventListener("click", handleClickOutside, true);
|
|
1764
|
-
}
|
|
1765
|
-
return () => {
|
|
1766
|
-
const timer = hintTimeoutMap.get(hintId);
|
|
1767
|
-
if (timer) {
|
|
1768
|
-
clearTimeout(timer);
|
|
1769
|
-
hintTimeoutMap.delete(hintId);
|
|
1770
|
-
}
|
|
1771
|
-
};
|
|
1772
|
-
}, [isOpen]);
|
|
1773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { "data-testid": testId, className: (0, import_classnames16.default)("hint", className), ref: hintRef, children: [
|
|
1774
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1775
|
-
"button",
|
|
1776
|
-
{
|
|
1777
|
-
tabIndex: isAccessability ? 0 : -1,
|
|
1778
|
-
"data-testid": typeof label === "string" && label.length ? label.replace?.(/\s/g, "-") : `${testId}--button`,
|
|
1779
|
-
"aria-label": isAccessability && typeof label === "string" ? label : "",
|
|
1780
|
-
onClick: () => handleOpenType === "click" && (isCallbackExist ? onClickCallback?.() : setIsOpen(!isOpen)),
|
|
1781
|
-
onMouseEnter: handle.onMouseEnter,
|
|
1782
|
-
onMouseLeave: handle.onMouseLeave,
|
|
1783
|
-
className: (0, import_classnames16.default)("hint__button", { hint__button_active: isOpen }),
|
|
1784
|
-
children: [
|
|
1785
|
-
icon || icon === null || /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1786
|
-
variant === "outlined" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_feather8.HelpCircle, { width: 16, height: 16, className: "hint__icon outlined" }),
|
|
1787
|
-
variant === "filled" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(HelpCircleFilled, { className: "hint__icon filled" }),
|
|
1788
|
-
variant === "warning" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_feather8.AlertTriangle, { className: "hint__icon", color: "#F06D8D", width: 16, height: 16 })
|
|
1789
|
-
] }),
|
|
1790
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: (0, import_classnames16.default)("hint__label", { "color--primary": isOpen }), children: typeof label === "string" ? capitalized(label) : label })
|
|
1791
|
-
]
|
|
1792
|
-
}
|
|
1793
|
-
),
|
|
1794
|
-
isOpen && renderHintContainer(className)
|
|
1795
|
-
] });
|
|
1796
|
-
};
|
|
1797
|
-
var Hint_default = Hint;
|
|
1798
|
-
|
|
1799
|
-
// src/Atomic/UI/Hint/index.ts
|
|
1800
|
-
var Hint_default2 = Hint_default;
|
|
1801
|
-
|
|
1802
|
-
// src/Atomic/UI/Modal/Modal.tsx
|
|
1803
|
-
var import_classnames19 = __toESM(require("classnames"), 1);
|
|
1804
|
-
var import_react23 = require("react");
|
|
1805
|
-
|
|
1806
|
-
// src/Functions/useKeyPress/useHandleKeyPress.ts
|
|
1807
|
-
var import_react18 = require("react");
|
|
1808
|
-
|
|
1809
|
-
// src/Functions/useKeyPress/useKeyPress.ts
|
|
1810
|
-
var import_react17 = require("react");
|
|
1811
|
-
function isISuspendProcessing(x) {
|
|
1812
|
-
return getIsOnlyAnObject(x) && Object.values(x).every((v) => typeof v === "function");
|
|
1813
|
-
}
|
|
1814
|
-
function useKeyPress(targetKey, clamping = true, isForbidden, suspendProcessing) {
|
|
1815
|
-
const [keyPressed, setKeyPressed] = (0, import_react17.useState)(false);
|
|
1816
|
-
const safelySuspendProcessing = isISuspendProcessing(suspendProcessing) ? suspendProcessing : {};
|
|
1817
|
-
const downHandler = (0, import_react17.useCallback)(
|
|
1818
|
-
(event) => {
|
|
1819
|
-
const { key, repeat, altKey, ctrlKey, shiftKey, metaKey } = event;
|
|
1820
|
-
const isPressingWithoutAuxiliaryKeys = !altKey && !ctrlKey && !shiftKey && !metaKey;
|
|
1821
|
-
if (key === targetKey && isPressingWithoutAuxiliaryKeys && !safelySuspendProcessing[key]?.(event)) {
|
|
1822
|
-
if (!clamping && repeat) return;
|
|
1823
|
-
setKeyPressed(true);
|
|
1824
|
-
}
|
|
1825
|
-
},
|
|
1826
|
-
// ? Намерянно в зависимостях используем именно входной suspendProcessing,
|
|
1827
|
-
// ? хоть в коде используем "безопасный"
|
|
1828
|
-
[clamping, targetKey, suspendProcessing]
|
|
1829
|
-
);
|
|
1830
|
-
const upHandler = (0, import_react17.useCallback)(
|
|
1831
|
-
(event) => {
|
|
1832
|
-
const { key, repeat, altKey, ctrlKey, shiftKey, metaKey } = event;
|
|
1833
|
-
const isPressingWithoutAuxiliaryKeys = !altKey && !ctrlKey && !shiftKey && !metaKey;
|
|
1834
|
-
if (key === targetKey && isPressingWithoutAuxiliaryKeys && !safelySuspendProcessing[key]?.(event)) {
|
|
1835
|
-
if (!clamping && repeat) return;
|
|
1836
|
-
setKeyPressed(false);
|
|
1837
|
-
}
|
|
1838
|
-
},
|
|
1839
|
-
// ? Намерянно в зависимостях используем именно входной suspendProcessing,
|
|
1840
|
-
// ? хоть в коде используем "безопасный"
|
|
1841
|
-
[clamping, targetKey, suspendProcessing]
|
|
1842
|
-
);
|
|
1843
|
-
(0, import_react17.useEffect)(
|
|
1844
|
-
() => {
|
|
1845
|
-
const handleDown = (event) => downHandler(event);
|
|
1846
|
-
const handleUp = (event) => upHandler(event);
|
|
1847
|
-
if (!isForbidden) {
|
|
1848
|
-
window.addEventListener("keydown", handleDown);
|
|
1849
|
-
window.addEventListener("keyup", handleUp);
|
|
1850
|
-
}
|
|
1851
|
-
return () => {
|
|
1852
|
-
window.removeEventListener("keydown", handleDown);
|
|
1853
|
-
window.removeEventListener("keyup", handleUp);
|
|
1854
|
-
};
|
|
1855
|
-
},
|
|
1856
|
-
// ? Намерянно в зависимостях используем именно входной suspendProcessing,
|
|
1857
|
-
// ? хоть в коде используем "безопасный"
|
|
1858
|
-
[downHandler, upHandler, isForbidden, suspendProcessing]
|
|
1859
|
-
);
|
|
1860
|
-
return keyPressed;
|
|
1861
|
-
}
|
|
1862
|
-
var useKeyPress_default = useKeyPress;
|
|
1863
|
-
|
|
1864
|
-
// src/Functions/useKeyPress/useHandleKeyPress.ts
|
|
1865
|
-
function useHandleKeyPress({
|
|
1866
|
-
escCallback,
|
|
1867
|
-
enterCallback,
|
|
1868
|
-
withClamping = true,
|
|
1869
|
-
withEventManagementStructure,
|
|
1870
|
-
suspendProcessing = null
|
|
1871
|
-
}) {
|
|
1872
|
-
const { isWithSubmitAndCloseManagement } = withEventManagementStructure || {};
|
|
1873
|
-
const isPressEnter = useKeyPress_default("Enter", withClamping, isWithSubmitAndCloseManagement, suspendProcessing);
|
|
1874
|
-
const isPressEscape = useKeyPress_default("Escape", withClamping, isWithSubmitAndCloseManagement, suspendProcessing);
|
|
1875
|
-
(0, import_react18.useEffect)(() => {
|
|
1876
|
-
if (!isWithSubmitAndCloseManagement && isPressEscape && typeof escCallback === "function") {
|
|
1877
|
-
escCallback();
|
|
1878
|
-
}
|
|
1879
|
-
}, [isPressEscape, escCallback]);
|
|
1880
|
-
(0, import_react18.useEffect)(() => {
|
|
1881
|
-
if (!isWithSubmitAndCloseManagement && isPressEnter && typeof enterCallback === "function") {
|
|
1882
|
-
enterCallback();
|
|
1883
|
-
}
|
|
1884
|
-
}, [isPressEnter, enterCallback]);
|
|
1885
|
-
}
|
|
1886
|
-
var useHandleKeyPress_default = useHandleKeyPress;
|
|
1887
|
-
|
|
1888
|
-
// src/Atomic/UI/Modal/partials/_constants.ts
|
|
1889
|
-
var DEFAULT_EVENT_OPTIONS = Object.freeze({
|
|
1890
|
-
bubbles: true,
|
|
1891
|
-
cancelable: true,
|
|
1892
|
-
composed: false
|
|
1893
|
-
});
|
|
1894
|
-
var EVENTS = Object.freeze({
|
|
1895
|
-
["iGotAnEnterKeyPress" /* iGotAnEnterKeyPress */]: {
|
|
1896
|
-
innerKey: "iGotAnEnterKeyPress" /* iGotAnEnterKeyPress */,
|
|
1897
|
-
name: "modal:i-got-an-enter-key-press",
|
|
1898
|
-
shortName: "enterIsPressed",
|
|
1899
|
-
middlewareKey: "Enter",
|
|
1900
|
-
options: DEFAULT_EVENT_OPTIONS
|
|
1901
|
-
},
|
|
1902
|
-
["iGotAnEscKeyPress" /* iGotAnEscKeyPress */]: {
|
|
1903
|
-
innerKey: "iGotAnEscKeyPress" /* iGotAnEscKeyPress */,
|
|
1904
|
-
name: "modal:i-got-an-esc-key-press",
|
|
1905
|
-
shortName: "escIsPressed",
|
|
1906
|
-
middlewareKey: "Escape",
|
|
1907
|
-
options: DEFAULT_EVENT_OPTIONS
|
|
1908
|
-
}
|
|
1909
|
-
});
|
|
1910
|
-
|
|
1911
|
-
// src/Atomic/UI/Modal/partials/_utils.ts
|
|
1912
|
-
function getWithEventManagementStructure(modalId, withEventManagement) {
|
|
1913
|
-
const output = {
|
|
1914
|
-
isWithSubmitAndCloseManagement: false
|
|
1915
|
-
};
|
|
1916
|
-
for (const key in output) {
|
|
1917
|
-
if (!modalId) {
|
|
1918
|
-
output[key] = false;
|
|
1919
|
-
} else {
|
|
1920
|
-
output[key] = getIsOnlyAnObject(withEventManagement) ? withEventManagement[key] ?? false : !!withEventManagement;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
return output;
|
|
1924
|
-
}
|
|
1925
|
-
function getOnKeyPress({
|
|
1926
|
-
id: modalId,
|
|
1927
|
-
onSubmit,
|
|
1928
|
-
onClose,
|
|
1929
|
-
suspendProcessing
|
|
1930
|
-
}) {
|
|
1931
|
-
if (!modalId) return null;
|
|
1932
|
-
return function onKeyPress(ev) {
|
|
1933
|
-
const customEvent = ev;
|
|
1934
|
-
const { id: eventId, realEvent } = customEvent.detail || {};
|
|
1935
|
-
const constantInfoAboutCustomEvent = Object.values(EVENTS).find((ev2) => ev2.name === customEvent.type || ev2.shortName === customEvent.type) || {};
|
|
1936
|
-
const middlewareKey = constantInfoAboutCustomEvent.middlewareKey || "incorrectKey";
|
|
1937
|
-
const safelySuspendProcessing = isISuspendProcessing(suspendProcessing) ? suspendProcessing : {};
|
|
1938
|
-
if (modalId && eventId && eventId === modalId && !safelySuspendProcessing[middlewareKey]?.(realEvent)) {
|
|
1939
|
-
switch (customEvent.type) {
|
|
1940
|
-
case EVENTS.iGotAnEnterKeyPress.name: {
|
|
1941
|
-
onSubmit?.();
|
|
1942
|
-
break;
|
|
1943
|
-
}
|
|
1944
|
-
case EVENTS.iGotAnEscKeyPress.name: {
|
|
1945
|
-
onClose?.();
|
|
1946
|
-
break;
|
|
1947
|
-
}
|
|
1948
|
-
default: {
|
|
1949
|
-
break;
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
}
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
function dispatchEventForModalManagement(realEvent, nameOfCustomEvent, uniqueIdOfRecipient, target) {
|
|
1956
|
-
const { repeat, altKey, ctrlKey, shiftKey, metaKey } = realEvent;
|
|
1957
|
-
const isPressingWithoutAuxiliaryKeys = !altKey && !ctrlKey && !shiftKey && !metaKey;
|
|
1958
|
-
if (!repeat && isPressingWithoutAuxiliaryKeys) {
|
|
1959
|
-
const event = Object.values(EVENTS).find((ev) => ev.name === nameOfCustomEvent || ev.shortName === nameOfCustomEvent);
|
|
1960
|
-
if (event && uniqueIdOfRecipient) {
|
|
1961
|
-
(target ?? document).dispatchEvent(new CustomEvent(event.name, { ...event.options, detail: { id: uniqueIdOfRecipient, realEvent } }));
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
// src/Atomic/UI/Modal/partials/ModalFooter.tsx
|
|
1967
|
-
var import_classnames17 = __toESM(require("classnames"), 1);
|
|
1968
|
-
var import_react19 = require("react");
|
|
1969
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1970
|
-
var ModalFooter = (0, import_react19.memo)(
|
|
1971
|
-
({ className = "", children, wrapperRef, testId = "modal-footer" }) => {
|
|
1972
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1973
|
-
"footer",
|
|
1974
|
-
{
|
|
1975
|
-
"data-testid": testId,
|
|
1976
|
-
ref: wrapperRef,
|
|
1977
|
-
className: (0, import_classnames17.default)("modal__footer", className),
|
|
1978
|
-
role: "contentinfo",
|
|
1979
|
-
"aria-label": "Modal footer",
|
|
1980
|
-
children
|
|
1981
|
-
}
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
);
|
|
1985
|
-
ModalFooter.displayName = "ModalFooter";
|
|
1986
|
-
var ModalFooter_default = ModalFooter;
|
|
1987
|
-
|
|
1988
|
-
// src/Atomic/UI/Modal/partials/ModalTitle.tsx
|
|
1989
|
-
var import_classnames18 = __toESM(require("classnames"), 1);
|
|
1990
|
-
var import_react20 = require("react");
|
|
1991
|
-
var import_react_feather9 = require("react-feather");
|
|
1992
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1993
|
-
var ModalTitle = (0, import_react20.memo)(
|
|
1994
|
-
({
|
|
1995
|
-
variant = "primary",
|
|
1996
|
-
children,
|
|
1997
|
-
isForced = false,
|
|
1998
|
-
onClose,
|
|
1999
|
-
closeBtnDisable,
|
|
2000
|
-
noHeaderCloseBtn = false,
|
|
2001
|
-
className,
|
|
2002
|
-
wrapperRef,
|
|
2003
|
-
testId = "modal-title"
|
|
2004
|
-
}) => {
|
|
2005
|
-
const closeModalRef = (0, import_react20.useRef)(onClose);
|
|
2006
|
-
const handleClick = (0, import_react20.useMemo)(() => () => closeModalRef.current?.(), []);
|
|
2007
|
-
(0, import_react20.useLayoutEffect)(() => {
|
|
2008
|
-
closeModalRef.current = closeBtnDisable ? void 0 : onClose;
|
|
2009
|
-
}, [onClose, closeBtnDisable]);
|
|
2010
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2011
|
-
"header",
|
|
2012
|
-
{
|
|
2013
|
-
"data-testid": testId,
|
|
2014
|
-
ref: wrapperRef,
|
|
2015
|
-
className: (0, import_classnames18.default)("modal__header", className, {
|
|
2016
|
-
[`modal__header-${variant}`]: variant
|
|
2017
|
-
}),
|
|
2018
|
-
role: "banner",
|
|
2019
|
-
"aria-label": "Modal header",
|
|
2020
|
-
children: [
|
|
2021
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2022
|
-
"span",
|
|
2023
|
-
{
|
|
2024
|
-
className: (0, import_classnames18.default)("modal__header-title", {
|
|
2025
|
-
[`modal__header-${variant}-title`]: variant
|
|
2026
|
-
}),
|
|
2027
|
-
id: `${testId}-heading`,
|
|
2028
|
-
children
|
|
2029
|
-
}
|
|
2030
|
-
),
|
|
2031
|
-
!isForced && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2032
|
-
"button",
|
|
2033
|
-
{
|
|
2034
|
-
type: "button",
|
|
2035
|
-
onClick: handleClick,
|
|
2036
|
-
className: (0, import_classnames18.default)("modal-close-icon-box", {
|
|
2037
|
-
"modal-close-icon-box-primary": variant === "primary",
|
|
2038
|
-
"modal-close-icon-box--hidden": noHeaderCloseBtn
|
|
2039
|
-
}),
|
|
2040
|
-
"aria-label": "Close modal",
|
|
2041
|
-
title: "Close modal",
|
|
2042
|
-
children: !noHeaderCloseBtn && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_feather9.X, { className: "modal-close-icon", role: "img", "aria-hidden": "true" })
|
|
2043
|
-
}
|
|
2044
|
-
)
|
|
2045
|
-
]
|
|
2046
|
-
}
|
|
2047
|
-
);
|
|
2048
|
-
}
|
|
2049
|
-
);
|
|
2050
|
-
ModalTitle.displayName = "ModalTitle";
|
|
2051
|
-
var ModalTitle_default = ModalTitle;
|
|
2052
|
-
|
|
2053
|
-
// src/Atomic/UI/Modal/partials/useMobileModal.tsx
|
|
2054
|
-
var import_react22 = require("react");
|
|
2055
|
-
|
|
2056
|
-
// src/Functions/useIsMobile/useIsMobile.ts
|
|
2057
|
-
var import_react21 = require("react");
|
|
2058
|
-
function useIsMobile({ isWithoutWidthCheck = false } = {}) {
|
|
2059
|
-
const isIPad = () => {
|
|
2060
|
-
const ua = navigator.userAgent || navigator.vendor || window.opera;
|
|
2061
|
-
const isMac = /Macintosh/.test(ua);
|
|
2062
|
-
const hasTouch = navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
|
|
2063
|
-
return isMac && !!hasTouch;
|
|
2064
|
-
};
|
|
2065
|
-
const getIsMobile = () => {
|
|
2066
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || isIPad();
|
|
2067
|
-
};
|
|
2068
|
-
const [isMobile, setIsMobile] = (0, import_react21.useState)(getIsMobile());
|
|
2069
|
-
(0, import_react21.useEffect)(() => {
|
|
2070
|
-
if (getIsMobile()) {
|
|
2071
|
-
setIsMobile(true);
|
|
2072
|
-
}
|
|
2073
|
-
}, [navigator.userAgent]);
|
|
2074
|
-
return {
|
|
2075
|
-
isMobile: isMobile && (isWithoutWidthCheck || window.screen.width <= 768 || window.screen.width <= 1024 && window.matchMedia("(orientation: landscape)").matches),
|
|
2076
|
-
isMobilePortrait: isMobile && window.screen.width <= 768 && window.matchMedia("(orientation: portait)").matches,
|
|
2077
|
-
isMobileLandscape: isMobile && window.screen.width <= 1024 && window.matchMedia("(orientation: landscape)").matches
|
|
2078
|
-
};
|
|
2079
|
-
}
|
|
2080
|
-
var useIsMobile_default = useIsMobile;
|
|
2081
|
-
|
|
2082
|
-
// src/Atomic/UI/Modal/partials/useMobileModal.tsx
|
|
2083
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2084
|
-
var SCROLL_DIRECTION = {
|
|
2085
|
-
UP: "up",
|
|
2086
|
-
DOWN: "down"
|
|
2087
|
-
};
|
|
2088
|
-
function useMobileModal({
|
|
2089
|
-
modalRef,
|
|
2090
|
-
withMobileLogic = false,
|
|
2091
|
-
withFixedFooter = false,
|
|
2092
|
-
isOpen = false
|
|
2093
|
-
}) {
|
|
2094
|
-
const modalMobileContainerRef = (0, import_react22.useRef)(null);
|
|
2095
|
-
const modalMobileHeaderRef = (0, import_react22.useRef)(null);
|
|
2096
|
-
const modalMobileFooterRef = (0, import_react22.useRef)(null);
|
|
2097
|
-
const modalMobileBodyRef = (0, import_react22.useRef)(null);
|
|
2098
|
-
const { isMobile } = useIsMobile_default();
|
|
2099
|
-
const [modalHeight, setModalHeight] = (0, import_react22.useState)(0);
|
|
2100
|
-
const [modalsLogic, setModalsLogic] = (0, import_react22.useState)({
|
|
2101
|
-
IS_HEADER_HIDDEN: false,
|
|
2102
|
-
IS_HEADER_STICKY: false,
|
|
2103
|
-
IS_FOOTER_HIDDEN: false,
|
|
2104
|
-
IS_FOOTER_STICKY: withFixedFooter
|
|
2105
|
-
});
|
|
2106
|
-
const [modalsLogicProps, setModalsLogicProps] = (0, import_react22.useState)({
|
|
2107
|
-
headerHeight: 0,
|
|
2108
|
-
footerHeight: 0
|
|
2109
|
-
});
|
|
2110
|
-
const [scrollDirection, setScrollDirection] = (0, import_react22.useState)(SCROLL_DIRECTION.UP);
|
|
2111
|
-
const [scrollTopPrev, setScrollTopPrev] = (0, import_react22.useState)(0);
|
|
2112
|
-
const [scrollTop, setScrollTop] = (0, import_react22.useState)(0);
|
|
2113
|
-
const [scrollHeight, setScrollHeight] = (0, import_react22.useState)(1);
|
|
2114
|
-
const [, setContainerScrollHeight] = (0, import_react22.useState)(1);
|
|
2115
|
-
(0, import_react22.useLayoutEffect)(() => {
|
|
2116
|
-
const el = modalMobileContainerRef?.current;
|
|
2117
|
-
if (el) {
|
|
2118
|
-
el.addEventListener("scroll", () => {
|
|
2119
|
-
setScrollTop((scrollTop2) => {
|
|
2120
|
-
if (scrollTop2 !== el.scrollTop) setScrollTopPrev(scrollTop2);
|
|
2121
|
-
return el.scrollTop;
|
|
2122
|
-
});
|
|
2123
|
-
});
|
|
2124
|
-
}
|
|
2125
|
-
}, [modalMobileContainerRef?.current]);
|
|
2126
|
-
(0, import_react22.useEffect)(() => {
|
|
2127
|
-
setScrollDirection(
|
|
2128
|
-
(prevScrollDirection) => scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : scrollTop > scrollTopPrev ? SCROLL_DIRECTION.DOWN : prevScrollDirection
|
|
2129
|
-
);
|
|
2130
|
-
}, [scrollTop, scrollTopPrev]);
|
|
2131
|
-
(0, import_react22.useLayoutEffect)(() => {
|
|
2132
|
-
if (isOpen) {
|
|
2133
|
-
const modalStyle = modalRef?.current ? modalRef?.current.style || window.getComputedStyle(modalRef?.current) : {};
|
|
2134
|
-
const computedModalHeight = modalRef?.current ? modalHeight + Number.parseFloat(modalStyle?.marginTop || "0") : 0;
|
|
2135
|
-
const windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
|
|
2136
|
-
if (modalMobileContainerRef?.current) {
|
|
2137
|
-
if (computedModalHeight <= windowHeight) {
|
|
2138
|
-
modalMobileContainerRef.current.style.display = "flex";
|
|
2139
|
-
modalMobileContainerRef.current.style.alignItems = "flex-end";
|
|
2140
|
-
} else {
|
|
2141
|
-
modalMobileContainerRef.current?.style?.removeProperty("display");
|
|
2142
|
-
modalMobileContainerRef.current?.style?.removeProperty("align-items");
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
}, [modalsLogicProps, isOpen, isMobile, modalHeight]);
|
|
2147
|
-
(0, import_react22.useLayoutEffect)(() => {
|
|
2148
|
-
if (isMobile && isOpen) {
|
|
2149
|
-
const newModalHeight = modalRef?.current?.getBoundingClientRect()?.height;
|
|
2150
|
-
if (newModalHeight && modalHeight !== newModalHeight) {
|
|
2151
|
-
setModalHeight(newModalHeight);
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
(0, import_react22.useEffect)(() => {
|
|
2156
|
-
if (isMobile && withMobileLogic) {
|
|
2157
|
-
const { footerHeight, headerHeight } = modalsLogicProps;
|
|
2158
|
-
setModalsLogic((prevStickyLogic) => ({
|
|
2159
|
-
IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
|
|
2160
|
-
IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
|
|
2161
|
-
IS_FOOTER_HIDDEN: !withFixedFooter && (scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === Math.round(scrollTop)),
|
|
2162
|
-
IS_FOOTER_STICKY: withFixedFooter && scrollHeight > 1 || scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - Math.round(scrollTop) >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
|
|
2163
|
-
}));
|
|
2164
|
-
}
|
|
2165
|
-
}, [
|
|
2166
|
-
scrollTop,
|
|
2167
|
-
scrollHeight,
|
|
2168
|
-
isMobile,
|
|
2169
|
-
withMobileLogic,
|
|
2170
|
-
scrollDirection,
|
|
2171
|
-
modalsLogicProps,
|
|
2172
|
-
modalHeight,
|
|
2173
|
-
window.innerHeight
|
|
2174
|
-
]);
|
|
2175
|
-
(0, import_react22.useLayoutEffect)(() => {
|
|
2176
|
-
if (modalMobileHeaderRef?.current?.getBoundingClientRect()?.height !== void 0) {
|
|
2177
|
-
setModalsLogicProps((state) => ({
|
|
2178
|
-
...state,
|
|
2179
|
-
headerHeight: modalMobileHeaderRef?.current?.getBoundingClientRect()?.height ?? 0
|
|
2180
|
-
}));
|
|
2181
|
-
}
|
|
2182
|
-
}, [modalMobileHeaderRef?.current?.getBoundingClientRect()?.height]);
|
|
2183
|
-
(0, import_react22.useLayoutEffect)(() => {
|
|
2184
|
-
if (modalMobileFooterRef?.current?.getBoundingClientRect()?.height !== void 0) {
|
|
2185
|
-
setModalsLogicProps((state) => ({
|
|
2186
|
-
...state,
|
|
2187
|
-
footerHeight: modalMobileFooterRef?.current?.getBoundingClientRect()?.height ?? 0
|
|
2188
|
-
}));
|
|
2189
|
-
}
|
|
2190
|
-
}, [modalMobileFooterRef?.current?.getBoundingClientRect()?.height]);
|
|
2191
|
-
(0, import_react22.useEffect)(() => {
|
|
2192
|
-
if (modalMobileContainerRef?.current) {
|
|
2193
|
-
setContainerScrollHeight(modalMobileContainerRef?.current?.scrollHeight);
|
|
2194
|
-
setScrollHeight(
|
|
2195
|
-
modalMobileContainerRef?.current?.scrollHeight - window.innerHeight
|
|
2196
|
-
);
|
|
2197
|
-
}
|
|
2198
|
-
}, [scrollTop, modalMobileContainerRef?.current, window.innerHeight]);
|
|
2199
|
-
(0, import_react22.useEffect)(() => {
|
|
2200
|
-
window.addEventListener("resize", () => {
|
|
2201
|
-
setContainerScrollHeight((containerScrollHeight) => {
|
|
2202
|
-
setScrollHeight(containerScrollHeight - window.innerHeight);
|
|
2203
|
-
return containerScrollHeight;
|
|
2204
|
-
});
|
|
2205
|
-
});
|
|
2206
|
-
}, []);
|
|
2207
|
-
const renderModal = (0, import_react22.useCallback)(
|
|
2208
|
-
(modal) => {
|
|
2209
|
-
if (!isMobile || !withMobileLogic) return modal;
|
|
2210
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "modal-mobile-container", ref: modalMobileContainerRef, children: modal });
|
|
2211
|
-
},
|
|
2212
|
-
[isMobile, withMobileLogic]
|
|
2213
|
-
);
|
|
2214
|
-
return {
|
|
2215
|
-
modalMobileContainerRef,
|
|
2216
|
-
modalMobileHeaderRef,
|
|
2217
|
-
modalMobileBodyRef,
|
|
2218
|
-
modalMobileFooterRef,
|
|
2219
|
-
MODALS_LOGIC: modalsLogic,
|
|
2220
|
-
SCROLL_DIRECTION,
|
|
2221
|
-
scrollTop,
|
|
2222
|
-
scrollHeight,
|
|
2223
|
-
renderModal,
|
|
2224
|
-
isMobile
|
|
2225
|
-
};
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
// src/Atomic/UI/Modal/Modal.tsx
|
|
2229
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2230
|
-
var attrsForModalBodyDefault = {};
|
|
2231
|
-
var KEY_CODE = Object.freeze({
|
|
2232
|
-
ENTER: 13,
|
|
2233
|
-
ESC: 27
|
|
2234
|
-
});
|
|
2235
|
-
function renderModalTitle({
|
|
2236
|
-
mode,
|
|
2237
|
-
title,
|
|
2238
|
-
onlyTitle
|
|
2239
|
-
}) {
|
|
2240
|
-
if (mode && mode !== "default" && !onlyTitle) {
|
|
2241
|
-
return `${mode[0].toUpperCase()}${mode.slice(1)} ${title}`;
|
|
2242
|
-
}
|
|
2243
|
-
return title;
|
|
2244
|
-
}
|
|
2245
|
-
function Modal({
|
|
2246
|
-
ref,
|
|
2247
|
-
id,
|
|
2248
|
-
testId = "modal",
|
|
2249
|
-
zIndex = 100,
|
|
2250
|
-
isOpen,
|
|
2251
|
-
onConfirm,
|
|
2252
|
-
onDecline,
|
|
2253
|
-
closeModal,
|
|
2254
|
-
className,
|
|
2255
|
-
variant = "primary",
|
|
2256
|
-
size,
|
|
2257
|
-
mode,
|
|
2258
|
-
title,
|
|
2259
|
-
onlyTitle,
|
|
2260
|
-
atributesForModalBody = attrsForModalBodyDefault,
|
|
2261
|
-
confirmBtnClassName,
|
|
2262
|
-
confirmBtnLabel,
|
|
2263
|
-
confirmBtnVariant = "primary",
|
|
2264
|
-
confirmBtnDisable,
|
|
2265
|
-
confirmBtnIcon,
|
|
2266
|
-
isConfirmBtnIconPositionRight,
|
|
2267
|
-
noConfirmBtn,
|
|
2268
|
-
forced,
|
|
2269
|
-
closeBtnClassName,
|
|
2270
|
-
closeBtnText,
|
|
2271
|
-
closeBtnVariant,
|
|
2272
|
-
closeBtnDisable,
|
|
2273
|
-
closeBtnIcon,
|
|
2274
|
-
btnClassNames,
|
|
2275
|
-
isCloseBtnIconPositionRight,
|
|
2276
|
-
noCloseBtn,
|
|
2277
|
-
noHeader,
|
|
2278
|
-
noHeaderCloseBtn,
|
|
2279
|
-
customHeader,
|
|
2280
|
-
declineBtnDisable,
|
|
2281
|
-
noFooter,
|
|
2282
|
-
customFooter,
|
|
2283
|
-
withFixedFooter,
|
|
2284
|
-
leftContentOfFooter,
|
|
2285
|
-
isSubmittingByEnter: isSubmittingByEnterOuter = true,
|
|
2286
|
-
isClosingByEsc: isClosingByEscOuter = true,
|
|
2287
|
-
withEventManagement = false,
|
|
2288
|
-
submitOnEnter,
|
|
2289
|
-
closeOnEsc,
|
|
2290
|
-
withMobileLogic,
|
|
2291
|
-
children
|
|
2292
|
-
}) {
|
|
2293
|
-
const internalRef = (0, import_react23.useRef)(null);
|
|
2294
|
-
const modalRef = ref || internalRef;
|
|
2295
|
-
const onConfirmRef = (0, import_react23.useRef)(onConfirm);
|
|
2296
|
-
const closeModalRef = (0, import_react23.useRef)(closeModal);
|
|
2297
|
-
const onDeclineRef = (0, import_react23.useRef)(onDecline);
|
|
2298
|
-
const isSubmittingByEnter = submitOnEnter === false ? false : isSubmittingByEnterOuter;
|
|
2299
|
-
const isClosingByEsc = closeOnEsc === false ? false : isClosingByEscOuter;
|
|
2300
|
-
const withEventManagementStructure = getWithEventManagementStructure(id, withEventManagement);
|
|
2301
|
-
const isUseAutoBlockingForHandlers = withEventManagementStructure.isWithSubmitAndCloseManagement;
|
|
2302
|
-
const isOnConfirmBlocked = typeof onConfirm === "function" && isUseAutoBlockingForHandlers && confirmBtnDisable;
|
|
2303
|
-
const isCloseModalBlocked = typeof closeModal === "function" && isUseAutoBlockingForHandlers && closeBtnDisable;
|
|
2304
|
-
const isOnDeclineBlocked = typeof onDecline === "function" && isUseAutoBlockingForHandlers && declineBtnDisable;
|
|
2305
|
-
const {
|
|
2306
|
-
modalMobileHeaderRef,
|
|
2307
|
-
modalMobileBodyRef,
|
|
2308
|
-
modalMobileFooterRef,
|
|
2309
|
-
MODALS_LOGIC,
|
|
2310
|
-
renderModal,
|
|
2311
|
-
isMobile,
|
|
2312
|
-
scrollTop,
|
|
2313
|
-
scrollHeight
|
|
2314
|
-
} = useMobileModal({
|
|
2315
|
-
withMobileLogic,
|
|
2316
|
-
withFixedFooter,
|
|
2317
|
-
isOpen
|
|
2318
|
-
});
|
|
2319
|
-
const handle = (0, import_react23.useMemo)(() => ({
|
|
2320
|
-
confirm: () => onConfirmRef.current?.(),
|
|
2321
|
-
close: () => closeModalRef.current?.(),
|
|
2322
|
-
decline: () => {
|
|
2323
|
-
if (typeof onDeclineRef.current === "function") onDeclineRef.current();
|
|
2324
|
-
else closeModalRef.current?.();
|
|
2325
|
-
}
|
|
2326
|
-
}), []);
|
|
2327
|
-
const suspendProcessing = {
|
|
2328
|
-
// FIN-12482
|
|
2329
|
-
// ? Чтобы НЕ замыкать рефку на модалку в логике, чтобы потом поискать в контенте все текстэриа,
|
|
2330
|
-
// ? чтобы оценить есть ли среди них сфокусированная - делаем элеГАнтно:
|
|
2331
|
-
// ? оцениваем ev.target, и если target это текстэриа, то вот сейчас то она и сфокусирована,
|
|
2332
|
-
// ? т.е нужно приостановить процессы связанные с нажатием enter.
|
|
2333
|
-
Enter: (ev) => ev?.target?.nodeName === "TEXTAREA"
|
|
2334
|
-
// ? Колбеки опциональны, можно передавать только нужные
|
|
2335
|
-
// Escape: (ev: globalThis.KeyboardEvent) => false,
|
|
2336
|
-
};
|
|
2337
|
-
useHandleKeyPress_default({
|
|
2338
|
-
enterCallback: isSubmittingByEnter && typeof onConfirm === "function" && !confirmBtnDisable ? handle.confirm : void 0,
|
|
2339
|
-
escCallback: isClosingByEsc && typeof closeModal === "function" ? handle.close : void 0,
|
|
2340
|
-
withClamping: false,
|
|
2341
|
-
withEventManagementStructure: {
|
|
2342
|
-
isWithSubmitAndCloseManagement: confirmBtnDisable || withEventManagementStructure.isWithSubmitAndCloseManagement
|
|
2343
|
-
},
|
|
2344
|
-
suspendProcessing
|
|
2345
|
-
});
|
|
2346
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
2347
|
-
onConfirmRef.current = isOnConfirmBlocked ? void 0 : onConfirm;
|
|
2348
|
-
}, [onConfirm, isOnConfirmBlocked]);
|
|
2349
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
2350
|
-
closeModalRef.current = isCloseModalBlocked ? void 0 : closeModal;
|
|
2351
|
-
}, [closeModal, isCloseModalBlocked]);
|
|
2352
|
-
(0, import_react23.useLayoutEffect)(() => {
|
|
2353
|
-
onDeclineRef.current = isOnDeclineBlocked ? () => {
|
|
2354
|
-
} : onDecline;
|
|
2355
|
-
}, [onDecline, isOnDeclineBlocked]);
|
|
2356
|
-
(0, import_react23.useEffect)(() => {
|
|
2357
|
-
const outerTarget = getIsOnlyAnObject(withEventManagement) ? withEventManagement.listenersTarget : void 0;
|
|
2358
|
-
const target = outerTarget ?? document;
|
|
2359
|
-
const onKeyPress = getOnKeyPress({ id, onSubmit: handle.confirm, onClose: handle.close, suspendProcessing });
|
|
2360
|
-
if (withEventManagementStructure.isWithSubmitAndCloseManagement && !!onKeyPress) {
|
|
2361
|
-
if (isSubmittingByEnter) target.addEventListener(EVENTS.iGotAnEnterKeyPress.name, onKeyPress);
|
|
2362
|
-
if (isClosingByEsc) target.addEventListener(EVENTS.iGotAnEscKeyPress.name, onKeyPress);
|
|
2363
|
-
}
|
|
2364
|
-
return () => {
|
|
2365
|
-
if (withEventManagementStructure.isWithSubmitAndCloseManagement && !!onKeyPress) {
|
|
2366
|
-
if (isSubmittingByEnter) target.removeEventListener(EVENTS.iGotAnEnterKeyPress.name, onKeyPress);
|
|
2367
|
-
if (isClosingByEsc) target.removeEventListener(EVENTS.iGotAnEscKeyPress.name, onKeyPress);
|
|
2368
|
-
}
|
|
2369
|
-
};
|
|
2370
|
-
}, []);
|
|
2371
|
-
if (!isOpen) return null;
|
|
2372
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2373
|
-
"div",
|
|
2374
|
-
{
|
|
2375
|
-
id: `${id}`,
|
|
2376
|
-
style: { zIndex },
|
|
2377
|
-
"data-testid": testId,
|
|
2378
|
-
className: "modal-box j5",
|
|
2379
|
-
role: "dialog",
|
|
2380
|
-
"aria-modal": "true",
|
|
2381
|
-
"aria-labelledby": `${testId}-title`,
|
|
2382
|
-
children: renderModal(
|
|
2383
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2384
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2385
|
-
"div",
|
|
2386
|
-
{
|
|
2387
|
-
"data-testid": `${testId}-overlay`,
|
|
2388
|
-
className: isOpen ? "modal-overlay" : "hidden",
|
|
2389
|
-
onClick: handle.close,
|
|
2390
|
-
role: "presentation"
|
|
2391
|
-
}
|
|
2392
|
-
),
|
|
2393
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2394
|
-
"div",
|
|
2395
|
-
{
|
|
2396
|
-
ref: modalRef,
|
|
2397
|
-
style: { width: typeof size === "number" ? `${size}px` : `${size?.replace("px", "")}px` },
|
|
2398
|
-
className: (0, import_classnames19.default)(className, {
|
|
2399
|
-
"modal": isOpen,
|
|
2400
|
-
"modal--no-header": isOpen && noHeader && !customHeader,
|
|
2401
|
-
"modal-mobile": isOpen && isMobile,
|
|
2402
|
-
"hidden": !isOpen
|
|
2403
|
-
}),
|
|
2404
|
-
children: [
|
|
2405
|
-
customHeader || !noHeader && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2406
|
-
ModalTitle_default,
|
|
2407
|
-
{
|
|
2408
|
-
wrapperRef: modalMobileHeaderRef,
|
|
2409
|
-
className: (0, import_classnames19.default)({
|
|
2410
|
-
"modal__header--hidden": MODALS_LOGIC.IS_HEADER_HIDDEN,
|
|
2411
|
-
"modal__header--sticky": !MODALS_LOGIC.IS_HEADER_HIDDEN && MODALS_LOGIC.IS_HEADER_STICKY
|
|
2412
|
-
}),
|
|
2413
|
-
variant,
|
|
2414
|
-
isForced: forced,
|
|
2415
|
-
onClose: handle.close,
|
|
2416
|
-
noHeaderCloseBtn,
|
|
2417
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { id: `${testId}-title`, children: renderModalTitle({ mode, title, onlyTitle }) })
|
|
2418
|
-
}
|
|
2419
|
-
),
|
|
2420
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2421
|
-
"div",
|
|
2422
|
-
{
|
|
2423
|
-
...atributesForModalBody,
|
|
2424
|
-
ref: modalMobileBodyRef,
|
|
2425
|
-
className: (0, import_classnames19.default)("modal__body", {
|
|
2426
|
-
"modal__body--no-footer": noFooter
|
|
2427
|
-
}),
|
|
2428
|
-
role: "document",
|
|
2429
|
-
children
|
|
2430
|
-
}
|
|
2431
|
-
),
|
|
2432
|
-
(!noFooter || customFooter) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2433
|
-
ModalFooter_default,
|
|
2434
|
-
{
|
|
2435
|
-
wrapperRef: modalMobileFooterRef,
|
|
2436
|
-
className: (0, import_classnames19.default)({
|
|
2437
|
-
"modal__footer--hidden": MODALS_LOGIC.IS_FOOTER_HIDDEN,
|
|
2438
|
-
"modal__footer--sticky": !MODALS_LOGIC.IS_FOOTER_HIDDEN && MODALS_LOGIC.IS_FOOTER_STICKY && scrollTop !== scrollHeight,
|
|
2439
|
-
"modal__footer_with-left-content": leftContentOfFooter
|
|
2440
|
-
}),
|
|
2441
|
-
children: customFooter || /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2442
|
-
leftContentOfFooter,
|
|
2443
|
-
(!noCloseBtn || !noConfirmBtn) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "modal__buttons-block", children: [
|
|
2444
|
-
!noCloseBtn && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2445
|
-
Button_default,
|
|
2446
|
-
{
|
|
2447
|
-
testId: "modal",
|
|
2448
|
-
className: (0, import_classnames19.default)(closeBtnClassName, btnClassNames),
|
|
2449
|
-
variant: closeBtnVariant || "dark-outline",
|
|
2450
|
-
onClick: handle.decline,
|
|
2451
|
-
label: closeBtnText || "Cancel",
|
|
2452
|
-
disabled: typeof onDecline === "function" ? declineBtnDisable : closeBtnDisable,
|
|
2453
|
-
icon: closeBtnIcon,
|
|
2454
|
-
isIconRight: isCloseBtnIconPositionRight,
|
|
2455
|
-
tabIndex: 1,
|
|
2456
|
-
"aria-label": "Close modal"
|
|
2457
|
-
}
|
|
2458
|
-
),
|
|
2459
|
-
!noConfirmBtn && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2460
|
-
Button_default,
|
|
2461
|
-
{
|
|
2462
|
-
testId: "modal",
|
|
2463
|
-
onClick: handle.confirm,
|
|
2464
|
-
label: confirmBtnLabel || mode && mode?.[0].toUpperCase() + mode?.slice(1) || "Apply",
|
|
2465
|
-
className: (0, import_classnames19.default)("ml5", confirmBtnClassName, btnClassNames),
|
|
2466
|
-
variant: confirmBtnVariant,
|
|
2467
|
-
disabled: confirmBtnDisable,
|
|
2468
|
-
icon: confirmBtnIcon,
|
|
2469
|
-
isIconRight: isConfirmBtnIconPositionRight,
|
|
2470
|
-
"aria-label": "Confirm modal"
|
|
2471
|
-
}
|
|
2472
|
-
)
|
|
2473
|
-
] })
|
|
2474
|
-
] })
|
|
2475
|
-
}
|
|
2476
|
-
)
|
|
2477
|
-
]
|
|
2478
|
-
}
|
|
2479
|
-
)
|
|
2480
|
-
] })
|
|
2481
|
-
)
|
|
2482
|
-
}
|
|
2483
|
-
);
|
|
2484
|
-
}
|
|
2485
|
-
Modal.displayName = "Modal";
|
|
2486
|
-
var Modal_default = Modal;
|
|
2487
|
-
|
|
2488
|
-
// src/Atomic/UI/Modal/ModalHOC.tsx
|
|
2489
|
-
var import_classnames20 = __toESM(require("classnames"), 1);
|
|
2490
|
-
var import_react24 = require("react");
|
|
2491
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2492
|
-
var ModalHOC = ({
|
|
2493
|
-
id,
|
|
2494
|
-
zIndex = 100,
|
|
2495
|
-
isOpen,
|
|
2496
|
-
closeModal,
|
|
2497
|
-
closeBtnDisable,
|
|
2498
|
-
children,
|
|
2499
|
-
className,
|
|
2500
|
-
size,
|
|
2501
|
-
testId = "modal",
|
|
2502
|
-
withEventManagement = false,
|
|
2503
|
-
// ! Полностью проигнорируется если в модалку НЕ прокинут id
|
|
2504
|
-
// ? isClosingByEsc является явным разрешением/запретом на работу ф-ла,
|
|
2505
|
-
// ? в то время как withEventManagement лишь настройка способа реализации этого ф-ла
|
|
2506
|
-
isClosingByEsc: isClosingByEscOuter = true,
|
|
2507
|
-
closeOnEsc
|
|
2508
|
-
}) => {
|
|
2509
|
-
const modalRef = (0, import_react24.useRef)(null);
|
|
2510
|
-
const closeModalRef = (0, import_react24.useRef)(closeModal);
|
|
2511
|
-
const isClosingByEsc = closeOnEsc === false ? false : isClosingByEscOuter;
|
|
2512
|
-
const withEventManagementStructure = getWithEventManagementStructure(id, withEventManagement);
|
|
2513
|
-
const handleClose = (0, import_react24.useMemo)(() => () => closeModalRef.current?.(), []);
|
|
2514
|
-
useHandleKeyPress_default({
|
|
2515
|
-
escCallback: isClosingByEsc && typeof closeModal === "function" ? handleClose : void 0,
|
|
2516
|
-
withEventManagementStructure
|
|
2517
|
-
});
|
|
2518
|
-
(0, import_react24.useLayoutEffect)(() => {
|
|
2519
|
-
closeModalRef.current = closeBtnDisable ? void 0 : closeModal;
|
|
2520
|
-
}, [closeModal, closeBtnDisable]);
|
|
2521
|
-
(0, import_react24.useEffect)(() => {
|
|
2522
|
-
const onKeyPress = getOnKeyPress({ id, onClose: handleClose });
|
|
2523
|
-
if (withEventManagementStructure.isWithSubmitAndCloseManagement && !!onKeyPress) {
|
|
2524
|
-
if (isClosingByEsc) document.addEventListener(EVENTS.iGotAnEscKeyPress.name, onKeyPress);
|
|
2525
|
-
}
|
|
2526
|
-
return () => {
|
|
2527
|
-
if (withEventManagementStructure.isWithSubmitAndCloseManagement && !!onKeyPress) {
|
|
2528
|
-
if (isClosingByEsc) document.removeEventListener(EVENTS.iGotAnEscKeyPress.name, onKeyPress);
|
|
2529
|
-
}
|
|
2530
|
-
};
|
|
2531
|
-
}, []);
|
|
2532
|
-
if (!isOpen) return null;
|
|
2533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { id: `${id}`, style: { zIndex }, "data-testid": testId, className: "modal-box j5", role: "presentation", children: [
|
|
2534
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "modal-overlay", onClick: handleClose, role: "presentation", "aria-hidden": "true" }),
|
|
2535
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2536
|
-
"div",
|
|
2537
|
-
{
|
|
2538
|
-
ref: modalRef,
|
|
2539
|
-
style: { width: size },
|
|
2540
|
-
className: (0, import_classnames20.default)(className, "modal"),
|
|
2541
|
-
role: "dialog",
|
|
2542
|
-
"aria-modal": "true",
|
|
2543
|
-
"aria-labelledby": testId,
|
|
2544
|
-
tabIndex: -1,
|
|
2545
|
-
children
|
|
2546
|
-
}
|
|
2547
|
-
)
|
|
2548
|
-
] });
|
|
2549
|
-
};
|
|
2550
|
-
var ModalHOC_default = ModalHOC;
|
|
2551
|
-
|
|
2552
|
-
// src/Atomic/UI/Modal/index.ts
|
|
2553
|
-
var Modal_default2 = Modal_default;
|
|
2554
|
-
|
|
2555
|
-
// src/Atomic/UI/MonoAccordion/index.ts
|
|
2556
|
-
var MonoAccordion_default2 = MonoAccordion_default;
|
|
2557
|
-
|
|
2558
|
-
// src/Atomic/UI/PageTitle/PageTitle.tsx
|
|
2559
|
-
var import_classnames21 = __toESM(require("classnames"), 1);
|
|
2560
|
-
var import_react_feather10 = require("react-feather");
|
|
2561
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2562
|
-
var RC5 = "page-title";
|
|
2563
|
-
var PageTitle = ({ title, pages, children, testId = RC5 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { "data-testid": testId, className: RC5, role: "region", "aria-label": title, children: [
|
|
2564
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `${RC5}__wrap`, children: [
|
|
2565
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { className: `${RC5}__title`, children: title }),
|
|
2566
|
-
pages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { className: `${RC5}__pages`, "aria-label": "Breadcrumb", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("ol", { className: `${RC5}__list`, children: [
|
|
2567
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { className: `${RC5}__link`, href: "/", "aria-label": "Home page", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_feather10.Home, { "aria-hidden": "true" }) }) }),
|
|
2568
|
-
pages.map(({ name, path }, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { children: [
|
|
2569
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: `${RC5}__delimiter`, "aria-hidden": "true", children: "/" }),
|
|
2570
|
-
pages.length - 1 === index ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: (0, import_classnames21.default)(`${RC5}__link`, `${RC5}__link_last`), "aria-current": "page", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { className: `${RC5}__link`, href: path, children: name })
|
|
2571
|
-
] }, path))
|
|
2572
|
-
] }) })
|
|
2573
|
-
] }),
|
|
2574
|
-
children
|
|
2575
|
-
] });
|
|
2576
|
-
var PageTitle_default = PageTitle;
|
|
2577
|
-
|
|
2578
|
-
// src/Atomic/UI/PageTitle/index.ts
|
|
2579
|
-
var PageTitle_default2 = PageTitle_default;
|
|
2580
|
-
|
|
2581
|
-
// src/Atomic/UI/Price/Price.tsx
|
|
2582
|
-
var import_classnames22 = __toESM(require("classnames"), 1);
|
|
2583
|
-
|
|
2584
|
-
// src/Functions/fieldValueFormatters.js
|
|
2585
|
-
var getSafelyValue = (value) => value !== void 0 && value !== null ? value?.toString?.() || "" : "";
|
|
2586
|
-
var intlNumbersFormatter = (inputValue, settings = {}) => {
|
|
2587
|
-
const safelyInputValue = getSafelyValue(inputValue);
|
|
2588
|
-
const previousValue = safelyInputValue.slice(0, -1);
|
|
2589
|
-
const lastSym = safelyInputValue.slice(-1);
|
|
2590
|
-
const value = lastSym === "." ? previousValue : safelyInputValue;
|
|
2591
|
-
if (Number.isNaN(Number(value)) || !getSafelyValue(value)) return "";
|
|
2592
|
-
const {
|
|
2593
|
-
// локаль, даже региональная, влияет на отображение знаков и формата.
|
|
2594
|
-
locale = "en-US",
|
|
2595
|
-
// percent || currency(default case) || decimal(просто число) влияет на ТИП обработки.
|
|
2596
|
-
withSymbol,
|
|
2597
|
-
//группировка запятыми поразрядно.
|
|
2598
|
-
useGrouping = true,
|
|
2599
|
-
//!!работает только при withSymbol: 'currency' !! влияет на то, как именно будет выглядет формат валюты.
|
|
2600
|
-
currency = {},
|
|
2601
|
-
//сколько знаков после точки, и всегда ли они будут.
|
|
2602
|
-
// !!если поставить isAlwaysRender: true, но не дать центов, то будет 100.00
|
|
2603
|
-
fractionDigits = {}
|
|
2604
|
-
} = settings;
|
|
2605
|
-
const { currencyType = "USD", currencyDisplay: inputCurrencyDisplay } = currency;
|
|
2606
|
-
let currencyDisplay;
|
|
2607
|
-
switch (inputCurrencyDisplay) {
|
|
2608
|
-
case "name":
|
|
2609
|
-
currencyDisplay = "name";
|
|
2610
|
-
break;
|
|
2611
|
-
case "code":
|
|
2612
|
-
currencyDisplay = "code";
|
|
2613
|
-
break;
|
|
2614
|
-
case "narrowSymbol":
|
|
2615
|
-
currencyDisplay = "narrowSymbol";
|
|
2616
|
-
break;
|
|
2617
|
-
default:
|
|
2618
|
-
currencyDisplay = "symbol";
|
|
2619
|
-
}
|
|
2620
|
-
let numberStyle;
|
|
2621
|
-
switch (withSymbol) {
|
|
2622
|
-
case "percent":
|
|
2623
|
-
numberStyle = "percent";
|
|
2624
|
-
break;
|
|
2625
|
-
case "currency":
|
|
2626
|
-
numberStyle = "currency";
|
|
2627
|
-
break;
|
|
2628
|
-
default:
|
|
2629
|
-
numberStyle = "decimal";
|
|
2630
|
-
break;
|
|
2631
|
-
}
|
|
2632
|
-
const {
|
|
2633
|
-
quantity,
|
|
2634
|
-
isRenderAlways = false,
|
|
2635
|
-
minimumFractionDigits: inputMinimumFractionDigits,
|
|
2636
|
-
maximumFractionDigits: inputMaximumFractionDigits,
|
|
2637
|
-
conditionallyMinimumFractionDigits
|
|
2638
|
-
} = fractionDigits;
|
|
2639
|
-
const dotIndex = safelyInputValue?.indexOf(".");
|
|
2640
|
-
const afterDot = dotIndex !== -1 ? safelyInputValue.slice(dotIndex + 1) : "";
|
|
2641
|
-
const minimumFractionDigits = (() => {
|
|
2642
|
-
if (typeof inputMinimumFractionDigits === "number")
|
|
2643
|
-
return inputMinimumFractionDigits;
|
|
2644
|
-
if (typeof conditionallyMinimumFractionDigits === "number") {
|
|
2645
|
-
return afterDot && lastSym !== "." ? conditionallyMinimumFractionDigits : 0;
|
|
2646
|
-
}
|
|
2647
|
-
return afterDot && lastSym !== "." ? safelyInputValue.slice(dotIndex).length - 1 : isRenderAlways ? quantity : 0;
|
|
2648
|
-
})();
|
|
2649
|
-
const priceSettings = {
|
|
2650
|
-
useGrouping,
|
|
2651
|
-
//группировка разрядов
|
|
2652
|
-
style: numberStyle,
|
|
2653
|
-
//тип форматирования (валюта или число). decimal - без знака валюты
|
|
2654
|
-
currency: currencyType,
|
|
2655
|
-
//валюта
|
|
2656
|
-
currencyDisplay,
|
|
2657
|
-
//валюта в виде символа
|
|
2658
|
-
//минимально не надо отображать центы, если их нет, иначе всегда будет .00
|
|
2659
|
-
minimumFractionDigits,
|
|
2660
|
-
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
2661
|
-
//! чем указано в (inputMaximumFractionDigits ?? quantity) - округлит по правилам округления
|
|
2662
|
-
//максимально отображать 2 цифры после запятой, если центы всё же есть
|
|
2663
|
-
maximumFractionDigits: inputMaximumFractionDigits ?? quantity
|
|
2664
|
-
};
|
|
2665
|
-
let output;
|
|
2666
|
-
try {
|
|
2667
|
-
output = new Intl.NumberFormat(locale, priceSettings).format(value);
|
|
2668
|
-
} catch (e) {
|
|
2669
|
-
output = value;
|
|
2670
|
-
console.warn("Intl.NumberFormat error", e);
|
|
2671
|
-
}
|
|
2672
|
-
return lastSym === "." ? output + lastSym : output;
|
|
2673
|
-
};
|
|
2674
|
-
var formatToPriceWithUSD = (value) => {
|
|
2675
|
-
if (isNaN(Number(value))) return value;
|
|
2676
|
-
return intlNumbersFormatter(getSafelyValue(value), {
|
|
2677
|
-
withSymbol: "currency",
|
|
2678
|
-
currency: { currencyType: "USD" },
|
|
2679
|
-
fractionDigits: { quantity: 2, conditionallyMinimumFractionDigits: 2 }
|
|
2680
|
-
});
|
|
2681
|
-
};
|
|
2682
|
-
var formatToPriceWithCurrency = (value, currencyCode, symbolPosition = "before") => {
|
|
2683
|
-
if (isNaN(Number(value))) return value;
|
|
2684
|
-
return intlNumbersFormatter(getSafelyValue(value), {
|
|
2685
|
-
withSymbol: "currency",
|
|
2686
|
-
currency: { currencyType: currencyCode },
|
|
2687
|
-
fractionDigits: { quantity: 2, conditionallyMinimumFractionDigits: 2 }
|
|
2688
|
-
});
|
|
2689
|
-
};
|
|
2690
|
-
|
|
2691
|
-
// src/Atomic/UI/Price/Price.tsx
|
|
2692
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2693
|
-
var CN3 = "price";
|
|
2694
|
-
var Price = ({ value, currencyCode, isSymbolAfter, className, testId = CN3 }) => {
|
|
2695
|
-
if (value === void 0 || value === null) return null;
|
|
2696
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2697
|
-
"div",
|
|
2698
|
-
{
|
|
2699
|
-
"data-testid": testId,
|
|
2700
|
-
className: (0, import_classnames22.default)(CN3, className),
|
|
2701
|
-
role: "contentinfo",
|
|
2702
|
-
"aria-label": `Price: ${formatToPriceWithCurrency(value, currencyCode, isSymbolAfter ? "after" : "before")}`,
|
|
2703
|
-
children: formatToPriceWithCurrency(value, currencyCode, isSymbolAfter ? "after" : "before")
|
|
2704
|
-
}
|
|
2705
|
-
);
|
|
2706
|
-
};
|
|
2707
|
-
var Price_default = Price;
|
|
2708
|
-
|
|
2709
|
-
// src/Atomic/UI/Price/index.ts
|
|
2710
|
-
var Price_default2 = Price_default;
|
|
2711
|
-
|
|
2712
|
-
// src/Atomic/UI/PriceRange/PriceRange.tsx
|
|
2713
|
-
var import_classnames23 = __toESM(require("classnames"), 1);
|
|
2714
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2715
|
-
var CN4 = "price-range";
|
|
2716
|
-
var PriceRange = ({ from, to, mode, testId = CN4 }) => {
|
|
2717
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { "data-testid": testId, className: (0, import_classnames23.default)(CN4, "j4"), role: "region", "aria-label": "Price range", children: mode === "simple" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { "aria-live": "polite", children: [
|
|
2718
|
-
from,
|
|
2719
|
-
" - ",
|
|
2720
|
-
to
|
|
2721
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { "aria-live": "polite", children: [
|
|
2722
|
-
formatToPriceWithUSD(from?.toString()),
|
|
2723
|
-
" - ",
|
|
2724
|
-
formatToPriceWithUSD(to?.toString())
|
|
2725
|
-
] }) });
|
|
2726
|
-
};
|
|
2727
|
-
var PriceRange_default = PriceRange;
|
|
2728
|
-
|
|
2729
|
-
// src/Atomic/UI/PriceRange/index.ts
|
|
2730
|
-
var PriceRange_default2 = PriceRange_default;
|
|
2731
|
-
|
|
2732
|
-
// src/Atomic/UI/ProgressLine/ProgressLine.tsx
|
|
2733
|
-
var import_classnames24 = __toESM(require("classnames"), 1);
|
|
2734
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2735
|
-
var CN5 = "progress-line";
|
|
2736
|
-
var ProgressLine = ({
|
|
2737
|
-
label = "",
|
|
2738
|
-
labelAlign = "left",
|
|
2739
|
-
renderValue = false,
|
|
2740
|
-
renderValueInPercents = false,
|
|
2741
|
-
valueMeasurement = "",
|
|
2742
|
-
valueHorizontalPosition = "right",
|
|
2743
|
-
valueVerticalPosition = "center",
|
|
2744
|
-
symbolsAfterComma = 0,
|
|
2745
|
-
minValue = 0,
|
|
2746
|
-
maxValue = 100,
|
|
2747
|
-
value = 0,
|
|
2748
|
-
showExtremums = false,
|
|
2749
|
-
extremumsPosition = "top",
|
|
2750
|
-
variant = "info",
|
|
2751
|
-
useVariantLabelColor = true,
|
|
2752
|
-
isShowLine = true,
|
|
2753
|
-
className,
|
|
2754
|
-
testId = CN5
|
|
2755
|
-
}) => {
|
|
2756
|
-
const getFilledLineWidth = () => {
|
|
2757
|
-
if (value > maxValue) value = maxValue;
|
|
2758
|
-
return `${((value - minValue) * 100 / (maxValue - minValue)).toFixed(symbolsAfterComma)}%`;
|
|
2759
|
-
};
|
|
2760
|
-
const renderLabel = () => {
|
|
2761
|
-
if (!label) return null;
|
|
2762
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `progress-line__wrapper__label align-${labelAlign}`, children: label });
|
|
2763
|
-
};
|
|
2764
|
-
const renderProgressValue = () => {
|
|
2765
|
-
if (!renderValue) return null;
|
|
2766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "progress-line__wrapper__value", "aria-live": "polite", children: renderValueInPercents ? getFilledLineWidth() : `${addBitDepthPoints(String(value))} ${valueMeasurement}` });
|
|
2767
|
-
};
|
|
2768
|
-
const renderExtremums = () => {
|
|
2769
|
-
if (!showExtremums) return null;
|
|
2770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { "aria-hidden": "true", className: `progress-line__wrapper__extremums position-${extremumsPosition}`, children: [
|
|
2771
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "progress-line__wrapper__extremums--min", children: renderValueInPercents ? "0 %" : `${minValue} ${valueMeasurement}` }),
|
|
2772
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "progress-line__wrapper__extremums--max", children: renderValueInPercents ? "100 %" : `${maxValue} ${valueMeasurement}` })
|
|
2773
|
-
] });
|
|
2774
|
-
};
|
|
2775
|
-
const renderFilledLine = () => {
|
|
2776
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2777
|
-
"div",
|
|
2778
|
-
{
|
|
2779
|
-
className: "progress-line__wrapper__line--filled",
|
|
2780
|
-
role: "progressbar",
|
|
2781
|
-
"aria-label": `Progress: ${value} out of ${maxValue}`,
|
|
2782
|
-
"aria-valuenow": value,
|
|
2783
|
-
"aria-valuemin": minValue,
|
|
2784
|
-
"aria-valuemax": maxValue,
|
|
2785
|
-
style: { width: getFilledLineWidth() }
|
|
2786
|
-
}
|
|
2787
|
-
);
|
|
2788
|
-
};
|
|
2789
|
-
const renderLine = () => {
|
|
2790
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "progress-line__wrapper__line", children: [
|
|
2791
|
-
renderExtremums(),
|
|
2792
|
-
renderFilledLine()
|
|
2793
|
-
] });
|
|
2794
|
-
};
|
|
2795
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: (0, import_classnames24.default)(CN5, className), "data-testid": testId, role: "region", "aria-label": "Progress line", children: [
|
|
2796
|
-
renderLabel(),
|
|
2797
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2798
|
-
"div",
|
|
2799
|
-
{
|
|
2800
|
-
className: `progress-line__wrapper variant-${useVariantLabelColor && variant} value-${valueVerticalPosition}-${valueHorizontalPosition} ${className}`,
|
|
2801
|
-
children: [
|
|
2802
|
-
renderProgressValue(),
|
|
2803
|
-
isShowLine && renderLine()
|
|
2804
|
-
]
|
|
2805
|
-
}
|
|
2806
|
-
)
|
|
2807
|
-
] });
|
|
2808
|
-
};
|
|
2809
|
-
var ProgressLine_default = ProgressLine;
|
|
2810
|
-
|
|
2811
|
-
// src/Atomic/UI/ProgressLine/index.ts
|
|
2812
|
-
var ProgressLine_default2 = ProgressLine_default;
|
|
2813
|
-
|
|
2814
|
-
// src/Atomic/UI/Status/Status.tsx
|
|
2815
|
-
var import_classnames25 = __toESM(require("classnames"), 1);
|
|
2816
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2817
|
-
function defaultOnClick2() {
|
|
2818
|
-
}
|
|
2819
|
-
var Status = ({
|
|
2820
|
-
icon,
|
|
2821
|
-
value,
|
|
2822
|
-
label,
|
|
2823
|
-
status,
|
|
2824
|
-
disabled,
|
|
2825
|
-
type,
|
|
2826
|
-
active = 0,
|
|
2827
|
-
pause = 0,
|
|
2828
|
-
className,
|
|
2829
|
-
noBackground,
|
|
2830
|
-
children,
|
|
2831
|
-
testId = "status",
|
|
2832
|
-
onClick = defaultOnClick2
|
|
2833
|
-
}) => {
|
|
2834
|
-
if (!status) return null;
|
|
2835
|
-
const text = children && typeof children === "string" ? children : value || label || status;
|
|
2836
|
-
const formattedLabel = text?.[0].toUpperCase() + text?.slice(1);
|
|
2837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { onClick, "data-testid": testId, className: (0, import_classnames25.default)({ disabled }, className), children: type === "number" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: active === 0 && pause === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "status status--error", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: active }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "status status--warning", children: [
|
|
2838
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "status--number-active", children: active }),
|
|
2839
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "color--gray-gull", children: " / " }),
|
|
2840
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: pause > 0 ? "color--froly" : "color--gray-gull", children: pause })
|
|
2841
|
-
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2842
|
-
"div",
|
|
2843
|
-
{
|
|
2844
|
-
className: (0, import_classnames25.default)(
|
|
2845
|
-
"status",
|
|
2846
|
-
`status--${status}`,
|
|
2847
|
-
{
|
|
2848
|
-
"status--no-bg": noBackground && status === "pause",
|
|
2849
|
-
"color--gray-gull": noBackground && status === "pause" && !className,
|
|
2850
|
-
"j4": !!icon
|
|
2851
|
-
},
|
|
2852
|
-
className
|
|
2853
|
-
),
|
|
2854
|
-
children: [
|
|
2855
|
-
icon,
|
|
2856
|
-
formattedLabel
|
|
2857
|
-
]
|
|
2858
|
-
}
|
|
2859
|
-
) });
|
|
2860
|
-
};
|
|
2861
|
-
var Status_default = Status;
|
|
2862
|
-
|
|
2863
|
-
// src/Atomic/UI/Status/index.ts
|
|
2864
|
-
var Status_default2 = Status_default;
|
|
2865
|
-
|
|
2866
|
-
// src/Atomic/UI/Table/Table.js
|
|
2867
|
-
var import_react32 = __toESM(require("react"), 1);
|
|
2868
|
-
var import_classnames32 = __toESM(require("classnames"), 1);
|
|
2869
|
-
|
|
2870
|
-
// src/Atomic/UI/Table/Partials/TdHeader.js
|
|
2871
|
-
var import_react25 = __toESM(require("react"), 1);
|
|
2872
|
-
var import_classnames26 = __toESM(require("classnames"), 1);
|
|
2873
|
-
|
|
2874
|
-
// src/Langs.js
|
|
2875
|
-
var Langs = {
|
|
2876
|
-
en: {
|
|
2877
|
-
auth: {},
|
|
2878
|
-
settings: {},
|
|
2879
|
-
labels: {
|
|
2880
|
-
industries: "Industries",
|
|
2881
|
-
includedLenders: "Included Lenders",
|
|
2882
|
-
admin: "Administrator",
|
|
2883
|
-
user: "User",
|
|
2884
|
-
help: "Help",
|
|
2885
|
-
description: "Description",
|
|
2886
|
-
value: "Value",
|
|
2887
|
-
paramName: "Parameter name(key)",
|
|
2888
|
-
active: "Active",
|
|
2889
|
-
pause: "Pause",
|
|
2890
|
-
error: "Error",
|
|
2891
|
-
sold: "Sold",
|
|
2892
|
-
processing: "Processing",
|
|
2893
|
-
home: "Home",
|
|
2894
|
-
goods: "Goods",
|
|
2895
|
-
improvement: "Improvement",
|
|
2896
|
-
jewelry: "Jewelry",
|
|
2897
|
-
firstName: "First Name",
|
|
2898
|
-
lastName: "Last Name",
|
|
2899
|
-
dateOfBirth: "Date of Birth",
|
|
2900
|
-
militaryStatus: "Military status",
|
|
2901
|
-
ssn: "SSN",
|
|
2902
|
-
lengthAtAddress: "Length At Address",
|
|
2903
|
-
rentOrOwn: "Rent or Own",
|
|
2904
|
-
zip: "ZIP",
|
|
2905
|
-
city: "City",
|
|
2906
|
-
state: "State",
|
|
2907
|
-
address: "Address",
|
|
2908
|
-
email: "E-mail",
|
|
2909
|
-
homePhone: "Home Phone",
|
|
2910
|
-
cellPhone: "Cell Phone",
|
|
2911
|
-
contactTime: "Contact Time",
|
|
2912
|
-
dlState: "DL state",
|
|
2913
|
-
dlNumber: "DL number",
|
|
2914
|
-
ownCar: "Do you own a car?",
|
|
2915
|
-
tcpaOptin: "TCPA OPTIN",
|
|
2916
|
-
incomeSource: "Income Source",
|
|
2917
|
-
timeEmployed: "Time Employed",
|
|
2918
|
-
jobTitle: "Job Title",
|
|
2919
|
-
currentEmployer: "Current Employer",
|
|
2920
|
-
employersPhone: "Employer's Phone",
|
|
2921
|
-
netMonthlyIncome: "Net monthly income",
|
|
2922
|
-
howOftenIsPaid: "How often is paid",
|
|
2923
|
-
nextPayDate: "Next Pay Date",
|
|
2924
|
-
secondPayDate: "Second Pay Date",
|
|
2925
|
-
loanAmount: "Loan amount",
|
|
2926
|
-
ip: "IP",
|
|
2927
|
-
storyName: "Story name",
|
|
2928
|
-
channelName: "Channel name",
|
|
2929
|
-
employmentInfo: "Employment Information",
|
|
2930
|
-
personalDetails: "Personal Details",
|
|
2931
|
-
offer: "Offer",
|
|
2932
|
-
offers: "Offers",
|
|
2933
|
-
status: "Status",
|
|
2934
|
-
name: "Name",
|
|
2935
|
-
from: "From",
|
|
2936
|
-
to: "to",
|
|
2937
|
-
periodMonths: "Period (months)",
|
|
2938
|
-
loansSent: "Loans Sent",
|
|
2939
|
-
approved: "Approved",
|
|
2940
|
-
rejected: "Rejected",
|
|
2941
|
-
loanAmountApproved: "Loan Amount Approved ($)",
|
|
2942
|
-
loanAmountRejected: "Loan Amount Rejected ($)",
|
|
2943
|
-
approveRate: "Approve Rate (%)",
|
|
2944
|
-
actions: "Actions",
|
|
2945
|
-
locations: "Locations",
|
|
2946
|
-
score: "Score",
|
|
2947
|
-
priority: "Priority",
|
|
2948
|
-
lender: "Lender",
|
|
2949
|
-
weight: "Weight",
|
|
2950
|
-
selectLender: "Select lender"
|
|
2951
|
-
},
|
|
2952
|
-
singulars: {},
|
|
2953
|
-
titles: {
|
|
2954
|
-
pingTree: "Ping tree",
|
|
2955
|
-
edit: "Edit",
|
|
2956
|
-
create: "Create",
|
|
2957
|
-
add: "Add",
|
|
2958
|
-
consumerInfo: "Consumer info",
|
|
2959
|
-
personalDetails: "Personal Details",
|
|
2960
|
-
employmentInfo: "Employment Information",
|
|
2961
|
-
tools: "Tools",
|
|
2962
|
-
lenders: "Lenders",
|
|
2963
|
-
settings: "Settings",
|
|
2964
|
-
dashboard: "Dashboard",
|
|
2965
|
-
consumers: "Consumers",
|
|
2966
|
-
ticketDesk: "Ticket desk",
|
|
2967
|
-
accounting: "Accounting",
|
|
2968
|
-
users: "Users",
|
|
2969
|
-
merchants: "Merchants",
|
|
2970
|
-
lenderPingTree: "Lender Ping Tree",
|
|
2971
|
-
reports: "Reports",
|
|
2972
|
-
leads: "Leads",
|
|
2973
|
-
location: "Location",
|
|
2974
|
-
mainMenu: "Main menu",
|
|
2975
|
-
partners: "Partners",
|
|
2976
|
-
other: "Other",
|
|
2977
|
-
homeGoodsAndInteriorDesign: "Home Goods and Interior Design"
|
|
2978
|
-
},
|
|
2979
|
-
placeholders: {
|
|
2980
|
-
typeName: "Type name",
|
|
2981
|
-
params: "Params placeholder",
|
|
2982
|
-
value: "Value placeholder",
|
|
2983
|
-
description: "Description placeholder"
|
|
2984
|
-
},
|
|
2985
|
-
hints: {
|
|
2986
|
-
landerNotIncluded: "Lender is not included in Ping Tree by the \u201CHome Goods\u201D industry",
|
|
2987
|
-
noMerchants: "No Merchants for the \u201CHome Goods\u201D industry"
|
|
2988
|
-
},
|
|
2989
|
-
buttons: {
|
|
2990
|
-
create: "Create",
|
|
2991
|
-
edit: "Edit",
|
|
2992
|
-
add: "Add",
|
|
2993
|
-
close: "Close",
|
|
2994
|
-
apply: "Apply",
|
|
2995
|
-
pingTree: "Ping tree",
|
|
2996
|
-
addRow: "Add row",
|
|
2997
|
-
consumerInfo: "Consumer Info",
|
|
2998
|
-
deletePingTree: "Delete Ping Tree",
|
|
2999
|
-
cancel: "Cancel"
|
|
3000
|
-
},
|
|
3001
|
-
radioButtons: {},
|
|
3002
|
-
weekDays: {
|
|
3003
|
-
su: "Su",
|
|
3004
|
-
mo: "Mo",
|
|
3005
|
-
tu: "Tu",
|
|
3006
|
-
we: "We",
|
|
3007
|
-
th: "Th",
|
|
3008
|
-
fr: "Fr",
|
|
3009
|
-
sa: "Sa"
|
|
3010
|
-
},
|
|
3011
|
-
alerts: {
|
|
3012
|
-
lendersWillBeRemoved: "lenders will be removed"
|
|
3013
|
-
},
|
|
3014
|
-
checkboxes: {
|
|
3015
|
-
homeGoods: "Home Goods",
|
|
3016
|
-
travel: "Travel",
|
|
3017
|
-
energyImprovement: "Energy Improvement",
|
|
3018
|
-
jewelryIncluded: "Jewelry (included in PingTree name 2)",
|
|
3019
|
-
jewelry: "Jewelry",
|
|
3020
|
-
autoRepair: "Auto Repair",
|
|
3021
|
-
cosmetics: "Cosmetics",
|
|
3022
|
-
health: "Health"
|
|
3023
|
-
},
|
|
3024
|
-
errors: {},
|
|
3025
|
-
texts: {},
|
|
3026
|
-
tabs: {
|
|
3027
|
-
general: "General",
|
|
3028
|
-
payments: "Payments",
|
|
3029
|
-
filters: "Filters",
|
|
3030
|
-
offers: "Offers",
|
|
3031
|
-
merchants: "Merchants",
|
|
3032
|
-
integration: "Integration",
|
|
3033
|
-
customDetails: "Custom details",
|
|
3034
|
-
customerDetails: "Customer details",
|
|
3035
|
-
postsLog: "Posts log"
|
|
3036
|
-
},
|
|
3037
|
-
toasts: {}
|
|
3038
|
-
}
|
|
3039
|
-
};
|
|
3040
|
-
var Langs_default = Langs;
|
|
3041
|
-
|
|
3042
|
-
// src/Atomic/UI/Table/Partials/TdHeader.js
|
|
3043
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3044
|
-
var TdHeader = ({ item, testId = "td-header" }) => {
|
|
3045
|
-
const txt = Langs_default[global.lng];
|
|
3046
|
-
switch (item.type) {
|
|
3047
|
-
case "double":
|
|
3048
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("th", { "data-testid": testId, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "j46", children: [
|
|
3049
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "", children: txt.labels[item.left] || item.left }),
|
|
3050
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "", children: txt.labels[item.right] || item.right })
|
|
3051
|
-
] }) });
|
|
3052
|
-
default:
|
|
3053
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("th", { "data-testid": testId, className: (0, import_classnames26.default)(item.className), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: (0, import_classnames26.default)({ df: item.button }), children: [
|
|
3054
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "mr5", children: txt.labels[item.label] || item.label }),
|
|
3055
|
-
item.button && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "cards-table__btn", children: txt.buttons[item.button] || item.button })
|
|
3056
|
-
] }) });
|
|
3057
|
-
}
|
|
3058
|
-
};
|
|
3059
|
-
var TdHeader_default = TdHeader;
|
|
3060
|
-
|
|
3061
|
-
// src/Atomic/UI/Table/Partials/TdRow.js
|
|
3062
|
-
var import_react31 = __toESM(require("react"), 1);
|
|
3063
|
-
var import_classnames31 = __toESM(require("classnames"), 1);
|
|
3064
|
-
|
|
3065
|
-
// src/Atomic/UI/Table/TdTypes/TdRange.js
|
|
3066
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3067
|
-
var TdRange = ({ item }) => {
|
|
3068
|
-
if (!item) return false;
|
|
3069
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
3070
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: item.from }),
|
|
3071
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: " - " }),
|
|
3072
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: item.to })
|
|
3073
|
-
] });
|
|
3074
|
-
};
|
|
3075
|
-
var TdRange_default = TdRange;
|
|
3076
|
-
|
|
3077
|
-
// src/Atomic/UI/Table/Partials/TdCell.js
|
|
3078
|
-
var import_react30 = __toESM(require("react"), 1);
|
|
3079
|
-
|
|
3080
|
-
// src/Atomic/UI/Accordion/AccordionItem.tsx
|
|
3081
|
-
var import_classnames27 = __toESM(require("classnames"), 1);
|
|
3082
|
-
var import_react26 = require("react");
|
|
3083
|
-
var Icons = __toESM(require("react-feather"), 1);
|
|
3084
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3085
|
-
var DefaultLink = ({ to, className, children }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("a", { href: to, className, children });
|
|
3086
|
-
var AccordionItem = ({
|
|
3087
|
-
item,
|
|
3088
|
-
onClick,
|
|
3089
|
-
isOpen,
|
|
3090
|
-
className,
|
|
3091
|
-
children,
|
|
3092
|
-
noChevron,
|
|
3093
|
-
linkComponent: LinkComponent = DefaultLink,
|
|
3094
|
-
testId = "accordion-item"
|
|
3095
|
-
}) => {
|
|
3096
|
-
const Icon = Icons[item.icon];
|
|
3097
|
-
const [maxHeight, setMaxHeight] = (0, import_react26.useState)(0);
|
|
3098
|
-
const ref = (0, import_react26.useRef)(null);
|
|
3099
|
-
const getItemsHeight = () => {
|
|
3100
|
-
let itemHeight = 0;
|
|
3101
|
-
ref.current?.childNodes.forEach((el) => {
|
|
3102
|
-
itemHeight += el.offsetHeight;
|
|
3103
|
-
});
|
|
3104
|
-
return itemHeight + 20;
|
|
3105
|
-
};
|
|
3106
|
-
(0, import_react26.useEffect)(() => {
|
|
3107
|
-
setMaxHeight(isOpen ? getItemsHeight() : 0);
|
|
3108
|
-
}, [isOpen]);
|
|
3109
|
-
const calculateStatusCount = () => {
|
|
3110
|
-
return item?.rows?.reduce(
|
|
3111
|
-
(acc, row) => {
|
|
3112
|
-
const result = row.cols.reduce(
|
|
3113
|
-
(accum, col) => ({
|
|
3114
|
-
active: accum.active + (col.status === "active" ? 1 : 0),
|
|
3115
|
-
pause: accum.pause + (col.status === "pause" ? 1 : 0)
|
|
3116
|
-
}),
|
|
3117
|
-
{ active: 0, pause: 0 }
|
|
3118
|
-
);
|
|
3119
|
-
return {
|
|
3120
|
-
active: acc.active + result.active,
|
|
3121
|
-
pause: acc.pause + result.pause
|
|
3122
|
-
};
|
|
3123
|
-
},
|
|
3124
|
-
{ active: 0, pause: 0 }
|
|
3125
|
-
);
|
|
3126
|
-
};
|
|
3127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3128
|
-
"div",
|
|
3129
|
-
{
|
|
3130
|
-
"data-testid": testId,
|
|
3131
|
-
className: (0, import_classnames27.default)("accordion--item", className),
|
|
3132
|
-
role: "region",
|
|
3133
|
-
"aria-labelledby": `accordion-title-${item.title}`,
|
|
3134
|
-
children: [
|
|
3135
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3136
|
-
"div",
|
|
3137
|
-
{
|
|
3138
|
-
className: (0, import_classnames27.default)("accordion--title-box", {
|
|
3139
|
-
"accordion--title-open": isOpen
|
|
3140
|
-
}),
|
|
3141
|
-
onClick: () => onClick(!isOpen),
|
|
3142
|
-
id: `accordion-title-${item.title}`,
|
|
3143
|
-
role: "button",
|
|
3144
|
-
"aria-expanded": isOpen,
|
|
3145
|
-
"aria-controls": `accordion-content-${item.title}`,
|
|
3146
|
-
tabIndex: 0,
|
|
3147
|
-
children: [
|
|
3148
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "j4 no-wrap", children: [
|
|
3149
|
-
item?.icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { className: (0, import_classnames27.default)("mr5", item?.className), "aria-hidden": "true" }),
|
|
3150
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "accordion--title", children: item.title || "Menu Chapter" })
|
|
3151
|
-
] }),
|
|
3152
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "j6 accordion-title__right-box", children: [
|
|
3153
|
-
item.status && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mr5", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3154
|
-
Status_default2,
|
|
3155
|
-
{
|
|
3156
|
-
type: item?.status.type,
|
|
3157
|
-
value: item?.status.value,
|
|
3158
|
-
status: item?.status.status,
|
|
3159
|
-
active: calculateStatusCount()?.active,
|
|
3160
|
-
pause: calculateStatusCount()?.pause
|
|
3161
|
-
}
|
|
3162
|
-
) }),
|
|
3163
|
-
!noChevron && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3164
|
-
Icons.ChevronRight,
|
|
3165
|
-
{
|
|
3166
|
-
"aria-hidden": "true",
|
|
3167
|
-
className: (0, import_classnames27.default)("accordion--title-chevron", {
|
|
3168
|
-
"accordion--title-chevron-open": isOpen
|
|
3169
|
-
})
|
|
3170
|
-
}
|
|
3171
|
-
)
|
|
3172
|
-
] })
|
|
3173
|
-
]
|
|
3174
|
-
}
|
|
3175
|
-
),
|
|
3176
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3177
|
-
"div",
|
|
3178
|
-
{
|
|
3179
|
-
ref,
|
|
3180
|
-
style: { maxHeight },
|
|
3181
|
-
className: (0, import_classnames27.default)("accordion--content", {
|
|
3182
|
-
"accordion--content-is-open": isOpen
|
|
3183
|
-
}),
|
|
3184
|
-
id: `accordion-content-${item.title}`,
|
|
3185
|
-
role: "region",
|
|
3186
|
-
"aria-labelledby": `accordion-title-${item.title}`,
|
|
3187
|
-
children: item.children ? item.children.map((el) => {
|
|
3188
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LinkComponent, { to: el.link, className: "accordion--content-item accordion--menu-link", children: el?.title || "Menu item" }, el.id);
|
|
3189
|
-
}) : children
|
|
3190
|
-
}
|
|
3191
|
-
)
|
|
3192
|
-
]
|
|
3193
|
-
}
|
|
3194
|
-
);
|
|
3195
|
-
};
|
|
3196
|
-
var AccordionItem_default = AccordionItem;
|
|
3197
|
-
|
|
3198
|
-
// src/Atomic/UI/Table/TdTypes/TdActions.js
|
|
3199
|
-
var import_react27 = __toESM(require("react"), 1);
|
|
3200
|
-
var Icons2 = __toESM(require("react-feather"), 1);
|
|
3201
|
-
|
|
3202
|
-
// src/Atomic/FormElements/Switcher/Switcher.tsx
|
|
3203
|
-
var import_classnames28 = __toESM(require("classnames"), 1);
|
|
3204
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3205
|
-
var RC6 = "switcher";
|
|
3206
|
-
var Switcher = ({
|
|
3207
|
-
label,
|
|
3208
|
-
className,
|
|
3209
|
-
isActive,
|
|
3210
|
-
disabled,
|
|
3211
|
-
onChange,
|
|
3212
|
-
isLabelBold,
|
|
3213
|
-
hint,
|
|
3214
|
-
hintSide,
|
|
3215
|
-
testId = "switcher"
|
|
3216
|
-
}) => {
|
|
3217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3218
|
-
"div",
|
|
3219
|
-
{
|
|
3220
|
-
"data-testid": testId,
|
|
3221
|
-
className: (0, import_classnames28.default)(RC6, className, { [`${RC6}_disabled`]: disabled }),
|
|
3222
|
-
children: [
|
|
3223
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3224
|
-
"button",
|
|
3225
|
-
{
|
|
3226
|
-
type: "button",
|
|
3227
|
-
"data-testid": `${testId}-button`,
|
|
3228
|
-
className: (0, import_classnames28.default)(`${RC6}__button`),
|
|
3229
|
-
disabled,
|
|
3230
|
-
onClick: (e) => onChange(!isActive, e),
|
|
3231
|
-
children: [
|
|
3232
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3233
|
-
"div",
|
|
3234
|
-
{
|
|
3235
|
-
className: (0, import_classnames28.default)(`${RC6}__button-content`, {
|
|
3236
|
-
[`${RC6}__button-content_active`]: isActive
|
|
3237
|
-
}),
|
|
3238
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `${RC6}__ball` })
|
|
3239
|
-
}
|
|
3240
|
-
),
|
|
3241
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3242
|
-
"span",
|
|
3243
|
-
{
|
|
3244
|
-
className: (0, import_classnames28.default)(`${RC6}__label`, {
|
|
3245
|
-
[`${RC6}__label_bold`]: isLabelBold
|
|
3246
|
-
}),
|
|
3247
|
-
children: label
|
|
3248
|
-
}
|
|
3249
|
-
)
|
|
3250
|
-
]
|
|
3251
|
-
}
|
|
3252
|
-
),
|
|
3253
|
-
hint && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Hint_default, { className: `${RC6}__hint`, hint, side: hintSide })
|
|
3254
|
-
]
|
|
3255
|
-
}
|
|
3256
|
-
);
|
|
3257
|
-
};
|
|
3258
|
-
var Switcher_default = Switcher;
|
|
3259
|
-
|
|
3260
|
-
// src/Atomic/UI/Table/TdTypes/TdActions.js
|
|
3261
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3262
|
-
var TdActions = ({ actions, onChange, onActionClick, rowItem }) => {
|
|
3263
|
-
if (!actions) return false;
|
|
3264
|
-
const [state, setState] = (0, import_react27.useState)(actions);
|
|
3265
|
-
const handleArrayChange = (value, index, prop) => {
|
|
3266
|
-
state[index][prop] = value;
|
|
3267
|
-
setState([...state]);
|
|
3268
|
-
onChange(state);
|
|
3269
|
-
};
|
|
3270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "j6", children: actions?.map((action, index) => {
|
|
3271
|
-
switch (action.type) {
|
|
3272
|
-
case "download":
|
|
3273
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3274
|
-
"div",
|
|
3275
|
-
{
|
|
3276
|
-
className: "td-actions--item td-actions--download",
|
|
3277
|
-
onClick: () => {
|
|
3278
|
-
},
|
|
3279
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icons2.Download, {})
|
|
3280
|
-
},
|
|
3281
|
-
index
|
|
3282
|
-
);
|
|
3283
|
-
case "edit":
|
|
3284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3285
|
-
"div",
|
|
3286
|
-
{
|
|
3287
|
-
className: "td-actions--item td-actions--edit",
|
|
3288
|
-
onClick: () => {
|
|
3289
|
-
},
|
|
3290
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icons2.Edit3, {})
|
|
3291
|
-
},
|
|
3292
|
-
index
|
|
3293
|
-
);
|
|
3294
|
-
case "delete":
|
|
3295
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3296
|
-
"div",
|
|
3297
|
-
{
|
|
3298
|
-
className: "td-actions--item td-actions--delete",
|
|
3299
|
-
onClick: () => onActionClick("delete", rowItem),
|
|
3300
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icons2.Trash2, {})
|
|
3301
|
-
},
|
|
3302
|
-
index
|
|
3303
|
-
);
|
|
3304
|
-
case "undo":
|
|
3305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3306
|
-
"div",
|
|
3307
|
-
{
|
|
3308
|
-
className: "td-actions--item td-actions--undo",
|
|
3309
|
-
onClick: () => onActionClick("undo", rowItem),
|
|
3310
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icons2.RotateCcw, {})
|
|
3311
|
-
},
|
|
3312
|
-
index
|
|
3313
|
-
);
|
|
3314
|
-
case "switcher":
|
|
3315
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "df", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3316
|
-
Switcher_default,
|
|
3317
|
-
{
|
|
3318
|
-
label: action.label || null,
|
|
3319
|
-
isActive: action?.value,
|
|
3320
|
-
onChange: (e) => handleArrayChange(e, index, "value")
|
|
3321
|
-
}
|
|
3322
|
-
) }, index);
|
|
3323
|
-
default:
|
|
3324
|
-
return null;
|
|
3325
|
-
}
|
|
3326
|
-
}) });
|
|
3327
|
-
};
|
|
3328
|
-
|
|
3329
|
-
// src/Atomic/UI/Table/TdTypes/TdPriority.js
|
|
3330
|
-
var import_react28 = __toESM(require("react"), 1);
|
|
3331
|
-
var import_classnames29 = __toESM(require("classnames"), 1);
|
|
3332
|
-
var import_react_feather11 = require("react-feather");
|
|
3333
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3334
|
-
var TdPriority = ({ onClick, rowIndex, cardLength }) => {
|
|
3335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "cards-table__priority", children: [
|
|
3336
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mr5", children: rowIndex + 1 }),
|
|
3337
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "df", children: [
|
|
3338
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3339
|
-
import_react_feather11.ArrowDown,
|
|
3340
|
-
{
|
|
3341
|
-
onClick: () => onClick(rowIndex),
|
|
3342
|
-
className: (0, import_classnames29.default)("table--icon", {
|
|
3343
|
-
disabled: rowIndex + 1 === cardLength
|
|
3344
|
-
})
|
|
3345
|
-
}
|
|
3346
|
-
),
|
|
3347
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3348
|
-
import_react_feather11.ArrowUp,
|
|
3349
|
-
{
|
|
3350
|
-
onClick: () => onClick(rowIndex, true),
|
|
3351
|
-
className: (0, import_classnames29.default)("table--icon", { disabled: rowIndex === 0 })
|
|
3352
|
-
}
|
|
3353
|
-
)
|
|
3354
|
-
] })
|
|
3355
|
-
] });
|
|
3356
|
-
};
|
|
3357
|
-
var TdPriority_default = TdPriority;
|
|
3358
|
-
|
|
3359
|
-
// src/Atomic/UI/Table/TdTypes/TdWeight.js
|
|
3360
|
-
var import_react29 = require("react");
|
|
3361
|
-
var import_classnames30 = __toESM(require("classnames"), 1);
|
|
3362
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3363
|
-
var TdWeight = ({ value, percent, onChange, className }) => {
|
|
3364
|
-
const [state, setState] = (0, import_react29.useState)(value);
|
|
3365
|
-
const {
|
|
3366
|
-
isToggled: isEdited,
|
|
3367
|
-
toggleOff: unsetIsEdited,
|
|
3368
|
-
toggleOn: setIsEdited
|
|
3369
|
-
} = useOutsideToggle(false);
|
|
3370
|
-
(0, import_react29.useEffect)(() => {
|
|
3371
|
-
setState(value);
|
|
3372
|
-
}, [value, isEdited]);
|
|
3373
|
-
const handleKeyUp = ({ keyCode, target }) => {
|
|
3374
|
-
if (keyCode === KEY_CODE.ENTER) {
|
|
3375
|
-
const newValue = Number(target.value) || 1;
|
|
3376
|
-
onChange(newValue);
|
|
3377
|
-
unsetIsEdited();
|
|
3378
|
-
}
|
|
3379
|
-
};
|
|
3380
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: isEdited ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3381
|
-
Input,
|
|
3382
|
-
{
|
|
3383
|
-
value: state,
|
|
3384
|
-
onChange: (e) => setState(e),
|
|
3385
|
-
onBlur: unsetIsEdited,
|
|
3386
|
-
onKeyUp: handleKeyUp,
|
|
3387
|
-
autoFocus: true
|
|
3388
|
-
}
|
|
3389
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: (0, import_classnames30.default)("td-weight", className), onClick: setIsEdited, children: [
|
|
3390
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: value }),
|
|
3391
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "ml2 color--grey-gull", children: [
|
|
3392
|
-
"(",
|
|
3393
|
-
percent,
|
|
3394
|
-
"%)"
|
|
3395
|
-
] })
|
|
3396
|
-
] }) });
|
|
3397
|
-
};
|
|
3398
|
-
var TdWeight_default = TdWeight;
|
|
3399
|
-
|
|
3400
|
-
// src/Atomic/UI/Table/Partials/TdCell.js
|
|
3401
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3402
|
-
var TdCell = ({
|
|
3403
|
-
type,
|
|
3404
|
-
item,
|
|
3405
|
-
rowIndex,
|
|
3406
|
-
onChange,
|
|
3407
|
-
cardLength,
|
|
3408
|
-
changePriority,
|
|
3409
|
-
getAdviceWeight,
|
|
3410
|
-
onActionClick,
|
|
3411
|
-
rowItem,
|
|
3412
|
-
isDeleted
|
|
3413
|
-
}) => {
|
|
3414
|
-
const [isAccordionOpen, setIsAccordionOpen] = (0, import_react30.useState)(item.isOpen);
|
|
3415
|
-
const percent = item.type === "weight" && getAdviceWeight(isDeleted ? 0 : item.value);
|
|
3416
|
-
switch (type) {
|
|
3417
|
-
case "accordion":
|
|
3418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3419
|
-
AccordionItem_default,
|
|
3420
|
-
{
|
|
3421
|
-
className: item.itemClassName,
|
|
3422
|
-
item,
|
|
3423
|
-
isOpen: isAccordionOpen,
|
|
3424
|
-
onClick: (e) => setIsAccordionOpen(e),
|
|
3425
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Table_default, { rows: item.rows, className: "accordion--table" })
|
|
3426
|
-
}
|
|
3427
|
-
);
|
|
3428
|
-
case "actions":
|
|
3429
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3430
|
-
TdActions,
|
|
3431
|
-
{
|
|
3432
|
-
rowItem,
|
|
3433
|
-
actions: item,
|
|
3434
|
-
onChange,
|
|
3435
|
-
onActionClick
|
|
3436
|
-
}
|
|
3437
|
-
);
|
|
3438
|
-
case "advancedTags":
|
|
3439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AdvancedTags_default, { items: item });
|
|
3440
|
-
case "link":
|
|
3441
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("a", { href: item.link, children: item.label });
|
|
3442
|
-
case "priority":
|
|
3443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3444
|
-
TdPriority_default,
|
|
3445
|
-
{
|
|
3446
|
-
rowIndex,
|
|
3447
|
-
cardLength,
|
|
3448
|
-
onClick: changePriority
|
|
3449
|
-
}
|
|
3450
|
-
);
|
|
3451
|
-
case "status":
|
|
3452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3453
|
-
Status_default,
|
|
3454
|
-
{
|
|
3455
|
-
className: item.className,
|
|
3456
|
-
label: item.label,
|
|
3457
|
-
status: item.status
|
|
3458
|
-
}
|
|
3459
|
-
);
|
|
3460
|
-
case "tags":
|
|
3461
|
-
return item.map((tag, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tag_default, { label: tag.label }, index));
|
|
3462
|
-
case "weight":
|
|
3463
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3464
|
-
TdWeight_default,
|
|
3465
|
-
{
|
|
3466
|
-
value: item.value,
|
|
3467
|
-
percent,
|
|
3468
|
-
onChange: (value) => onChange({ ...item, value })
|
|
3469
|
-
}
|
|
3470
|
-
);
|
|
3471
|
-
default:
|
|
3472
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: item.className, children: item.value });
|
|
3473
|
-
}
|
|
3474
|
-
};
|
|
3475
|
-
var TdCell_default = TdCell;
|
|
3476
|
-
|
|
3477
|
-
// src/Atomic/UI/Table/Partials/TdRow.js
|
|
3478
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3479
|
-
var TdRow = ({
|
|
3480
|
-
item,
|
|
3481
|
-
onChange,
|
|
3482
|
-
rowIndex,
|
|
3483
|
-
cardStatus,
|
|
3484
|
-
range,
|
|
3485
|
-
type,
|
|
3486
|
-
rowSpan,
|
|
3487
|
-
colSpan,
|
|
3488
|
-
cardLength,
|
|
3489
|
-
changePriority,
|
|
3490
|
-
getAdviceWeight,
|
|
3491
|
-
onActionClick,
|
|
3492
|
-
isDeleted,
|
|
3493
|
-
testId = "td-row"
|
|
3494
|
-
}) => {
|
|
3495
|
-
const [isOpen, setIsOpen] = (0, import_react31.useState)(false);
|
|
3496
|
-
const handleChange = handleObjectChange(item, () => onChange({ ...item }));
|
|
3497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
3498
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("tr", { "data-testid": testId, children: [
|
|
3499
|
-
type && rowSpan && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("td", { className: "rel", rowSpan: rowSpan + 1, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3500
|
-
"span",
|
|
3501
|
-
{
|
|
3502
|
-
className: (0, import_classnames31.default)(
|
|
3503
|
-
type && `cards-table__score cards-table__score-${cardStatus}`
|
|
3504
|
-
),
|
|
3505
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TdRange_default, { item: range })
|
|
3506
|
-
}
|
|
3507
|
-
) }),
|
|
3508
|
-
Object.entries(item).map(
|
|
3509
|
-
([key, value]) => key === "id" || key === "isDeleted" ? null : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3510
|
-
"td",
|
|
3511
|
-
{
|
|
3512
|
-
className: (0, import_classnames31.default)("cards-table__body-item", {
|
|
3513
|
-
"cards-table__accordion": value.type === "accordion"
|
|
3514
|
-
}),
|
|
3515
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3516
|
-
TdCell_default,
|
|
3517
|
-
{
|
|
3518
|
-
onActionClick,
|
|
3519
|
-
changePriority,
|
|
3520
|
-
cardLength,
|
|
3521
|
-
rowIndex,
|
|
3522
|
-
rowItem: item,
|
|
3523
|
-
type: key,
|
|
3524
|
-
item: value,
|
|
3525
|
-
onChange: (newValue) => handleChange(newValue, key),
|
|
3526
|
-
getAdviceWeight,
|
|
3527
|
-
isDeleted
|
|
3528
|
-
}
|
|
3529
|
-
)
|
|
3530
|
-
},
|
|
3531
|
-
key
|
|
3532
|
-
)
|
|
3533
|
-
)
|
|
3534
|
-
] }),
|
|
3535
|
-
type && colSpan ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("tr", { children: [
|
|
3536
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("td", {}),
|
|
3537
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("td", { colSpan, children: [
|
|
3538
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3539
|
-
"span",
|
|
3540
|
-
{
|
|
3541
|
-
className: "cards-table__title-select-lender-btn",
|
|
3542
|
-
onClick: () => setIsOpen(true),
|
|
3543
|
-
children: "Select Lender"
|
|
3544
|
-
}
|
|
3545
|
-
),
|
|
3546
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3547
|
-
Modal_default,
|
|
3548
|
-
{
|
|
3549
|
-
closeModal: () => setIsOpen(false),
|
|
3550
|
-
isOpen,
|
|
3551
|
-
title: "Choose Lender",
|
|
3552
|
-
size: "420",
|
|
3553
|
-
children: "test"
|
|
3554
|
-
}
|
|
3555
|
-
)
|
|
3556
|
-
] })
|
|
3557
|
-
] }) : null
|
|
3558
|
-
] });
|
|
3559
|
-
};
|
|
3560
|
-
var TdRow_default = TdRow;
|
|
3561
|
-
|
|
3562
|
-
// src/Atomic/UI/Table/Table.js
|
|
3563
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3564
|
-
var Table = ({
|
|
3565
|
-
rows,
|
|
3566
|
-
onChange,
|
|
3567
|
-
className,
|
|
3568
|
-
header,
|
|
3569
|
-
onActionClick,
|
|
3570
|
-
testId = "table"
|
|
3571
|
-
}) => {
|
|
3572
|
-
const handleArrayChange = (value, index) => {
|
|
3573
|
-
rows[index] = value;
|
|
3574
|
-
onChange({ header: [...header], rows: [...rows] });
|
|
3575
|
-
};
|
|
3576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3577
|
-
"div",
|
|
3578
|
-
{
|
|
3579
|
-
"data-testid": testId,
|
|
3580
|
-
className: (0, import_classnames32.default)("simple-table", {
|
|
3581
|
-
[`simple-table--${className}`]: className
|
|
3582
|
-
}),
|
|
3583
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("table", { children: [
|
|
3584
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tr", { children: header?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TdHeader_default, { item }, item.key)) }) }),
|
|
3585
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tbody", { children: rows && rows?.length ? rows?.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3586
|
-
TdRow_default,
|
|
3587
|
-
{
|
|
3588
|
-
onActionClick,
|
|
3589
|
-
rowIndex: index,
|
|
3590
|
-
item: row,
|
|
3591
|
-
header,
|
|
3592
|
-
onChange: (value) => handleArrayChange(value, index)
|
|
3593
|
-
},
|
|
3594
|
-
typeof row.id === "object" ? row.id.value : row.id
|
|
3595
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("td", { className: "row--not-found", colSpan: header?.length, children: "Not set" }) }) })
|
|
3596
|
-
] })
|
|
3597
|
-
}
|
|
3598
|
-
);
|
|
3599
|
-
};
|
|
3600
|
-
var Table_default = Table;
|
|
3601
|
-
|
|
3602
|
-
// src/Atomic/UI/Tag/index.ts
|
|
3603
|
-
var Tag_default2 = Tag_default;
|
|
3604
|
-
|
|
3605
|
-
// src/Atomic/UI/TagList/TagList.tsx
|
|
3606
|
-
var import_classnames33 = __toESM(require("classnames"), 1);
|
|
3607
|
-
var import_react33 = require("react");
|
|
3608
|
-
var import_react_feather12 = require("react-feather");
|
|
3609
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3610
|
-
var TagList = ({
|
|
3611
|
-
disabled,
|
|
3612
|
-
className,
|
|
3613
|
-
onTagClick,
|
|
3614
|
-
removeItem,
|
|
3615
|
-
items,
|
|
3616
|
-
withToggle = true,
|
|
3617
|
-
disableShowMore = false,
|
|
3618
|
-
shownItemsCount = "auto",
|
|
3619
|
-
testId = "test-taglist",
|
|
3620
|
-
refProp,
|
|
3621
|
-
renderOrder,
|
|
3622
|
-
onEditClick,
|
|
3623
|
-
onToggleRenderAll,
|
|
3624
|
-
isUseInTable
|
|
3625
|
-
}) => {
|
|
3626
|
-
const wrapperRef = (0, import_react33.useRef)(null);
|
|
3627
|
-
const [tagList, setTagList] = (0, import_react33.useState)([]);
|
|
3628
|
-
const [staticTagsCount, setStaticTagsCount] = (0, import_react33.useState)(-1);
|
|
3629
|
-
const [renderItemsCount, setRenderItemsCount] = (0, import_react33.useState)(-1);
|
|
3630
|
-
const [renderAll, setRenderAll] = (0, import_react33.useState)(!withToggle);
|
|
3631
|
-
const wrapperWidth = wrapperRef?.current?.getBoundingClientRect()?.width ?? -1;
|
|
3632
|
-
const setRenderAllInterceptor = (v, event) => {
|
|
3633
|
-
setRenderAll(v);
|
|
3634
|
-
onToggleRenderAll?.(v);
|
|
3635
|
-
event?.stopPropagation();
|
|
3636
|
-
event?.preventDefault();
|
|
3637
|
-
};
|
|
3638
|
-
const getStaticTagsCount = (computedWidth) => {
|
|
3639
|
-
if (typeof shownItemsCount === "number") return shownItemsCount;
|
|
3640
|
-
const delta = typeof onEditClick === "function" ? 60 : 32;
|
|
3641
|
-
const result = tagList.reduce((result2, { itemRef }, index) => {
|
|
3642
|
-
if (result2.skip) return result2;
|
|
3643
|
-
const itemStyle = itemRef?.current && window.getComputedStyle(itemRef.current);
|
|
3644
|
-
const itemWidth = [
|
|
3645
|
-
Number.parseInt((itemRef.current?.getBoundingClientRect()?.width ?? 0).toString(), 10),
|
|
3646
|
-
Number.parseInt((itemStyle?.marginLeft ?? 0).toString(), 10),
|
|
3647
|
-
Number.parseInt((itemStyle?.marginRight ?? 0).toString(), 10)
|
|
3648
|
-
].reduce((result3, item) => {
|
|
3649
|
-
if (!Number.isNaN(item)) result3 += item;
|
|
3650
|
-
return result3;
|
|
3651
|
-
}, 0);
|
|
3652
|
-
if (!Number.isNaN(itemWidth) && itemWidth > 0 && itemWidth + result2.width < computedWidth - delta || index === 0) {
|
|
3653
|
-
result2 = {
|
|
3654
|
-
count: result2.count + 1,
|
|
3655
|
-
width: result2.width + itemWidth,
|
|
3656
|
-
items: [...result2.items, { w: itemWidth, r: itemRef?.current }]
|
|
3657
|
-
};
|
|
3658
|
-
} else {
|
|
3659
|
-
result2.skip = true;
|
|
3660
|
-
}
|
|
3661
|
-
return result2;
|
|
3662
|
-
}, { count: 0, width: 0, items: [], skip: false });
|
|
3663
|
-
if (result?.items?.length === 1 && result.items[0].r && tagList.length > 1) {
|
|
3664
|
-
result.items[0].r.style.maxWidth = `${computedWidth - delta - 8}px`;
|
|
3665
|
-
}
|
|
3666
|
-
return result?.count;
|
|
3667
|
-
};
|
|
3668
|
-
const cancelDefault = (_e, cb) => {
|
|
3669
|
-
cb?.();
|
|
3670
|
-
};
|
|
3671
|
-
const renderTags = () => {
|
|
3672
|
-
const tagsRenderOrder = renderOrder ?? tagList.map(({ value, id }) => id ?? value);
|
|
3673
|
-
return tagsRenderOrder.map((v, i) => {
|
|
3674
|
-
const item = tagList.find(({ value, id }) => {
|
|
3675
|
-
if (id) return id === v;
|
|
3676
|
-
if (value) return value === v;
|
|
3677
|
-
return false;
|
|
3678
|
-
});
|
|
3679
|
-
if (!item) return null;
|
|
3680
|
-
const isHidden = renderItemsCount !== -1 && staticTagsCount !== -1 ? i >= renderItemsCount : false;
|
|
3681
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3682
|
-
"div",
|
|
3683
|
-
{
|
|
3684
|
-
className: `tag-list_wrapper_item ${isHidden ? "tag-list_wrapper_item--hidden" : ""}`,
|
|
3685
|
-
ref: checkedRef(item?.itemRef),
|
|
3686
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3687
|
-
Tag_default,
|
|
3688
|
-
{
|
|
3689
|
-
testId: `test-taglist-item-${item?.id ?? item?.value}`,
|
|
3690
|
-
...item,
|
|
3691
|
-
onClick: onTagClick,
|
|
3692
|
-
removeItem,
|
|
3693
|
-
isUseInTable
|
|
3694
|
-
}
|
|
3695
|
-
)
|
|
3696
|
-
},
|
|
3697
|
-
`tag-list-item-${item?.id ?? item?.value}`
|
|
3698
|
-
);
|
|
3699
|
-
});
|
|
3700
|
-
};
|
|
3701
|
-
const renderMoreTags = () => {
|
|
3702
|
-
if (typeof shownItemsCount === "number" && tagList?.length < shownItemsCount || !tagList?.length || disableShowMore) {
|
|
3703
|
-
return null;
|
|
3704
|
-
}
|
|
3705
|
-
const restItems = tagList.length - renderItemsCount;
|
|
3706
|
-
if (restItems === 0 || !withToggle || staticTagsCount === -1) return null;
|
|
3707
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3708
|
-
Tag_default,
|
|
3709
|
-
{
|
|
3710
|
-
label: `+${restItems}`,
|
|
3711
|
-
className: "tag-list_wrapper_render-more",
|
|
3712
|
-
onClick: disableShowMore ? () => {
|
|
3713
|
-
} : (value, event) => cancelDefault(value, () => setRenderAllInterceptor(true, event)),
|
|
3714
|
-
isUseInTable
|
|
3715
|
-
}
|
|
3716
|
-
);
|
|
3717
|
-
};
|
|
3718
|
-
const renderHideTags = () => {
|
|
3719
|
-
if (renderItemsCount !== tagList?.length || !withToggle || staticTagsCount === -1 || staticTagsCount === tagList?.length) {
|
|
3720
|
-
return null;
|
|
3721
|
-
}
|
|
3722
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3723
|
-
Tag_default,
|
|
3724
|
-
{
|
|
3725
|
-
label: "...",
|
|
3726
|
-
className: "tag-list_wrapper_hide-more",
|
|
3727
|
-
onClick: (value, event) => cancelDefault(value, () => setRenderAllInterceptor(false, event)),
|
|
3728
|
-
isUseInTable
|
|
3729
|
-
}
|
|
3730
|
-
);
|
|
3731
|
-
};
|
|
3732
|
-
(0, import_react33.useEffect)(() => {
|
|
3733
|
-
setStaticTagsCount(-1);
|
|
3734
|
-
setRenderItemsCount(-1);
|
|
3735
|
-
setRenderAllInterceptor(false, null);
|
|
3736
|
-
const itemsWithRef = items.map((item) => ({ ...item, itemRef: (0, import_react33.createRef)() }));
|
|
3737
|
-
setTagList(itemsWithRef);
|
|
3738
|
-
}, [items]);
|
|
3739
|
-
(0, import_react33.useLayoutEffect)(() => {
|
|
3740
|
-
if (withToggle && wrapperWidth !== -1 && staticTagsCount === -1) {
|
|
3741
|
-
let computedWidth = wrapperWidth;
|
|
3742
|
-
if (computedWidth === 0) {
|
|
3743
|
-
computedWidth = Number.parseInt(
|
|
3744
|
-
(wrapperRef?.current ? window.getComputedStyle(wrapperRef?.current)?.width : 0).toString()
|
|
3745
|
-
);
|
|
3746
|
-
}
|
|
3747
|
-
if (!Number.isNaN(computedWidth)) {
|
|
3748
|
-
setStaticTagsCount(getStaticTagsCount(computedWidth));
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
}, [tagList, wrapperWidth, wrapperRef?.current]);
|
|
3752
|
-
(0, import_react33.useLayoutEffect)(() => {
|
|
3753
|
-
setRenderItemsCount(staticTagsCount);
|
|
3754
|
-
}, [staticTagsCount]);
|
|
3755
|
-
(0, import_react33.useEffect)(() => {
|
|
3756
|
-
setRenderItemsCount(renderAll ? tagList?.length : staticTagsCount);
|
|
3757
|
-
}, [renderAll]);
|
|
3758
|
-
(0, import_react33.useEffect)(() => {
|
|
3759
|
-
if (wrapperRef?.current && refProp) refProp.current = wrapperRef?.current;
|
|
3760
|
-
}, [wrapperRef?.current]);
|
|
3761
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3762
|
-
"div",
|
|
3763
|
-
{
|
|
3764
|
-
"data-testid": testId,
|
|
3765
|
-
className: (0, import_classnames33.default)(
|
|
3766
|
-
"tag-list_wrapper",
|
|
3767
|
-
`${renderItemsCount !== tagList?.length || !withToggle || staticTagsCount === -1 || staticTagsCount === tagList?.length ? "tag-list_wrapper--only-static-items" : "tag-list_wrapper--all-items"}`,
|
|
3768
|
-
className,
|
|
3769
|
-
{ "tag-list_wrapper--disabled": disabled }
|
|
3770
|
-
),
|
|
3771
|
-
style: {
|
|
3772
|
-
visibility: staticTagsCount === -1 ? "hidden" : "visible",
|
|
3773
|
-
zIndex: staticTagsCount === -1 ? "-1" : "auto"
|
|
3774
|
-
},
|
|
3775
|
-
ref: wrapperRef,
|
|
3776
|
-
children: [
|
|
3777
|
-
renderTags(),
|
|
3778
|
-
renderMoreTags(),
|
|
3779
|
-
renderHideTags(),
|
|
3780
|
-
typeof onEditClick === "function" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "tag-list__edit-trigger", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_feather12.Edit3, { onClick: onEditClick }) })
|
|
3781
|
-
]
|
|
3782
|
-
}
|
|
3783
|
-
);
|
|
3784
|
-
};
|
|
3785
|
-
var TagList_default = TagList;
|
|
3786
|
-
|
|
3787
|
-
// src/Atomic/UI/UserBox/UserBox.tsx
|
|
3788
|
-
var import_classnames35 = __toESM(require("classnames"), 1);
|
|
3789
|
-
|
|
3790
|
-
// src/Atomic/FormElements/Label/Label.tsx
|
|
3791
|
-
var import_classnames34 = __toESM(require("classnames"), 1);
|
|
3792
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3793
|
-
var CN6 = "label";
|
|
3794
|
-
var Label = ({
|
|
3795
|
-
className = "",
|
|
3796
|
-
label = "",
|
|
3797
|
-
note,
|
|
3798
|
-
hint,
|
|
3799
|
-
isRequired,
|
|
3800
|
-
isLabelBolt,
|
|
3801
|
-
onClickHintCallback,
|
|
3802
|
-
error = null,
|
|
3803
|
-
isAccessability = false,
|
|
3804
|
-
isAccessabilityHint = false,
|
|
3805
|
-
testId = CN6
|
|
3806
|
-
}) => {
|
|
3807
|
-
const correctLabel = isRequired ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3808
|
-
label,
|
|
3809
|
-
" ",
|
|
3810
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "label_asterisk", children: "*" }),
|
|
3811
|
-
" ",
|
|
3812
|
-
note && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "label_note", children: note }),
|
|
3813
|
-
hint && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3814
|
-
Hint_default,
|
|
3815
|
-
{
|
|
3816
|
-
id: `hint-${label}`,
|
|
3817
|
-
children: null,
|
|
3818
|
-
isLoading: false,
|
|
3819
|
-
isAccessability: isAccessabilityHint,
|
|
3820
|
-
hint: hint.text,
|
|
3821
|
-
icon: hint.icon,
|
|
3822
|
-
variant: hint.variant,
|
|
3823
|
-
side: hint.hintSide,
|
|
3824
|
-
className: "label-hint",
|
|
3825
|
-
onClickCallback: onClickHintCallback
|
|
3826
|
-
},
|
|
3827
|
-
`hint-${label}`
|
|
3828
|
-
)
|
|
3829
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3830
|
-
label,
|
|
3831
|
-
" ",
|
|
3832
|
-
note && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "label_note", children: note }),
|
|
3833
|
-
hint && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3834
|
-
Hint_default,
|
|
3835
|
-
{
|
|
3836
|
-
isAccessability: isAccessabilityHint,
|
|
3837
|
-
hint: hint.text,
|
|
3838
|
-
icon: hint.icon,
|
|
3839
|
-
variant: hint.variant,
|
|
3840
|
-
side: hint.hintSide,
|
|
3841
|
-
className: "label-hint",
|
|
3842
|
-
onClickCallback: onClickHintCallback,
|
|
3843
|
-
id: void 0,
|
|
3844
|
-
children: void 0,
|
|
3845
|
-
isLoading: void 0
|
|
3846
|
-
},
|
|
3847
|
-
void 0
|
|
3848
|
-
)
|
|
3849
|
-
] });
|
|
3850
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3851
|
-
"span",
|
|
3852
|
-
{
|
|
3853
|
-
tabIndex: isAccessability ? 0 : -1,
|
|
3854
|
-
"aria-label": label,
|
|
3855
|
-
className: (0, import_classnames34.default)(CN6, { label_bold: isLabelBolt, error, isRequired }, className),
|
|
3856
|
-
"data-testid": testId,
|
|
3857
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "label_text", "data-testid": "label-text", children: correctLabel })
|
|
3858
|
-
}
|
|
3859
|
-
);
|
|
3860
|
-
};
|
|
3861
|
-
var Label_default = Label;
|
|
3862
|
-
|
|
3863
|
-
// src/Atomic/UI/UserBox/UserBox.tsx
|
|
3864
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3865
|
-
var UserBox = ({
|
|
3866
|
-
name = "Username",
|
|
3867
|
-
role,
|
|
3868
|
-
id,
|
|
3869
|
-
onClick,
|
|
3870
|
-
isModal,
|
|
3871
|
-
className,
|
|
3872
|
-
colors,
|
|
3873
|
-
testId = "userbox"
|
|
3874
|
-
}) => {
|
|
3875
|
-
const getNameFirstLetter = name.charAt(0).toUpperCase();
|
|
3876
|
-
const renderUser = () => {
|
|
3877
|
-
if (isModal) {
|
|
3878
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3879
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { backgroundColor: getColorById(id, colors) }, className: "td-user-box__avatar", children: getNameFirstLetter }),
|
|
3880
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "td-user-box__user-data", children: [
|
|
3881
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button_default, { className: "p0 no-shadow", onClick, label: name, variant: "link" }),
|
|
3882
|
-
role && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: role })
|
|
3883
|
-
] })
|
|
3884
|
-
] });
|
|
3885
|
-
} else {
|
|
3886
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3887
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { backgroundColor: getColorById(id) }, className: "td-user-box__avatar", children: getNameFirstLetter }),
|
|
3888
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "td-user-box__user-data", children: [
|
|
3889
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Label_default, { label: name }),
|
|
3890
|
-
role && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "aria-label": `User role: ${role}`, children: role })
|
|
3891
|
-
] })
|
|
3892
|
-
] });
|
|
3893
|
-
}
|
|
3894
|
-
};
|
|
3895
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3896
|
-
"div",
|
|
3897
|
-
{
|
|
3898
|
-
"data-testid": testId,
|
|
3899
|
-
className: (0, import_classnames35.default)("td-user-box", className),
|
|
3900
|
-
role: "region",
|
|
3901
|
-
"aria-label": `User box for ${name}`,
|
|
3902
|
-
children: renderUser()
|
|
3903
|
-
}
|
|
3904
|
-
);
|
|
3905
|
-
};
|
|
3906
|
-
var UserBox_default = UserBox;
|
|
3907
|
-
|
|
3908
|
-
// src/Atomic/UI/UserBox/index.ts
|
|
3909
|
-
var UserBox_default2 = UserBox_default;
|
|
3910
|
-
|
|
3911
|
-
// src/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.tsx
|
|
3912
|
-
var import_classnames38 = __toESM(require("classnames"), 1);
|
|
3913
|
-
|
|
3914
|
-
// src/Atomic/UI/WizardStepper/ui/icons.tsx
|
|
3915
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3916
|
-
var DoneIcon = () => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3917
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("rect", { width: "20", height: "20", rx: "10", fill: "#69A457" }),
|
|
3918
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("mask", { id: "mask0_54394_4001", style: { maskType: "alpha" }, maskUnits: "userSpaceOnUse", x: "2", y: "2", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("path", { d: "M14.5 7L9 12.5L6 9.5", stroke: "black", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
3919
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("g", { mask: "url(#mask0_54394_4001)", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("rect", { x: "2", y: "2", width: "16", height: "16", fill: "white" }) })
|
|
3920
|
-
] });
|
|
3921
|
-
var TodoIcon = () => {
|
|
3922
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3923
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("g", { clipPath: "url(#clip0_54394_4448)", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("circle", { cx: "10", cy: "10", r: "7", fill: "white", stroke: "#B3B8CB", strokeWidth: "2" }) }),
|
|
3924
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("clipPath", { id: "clip0_54394_4448", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("rect", { width: "16", height: "16", fill: "white", transform: "translate(2 2)" }) }) })
|
|
3925
|
-
] });
|
|
3926
|
-
};
|
|
3927
|
-
var ActiveIcon = () => {
|
|
3928
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3929
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("rect", { width: "20", height: "20", rx: "10", fill: "#E8F9E5" }),
|
|
3930
|
-
"ii",
|
|
3931
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("mask", { id: "mask0_54394_1459", style: { maskType: "alpha" }, maskUnits: "userSpaceOnUse", x: "2", y: "2", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("circle", { cx: "10", cy: "10", r: "4", fill: "#171D33" }) }),
|
|
3932
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("g", { mask: "url(#mask0_54394_1459)", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("rect", { x: "2", y: "2", width: "16", height: "16", fill: "#171D33" }) })
|
|
3933
|
-
] });
|
|
3934
|
-
};
|
|
3935
|
-
var alternativeIconSet = {
|
|
3936
|
-
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TodoIcon, {}),
|
|
3937
|
-
doneIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DoneIcon, {}),
|
|
3938
|
-
activeIcon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ActiveIcon, {})
|
|
3939
|
-
};
|
|
3940
|
-
|
|
3941
|
-
// src/Atomic/UI/WizardStepper/ui/StepRow/StepRow.tsx
|
|
3942
|
-
var import_classnames37 = __toESM(require("classnames"), 1);
|
|
3943
|
-
|
|
3944
|
-
// src/Atomic/UI/WizardStepper/constructor.js
|
|
3945
|
-
var import_react34 = __toESM(require("react"), 1);
|
|
3946
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3947
|
-
var WIZARD_STEP_VARIANTS = Object.freeze({
|
|
3948
|
-
DEFAULT: "default",
|
|
3949
|
-
DONE: "done",
|
|
3950
|
-
ACTIVE: "active"
|
|
3951
|
-
});
|
|
3952
|
-
|
|
3953
|
-
// src/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.tsx
|
|
3954
|
-
var import_classnames36 = __toESM(require("classnames"), 1);
|
|
3955
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3956
|
-
var DefaultPoint = () => {
|
|
3957
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("circle", { cx: "8", cy: "8", r: "4" }) });
|
|
3958
|
-
};
|
|
3959
|
-
var DonePoint = () => {
|
|
3960
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M12.5 5L7 10.5L4 7.5", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3961
|
-
};
|
|
3962
|
-
var RC7 = "state-icon";
|
|
3963
|
-
var { ACTIVE, DEFAULT, DONE } = WIZARD_STEP_VARIANTS;
|
|
3964
|
-
var StateIcon = ({ variant = DEFAULT, className }) => {
|
|
3965
|
-
const computedState = variant === ACTIVE || variant === DONE ? variant : DEFAULT;
|
|
3966
|
-
const Inner = {
|
|
3967
|
-
[DEFAULT]: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DefaultPoint, {}),
|
|
3968
|
-
[ACTIVE]: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DefaultPoint, {}),
|
|
3969
|
-
[DONE]: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DonePoint, {})
|
|
3970
|
-
};
|
|
3971
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: (0, import_classnames36.default)(RC7, `${RC7}--${computedState}`, className), children: Inner[computedState] });
|
|
3972
|
-
};
|
|
3973
|
-
|
|
3974
|
-
// src/Atomic/UI/WizardStepper/ui/StateIcon/index.ts
|
|
3975
|
-
var StateIcon_default = StateIcon;
|
|
3976
|
-
|
|
3977
|
-
// src/Atomic/UI/WizardStepper/ui/StepRow/StepRow.tsx
|
|
3978
|
-
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3979
|
-
var RC8 = "step-row";
|
|
3980
|
-
var { DEFAULT: DEFAULT2, ACTIVE: ACTIVE2, DONE: DONE2 } = WIZARD_STEP_VARIANTS;
|
|
3981
|
-
var StepRow = ({
|
|
3982
|
-
label,
|
|
3983
|
-
description,
|
|
3984
|
-
className,
|
|
3985
|
-
isOptional,
|
|
3986
|
-
isFinished,
|
|
3987
|
-
isActive,
|
|
3988
|
-
titleSlot,
|
|
3989
|
-
contentSlot,
|
|
3990
|
-
customIcons
|
|
3991
|
-
}) => {
|
|
3992
|
-
const title = label;
|
|
3993
|
-
const rowVariant = (() => {
|
|
3994
|
-
if (isActive) return ACTIVE2;
|
|
3995
|
-
if (isFinished) return DONE2;
|
|
3996
|
-
return DEFAULT2;
|
|
3997
|
-
})();
|
|
3998
|
-
const alternaviteIconFromProps = (() => {
|
|
3999
|
-
if (isActive) return customIcons?.activeIcon;
|
|
4000
|
-
if (isFinished) return customIcons?.doneIcon;
|
|
4001
|
-
return customIcons?.defaultIcon;
|
|
4002
|
-
})();
|
|
4003
|
-
const CorrectIcon = () => {
|
|
4004
|
-
if (!customIcons || Object?.values(customIcons)?.every((icon) => !icon)) {
|
|
4005
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(StateIcon_default, { variant: rowVariant });
|
|
4006
|
-
}
|
|
4007
|
-
return alternaviteIconFromProps || null;
|
|
4008
|
-
};
|
|
4009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: (0, import_classnames37.default)(RC8, `${RC8}--${rowVariant}`, className), children: [
|
|
4010
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: (0, import_classnames37.default)(`${RC8}__state-point`, `${RC8}__state-point--${rowVariant}`), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CorrectIcon, {}) }),
|
|
4011
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `${RC8}__content`, children: [
|
|
4012
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `${RC8}__title`, children: [
|
|
4013
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `${RC8}__title-left`, children: [
|
|
4014
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: (0, import_classnames37.default)(`${RC8}__title-text`, { "text-muted": rowVariant === DEFAULT2 }), children: title }),
|
|
4015
|
-
isOptional && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Status_default, { label: "Optional", status: "draft" })
|
|
4016
|
-
] }),
|
|
4017
|
-
titleSlot && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `${RC8}__title-right`, children: titleSlot })
|
|
4018
|
-
] }),
|
|
4019
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `${RC8}__description`, children: description }),
|
|
4020
|
-
contentSlot && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `${RC8}__body`, children: contentSlot })
|
|
4021
|
-
] })
|
|
4022
|
-
] }, label);
|
|
4023
|
-
};
|
|
4024
|
-
var StepRow_default = StepRow;
|
|
4025
|
-
|
|
4026
|
-
// src/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.tsx
|
|
4027
|
-
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4028
|
-
var StepWrapper = ({
|
|
4029
|
-
steps,
|
|
4030
|
-
customIcons,
|
|
4031
|
-
variant = "default",
|
|
4032
|
-
className,
|
|
4033
|
-
testId = "step-wrapper"
|
|
4034
|
-
}) => {
|
|
4035
|
-
if (!steps?.length) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { "data-testid": "empty-state", children: "No steps available" });
|
|
4036
|
-
const renderStepRow = (step) => {
|
|
4037
|
-
const { key, ...stepProps } = step;
|
|
4038
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4039
|
-
StepRow_default,
|
|
4040
|
-
{
|
|
4041
|
-
...stepProps,
|
|
4042
|
-
customIcons: customIcons || alternativeIconSet
|
|
4043
|
-
},
|
|
4044
|
-
key
|
|
4045
|
-
);
|
|
4046
|
-
};
|
|
4047
|
-
switch (variant) {
|
|
4048
|
-
case "ghost":
|
|
4049
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4050
|
-
Box_default,
|
|
4051
|
-
{
|
|
4052
|
-
className: (0, import_classnames38.default)("step-wrapper", "step-wrapper-ghost", className),
|
|
4053
|
-
"data-testid": testId,
|
|
4054
|
-
children: steps?.map(renderStepRow)
|
|
4055
|
-
}
|
|
4056
|
-
);
|
|
4057
|
-
case "cardActive":
|
|
4058
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4059
|
-
"div",
|
|
4060
|
-
{
|
|
4061
|
-
className: (0, import_classnames38.default)("step-wrapper", "step-wrapper-card-active", className),
|
|
4062
|
-
"data-testid": testId,
|
|
4063
|
-
children: steps?.map(renderStepRow)
|
|
4064
|
-
}
|
|
4065
|
-
);
|
|
4066
|
-
default:
|
|
4067
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4068
|
-
"div",
|
|
4069
|
-
{
|
|
4070
|
-
className: (0, import_classnames38.default)("step-wrapper", className),
|
|
4071
|
-
"data-testid": testId,
|
|
4072
|
-
children: steps?.map(renderStepRow)
|
|
4073
|
-
}
|
|
4074
|
-
);
|
|
4075
|
-
}
|
|
4076
|
-
};
|
|
4077
|
-
var StepWrapper_default = StepWrapper;
|
|
4078
|
-
|
|
4079
|
-
// src/Atomic/UI/WizardStepper/ui/StepWrapper/index.ts
|
|
4080
|
-
var StepWrapper_default2 = StepWrapper_default;
|
|
4081
|
-
|
|
4082
|
-
// src/Atomic/UI/WizardStepper/ui/index.ts
|
|
4083
|
-
var ui_default = StepWrapper_default2;
|
|
4084
|
-
|
|
4085
|
-
// src/Atomic/UI/WizardStepper/index.ts
|
|
4086
|
-
var WizardStepper_default = ui_default;
|
|
4087
|
-
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
4088
|
-
//! чем указано в quantity - округлит по правилам округления
|
|
4089
|
-
//! чем указано в decimalPlaces - округлит по правилам округления
|
|
4090
|
-
//# sourceMappingURL=ui.cjs.map
|