stone-kit 0.0.651 → 0.0.653

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,46 +1,46 @@
1
- const d = ({
1
+ const t = ({
2
2
  option: e,
3
3
  setSelectedOptions: s,
4
- selectedOptions: r,
5
- disabledOptions: u,
6
- onChange: c,
4
+ selectedOptions: u,
5
+ disabledOptions: i,
6
+ onChange: r,
7
7
  mode: y,
8
- optionsParentArr: i
8
+ optionsParentArr: l
9
9
  }) => {
10
10
  if (!Array.isArray(e)) {
11
- if (u.includes(e))
11
+ if (i.includes(e))
12
12
  return;
13
- let f = r.some((l) => l.value === e.value) ? r.filter((l) => l.value !== e.value) : [...r, e];
13
+ let c = u.some((f) => f.value === e.value) ? u.filter((f) => f.value !== e.value) : [...u, e];
14
14
  if (y === "double") {
15
- "options" in e && r.includes(e) && (f = f.filter((n) => !e.options.includes(n)));
16
- const l = i == null ? void 0 : i.filter((S) => "options" in S && S.options.includes(e))[0];
17
- !(l && r.includes(l)) && l && f.push(l);
15
+ "options" in e && u.includes(e) && (c = c.filter((d) => !e.options.includes(d)));
16
+ const f = l == null ? void 0 : l.filter((S) => "options" in S && S.options.includes(e))[0];
17
+ !(f && u.includes(f)) && f && c.push(f);
18
18
  }
19
- s(f), c && c(f);
19
+ s(c), r && r(c);
20
20
  }
21
- }, J = ({
21
+ }, a = ({
22
22
  option: e,
23
23
  setSelectedOptions: s,
24
- selectedOptions: r,
25
- disabledOptions: u,
26
- onChange: c
24
+ selectedOptions: u,
25
+ disabledOptions: i,
26
+ onChange: r
27
27
  }) => {
28
28
  if (Array.isArray(e)) {
29
- const y = e.filter((i) => !(u != null && u.includes(i)));
30
- if (y.every((i) => r.map((f) => JSON.stringify(f)).includes(JSON.stringify(i)))) {
31
- const i = r.filter(
32
- (f) => !e.map((l) => JSON.stringify(l)).includes(JSON.stringify(f))
29
+ const y = e.filter((l) => !(i != null && i.includes(l)));
30
+ if (y.every((l) => u.map((c) => c).includes(l))) {
31
+ const l = u.filter(
32
+ (c) => !e.includes(c)
33
33
  );
34
- s(i), c && c(i);
34
+ s(l), r && r(l);
35
35
  } else {
36
- const i = y.filter(
37
- (l) => !r.map((t) => JSON.stringify(t)).includes(JSON.stringify(l))
38
- ), f = [...r, ...i];
39
- s(f), c && c(f);
36
+ const l = y.filter(
37
+ (f) => !u.includes(f)
38
+ ), c = [...u, ...l];
39
+ s(c), r && r(c);
40
40
  }
41
41
  }
42
42
  };
43
43
  export {
44
- J as handleClickModeCategory,
45
- d as handleClickModeOption
44
+ a as handleClickModeCategory,
45
+ t as handleClickModeOption
46
46
  };
@@ -1,12 +1,12 @@
1
- import { jsxs as m, Fragment as A, jsx as l } from "react/jsx-runtime";
2
- import { useState as D, useRef as W, useEffect as j } from "react";
1
+ import { jsxs as m, Fragment as w, jsx as i } from "react/jsx-runtime";
2
+ import { useState as A, useRef as D, useEffect as W } from "react";
3
3
  import { c as G } from "../../../index-rKuIKazb.js";
4
4
  import { s as e, O as H } from "../../../Option-a48eBPyn.js";
5
- import { NewIcon as w } from "../../NewIcon/ui/NewIcon.js";
5
+ import { NewIcon as j } from "../../NewIcon/ui/NewIcon.js";
6
6
  import { Category as J } from "./Category.js";
7
7
  import { handleClickModeOption as K, handleClickModeCategory as Q } from "../model/selectMode.js";
8
8
  const s = G.bind(e), ee = ({
9
- options: n,
9
+ options: r,
10
10
  placeholder: z = "Выберите опции",
11
11
  error: B,
12
12
  disabled: g,
@@ -16,7 +16,7 @@ const s = G.bind(e), ee = ({
16
16
  additionalClassBtn: b,
17
17
  onChange: F,
18
18
  onBlur: u,
19
- selectedValues: i = [],
19
+ selectedValues: c = [],
20
20
  isBtn: O = !1,
21
21
  btnName: C,
22
22
  clickableOptions: v,
@@ -25,29 +25,30 @@ const s = G.bind(e), ee = ({
25
25
  mode: a = "options",
26
26
  onClickItem: y,
27
27
  onCLickSelect: N,
28
- size_s: k = "large",
29
- size_m: S,
28
+ size_s: S = "large",
29
+ size_m: k,
30
30
  size_l: $
31
31
  }) => {
32
- const [c, x] = D(i), [o, p] = D(!1), h = W(null), E = (t) => {
32
+ r = [.../* @__PURE__ */ new Set([...r])];
33
+ const [l, x] = A(c), [o, p] = A(!1), h = D(null), E = (t) => {
33
34
  y && y(t);
34
- const r = {
35
+ const n = {
35
36
  option: t,
36
- selectedOptions: c,
37
+ selectedOptions: l,
37
38
  disabledOptions: f,
38
39
  setSelectedOptions: x,
39
40
  onChange: F,
40
41
  mode: a,
41
- optionsParentArr: n
42
+ optionsParentArr: r
42
43
  };
43
- Array.isArray(t) ? Q(r) : K(r);
44
+ Array.isArray(t) ? Q(n) : K(n);
44
45
  }, _ = () => {
45
- u && u(c);
46
+ u && u(l);
46
47
  };
47
- j(() => {
48
- const t = (r) => {
49
- const q = r.target;
50
- if (h.current && !h.current.contains(r.target)) {
48
+ W(() => {
49
+ const t = (n) => {
50
+ const q = n.target;
51
+ if (h.current && !h.current.contains(n.target)) {
51
52
  if (q.closest("svg"))
52
53
  return;
53
54
  p(!1);
@@ -57,10 +58,10 @@ const s = G.bind(e), ee = ({
57
58
  document.removeEventListener("click", t);
58
59
  };
59
60
  }, []);
60
- const R = W(i);
61
- return j(() => {
62
- i.length !== R.current.length && (x(i), R.current = i);
63
- }, [i]), /* @__PURE__ */ m(
61
+ const R = D(c);
62
+ return W(() => {
63
+ c.length !== R.current.length && (x(c), R.current = c);
64
+ }, [c]), /* @__PURE__ */ m(
64
65
  "div",
65
66
  {
66
67
  ref: h,
@@ -69,24 +70,24 @@ const s = G.bind(e), ee = ({
69
70
  onBlur: _,
70
71
  children: [
71
72
  /* @__PURE__ */ m("div", { className: s(e.inputWrapper), children: [
72
- !O && /* @__PURE__ */ m(A, { children: [
73
- /* @__PURE__ */ l(
73
+ !O && /* @__PURE__ */ m(w, { children: [
74
+ /* @__PURE__ */ i(
74
75
  "div",
75
76
  {
76
77
  className: s(
77
78
  e.selectedOptions,
78
- e[`${k}-size`],
79
- e[`${S}-size_m`],
79
+ e[`${S}-size`],
80
+ e[`${k}-size_m`],
80
81
  e[`${$}-size)_l`],
81
- { [e.selectedOptionsNotEmpty]: c.length > 0 },
82
+ { [e.selectedOptionsNotEmpty]: l.length > 0 },
82
83
  { [e.selectOptionsDisabled]: g }
83
84
  ),
84
85
  onClick: () => p(!o),
85
- children: c.length === 0 ? z : "Выбрано " + c.length
86
+ children: l.length === 0 ? z : "Выбрано " + l.length
86
87
  }
87
88
  ),
88
- /* @__PURE__ */ l(
89
- w,
89
+ /* @__PURE__ */ i(
90
+ j,
90
91
  {
91
92
  name: "arrowShort",
92
93
  deg: o ? "180" : "0",
@@ -95,14 +96,14 @@ const s = G.bind(e), ee = ({
95
96
  }
96
97
  )
97
98
  ] }),
98
- O && /* @__PURE__ */ m(A, { children: [
99
- /* @__PURE__ */ l(
99
+ O && /* @__PURE__ */ m(w, { children: [
100
+ /* @__PURE__ */ i(
100
101
  "button",
101
102
  {
102
103
  className: s(
103
104
  e.selectedOptions,
104
- e[`${k}-size`],
105
- e[`${S}-size_m`],
105
+ e[`${S}-size`],
106
+ e[`${k}-size_m`],
106
107
  e[`${$}-size_l`],
107
108
  e.selectedOptionsBtn,
108
109
  { [e.selectOptionsDisabled]: g },
@@ -114,8 +115,8 @@ const s = G.bind(e), ee = ({
114
115
  children: C
115
116
  }
116
117
  ),
117
- /* @__PURE__ */ l(
118
- w,
118
+ /* @__PURE__ */ i(
119
+ j,
119
120
  {
120
121
  name: "filter",
121
122
  deg: o ? "180" : "0",
@@ -126,32 +127,32 @@ const s = G.bind(e), ee = ({
126
127
  ] })
127
128
  ] }),
128
129
  o && /* @__PURE__ */ m("div", { className: s(e.optionsList, { [e.listRight]: P }, M), children: [
129
- a === "options" && (n == null ? void 0 : n.map((t, r) => /* @__PURE__ */ l(
130
+ a === "options" && (r == null ? void 0 : r.map((t, n) => /* @__PURE__ */ i(
130
131
  H,
131
132
  {
132
133
  disabledOptions: f,
133
134
  clickableOptions: v,
134
- selectedOptions: c,
135
+ selectedOptions: l,
135
136
  sizeIcon: d,
136
137
  option: t,
137
138
  handleOptionClick: E
138
139
  },
139
- r
140
+ n
140
141
  ))),
141
- (a === "category" || a === "double") && (n == null ? void 0 : n.map(
142
- (t, r) => "options" in t ? /* @__PURE__ */ l(
142
+ (a === "category" || a === "double") && (r == null ? void 0 : r.map(
143
+ (t, n) => "options" in t ? /* @__PURE__ */ i(
143
144
  J,
144
145
  {
145
146
  disabledOptions: f,
146
147
  clickableOptions: v,
147
- selectedOptions: c,
148
+ selectedOptions: l,
148
149
  sizeIcon: d,
149
150
  category: t,
150
151
  mode: a,
151
- selectedValues: i,
152
+ selectedValues: c,
152
153
  handleOptionClick: E
153
154
  },
154
- r
155
+ n
155
156
  ) : null
156
157
  ))
157
158
  ] })
@@ -11,7 +11,7 @@ export type TCategory = {
11
11
  export type TModeSelect = 'options' | 'category' | 'double';
12
12
  type SelectSizes = 'medium' | 'small' | 'large';
13
13
  export interface MultiSelectProps {
14
- options?: TOption[] | TCategory[];
14
+ options: TOption[] | TCategory[];
15
15
  category?: TCategory[];
16
16
  placeholder?: string;
17
17
  error?: boolean;
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.651",
5
+ "version": "0.0.653",
6
6
  "author": "Mollycodd1e",
7
7
  "license": "ISC",
8
8
  "type": "module",