@companix/uikit 0.0.47 → 0.0.49

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.
@@ -1,5 +1,6 @@
1
1
  export interface SpinnerProps {
2
2
  size?: number;
3
3
  className?: string;
4
+ color?: string;
4
5
  }
5
- export declare const Spinner: ({ size, className }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const Spinner: ({ size, className, color }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,67 +1,65 @@
1
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
- import { useFroozeClosing as M } from "./bundle.es45.js";
3
- import { Popover as j } from "./bundle.es10.js";
4
- import { OptionItem as q } from "./bundle.es14.js";
5
- import { OptionsList as V } from "./bundle.es16.js";
1
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import { useFroozeClosing as j } from "./bundle.es45.js";
3
+ import { Popover as q } from "./bundle.es10.js";
4
+ import { OptionItem as V } from "./bundle.es14.js";
5
+ import { OptionsList as B } from "./bundle.es16.js";
6
6
  import { Icon as d } from "./bundle.es33.js";
7
- import { useState as B, useRef as h, useMemo as g } from "react";
8
- import { attr as v, getActiveElementByAnotherElement as H, contains as Q } from "@companix/utils-browser";
9
- import { mergeRefs as X } from "react-merge-refs";
10
- import { faXmark as G, faChevronDown as J } from "@companix/icons-solid";
11
- const re = (x) => {
7
+ import { useState as H, useRef as h, useMemo as g } from "react";
8
+ import { attr as v, getActiveElementByAnotherElement as L, contains as X } from "@companix/utils-browser";
9
+ import { mergeRefs as G } from "react-merge-refs";
10
+ import { faXmark as J, faChevronDown as K } from "@companix/icons-solid";
11
+ import { matchPattern as Q } from "@companix/utils-js";
12
+ const ie = (x) => {
12
13
  const {
13
14
  options: r,
14
15
  closeAfterSelect: C,
15
16
  placeholder: N,
16
- onChange: l,
17
+ onChange: c,
17
18
  emptyText: R = "Ничего не найдено",
18
- readOnly: m,
19
- size: z = "md",
19
+ readOnly: l,
20
+ size: A = "md",
20
21
  value: n,
21
- inputRef: A,
22
+ inputRef: z,
22
23
  disabled: f,
23
- required: y
24
- } = x, [s, D] = B(""), a = h(null), b = h(null), { popoverRef: u, froozePopoverPosition: k, handleAnimationEnd: w } = M(), E = g(() => {
24
+ required: D
25
+ } = x, [a, P] = H(""), i = h(null), b = h(null), { popoverRef: m, froozePopoverPosition: k, handleAnimationEnd: y } = j(), E = g(() => {
25
26
  const e = {};
26
27
  return r.forEach((t) => {
27
28
  e[t.value] = t;
28
29
  }), e;
29
- }, [r]), O = (e) => n.includes(e) ? [...n] : [...n, e], P = (e) => n.filter((t) => e !== t), T = (e, t) => {
30
- C ? (k(), l(e), t()) : l(e);
31
- }, p = g(() => s.trim() ? r.filter(({ title: e }) => {
32
- const t = e.toLowerCase(), i = s.trim().toLowerCase();
33
- return t.indexOf(i) >= 0;
34
- }) : r, [s, r]), I = (e) => {
30
+ }, [r]), O = (e) => n.includes(e) ? [...n] : [...n, e], T = (e) => n.filter((t) => e !== t), w = (e, t) => {
31
+ C ? (k(), c(e), t()) : c(e);
32
+ }, p = g(() => a.trim() ? r.filter(({ title: e }) => Q(e, a)) : r, [a, r]), I = (e) => {
35
33
  if (f) return;
36
- u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
37
- const t = H(e.currentTarget);
38
- e.defaultPrevented || Q(e.currentTarget, t) || a.current && a.current.focus();
34
+ m.current && m.current.getAttribute("data-state") === "open" && e.preventDefault();
35
+ const t = L(e.currentTarget);
36
+ e.defaultPrevented || X(e.currentTarget, t) || i.current && i.current.focus();
39
37
  }, S = (e) => {
40
- e.target !== a.current && e.preventDefault();
38
+ e.target !== i.current && e.preventDefault();
41
39
  }, $ = (e, t) => {
42
- e.stopPropagation(), l(P(t));
40
+ e.stopPropagation(), c(T(t));
43
41
  };
44
42
  return /* @__PURE__ */ o(
45
- j,
43
+ q,
46
44
  {
47
45
  minimal: !0,
48
- ref: u,
46
+ ref: m,
49
47
  sideOffset: 0,
50
48
  matchTarget: "width",
51
- onAnimationEnd: w,
49
+ onAnimationEnd: y,
52
50
  onOpenAutoFocus: (e) => e.preventDefault(),
53
51
  onCloseAutoFocus: (e) => e.preventDefault(),
54
- content: ({ close: e }) => /* @__PURE__ */ c(V, { maxHeight: 300, children: [
52
+ content: ({ close: e }) => /* @__PURE__ */ s(B, { maxHeight: 300, children: [
55
53
  p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: R }),
56
- p.map(({ value: t, title: i, icon: F }, L) => /* @__PURE__ */ o(
57
- q,
54
+ p.map(({ value: t, title: u, icon: F }, M) => /* @__PURE__ */ o(
55
+ V,
58
56
  {
59
57
  active: n.includes(t),
60
- onClick: () => T(O(t), e),
61
- title: i,
58
+ onClick: () => w(O(t), e),
59
+ title: u,
62
60
  icon: F
63
61
  },
64
- `option-item-${t}-${L}`
62
+ `option-item-${t}-${M}`
65
63
  ))
66
64
  ] }),
67
65
  children: /* @__PURE__ */ o(
@@ -70,42 +68,42 @@ const re = (x) => {
70
68
  className: "form",
71
69
  onClick: I,
72
70
  onMouseDown: S,
73
- "data-size": z,
74
- "data-required": v(y),
75
- children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
76
- /* @__PURE__ */ c("div", { className: "select-tags", children: [
71
+ "data-size": A,
72
+ "data-required": v(D),
73
+ children: /* @__PURE__ */ s("div", { className: "select-tags-container", children: [
74
+ /* @__PURE__ */ s("div", { className: "select-tags", children: [
77
75
  n.length > 0 && /* @__PURE__ */ o(
78
76
  "div",
79
77
  {
80
78
  className: "tag-container",
81
79
  ref: b,
82
80
  role: "listbox",
83
- "data-readonly": v(m),
84
- children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
81
+ "data-readonly": v(l),
82
+ children: n.map((e, t) => /* @__PURE__ */ s("div", { className: "tag", children: [
85
83
  /* @__PURE__ */ o("span", { className: "tag-name", children: E[e].title }),
86
- /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (i) => $(i, e), children: /* @__PURE__ */ o(d, { className: "tag-close-icon", icon: G, size: "xxxs" }) })
84
+ /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (u) => $(u, e), children: /* @__PURE__ */ o(d, { className: "tag-close-icon", icon: J, size: "xxxs" }) })
87
85
  ] }, `tag-option-${e}-${t}`))
88
86
  }
89
87
  ),
90
- (!m || n.length === 0) && /* @__PURE__ */ o(
88
+ (!l || n.length === 0) && /* @__PURE__ */ o(
91
89
  "input",
92
90
  {
93
- ref: X([A, a]),
91
+ ref: G([z, i]),
94
92
  type: "text",
95
93
  autoCapitalize: "none",
96
94
  autoComplete: "off",
97
95
  autoCorrect: "off",
98
96
  className: "form-input",
99
97
  spellCheck: !1,
100
- value: s,
98
+ value: a,
101
99
  disabled: f,
102
- readOnly: m,
100
+ readOnly: l,
103
101
  placeholder: N,
104
- onChange: ({ target: e }) => D(e.value)
102
+ onChange: ({ target: e }) => P(e.value)
105
103
  }
106
104
  )
107
105
  ] }),
108
- /* @__PURE__ */ o(d, { className: "expand-icon", icon: J, size: "xxxs" })
106
+ /* @__PURE__ */ o(d, { className: "expand-icon", icon: K, size: "xxxs" })
109
107
  ] })
110
108
  }
111
109
  )
@@ -113,5 +111,5 @@ const re = (x) => {
113
111
  );
114
112
  };
115
113
  export {
116
- re as SelectTags
114
+ ie as SelectTags
117
115
  };
@@ -1,13 +1,13 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import n from "classnames";
3
- const s = ({ size: r = 40, className: t }) => /* @__PURE__ */ e(
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import o from "classnames";
3
+ const i = ({ size: r = 40, className: t, color: e }) => /* @__PURE__ */ n(
4
4
  "div",
5
5
  {
6
- style: { width: `${r}px`, height: `${r}px` },
7
- className: n("spinner", t),
6
+ style: { width: `${r}px`, height: `${r}px`, color: e },
7
+ className: o("spinner", t),
8
8
  role: "status"
9
9
  }
10
10
  );
11
11
  export {
12
- s as Spinner
12
+ i as Spinner
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",