stone-kit 0.0.777 → 0.0.779

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.
@@ -214,7 +214,7 @@ const d = ({
214
214
  title: t,
215
215
  titleId: l,
216
216
  ...r
217
- }, a) => /* @__PURE__ */ e.createElement("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ref: a, "aria-labelledby": l, ...r }, t ? /* @__PURE__ */ e.createElement("title", { id: l }, t) : null, /* @__PURE__ */ e.createElement("path", { d: "M10.0004 0C7.34927 0.0028667 4.8075 1.05704 2.93284 2.93121C1.05818 4.80539 0.00373907 7.3465 0.000871626 9.99698C-0.104124 17.9721 9.29963 22.8506 15.7502 18.1753C15.8429 18.1137 15.9223 18.0341 15.9837 17.9413C16.0451 17.8484 16.0873 17.7442 16.1078 17.6348C16.1282 17.5254 16.1266 17.413 16.1028 17.3043C16.0791 17.1955 16.0339 17.0926 15.9697 17.0017C15.9056 16.9107 15.8238 16.8335 15.7294 16.7746C15.6349 16.7158 15.5295 16.6764 15.4196 16.659C15.3096 16.6415 15.1973 16.6462 15.0892 16.6728C14.9811 16.6995 14.8794 16.7475 14.7902 16.8141C9.41713 20.7071 1.58414 16.6433 1.66747 9.99698C2.12495 -1.05468 17.8776 -1.05218 18.3334 9.99698V11.6631C18.3334 12.105 18.1578 12.5288 17.8453 12.8413C17.5327 13.1538 17.1088 13.3293 16.6668 13.3293C16.2248 13.3293 15.8009 13.1538 15.4884 12.8413C15.1758 12.5288 15.0002 12.105 15.0002 11.6631V9.99698C14.7902 3.39148 5.20981 3.39231 5.00065 9.99698C5.01035 11.01 5.32685 11.9963 5.90843 12.8259C6.49002 13.6555 7.30939 14.2895 8.25856 14.6443C9.20772 14.999 10.2421 15.0579 11.2255 14.8132C12.2088 14.5685 13.0949 14.0317 13.7669 13.2735C14.1284 13.9113 14.6902 14.4122 15.3653 14.6985C16.0403 14.9848 16.791 15.0405 17.5009 14.8571C18.2109 14.6737 18.8406 14.2613 19.2924 13.6839C19.7441 13.1065 19.9929 12.3962 20 11.6631V9.99698C19.9971 7.3465 18.9427 4.80539 17.068 2.93121C15.1934 1.05704 12.6516 0.0028667 10.0004 0ZM10.0004 13.3293C9.11642 13.3293 8.26861 12.9782 7.64352 12.3533C7.01842 11.7284 6.66725 10.8808 6.66725 9.99698C6.66725 9.11319 7.01842 8.2656 7.64352 7.64067C8.26861 7.01574 9.11642 6.66465 10.0004 6.66465C10.8845 6.66465 11.7323 7.01574 12.3574 7.64067C12.9824 8.2656 13.3336 9.11319 13.3336 9.99698C13.3336 10.8808 12.9824 11.7284 12.3574 12.3533C11.7323 12.9782 10.8845 13.3293 10.0004 13.3293Z", fill: "white" })), i0 = o(s0), i = {}, w0 = {
217
+ }, a) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ref: a, "aria-labelledby": l, ...r }, t ? /* @__PURE__ */ e.createElement("title", { id: l }, t) : null, /* @__PURE__ */ e.createElement("path", { d: "M12.0004 2C9.34927 2.00287 6.8075 3.05704 4.93284 4.93121C3.05818 6.80539 2.00374 9.3465 2.00087 11.997C1.89588 19.9721 11.2996 24.8506 17.7502 20.1753C17.8429 20.1137 17.9223 20.0341 17.9837 19.9413C18.0451 19.8484 18.0873 19.7442 18.1078 19.6348C18.1282 19.5254 18.1266 19.413 18.1028 19.3043C18.0791 19.1955 18.0339 19.0926 17.9697 19.0017C17.9056 18.9107 17.8238 18.8335 17.7294 18.7746C17.6349 18.7158 17.5295 18.6764 17.4196 18.659C17.3096 18.6415 17.1973 18.6462 17.0892 18.6728C16.9811 18.6995 16.8794 18.7475 16.7902 18.8141C11.4171 22.7071 3.58414 18.6433 3.66747 11.997C4.12495 0.945319 19.8776 0.947818 20.3334 11.997V13.6631C20.3334 14.105 20.1578 14.5288 19.8453 14.8413C19.5327 15.1538 19.1088 15.3293 18.6668 15.3293C18.2248 15.3293 17.8009 15.1538 17.4884 14.8413C17.1758 14.5288 17.0002 14.105 17.0002 13.6631V11.997C16.7902 5.39148 7.20981 5.39231 7.00065 11.997C7.01035 13.01 7.32685 13.9963 7.90843 14.8259C8.49002 15.6555 9.30939 16.2895 10.2586 16.6443C11.2077 16.999 12.2421 17.0579 13.2255 16.8132C14.2088 16.5685 15.0949 16.0317 15.7669 15.2735C16.1284 15.9113 16.6902 16.4122 17.3653 16.6985C18.0403 16.9848 18.791 17.0405 19.5009 16.8571C20.2109 16.6737 20.8406 16.2613 21.2924 15.6839C21.7441 15.1065 21.9929 14.3962 22 13.6631V11.997C21.9971 9.3465 20.9427 6.80539 19.068 4.93121C17.1934 3.05704 14.6516 2.00287 12.0004 2ZM12.0004 15.3293C11.1164 15.3293 10.2686 14.9782 9.64352 14.3533C9.01842 13.7284 8.66725 12.8808 8.66725 11.997C8.66725 11.1132 9.01842 10.2656 9.64352 9.64067C10.2686 9.01574 11.1164 8.66465 12.0004 8.66465C12.8845 8.66465 13.7323 9.01574 14.3574 9.64067C14.9824 10.2656 15.3336 11.1132 15.3336 11.997C15.3336 12.8808 14.9824 13.7284 14.3574 14.3533C13.7323 14.9782 12.8845 15.3293 12.0004 15.3293Z", fill: "white" })), i0 = o(s0), i = {}, w0 = {
218
218
  arrowRight: () => /* @__PURE__ */ n(l0, {}),
219
219
  loader: () => /* @__PURE__ */ n(h, {}),
220
220
  filter: () => /* @__PURE__ */ n(f, {}),
@@ -7,9 +7,9 @@ export type TClickOptionProps = {
7
7
  selectedOptions: TOption[];
8
8
  setSelectedOptions: (value: SetStateAction<TOption[]>) => void;
9
9
  mode: TModeSelect;
10
- onChange?: ((selectedOptions: TOption[]) => unknown);
10
+ onChange?: (selectedOptions: TOption[]) => unknown;
11
11
  optionsParentArr?: TCategory[] | TOption[];
12
12
  };
13
- declare const handleClickModeOption: ({ option, setSelectedOptions, selectedOptions, disabledOptions, onChange, mode, optionsParentArr }: TClickOptionProps) => void;
14
- declare const handleClickModeCategory: ({ option, setSelectedOptions, selectedOptions, disabledOptions, onChange }: TClickOptionProps) => void;
13
+ declare const handleClickModeOption: ({ option, setSelectedOptions, selectedOptions, disabledOptions, onChange, mode, optionsParentArr, }: TClickOptionProps) => void;
14
+ declare const handleClickModeCategory: ({ option, setSelectedOptions, selectedOptions, disabledOptions, onChange, }: TClickOptionProps) => void;
15
15
  export { handleClickModeCategory, handleClickModeOption };
@@ -1,46 +1,49 @@
1
- const d = ({
1
+ const J = ({
2
2
  option: e,
3
- setSelectedOptions: y,
4
- selectedOptions: f,
5
- disabledOptions: s,
3
+ setSelectedOptions: s,
4
+ selectedOptions: l,
5
+ disabledOptions: u,
6
6
  onChange: c,
7
- mode: S,
8
- optionsParentArr: r
7
+ mode: y,
8
+ optionsParentArr: f
9
9
  }) => {
10
10
  if (!Array.isArray(e)) {
11
- if (s.includes(e))
11
+ if (u.includes(e))
12
12
  return;
13
- let i = f.some((l) => l.value === e.value) ? f.filter((l) => l.value !== e.value) : [...f, e];
14
- if (S === "double") {
15
- "options" in e && (f.map((t) => JSON.stringify(t)).includes(JSON.stringify(e)) ? i = i.filter((t) => !e.options.map((a) => JSON.stringify(a)).includes(JSON.stringify(t))) : Array.isArray(e.options) && (i = [...i, ...e.options]));
16
- const l = r == null ? void 0 : r.filter((u) => "options" in u && u.options.includes(e))[0];
17
- !(l && f.map((u) => JSON.stringify(u)).includes(JSON.stringify(l))) && l && i.push(l);
13
+ let i = l.some((r) => r.value === e.value) ? l.filter((r) => r.value !== e.value) : [...l, e];
14
+ if (y === "single") {
15
+ const r = [e];
16
+ s(r), c && c(r);
17
+ return;
18
+ }
19
+ if (y === "double") {
20
+ "options" in e && (l.map((t) => JSON.stringify(t)).includes(JSON.stringify(e)) ? i = i.filter(
21
+ (t) => !e.options.map((a) => JSON.stringify(a)).includes(JSON.stringify(t))
22
+ ) : Array.isArray(e.options) && (i = [...i, ...e.options]));
23
+ const r = f == null ? void 0 : f.filter((S) => "options" in S && S.options.includes(e))[0];
24
+ !(r && l.map((S) => JSON.stringify(S)).includes(JSON.stringify(r))) && r && i.push(r);
18
25
  }
19
- y(i), c && c(i);
26
+ s(i), c && c(i);
20
27
  }
21
- }, m = ({
28
+ }, N = ({
22
29
  option: e,
23
- setSelectedOptions: y,
24
- selectedOptions: f,
25
- disabledOptions: s,
30
+ setSelectedOptions: s,
31
+ selectedOptions: l,
32
+ disabledOptions: u,
26
33
  onChange: c
27
34
  }) => {
28
35
  if (Array.isArray(e)) {
29
- const S = e.filter((r) => !(s != null && s.includes(r)));
30
- if (S.every((r) => f.map((i) => i).includes(r))) {
31
- const r = f.filter(
32
- (i) => !e.includes(i)
33
- );
34
- y(r), c && c(r);
36
+ const y = e.filter((f) => !(u != null && u.includes(f)));
37
+ if (y.every((f) => l.map((i) => i).includes(f))) {
38
+ const f = l.filter((i) => !e.includes(i));
39
+ s(f), c && c(f);
35
40
  } else {
36
- const r = S.filter(
37
- (l) => !f.includes(l)
38
- ), i = [...f, ...r];
39
- y(i), c && c(i);
41
+ const f = y.filter((r) => !l.includes(r)), i = [...l, ...f];
42
+ s(i), c && c(i);
40
43
  }
41
44
  }
42
45
  };
43
46
  export {
44
- m as handleClickModeCategory,
45
- d as handleClickModeOption
47
+ N as handleClickModeCategory,
48
+ J as handleClickModeOption
46
49
  };
@@ -1,4 +1,4 @@
1
- import { jsxs as m, Fragment as w, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as m, Fragment as w, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as L, useRef as W, useEffect as j } from "react";
3
3
  import { c as K } from "../../../index-rKuIKazb.js";
4
4
  import { s as e, O as Q } from "../../../Option-BVIm7wOW.js";
@@ -9,7 +9,7 @@ const a = K.bind(e), te = ({
9
9
  options: t,
10
10
  placeholder: B = "Выберите опции",
11
11
  error: D,
12
- disabled: g,
12
+ disabled: p,
13
13
  disabledOptions: f = [],
14
14
  additionalClass: M = "",
15
15
  additionalClassOption: F,
@@ -22,7 +22,7 @@ const a = K.bind(e), te = ({
22
22
  clickableOptions: v,
23
23
  isListRight: q = !1,
24
24
  sizeIcon: d,
25
- mode: i = "options",
25
+ mode: s = "options",
26
26
  onClickItem: C,
27
27
  onCLickSelect: S,
28
28
  size_s: N = "large",
@@ -32,7 +32,7 @@ const a = K.bind(e), te = ({
32
32
  isLast: G
33
33
  }) => {
34
34
  t = Array.isArray(t) ? [.../* @__PURE__ */ new Set([...t])] : [];
35
- const [l, A] = L(c), [o, h] = L(!1), p = W(null), E = (r) => {
35
+ const [l, A] = L(c), [o, g] = L(!1), h = W(null), E = (r) => {
36
36
  C && C(r);
37
37
  const n = {
38
38
  option: r,
@@ -40,7 +40,7 @@ const a = K.bind(e), te = ({
40
40
  disabledOptions: f,
41
41
  setSelectedOptions: A,
42
42
  onChange: _,
43
- mode: i,
43
+ mode: s,
44
44
  optionsParentArr: t
45
45
  };
46
46
  Array.isArray(r) ? X(n) : U(n);
@@ -50,10 +50,10 @@ const a = K.bind(e), te = ({
50
50
  j(() => {
51
51
  const r = (n) => {
52
52
  const J = n.target;
53
- if (p.current && !p.current.contains(n.target)) {
53
+ if (h.current && !h.current.contains(n.target)) {
54
54
  if (J.closest("svg"))
55
55
  return;
56
- h(!1);
56
+ g(!1);
57
57
  }
58
58
  };
59
59
  return document.addEventListener("click", r), () => {
@@ -66,14 +66,14 @@ const a = K.bind(e), te = ({
66
66
  }, [c]), /* @__PURE__ */ m(
67
67
  "div",
68
68
  {
69
- ref: p,
69
+ ref: h,
70
70
  className: a(e.multiSelectWrapper, { [e.multiSelectWrapperError]: D }, M),
71
71
  tabIndex: 0,
72
72
  onBlur: H,
73
73
  children: [
74
74
  /* @__PURE__ */ m("div", { className: a(e.inputWrapper), children: [
75
75
  !O && /* @__PURE__ */ m(w, { children: [
76
- /* @__PURE__ */ s(
76
+ /* @__PURE__ */ i(
77
77
  "div",
78
78
  {
79
79
  className: a(
@@ -82,13 +82,13 @@ const a = K.bind(e), te = ({
82
82
  e[`${$}-size_m`],
83
83
  e[`${k}-size)_l`],
84
84
  { [e.selectedOptionsNotEmpty]: l.length > 0 },
85
- { [e.selectOptionsDisabled]: g }
85
+ { [e.selectOptionsDisabled]: p }
86
86
  ),
87
- onClick: () => h(!o),
87
+ onClick: () => g(!o),
88
88
  children: l.length === 0 ? B : "Выбрано " + l.length
89
89
  }
90
90
  ),
91
- /* @__PURE__ */ s(
91
+ /* @__PURE__ */ i(
92
92
  z,
93
93
  {
94
94
  name: "arrowShort",
@@ -99,7 +99,7 @@ const a = K.bind(e), te = ({
99
99
  )
100
100
  ] }),
101
101
  O && /* @__PURE__ */ m(w, { children: [
102
- /* @__PURE__ */ s(
102
+ /* @__PURE__ */ i(
103
103
  "button",
104
104
  {
105
105
  className: a(
@@ -108,16 +108,16 @@ const a = K.bind(e), te = ({
108
108
  e[`${$}-size_m`],
109
109
  e[`${k}-size_l`],
110
110
  e.selectedOptionsBtn,
111
- { [e.selectOptionsDisabled]: g },
111
+ { [e.selectOptionsDisabled]: p },
112
112
  P
113
113
  ),
114
114
  onClick: () => {
115
- S && S(), h(!o);
115
+ S && S(), g(!o);
116
116
  },
117
117
  children: y
118
118
  }
119
119
  ),
120
- /* @__PURE__ */ s(
120
+ /* @__PURE__ */ i(
121
121
  z,
122
122
  {
123
123
  name: "filter",
@@ -138,7 +138,7 @@ const a = K.bind(e), te = ({
138
138
  F
139
139
  ),
140
140
  children: [
141
- i === "options" && (t == null ? void 0 : t.map((r, n) => /* @__PURE__ */ s(
141
+ (s === "options" || s === "single") && (t == null ? void 0 : t.map((r, n) => /* @__PURE__ */ i(
142
142
  Q,
143
143
  {
144
144
  disabledOptions: f,
@@ -151,7 +151,7 @@ const a = K.bind(e), te = ({
151
151
  },
152
152
  n
153
153
  ))),
154
- (i === "category" || i === "double") && (t == null ? void 0 : t.map((r, n) => "options" in r ? /* @__PURE__ */ s(
154
+ (s === "category" || s === "double") && (t == null ? void 0 : t.map((r, n) => "options" in r ? /* @__PURE__ */ i(
155
155
  T,
156
156
  {
157
157
  disabledOptions: f,
@@ -159,7 +159,7 @@ const a = K.bind(e), te = ({
159
159
  selectedOptions: l,
160
160
  sizeIcon: d,
161
161
  category: r,
162
- mode: i,
162
+ mode: s,
163
163
  selectedValues: c,
164
164
  handleOptionClick: E,
165
165
  isDisabledNotClickable: x
@@ -9,7 +9,7 @@ export type TCategory = {
9
9
  label: string;
10
10
  options: TOption[];
11
11
  };
12
- export type TModeSelect = 'options' | 'category' | 'double';
12
+ export type TModeSelect = 'options' | 'category' | 'double' | 'single';
13
13
  type SelectSizes = 'medium' | 'small' | 'large';
14
14
  export interface MultiSelectProps {
15
15
  options: TOption[] | TCategory[];
@@ -1,10 +1,10 @@
1
1
  import { jsxs as s, jsx as l } from "react/jsx-runtime";
2
2
  import { NewIcon as d } from "../../NewIcon/ui/NewIcon.js";
3
3
  import { Select as O } from "../../Select/ui/Select.js";
4
- const N = "_root_156r8_1", p = "_nameWrapper_156r8_8", f = "_clearBtn_156r8_18", S = "_summaryList_156r8_33", V = "_summaryOption_156r8_40", B = "_categoryOption_156r8_62", b = "_summaryCategory_156r8_71", k = "_headerCategory_156r8_81", T = "_categoryTitle_156r8_87", W = "_categoryOptions_156r8_95", t = {
4
+ const N = "_root_156r8_1", f = "_nameWrapper_156r8_8", p = "_clearBtn_156r8_18", S = "_summaryList_156r8_33", V = "_summaryOption_156r8_40", B = "_categoryOption_156r8_62", b = "_summaryCategory_156r8_71", k = "_headerCategory_156r8_81", T = "_categoryTitle_156r8_87", W = "_categoryOptions_156r8_95", t = {
5
5
  root: N,
6
- nameWrapper: p,
7
- clearBtn: f,
6
+ nameWrapper: f,
7
+ clearBtn: p,
8
8
  summaryList: S,
9
9
  summaryOption: V,
10
10
  categoryOption: B,
@@ -28,7 +28,11 @@ const N = "_root_156r8_1", p = "_nameWrapper_156r8_8", f = "_clearBtn_156r8_18",
28
28
  c([]);
29
29
  }, v = (e) => {
30
30
  var o;
31
- c(((o = a.selectedValues) == null ? void 0 : o.filter((r) => r.value !== e.value).filter((r) => !e.options.some((n) => n.value === r.value))) ?? []);
31
+ c(
32
+ ((o = a.selectedValues) == null ? void 0 : o.filter((r) => r.value !== e.value).filter(
33
+ (r) => !e.options.some((n) => n.value === r.value)
34
+ )) ?? []
35
+ );
32
36
  }, m = (y = a.selectedValues) == null ? void 0 : y.filter((e) => "options" in e);
33
37
  return /* @__PURE__ */ s("div", { className: t.root, children: [
34
38
  /* @__PURE__ */ s("div", { className: t.nameWrapper, children: [
@@ -49,7 +53,7 @@ const N = "_root_156r8_1", p = "_nameWrapper_156r8_8", f = "_clearBtn_156r8_18",
49
53
  onChange: c
50
54
  }
51
55
  ),
52
- a.mode === "options" && a.selectedValues && a.selectedValues.length > 0 && /* @__PURE__ */ l("div", { className: t.summaryList, children: a.selectedValues.map((e) => /* @__PURE__ */ s(
56
+ (a.mode === "options" || a.mode === "single") && a.selectedValues && a.selectedValues.length > 0 && /* @__PURE__ */ l("div", { className: t.summaryList, children: a.selectedValues.map((e) => /* @__PURE__ */ s(
53
57
  "div",
54
58
  {
55
59
  onClick: () => u(e.value.toString()),
@@ -69,39 +73,53 @@ const N = "_root_156r8_1", p = "_nameWrapper_156r8_8", f = "_clearBtn_156r8_18",
69
73
  )) }),
70
74
  a.mode === "double" && (m == null ? void 0 : m.map((e, o) => {
71
75
  const r = e;
72
- return /* @__PURE__ */ s("div", { className: t.summaryCategory, children: [
73
- /* @__PURE__ */ s("div", { className: t.headerCategory, children: [
74
- /* @__PURE__ */ l("div", { className: t.categoryTitle, children: r.label }),
75
- /* @__PURE__ */ l("div", { onClick: () => v(e), className: t.clearBtn, children: /* @__PURE__ */ l(
76
- d,
77
- {
78
- name: "close",
79
- size: "16"
80
- }
81
- ) })
82
- ] }),
83
- /* @__PURE__ */ l("div", { className: t.categoryOptions, children: r.options.filter((n) => {
84
- var i;
85
- return (i = a.selectedValues) == null ? void 0 : i.some((C) => n.value === C.value);
86
- }).map((n, i) => /* @__PURE__ */ s(
87
- "div",
88
- {
89
- onClick: () => u(n.value.toString()),
90
- className: `${t.summaryOption} ${t.categoryOption}`,
91
- children: [
92
- n.label,
76
+ return /* @__PURE__ */ s(
77
+ "div",
78
+ {
79
+ className: t.summaryCategory,
80
+ children: [
81
+ /* @__PURE__ */ s("div", { className: t.headerCategory, children: [
82
+ /* @__PURE__ */ l("div", { className: t.categoryTitle, children: r.label }),
93
83
  /* @__PURE__ */ l(
94
- d,
84
+ "div",
95
85
  {
96
- name: "close",
97
- size: "16"
86
+ onClick: () => v(e),
87
+ className: t.clearBtn,
88
+ children: /* @__PURE__ */ l(
89
+ d,
90
+ {
91
+ name: "close",
92
+ size: "16"
93
+ }
94
+ )
98
95
  }
99
96
  )
100
- ]
101
- },
102
- i
103
- )) })
104
- ] }, o);
97
+ ] }),
98
+ /* @__PURE__ */ l("div", { className: t.categoryOptions, children: r.options.filter((n) => {
99
+ var i;
100
+ return (i = a.selectedValues) == null ? void 0 : i.some((C) => n.value === C.value);
101
+ }).map((n, i) => /* @__PURE__ */ s(
102
+ "div",
103
+ {
104
+ onClick: () => u(n.value.toString()),
105
+ className: `${t.summaryOption} ${t.categoryOption}`,
106
+ children: [
107
+ n.label,
108
+ /* @__PURE__ */ l(
109
+ d,
110
+ {
111
+ name: "close",
112
+ size: "16"
113
+ }
114
+ )
115
+ ]
116
+ },
117
+ i
118
+ )) })
119
+ ]
120
+ },
121
+ o
122
+ );
105
123
  }))
106
124
  ] });
107
125
  };
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.777",
5
+ "version": "0.0.779",
6
6
  "author": "Mollycodd1e",
7
7
  "license": "ISC",
8
8
  "type": "module",