stone-kit 0.0.1034 → 0.0.1036

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,188 +1,202 @@
1
- import { jsxs as p, jsx as n, Fragment as k } from "react/jsx-runtime";
2
- import { useState as z, useRef as B, useEffect as F } from "react";
3
- import { c as V } from "../../../index-YnD2EP-S.js";
4
- import { s as e, O as M } from "../../../Option-D-8xnCui.js";
5
- import { Category as ee } from "./Category.js";
6
- import { handleClickModeOption as te, handleClickModeCategory as re } from "../model/selectMode.js";
7
- import { NewIcon as D } from "../../NewIcon/ui/NewIcon.js";
8
- const c = V.bind(e), me = ({
1
+ import { jsxs as d, jsx as r, Fragment as B } from "react/jsx-runtime";
2
+ import { useState as F, useRef as M, useEffect as D } from "react";
3
+ import { c as te } from "../../../index-YnD2EP-S.js";
4
+ import { s as e, O as T } from "../../../Option-DI87iJMM.js";
5
+ import { Category as re } from "./Category.js";
6
+ import { handleClickModeOption as ne, handleClickModeCategory as le } from "../model/selectMode.js";
7
+ import { NewIcon as y } from "../../NewIcon/ui/NewIcon.js";
8
+ const o = te.bind(e), me = ({
9
9
  options: s,
10
- customPlaceholder: O,
11
- placeholder: T = "Выберите опции",
12
- error: q,
13
- disabled: y,
14
- disabledOptions: d = [],
15
- additionalClass: G = "",
16
- additionalClassOption: H,
17
- additionalClassBtn: J,
18
- onChange: K,
10
+ customPlaceholder: $,
11
+ placeholder: q = "Выберите опции",
12
+ error: G,
13
+ disabled: C,
14
+ disabledOptions: m = [],
15
+ additionalClass: H = "",
16
+ additionalClassOption: J,
17
+ additionalClassBtn: K,
18
+ onChange: Q,
19
19
  onBlur: S,
20
- selectedValues: i = [],
20
+ selectedValues: a = [],
21
21
  isBtn: A = !1,
22
- btnName: $,
22
+ btnName: N,
23
23
  clickableOptions: f,
24
- isListRight: Q = !1,
25
- sizeIcon: m,
26
- mode: a = "options",
27
- onClickItem: C,
28
- onCLickSelect: N,
29
- size_s: w = "large",
30
- size_m: x,
31
- size_l: E,
32
- betweenSize: U = "small",
24
+ isListRight: U = !1,
25
+ sizeIcon: p,
26
+ mode: c = "options",
27
+ onClickItem: x,
28
+ onCLickSelect: w,
29
+ size_s: E = "large",
30
+ size_m: R,
31
+ size_l: W,
32
+ betweenSize: X = "small",
33
33
  isDisabledNotClickable: u,
34
- isLast: X,
35
- isPositionLeftCheckbox: R,
34
+ isLast: Y,
35
+ isPositionLeftCheckbox: z,
36
36
  selectAll: L,
37
- scrollVersion: Y = "compact"
37
+ scrollVersion: Z = "compact",
38
+ isLoading: b = !1,
39
+ selectPaddingBottom: g
38
40
  }) => {
39
- const Z = { value: "selectAll", label: L?.label ?? "Выбрать все" }, P = () => L?.enabled ? [Z, .../* @__PURE__ */ new Set([...s])] : [.../* @__PURE__ */ new Set([...s])];
41
+ const I = { value: "selectAll", label: L?.label ?? "Выбрать все" }, P = () => L?.enabled ? [I, .../* @__PURE__ */ new Set([...s])] : [.../* @__PURE__ */ new Set([...s])];
40
42
  s = Array.isArray(s) ? P() : [];
41
- const [l, W] = z(i), [o, g] = z(!1), h = B(null), b = l.filter((t) => t.value !== "selectAll").length, v = (t) => {
42
- C && C(t);
43
- const r = {
43
+ const [l, _] = F(a), [i, h] = F(!1), v = M(null), V = l.filter((t) => t.value !== "selectAll").length, O = (t) => {
44
+ x && x(t);
45
+ const n = {
44
46
  option: t,
45
47
  selectedOptions: l,
46
- disabledOptions: d,
47
- setSelectedOptions: W,
48
- onChange: K,
49
- mode: a,
48
+ disabledOptions: m,
49
+ setSelectedOptions: _,
50
+ onChange: Q,
51
+ mode: c,
50
52
  optionsParentArr: s
51
53
  };
52
- Array.isArray(t) ? re(r) : te(r);
53
- }, I = () => {
54
+ Array.isArray(t) ? le(n) : ne(n);
55
+ }, ee = () => {
54
56
  S && S(l);
55
- }, _ = (t) => {
56
- const r = t.target;
57
- if (h.current && !h.current.contains(t.target)) {
58
- if (r.closest("svg"))
57
+ }, j = (t) => {
58
+ const n = t.target;
59
+ if (v.current && !v.current.contains(t.target)) {
60
+ if (n.closest("svg"))
59
61
  return;
60
- g(!1);
62
+ h(!1);
61
63
  }
62
64
  };
63
- F(() => (document.addEventListener("click", _), () => {
64
- document.removeEventListener("click", _);
65
- }), [o]);
66
- const j = B(i);
67
- return F(() => {
68
- i.length !== j.current.length && (W(i), j.current = i);
69
- }, [i]), /* @__PURE__ */ p(
65
+ D(() => (document.addEventListener("click", j), () => {
66
+ document.removeEventListener("click", j);
67
+ }), [i]);
68
+ const k = M(a);
69
+ return D(() => {
70
+ a.length !== k.current.length && (_(a), k.current = a);
71
+ }, [a]), /* @__PURE__ */ d(
70
72
  "div",
71
73
  {
72
- ref: h,
73
- className: c(e.multiSelectWrapper, { [e.multiSelectWrapperError]: q }, G),
74
+ ref: v,
75
+ className: o(e.multiSelectWrapper, { [e.multiSelectWrapperError]: G }, H),
76
+ style: g !== void 0 && i ? {
77
+ paddingBottom: `${g}px`,
78
+ marginBottom: `-${g}px`
79
+ } : void 0,
74
80
  tabIndex: 0,
75
- onBlur: I,
81
+ onBlur: ee,
76
82
  children: [
77
- /* @__PURE__ */ p("div", { className: c(e.inputWrapper), children: [
78
- !A && /* @__PURE__ */ p(k, { children: [
79
- /* @__PURE__ */ n(
83
+ /* @__PURE__ */ d("div", { className: o(e.inputWrapper), children: [
84
+ !A && /* @__PURE__ */ d(B, { children: [
85
+ /* @__PURE__ */ r(
80
86
  "div",
81
87
  {
82
- className: c(
88
+ className: o(
83
89
  e.selectedOptions,
84
- e[`${w}-size`],
85
- e[`${x}-size_m`],
86
- e[`${E}-size)_l`],
90
+ e[`${E}-size`],
91
+ e[`${R}-size_m`],
92
+ e[`${W}-size)_l`],
87
93
  { [e.selectedOptionsNotEmpty]: l.length > 0 },
88
- { [e.selectOptionsDisabled]: y }
94
+ { [e.selectOptionsDisabled]: C }
89
95
  ),
90
- onClick: () => g(!o),
91
- children: /* @__PURE__ */ n("div", { className: e.selectedText, children: O || (l.length === 0 ? T : "Выбрано " + b) })
96
+ onClick: () => h(!i),
97
+ children: /* @__PURE__ */ r("div", { className: e.selectedText, children: $ || (l.length === 0 ? q : "Выбрано " + V) })
92
98
  }
93
99
  ),
94
- /* @__PURE__ */ n(
95
- D,
100
+ /* @__PURE__ */ r(
101
+ y,
96
102
  {
97
103
  name: "arrowShort",
98
- deg: o ? "180" : "0",
99
- size: m ?? "24",
104
+ deg: i ? "180" : "0",
105
+ size: p ?? "24",
100
106
  additionalClass: e.icon
101
107
  }
102
108
  )
103
109
  ] }),
104
- A && /* @__PURE__ */ p(k, { children: [
105
- /* @__PURE__ */ n(
110
+ A && /* @__PURE__ */ d(B, { children: [
111
+ /* @__PURE__ */ r(
106
112
  "button",
107
113
  {
108
- className: c(
114
+ className: o(
109
115
  e.selectedOptions,
110
- e[`${w}-size`],
111
- e[`${x}-size_m`],
112
- e[`${E}-size_l`],
116
+ e[`${E}-size`],
117
+ e[`${R}-size_m`],
118
+ e[`${W}-size_l`],
113
119
  e.selectedOptionsBtn,
114
- { [e.selectOptionsDisabled]: y },
115
- J
120
+ { [e.selectOptionsDisabled]: C },
121
+ K
116
122
  ),
117
123
  onClick: () => {
118
- N && N(), g(!o);
124
+ w && w(), h(!i);
119
125
  },
120
- children: $
126
+ children: N
121
127
  }
122
128
  ),
123
- /* @__PURE__ */ n(
124
- D,
129
+ /* @__PURE__ */ r(
130
+ y,
125
131
  {
126
132
  name: "filter",
127
- deg: o ? "180" : "0",
128
- size: m ?? "24",
129
- additionalClass: c(e.icon, { [e.iconBtn]: !$ })
133
+ deg: i ? "180" : "0",
134
+ size: p ?? "24",
135
+ additionalClass: o(e.icon, { [e.iconBtn]: !N })
130
136
  }
131
137
  )
132
138
  ] })
133
139
  ] }),
134
- o && /* @__PURE__ */ n("div", { className: c(
140
+ i && /* @__PURE__ */ r("div", { className: o(
135
141
  e.optionsOuterContainer,
136
- e[`betweenSize_${U}`],
137
- { [e.listRight]: Q },
138
- { [e.lastList]: X },
139
- H
140
- ), children: /* @__PURE__ */ p(
142
+ e[`betweenSize_${X}`],
143
+ { [e.listRight]: U },
144
+ { [e.lastList]: Y },
145
+ J
146
+ ), children: b ? /* @__PURE__ */ r("div", { className: e.loaderWrapper, children: /* @__PURE__ */ r(
147
+ y,
148
+ {
149
+ name: "loader",
150
+ size: "24",
151
+ color: "currentColor",
152
+ additionalClass: e.loader
153
+ }
154
+ ) }) : /* @__PURE__ */ d(
141
155
  "div",
142
156
  {
143
- className: c(e.optionsList, e[`scroll_${Y}`]),
157
+ className: o(e.optionsList, e[`scroll_${Z}`]),
144
158
  children: [
145
- (a === "options" || a === "single") && s?.map((t, r) => /* @__PURE__ */ n(
146
- M,
159
+ (c === "options" || c === "single") && s?.map((t, n) => /* @__PURE__ */ r(
160
+ T,
147
161
  {
148
- disabledOptions: d,
162
+ disabledOptions: m,
149
163
  clickableOptions: f,
150
164
  selectedOptions: l,
151
- sizeIcon: m,
165
+ sizeIcon: p,
152
166
  option: t,
153
- isPositionLeftCheckbox: R,
154
- handleOptionClick: v,
167
+ isPositionLeftCheckbox: z,
168
+ handleOptionClick: O,
155
169
  isDisabledNotClickable: u
156
170
  },
157
- r
171
+ n
158
172
  )),
159
- (a === "category" || a === "double") && s?.map((t, r) => "options" in t ? /* @__PURE__ */ n(
160
- ee,
173
+ (c === "category" || c === "double") && s?.map((t, n) => "options" in t ? /* @__PURE__ */ r(
174
+ re,
161
175
  {
162
- disabledOptions: d,
176
+ disabledOptions: m,
163
177
  clickableOptions: f,
164
178
  selectedOptions: l,
165
- sizeIcon: m,
179
+ sizeIcon: p,
166
180
  category: t,
167
- mode: a,
168
- selectedValues: i,
169
- handleOptionClick: v,
181
+ mode: c,
182
+ selectedValues: a,
183
+ handleOptionClick: O,
170
184
  isDisabledNotClickable: u
171
185
  },
172
- r
173
- ) : t.value === "selectAll" ? /* @__PURE__ */ n(
174
- M,
186
+ n
187
+ ) : t.value === "selectAll" ? /* @__PURE__ */ r(
188
+ T,
175
189
  {
176
- disabledOptions: d,
190
+ disabledOptions: m,
177
191
  clickableOptions: f,
178
192
  selectedOptions: l,
179
- isPositionLeftCheckbox: R,
180
- sizeIcon: m,
193
+ isPositionLeftCheckbox: z,
194
+ sizeIcon: p,
181
195
  option: t,
182
- handleOptionClick: v,
196
+ handleOptionClick: O,
183
197
  isDisabledNotClickable: u
184
198
  },
185
- r
199
+ n
186
200
  ) : null)
187
201
  ]
188
202
  }
@@ -64,5 +64,7 @@ export interface MultiSelectProps {
64
64
  label?: string;
65
65
  };
66
66
  scrollVersion?: ScrollVersion;
67
+ isLoading?: boolean;
68
+ selectPaddingBottom?: number;
67
69
  }
68
70
  export {};
@@ -5,6 +5,9 @@ interface ISummarySelectProps extends MultiSelectProps {
5
5
  isLast?: boolean;
6
6
  isShowCategoryDelete?: boolean;
7
7
  labelSize?: 'medium' | 'large';
8
+ clearPosition?: 'top' | 'bottom';
9
+ chipVariant?: 'default' | 'secondary';
10
+ chipAdditionalClass?: string;
8
11
  }
9
12
  export declare const SummarySelect: React.FC<ISummarySelectProps>;
10
13
  export {};
@@ -1,126 +1,166 @@
1
- import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
- import { c as O } from "../../../index-YnD2EP-S.js";
3
- import { Select as N } from "../../Select/ui/Select.js";
4
- import { NewIcon as m } from "../../NewIcon/ui/NewIcon.js";
5
- const p = "_root_50nmy_1", f = "_nameWrapper_50nmy_8", z = "_size_large_50nmy_18", V = "_clearBtn_50nmy_25", S = "_summaryList_50nmy_40", B = "_summaryOption_50nmy_47", L = "_categoryOption_50nmy_69", b = "_summaryCategory_50nmy_78", k = "_headerCategory_50nmy_88", T = "_categoryTitle_50nmy_94", W = "_categoryOptions_50nmy_102", a = {
6
- root: p,
7
- nameWrapper: f,
8
- size_large: z,
9
- clearBtn: V,
10
- summaryList: S,
11
- summaryOption: B,
12
- categoryOption: L,
13
- summaryCategory: b,
14
- headerCategory: k,
15
- categoryTitle: T,
16
- categoryOptions: W
17
- }, I = ({
18
- label: u = "",
19
- isShowReset: _,
20
- isShowCategoryDelete: y = !1,
21
- labelSize: g = "medium",
1
+ import { jsxs as o, jsx as n, Fragment as W } from "react/jsx-runtime";
2
+ import { c as s } from "../../../index-YnD2EP-S.js";
3
+ import { Select as z } from "../../Select/ui/Select.js";
4
+ import { NewIcon as u } from "../../NewIcon/ui/NewIcon.js";
5
+ const k = "_root_a207n_1", L = "_nameWrapper_a207n_8", V = "_size_large_a207n_18", b = "_clearBtnWrapper_a207n_25", x = "_clearBtn_a207n_25", j = "_summaryList_a207n_46", F = "_summaryOption_a207n_53", I = "_summaryOptionSecondary_a207n_75", $ = "_categoryOption_a207n_80", q = "_categoryOptionSecondary_a207n_89", A = "_summaryCategory_a207n_93", E = "_headerCategory_a207n_103", G = "_categoryTitle_a207n_109", H = "_categoryTitleSecondary_a207n_117", J = "_categoryOptions_a207n_121", e = {
6
+ root: k,
7
+ nameWrapper: L,
8
+ size_large: V,
9
+ clearBtnWrapper: b,
10
+ clearBtn: x,
11
+ summaryList: j,
12
+ summaryOption: F,
13
+ summaryOptionSecondary: I,
14
+ categoryOption: $,
15
+ categoryOptionSecondary: q,
16
+ summaryCategory: A,
17
+ headerCategory: E,
18
+ categoryTitle: G,
19
+ categoryTitleSecondary: H,
20
+ categoryOptions: J
21
+ }, U = ({
22
+ label: g = "",
23
+ isShowReset: d,
24
+ isShowCategoryDelete: v = !1,
25
+ labelSize: S = "medium",
26
+ isLoading: N = !1,
27
+ clearPosition: h = "top",
28
+ chipVariant: l = "default",
29
+ chipAdditionalClass: O = "",
30
+ selectPaddingBottom: f,
22
31
  ...t
23
32
  }) => {
24
- const r = (e) => {
25
- t.onChange && t.onChange(e);
26
- }, d = (e) => {
27
- const l = t.selectedValues?.filter((s) => s.value !== e) || [];
28
- r(l);
29
- }, h = () => {
30
- r([]);
31
- }, v = (e) => {
32
- r(
33
- t.selectedValues?.filter((l) => l.value !== e.value).filter(
34
- (l) => !e.options.some((s) => s.value === l.value)
33
+ const p = d && h === "bottom", i = (a) => {
34
+ t.onChange && t.onChange(a);
35
+ }, C = (a) => {
36
+ const r = t.selectedValues?.filter((c) => c.value !== a) || [];
37
+ i(r);
38
+ }, y = () => {
39
+ i([]);
40
+ }, B = (a) => {
41
+ i(
42
+ t.selectedValues?.filter((r) => r.value !== a.value).filter(
43
+ (r) => !a.options.some((c) => c.value === r.value)
35
44
  ) ?? []
36
45
  );
37
- }, C = t.selectedValues?.filter((e) => "options" in e);
38
- return /* @__PURE__ */ o("div", { className: a.root, children: [
39
- /* @__PURE__ */ o("div", { className: O(a.nameWrapper, a[`size_${g}`]), children: [
40
- /* @__PURE__ */ n("div", { children: u }),
41
- _ && /* @__PURE__ */ n(
46
+ }, T = t.selectedValues?.filter((a) => "options" in a);
47
+ return /* @__PURE__ */ o("div", { className: e.root, children: [
48
+ (d || g) && /* @__PURE__ */ o("div", { className: s(e.nameWrapper, e[`size_${S}`]), children: [
49
+ /* @__PURE__ */ n("div", { children: g }),
50
+ d && h === "top" && /* @__PURE__ */ n(
42
51
  "div",
43
52
  {
44
- className: a.clearBtn,
45
- onClick: h,
53
+ className: e.clearBtn,
54
+ onClick: y,
46
55
  children: "Очистить"
47
56
  }
48
57
  )
49
58
  ] }),
50
59
  /* @__PURE__ */ n(
51
- N,
60
+ z,
52
61
  {
53
62
  ...t,
54
- onChange: r
63
+ isLoading: N,
64
+ selectPaddingBottom: f,
65
+ onChange: i
55
66
  }
56
67
  ),
57
- !y && t.mode === "options" && t.selectedValues && t.selectedValues.length > 0 && /* @__PURE__ */ n("div", { className: a.summaryList, children: t.selectedValues.map((e) => /* @__PURE__ */ o(
58
- "div",
59
- {
60
- onClick: () => d(e.value.toString()),
61
- className: a.summaryOption,
62
- children: [
63
- e.label,
64
- /* @__PURE__ */ n(
65
- m,
66
- {
67
- name: "close",
68
- size: "16"
69
- }
70
- )
71
- ]
72
- },
73
- e.value
74
- )) }),
75
- !y && t.mode === "double" && C?.map((e, l) => {
76
- const s = e;
77
- return /* @__PURE__ */ o(
68
+ !v && t.mode === "options" && t.selectedValues && t.selectedValues.length > 0 && /* @__PURE__ */ o("div", { className: s(e.summaryList), children: [
69
+ p && /* @__PURE__ */ n("div", { className: e.clearBtnWrapper, children: /* @__PURE__ */ n(
78
70
  "div",
79
71
  {
80
- className: a.summaryCategory,
72
+ className: e.clearBtn,
73
+ onClick: y,
74
+ children: "Очистить"
75
+ }
76
+ ) }),
77
+ t.selectedValues.map((a) => /* @__PURE__ */ o(
78
+ "div",
79
+ {
80
+ onClick: () => C(a.value.toString()),
81
+ className: s(e.summaryOption, {
82
+ [e.summaryOptionSecondary]: l === "secondary"
83
+ }, O),
81
84
  children: [
82
- /* @__PURE__ */ o("div", { className: a.headerCategory, children: [
83
- /* @__PURE__ */ n("div", { className: a.categoryTitle, children: s.label }),
84
- /* @__PURE__ */ n(
85
- "div",
86
- {
87
- onClick: () => v(e),
88
- className: a.clearBtn,
89
- children: /* @__PURE__ */ n(
90
- m,
91
- {
92
- name: "close",
93
- size: "16"
94
- }
95
- )
96
- }
97
- )
98
- ] }),
99
- /* @__PURE__ */ n("div", { className: a.categoryOptions, children: s.options.filter((c) => t.selectedValues?.some((i) => c.value === i.value)).map((c, i) => /* @__PURE__ */ o(
100
- "div",
85
+ a.label,
86
+ /* @__PURE__ */ n(
87
+ u,
101
88
  {
102
- onClick: () => d(c.value.toString()),
103
- className: `${a.summaryOption} ${a.categoryOption}`,
104
- children: [
105
- c.label,
106
- /* @__PURE__ */ n(
107
- m,
108
- {
109
- name: "close",
110
- size: "16"
111
- }
112
- )
113
- ]
114
- },
115
- i
116
- )) })
89
+ name: "close",
90
+ size: l === "secondary" ? "20" : "16"
91
+ }
92
+ )
117
93
  ]
118
94
  },
119
- l
120
- );
121
- })
95
+ a.value
96
+ ))
97
+ ] }),
98
+ !v && t.mode === "double" && /* @__PURE__ */ o(W, { children: [
99
+ p && t.selectedValues && t.selectedValues.length > 0 && /* @__PURE__ */ n(
100
+ "div",
101
+ {
102
+ className: e.clearBtn,
103
+ onClick: y,
104
+ children: "Очистить"
105
+ }
106
+ ),
107
+ T?.map((a, r) => {
108
+ const c = a;
109
+ return /* @__PURE__ */ o(
110
+ "div",
111
+ {
112
+ className: e.summaryCategory,
113
+ children: [
114
+ /* @__PURE__ */ o("div", { className: e.headerCategory, children: [
115
+ /* @__PURE__ */ n("div", { className: s(e.categoryTitle, {
116
+ [e.categoryTitleSecondary]: l === "secondary"
117
+ }), children: c.label }),
118
+ /* @__PURE__ */ n(
119
+ "div",
120
+ {
121
+ onClick: () => B(a),
122
+ className: e.clearBtn,
123
+ children: /* @__PURE__ */ n(
124
+ u,
125
+ {
126
+ name: "close",
127
+ size: "16"
128
+ }
129
+ )
130
+ }
131
+ )
132
+ ] }),
133
+ /* @__PURE__ */ n("div", { className: e.categoryOptions, children: c.options.filter((m) => t.selectedValues?.some((_) => m.value === _.value)).map((m, _) => /* @__PURE__ */ o(
134
+ "div",
135
+ {
136
+ onClick: () => C(m.value.toString()),
137
+ className: s(
138
+ e.summaryOption,
139
+ e.categoryOption,
140
+ { [e.categoryOptionSecondary]: l === "secondary" },
141
+ O
142
+ ),
143
+ children: [
144
+ m.label,
145
+ /* @__PURE__ */ n(
146
+ u,
147
+ {
148
+ name: "close",
149
+ size: l === "secondary" ? "20" : "16"
150
+ }
151
+ )
152
+ ]
153
+ },
154
+ _
155
+ )) })
156
+ ]
157
+ },
158
+ r
159
+ );
160
+ })
161
+ ] })
122
162
  ] });
123
163
  };
124
164
  export {
125
- I as SummarySelect
165
+ U as SummarySelect
126
166
  };