stone-kit 0.0.1099 → 0.0.1100

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