stone-kit 0.0.139 → 0.0.141

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,7 +1,7 @@
1
- import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
- import { memo as D, useState as h, useRef as S, useCallback as _, useEffect as g } from "react";
1
+ import { jsxs as _, jsx as l } from "react/jsx-runtime";
2
+ import { memo as D, useState as S, useRef as g, useCallback as O, useEffect as w } from "react";
3
3
  import { c as E } from "../../../index-DIxK0V-G.js";
4
- import { NewIcon as w } from "../../NewIcon/ui/NewIcon.js";
4
+ import { NewIcon as b } from "../../NewIcon/ui/NewIcon.js";
5
5
  const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_selectedOptionsOpened_100gw_28", j = "_selectOptionsDisabled_100gw_32", z = "_optionsList_100gw_39", U = "_inputWrapper_100gw_54", q = "_option_100gw_39", A = "_icon_100gw_76", s = {
6
6
  multiSelectWrapper: y,
7
7
  selectedOptions: I,
@@ -11,54 +11,54 @@ const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_s
11
11
  inputWrapper: U,
12
12
  option: q,
13
13
  icon: A
14
- }, l = E.bind(s), B = ({
15
- options: b,
14
+ }, i = E.bind(s), B = ({
15
+ options: o,
16
16
  placeholder: k = "Выберите опции",
17
17
  error: W,
18
18
  disabled: N,
19
19
  additionalClass: x = "",
20
- onChange: o,
21
- onBlur: r,
20
+ onChange: r,
21
+ onBlur: a,
22
22
  selectedValues: n = []
23
23
  }) => {
24
- const [t, O] = h(n), [p, v] = h(!1), a = S(null), C = _(
24
+ const [t, v] = S(n), [p, f] = S(!1), d = g(null), C = O(
25
25
  (e) => () => {
26
- const c = t.some((m) => m.value === e.value) ? t.filter((m) => m.value !== e.value) : [...t, e];
27
- O(c), o && o(c);
26
+ const c = t.some((u) => u.value === e.value) ? t.filter((u) => u.value !== e.value) : [...t, e];
27
+ v(c), r && r(c);
28
28
  },
29
- [t, o]
30
- ), d = _((e) => {
31
- a.current && !a.current.contains(e.target) && v(!1);
32
- }, []), L = _(() => {
33
- r && r(t);
34
- }, [t, r]);
35
- g(() => (document.addEventListener("click", d), () => {
36
- document.removeEventListener("click", d);
37
- }), [d]);
38
- const f = S(n);
39
- return g(() => {
40
- n.length !== f.current.length && (O(n), f.current = n);
41
- }, [n]), /* @__PURE__ */ u(
29
+ [t, r]
30
+ ), m = O((e) => {
31
+ d.current && !d.current.contains(e.target) && f(!1);
32
+ }, []), L = O(() => {
33
+ a && a(t);
34
+ }, [t, a]);
35
+ w(() => (document.addEventListener("click", m), () => {
36
+ document.removeEventListener("click", m);
37
+ }), [m]);
38
+ const h = g(n);
39
+ return w(() => {
40
+ n.length !== h.current.length && (v(n), h.current = n);
41
+ }, [n]), /* @__PURE__ */ _(
42
42
  "div",
43
43
  {
44
- ref: a,
45
- className: l(s.multiSelectWrapper, { [s.multiSelectWrapperError]: W }, x),
44
+ ref: d,
45
+ className: i(s.multiSelectWrapper, { [s.multiSelectWrapperError]: W }, x),
46
46
  tabIndex: 0,
47
47
  onBlur: L,
48
48
  children: [
49
- /* @__PURE__ */ u("div", { className: l(s.inputWrapper), children: [
50
- /* @__PURE__ */ i(
49
+ /* @__PURE__ */ _("div", { className: i(s.inputWrapper), children: [
50
+ /* @__PURE__ */ l(
51
51
  "input",
52
52
  {
53
53
  type: "text",
54
54
  readOnly: !0,
55
55
  value: t.length === 0 ? k : "Выбрано " + t.length + " опции",
56
- className: l(s.selectedOptions, { [s.selectOptionsDisabled]: N }),
57
- onClick: () => v(!p)
56
+ className: i(s.selectedOptions, { [s.selectOptionsDisabled]: N }),
57
+ onClick: () => f(!p)
58
58
  }
59
59
  ),
60
- /* @__PURE__ */ i(
61
- w,
60
+ /* @__PURE__ */ l(
61
+ b,
62
62
  {
63
63
  name: "arrowShort",
64
64
  deg: p ? "180" : "0",
@@ -67,17 +67,17 @@ const y = "_multiSelectWrapper_100gw_1", I = "_selectedOptions_100gw_7", R = "_s
67
67
  }
68
68
  )
69
69
  ] }),
70
- p && /* @__PURE__ */ i("div", { className: s.optionsList, children: b.map((e) => /* @__PURE__ */ u(
70
+ p && /* @__PURE__ */ l("div", { className: s.optionsList, children: o == null ? void 0 : o.map((e) => /* @__PURE__ */ _(
71
71
  "div",
72
72
  {
73
- className: l(s.option, {
73
+ className: i(s.option, {
74
74
  [s.selected]: t.some((c) => c.value === e.value)
75
75
  }),
76
76
  onClick: C(e),
77
77
  children: [
78
- /* @__PURE__ */ i("div", { children: e.label }),
79
- /* @__PURE__ */ i(
80
- w,
78
+ /* @__PURE__ */ l("div", { children: e.label }),
79
+ /* @__PURE__ */ l(
80
+ b,
81
81
  {
82
82
  size: "20",
83
83
  name: t.some((c) => c.value === e.value) ? "selectChecked" : "selectUnchecked"
@@ -5,7 +5,7 @@ export interface Option {
5
5
  label: string;
6
6
  }
7
7
  export interface MultiSelectProps {
8
- options: Option[];
8
+ options?: Option[];
9
9
  placeholder?: string;
10
10
  error?: boolean;
11
11
  disabled?: boolean;
@@ -1,4 +1,4 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as I, useRef as L, useEffect as W } from "react";
3
3
  import { c as B } from "../../../index-DIxK0V-G.js";
4
4
  import { s as e, u as E } from "../../../useSortSelect-Dy4WKDDY.js";
@@ -19,44 +19,44 @@ import "../../MetroTag/ui/MetroTag.js";
19
19
  import "../../Select/ui/Select.js";
20
20
  import { useClientWidth as w } from "../../../shared/useClientWidth.js";
21
21
  const s = B.bind(e), D = ({
22
- options: n,
22
+ options: r,
23
23
  selectedOption: S,
24
24
  placeholder: O = "",
25
25
  error: h,
26
26
  disabled: v,
27
27
  additionalClass: N = "",
28
- onChange: c,
28
+ onChange: a,
29
29
  onBlur: b,
30
30
  mini: x,
31
- openOnTop: a = !1
31
+ openOnTop: m = !1
32
32
  }) => {
33
- const [o, i] = I(!1), m = L(null), { isMobile: p, isDesktop: y } = w(), { handleBlur: k, getInputValue: C, getOption: d, handleDocumentClick: u } = E({
33
+ const [i, o] = I(!1), n = L(null), { isMobile: d, isDesktop: y } = w(), { handleBlur: k, getInputValue: C, getOption: p, handleDocumentClick: u } = E({
34
34
  selectedOption: S,
35
- setSelectedOption: c,
36
- setIsOpen: i,
37
- containerRef: m,
38
- isOpen: o,
35
+ setSelectedOption: a,
36
+ setIsOpen: o,
37
+ containerRef: n,
38
+ isOpen: i,
39
39
  isDesktop: y,
40
40
  placeholder: O,
41
- onChange: c,
41
+ onChange: a,
42
42
  onBlur: b
43
43
  });
44
44
  return W(() => (document.addEventListener("click", u), () => {
45
45
  document.removeEventListener("click", u);
46
- }), []), /* @__PURE__ */ r(
46
+ }), []), /* @__PURE__ */ l(
47
47
  "div",
48
48
  {
49
- ref: m,
49
+ ref: n,
50
50
  className: s(
51
51
  e.sortSelectWrapper,
52
52
  { [e.sortSelectWrapperError]: h },
53
- { [e.sortSelectWrapperTop]: a },
53
+ { [e.sortSelectWrapperTop]: m },
54
54
  N
55
55
  ),
56
56
  tabIndex: 0,
57
57
  onBlur: k,
58
58
  children: [
59
- /* @__PURE__ */ r("div", { className: s(e.inputWrapper), children: [
59
+ /* @__PURE__ */ l("div", { className: s(e.inputWrapper), children: [
60
60
  /* @__PURE__ */ t(
61
61
  "input",
62
62
  {
@@ -68,7 +68,7 @@ const s = B.bind(e), D = ({
68
68
  { [e.selectOptionsDisabled]: v },
69
69
  { [e.selectionOptionMini]: x }
70
70
  ),
71
- onClick: () => i(!o)
71
+ onClick: () => o(!i)
72
72
  }
73
73
  ),
74
74
  /* @__PURE__ */ t(
@@ -80,17 +80,17 @@ const s = B.bind(e), D = ({
80
80
  }
81
81
  )
82
82
  ] }),
83
- o && p && /* @__PURE__ */ r(
83
+ i && d && /* @__PURE__ */ l(
84
84
  j,
85
85
  {
86
- isOpen: o,
87
- emitIsOpen: i,
86
+ isOpen: i,
87
+ emitIsOpen: o,
88
88
  additionalClassModalBody: e.modalAddBody,
89
89
  createPortalObj: { domNode: document.querySelector("body") },
90
90
  children: [
91
- /* @__PURE__ */ r("div", { className: e.mobileSortHeader, children: [
91
+ /* @__PURE__ */ l("div", { className: e.mobileSortHeader, children: [
92
92
  /* @__PURE__ */ t(M, { children: "Сортировка" }),
93
- /* @__PURE__ */ t("div", { onClick: () => i(!1), children: /* @__PURE__ */ t(
93
+ /* @__PURE__ */ t("div", { onClick: () => o(!1), children: /* @__PURE__ */ t(
94
94
  f,
95
95
  {
96
96
  name: "close",
@@ -98,11 +98,11 @@ const s = B.bind(e), D = ({
98
98
  }
99
99
  ) })
100
100
  ] }),
101
- /* @__PURE__ */ t("div", { className: e.mobileOptionList, children: n.map((l) => d(l)) })
101
+ /* @__PURE__ */ t("div", { className: e.mobileOptionList, children: r == null ? void 0 : r.map((c) => p(c)) })
102
102
  ]
103
103
  }
104
104
  ),
105
- o && !p && /* @__PURE__ */ t("div", { className: s(e.optionsList, { [e.optionListOnTop]: a }), children: n.map((l) => d(l)) })
105
+ i && !d && /* @__PURE__ */ t("div", { className: s(e.optionsList, { [e.optionListOnTop]: m }), children: r == null ? void 0 : r.map((c) => p(c)) })
106
106
  ]
107
107
  }
108
108
  );
@@ -3,7 +3,7 @@ export interface Option {
3
3
  label: string;
4
4
  }
5
5
  export interface SortSelectProps {
6
- options: Option[];
6
+ options?: Option[];
7
7
  selectedOption: Option | null;
8
8
  placeholder?: string;
9
9
  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.139",
5
+ "version": "0.0.141",
6
6
  "author": "Mollycodd1e",
7
7
  "license": "ISC",
8
8
  "type": "module",