@companix/uikit 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Select/OptionsPopover.d.ts +1 -0
- package/dist/bundle.es50.js +73 -70
- package/package.json +1 -1
package/dist/bundle.es50.js
CHANGED
|
@@ -1,92 +1,95 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { Spinner as
|
|
4
|
-
import { OptionItem as
|
|
5
|
-
import { OptionsList as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { faPlus as
|
|
8
|
-
const
|
|
9
|
-
const { onOptionsLoaded: e, useOptions:
|
|
10
|
-
return
|
|
1
|
+
import { jsx as i, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as k, useEffect as C } from "react";
|
|
3
|
+
import { Spinner as P } from "./bundle.es6.js";
|
|
4
|
+
import { OptionItem as L } from "./bundle.es15.js";
|
|
5
|
+
import { OptionsList as T } from "./bundle.es17.js";
|
|
6
|
+
import { Icon as R } from "./bundle.es33.js";
|
|
7
|
+
import { faPlus as S } from "@companix/icons-solid";
|
|
8
|
+
const b = () => ({ isLoading: !1, options: [] }), I = (n) => {
|
|
9
|
+
const { onOptionsLoaded: e, useOptions: s = b, options: o } = n, t = s();
|
|
10
|
+
return C(() => {
|
|
11
11
|
t.options.length > 0 && e?.(t.options);
|
|
12
12
|
}, [t.options]), o ? { options: o, isLoading: !1 } : t;
|
|
13
|
-
},
|
|
13
|
+
}, H = (n) => {
|
|
14
14
|
const {
|
|
15
15
|
isActive: e,
|
|
16
|
-
emptyText:
|
|
16
|
+
emptyText: s,
|
|
17
17
|
isLoading: o,
|
|
18
18
|
scrollboxRef: t,
|
|
19
|
-
optionsWrapperRef:
|
|
20
|
-
addOption:
|
|
21
|
-
onOpened:
|
|
22
|
-
onSelect:
|
|
23
|
-
minimalOptions:
|
|
24
|
-
filterOptions:
|
|
25
|
-
disableFiltering:
|
|
26
|
-
close:
|
|
27
|
-
...
|
|
28
|
-
} =
|
|
29
|
-
return g ?? o ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(
|
|
30
|
-
|
|
19
|
+
optionsWrapperRef: d,
|
|
20
|
+
addOption: p,
|
|
21
|
+
onOpened: f,
|
|
22
|
+
onSelect: O,
|
|
23
|
+
minimalOptions: u,
|
|
24
|
+
filterOptions: r,
|
|
25
|
+
disableFiltering: l,
|
|
26
|
+
close: c,
|
|
27
|
+
...a
|
|
28
|
+
} = n, { emptyText: x, options: m, isLoading: g } = I(a), v = k(() => r && !l ? m.filter(r) : m, [m, r, l]);
|
|
29
|
+
return g ?? o ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(P, { size: 24 }) }) : /* @__PURE__ */ i(
|
|
30
|
+
N,
|
|
31
31
|
{
|
|
32
|
-
options:
|
|
32
|
+
options: v,
|
|
33
33
|
isActive: e,
|
|
34
|
-
emptyText: x ??
|
|
34
|
+
emptyText: x ?? s,
|
|
35
35
|
scrollboxRef: t,
|
|
36
|
-
optionsWrapperRef:
|
|
37
|
-
minimalOptions:
|
|
38
|
-
addOption:
|
|
39
|
-
onOpened:
|
|
40
|
-
onSelect:
|
|
41
|
-
close:
|
|
36
|
+
optionsWrapperRef: d,
|
|
37
|
+
minimalOptions: u,
|
|
38
|
+
addOption: p,
|
|
39
|
+
onOpened: f,
|
|
40
|
+
onSelect: O,
|
|
41
|
+
close: c
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
|
-
},
|
|
44
|
+
}, N = (n) => {
|
|
45
45
|
const {
|
|
46
46
|
isActive: e,
|
|
47
|
-
onOpened:
|
|
47
|
+
onOpened: s,
|
|
48
48
|
addOption: o,
|
|
49
49
|
scrollboxRef: t,
|
|
50
|
-
optionsWrapperRef:
|
|
51
|
-
options:
|
|
52
|
-
onSelect:
|
|
53
|
-
minimalOptions:
|
|
54
|
-
emptyText:
|
|
55
|
-
close:
|
|
56
|
-
} =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, [])
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
50
|
+
optionsWrapperRef: d,
|
|
51
|
+
options: p,
|
|
52
|
+
onSelect: f,
|
|
53
|
+
minimalOptions: O,
|
|
54
|
+
emptyText: u = "Ничего не найдено",
|
|
55
|
+
close: r
|
|
56
|
+
} = n;
|
|
57
|
+
C(() => {
|
|
58
|
+
s?.(p.findIndex(({ value: c }) => e(c)));
|
|
59
|
+
}, []);
|
|
60
|
+
const l = o ? /* @__PURE__ */ i(
|
|
61
|
+
L,
|
|
62
|
+
{
|
|
63
|
+
className: "select-add-option",
|
|
64
|
+
icon: /* @__PURE__ */ i(R, { icon: S }),
|
|
65
|
+
title: o.text,
|
|
66
|
+
onClick: o.onClick,
|
|
67
|
+
onClickCapture: () => {
|
|
68
|
+
o.closeOnClick && r();
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
}
|
|
71
|
+
) : void 0;
|
|
72
|
+
return /* @__PURE__ */ y(T, { scrollboxRef: t, optionsWrapperRef: d, maxHeight: 300, children: [
|
|
73
|
+
(o?.position === void 0 || o?.position === "first") && l,
|
|
74
|
+
p.length === 0 && !o && /* @__PURE__ */ i("div", { className: "select-tags-empty", children: u }),
|
|
75
|
+
p.map(({ title: c, value: a, className: x, icon: m, disabled: g, label: v }, h) => /* @__PURE__ */ i(
|
|
76
|
+
L,
|
|
75
77
|
{
|
|
76
|
-
active: e(
|
|
77
|
-
onClick: () =>
|
|
78
|
-
minimal:
|
|
79
|
-
disabled:
|
|
80
|
-
className:
|
|
81
|
-
title:
|
|
82
|
-
label:
|
|
83
|
-
icon:
|
|
78
|
+
active: e(a),
|
|
79
|
+
onClick: () => f?.(a),
|
|
80
|
+
minimal: O,
|
|
81
|
+
disabled: g,
|
|
82
|
+
className: x,
|
|
83
|
+
title: c,
|
|
84
|
+
label: v,
|
|
85
|
+
icon: m
|
|
84
86
|
},
|
|
85
|
-
`select-option-${
|
|
86
|
-
))
|
|
87
|
+
`select-option-${h}`
|
|
88
|
+
)),
|
|
89
|
+
o?.position === "last" && l
|
|
87
90
|
] });
|
|
88
91
|
};
|
|
89
92
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
H as OptionsPopover,
|
|
94
|
+
N as SelectOptionsList
|
|
92
95
|
};
|