stone-kit 0.0.650 → 0.0.651

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