stone-kit 0.0.130 → 0.0.132

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.
@@ -2,8 +2,8 @@ import { MouseEvent } from 'react';
2
2
  import { Option } from '../ui/SortSelect.types';
3
3
 
4
4
  interface IUseSortSelect {
5
- selectedOption: Option | null;
6
- setSelectedOption: React.Dispatch<React.SetStateAction<Option | null>>;
5
+ selectedOption?: Option;
6
+ setSelectedOption?: (event: Option | undefined) => void;
7
7
  setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
8
8
  containerRef: React.RefObject<HTMLDivElement>;
9
9
  isOpen: boolean;
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { u as m } from "../../../useSortSelect-C-PfwcIF.js";
2
+ import { u as m } from "../../../useSortSelect-Dfs-72R7.js";
3
3
  import "../../../index-DIxK0V-G.js";
4
4
  export {
5
5
  m as useSortSelect
@@ -1,7 +1,7 @@
1
1
  import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { useState as d, useRef as B, useEffect as E } from "react";
3
- import { c as L } from "../../../index-DIxK0V-G.js";
4
- import { s as e, u as M } from "../../../useSortSelect-C-PfwcIF.js";
2
+ import { useState as C, useRef as I, useEffect as B } from "react";
3
+ import { c as E } from "../../../index-DIxK0V-G.js";
4
+ import { s as e, u as L } from "../../../useSortSelect-Dfs-72R7.js";
5
5
  import { NewIcon as u } from "../../NewIcon/ui/NewIcon.js";
6
6
  import "../../Button/ui/Button.js";
7
7
  import "../../mobileButton/ui/MobileButton.js";
@@ -9,43 +9,44 @@ import "../../DestinationTab/ui/DestinationTab.js";
9
9
  import "../../RoundButton/ui/RoundButton.js";
10
10
  import "../../Tag/ui/Tag.js";
11
11
  import "../../Switcher/ui/Switcher.js";
12
- import { Text as W } from "../../Text/ui/Text.js";
12
+ import { Text as M } from "../../Text/ui/Text.js";
13
13
  import "../../Flex/ui/Flex.js";
14
14
  import "../../Input/ui/Input.js";
15
- import { Modal as w } from "../../Modal/ui/Modal.js";
15
+ import { Modal as W } from "../../Modal/ui/Modal.js";
16
16
  import "../../TabSwitcher/ui/TabSwitcher.js";
17
17
  import "../../GroupedInput/ui/GroupedInputs.js";
18
18
  import "../../MetroTag/ui/MetroTag.js";
19
19
  import "../../Select/ui/Select.js";
20
- import { useClientWidth as D } from "../../../shared/useClientWidth.js";
21
- const l = L.bind(e), g = ({
22
- options: s,
23
- placeholder: f = "",
24
- error: h,
25
- disabled: O,
26
- additionalClass: S = "",
27
- onChange: v,
20
+ import { useClientWidth as j } from "../../../shared/useClientWidth.js";
21
+ const l = E.bind(e), w = ({
22
+ options: n,
23
+ selectedOption: f,
24
+ placeholder: S = "",
25
+ error: O,
26
+ disabled: h,
27
+ additionalClass: v = "",
28
+ onChange: c,
28
29
  onBlur: N,
29
- mini: x
30
+ mini: b
30
31
  }) => {
31
- const [b, k] = d(s[0]), [i, o] = d(!1), c = B(null), { isMobile: m, isDesktop: C } = D(), { handleBlur: y, getInputValue: I, getOption: a, handleDocumentClick: p } = M({
32
- selectedOption: b,
33
- setSelectedOption: k,
34
- setIsOpen: o,
35
- containerRef: c,
36
- isOpen: i,
37
- isDesktop: C,
38
- placeholder: f,
39
- onChange: v,
32
+ const [o, i] = C(!1), m = I(null), { isMobile: a, isDesktop: x } = j(), { handleBlur: y, getInputValue: k, getOption: d, handleDocumentClick: p } = L({
33
+ selectedOption: f,
34
+ setSelectedOption: c,
35
+ setIsOpen: i,
36
+ containerRef: m,
37
+ isOpen: o,
38
+ isDesktop: x,
39
+ placeholder: S,
40
+ onChange: c,
40
41
  onBlur: N
41
42
  });
42
- return E(() => (document.addEventListener("click", p), () => {
43
+ return B(() => (document.addEventListener("click", p), () => {
43
44
  document.removeEventListener("click", p);
44
45
  }), []), /* @__PURE__ */ r(
45
46
  "div",
46
47
  {
47
- ref: c,
48
- className: l(e.sortSelectWrapper, { [e.sortSelectWrapperError]: h }, S),
48
+ ref: m,
49
+ className: l(e.sortSelectWrapper, { [e.sortSelectWrapperError]: O }, v),
49
50
  tabIndex: 0,
50
51
  onBlur: y,
51
52
  children: [
@@ -55,13 +56,13 @@ const l = L.bind(e), g = ({
55
56
  {
56
57
  type: "text",
57
58
  readOnly: !0,
58
- value: I(),
59
+ value: k(),
59
60
  className: l(
60
61
  e.selectedOptions,
61
- { [e.selectOptionsDisabled]: O },
62
- { [e.selectionOptionMini]: x }
62
+ { [e.selectOptionsDisabled]: h },
63
+ { [e.selectionOptionMini]: b }
63
64
  ),
64
- onClick: () => o(!i)
65
+ onClick: () => i(!o)
65
66
  }
66
67
  ),
67
68
  /* @__PURE__ */ t(
@@ -73,16 +74,17 @@ const l = L.bind(e), g = ({
73
74
  }
74
75
  )
75
76
  ] }),
76
- i && m && /* @__PURE__ */ r(
77
- w,
77
+ o && a && /* @__PURE__ */ r(
78
+ W,
78
79
  {
79
- isOpen: i,
80
- emitIsOpen: o,
80
+ isOpen: o,
81
+ emitIsOpen: i,
81
82
  additionalClassModalBody: e.modalAddBody,
83
+ createPortalObj: { domNode: document.querySelector("body") },
82
84
  children: [
83
85
  /* @__PURE__ */ r("div", { className: e.mobileSortHeader, children: [
84
- /* @__PURE__ */ t(W, { children: "Сортировка" }),
85
- /* @__PURE__ */ t("div", { onClick: () => o(!1), children: /* @__PURE__ */ t(
86
+ /* @__PURE__ */ t(M, { children: "Сортировка" }),
87
+ /* @__PURE__ */ t("div", { onClick: () => i(!1), children: /* @__PURE__ */ t(
86
88
  u,
87
89
  {
88
90
  name: "close",
@@ -90,16 +92,16 @@ const l = L.bind(e), g = ({
90
92
  }
91
93
  ) })
92
94
  ] }),
93
- /* @__PURE__ */ t("div", { className: e.mobileOptionList, children: s.map((n) => a(n)) })
95
+ /* @__PURE__ */ t("div", { className: e.mobileOptionList, children: n.map((s) => d(s)) })
94
96
  ]
95
97
  }
96
98
  ),
97
- i && !m && /* @__PURE__ */ t("div", { className: e.optionsList, children: s.map((n) => a(n)) })
99
+ o && !a && /* @__PURE__ */ t("div", { className: e.optionsList, children: n.map((s) => d(s)) })
98
100
  ]
99
101
  }
100
102
  );
101
103
  };
102
- g.displayName = "SortSelect";
104
+ w.displayName = "SortSelect";
103
105
  export {
104
- g as SortSelect
106
+ w as SortSelect
105
107
  };
@@ -4,10 +4,11 @@ export interface Option {
4
4
  }
5
5
  export interface SortSelectProps {
6
6
  options: Option[];
7
+ selectedOption?: Option;
7
8
  placeholder?: string;
8
9
  error?: boolean;
9
10
  disabled?: boolean;
10
- onChange?: (event: Option) => void;
11
+ onChange?: (event: Option | undefined) => void;
11
12
  onBlur?: (event: Option) => void;
12
13
  additionalClass?: string;
13
14
  mini?: boolean;
@@ -1,12 +1,12 @@
1
1
  import { jsxs as h, jsx as c } from "react/jsx-runtime";
2
2
  import { c as p } from "./index-DIxK0V-G.js";
3
- const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_selectionOptionMini_vmknt_33", C = "_selectedOptionsOpened_vmknt_37", S = "_selectOptionsDisabled_vmknt_41", f = "_optionsList_vmknt_48", g = "_mobileOptionList_vmknt_63", L = "_mobileSortHeader_vmknt_70", W = "_modalAddBody_vmknt_84", D = "_inputWrapper_vmknt_90", N = "_option_vmknt_48", y = "_icon_vmknt_117", A = "_checkBox_vmknt_124", H = "_checkBoxChecked_vmknt_131", M = "_innerCheck_vmknt_138", e = {
3
+ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_selectionOptionMini_vmknt_33", C = "_selectedOptionsOpened_vmknt_37", f = "_selectOptionsDisabled_vmknt_41", S = "_optionsList_vmknt_48", g = "_mobileOptionList_vmknt_63", L = "_mobileSortHeader_vmknt_70", W = "_modalAddBody_vmknt_84", D = "_inputWrapper_vmknt_90", N = "_option_vmknt_48", y = "_icon_vmknt_117", A = "_checkBox_vmknt_124", H = "_checkBoxChecked_vmknt_131", M = "_innerCheck_vmknt_138", o = {
4
4
  sortSelectWrapper: b,
5
5
  selectedOptions: x,
6
6
  selectionOptionMini: B,
7
7
  selectedOptionsOpened: C,
8
- selectOptionsDisabled: S,
9
- optionsList: f,
8
+ selectOptionsDisabled: f,
9
+ optionsList: S,
10
10
  mobileOptionList: g,
11
11
  mobileSortHeader: L,
12
12
  modalAddBody: W,
@@ -16,43 +16,43 @@ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_s
16
16
  checkBox: A,
17
17
  checkBoxChecked: H,
18
18
  innerCheck: M
19
- }, _ = p.bind(e), q = ({
19
+ }, m = p.bind(o), q = ({
20
20
  selectedOption: n,
21
- setSelectedOption: m,
22
- setIsOpen: s,
23
- containerRef: i,
24
- onBlur: r,
25
- onChange: a,
21
+ setSelectedOption: s,
22
+ setIsOpen: i,
23
+ containerRef: r,
24
+ onBlur: a,
25
+ onChange: _,
26
26
  isDesktop: k,
27
27
  placeholder: u
28
28
  }) => {
29
- const v = (t) => (o) => {
30
- o.stopPropagation();
31
- const l = (n == null ? void 0 : n.value) === t.value ? null : t;
32
- if (m(l), a) {
29
+ const v = (t) => (e) => {
30
+ e.stopPropagation();
31
+ const l = (n == null ? void 0 : n.value) === t.value ? void 0 : t;
32
+ if (s && s(l), _) {
33
33
  const d = {
34
- ...o,
34
+ ...e,
35
35
  target: { value: l }
36
36
  };
37
- a(d);
37
+ _(d);
38
38
  }
39
- s(!1);
39
+ i(!1);
40
40
  };
41
41
  return { handleDocumentClick: (t) => {
42
- i.current && !i.current.contains(t.target) && s(!1);
42
+ r.current && !r.current.contains(t.target) && i(!1);
43
43
  }, handleBlur: (t) => {
44
- if (r) {
45
- const o = {
44
+ if (a) {
45
+ const e = {
46
46
  ...t,
47
47
  target: { value: n }
48
48
  };
49
- r(o);
49
+ a(e);
50
50
  }
51
51
  }, getInputValue: () => k ? n ? n.label : u : "", getOption: (t) => /* @__PURE__ */ h(
52
52
  "div",
53
53
  {
54
- className: _(e.option, {
55
- [e.selected]: (n == null ? void 0 : n.value) === t.value
54
+ className: m(o.option, {
55
+ [o.selected]: (n == null ? void 0 : n.value) === t.value
56
56
  }),
57
57
  onClick: v(t),
58
58
  children: [
@@ -60,10 +60,10 @@ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_s
60
60
  /* @__PURE__ */ c(
61
61
  "div",
62
62
  {
63
- className: _(e.checkBox, {
64
- [e.checkBoxChecked]: (n == null ? void 0 : n.value) === t.value
63
+ className: m(o.checkBox, {
64
+ [o.checkBoxChecked]: (n == null ? void 0 : n.value) === t.value
65
65
  }),
66
- children: (n == null ? void 0 : n.value) === t.value && /* @__PURE__ */ c("div", { className: e.innerCheck })
66
+ children: (n == null ? void 0 : n.value) === t.value && /* @__PURE__ */ c("div", { className: o.innerCheck })
67
67
  }
68
68
  )
69
69
  ]
@@ -72,6 +72,6 @@ const b = "_sortSelectWrapper_vmknt_1", x = "_selectedOptions_vmknt_10", B = "_s
72
72
  ) };
73
73
  };
74
74
  export {
75
- e as s,
75
+ o as s,
76
76
  q as u
77
77
  };
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.130",
5
+ "version": "0.0.132",
6
6
  "author": "Mollycodd1e",
7
7
  "license": "ISC",
8
8
  "type": "module",