nntc-ui 0.0.1

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/index.js ADDED
@@ -0,0 +1,2933 @@
1
+ import {
2
+ AddIcon,
3
+ ArrowDropDownIcon,
4
+ ArrowDropUpIcon,
5
+ CheckboxDeselectedIcon,
6
+ CheckboxIcon,
7
+ CheckboxSeveralIcon,
8
+ ChevronLeftIcon,
9
+ ChevronRightIcon,
10
+ CloseIcon,
11
+ DateRangeIcon,
12
+ DoneIcon,
13
+ FilterIcon,
14
+ KeyboardArrowDownIcon,
15
+ SearchIcon,
16
+ SortDownIcon,
17
+ SortUpIcon
18
+ } from "./chunk-RKPZOIBV.js";
19
+
20
+ // src/components/common/Button/Button.tsx
21
+ import classnames from "classnames";
22
+ import { forwardRef } from "react";
23
+
24
+ // src/components/common/Button/button.module.css
25
+ var button_default = {
26
+ root: "button_root",
27
+ stateLayer: "button_stateLayer",
28
+ active: "button_active",
29
+ filled: "button_filled",
30
+ outlined: "button_outlined",
31
+ text: "button_text",
32
+ elevated: "button_elevated",
33
+ tonal: "button_tonal",
34
+ link: "button_link",
35
+ medium: "button_medium",
36
+ small: "button_small",
37
+ withIcon: "button_withIcon",
38
+ withoutIcon: "button_withoutIcon",
39
+ onlyIcon: "button_onlyIcon",
40
+ textSecondary: "button_textSecondary"
41
+ };
42
+
43
+ // src/components/common/Button/Button.tsx
44
+ import { jsx, jsxs } from "react/jsx-runtime";
45
+ var Button = forwardRef(function Button2({ variant = "filled", size = "medium", icon, textSecondary, isActive, className, children, classes, ...buttonProps }, propRef) {
46
+ return /* @__PURE__ */ jsx(
47
+ "button",
48
+ {
49
+ className: classnames(
50
+ button_default.root,
51
+ button_default[variant],
52
+ button_default[size],
53
+ !icon ? button_default.withoutIcon : !children ? button_default.onlyIcon : button_default.withIcon,
54
+ isActive ? button_default.active : void 0,
55
+ textSecondary ? button_default.textSecondary : void 0,
56
+ className,
57
+ classes?.root
58
+ ),
59
+ ...buttonProps,
60
+ ref: propRef,
61
+ children: /* @__PURE__ */ jsxs("span", { className: classnames(button_default.stateLayer, classes?.stateLayer), children: [
62
+ icon,
63
+ children
64
+ ] })
65
+ }
66
+ );
67
+ });
68
+
69
+ // src/components/common/Checkbox/Checkbox.tsx
70
+ import classnames3 from "classnames";
71
+ import { useEffect, useRef } from "react";
72
+ import { mergeRefs } from "react-merge-refs";
73
+ import { v4 as uuidv4 } from "uuid";
74
+
75
+ // src/components/view/Typography/Typography.tsx
76
+ import classnames2 from "classnames";
77
+ import { forwardRef as forwardRef2 } from "react";
78
+
79
+ // src/components/view/Typography/typography.module.css
80
+ var typography_default = {
81
+ h1: "typography_h1",
82
+ h2: "typography_h2",
83
+ h3: "typography_h3",
84
+ h4: "typography_h4",
85
+ h5: "typography_h5",
86
+ h6: "typography_h6",
87
+ h7: "typography_h7",
88
+ subtitle1: "typography_subtitle1",
89
+ subtitle2: "typography_subtitle2",
90
+ body1: "typography_body1",
91
+ body2: "typography_body2",
92
+ button: "typography_button",
93
+ caption: "typography_caption",
94
+ overline: "typography_overline"
95
+ };
96
+
97
+ // src/components/view/Typography/Typography.tsx
98
+ import { jsx as jsx2 } from "react/jsx-runtime";
99
+ var Typography = forwardRef2(function Typography2({ variant = "body2", component, children, className, ...typographyProps }, propRef) {
100
+ const Component = component || "span";
101
+ return /* @__PURE__ */ jsx2(
102
+ Component,
103
+ {
104
+ className: classnames2(typography_default[variant], className),
105
+ ...typographyProps,
106
+ ref: propRef,
107
+ children
108
+ }
109
+ );
110
+ });
111
+
112
+ // src/hooks/useTranslation.ts
113
+ import { useTranslation as useTranslationOriginal } from "react-i18next";
114
+ var useTranslation = () => {
115
+ const { t, i18n } = useTranslationOriginal();
116
+ const changeLanguage = (language) => {
117
+ i18n.changeLanguage(language);
118
+ };
119
+ return {
120
+ t,
121
+ currentLanguage: i18n.language,
122
+ changeLanguage
123
+ };
124
+ };
125
+
126
+ // src/components/common/Checkbox/checkbox.module.css
127
+ var checkbox_default = {
128
+ root: "checkbox_root",
129
+ input: "checkbox_input",
130
+ label: "checkbox_label",
131
+ checkbox: "checkbox_checkbox",
132
+ several: "checkbox_several",
133
+ deselected: "checkbox_deselected",
134
+ selected: "checkbox_selected",
135
+ labelText: "checkbox_labelText",
136
+ pressed: "checkbox_pressed"
137
+ };
138
+
139
+ // src/components/common/Checkbox/Checkbox.tsx
140
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
141
+ function Checkbox(props) {
142
+ const { label, several, componentSize = "medium", classes, id, checked, ref, ...inputProps } = props;
143
+ const { t } = useTranslation();
144
+ const inputRef = useRef(null);
145
+ const inputId = id ?? uuidv4();
146
+ useEffect(() => {
147
+ const mouseupListener = function() {
148
+ this.classList.remove("pressed");
149
+ };
150
+ const mousedownListener = function() {
151
+ this.classList.add("pressed");
152
+ };
153
+ if (inputRef?.current) {
154
+ inputRef.current.addEventListener("mousedown", mousedownListener);
155
+ inputRef.current.addEventListener("mouseup", mouseupListener);
156
+ }
157
+ return () => {
158
+ if (inputRef?.current) {
159
+ inputRef.current.removeEventListener("mousedown", mousedownListener);
160
+ inputRef.current.removeEventListener("mouseup", mouseupListener);
161
+ }
162
+ };
163
+ }, [inputRef]);
164
+ return /* @__PURE__ */ jsxs2("div", { className: classnames3(checkbox_default.root, classes?.root), children: [
165
+ /* @__PURE__ */ jsx3(
166
+ "input",
167
+ {
168
+ ref: mergeRefs([inputRef, ref]),
169
+ type: "checkbox",
170
+ className: classnames3(checkbox_default.input, classes?.input),
171
+ placeholder: t("\u041F\u043E\u0438\u0441\u043A..."),
172
+ id: inputId,
173
+ title: label,
174
+ ...inputProps
175
+ }
176
+ ),
177
+ /* @__PURE__ */ jsxs2("label", { htmlFor: inputId, className: classnames3(checkbox_default.label, classes?.label), title: label, children: [
178
+ several ? /* @__PURE__ */ jsx3("span", { className: classnames3(checkbox_default.checkbox, checkbox_default.several, classes?.checkbox), children: /* @__PURE__ */ jsx3(CheckboxSeveralIcon, {}) }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
179
+ /* @__PURE__ */ jsx3("span", { className: classnames3(checkbox_default.checkbox, checkbox_default.deselected, classes?.checkbox), children: /* @__PURE__ */ jsx3(CheckboxDeselectedIcon, {}) }),
180
+ /* @__PURE__ */ jsx3("span", { className: classnames3(checkbox_default.checkbox, checkbox_default.selected, classes?.checkbox), children: /* @__PURE__ */ jsx3(CheckboxIcon, {}) })
181
+ ] }),
182
+ !!label && /* @__PURE__ */ jsx3(Fragment, { children: componentSize === "large" ? /* @__PURE__ */ jsx3(Typography, { variant: "subtitle1", className: classnames3(checkbox_default.labelText, classes?.labelText), children: label }) : /* @__PURE__ */ jsx3(Typography, { variant: "subtitle2", className: classnames3(checkbox_default.labelText, classes?.labelText), children: label }) })
183
+ ] })
184
+ ] });
185
+ }
186
+
187
+ // src/components/common/Select/Select.tsx
188
+ import classnames6 from "classnames";
189
+ import {
190
+ useCallback as useCallback2,
191
+ useEffect as useEffect2,
192
+ useRef as useRef2,
193
+ useState as useState3
194
+ } from "react";
195
+ import { mergeRefs as mergeRefs2 } from "react-merge-refs";
196
+ import { v4 as uuidv42 } from "uuid";
197
+
198
+ // src/components/view/Popover/Popover.tsx
199
+ import classnames4 from "classnames";
200
+ import { useState as useState2 } from "react";
201
+
202
+ // src/components/view/Popover/popover.module.css
203
+ var popover_default = {
204
+ trigger: "popover_trigger",
205
+ content: "popover_content"
206
+ };
207
+
208
+ // src/components/view/Popover/ui/PopoverContent/PopoverContent.tsx
209
+ import { FloatingFocusManager, FloatingPortal, useId, useMergeRefs } from "@floating-ui/react";
210
+ import { forwardRef as forwardRef3, useContext, useLayoutEffect } from "react";
211
+
212
+ // src/components/view/Popover/ui/PopoverProvider/constants/PopoverContext.ts
213
+ import { createContext } from "react";
214
+ var PopoverContext = createContext(null);
215
+
216
+ // src/components/view/Popover/ui/PopoverContent/PopoverContent.tsx
217
+ import { jsx as jsx4 } from "react/jsx-runtime";
218
+ var PopoverContent = forwardRef3(function PopoverContent2({ style, children, ...props }, propRef) {
219
+ const context = useContext(PopoverContext);
220
+ if (!context) {
221
+ return null;
222
+ }
223
+ const { context: floatingContext, ...otherContext } = context;
224
+ const ref = useMergeRefs([otherContext.refs.setFloating, propRef]);
225
+ const id = useId();
226
+ useLayoutEffect(() => {
227
+ context.setDescriptionId(id);
228
+ return () => context.setDescriptionId(void 0);
229
+ }, [id, context.setDescriptionId]);
230
+ if (!floatingContext.open)
231
+ return null;
232
+ return /* @__PURE__ */ jsx4(FloatingPortal, { children: /* @__PURE__ */ jsx4(FloatingFocusManager, { context: floatingContext, modal: otherContext.modal, children: /* @__PURE__ */ jsx4(
233
+ "div",
234
+ {
235
+ id,
236
+ ref,
237
+ style: { ...otherContext.floatingStyles, ...style },
238
+ "aria-describedby": otherContext.descriptionId,
239
+ ...otherContext.getFloatingProps(props),
240
+ children
241
+ }
242
+ ) }) });
243
+ });
244
+
245
+ // src/components/view/Popover/ui/PopoverProvider/hooks/usePopover.ts
246
+ import {
247
+ autoUpdate,
248
+ flip,
249
+ offset,
250
+ shift,
251
+ useClick,
252
+ useDismiss,
253
+ useFloating,
254
+ useInteractions,
255
+ useRole
256
+ } from "@floating-ui/react";
257
+ import { useMemo, useState } from "react";
258
+ function usePopover(props = {}) {
259
+ const {
260
+ initialOpen = false,
261
+ placement = "bottom",
262
+ modal,
263
+ open: controlledOpen,
264
+ onOpenChange: setControlledOpen,
265
+ containerOffset = 12
266
+ } = props;
267
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);
268
+ const [descriptionId, setDescriptionId] = useState();
269
+ const open = controlledOpen ?? uncontrolledOpen;
270
+ const setOpen = setControlledOpen ?? setUncontrolledOpen;
271
+ const data = useFloating({
272
+ placement,
273
+ open,
274
+ onOpenChange: setOpen,
275
+ whileElementsMounted: autoUpdate,
276
+ middleware: [
277
+ offset(containerOffset),
278
+ flip({
279
+ crossAxis: placement.includes("-"),
280
+ fallbackAxisSideDirection: "end",
281
+ padding: 5
282
+ }),
283
+ shift({ padding: 5 })
284
+ ]
285
+ });
286
+ const { context } = data;
287
+ const click = useClick(context, {
288
+ enabled: controlledOpen == void 0
289
+ });
290
+ const dismiss = useDismiss(context);
291
+ const role = useRole(context);
292
+ const interactions = useInteractions([click, dismiss, role]);
293
+ return useMemo(
294
+ () => ({
295
+ open,
296
+ setOpen,
297
+ ...interactions,
298
+ ...data,
299
+ modal,
300
+ descriptionId,
301
+ setDescriptionId
302
+ }),
303
+ [open, setOpen, interactions, data, modal, descriptionId]
304
+ );
305
+ }
306
+
307
+ // src/components/view/Popover/ui/PopoverProvider/PopoverProvider.tsx
308
+ import { jsx as jsx5 } from "react/jsx-runtime";
309
+ var PopoverProvider = (props) => {
310
+ const { children, modal = false, ...options } = props;
311
+ const popover = usePopover({ modal, ...options });
312
+ return /* @__PURE__ */ jsx5(PopoverContext.Provider, { value: popover, children });
313
+ };
314
+
315
+ // src/components/view/Popover/ui/PopoverTrigger/PopoverTrigger.tsx
316
+ import { useMergeRefs as useMergeRefs2 } from "@floating-ui/react";
317
+ import { cloneElement, forwardRef as forwardRef4, isValidElement, useContext as useContext2 } from "react";
318
+ import { jsx as jsx6 } from "react/jsx-runtime";
319
+ var PopoverTrigger = forwardRef4(
320
+ function PopoverTrigger2({ children, wrapTrigger = false, ...props }, propRef) {
321
+ const context = useContext2(PopoverContext);
322
+ const childrenRef = children.ref;
323
+ const ref = useMergeRefs2([context?.refs.setReference, propRef, childrenRef]);
324
+ if (!context) {
325
+ return null;
326
+ }
327
+ if (!wrapTrigger && isValidElement(children)) {
328
+ return cloneElement(
329
+ children,
330
+ context.getReferenceProps({
331
+ ref,
332
+ ...props,
333
+ ...children.props,
334
+ "data-state": context.open ? "open" : "closed"
335
+ })
336
+ );
337
+ }
338
+ return /* @__PURE__ */ jsx6("div", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
339
+ }
340
+ );
341
+
342
+ // src/components/view/Popover/Popover.tsx
343
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
344
+ function Popover(props) {
345
+ const { description, clickable, initialOpen, placement, wrapTrigger, containerOffset, children, classes } = props;
346
+ const [showTooltip, setShowTooltip] = useState2(false);
347
+ if (!children) {
348
+ return null;
349
+ }
350
+ if (!description) {
351
+ return children;
352
+ }
353
+ return /* @__PURE__ */ jsxs3(
354
+ PopoverProvider,
355
+ {
356
+ placement,
357
+ initialOpen,
358
+ open: clickable ? showTooltip : void 0,
359
+ onOpenChange: clickable ? setShowTooltip : void 0,
360
+ containerOffset,
361
+ children: [
362
+ /* @__PURE__ */ jsx7(
363
+ PopoverTrigger,
364
+ {
365
+ wrapTrigger,
366
+ onClick: clickable ? () => setShowTooltip((prev) => !prev) : void 0,
367
+ className: classnames4(wrapTrigger ? popover_default.trigger : void 0, classes?.trigger),
368
+ children
369
+ }
370
+ ),
371
+ /* @__PURE__ */ jsx7(PopoverContent, { className: classnames4(popover_default.content, classes?.content), children: description })
372
+ ]
373
+ }
374
+ );
375
+ }
376
+
377
+ // src/components/view/Popover/ui/Arrow/Arrow.tsx
378
+ import { useContext as useContext3 } from "react";
379
+ import { jsx as jsx8 } from "react/jsx-runtime";
380
+ function Arrow() {
381
+ const popoverContext = useContext3(PopoverContext);
382
+ return popoverContext?.open ? /* @__PURE__ */ jsx8(ArrowDropUpIcon, {}) : /* @__PURE__ */ jsx8(ArrowDropDownIcon, {});
383
+ }
384
+
385
+ // src/components/common/Select/select.module.css
386
+ var select_default = {
387
+ root: "select_root",
388
+ medium: "select_medium",
389
+ small: "select_small",
390
+ label: "select_label",
391
+ wrapper: "select_wrapper",
392
+ input: "select_input",
393
+ withIcon: "select_withIcon",
394
+ withItemIcon: "select_withItemIcon",
395
+ icon: "select_icon",
396
+ itemIcon: "select_itemIcon",
397
+ filled: "select_filled",
398
+ outlined: "select_outlined",
399
+ arrow: "select_arrow",
400
+ popoverTarget: "select_popoverTarget",
401
+ popoverContent: "select_popoverContent"
402
+ };
403
+
404
+ // src/components/common/Select/ui/SelectPopover/SelectPopover.tsx
405
+ import { useContext as useContext4 } from "react";
406
+
407
+ // src/components/navigation/Menu/Menu.tsx
408
+ import classnames5 from "classnames";
409
+ import { useCallback } from "react";
410
+
411
+ // src/components/navigation/Menu/menu.module.css
412
+ var menu_default = {
413
+ root: "menu_root",
414
+ medium: "menu_medium",
415
+ small: "menu_small",
416
+ item: "menu_item",
417
+ stateLayer: "menu_stateLayer",
418
+ itemDisabled: "menu_itemDisabled",
419
+ itemSelected: "menu_itemSelected",
420
+ itemIcon: "menu_itemIcon",
421
+ itemTitle: "menu_itemTitle",
422
+ itemDescription: "menu_itemDescription",
423
+ divider: "menu_divider"
424
+ };
425
+
426
+ // src/components/navigation/Menu/Menu.tsx
427
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
428
+ function Menu(props) {
429
+ const { items, size = "medium", classes } = props;
430
+ const handleClick = useCallback(
431
+ (item) => (e) => {
432
+ item?.onClick?.();
433
+ e.currentTarget.blur();
434
+ },
435
+ []
436
+ );
437
+ return /* @__PURE__ */ jsx9("div", { className: classnames5(menu_default.root, menu_default[size], classes?.root), children: items.map(
438
+ (item, index) => item.type === "item" ? /* @__PURE__ */ jsx9(
439
+ "button",
440
+ {
441
+ tabIndex: -10,
442
+ className: classnames5(
443
+ menu_default.item,
444
+ item.selected ? menu_default.itemSelected : void 0,
445
+ item.disabled ? menu_default.itemDisabled : void 0,
446
+ classes?.item,
447
+ item.selected ? classes?.itemSelected : void 0,
448
+ item.disabled ? classes?.itemDisabled : void 0
449
+ ),
450
+ onClick: !item.disabled ? handleClick(item) : void 0,
451
+ title: item.name,
452
+ children: /* @__PURE__ */ jsxs4("span", { className: classnames5(menu_default.stateLayer), children: [
453
+ !!item.icon && /* @__PURE__ */ jsx9(
454
+ "span",
455
+ {
456
+ className: classnames5(
457
+ menu_default.itemIcon,
458
+ classes?.itemIcon,
459
+ item.selected ? classes?.itemSelectedIcon : void 0,
460
+ item.disabled ? classes?.itemDisabledIcon : void 0
461
+ ),
462
+ children: item.icon
463
+ }
464
+ ),
465
+ /* @__PURE__ */ jsx9(
466
+ "span",
467
+ {
468
+ className: classnames5(
469
+ menu_default.itemTitle,
470
+ classes?.itemTitle,
471
+ item.selected ? classes?.itemSelectedTitle : void 0,
472
+ item.disabled ? classes?.itemDisabledTitle : void 0
473
+ ),
474
+ children: item.name
475
+ }
476
+ ),
477
+ !!item.description && /* @__PURE__ */ jsx9(
478
+ "span",
479
+ {
480
+ className: classnames5(
481
+ menu_default.itemDescription,
482
+ classes?.itemDescription,
483
+ item.selected ? classes?.itemSelectedDescription : void 0,
484
+ item.disabled ? classes?.itemDisabledDescription : void 0
485
+ ),
486
+ children: item.description
487
+ }
488
+ )
489
+ ] })
490
+ },
491
+ `menu-item-${item.name}-${index}`
492
+ ) : /* @__PURE__ */ jsx9("div", { className: classnames5(menu_default.divider, classes?.divider), children: item.name }, `menu-divider-${item.name}-${index}`)
493
+ ) });
494
+ }
495
+
496
+ // src/components/common/Select/ui/SelectPopover/SelectPopover.tsx
497
+ import { jsx as jsx10 } from "react/jsx-runtime";
498
+ function SelectPopover(props) {
499
+ const { items, componentSize, selectedValue, changeSelectedItem, classes } = props;
500
+ const popoverContext = useContext4(PopoverContext);
501
+ return /* @__PURE__ */ jsx10(
502
+ Menu,
503
+ {
504
+ size: componentSize,
505
+ classes: classes?.menu,
506
+ items: items.map(
507
+ (i) => i.type === "divider" ? { type: "divider", name: i.name } : {
508
+ type: "item",
509
+ name: i.name,
510
+ icon: i.icon,
511
+ description: i.description,
512
+ disabled: i.disabled,
513
+ selected: i.value === selectedValue,
514
+ onClick: () => {
515
+ changeSelectedItem(i);
516
+ if (popoverContext) {
517
+ popoverContext.setOpen(false);
518
+ }
519
+ }
520
+ }
521
+ )
522
+ }
523
+ );
524
+ }
525
+
526
+ // src/components/common/Select/Select.tsx
527
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
528
+ function Select(props) {
529
+ const {
530
+ variant = "filled",
531
+ componentSize = "medium",
532
+ icon,
533
+ fullWidth,
534
+ label,
535
+ placeholder,
536
+ items,
537
+ defaultValue,
538
+ onValueChange,
539
+ selected,
540
+ classes,
541
+ ref,
542
+ disabled,
543
+ id,
544
+ ...inputProps
545
+ } = props;
546
+ const isLocalState = defaultValue && !selected;
547
+ const [localSelectedItem, setlocalSelectedItem] = useState3(
548
+ isLocalState ? items.find((i) => i.type === "item" && i.value === defaultValue) : void 0
549
+ );
550
+ const selectedItem = isLocalState ? localSelectedItem : selected;
551
+ const inputRef = useRef2(null);
552
+ const popoverTargetRef = useRef2(null);
553
+ const inputClickHandler = useCallback2(
554
+ (e) => {
555
+ e.preventDefault();
556
+ if (!disabled)
557
+ popoverTargetRef?.current?.click();
558
+ },
559
+ [popoverTargetRef]
560
+ );
561
+ const changeSelectedItem = (item) => {
562
+ if (isLocalState)
563
+ setlocalSelectedItem(item);
564
+ onValueChange?.(item);
565
+ };
566
+ useEffect2(() => {
567
+ if (selectedItem) {
568
+ const current = items.find((i) => i.type === "item" && i.value === selectedItem?.value);
569
+ if (!current)
570
+ changeSelectedItem(current);
571
+ }
572
+ }, [items, selectedItem]);
573
+ const inputId = id ?? uuidv42();
574
+ return /* @__PURE__ */ jsxs5(
575
+ "div",
576
+ {
577
+ className: classnames6(select_default.root, select_default[componentSize], classes?.root),
578
+ style: {
579
+ maxWidth: fullWidth ? "100%" : void 0
580
+ },
581
+ children: [
582
+ !!label && /* @__PURE__ */ jsx11(
583
+ Typography,
584
+ {
585
+ className: classnames6(select_default.label, classes?.label),
586
+ component: "label",
587
+ variant: "caption",
588
+ htmlFor: inputId,
589
+ onClick: inputClickHandler,
590
+ children: label
591
+ }
592
+ ),
593
+ /* @__PURE__ */ jsxs5(
594
+ "div",
595
+ {
596
+ className: classnames6(
597
+ select_default.wrapper,
598
+ select_default[variant],
599
+ icon ? select_default.withIcon : void 0,
600
+ selectedItem?.icon ? select_default.withItemIcon : void 0,
601
+ classes?.wrapper
602
+ ),
603
+ children: [
604
+ /* @__PURE__ */ jsx11(
605
+ "input",
606
+ {
607
+ ref: mergeRefs2([inputRef, ref]),
608
+ id: inputId,
609
+ className: classnames6(select_default.input, classes?.input),
610
+ placeholder,
611
+ ...inputProps,
612
+ value: selectedItem?.name ?? "",
613
+ onChange: () => {
614
+ },
615
+ onClick: inputClickHandler,
616
+ disabled
617
+ }
618
+ ),
619
+ !!icon && /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.icon, classes?.icon), children: icon }),
620
+ !!selectedItem?.icon && /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.itemIcon, classes?.itemIcon), children: selectedItem?.icon }),
621
+ /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.arrow, classes?.arrow), children: /* @__PURE__ */ jsx11(Arrow, {}) }),
622
+ /* @__PURE__ */ jsx11(
623
+ Popover,
624
+ {
625
+ placement: "bottom-start",
626
+ classes: {
627
+ content: classnames6(select_default.popoverContent, "styledScroll", classes?.popoverContent),
628
+ ...classes?.popover
629
+ },
630
+ containerOffset: 4,
631
+ description: /* @__PURE__ */ jsx11(
632
+ SelectPopover,
633
+ {
634
+ items,
635
+ classes,
636
+ componentSize,
637
+ selectedValue: selectedItem?.value,
638
+ changeSelectedItem
639
+ }
640
+ ),
641
+ children: /* @__PURE__ */ jsx11("div", { ref: popoverTargetRef, className: classnames6(select_default.popoverTarget) })
642
+ }
643
+ )
644
+ ]
645
+ }
646
+ )
647
+ ]
648
+ }
649
+ );
650
+ }
651
+
652
+ // src/components/common/DateTime/DateTime.tsx
653
+ import classnames7 from "classnames";
654
+ import dayjs2 from "dayjs";
655
+ import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
656
+ import { mergeRefs as mergeRefs3 } from "react-merge-refs";
657
+
658
+ // src/components/common/DateTime/dateTime.module.css
659
+ var dateTime_default = {
660
+ root: "dateTime_root",
661
+ medium: "dateTime_medium",
662
+ small: "dateTime_small",
663
+ input: "dateTime_input",
664
+ filled: "dateTime_filled",
665
+ outlined: "dateTime_outlined",
666
+ icon: "dateTime_icon",
667
+ popoverTarget: "dateTime_popoverTarget"
668
+ };
669
+
670
+ // src/components/common/DateTime/ui/CalendarPopover/CalendarPopover.tsx
671
+ import classNames from "classnames";
672
+ import dayjs from "dayjs";
673
+ import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
674
+
675
+ // src/components/common/DateTime/ui/CalendarPopover/calendarPopover.module.css
676
+ var calendarPopover_default = {
677
+ root: "calendarPopover_root",
678
+ button: "calendarPopover_button",
679
+ navigationContainer: "calendarPopover_navigationContainer",
680
+ navigationArrow: "calendarPopover_navigationArrow",
681
+ navigationValue: "calendarPopover_navigationValue",
682
+ navigationTitle: "calendarPopover_navigationTitle",
683
+ cellsContainer: "calendarPopover_cellsContainer",
684
+ cell: "calendarPopover_cell",
685
+ month: "calendarPopover_month",
686
+ cellData: "calendarPopover_cellData",
687
+ cellCircle: "calendarPopover_cellCircle",
688
+ cellSelection: "calendarPopover_cellSelection",
689
+ cellSelectionFirst: "calendarPopover_cellSelectionFirst",
690
+ cellSelectionLast: "calendarPopover_cellSelectionLast",
691
+ monthCellSelection: "calendarPopover_monthCellSelection"
692
+ };
693
+
694
+ // src/components/common/DateTime/ui/CalendarPopover/CalendarPopover.tsx
695
+ import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
696
+ function CalendarPopover(props) {
697
+ const { componentSize, initStartDate, initEndDate, changeDates, onClear, classes } = props;
698
+ const [viewType, setViewType] = useState4("month");
699
+ const [currentItem, setCurrentItem] = useState4({
700
+ year: dayjs().year(),
701
+ month: dayjs().month()
702
+ });
703
+ const [startDate, setStartDate] = useState4(initStartDate ? dayjs(initStartDate).startOf("D").valueOf() : void 0);
704
+ const [endDate, setEndDate] = useState4(initEndDate ? dayjs(initEndDate).startOf("D").valueOf() : void 0);
705
+ const startDateMonth = useMemo2(() => startDate ? dayjs(startDate).startOf("M").valueOf() : void 0, [startDate]);
706
+ const endDateMonth = useMemo2(() => endDate ? dayjs(endDate).startOf("M").valueOf() : void 0, [endDate]);
707
+ const currentDate = useMemo2(
708
+ () => dayjs(new Date(currentItem.year, currentItem.month, 1)).startOf(viewType === "year" ? "y" : "M"),
709
+ [currentItem, viewType]
710
+ );
711
+ const daysInMonth = currentDate.daysInMonth();
712
+ const firstDayOfWeek = currentDate.startOf("M").day();
713
+ let emptyCellsCount = firstDayOfWeek - 1;
714
+ if (emptyCellsCount < 0) {
715
+ emptyCellsCount = 6;
716
+ }
717
+ useEffect3(() => {
718
+ if (!startDate && !endDate) {
719
+ onClear?.();
720
+ changeDates();
721
+ } else if (!!startDate && !!endDate) {
722
+ changeDates(dayjs(startDate).format(), dayjs(endDate).format());
723
+ }
724
+ }, [startDate, endDate]);
725
+ const changeCurrentItem = useCallback3(
726
+ (count) => () => {
727
+ const tempDate = dayjs(new Date(currentItem.year, currentItem.month, 1)).add(count, viewType);
728
+ setCurrentItem({
729
+ month: tempDate.month(),
730
+ year: tempDate.year()
731
+ });
732
+ },
733
+ [viewType, currentItem]
734
+ );
735
+ const changeViewType = useCallback3(
736
+ (date) => () => {
737
+ if (viewType === "year" && date) {
738
+ setCurrentItem({ month: date.month(), year: date.year() });
739
+ setViewType("month");
740
+ } else {
741
+ setViewType("year");
742
+ }
743
+ },
744
+ [viewType]
745
+ );
746
+ const setDate = useCallback3(
747
+ (cellDate) => () => {
748
+ if (startDate && endDate) {
749
+ if (cellDate === startDate) {
750
+ setStartDate(void 0);
751
+ } else if (cellDate === endDate) {
752
+ setEndDate(void 0);
753
+ } else {
754
+ setStartDate(cellDate);
755
+ setEndDate(void 0);
756
+ }
757
+ } else if (startDate) {
758
+ if (cellDate === startDate) {
759
+ setStartDate(void 0);
760
+ } else if (cellDate < startDate) {
761
+ setEndDate(startDate);
762
+ setStartDate(cellDate);
763
+ } else {
764
+ setEndDate(cellDate);
765
+ }
766
+ } else if (endDate) {
767
+ if (cellDate === endDate) {
768
+ setEndDate(void 0);
769
+ } else if (cellDate < endDate) {
770
+ setStartDate(cellDate);
771
+ } else {
772
+ setStartDate(endDate);
773
+ setEndDate(cellDate);
774
+ }
775
+ } else {
776
+ setStartDate(cellDate);
777
+ }
778
+ },
779
+ [startDate, endDate]
780
+ );
781
+ return /* @__PURE__ */ jsxs6("div", { className: classNames(calendarPopover_default.root, calendarPopover_default[componentSize], classes?.root), children: [
782
+ /* @__PURE__ */ jsxs6("div", { className: classNames(calendarPopover_default.navigationContainer, classes?.navigationContainer), children: [
783
+ /* @__PURE__ */ jsx12(
784
+ "button",
785
+ {
786
+ type: "button",
787
+ className: classNames(calendarPopover_default.button, calendarPopover_default.navigationArrow, classes?.navigationArrow),
788
+ onClick: changeCurrentItem(-1),
789
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon, {})
790
+ }
791
+ ),
792
+ /* @__PURE__ */ jsx12(
793
+ "button",
794
+ {
795
+ type: "button",
796
+ className: classNames(calendarPopover_default.button, calendarPopover_default.navigationValue, classes?.navigationValue),
797
+ onClick: changeViewType(),
798
+ children: /* @__PURE__ */ jsx12(Typography, { variant: "subtitle1", className: classNames(calendarPopover_default.navigationTitle, classes?.navigationTitle), children: viewType === "year" ? currentDate.format("YYYY") : currentDate.format("MMMM YYYY") })
799
+ }
800
+ ),
801
+ /* @__PURE__ */ jsx12(
802
+ "button",
803
+ {
804
+ type: "button",
805
+ className: classNames(calendarPopover_default.button, calendarPopover_default.navigationArrow, classes?.navigationArrow),
806
+ onClick: changeCurrentItem(1),
807
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon, {})
808
+ }
809
+ )
810
+ ] }),
811
+ /* @__PURE__ */ jsx12("div", { className: classNames(calendarPopover_default.cellsContainer, classes?.cellsContainer), children: viewType === "year" ? /* @__PURE__ */ jsx12(Fragment2, { children: [...Array(12)].map((__, index) => {
812
+ const cellDate = currentDate.add(index, "M");
813
+ const cellDateValue = cellDate.valueOf();
814
+ return /* @__PURE__ */ jsxs6(
815
+ "button",
816
+ {
817
+ type: "button",
818
+ className: classNames(calendarPopover_default.button, calendarPopover_default.cell, calendarPopover_default.month, classes?.cell, classes?.month),
819
+ onClick: changeViewType(cellDate),
820
+ children: [
821
+ startDateMonth !== void 0 && endDateMonth !== void 0 && cellDateValue >= startDateMonth && cellDateValue <= endDateMonth && /* @__PURE__ */ jsx12("span", { className: classNames(calendarPopover_default.monthCellSelection, classes?.monthCellSelection) }),
822
+ /* @__PURE__ */ jsx12(Typography, { variant: "subtitle1", className: classNames(calendarPopover_default.cellData, classes?.cellData), children: cellDate.format("MMMM") })
823
+ ]
824
+ },
825
+ `cell-${index}`
826
+ );
827
+ }) }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
828
+ [...Array(emptyCellsCount)].map((__, index) => /* @__PURE__ */ jsx12("div", { className: classNames(calendarPopover_default.cell, classes?.cell) }, `empty-cell-${index}`)),
829
+ [...Array(daysInMonth)].map((__, index) => {
830
+ const cellDate = currentDate.add(index, "d").valueOf();
831
+ return /* @__PURE__ */ jsxs6(
832
+ "button",
833
+ {
834
+ type: "button",
835
+ className: classNames(calendarPopover_default.button, calendarPopover_default.cell, classes?.cell),
836
+ onClick: setDate(cellDate),
837
+ children: [
838
+ (cellDate === startDate || cellDate === endDate) && /* @__PURE__ */ jsx12("span", { className: classNames(calendarPopover_default.cellCircle, classes?.cellCircle) }),
839
+ startDate !== void 0 && endDate !== void 0 && cellDate >= startDate && cellDate <= endDate && /* @__PURE__ */ jsx12(
840
+ "span",
841
+ {
842
+ className: classNames(
843
+ calendarPopover_default.cellSelection,
844
+ classes?.cellSelection,
845
+ cellDate === startDate && calendarPopover_default.cellSelectionFirst,
846
+ cellDate === startDate && classes?.cellSelectionFirst,
847
+ cellDate === endDate && calendarPopover_default.cellSelectionLast,
848
+ cellDate === endDate && classes?.cellSelectionLast
849
+ )
850
+ }
851
+ ),
852
+ /* @__PURE__ */ jsx12(
853
+ Typography,
854
+ {
855
+ variant: "subtitle1",
856
+ className: classNames(calendarPopover_default.cellData, classes?.cellData),
857
+ children: `${index + 1}`
858
+ }
859
+ )
860
+ ]
861
+ },
862
+ `cell-${index}`
863
+ );
864
+ })
865
+ ] }) })
866
+ ] });
867
+ }
868
+
869
+ // src/components/common/DateTime/DateTime.tsx
870
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
871
+ function DateTime(props) {
872
+ const {
873
+ variant = "filled",
874
+ componentSize = "medium",
875
+ fullWidth,
876
+ placeholder,
877
+ defaultValues,
878
+ values,
879
+ onClear,
880
+ onValueChange,
881
+ classes,
882
+ ref,
883
+ ...inputProps
884
+ } = props;
885
+ const [stateValues, setStateValues] = useState5(defaultValues);
886
+ useEffect4(() => {
887
+ setStateValues(values);
888
+ }, values);
889
+ const inputRef = useRef3(null);
890
+ const popoverTargetRef = useRef3(null);
891
+ const inputClickHandler = useCallback4(
892
+ (e) => {
893
+ e.preventDefault();
894
+ popoverTargetRef?.current?.click();
895
+ },
896
+ [popoverTargetRef]
897
+ );
898
+ const changeDates = (newStartDate, newEndDate) => {
899
+ setStateValues([newStartDate, newEndDate]);
900
+ onValueChange?.([newStartDate, newEndDate]);
901
+ };
902
+ return /* @__PURE__ */ jsxs7(
903
+ "div",
904
+ {
905
+ className: classnames7(
906
+ dateTime_default.root,
907
+ dateTime_default[variant],
908
+ dateTime_default[componentSize],
909
+ classes?.root
910
+ ),
911
+ style: {
912
+ maxWidth: fullWidth ? "100%" : void 0
913
+ },
914
+ children: [
915
+ /* @__PURE__ */ jsx13(
916
+ "input",
917
+ {
918
+ ref: mergeRefs3([inputRef, ref]),
919
+ className: classnames7(dateTime_default.input, classes?.input),
920
+ placeholder,
921
+ ...inputProps,
922
+ value: !!stateValues?.[0] ? `${dayjs2(stateValues[0]).format("DD.MM.YYYY")}` + (stateValues[1] ? ` - ${dayjs2(stateValues[1]).format("DD.MM.YYYY")}` : "") : "",
923
+ onChange: () => {
924
+ },
925
+ onClick: inputClickHandler
926
+ }
927
+ ),
928
+ /* @__PURE__ */ jsx13("span", { onClick: inputClickHandler, className: classnames7(dateTime_default.icon, classes?.icon), children: /* @__PURE__ */ jsx13(DateRangeIcon, {}) }),
929
+ /* @__PURE__ */ jsx13(
930
+ Popover,
931
+ {
932
+ placement: "bottom-start",
933
+ classes: classes?.popover,
934
+ containerOffset: 4,
935
+ description: /* @__PURE__ */ jsx13(
936
+ CalendarPopover,
937
+ {
938
+ classes,
939
+ componentSize,
940
+ initStartDate: stateValues?.[0],
941
+ initEndDate: stateValues?.[1],
942
+ changeDates,
943
+ onClear
944
+ }
945
+ ),
946
+ children: /* @__PURE__ */ jsx13("div", { ref: popoverTargetRef, className: classnames7(dateTime_default.popoverTarget) })
947
+ }
948
+ )
949
+ ]
950
+ }
951
+ );
952
+ }
953
+
954
+ // src/components/common/ColorPicker/ColorPicker.tsx
955
+ import classNames2 from "classnames";
956
+ import { useCallback as useCallback5, useRef as useRef4, useState as useState6 } from "react";
957
+ import { HexColorPicker } from "react-colorful";
958
+ import { mergeRefs as mergeRefs4 } from "react-merge-refs";
959
+ import { v4 as uuidv43 } from "uuid";
960
+
961
+ // src/components/common/ColorPicker/colorPicker.module.css
962
+ var colorPicker_default = {
963
+ root: "colorPicker_root",
964
+ medium: "colorPicker_medium",
965
+ small: "colorPicker_small",
966
+ label: "colorPicker_label",
967
+ wrapper: "colorPicker_wrapper",
968
+ input: "colorPicker_input",
969
+ icon: "colorPicker_icon",
970
+ outlined: "colorPicker_outlined",
971
+ arrow: "colorPicker_arrow",
972
+ popoverTarget: "colorPicker_popoverTarget",
973
+ popoverContent: "colorPicker_popoverContent"
974
+ };
975
+
976
+ // src/components/common/ColorPicker/ColorPicker.tsx
977
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
978
+ var ColorPicker = (props) => {
979
+ const {
980
+ variant = "outlined",
981
+ componentSize = "medium",
982
+ fullWidth,
983
+ label,
984
+ classes,
985
+ placeholder,
986
+ ref,
987
+ disabled,
988
+ defaultValue,
989
+ id,
990
+ onValueChange,
991
+ ...inputProps
992
+ } = props;
993
+ const [color, setColor] = useState6(defaultValue?.toString() ?? "#AABBCC");
994
+ const inputRef = useRef4(null);
995
+ const popoverTargetRef = useRef4(null);
996
+ const changeColorHandler = useCallback5((newColor) => {
997
+ setColor(newColor.toUpperCase());
998
+ onValueChange?.(newColor.toUpperCase());
999
+ }, []);
1000
+ const inputClickHandler = useCallback5(
1001
+ (e) => {
1002
+ e.preventDefault();
1003
+ if (!disabled)
1004
+ popoverTargetRef?.current?.click();
1005
+ },
1006
+ [popoverTargetRef]
1007
+ );
1008
+ const inputId = id ?? uuidv43();
1009
+ return /* @__PURE__ */ jsxs8(
1010
+ "div",
1011
+ {
1012
+ className: classNames2(colorPicker_default.root, colorPicker_default[componentSize], classes?.root),
1013
+ style: {
1014
+ maxWidth: fullWidth ? "100%" : void 0
1015
+ },
1016
+ children: [
1017
+ !!label && /* @__PURE__ */ jsx14(
1018
+ Typography,
1019
+ {
1020
+ className: classNames2(colorPicker_default.label, classes?.label),
1021
+ component: "label",
1022
+ variant: "caption",
1023
+ htmlFor: inputId,
1024
+ onClick: inputClickHandler,
1025
+ children: label
1026
+ }
1027
+ ),
1028
+ /* @__PURE__ */ jsxs8("div", { className: classNames2(colorPicker_default.wrapper, colorPicker_default[variant], classes?.wrapper), children: [
1029
+ /* @__PURE__ */ jsx14(
1030
+ "input",
1031
+ {
1032
+ ref: mergeRefs4([inputRef, ref]),
1033
+ id: inputId,
1034
+ className: classNames2(colorPicker_default.input, classes?.input),
1035
+ placeholder,
1036
+ ...inputProps,
1037
+ value: color,
1038
+ onChange: () => {
1039
+ },
1040
+ onClick: inputClickHandler,
1041
+ disabled
1042
+ }
1043
+ ),
1044
+ /* @__PURE__ */ jsx14(
1045
+ "span",
1046
+ {
1047
+ onClick: inputClickHandler,
1048
+ className: classNames2(colorPicker_default.icon, classes?.icon),
1049
+ style: { backgroundColor: color }
1050
+ }
1051
+ ),
1052
+ /* @__PURE__ */ jsx14("span", { onClick: inputClickHandler, className: classNames2(colorPicker_default.arrow, classes?.arrow), children: /* @__PURE__ */ jsx14(Arrow, {}) }),
1053
+ /* @__PURE__ */ jsx14(
1054
+ Popover,
1055
+ {
1056
+ placement: "bottom-start",
1057
+ classes: {
1058
+ content: classNames2(colorPicker_default.popoverContent, "styledScroll", classes?.popoverContent),
1059
+ ...classes?.popover
1060
+ },
1061
+ containerOffset: 4,
1062
+ description: /* @__PURE__ */ jsx14(HexColorPicker, { color, onChange: changeColorHandler }),
1063
+ children: /* @__PURE__ */ jsx14("div", { ref: popoverTargetRef, className: classNames2(colorPicker_default.popoverTarget) })
1064
+ }
1065
+ )
1066
+ ] })
1067
+ ]
1068
+ }
1069
+ );
1070
+ };
1071
+
1072
+ // src/components/common/Input/Input.tsx
1073
+ import classnames8 from "classnames";
1074
+ import { useRef as useRef5 } from "react";
1075
+ import { mergeRefs as mergeRefs5 } from "react-merge-refs";
1076
+ import { v4 as uuidv44 } from "uuid";
1077
+
1078
+ // src/components/common/Input/input.module.css
1079
+ var input_default = {
1080
+ root: "input_root",
1081
+ medium: "input_medium",
1082
+ small: "input_small",
1083
+ label: "input_label",
1084
+ wrapper: "input_wrapper",
1085
+ input: "input_input",
1086
+ outlined: "input_outlined"
1087
+ };
1088
+
1089
+ // src/components/common/Input/Input.tsx
1090
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1091
+ var Input = (props) => {
1092
+ const {
1093
+ variant = "outlined",
1094
+ componentSize = "medium",
1095
+ fullWidth,
1096
+ label,
1097
+ classes,
1098
+ placeholder,
1099
+ ref,
1100
+ id,
1101
+ ...inputProps
1102
+ } = props;
1103
+ const inputRef = useRef5(null);
1104
+ const inputId = id ?? uuidv44();
1105
+ return /* @__PURE__ */ jsxs9(
1106
+ "div",
1107
+ {
1108
+ className: classnames8(input_default.root, input_default[componentSize], classes?.root),
1109
+ style: {
1110
+ maxWidth: fullWidth ? "100%" : void 0
1111
+ },
1112
+ children: [
1113
+ !!label && /* @__PURE__ */ jsx15(
1114
+ Typography,
1115
+ {
1116
+ className: classnames8(input_default.label, classes?.label),
1117
+ component: "label",
1118
+ variant: "caption",
1119
+ htmlFor: inputId,
1120
+ children: label
1121
+ }
1122
+ ),
1123
+ /* @__PURE__ */ jsx15("div", { className: classnames8(input_default.wrapper, input_default[variant], classes?.wrapper), children: /* @__PURE__ */ jsx15(
1124
+ "input",
1125
+ {
1126
+ ref: mergeRefs5([inputRef, ref]),
1127
+ id: inputId,
1128
+ className: classnames8(input_default.input, classes?.input),
1129
+ placeholder,
1130
+ autoComplete: "off",
1131
+ ...inputProps
1132
+ }
1133
+ ) })
1134
+ ]
1135
+ }
1136
+ );
1137
+ };
1138
+
1139
+ // src/components/common/SearchInput/SearchInput.tsx
1140
+ import classnames9 from "classnames";
1141
+ import { useRef as useRef6 } from "react";
1142
+ import { mergeRefs as mergeRefs6 } from "react-merge-refs";
1143
+
1144
+ // src/components/common/SearchInput/searchInput.module.css
1145
+ var searchInput_default = {
1146
+ root: "searchInput_root",
1147
+ medium: "searchInput_medium",
1148
+ small: "searchInput_small",
1149
+ input: "searchInput_input",
1150
+ withIcon: "searchInput_withIcon",
1151
+ icon: "searchInput_icon",
1152
+ filled: "searchInput_filled",
1153
+ outlined: "searchInput_outlined"
1154
+ };
1155
+
1156
+ // src/components/common/SearchInput/SearchInput.tsx
1157
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1158
+ function SearchInput(props) {
1159
+ const {
1160
+ variant = "filled",
1161
+ componentSize = "medium",
1162
+ disableIcon,
1163
+ fullWidth,
1164
+ placeholder,
1165
+ classes,
1166
+ ref,
1167
+ ...inputProps
1168
+ } = props;
1169
+ const { t } = useTranslation();
1170
+ const inputRef = useRef6(null);
1171
+ return /* @__PURE__ */ jsxs10(
1172
+ "div",
1173
+ {
1174
+ className: classnames9(
1175
+ searchInput_default.root,
1176
+ searchInput_default[variant],
1177
+ searchInput_default[componentSize],
1178
+ !disableIcon ? searchInput_default.withIcon : void 0,
1179
+ classes?.root
1180
+ ),
1181
+ style: {
1182
+ maxWidth: fullWidth ? "100%" : void 0
1183
+ },
1184
+ children: [
1185
+ !disableIcon && /* @__PURE__ */ jsx16(
1186
+ "span",
1187
+ {
1188
+ className: classnames9(searchInput_default.icon, classes?.icon),
1189
+ onClick: () => {
1190
+ inputRef.current?.focus();
1191
+ },
1192
+ children: /* @__PURE__ */ jsx16(SearchIcon, {})
1193
+ }
1194
+ ),
1195
+ /* @__PURE__ */ jsx16(
1196
+ "input",
1197
+ {
1198
+ ref: mergeRefs6([inputRef, ref]),
1199
+ className: classnames9(searchInput_default.input, classes?.input),
1200
+ placeholder: placeholder ?? t("\u041F\u043E\u0438\u0441\u043A..."),
1201
+ ...inputProps
1202
+ }
1203
+ )
1204
+ ]
1205
+ }
1206
+ );
1207
+ }
1208
+
1209
+ // src/components/common/WrapForLabel/WrapForLabel.tsx
1210
+ import classnames10 from "classnames";
1211
+
1212
+ // src/components/common/WrapForLabel/wrapForLabel.module.css
1213
+ var wrapForLabel_default = {
1214
+ root: "wrapForLabel_root",
1215
+ medium: "wrapForLabel_medium",
1216
+ small: "wrapForLabel_small"
1217
+ };
1218
+
1219
+ // src/components/common/WrapForLabel/WrapForLabel.tsx
1220
+ import { jsx as jsx17 } from "react/jsx-runtime";
1221
+ var WrapForLabel = (props) => {
1222
+ const { componentSize = "medium", children, classes } = props;
1223
+ return /* @__PURE__ */ jsx17("div", { className: classnames10(wrapForLabel_default.root, wrapForLabel_default[componentSize], classes?.root), children });
1224
+ };
1225
+
1226
+ // src/components/common/MultiSelect/MultiSelect.tsx
1227
+ import classnames11 from "classnames";
1228
+ import { useCallback as useCallback6, useMemo as useMemo3, useRef as useRef7 } from "react";
1229
+ import { mergeRefs as mergeRefs7 } from "react-merge-refs";
1230
+ import { v4 as uuidv45 } from "uuid";
1231
+
1232
+ // src/components/common/MultiSelect/multiSelect.module.css
1233
+ var multiSelect_default = {
1234
+ root: "multiSelect_root",
1235
+ medium: "multiSelect_medium",
1236
+ small: "multiSelect_small",
1237
+ label: "multiSelect_label",
1238
+ wrapper: "multiSelect_wrapper",
1239
+ input: "multiSelect_input",
1240
+ withIcon: "multiSelect_withIcon",
1241
+ withItemIcon: "multiSelect_withItemIcon",
1242
+ icon: "multiSelect_icon",
1243
+ itemIcon: "multiSelect_itemIcon",
1244
+ filled: "multiSelect_filled",
1245
+ outlined: "multiSelect_outlined",
1246
+ clear: "multiSelect_clear",
1247
+ arrow: "multiSelect_arrow",
1248
+ popoverTarget: "multiSelect_popoverTarget",
1249
+ popoverContent: "multiSelect_popoverContent"
1250
+ };
1251
+
1252
+ // src/components/common/MultiSelect/ui/SelectPopover/SelectPopover.tsx
1253
+ import { jsx as jsx18 } from "react/jsx-runtime";
1254
+ function SelectPopover2(props) {
1255
+ const { items, componentSize, selected, changeSelectedItem, classes } = props;
1256
+ return /* @__PURE__ */ jsx18(
1257
+ Menu,
1258
+ {
1259
+ size: componentSize,
1260
+ classes: classes?.menu,
1261
+ items: items.map(
1262
+ (i) => ({
1263
+ type: "item",
1264
+ name: i.name,
1265
+ description: i.description,
1266
+ disabled: i.disabled,
1267
+ selected: selected?.includes(i.value),
1268
+ onClick: () => {
1269
+ changeSelectedItem(i);
1270
+ }
1271
+ })
1272
+ )
1273
+ }
1274
+ );
1275
+ }
1276
+
1277
+ // src/components/common/MultiSelect/utils/getTitle.ts
1278
+ var getTitle = (titleType, activeItems) => {
1279
+ const { t } = useTranslation();
1280
+ switch (titleType) {
1281
+ case "allValue": {
1282
+ return activeItems.map((i) => i.name).join(", ");
1283
+ }
1284
+ case "numberValue": {
1285
+ return `${t("\u0412\u044B\u0431\u0440\u0430\u043D\u043E \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432")}: ` + activeItems.length;
1286
+ }
1287
+ case "firstValue": {
1288
+ return `${activeItems[0]?.name} ${activeItems.length > 1 ? " +" + (activeItems.length - 1) : ""}`;
1289
+ }
1290
+ }
1291
+ };
1292
+
1293
+ // src/components/common/MultiSelect/MultiSelect.tsx
1294
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
1295
+ function MultiSelect(props) {
1296
+ const {
1297
+ variant = "filled",
1298
+ componentSize = "medium",
1299
+ icon,
1300
+ fullWidth,
1301
+ label,
1302
+ placeholder,
1303
+ items,
1304
+ onValueChange,
1305
+ selected,
1306
+ classes,
1307
+ ref,
1308
+ disabled,
1309
+ id,
1310
+ titleType = "allValue",
1311
+ ...inputProps
1312
+ } = props;
1313
+ const inputRef = useRef7(null);
1314
+ const popoverTargetRef = useRef7(null);
1315
+ const activeItems = useMemo3(() => items.filter((i) => selected?.includes(i.value)), [selected, items]);
1316
+ const inputClickHandler = useCallback6(
1317
+ (e) => {
1318
+ e.preventDefault();
1319
+ if (!disabled)
1320
+ popoverTargetRef?.current?.click();
1321
+ },
1322
+ [popoverTargetRef]
1323
+ );
1324
+ const changeSelectedItem = (item) => {
1325
+ const newValue = selected ?? [];
1326
+ if (newValue.includes(item.value)) {
1327
+ onValueChange?.(newValue.filter((v) => v !== item.value));
1328
+ } else {
1329
+ onValueChange?.([...newValue, item.value]);
1330
+ }
1331
+ };
1332
+ const title = useMemo3(() => {
1333
+ if (!activeItems.length)
1334
+ return "";
1335
+ return getTitle(titleType, activeItems);
1336
+ }, [titleType, activeItems.length]);
1337
+ const clearHandler = () => {
1338
+ onValueChange?.(null);
1339
+ };
1340
+ const inputId = id ?? uuidv45();
1341
+ return /* @__PURE__ */ jsxs11(
1342
+ "div",
1343
+ {
1344
+ className: classnames11(multiSelect_default.root, multiSelect_default[componentSize], classes?.root),
1345
+ style: {
1346
+ maxWidth: fullWidth ? "100%" : void 0
1347
+ },
1348
+ children: [
1349
+ !!label && /* @__PURE__ */ jsx19(
1350
+ Typography,
1351
+ {
1352
+ className: classnames11(multiSelect_default.label, classes?.label),
1353
+ component: "label",
1354
+ variant: "caption",
1355
+ htmlFor: inputId,
1356
+ onClick: inputClickHandler,
1357
+ children: label
1358
+ }
1359
+ ),
1360
+ /* @__PURE__ */ jsxs11(
1361
+ "div",
1362
+ {
1363
+ className: classnames11(
1364
+ multiSelect_default.wrapper,
1365
+ multiSelect_default[variant],
1366
+ icon ? multiSelect_default.withIcon : void 0,
1367
+ classes?.wrapper
1368
+ ),
1369
+ children: [
1370
+ /* @__PURE__ */ jsx19(
1371
+ "input",
1372
+ {
1373
+ ref: mergeRefs7([inputRef, ref]),
1374
+ id: inputId,
1375
+ className: classnames11(multiSelect_default.input, classes?.input),
1376
+ placeholder,
1377
+ ...inputProps,
1378
+ value: title,
1379
+ onClick: inputClickHandler,
1380
+ disabled,
1381
+ title: activeItems.map((i) => i.name).join(", ")
1382
+ }
1383
+ ),
1384
+ !!icon && /* @__PURE__ */ jsx19("span", { onClick: inputClickHandler, className: classnames11(multiSelect_default.icon, classes?.icon), children: icon }),
1385
+ !!activeItems.length && /* @__PURE__ */ jsx19("span", { onClick: clearHandler, className: classnames11(multiSelect_default.clear, classes?.clear), children: /* @__PURE__ */ jsx19(CloseIcon, {}) }),
1386
+ /* @__PURE__ */ jsx19("span", { onClick: inputClickHandler, className: classnames11(multiSelect_default.arrow, classes?.arrow), children: /* @__PURE__ */ jsx19(Arrow, {}) }),
1387
+ /* @__PURE__ */ jsx19(
1388
+ Popover,
1389
+ {
1390
+ placement: "bottom-start",
1391
+ classes: {
1392
+ content: classnames11(multiSelect_default.popoverContent, "styledScroll", classes?.popoverContent),
1393
+ ...classes?.popover
1394
+ },
1395
+ containerOffset: 4,
1396
+ description: /* @__PURE__ */ jsx19(
1397
+ SelectPopover2,
1398
+ {
1399
+ items,
1400
+ classes,
1401
+ componentSize,
1402
+ selected,
1403
+ changeSelectedItem
1404
+ }
1405
+ ),
1406
+ children: /* @__PURE__ */ jsx19("div", { ref: popoverTargetRef, className: classnames11(multiSelect_default.popoverTarget) })
1407
+ }
1408
+ )
1409
+ ]
1410
+ }
1411
+ )
1412
+ ]
1413
+ }
1414
+ );
1415
+ }
1416
+
1417
+ // src/components/common/Checklist/Checklist.tsx
1418
+ import classnames12 from "classnames";
1419
+ import { useState as useState7 } from "react";
1420
+
1421
+ // src/components/common/Checklist/checklist.module.css
1422
+ var checklist_default = {
1423
+ root: "checklist_root",
1424
+ scrolled: "checklist_scrolled",
1425
+ actionWrap: "checklist_actionWrap"
1426
+ };
1427
+
1428
+ // src/components/common/Checklist/utils/filterItems.ts
1429
+ var filterItems = (items, filterText, selectedItems) => {
1430
+ if (!filterText) {
1431
+ return items.filter((item) => !selectedItems[item.value]);
1432
+ }
1433
+ const reduceCallback = (filteredItems, item) => {
1434
+ if (item.name.toUpperCase().includes(filterText.toUpperCase()) && !selectedItems[item.value]) {
1435
+ filteredItems.push({ ...item });
1436
+ }
1437
+ return filteredItems;
1438
+ };
1439
+ return items.reduce(reduceCallback, []);
1440
+ };
1441
+
1442
+ // src/components/common/Checklist/Checklist.tsx
1443
+ import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
1444
+ function Checklist(props) {
1445
+ const { items, selected, disableSearch, isDisabled, actionWithSelected, onChangeItem, classes } = props;
1446
+ const { t } = useTranslation();
1447
+ const [filterSubstring, setFilterSubstring] = useState7("");
1448
+ const [selectedItems, setSelectedItems] = useState7(selected);
1449
+ const filteredItems = filterItems(items, filterSubstring, selectedItems);
1450
+ const handleClick = (item) => {
1451
+ const value = !selected[item.value];
1452
+ if (onChangeItem) {
1453
+ onChangeItem?.(item);
1454
+ }
1455
+ const newSelected = { ...selected, [item.value]: value };
1456
+ setSelectedItems(newSelected);
1457
+ actionWithSelected(newSelected);
1458
+ };
1459
+ const onSelectAll = () => {
1460
+ let newSelected = { ...selected };
1461
+ filteredItems.forEach((item) => {
1462
+ newSelected = { ...newSelected, [item.value]: true };
1463
+ });
1464
+ setSelectedItems(newSelected);
1465
+ actionWithSelected(newSelected);
1466
+ };
1467
+ const onUnSelectAll = () => {
1468
+ const newSelected = {};
1469
+ setSelectedItems(newSelected);
1470
+ actionWithSelected(newSelected);
1471
+ };
1472
+ return /* @__PURE__ */ jsxs12("div", { className: classnames12(checklist_default.root, classes?.root), children: [
1473
+ !disableSearch && /* @__PURE__ */ jsx20(
1474
+ SearchInput,
1475
+ {
1476
+ variant: "outlined",
1477
+ disabled: isDisabled,
1478
+ value: filterSubstring,
1479
+ fullWidth: true,
1480
+ classes: classes?.searchInput,
1481
+ onChange: (e) => setFilterSubstring(e.target.value)
1482
+ }
1483
+ ),
1484
+ /* @__PURE__ */ jsxs12("div", { className: classnames12(checklist_default.scrolled, "styledScroll"), children: [
1485
+ items.some((item) => !!selectedItems[item.value]) && /* @__PURE__ */ jsxs12(Fragment3, { children: [
1486
+ /* @__PURE__ */ jsxs12("div", { className: classnames12(checklist_default.actionWrap, classes?.actionWrap), children: [
1487
+ /* @__PURE__ */ jsx20(Typography, { className: classnames12(classes?.typography), children: t("\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0435") }),
1488
+ /* @__PURE__ */ jsx20(
1489
+ Button,
1490
+ {
1491
+ variant: "link",
1492
+ size: "small",
1493
+ disabled: isDisabled,
1494
+ onClick: onUnSelectAll,
1495
+ className: classnames12(classes?.button),
1496
+ children: t("\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C")
1497
+ }
1498
+ )
1499
+ ] }),
1500
+ /* @__PURE__ */ jsx20("div", { children: items.filter((item) => !!selectedItems[item.value]).map((item) => /* @__PURE__ */ jsx20(
1501
+ Checkbox,
1502
+ {
1503
+ label: item.name,
1504
+ defaultChecked: !!selected[item.value],
1505
+ onClick: (e) => {
1506
+ e.stopPropagation();
1507
+ handleClick(item);
1508
+ },
1509
+ disabled: isDisabled,
1510
+ classes: classes?.checkbox
1511
+ },
1512
+ `selected-${item.value}`
1513
+ )) })
1514
+ ] }),
1515
+ !isDisabled && !!filteredItems.length && /* @__PURE__ */ jsx20(
1516
+ Button,
1517
+ {
1518
+ variant: "link",
1519
+ size: "small",
1520
+ disabled: isDisabled,
1521
+ onClick: onSelectAll,
1522
+ className: classnames12(classes?.button),
1523
+ children: t("\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435")
1524
+ }
1525
+ ),
1526
+ /* @__PURE__ */ jsx20("div", { children: filteredItems.map((item) => /* @__PURE__ */ jsx20(
1527
+ Checkbox,
1528
+ {
1529
+ label: item.name,
1530
+ defaultChecked: !!selected[item.value],
1531
+ onClick: (e) => {
1532
+ e.stopPropagation();
1533
+ handleClick(item);
1534
+ },
1535
+ disabled: isDisabled,
1536
+ classes: classes?.checkbox
1537
+ },
1538
+ `filtered-${item.value}`
1539
+ )) })
1540
+ ] })
1541
+ ] });
1542
+ }
1543
+
1544
+ // src/components/common/ButtonsGroup/ButtonsGroup.tsx
1545
+ import classNames3 from "classnames";
1546
+
1547
+ // src/components/common/ButtonsGroup/buttonsGroup.module.css
1548
+ var buttonsGroup_default = {
1549
+ root: "buttonsGroup_root"
1550
+ };
1551
+
1552
+ // src/components/common/ButtonsGroup/ButtonsGroup.tsx
1553
+ import { jsx as jsx21 } from "react/jsx-runtime";
1554
+ var ButtonsGroup = (props) => {
1555
+ const { children, classes } = props;
1556
+ return /* @__PURE__ */ jsx21("div", { className: classNames3(buttonsGroup_default.root, classes?.root), children });
1557
+ };
1558
+
1559
+ // src/components/layout/Surface/Surface.tsx
1560
+ import classnames13 from "classnames";
1561
+
1562
+ // src/components/layout/Surface/surface.module.css
1563
+ var surface_default = {
1564
+ root: "surface_root",
1565
+ primary: "surface_primary",
1566
+ panel: "surface_panel",
1567
+ modal: "surface_modal"
1568
+ };
1569
+
1570
+ // src/components/layout/Surface/Surface.tsx
1571
+ import { jsx as jsx22 } from "react/jsx-runtime";
1572
+ function Surface(props) {
1573
+ const { type = "primary", children, classes } = props;
1574
+ return /* @__PURE__ */ jsx22("div", { className: classnames13(surface_default.root, classes?.root, surface_default[type]), children });
1575
+ }
1576
+
1577
+ // src/components/layout/Layout/Layout.tsx
1578
+ import classnames14 from "classnames";
1579
+
1580
+ // src/components/layout/Layout/layout.module.css
1581
+ var layout_default = {
1582
+ root: "layout_root",
1583
+ withHeader: "layout_withHeader"
1584
+ };
1585
+
1586
+ // src/components/layout/Layout/Layout.tsx
1587
+ import { jsx as jsx23 } from "react/jsx-runtime";
1588
+ function Layout(props) {
1589
+ const { withoutHeader, children, classes } = props;
1590
+ return /* @__PURE__ */ jsx23("div", { className: classnames14(layout_default.root, !withoutHeader ? layout_default.withHeader : void 0, classes?.root), children });
1591
+ }
1592
+
1593
+ // src/components/navigation/Tabs/Tabs.tsx
1594
+ import classnames15 from "classnames";
1595
+ import { useEffect as useEffect5, useState as useState8 } from "react";
1596
+
1597
+ // src/components/navigation/Tabs/tabs.module.css
1598
+ var tabs_default = {
1599
+ root: "tabs_root",
1600
+ tab: "tabs_tab",
1601
+ tabTitle: "tabs_tabTitle",
1602
+ tabBorder: "tabs_tabBorder",
1603
+ selected: "tabs_selected"
1604
+ };
1605
+
1606
+ // src/components/navigation/Tabs/Tabs.tsx
1607
+ import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
1608
+ function Tabs(props) {
1609
+ const { items, defaultSelected, onChange, classes } = props;
1610
+ const [isMounted, setIsMounted] = useState8(false);
1611
+ const [selectedTab, setSelectedTab] = useState8(defaultSelected);
1612
+ const handleClick = (newValue) => () => {
1613
+ setSelectedTab(newValue);
1614
+ };
1615
+ useEffect5(() => {
1616
+ if (isMounted && !!selectedTab) {
1617
+ onChange?.(selectedTab);
1618
+ }
1619
+ if (!isMounted) {
1620
+ setIsMounted(true);
1621
+ }
1622
+ }, [selectedTab]);
1623
+ return /* @__PURE__ */ jsx24("div", { className: classnames15(tabs_default.root, classes?.root), children: items.map((item) => /* @__PURE__ */ jsxs13(
1624
+ "div",
1625
+ {
1626
+ className: classnames15(
1627
+ tabs_default.tab,
1628
+ selectedTab === item.value ? tabs_default.selected : void 0,
1629
+ classes?.tab,
1630
+ selectedTab === item.value ? classes?.tabSelected : void 0
1631
+ ),
1632
+ onClick: handleClick(item.value),
1633
+ children: [
1634
+ /* @__PURE__ */ jsx24(
1635
+ "div",
1636
+ {
1637
+ className: classnames15(
1638
+ tabs_default.tabTitle,
1639
+ classes?.tabTitle,
1640
+ selectedTab === item.value ? classes?.tabSelectedTitle : void 0
1641
+ ),
1642
+ children: /* @__PURE__ */ jsx24("span", { title: item.name, children: item.name })
1643
+ }
1644
+ ),
1645
+ /* @__PURE__ */ jsx24(
1646
+ "div",
1647
+ {
1648
+ className: classnames15(
1649
+ tabs_default.tabBorder,
1650
+ classes?.tabBorder,
1651
+ selectedTab === item.value ? classes?.tabSelectedBorder : void 0
1652
+ )
1653
+ }
1654
+ )
1655
+ ]
1656
+ },
1657
+ `tab-${item.value}`
1658
+ )) });
1659
+ }
1660
+
1661
+ // src/components/view/VirtualTable/VirtualTable.tsx
1662
+ import { flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table";
1663
+ import { useVirtualizer } from "@tanstack/react-virtual";
1664
+ import classnames21 from "classnames";
1665
+ import { Fragment as Fragment6, useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef10, useState as useState13 } from "react";
1666
+
1667
+ // src/components/view/Tooltip/Tooltip.tsx
1668
+ import classnames17 from "classnames";
1669
+ import { useRef as useRef8, useState as useState10 } from "react";
1670
+
1671
+ // src/components/view/Tooltip/tooltip.module.css
1672
+ var tooltip_default = {
1673
+ trigger: "tooltip_trigger",
1674
+ content: "tooltip_content",
1675
+ success: "tooltip_success",
1676
+ warning: "tooltip_warning",
1677
+ error: "tooltip_error",
1678
+ info: "tooltip_info",
1679
+ arrow: "tooltip_arrow",
1680
+ "top-arrow": "tooltip_top-arrow",
1681
+ "bottom-arrow": "tooltip_bottom-arrow",
1682
+ "left-arrow": "tooltip_left-arrow",
1683
+ "right-arrow": "tooltip_right-arrow"
1684
+ };
1685
+
1686
+ // src/components/view/Tooltip/ui/TooltipContent/TooltipContent.tsx
1687
+ import { FloatingPortal as FloatingPortal2, useMergeRefs as useMergeRefs3 } from "@floating-ui/react";
1688
+ import classnames16 from "classnames";
1689
+ import { forwardRef as forwardRef5, useContext as useContext5 } from "react";
1690
+
1691
+ // src/components/view/Tooltip/ui/TooltipProvider/constants/TooltipContext.ts
1692
+ import { createContext as createContext2 } from "react";
1693
+ var TooltipContext = createContext2(null);
1694
+
1695
+ // src/components/view/Tooltip/ui/TooltipContent/TooltipContent.tsx
1696
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
1697
+ var TooltipContent = forwardRef5(function TooltipContent2({ style, children, ...props }, propRef) {
1698
+ const context = useContext5(TooltipContext);
1699
+ if (!context) {
1700
+ return null;
1701
+ }
1702
+ const ref = useMergeRefs3([context.refs.setFloating, propRef]);
1703
+ if (!context.open)
1704
+ return null;
1705
+ let arrowClassName = "";
1706
+ let invertX = null;
1707
+ let invertY = null;
1708
+ switch (context.placement) {
1709
+ case "top":
1710
+ case "top-end":
1711
+ case "top-start":
1712
+ arrowClassName = "top-arrow";
1713
+ invertY = false;
1714
+ break;
1715
+ case "bottom":
1716
+ case "bottom-end":
1717
+ case "bottom-start":
1718
+ arrowClassName = "bottom-arrow";
1719
+ invertY = true;
1720
+ break;
1721
+ case "left":
1722
+ case "left-end":
1723
+ case "left-start":
1724
+ arrowClassName = "left-arrow";
1725
+ invertX = true;
1726
+ break;
1727
+ case "right":
1728
+ case "right-end":
1729
+ case "right-start":
1730
+ arrowClassName = "right-arrow";
1731
+ invertX = false;
1732
+ break;
1733
+ default:
1734
+ break;
1735
+ }
1736
+ return /* @__PURE__ */ jsx25(FloatingPortal2, { children: /* @__PURE__ */ jsxs14(
1737
+ "div",
1738
+ {
1739
+ ref,
1740
+ style: {
1741
+ ...context.floatingStyles,
1742
+ ...style
1743
+ },
1744
+ ...context.getFloatingProps(props),
1745
+ children: [
1746
+ children,
1747
+ !context.withoutArrow && /* @__PURE__ */ jsx25(
1748
+ "div",
1749
+ {
1750
+ className: classnames16("arrow", arrowClassName),
1751
+ ref: context.arrowRef,
1752
+ style: {
1753
+ position: "absolute",
1754
+ left: invertY === null && invertX === false ? 0 : context.middlewareData.arrow?.x,
1755
+ right: invertY === null && invertX === true ? 0 : context.middlewareData.arrow?.x,
1756
+ top: invertX === null && invertY === true ? 0 : context.middlewareData.arrow?.y,
1757
+ bottom: invertX === null && invertY === false ? 0 : context.middlewareData.arrow?.y
1758
+ }
1759
+ }
1760
+ )
1761
+ ]
1762
+ }
1763
+ ) });
1764
+ });
1765
+
1766
+ // src/components/view/Tooltip/ui/TooltipProvider/hooks/useTooltip.ts
1767
+ import {
1768
+ arrow,
1769
+ autoUpdate as autoUpdate2,
1770
+ flip as flip2,
1771
+ offset as offset2,
1772
+ shift as shift2,
1773
+ useDismiss as useDismiss2,
1774
+ useFloating as useFloating2,
1775
+ useFocus,
1776
+ useHover,
1777
+ useInteractions as useInteractions2,
1778
+ useRole as useRole2
1779
+ } from "@floating-ui/react";
1780
+ import { useMemo as useMemo4, useState as useState9 } from "react";
1781
+ function useTooltip(props = {}) {
1782
+ const {
1783
+ initialOpen = false,
1784
+ placement = "top",
1785
+ open: controlledOpen,
1786
+ onOpenChange: setControlledOpen,
1787
+ withoutArrow,
1788
+ arrowRef
1789
+ } = props;
1790
+ const [uncontrolledOpen, setUncontrolledOpen] = useState9(initialOpen);
1791
+ const open = controlledOpen ?? uncontrolledOpen;
1792
+ const setOpen = setControlledOpen ?? setUncontrolledOpen;
1793
+ const data = useFloating2({
1794
+ placement,
1795
+ open,
1796
+ onOpenChange: setOpen,
1797
+ whileElementsMounted: autoUpdate2,
1798
+ middleware: [
1799
+ offset2(12),
1800
+ flip2({
1801
+ crossAxis: placement.includes("-"),
1802
+ fallbackAxisSideDirection: "start",
1803
+ padding: 5
1804
+ }),
1805
+ shift2({ padding: 5 }),
1806
+ ...!withoutArrow && arrowRef?.current ? [arrow({ element: arrowRef })] : []
1807
+ ]
1808
+ });
1809
+ const { context } = data;
1810
+ const hover = useHover(context, {
1811
+ move: false,
1812
+ enabled: controlledOpen == null
1813
+ });
1814
+ const focus = useFocus(context, {
1815
+ enabled: controlledOpen == null
1816
+ });
1817
+ const dismiss = useDismiss2(context);
1818
+ const role = useRole2(context, { role: "tooltip" });
1819
+ const interactions = useInteractions2([hover, focus, dismiss, role]);
1820
+ return useMemo4(
1821
+ () => ({
1822
+ open,
1823
+ setOpen,
1824
+ withoutArrow,
1825
+ arrowRef,
1826
+ ...interactions,
1827
+ ...data
1828
+ }),
1829
+ [open, setOpen, interactions, data]
1830
+ );
1831
+ }
1832
+
1833
+ // src/components/view/Tooltip/ui/TooltipProvider/TooltipProvider.tsx
1834
+ import { jsx as jsx26 } from "react/jsx-runtime";
1835
+ var TooltipProvider = (props) => {
1836
+ const { children, ...options } = props;
1837
+ const tooltip = useTooltip(options);
1838
+ return /* @__PURE__ */ jsx26(TooltipContext.Provider, { value: tooltip, children });
1839
+ };
1840
+
1841
+ // src/components/view/Tooltip/ui/TooltipTrigger/TooltipTrigger.tsx
1842
+ import { useMergeRefs as useMergeRefs4 } from "@floating-ui/react";
1843
+ import { cloneElement as cloneElement2, forwardRef as forwardRef6, isValidElement as isValidElement2, useContext as useContext6 } from "react";
1844
+ import { jsx as jsx27 } from "react/jsx-runtime";
1845
+ var TooltipTrigger = forwardRef6(
1846
+ function TooltipTrigger2({ children, wrapTrigger = false, ...props }, propRef) {
1847
+ const context = useContext6(TooltipContext);
1848
+ const childrenRef = children.ref;
1849
+ const ref = useMergeRefs4([context?.refs.setReference, propRef, childrenRef]);
1850
+ if (!context) {
1851
+ return null;
1852
+ }
1853
+ if (!wrapTrigger && isValidElement2(children)) {
1854
+ return cloneElement2(
1855
+ children,
1856
+ context.getReferenceProps({
1857
+ ref,
1858
+ ...props,
1859
+ ...children.props,
1860
+ "data-state": context.open ? "open" : "closed"
1861
+ })
1862
+ );
1863
+ }
1864
+ return /* @__PURE__ */ jsx27("div", { ref, "data-state": context.open ? "open" : "closed", ...context.getReferenceProps(props), children });
1865
+ }
1866
+ );
1867
+
1868
+ // src/components/view/Tooltip/Tooltip.tsx
1869
+ import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
1870
+ function Tooltip(props) {
1871
+ const {
1872
+ label,
1873
+ clickable,
1874
+ initialOpen,
1875
+ placement,
1876
+ withoutArrow,
1877
+ wrapTrigger,
1878
+ alertType = "default",
1879
+ children,
1880
+ classes
1881
+ } = props;
1882
+ const [showTooltip, setShowTooltip] = useState10(false);
1883
+ const arrowRef = useRef8(null);
1884
+ if (!label) {
1885
+ return children;
1886
+ }
1887
+ if (!children) {
1888
+ return null;
1889
+ }
1890
+ return /* @__PURE__ */ jsxs15(
1891
+ TooltipProvider,
1892
+ {
1893
+ placement,
1894
+ initialOpen,
1895
+ open: clickable ? showTooltip : void 0,
1896
+ onOpenChange: clickable ? setShowTooltip : void 0,
1897
+ withoutArrow,
1898
+ arrowRef,
1899
+ children: [
1900
+ /* @__PURE__ */ jsx28(
1901
+ TooltipTrigger,
1902
+ {
1903
+ wrapTrigger,
1904
+ onClick: clickable ? () => setShowTooltip((prev) => !prev) : void 0,
1905
+ className: wrapTrigger ? classnames17(tooltip_default.trigger, classes?.trigger) : void 0,
1906
+ children
1907
+ }
1908
+ ),
1909
+ /* @__PURE__ */ jsx28(
1910
+ TooltipContent,
1911
+ {
1912
+ className: classnames17(tooltip_default.content, tooltip_default[alertType], classes?.content),
1913
+ children: label
1914
+ }
1915
+ )
1916
+ ]
1917
+ }
1918
+ );
1919
+ }
1920
+
1921
+ // src/hooks/window/hooks/useWindowSize.ts
1922
+ import { useLayoutEffect as useLayoutEffect2, useState as useState11 } from "react";
1923
+ var useWindowSize = () => {
1924
+ const [size, setSize] = useState11([0, 0]);
1925
+ useLayoutEffect2(() => {
1926
+ function updateSize() {
1927
+ setSize([window.innerWidth, window.innerHeight]);
1928
+ }
1929
+ window.addEventListener("resize", updateSize);
1930
+ updateSize();
1931
+ return () => window.removeEventListener("resize", updateSize);
1932
+ }, []);
1933
+ return size;
1934
+ };
1935
+
1936
+ // src/components/view/VirtualTable/constants/defaultRowHeight.ts
1937
+ var defaultRowHeight = 32;
1938
+
1939
+ // src/components/view/VirtualTable/ui/DefaultColumn/DefaultColumn.tsx
1940
+ import classnames19 from "classnames";
1941
+ import { useEffect as useEffect7, useMemo as useMemo5, useState as useState12 } from "react";
1942
+ import { createPortal } from "react-dom";
1943
+
1944
+ // src/components/view/Modal/Modal.tsx
1945
+ import classnames18 from "classnames";
1946
+ import { useEffect as useEffect6, useRef as useRef9 } from "react";
1947
+
1948
+ // src/components/view/Modal/modal.module.css
1949
+ var modal_default = {
1950
+ root: "modal_root",
1951
+ modal: "modal_modal"
1952
+ };
1953
+
1954
+ // src/components/view/Modal/Modal.tsx
1955
+ import { jsx as jsx29 } from "react/jsx-runtime";
1956
+ function Modal(props) {
1957
+ const { close, children, classes } = props;
1958
+ const rootRef = useRef9(null);
1959
+ useEffect6(() => {
1960
+ const clickListener = function(e) {
1961
+ if (e.target === rootRef?.current) {
1962
+ close();
1963
+ }
1964
+ };
1965
+ if (rootRef?.current) {
1966
+ rootRef.current.addEventListener("click", clickListener);
1967
+ }
1968
+ return () => {
1969
+ if (rootRef?.current) {
1970
+ rootRef.current.removeEventListener("click", clickListener);
1971
+ }
1972
+ };
1973
+ }, [rootRef]);
1974
+ return /* @__PURE__ */ jsx29("div", { ref: rootRef, className: classnames18(modal_default.root, classes?.root), children: /* @__PURE__ */ jsx29("div", { className: classnames18(modal_default.modal, classes?.modal), children }) });
1975
+ }
1976
+
1977
+ // src/components/view/VirtualTable/virtualTable.module.css
1978
+ var virtualTable_default = {
1979
+ root: "virtualTable_root",
1980
+ tableContainer: "virtualTable_tableContainer",
1981
+ table: "virtualTable_table",
1982
+ th: "virtualTable_th",
1983
+ firstThRow: "virtualTable_firstThRow",
1984
+ thCell: "virtualTable_thCell",
1985
+ label: "virtualTable_label",
1986
+ alignLeft: "virtualTable_alignLeft",
1987
+ alignRight: "virtualTable_alignRight",
1988
+ alignCenter: "virtualTable_alignCenter",
1989
+ td: "virtualTable_td",
1990
+ evenRow: "virtualTable_evenRow",
1991
+ selected: "virtualTable_selected",
1992
+ marginLeftChanging: "virtualTable_marginLeftChanging",
1993
+ marginLeftChangingLast: "virtualTable_marginLeftChangingLast",
1994
+ marginTopChanging: "virtualTable_marginTopChanging",
1995
+ rightBorder: "virtualTable_rightBorder",
1996
+ bottomBorder: "virtualTable_bottomBorder",
1997
+ viewCell: "virtualTable_viewCell",
1998
+ error: "virtualTable_error",
1999
+ viewSpan: "virtualTable_viewSpan",
2000
+ showInModal: "virtualTable_showInModal",
2001
+ modalContent: "virtualTable_modalContent",
2002
+ verticalAlignFlexStart: "virtualTable_verticalAlignFlexStart",
2003
+ verticalAlignCenter: "virtualTable_verticalAlignCenter",
2004
+ verticalAlignFlexEnd: "virtualTable_verticalAlignFlexEnd"
2005
+ };
2006
+
2007
+ // src/components/view/VirtualTable/ui/DefaultColumn/DefaultColumn.tsx
2008
+ import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
2009
+ var DefaultColumn = {
2010
+ cell: ({ getValue, row: { index, original }, column: { id, columnDef }, table }) => {
2011
+ const initialValue = getValue();
2012
+ const { meta } = columnDef;
2013
+ const tableMeta = table.options.meta;
2014
+ const [value, setValue] = useState12(initialValue);
2015
+ const [isEdit, setIsEdit] = useState12(false);
2016
+ const [showModal, setShowModal] = useState12(false);
2017
+ useEffect7(() => {
2018
+ setValue(initialValue);
2019
+ }, [initialValue]);
2020
+ const modalPortal = useMemo5(() => document.getElementById("modal-portal"), []);
2021
+ const additionalViewResult = tableMeta?.additionalColumnsViews?.(id, initialValue);
2022
+ if (isEdit && meta?.editable) {
2023
+ const onBlur = () => {
2024
+ tableMeta?.updateData(index, id, value, original);
2025
+ setIsEdit(false);
2026
+ };
2027
+ const onChange = (e) => {
2028
+ setValue(e.target.value);
2029
+ };
2030
+ return /* @__PURE__ */ jsx30(Tooltip, { label: original[id]?.error ?? "", alertType: "error", children: additionalViewResult?.edit !== null && additionalViewResult?.edit !== void 0 ? additionalViewResult.edit(onChange, onBlur) : /* @__PURE__ */ jsx30(Fragment4, { children: /* @__PURE__ */ jsx30("input", { onChange, onBlur, value: value ?? "", autoFocus: true }) }) });
2031
+ }
2032
+ const shownValue = additionalViewResult?.view !== null && additionalViewResult?.view !== void 0 ? additionalViewResult.view : meta?.valueFormat ? meta.valueFormat(initialValue?.toString() ?? "") : meta?.toFixed && !Number.isNaN(parseFloat(initialValue)) ? parseFloat(Number(initialValue).toFixed(meta.toFixed)) : initialValue;
2033
+ return /* @__PURE__ */ jsx30(Tooltip, { label: original[id]?.error, alertType: "error", children: /* @__PURE__ */ jsxs16(
2034
+ "div",
2035
+ {
2036
+ className: classnames19(
2037
+ virtualTable_default.viewCell,
2038
+ !!meta?.rowsAlign ? virtualTable_default[`align${meta?.rowsAlign}`] : void 0,
2039
+ meta?.showInModal ? virtualTable_default.showInModal : void 0,
2040
+ original[id]?.error ? virtualTable_default.error : void 0,
2041
+ !!meta?.verticalAlign ? virtualTable_default[`verticalAlign${meta?.verticalAlign}`] : void 0
2042
+ ),
2043
+ onClick: meta?.editable ? () => {
2044
+ setIsEdit(true);
2045
+ } : meta?.showInModal ? () => {
2046
+ setShowModal(true);
2047
+ } : void 0,
2048
+ children: [
2049
+ /* @__PURE__ */ jsx30("span", { className: virtualTable_default.viewSpan, children: shownValue }),
2050
+ showModal && modalPortal && createPortal(
2051
+ /* @__PURE__ */ jsx30(Modal, { close: () => setShowModal(false), children: /* @__PURE__ */ jsx30(Surface, { type: "panel", children: /* @__PURE__ */ jsx30("div", { className: virtualTable_default.modalContent, children: shownValue }) }) }),
2052
+ modalPortal
2053
+ )
2054
+ ]
2055
+ }
2056
+ ) });
2057
+ }
2058
+ };
2059
+
2060
+ // src/components/view/VirtualTable/ui/HeaderDropdown/HeaderDropdown.tsx
2061
+ import classnames20 from "classnames";
2062
+ import { useMemo as useMemo6 } from "react";
2063
+
2064
+ // src/components/view/VirtualTable/ui/HeaderDropdown/headerDropdown.module.css
2065
+ var headerDropdown_default = {
2066
+ root: "headerDropdown_root",
2067
+ checklistWrap: "headerDropdown_checklistWrap",
2068
+ iconButton: "headerDropdown_iconButton"
2069
+ };
2070
+
2071
+ // src/components/view/VirtualTable/ui/HeaderDropdown/HeaderDropdown.tsx
2072
+ import { Fragment as Fragment5, jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
2073
+ function HeaderDropdown(props) {
2074
+ const {
2075
+ sortable,
2076
+ sortBy,
2077
+ setSortBy,
2078
+ sortAnotherName,
2079
+ filterable,
2080
+ filterBy,
2081
+ setFilterBy,
2082
+ headerName,
2083
+ items,
2084
+ children
2085
+ } = props;
2086
+ const headerResultName = sortAnotherName ?? headerName;
2087
+ const filterItems2 = useMemo6(() => {
2088
+ const checklistItems = items.filter((i) => Object.keys(i).includes(headerResultName)).map(
2089
+ (i) => ({
2090
+ name: i[headerResultName].value,
2091
+ value: i[headerResultName].value
2092
+ })
2093
+ );
2094
+ const uniqueChecklistItems = [
2095
+ ...checklistItems.reduce((a, c) => {
2096
+ a.set(c.value, c);
2097
+ return a;
2098
+ }, /* @__PURE__ */ new Map()).values()
2099
+ ];
2100
+ return uniqueChecklistItems;
2101
+ }, [items, headerResultName]);
2102
+ const filterSelectedItems = useMemo6(() => {
2103
+ const result = {};
2104
+ filterBy.find((fb) => fb.columnName === headerResultName)?.values.forEach((v) => {
2105
+ result[v] = true;
2106
+ });
2107
+ return result;
2108
+ }, [filterBy, headerResultName]);
2109
+ const handleSortClick = (direction) => () => {
2110
+ setSortBy((prev) => {
2111
+ if (prev.some((p) => p.columnName === headerResultName && p.direction === direction)) {
2112
+ return prev.filter((p) => !(p.columnName === headerResultName && p.direction === direction));
2113
+ } else {
2114
+ if (prev.some((p) => p.columnName === headerResultName)) {
2115
+ return prev.map((p) => p.columnName === headerResultName ? { ...p, direction } : { ...p });
2116
+ } else {
2117
+ return prev.concat([{ columnName: headerResultName, direction }]);
2118
+ }
2119
+ }
2120
+ });
2121
+ };
2122
+ const actionWithSelectedObjects = (selected) => {
2123
+ Object.entries(selected).forEach(([key, value]) => {
2124
+ if (!value) {
2125
+ delete selected[key];
2126
+ }
2127
+ });
2128
+ setFilterBy((prev) => {
2129
+ const newResult = [...prev];
2130
+ const exist = newResult.find((p) => p.columnName === headerResultName);
2131
+ if (exist) {
2132
+ exist.values = Object.keys(selected);
2133
+ } else {
2134
+ newResult.push({ columnName: headerResultName, values: Object.keys(selected) });
2135
+ }
2136
+ return newResult;
2137
+ });
2138
+ };
2139
+ const hasAnyFilter = Object.keys(filterSelectedItems).length || sortBy.some((sb) => sb.columnName === headerResultName);
2140
+ const { t } = useTranslation();
2141
+ return /* @__PURE__ */ jsxs17("div", { className: classnames20(headerDropdown_default.root), children: [
2142
+ children,
2143
+ /* @__PURE__ */ jsx31(
2144
+ Popover,
2145
+ {
2146
+ placement: "bottom-end",
2147
+ wrapTrigger: true,
2148
+ description: /* @__PURE__ */ jsxs17(Fragment5, { children: [
2149
+ filterable && /* @__PURE__ */ jsx31("div", { className: classnames20(headerDropdown_default.checklistWrap), children: /* @__PURE__ */ jsx31(
2150
+ Checklist,
2151
+ {
2152
+ items: filterItems2,
2153
+ selected: filterSelectedItems,
2154
+ actionWithSelected: actionWithSelectedObjects
2155
+ }
2156
+ ) }),
2157
+ sortable && /* @__PURE__ */ jsx31("div", { children: /* @__PURE__ */ jsx31(
2158
+ Menu,
2159
+ {
2160
+ items: [
2161
+ {
2162
+ type: "divider",
2163
+ name: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430")
2164
+ },
2165
+ {
2166
+ type: "item",
2167
+ name: t("\u041F\u043E \u0432\u043E\u0437\u0440\u0430\u0441\u0442\u0430\u043D\u0438\u044E"),
2168
+ icon: /* @__PURE__ */ jsx31(SortUpIcon, {}),
2169
+ selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "asc"),
2170
+ onClick: handleSortClick("asc")
2171
+ },
2172
+ {
2173
+ type: "item",
2174
+ name: t("\u041F\u043E \u0443\u0431\u044B\u0432\u0430\u043D\u0438\u044E"),
2175
+ icon: /* @__PURE__ */ jsx31(SortDownIcon, {}),
2176
+ selected: sortBy.some((sb) => sb.columnName === headerResultName && sb.direction === "desc"),
2177
+ onClick: handleSortClick("desc")
2178
+ }
2179
+ ]
2180
+ }
2181
+ ) })
2182
+ ] }),
2183
+ children: /* @__PURE__ */ jsx31(Tooltip, { label: t("\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F"), placement: "bottom-end", children: /* @__PURE__ */ jsx31(
2184
+ Button,
2185
+ {
2186
+ size: "small",
2187
+ variant: "text",
2188
+ textSecondary: true,
2189
+ icon: hasAnyFilter ? /* @__PURE__ */ jsx31(FilterIcon, {}) : /* @__PURE__ */ jsx31(ArrowDropDownIcon, {})
2190
+ }
2191
+ ) })
2192
+ }
2193
+ )
2194
+ ] });
2195
+ }
2196
+
2197
+ // src/components/view/VirtualTable/utils/getColumns.ts
2198
+ var createMeta = (column) => {
2199
+ if (column) {
2200
+ return {
2201
+ editable: column.editable,
2202
+ sortable: column.sortable,
2203
+ sortAnotherName: column.sortAnotherName,
2204
+ filterable: column.filterable,
2205
+ width: column.width,
2206
+ headerAlign: column.headerAlign,
2207
+ rowsAlign: column.rowsAlign,
2208
+ valueFormat: column.valueFormat,
2209
+ showInModal: column.showInModal,
2210
+ label: column.label,
2211
+ verticalAlign: column.verticalAlign,
2212
+ toFixed: column.toFixed
2213
+ };
2214
+ }
2215
+ };
2216
+ var getColumns = (columns, parent) => {
2217
+ return columns.map((column) => ({
2218
+ id: column.id,
2219
+ accessorKey: column.accessorKey,
2220
+ accessorFn: column.accessorKey ? (row) => row[column.accessorKey]?.value : void 0,
2221
+ header: () => column.label,
2222
+ meta: createMeta(!!parent?.accessorKey ? parent : column),
2223
+ columns: column.columns ? getColumns(column.columns, column) : void 0
2224
+ }));
2225
+ };
2226
+
2227
+ // src/components/view/VirtualTable/utils/getNextHorizontalHeaders.ts
2228
+ var getNextHorizontalHeaders = (headers, currentIndex, lastVirtualColumnIndex) => {
2229
+ if (headers[currentIndex + 1] && headers[currentIndex].column.columnDef.id === headers[currentIndex + 1].column.columnDef.id && currentIndex < lastVirtualColumnIndex) {
2230
+ const result = [headers[currentIndex + 1]];
2231
+ return result.concat(getNextHorizontalHeaders(headers, currentIndex + 1, lastVirtualColumnIndex));
2232
+ }
2233
+ return [];
2234
+ };
2235
+
2236
+ // src/components/view/VirtualTable/utils/getPrevHorizontalHeaders.ts
2237
+ var getPrevHorizontalHeaders = (headers, currentIndex) => {
2238
+ if (headers[currentIndex - 1] && headers[currentIndex - 1].column.columnDef.id === headers[currentIndex].column.columnDef.id) {
2239
+ const result = [headers[currentIndex - 1]];
2240
+ return result.concat(getPrevHorizontalHeaders(headers, currentIndex - 1));
2241
+ }
2242
+ return [];
2243
+ };
2244
+
2245
+ // src/components/view/VirtualTable/utils/getPrevVerticalHeaders.ts
2246
+ var getPrevVerticalHeaders = (headersGroups, groupIndex, columnIndex) => {
2247
+ if (headersGroups[groupIndex - 1] && !headersGroups[groupIndex - 1].headers[columnIndex].column.columnDef.meta?.label) {
2248
+ const result = [headersGroups[groupIndex - 1].headers[columnIndex]];
2249
+ return result.concat(getPrevVerticalHeaders(headersGroups, groupIndex - 1, columnIndex));
2250
+ }
2251
+ return [];
2252
+ };
2253
+
2254
+ // src/components/view/VirtualTable/utils/recursiveFilter.ts
2255
+ var recursiveFilter = (items, filterBy) => {
2256
+ if (filterBy.length) {
2257
+ const filterByItem = filterBy[filterBy.length - 1];
2258
+ const filtered = filterByItem.values.length ? items.filter(
2259
+ (item) => filterByItem.values.includes(item[filterByItem.columnName]?.value?.toString() ?? "") || item.isNew?.value === 1
2260
+ ) : items;
2261
+ return recursiveFilter(filtered, filterBy.slice(0, filterBy.length - 1));
2262
+ }
2263
+ return items;
2264
+ };
2265
+
2266
+ // src/components/view/VirtualTable/utils/recursiveSort.ts
2267
+ var recursiveSort = (items, sortBy) => {
2268
+ if (sortBy.length) {
2269
+ const sortByItem = sortBy[sortBy.length - 1];
2270
+ const sorted = items.sort((a, b) => {
2271
+ const aValue = a[sortByItem.columnName]?.value?.toString() ?? "";
2272
+ const bValue = b[sortByItem.columnName]?.value?.toString() ?? "";
2273
+ const compare = aValue.localeCompare(bValue);
2274
+ return sortByItem.direction === "asc" ? compare : -compare;
2275
+ });
2276
+ return recursiveSort(sorted, sortBy.slice(0, sortBy.length - 1));
2277
+ }
2278
+ return items;
2279
+ };
2280
+
2281
+ // src/components/view/VirtualTable/VirtualTable.tsx
2282
+ import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
2283
+ function VirtualTable(props) {
2284
+ const {
2285
+ rows,
2286
+ columns,
2287
+ additionalColumnsViews,
2288
+ onChangeCell,
2289
+ cellWidth,
2290
+ rowButtons,
2291
+ fixedColumnsCount = 0,
2292
+ headerRowHeight = [defaultRowHeight],
2293
+ bodyRowHeight = defaultRowHeight,
2294
+ rowActionWidth = 77,
2295
+ classes,
2296
+ // При локальной разработке с динамической высотой строк нужно отключать StrictMode,
2297
+ // потому что вместо одного рендера происходит 2
2298
+ dynamicRowHeight = false
2299
+ } = props;
2300
+ const [filterBy, setFilterBy] = useState13([]);
2301
+ const [sortBy, setSortBy] = useState13([{ columnName: "isNew", direction: "desc" }]);
2302
+ const memoizedColumns = useMemo7(() => getColumns(columns), [columns]);
2303
+ const memoizedData = useMemo7(() => {
2304
+ const newRows = [...rows];
2305
+ const nextFilterBy = filterBy.filter(
2306
+ (i) => rows.some((r) => i.values.includes(r[i.columnName]?.value?.toString() ?? ""))
2307
+ );
2308
+ const filtered = nextFilterBy.length ? recursiveFilter(newRows, nextFilterBy) : newRows;
2309
+ const sorted = sortBy.length ? recursiveSort(filtered, sortBy) : filtered;
2310
+ return sorted;
2311
+ }, [rows, sortBy, filterBy]);
2312
+ const columnsEstimateSize = useMemo7(
2313
+ () => cellWidth ?? ((index) => memoizedColumns[index]?.meta?.width ?? 200),
2314
+ [cellWidth, memoizedColumns]
2315
+ );
2316
+ const table = useReactTable({
2317
+ data: memoizedData,
2318
+ columns: memoizedColumns,
2319
+ defaultColumn: DefaultColumn,
2320
+ manualSorting: true,
2321
+ getCoreRowModel: getCoreRowModel(),
2322
+ meta: {
2323
+ updateData: (rowIndex, columnId, value, original) => {
2324
+ onChangeCell?.(rowIndex, columnId, value, original);
2325
+ },
2326
+ additionalColumnsViews
2327
+ }
2328
+ });
2329
+ const tableContainerRef = useRef10(null);
2330
+ const { rows: rowsFromTable } = table.getRowModel();
2331
+ const headerGroups = table.getHeaderGroups();
2332
+ const tableContainer = tableContainerRef?.current;
2333
+ const measureElement = useMemo7(() => {
2334
+ if (dynamicRowHeight && tableContainer) {
2335
+ return (e, _, b) => {
2336
+ const dataIndex = e.getAttribute("data-index");
2337
+ let height = e.clientHeight + 1;
2338
+ if (dataIndex && height !== b.measurementsCache[+dataIndex].size) {
2339
+ const rowCells = Array.from(tableContainer.querySelectorAll(`[data-index='${dataIndex}']`)) ?? [];
2340
+ const cellsHeights = rowCells.map((cell) => cell.getBoundingClientRect().height);
2341
+ height = Math.max(...cellsHeights);
2342
+ b.resizeItem(+dataIndex, height);
2343
+ }
2344
+ return height;
2345
+ };
2346
+ }
2347
+ }, [dynamicRowHeight, tableContainer]);
2348
+ const rowVirtualizer = useVirtualizer({
2349
+ count: rowsFromTable.length,
2350
+ getScrollElement: () => tableContainerRef?.current,
2351
+ estimateSize: useCallback7(() => bodyRowHeight, []),
2352
+ measureElement,
2353
+ overscan: 2
2354
+ });
2355
+ const columnVirtualizer = useVirtualizer({
2356
+ horizontal: true,
2357
+ count: rowsFromTable[0]?.getAllCells().length ?? 1,
2358
+ getScrollElement: () => tableContainerRef?.current,
2359
+ overscan: 2,
2360
+ estimateSize: columnsEstimateSize
2361
+ });
2362
+ const {
2363
+ getVirtualItems: getVirtualRows,
2364
+ getTotalSize: getRowsTotalSize,
2365
+ measurementsCache,
2366
+ resizeItem
2367
+ } = rowVirtualizer;
2368
+ const { getVirtualItems: getVirtualColumns, getTotalSize: getColumnsTotalSize } = columnVirtualizer;
2369
+ useEffect8(() => {
2370
+ measurementsCache.forEach((i) => {
2371
+ resizeItem(i.index, bodyRowHeight);
2372
+ });
2373
+ }, [rowsFromTable]);
2374
+ const [windowWidth, windowHeight] = useWindowSize();
2375
+ const headerGroupHeight = useMemo7(() => {
2376
+ const delta = headerGroups.length - headerRowHeight.length;
2377
+ const result = [...headerRowHeight];
2378
+ if (delta > 0) {
2379
+ for (let i = 0; i < delta; i++) {
2380
+ result.push(defaultRowHeight);
2381
+ }
2382
+ }
2383
+ return result;
2384
+ }, [headerRowHeight, headerGroups]);
2385
+ const summaryHeaderHeight = useMemo7(
2386
+ () => headerGroupHeight.reduce(
2387
+ (sum, current, currentIndex) => currentIndex < headerGroups.length ? sum + current : sum,
2388
+ 0
2389
+ ),
2390
+ [headerGroupHeight, headerGroups]
2391
+ );
2392
+ const headerGroupY = useCallback7(
2393
+ (headerIndex) => headerGroupHeight.reduce((sum, current, currentIndex) => currentIndex < headerIndex ? sum + current : sum, 0),
2394
+ [headerGroupHeight, headerGroups]
2395
+ );
2396
+ const rowsTotalSize = getRowsTotalSize();
2397
+ const calculateRightAndBottomBorders = useCallback7(
2398
+ function(container) {
2399
+ const rightBorderElement = container.querySelector(`.${virtualTable_default.rightBorder}`);
2400
+ if (rightBorderElement) {
2401
+ const containerWidth = container.clientWidth;
2402
+ const tableWidth = getColumnsTotalSize() + (!!rowButtons ? rowActionWidth : 0);
2403
+ rightBorderElement.style.left = `${containerWidth > tableWidth ? tableWidth : containerWidth}px`;
2404
+ }
2405
+ const bottomBorderElement = container.querySelector(`.${virtualTable_default.bottomBorder}`);
2406
+ if (bottomBorderElement) {
2407
+ const containerHeight = container.clientHeight;
2408
+ const tableHeight = rowsTotalSize + summaryHeaderHeight;
2409
+ bottomBorderElement.style.top = `${containerHeight > tableHeight ? tableHeight : containerHeight}px`;
2410
+ }
2411
+ },
2412
+ [rowButtons, rowsTotalSize]
2413
+ );
2414
+ useEffect8(() => {
2415
+ if (tableContainerRef?.current) {
2416
+ calculateRightAndBottomBorders(tableContainerRef?.current);
2417
+ }
2418
+ }, [windowWidth, windowHeight, tableContainerRef, rowsTotalSize]);
2419
+ useEffect8(() => {
2420
+ const scrollListener = function() {
2421
+ const marginTopChangingElements = this.querySelectorAll(`.${virtualTable_default.marginTopChanging}`);
2422
+ marginTopChangingElements?.forEach(
2423
+ (element) => element.style.marginTop = `${this.scrollTop}px`
2424
+ );
2425
+ const marginLeftChangingElements = this.querySelectorAll(`.${virtualTable_default.marginLeftChanging}`);
2426
+ marginLeftChangingElements?.forEach(
2427
+ (element) => element.style.marginLeft = `${this.scrollLeft}px`
2428
+ );
2429
+ };
2430
+ if (tableContainerRef?.current) {
2431
+ tableContainerRef.current.addEventListener("scroll", scrollListener);
2432
+ tableContainerRef.current.scrollTo(0, tableContainerRef.current.scrollHeight);
2433
+ }
2434
+ return () => {
2435
+ if (tableContainerRef?.current) {
2436
+ tableContainerRef.current.removeEventListener("scroll", scrollListener);
2437
+ }
2438
+ };
2439
+ }, [tableContainerRef]);
2440
+ const virtualRows = getVirtualRows();
2441
+ const virtualColumns = getVirtualColumns();
2442
+ const lastVirtualColumnIndex = virtualColumns[virtualColumns.length - 1]?.index;
2443
+ return /* @__PURE__ */ jsx32("div", { className: classnames21(virtualTable_default.root, classes?.root), children: /* @__PURE__ */ jsxs18("div", { ref: tableContainerRef, className: classnames21(virtualTable_default.tableContainer, "styledScroll"), children: [
2444
+ /* @__PURE__ */ jsxs18(
2445
+ "div",
2446
+ {
2447
+ className: virtualTable_default.table,
2448
+ style: {
2449
+ width: `${getColumnsTotalSize() + (!!rowButtons ? rowActionWidth : 0)}px`,
2450
+ height: `${rowsTotalSize + summaryHeaderHeight}px`
2451
+ },
2452
+ children: [
2453
+ headerGroups.map((headerGroup, hgi) => {
2454
+ const innerCell = (header) => {
2455
+ const headerMeta = header.column.columnDef.meta;
2456
+ return /* @__PURE__ */ jsx32("div", { className: classnames21(virtualTable_default.thCell), children: header.column.columnDef.id === header.column.columnDef["accessorKey"] && (headerMeta?.sortable || headerMeta?.filterable) ? /* @__PURE__ */ jsx32(
2457
+ HeaderDropdown,
2458
+ {
2459
+ sortable: headerMeta?.sortable ?? false,
2460
+ sortBy,
2461
+ setSortBy,
2462
+ sortAnotherName: headerMeta?.sortAnotherName,
2463
+ filterable: headerMeta?.filterable ?? false,
2464
+ filterBy,
2465
+ setFilterBy,
2466
+ items: rows,
2467
+ headerName: header.column.columnDef.id ?? header.id,
2468
+ children: /* @__PURE__ */ jsx32(
2469
+ "div",
2470
+ {
2471
+ className: classnames21(
2472
+ virtualTable_default.label,
2473
+ !!headerMeta?.headerAlign ? virtualTable_default[`align${headerMeta?.headerAlign}`] : virtualTable_default.alignLeft
2474
+ ),
2475
+ children: flexRender(header.column.columnDef.header, header.getContext())
2476
+ }
2477
+ )
2478
+ }
2479
+ ) : /* @__PURE__ */ jsx32(
2480
+ "div",
2481
+ {
2482
+ className: classnames21(
2483
+ virtualTable_default.label,
2484
+ !!headerMeta?.headerAlign ? virtualTable_default[`align${headerMeta?.headerAlign}`] : virtualTable_default.alignLeft
2485
+ ),
2486
+ children: flexRender(header.column.columnDef.header, header.getContext())
2487
+ }
2488
+ ) });
2489
+ };
2490
+ return /* @__PURE__ */ jsxs18(Fragment6, { children: [
2491
+ [...Array(fixedColumnsCount)].map((_, index) => {
2492
+ const header = headerGroup.headers[index];
2493
+ return /* @__PURE__ */ jsx32(
2494
+ "div",
2495
+ {
2496
+ className: classnames21(
2497
+ virtualTable_default.th,
2498
+ hgi === 0 ? virtualTable_default.firstThRow : void 0,
2499
+ virtualTable_default.marginTopChanging,
2500
+ virtualTable_default.marginLeftChanging,
2501
+ index === fixedColumnsCount - 1 ? virtualTable_default.marginLeftChangingLast : void 0
2502
+ ),
2503
+ style: {
2504
+ zIndex: 3,
2505
+ width: `${columnsEstimateSize(index)}px`,
2506
+ height: `${headerGroupHeight[hgi]}px`,
2507
+ transform: `translateX(${index > 0 ? columnsEstimateSize(index - 1) : 0}px) translateY(${headerGroupY(hgi)}px)`
2508
+ },
2509
+ children: innerCell(header)
2510
+ },
2511
+ `${headerGroup.id}-${header.id}`
2512
+ );
2513
+ }),
2514
+ virtualColumns.map((column) => {
2515
+ if (column.index > fixedColumnsCount - 1) {
2516
+ const header = headerGroup.headers[column.index];
2517
+ const nextHorizontalHeaders = getNextHorizontalHeaders(
2518
+ headerGroup.headers,
2519
+ column.index,
2520
+ lastVirtualColumnIndex
2521
+ );
2522
+ const prevHorizontalHeaders = getPrevHorizontalHeaders(headerGroup.headers, column.index);
2523
+ const prevVerticalHeaders = getPrevVerticalHeaders(headerGroups, hgi, column.index);
2524
+ const width = !nextHorizontalHeaders.length && !prevHorizontalHeaders.length ? column.size : column.size + nextHorizontalHeaders.reduce(
2525
+ (sum, current) => sum + (current.column.columnDef.meta?.width ?? 0),
2526
+ 0
2527
+ );
2528
+ const zIndex = !nextHorizontalHeaders.length && !prevHorizontalHeaders.length ? void 0 : nextHorizontalHeaders.length + 2;
2529
+ const height = !prevVerticalHeaders.length ? headerGroupHeight[hgi] : headerGroupHeight[hgi] + prevVerticalHeaders.reduce(
2530
+ (sum, _, index) => sum + (headerGroupHeight[hgi - index - 1] ?? 0),
2531
+ 0
2532
+ );
2533
+ const translateY = !prevVerticalHeaders.length ? headerGroupY(hgi) : headerGroupY(hgi) - prevVerticalHeaders.reduce(
2534
+ (sum, _, index) => sum + (headerGroupHeight[hgi - index - 1] ?? 0),
2535
+ 0
2536
+ );
2537
+ return /* @__PURE__ */ jsx32(
2538
+ "div",
2539
+ {
2540
+ className: classnames21(
2541
+ virtualTable_default.th,
2542
+ hgi === 0 ? virtualTable_default.firstThRow : void 0,
2543
+ virtualTable_default.marginTopChanging
2544
+ ),
2545
+ style: {
2546
+ width: `${width}px`,
2547
+ zIndex,
2548
+ height: `${height}px`,
2549
+ transform: `translateX(${column.start}px) translateY(${translateY}px)`,
2550
+ borderTop: translateY === 0 ? "1px solid var(--border-color)" : void 0
2551
+ },
2552
+ children: innerCell(header)
2553
+ },
2554
+ `${headerGroup.id}-${header.id}`
2555
+ );
2556
+ }
2557
+ return null;
2558
+ }),
2559
+ !!rowButtons && /* @__PURE__ */ jsx32(
2560
+ "div",
2561
+ {
2562
+ className: classnames21(
2563
+ virtualTable_default.th,
2564
+ hgi === 0 ? virtualTable_default.firstThRow : void 0,
2565
+ virtualTable_default.marginTopChanging
2566
+ ),
2567
+ style: {
2568
+ width: `${rowActionWidth}px`,
2569
+ height: `${headerGroupHeight[hgi]}px`,
2570
+ transform: `translateX(${getColumnsTotalSize()}px) translateY(${headerGroupY(hgi)}px)`
2571
+ }
2572
+ }
2573
+ )
2574
+ ] }, headerGroup.id);
2575
+ }),
2576
+ virtualRows.map((virtualRow) => {
2577
+ const row = rowsFromTable[virtualRow.index];
2578
+ let height = bodyRowHeight;
2579
+ if (dynamicRowHeight) {
2580
+ const rowSizeFromCache = virtualRow.size;
2581
+ height = rowSizeFromCache === bodyRowHeight ? void 0 : rowSizeFromCache;
2582
+ }
2583
+ if (height) {
2584
+ height = `${height}px`;
2585
+ }
2586
+ return /* @__PURE__ */ jsxs18(Fragment6, { children: [
2587
+ [...Array(fixedColumnsCount)].map((_, index) => {
2588
+ const cell = row.getAllCells()[index];
2589
+ return /* @__PURE__ */ jsx32(
2590
+ "div",
2591
+ {
2592
+ className: classnames21(
2593
+ virtualTable_default.td,
2594
+ virtualTable_default.marginLeftChanging,
2595
+ index === fixedColumnsCount - 1 ? virtualTable_default.marginLeftChangingLast : void 0,
2596
+ row.original?.isNew?.value === 1 ? virtualTable_default.selected : void 0
2597
+ ),
2598
+ style: {
2599
+ width: `${columnsEstimateSize(index)}px`,
2600
+ height,
2601
+ zIndex: 2,
2602
+ transform: `translateX(${index > 0 ? columnsEstimateSize(index - 1) : 0}px) translateY(${summaryHeaderHeight + virtualRow.start}px)`
2603
+ },
2604
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
2605
+ },
2606
+ `${cell.id}}`
2607
+ );
2608
+ }),
2609
+ virtualColumns.map((column) => {
2610
+ if (column.index > fixedColumnsCount - 1) {
2611
+ const cell = row.getAllCells()[column.index];
2612
+ return /* @__PURE__ */ jsx32(
2613
+ "div",
2614
+ {
2615
+ className: classnames21(
2616
+ virtualTable_default.td,
2617
+ virtualRow.index % 2 !== 0 ? virtualTable_default.evenRow : void 0,
2618
+ row.original?.isNew?.value === 1 ? virtualTable_default.selected : void 0
2619
+ ),
2620
+ style: {
2621
+ width: `${column.size}px`,
2622
+ height,
2623
+ transform: `translateX(${column.start}px) translateY(${summaryHeaderHeight + virtualRow.start}px)`
2624
+ },
2625
+ "data-index": virtualRow.index,
2626
+ ref: dynamicRowHeight ? rowVirtualizer.measureElement : void 0,
2627
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
2628
+ },
2629
+ `${cell.id}`
2630
+ );
2631
+ }
2632
+ return null;
2633
+ }),
2634
+ !!rowButtons && /* @__PURE__ */ jsx32(
2635
+ "div",
2636
+ {
2637
+ className: classnames21(virtualTable_default.td, row.original?.isNew?.value === 1 ? virtualTable_default.selected : void 0),
2638
+ style: {
2639
+ width: `${rowActionWidth}px`,
2640
+ height,
2641
+ transform: `translateX(${getColumnsTotalSize()}px) translateY(${summaryHeaderHeight + virtualRow.start}px)`,
2642
+ justifyContent: "flex-start",
2643
+ padding: "4px"
2644
+ },
2645
+ children: rowButtons?.(row.original)?.map((ab) => /* @__PURE__ */ jsx32(Fragment6, { children: ab.template ? ab.template(ab) : /* @__PURE__ */ jsx32(Tooltip, { label: ab.title, placement: "top", wrapTrigger: true, children: /* @__PURE__ */ jsx32(
2646
+ Button,
2647
+ {
2648
+ onClick: () => ab.onClick?.(virtualRow.index, row.original),
2649
+ size: "small",
2650
+ variant: "text",
2651
+ icon: ab.icon
2652
+ }
2653
+ ) }) }, ab.title))
2654
+ }
2655
+ )
2656
+ ] }, `${row.id}`);
2657
+ })
2658
+ ]
2659
+ }
2660
+ ),
2661
+ /* @__PURE__ */ jsx32("div", { className: virtualTable_default.rightBorder, style: { height: `${rowsTotalSize + summaryHeaderHeight}px` } }),
2662
+ /* @__PURE__ */ jsx32("div", { className: virtualTable_default.bottomBorder, style: { width: `${getColumnsTotalSize()}px` } })
2663
+ ] }) });
2664
+ }
2665
+
2666
+ // src/components/view/TreeView/TreeView.tsx
2667
+ import { memo as memo2, useCallback as useCallback8, useMemo as useMemo8, useState as useState15 } from "react";
2668
+
2669
+ // src/components/view/TreeView/treeView.module.css
2670
+ var treeView_default = {
2671
+ search: "treeView_search"
2672
+ };
2673
+
2674
+ // src/components/view/TreeView/ui/TreeViewItem/TreeViewItem.tsx
2675
+ import classNames4 from "classnames";
2676
+ import { memo, useEffect as useEffect9, useState as useState14 } from "react";
2677
+
2678
+ // src/components/view/TreeView/ui/TreeViewItem/treeViewItem.module.css
2679
+ var treeViewItem_default = {
2680
+ item: "treeViewItem_item",
2681
+ selectable: "treeViewItem_selectable",
2682
+ children: "treeViewItem_children",
2683
+ title: "treeViewItem_title",
2684
+ selected: "treeViewItem_selected",
2685
+ selectIcon: "treeViewItem_selectIcon"
2686
+ };
2687
+
2688
+ // src/components/view/TreeView/ui/TreeViewItem/TreeViewItem.tsx
2689
+ import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
2690
+ var TreeViewItem_default = memo(function TreeViewItem({
2691
+ title,
2692
+ value,
2693
+ searchValue,
2694
+ selected,
2695
+ onSelect,
2696
+ type,
2697
+ isSelectable,
2698
+ startIcons,
2699
+ children
2700
+ }) {
2701
+ const [isOpen, setIsOpen] = useState14(false);
2702
+ useEffect9(() => {
2703
+ setIsOpen(!!searchValue);
2704
+ }, [searchValue]);
2705
+ const hasChildren = !!children?.length;
2706
+ const startIcon = type && startIcons?.[type];
2707
+ const handleClick = () => {
2708
+ if (isSelectable && onSelect) {
2709
+ onSelect(value);
2710
+ } else {
2711
+ setIsOpen(!isOpen);
2712
+ }
2713
+ };
2714
+ const isSelected = selected[value];
2715
+ return /* @__PURE__ */ jsxs19("div", { children: [
2716
+ /* @__PURE__ */ jsxs19("div", { className: classNames4(treeViewItem_default.item, { [treeViewItem_default.selectable]: isSelectable }), onClick: handleClick, children: [
2717
+ hasChildren && /* @__PURE__ */ jsx33(KeyboardArrowDownIcon, {}),
2718
+ /* @__PURE__ */ jsxs19("div", { className: classNames4(treeViewItem_default.title, { [treeViewItem_default.selected]: isSelected }), children: [
2719
+ startIcon,
2720
+ /* @__PURE__ */ jsx33(Typography, { variant: "subtitle2", children: title }),
2721
+ isSelectable && /* @__PURE__ */ jsx33("span", { className: treeViewItem_default.selectIcon, children: isSelected ? /* @__PURE__ */ jsx33(DoneIcon, {}) : /* @__PURE__ */ jsx33(AddIcon, {}) })
2722
+ ] })
2723
+ ] }),
2724
+ isOpen && hasChildren && /* @__PURE__ */ jsx33("div", { className: treeViewItem_default.children, children: children.map((c) => /* @__PURE__ */ jsx33(
2725
+ TreeViewItem,
2726
+ {
2727
+ title: c.name,
2728
+ value: c.id,
2729
+ children: c.children,
2730
+ selected,
2731
+ searchValue,
2732
+ type: c.type,
2733
+ isSelectable: c.isSelectable,
2734
+ startIcons,
2735
+ onSelect
2736
+ },
2737
+ c.id
2738
+ )) })
2739
+ ] });
2740
+ });
2741
+
2742
+ // src/components/view/TreeView/utils/getFilteredTree.ts
2743
+ var getFilteredTree = (tree, search) => {
2744
+ const lowerCasedSearch = search.toLowerCase();
2745
+ const getChildren = (acc, cur) => {
2746
+ if (cur.name.toLowerCase().includes(lowerCasedSearch)) {
2747
+ acc.push(cur);
2748
+ return acc;
2749
+ }
2750
+ if (Array.isArray(cur.children)) {
2751
+ const children = cur.children.reduce(getChildren, []);
2752
+ if (children.length)
2753
+ acc.push({ ...cur, children });
2754
+ }
2755
+ return acc;
2756
+ };
2757
+ return tree.reduce(getChildren, []);
2758
+ };
2759
+
2760
+ // src/components/view/TreeView/TreeView.tsx
2761
+ import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
2762
+ var TreeView_default = memo2(function TreeView({ data, selected, startIcons, onSelect, withSearch = false }) {
2763
+ const [searchValue, setSearchValue] = useState15("");
2764
+ const onChangeSearchValue = useCallback8((e) => setSearchValue(e.target.value), []);
2765
+ const selectedValues = useMemo8(
2766
+ () => selected.reduce(
2767
+ (acc, cur) => {
2768
+ acc[cur] = true;
2769
+ return acc;
2770
+ },
2771
+ {}
2772
+ ),
2773
+ [selected]
2774
+ );
2775
+ const filteredData = useMemo8(() => {
2776
+ return getFilteredTree(data, searchValue);
2777
+ }, [data, searchValue]);
2778
+ return /* @__PURE__ */ jsxs20(Fragment7, { children: [
2779
+ withSearch && /* @__PURE__ */ jsx34(
2780
+ SearchInput,
2781
+ {
2782
+ variant: "outlined",
2783
+ value: searchValue,
2784
+ fullWidth: true,
2785
+ onChange: onChangeSearchValue,
2786
+ classes: { root: treeView_default.search }
2787
+ }
2788
+ ),
2789
+ /* @__PURE__ */ jsx34("div", { className: "styledScroll", children: filteredData.map(({ id, name, children }) => {
2790
+ return /* @__PURE__ */ jsx34(
2791
+ TreeViewItem_default,
2792
+ {
2793
+ title: name,
2794
+ value: id,
2795
+ searchValue,
2796
+ children,
2797
+ startIcons,
2798
+ onSelect,
2799
+ selected: selectedValues
2800
+ },
2801
+ id
2802
+ );
2803
+ }) })
2804
+ ] });
2805
+ });
2806
+
2807
+ // src/components/view/Pairs/Pairs.tsx
2808
+ import classNames5 from "classnames";
2809
+
2810
+ // src/components/view/Pairs/pairs.module.css
2811
+ var pairs_default = {
2812
+ rowContainerBorders: "pairs_rowContainerBorders",
2813
+ labelsContainer: "pairs_labelsContainer",
2814
+ labelsWithBorders: "pairs_labelsWithBorders",
2815
+ valuesContainer: "pairs_valuesContainer",
2816
+ valuesWithBorders: "pairs_valuesWithBorders",
2817
+ dimTypography: "pairs_dimTypography",
2818
+ trimmedTypography: "pairs_trimmedTypography"
2819
+ };
2820
+
2821
+ // src/components/view/Pairs/ui/TypographyWithTooltip.tsx
2822
+ import { useState as useState16 } from "react";
2823
+ import { jsx as jsx35 } from "react/jsx-runtime";
2824
+ function TypographyWithTooltip(props) {
2825
+ const { label } = props;
2826
+ const [tooltip, setTooltip] = useState16(label);
2827
+ return /* @__PURE__ */ jsx35(Tooltip, { label: tooltip, children: /* @__PURE__ */ jsx35(
2828
+ Typography,
2829
+ {
2830
+ style: {
2831
+ textOverflow: "ellipsis",
2832
+ overflow: "hidden",
2833
+ whiteSpace: "nowrap"
2834
+ },
2835
+ onMouseEnter: (e) => {
2836
+ setTooltip(e.currentTarget.scrollWidth > e.currentTarget.clientWidth ? label : "");
2837
+ },
2838
+ children: label
2839
+ }
2840
+ ) });
2841
+ }
2842
+
2843
+ // src/components/view/Pairs/Pairs.tsx
2844
+ import { Fragment as Fragment8, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
2845
+ function Pairs(props) {
2846
+ const { pairs, column1Width = "50%", column2Width = "50%", showBorder, minRowHeight, classes } = props;
2847
+ return /* @__PURE__ */ jsx36("div", { className: classNames5(classes?.root), children: pairs.map((pair, i) => /* @__PURE__ */ jsx36(
2848
+ "div",
2849
+ {
2850
+ style: { minHeight: minRowHeight, display: "flex" },
2851
+ className: classNames5(classes?.rowContainer, {
2852
+ [pairs_default.rowContainerBorders]: showBorder
2853
+ }),
2854
+ children: pair && /* @__PURE__ */ jsxs21(Fragment8, { children: [
2855
+ /* @__PURE__ */ jsx36(
2856
+ "div",
2857
+ {
2858
+ className: classNames5(pairs_default.labelsContainer, classes?.labelsContainer, {
2859
+ [pairs_default.labelsWithBorders]: showBorder
2860
+ }),
2861
+ style: {
2862
+ width: column1Width,
2863
+ minWidth: column1Width
2864
+ },
2865
+ children: /* @__PURE__ */ jsx36(Typography, { className: pairs_default.dimTypography, children: pair.label })
2866
+ }
2867
+ ),
2868
+ /* @__PURE__ */ jsx36(
2869
+ "div",
2870
+ {
2871
+ style: {
2872
+ width: column2Width,
2873
+ minWidth: column2Width
2874
+ },
2875
+ className: classNames5(pairs_default.valuesContainer, classes?.valuesContainer, {
2876
+ [pairs_default.valuesWithBorders]: showBorder
2877
+ }),
2878
+ children: /* @__PURE__ */ jsx36(TypographyWithTooltip, { label: pair.value })
2879
+ }
2880
+ )
2881
+ ] })
2882
+ },
2883
+ i
2884
+ )) });
2885
+ }
2886
+
2887
+ // src/components/view/Card/Card.tsx
2888
+ import classNames6 from "classnames";
2889
+
2890
+ // src/components/view/Card/card.module.css
2891
+ var card_default = {
2892
+ root: "card_root",
2893
+ header: "card_header",
2894
+ actions: "card_actions"
2895
+ };
2896
+
2897
+ // src/components/view/Card/Card.tsx
2898
+ import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
2899
+ function Card(props) {
2900
+ const { surfaceType = "primary", title, actions, children, classes } = props;
2901
+ return /* @__PURE__ */ jsxs22(Surface, { type: surfaceType, classes: { root: classNames6(card_default.root, classes?.root) }, children: [
2902
+ (!!title || !!actions) && /* @__PURE__ */ jsxs22("div", { className: card_default.header, children: [
2903
+ title ?? /* @__PURE__ */ jsx37("div", {}),
2904
+ !!actions && /* @__PURE__ */ jsx37("div", { className: classNames6(card_default.actions, classes?.actions), children: actions })
2905
+ ] }),
2906
+ /* @__PURE__ */ jsx37("div", { className: classNames6(classes?.body), children })
2907
+ ] });
2908
+ }
2909
+ export {
2910
+ Button,
2911
+ ButtonsGroup,
2912
+ Card,
2913
+ Checkbox,
2914
+ Checklist,
2915
+ ColorPicker,
2916
+ DateTime,
2917
+ Input,
2918
+ Layout,
2919
+ Menu,
2920
+ Modal,
2921
+ MultiSelect,
2922
+ Pairs,
2923
+ Popover,
2924
+ SearchInput,
2925
+ Select,
2926
+ Surface,
2927
+ Tabs,
2928
+ Tooltip,
2929
+ TreeView_default as TreeView,
2930
+ Typography,
2931
+ VirtualTable,
2932
+ WrapForLabel
2933
+ };