@companix/uikit 0.0.71 → 0.0.72

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.
@@ -27,6 +27,7 @@ export interface SelectOptionsPopoverParams {
27
27
  minimalOptions?: boolean;
28
28
  addOption?: SelectAddOption;
29
29
  emptyText?: string;
30
+ isLoading?: boolean;
30
31
  }
31
32
  interface InternalListProps<T> extends SelectOptionsPopoverParams {
32
33
  options: Option<T>[];
@@ -1,87 +1,88 @@
1
- import { jsx as e, jsxs as y } from "react/jsx-runtime";
2
- import { useMemo as L, useEffect as h } from "react";
1
+ import { jsx as i, jsxs as v } from "react/jsx-runtime";
2
+ import { useMemo as y, useEffect as h } from "react";
3
3
  import { Spinner as k } from "./bundle.es6.js";
4
4
  import { OptionItem as C } from "./bundle.es15.js";
5
- import { OptionsList as T } from "./bundle.es17.js";
6
- import { Icon as P } from "./bundle.es33.js";
5
+ import { OptionsList as P } from "./bundle.es17.js";
6
+ import { Icon as T } from "./bundle.es33.js";
7
7
  import { faPlus as R } from "@companix/icons-solid";
8
- const S = () => ({ isLoading: !1, options: [] }), b = (n) => {
9
- const { onOptionsLoaded: i, useOptions: s = S, options: o } = n, t = s();
8
+ const S = () => ({ isLoading: !1, options: [] }), b = (s) => {
9
+ const { onOptionsLoaded: e, useOptions: p = S, options: o } = s, t = p();
10
10
  return h(() => {
11
- t.options.length > 0 && i?.(t.options);
11
+ t.options.length > 0 && e?.(t.options);
12
12
  }, [t.options]), o ? { options: o, isLoading: !1 } : t;
13
- }, F = (n) => {
13
+ }, F = (s) => {
14
14
  const {
15
- isActive: i,
16
- emptyText: s,
17
- scrollboxRef: o,
18
- optionsWrapperRef: t,
19
- addOption: f,
20
- onOpened: p,
21
- onSelect: d,
15
+ isActive: e,
16
+ emptyText: p,
17
+ isLoading: o,
18
+ scrollboxRef: t,
19
+ optionsWrapperRef: a,
20
+ addOption: r,
21
+ onOpened: d,
22
+ onSelect: f,
22
23
  minimalOptions: O,
23
- filterOptions: r,
24
- disableFiltering: m,
25
- close: c,
26
- ...a
27
- } = n, { emptyText: u, options: l, isLoading: x } = b(a), g = L(() => r && !m ? l.filter(r) : l, [l, r, m]);
28
- return x ? /* @__PURE__ */ e("div", { className: "select-popover-loading", children: /* @__PURE__ */ e(k, { size: 24 }) }) : /* @__PURE__ */ e(
24
+ filterOptions: c,
25
+ disableFiltering: n,
26
+ close: m,
27
+ ...u
28
+ } = s, { emptyText: x, options: l, isLoading: g } = b(u), L = y(() => c && !n ? l.filter(c) : l, [l, c, n]);
29
+ return g ?? o ? /* @__PURE__ */ i("div", { className: "select-popover-loading", children: /* @__PURE__ */ i(k, { size: 24 }) }) : /* @__PURE__ */ i(
29
30
  I,
30
31
  {
31
- options: g,
32
- isActive: i,
33
- emptyText: u ?? s,
34
- scrollboxRef: o,
35
- optionsWrapperRef: t,
32
+ options: L,
33
+ isActive: e,
34
+ emptyText: x ?? p,
35
+ scrollboxRef: t,
36
+ optionsWrapperRef: a,
36
37
  minimalOptions: O,
37
- addOption: f,
38
- onOpened: p,
39
- onSelect: d,
40
- close: c
38
+ addOption: r,
39
+ onOpened: d,
40
+ onSelect: f,
41
+ close: m
41
42
  }
42
43
  );
43
- }, I = (n) => {
44
+ }, I = (s) => {
44
45
  const {
45
- isActive: i,
46
- onOpened: s,
46
+ isActive: e,
47
+ onOpened: p,
47
48
  addOption: o,
48
49
  scrollboxRef: t,
49
- optionsWrapperRef: f,
50
- options: p,
50
+ optionsWrapperRef: a,
51
+ options: r,
51
52
  onSelect: d,
52
- minimalOptions: O,
53
- emptyText: r = "Ничего не найдено",
54
- close: m
55
- } = n;
53
+ minimalOptions: f,
54
+ emptyText: O = "Ничего не найдено",
55
+ close: c
56
+ } = s;
56
57
  return h(() => {
57
- s?.(p.findIndex(({ value: c }) => i(c)));
58
- }, []), /* @__PURE__ */ y(T, { scrollboxRef: t, optionsWrapperRef: f, maxHeight: 300, children: [
59
- o && /* @__PURE__ */ e(
58
+ p?.(r.findIndex(({ value: n }) => e(n)));
59
+ }, []), /* @__PURE__ */ v(P, { scrollboxRef: t, optionsWrapperRef: a, maxHeight: 300, children: [
60
+ o && /* @__PURE__ */ i(
60
61
  C,
61
62
  {
62
63
  className: "select-add-option",
63
- icon: /* @__PURE__ */ e(P, { icon: R }),
64
+ icon: /* @__PURE__ */ i(T, { icon: R }),
64
65
  title: o.text,
65
66
  onClick: o.onClick,
66
67
  onClickCapture: () => {
67
- o.closeOnClick && m();
68
+ o.closeOnClick && c();
68
69
  }
69
70
  }
70
71
  ),
71
- p.length === 0 && !o && /* @__PURE__ */ e("div", { className: "select-tags-empty", children: r }),
72
- p.map(({ title: c, value: a, className: u, icon: l, disabled: x, label: g }, v) => /* @__PURE__ */ e(
72
+ r.length === 0 && !o && /* @__PURE__ */ i("div", { className: "select-tags-empty", children: O }),
73
+ r.map(({ title: n, value: m, className: u, icon: x, disabled: l, label: g }, L) => /* @__PURE__ */ i(
73
74
  C,
74
75
  {
75
- active: i(a),
76
- onClick: () => d?.(a),
77
- minimal: O,
78
- disabled: x,
76
+ active: e(m),
77
+ onClick: () => d?.(m),
78
+ minimal: f,
79
+ disabled: l,
79
80
  className: u,
80
- title: c,
81
+ title: n,
81
82
  label: g,
82
- icon: l
83
+ icon: x
83
84
  },
84
- `select-option-${v}`
85
+ `select-option-${L}`
85
86
  ))
86
87
  ] });
87
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",