stone-kit 0.0.1103 → 0.0.1105

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