stone-kit 0.0.1097 → 0.0.1099

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,88 +1,91 @@
1
- import { jsxs as a, jsx as c } from "react/jsx-runtime";
2
- import { useState as _, useRef as x, useEffect as E } from "react";
3
- import { c as L } from "../../../index-DIxK0V-G.js";
4
- import { NewIcon as O } from "../../NewIcon/ui/NewIcon.js";
5
- const C = "_multiSelectWrapper_1hlrv_1", D = "_selectedOptions_1hlrv_7", w = "_selectedOptionsOpened_1hlrv_28", y = "_selectOptionsDisabled_1hlrv_32", I = "_optionsList_1hlrv_39", j = "_inputWrapper_1hlrv_54", z = "_option_1hlrv_39", R = "_icon_1hlrv_76", t = {
6
- multiSelectWrapper: C,
7
- selectedOptions: D,
8
- selectedOptionsOpened: w,
9
- selectOptionsDisabled: y,
10
- optionsList: I,
11
- inputWrapper: j,
12
- option: z,
13
- icon: R
14
- }, i = L.bind(t), B = ({
15
- options: h,
16
- placeholder: f = "Выберите опции",
17
- error: S,
18
- disabled: W,
19
- additionalClass: k = "",
20
- onChange: p,
21
- onBlur: d
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as h, useRef as L, useEffect as f } from "react";
3
+ import { c as C } from "../../../index-DIxK0V-G.js";
4
+ import { NewIcon as S } from "../../NewIcon/ui/NewIcon.js";
5
+ const D = "_multiSelectWrapper_1hlrv_1", w = "_selectedOptions_1hlrv_7", y = "_selectedOptionsOpened_1hlrv_28", I = "_selectOptionsDisabled_1hlrv_32", j = "_optionsList_1hlrv_39", z = "_inputWrapper_1hlrv_54", R = "_option_1hlrv_39", B = "_icon_1hlrv_76", t = {
6
+ multiSelectWrapper: D,
7
+ selectedOptions: w,
8
+ selectedOptionsOpened: y,
9
+ selectOptionsDisabled: I,
10
+ optionsList: j,
11
+ inputWrapper: z,
12
+ option: R,
13
+ icon: B
14
+ }, i = C.bind(t), P = ({
15
+ options: W,
16
+ placeholder: k = "Выберите опции",
17
+ error: N,
18
+ disabled: b,
19
+ additionalClass: g = "",
20
+ onChange: d,
21
+ onBlur: u,
22
+ selectedValues: o = []
22
23
  }) => {
23
- const [s, N] = _([]), [o, u] = _(!1), r = x(null), b = (e) => (n) => {
24
+ const [s, m] = h(o), [r, v] = h(!1), a = L(null), x = (e) => (n) => {
24
25
  n.stopPropagation();
25
- const v = s.some((l) => l.value === e.value) ? s.filter((l) => l.value !== e.value) : [...s, e];
26
- if (N(v), p) {
26
+ const O = s.some((l) => l.value === e.value) ? s.filter((l) => l.value !== e.value) : [...s, e];
27
+ if (m(O), d) {
27
28
  const l = {
28
29
  ...n,
29
- target: { value: v }
30
+ target: { value: O }
30
31
  };
31
- p(l);
32
+ d(l);
32
33
  }
33
- }, m = (e) => {
34
- r.current && !r.current.contains(e.target) && u(!1);
35
- }, g = (e) => {
36
- if (d) {
34
+ }, _ = (e) => {
35
+ a.current && !a.current.contains(e.target) && v(!1);
36
+ }, E = (e) => {
37
+ if (u) {
37
38
  const n = {
38
39
  ...e,
39
40
  target: { value: s }
40
41
  };
41
- d(n);
42
+ u(n);
42
43
  }
43
44
  };
44
- return E(() => (document.addEventListener("click", m), () => {
45
- document.removeEventListener("click", m);
46
- }), []), /* @__PURE__ */ a(
45
+ return f(() => (document.addEventListener("click", _), () => {
46
+ document.removeEventListener("click", _);
47
+ }), []), f(() => {
48
+ m(o);
49
+ }, [o]), /* @__PURE__ */ p(
47
50
  "div",
48
51
  {
49
- ref: r,
50
- className: i(t.multiSelectWrapper, { [t.multiSelectWrapperError]: S }, k),
52
+ ref: a,
53
+ className: i(t.multiSelectWrapper, { [t.multiSelectWrapperError]: N }, g),
51
54
  tabIndex: 0,
52
- onBlur: g,
55
+ onBlur: E,
53
56
  children: [
54
- /* @__PURE__ */ a("div", { className: i(t.inputWrapper), children: [
57
+ /* @__PURE__ */ p("div", { className: i(t.inputWrapper), children: [
55
58
  /* @__PURE__ */ c(
56
59
  "input",
57
60
  {
58
61
  type: "text",
59
62
  readOnly: !0,
60
- value: s.length === 0 ? f : "Выбрано " + s.length + " опции",
61
- className: i(t.selectedOptions, { [t.selectOptionsDisabled]: W }),
62
- onClick: () => u(!o)
63
+ value: s.length === 0 ? k : "Выбрано " + s.length + " опции",
64
+ className: i(t.selectedOptions, { [t.selectOptionsDisabled]: b }),
65
+ onClick: () => v(!r)
63
66
  }
64
67
  ),
65
68
  /* @__PURE__ */ c(
66
- O,
69
+ S,
67
70
  {
68
71
  name: "arrowShort",
69
- deg: o ? "180" : "0",
72
+ deg: r ? "180" : "0",
70
73
  size: "24",
71
74
  additionalClass: t.icon
72
75
  }
73
76
  )
74
77
  ] }),
75
- o && /* @__PURE__ */ c("div", { className: t.optionsList, children: h.map((e) => /* @__PURE__ */ a(
78
+ r && /* @__PURE__ */ c("div", { className: t.optionsList, children: W.map((e) => /* @__PURE__ */ p(
76
79
  "div",
77
80
  {
78
81
  className: i(t.option, {
79
82
  [t.selected]: s.some((n) => n.value === e.value)
80
83
  }),
81
- onClick: b(e),
84
+ onClick: x(e),
82
85
  children: [
83
86
  /* @__PURE__ */ c("div", { children: e.label }),
84
87
  /* @__PURE__ */ c(
85
- O,
88
+ S,
86
89
  {
87
90
  size: "20",
88
91
  name: s.some((n) => n.value === e.value) ? "selectChecked" : "selectUnchecked"
@@ -96,7 +99,7 @@ const C = "_multiSelectWrapper_1hlrv_1", D = "_selectedOptions_1hlrv_7", w = "_s
96
99
  }
97
100
  );
98
101
  };
99
- B.displayName = "Select";
102
+ P.displayName = "Select";
100
103
  export {
101
- B as Select
104
+ P as Select
102
105
  };
@@ -11,4 +11,5 @@ export interface MultiSelectProps {
11
11
  onChange?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
12
12
  onBlur?: (event: React.FocusEvent<HTMLDivElement, Element>) => void;
13
13
  additionalClass?: string;
14
+ selectedValues?: Option[];
14
15
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "stone-kit",
3
3
  "description": "uikit for redesign",
4
4
  "private": false,
5
- "version": "0.0.1097",
5
+ "version": "0.0.1099",
6
6
  "author": "Mollycodd1e",
7
7
  "license": "ISC",
8
8
  "type": "module",