@companix/uikit 0.0.49 → 0.0.50

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.
@@ -36,6 +36,13 @@
36
36
  }
37
37
  }
38
38
 
39
+ &-popover-loading {
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ padding: 20px 0px;
44
+ }
45
+
39
46
  &-add-option {
40
47
  color: #2d81e0;
41
48
 
@@ -18,6 +18,7 @@ export interface SelectParams {
18
18
  scrollTo: (index: number) => void;
19
19
  }>;
20
20
  addOption?: SelectAddOption;
21
+ isLoading?: boolean;
21
22
  }
22
23
  export type SelectProps<T> = Omit<SelectFormProps, 'value' | 'onChange' | 'closeButton'> & DependedValueType<T> & SelectParams & {
23
24
  value: T | null;
@@ -1,16 +1,17 @@
1
- import { jsx as l } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import { useMemo as I, useImperativeHandle as T } from "react";
3
3
  import { Popover as b } from "./bundle.es10.js";
4
- import { useFroozeClosing as z } from "./bundle.es45.js";
5
- import { SelectInput as B } from "./bundle.es46.js";
6
- import { useScrollListController as D } from "./bundle.es47.js";
4
+ import { useFroozeClosing as B } from "./bundle.es45.js";
5
+ import { SelectInput as D } from "./bundle.es46.js";
6
+ import { useScrollListController as L } from "./bundle.es47.js";
7
7
  import { SelectOptions as j } from "./bundle.es48.js";
8
8
  import { mergeRefs as w } from "react-merge-refs";
9
- const J = (a) => {
9
+ import { Spinner as H } from "./bundle.es6.js";
10
+ const Q = (a) => {
10
11
  const {
11
- options: n,
12
- onChange: i,
13
- value: r,
12
+ options: t,
13
+ onChange: l,
14
+ value: i,
14
15
  minimalOptions: m,
15
16
  matchTarget: f = "width",
16
17
  children: u,
@@ -19,55 +20,56 @@ const J = (a) => {
19
20
  popoverRef: v,
20
21
  clearButton: s,
21
22
  addOption: h,
23
+ isLoading: g,
22
24
  ...x
23
- } = a, t = I(() => {
24
- const o = r === null ? -1 : n.findIndex((e) => e.value === r);
25
+ } = a, r = I(() => {
26
+ const o = i === null ? -1 : t.findIndex((e) => e.value === i);
25
27
  return {
26
28
  index: o,
27
- option: n[o]
29
+ option: t[o]
28
30
  };
29
- }, [n, r]), R = t.option?.value ?? null, { popoverRef: C, froozePopoverPosition: O, handleAnimationEnd: g } = z(), { scrollToElement: c, optionsWrapperRef: P, scrollBoxRef: S } = D();
31
+ }, [t, i]), R = r.option?.value ?? null, { popoverRef: C, froozePopoverPosition: O, handleAnimationEnd: P } = B(), { scrollToElement: c, optionsWrapperRef: S, scrollBoxRef: A } = L();
30
32
  T(d, () => ({
31
33
  scrollTo: (o) => c(o, "top")
32
34
  }));
33
- const A = (o, e) => {
34
- O(), i(o), e();
35
+ const z = (o, e) => {
36
+ O(), l(o), e();
35
37
  }, E = (o) => {
36
- o.stopPropagation(), s && i(null);
38
+ o.stopPropagation(), s && l(null);
37
39
  }, F = () => {
38
- t.index !== -1 && c(t.index, "center");
40
+ r.index !== -1 && c(r.index, "center");
39
41
  };
40
- return /* @__PURE__ */ l(
42
+ return /* @__PURE__ */ n(
41
43
  b,
42
44
  {
43
45
  minimal: !0,
44
46
  ref: w([C, v]),
45
47
  sideOffset: 0,
46
48
  matchTarget: f,
47
- onAnimationEnd: g,
49
+ onAnimationEnd: P,
48
50
  onOpenAutoFocus: (o) => o.preventDefault(),
49
51
  onCloseAutoFocus: (o) => o.preventDefault(),
50
52
  disabled: p,
51
- content: ({ close: o }) => /* @__PURE__ */ l(
53
+ content: ({ close: o }) => g ? /* @__PURE__ */ n("div", { className: "select-popover-loading", children: /* @__PURE__ */ n(H, { size: 24 }) }) : /* @__PURE__ */ n(
52
54
  j,
53
55
  {
54
- options: n,
56
+ options: t,
55
57
  active: R,
56
- scrollboxRef: S,
57
- optionsWrapperRef: P,
58
+ scrollboxRef: A,
59
+ optionsWrapperRef: S,
58
60
  minimalOptions: m,
59
61
  addOption: h,
60
62
  onOpened: F,
61
- onSelect: (e) => A(e, o)
63
+ onSelect: (e) => z(e, o)
62
64
  }
63
65
  ),
64
- children: u ?? /* @__PURE__ */ l(
65
- B,
66
+ children: u ?? /* @__PURE__ */ n(
67
+ D,
66
68
  {
67
69
  ...x,
68
70
  disabled: p,
69
71
  clearButton: s,
70
- value: t.option?.title ?? "",
72
+ value: r.option?.title ?? "",
71
73
  onClear: E
72
74
  }
73
75
  )
@@ -75,5 +77,5 @@ const J = (a) => {
75
77
  );
76
78
  };
77
79
  export {
78
- J as Select
80
+ Q as Select
79
81
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import o from "classnames";
3
- const i = ({ size: r = 40, className: t, color: e }) => /* @__PURE__ */ n(
3
+ const i = ({ size: r = 18, className: t, color: e }) => /* @__PURE__ */ n(
4
4
  "div",
5
5
  {
6
6
  style: { width: `${r}px`, height: `${r}px`, color: e },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",