stone-kit 0.0.496 → 0.0.497
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.
- package/README.md +59 -59
- package/dist/{Option-C7WIx1fG.js → Option-CFf-6tyJ.js} +1 -1
- package/dist/components/Select/ui/Category.d.ts +1 -1
- package/dist/components/Select/ui/Category.js +27 -27
- package/dist/components/Select/ui/Option.d.ts +1 -1
- package/dist/components/Select/ui/Option.js +1 -1
- package/dist/components/Select/ui/Select.d.ts +1 -1
- package/dist/components/Select/ui/Select.js +54 -50
- package/dist/components/Select/ui/Select.types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# Stone-kit
|
|
2
|
-
|
|
3
|
-
Uikit for stone redesign 2.0
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Package installation:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm i stone-kit@latest
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
For Next.js page router in App.tsx:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
import 'stone-kit/dist/style.css'
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
and then:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
import {Button} from 'stone-kit'
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
For other projects u can immediately:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
import {Button} from 'stone-kit'
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Docs
|
|
34
|
-
|
|
35
|
-
### ButtonProps
|
|
36
|
-
|
|
37
|
-
size: optional, size of button. types : 'large' | 'medium' | 'small' | 'tiny'
|
|
38
|
-
|
|
39
|
-
pre: optional, insert icon/text before button text. type: ReactNode
|
|
40
|
-
|
|
41
|
-
post: optional, insert icon/text after button text. type: ReactNode
|
|
42
|
-
|
|
43
|
-
variant: optional, color variants of button. type:
|
|
44
|
-
'blue',
|
|
45
|
-
'gray',
|
|
46
|
-
'whiteStroke',
|
|
47
|
-
'sokolniki',
|
|
48
|
-
'black',
|
|
49
|
-
'whiteFilled'
|
|
50
|
-
|
|
51
|
-
width: optional, width of button. type: 'auto' | 'full'
|
|
52
|
-
|
|
53
|
-
additionalClass: optional, add your custom class to button. type: 'string'
|
|
54
|
-
|
|
55
|
-
as: optional, u can convert button to link. type: 'button' | 'link'. 'button' by default.
|
|
56
|
-
|
|
57
|
-
### MobileButtonProps
|
|
58
|
-
|
|
59
|
-
### Tag
|
|
1
|
+
# Stone-kit
|
|
2
|
+
|
|
3
|
+
Uikit for stone redesign 2.0
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Package installation:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i stone-kit@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
For Next.js page router in App.tsx:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
import 'stone-kit/dist/style.css'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
and then:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
import {Button} from 'stone-kit'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For other projects u can immediately:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
import {Button} from 'stone-kit'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Docs
|
|
34
|
+
|
|
35
|
+
### ButtonProps
|
|
36
|
+
|
|
37
|
+
size: optional, size of button. types : 'large' | 'medium' | 'small' | 'tiny'
|
|
38
|
+
|
|
39
|
+
pre: optional, insert icon/text before button text. type: ReactNode
|
|
40
|
+
|
|
41
|
+
post: optional, insert icon/text after button text. type: ReactNode
|
|
42
|
+
|
|
43
|
+
variant: optional, color variants of button. type:
|
|
44
|
+
'blue',
|
|
45
|
+
'gray',
|
|
46
|
+
'whiteStroke',
|
|
47
|
+
'sokolniki',
|
|
48
|
+
'black',
|
|
49
|
+
'whiteFilled'
|
|
50
|
+
|
|
51
|
+
width: optional, width of button. type: 'auto' | 'full'
|
|
52
|
+
|
|
53
|
+
additionalClass: optional, add your custom class to button. type: 'string'
|
|
54
|
+
|
|
55
|
+
as: optional, u can convert button to link. type: 'button' | 'link'. 'button' by default.
|
|
56
|
+
|
|
57
|
+
### MobileButtonProps
|
|
58
|
+
|
|
59
|
+
### Tag
|
|
@@ -6,7 +6,7 @@ export interface IOption {
|
|
|
6
6
|
disabledOptions: TOption[];
|
|
7
7
|
selectedOptions: TOption[];
|
|
8
8
|
clickableOptions?: (string | undefined)[];
|
|
9
|
-
handleOptionClick: (option: TOption | TOption[]) =>
|
|
9
|
+
handleOptionClick: (option: TOption | TOption[]) => void;
|
|
10
10
|
sizeIcon?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const Category: ({ category, selectedOptions, disabledOptions, clickableOptions, handleOptionClick, sizeIcon }: IOption) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { s as
|
|
1
|
+
import { jsxs as l, Fragment as v, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { s as e, O as f } from "../../../Option-CFf-6tyJ.js";
|
|
3
3
|
import { NewIcon as c } from "../../NewIcon/ui/NewIcon.js";
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
4
|
+
import { c as h } from "../../../index-rKuIKazb.js";
|
|
5
|
+
const N = h.bind(e), O = ({
|
|
6
6
|
category: o,
|
|
7
7
|
selectedOptions: n,
|
|
8
|
-
disabledOptions:
|
|
8
|
+
disabledOptions: r,
|
|
9
9
|
clickableOptions: p,
|
|
10
10
|
handleOptionClick: a,
|
|
11
|
-
sizeIcon:
|
|
11
|
+
sizeIcon: t
|
|
12
12
|
}) => {
|
|
13
|
-
const d = n.map((
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
13
|
+
const d = n.map((i) => JSON.stringify(i)), m = o.options.every((i) => d.includes(JSON.stringify(i)));
|
|
14
|
+
return /* @__PURE__ */ l(v, { children: [
|
|
15
|
+
/* @__PURE__ */ l(
|
|
16
16
|
"div",
|
|
17
17
|
{
|
|
18
|
-
className:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
className: N(
|
|
19
|
+
e.option,
|
|
20
|
+
e.category,
|
|
21
|
+
e.optionClickable,
|
|
22
22
|
{
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
(
|
|
23
|
+
[e.selected]: n.some((i) => i.value === o.value),
|
|
24
|
+
[e.optionDisabled]: r.some(
|
|
25
|
+
(i) => i.value === o.value
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
onClick: a(o.options),
|
|
29
|
+
onClick: () => a(o.options),
|
|
30
30
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ l("div", { className: e.leftSide, children: [
|
|
32
32
|
/* @__PURE__ */ s(
|
|
33
33
|
c,
|
|
34
34
|
{
|
|
35
|
-
size:
|
|
35
|
+
size: t ?? "20",
|
|
36
36
|
name: m ? "minusCheck" : "selectUnchecked"
|
|
37
37
|
}
|
|
38
38
|
),
|
|
@@ -43,21 +43,21 @@ const h = N.bind(i), k = ({
|
|
|
43
43
|
{
|
|
44
44
|
name: "arrowShort",
|
|
45
45
|
deg: m ? "180" : "0",
|
|
46
|
-
size:
|
|
47
|
-
additionalClass:
|
|
46
|
+
size: t ?? "24",
|
|
47
|
+
additionalClass: e.icon
|
|
48
48
|
}
|
|
49
49
|
)
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
o.options.map((
|
|
53
|
+
o.options.map((i, u) => /* @__PURE__ */ s(
|
|
54
54
|
f,
|
|
55
55
|
{
|
|
56
|
-
option:
|
|
57
|
-
disabledOptions:
|
|
56
|
+
option: i,
|
|
57
|
+
disabledOptions: r,
|
|
58
58
|
selectedOptions: n,
|
|
59
|
-
handleOptionClick: a,
|
|
60
|
-
sizeIcon:
|
|
59
|
+
handleOptionClick: () => a(i),
|
|
60
|
+
sizeIcon: t,
|
|
61
61
|
clickableOptions: p,
|
|
62
62
|
isOptionCategory: !0
|
|
63
63
|
},
|
|
@@ -66,5 +66,5 @@ const h = N.bind(i), k = ({
|
|
|
66
66
|
] });
|
|
67
67
|
};
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
O as Category
|
|
70
70
|
};
|
|
@@ -6,7 +6,7 @@ export interface IOption {
|
|
|
6
6
|
disabledOptions: TOption[];
|
|
7
7
|
selectedOptions: TOption[];
|
|
8
8
|
clickableOptions?: (string | undefined)[];
|
|
9
|
-
handleOptionClick: (option: TOption) =>
|
|
9
|
+
handleOptionClick: (option: TOption) => void;
|
|
10
10
|
sizeIcon?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const Option: ({ option, selectedOptions, disabledOptions, clickableOptions, handleOptionClick, isOptionCategory, sizeIcon }: IOption) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MultiSelectProps } from './Select.types';
|
|
2
2
|
|
|
3
|
-
export declare const Select: ({ options, placeholder, error, disabled, disabledOptions, additionalClass, additionalClassOption, additionalClassBtn, onChange, onBlur, selectedValues, isBtn, btnName, clickableOptions, isListRight, sizeIcon, mode, }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const Select: ({ options, placeholder, error, disabled, disabledOptions, additionalClass, additionalClassOption, additionalClassBtn, onChange, onBlur, selectedValues, isBtn, btnName, clickableOptions, isListRight, sizeIcon, mode, onClickItem, onCLickSelect }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { jsxs as m, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { c as
|
|
4
|
-
import { s as r, O as
|
|
5
|
-
import { NewIcon as
|
|
6
|
-
import { Category as
|
|
7
|
-
const u =
|
|
1
|
+
import { jsxs as m, Fragment as A, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useRef as R, useEffect as W } from "react";
|
|
3
|
+
import { c as Q } from "../../../index-rKuIKazb.js";
|
|
4
|
+
import { s as r, O as T } from "../../../Option-CFf-6tyJ.js";
|
|
5
|
+
import { NewIcon as j } from "../../NewIcon/ui/NewIcon.js";
|
|
6
|
+
import { Category as U } from "./Category.js";
|
|
7
|
+
const u = Q.bind(r), I = ({
|
|
8
8
|
options: g,
|
|
9
9
|
placeholder: L = "Выберите опции",
|
|
10
|
-
error:
|
|
10
|
+
error: B,
|
|
11
11
|
disabled: O,
|
|
12
12
|
disabledOptions: c = [],
|
|
13
|
-
additionalClass:
|
|
13
|
+
additionalClass: q = "",
|
|
14
14
|
additionalClassOption: C,
|
|
15
|
-
additionalClassBtn:
|
|
15
|
+
additionalClassBtn: G,
|
|
16
16
|
onChange: i,
|
|
17
17
|
onBlur: h,
|
|
18
|
-
selectedValues:
|
|
18
|
+
selectedValues: n = [],
|
|
19
19
|
isBtn: k = !1,
|
|
20
|
-
btnName:
|
|
20
|
+
btnName: H,
|
|
21
21
|
clickableOptions: F,
|
|
22
|
-
isListRight:
|
|
22
|
+
isListRight: K = !1,
|
|
23
23
|
sizeIcon: p,
|
|
24
|
-
mode: J = "options"
|
|
24
|
+
mode: J = "options",
|
|
25
|
+
onClickItem: w,
|
|
26
|
+
onCLickSelect: x
|
|
25
27
|
}) => {
|
|
26
28
|
const v = [
|
|
27
29
|
{
|
|
@@ -42,29 +44,29 @@ const u = K.bind(r), _ = ({
|
|
|
42
44
|
// {value: 'optionsFake6', label: 'labelFake6'}
|
|
43
45
|
// ]
|
|
44
46
|
// }
|
|
45
|
-
], [l, d] =
|
|
46
|
-
if (Array.isArray(e)) {
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
47
|
+
], [l, d] = D(n), [f, S] = D(!1), y = R(null), E = (e) => {
|
|
48
|
+
if (w && w(e), Array.isArray(e)) {
|
|
49
|
+
const s = e.filter((t) => !(c != null && c.includes(t)));
|
|
50
|
+
if (s.every((t) => l.map((a) => JSON.stringify(a)).includes(JSON.stringify(t)))) {
|
|
49
51
|
const t = l.filter((a) => !e.map((N) => JSON.stringify(N)).includes(JSON.stringify(a)));
|
|
50
52
|
d(t), i && i(t);
|
|
51
53
|
} else {
|
|
52
|
-
const t =
|
|
54
|
+
const t = s.filter((N) => !l.map((P) => JSON.stringify(P)).includes(JSON.stringify(N))), a = [...l, ...t];
|
|
53
55
|
d(a), i && i(a);
|
|
54
56
|
}
|
|
55
57
|
} else {
|
|
56
58
|
if (c.includes(e))
|
|
57
59
|
return;
|
|
58
|
-
const
|
|
59
|
-
d(
|
|
60
|
+
const s = l.some((t) => t.value === e.value) ? l.filter((t) => t.value !== e.value) : [...l, e];
|
|
61
|
+
d(s), i && i(s);
|
|
60
62
|
}
|
|
61
|
-
},
|
|
63
|
+
}, M = () => {
|
|
62
64
|
h && h(l);
|
|
63
65
|
};
|
|
64
|
-
|
|
65
|
-
const e = (
|
|
66
|
-
const t =
|
|
67
|
-
if (y.current && !y.current.contains(
|
|
66
|
+
W(() => {
|
|
67
|
+
const e = (s) => {
|
|
68
|
+
const t = s.target;
|
|
69
|
+
if (y.current && !y.current.contains(s.target)) {
|
|
68
70
|
if (t.closest("svg"))
|
|
69
71
|
return;
|
|
70
72
|
S(!1);
|
|
@@ -74,19 +76,19 @@ const u = K.bind(r), _ = ({
|
|
|
74
76
|
document.removeEventListener("click", e);
|
|
75
77
|
};
|
|
76
78
|
}, []);
|
|
77
|
-
const
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
}, [
|
|
79
|
+
const b = R(n);
|
|
80
|
+
return W(() => {
|
|
81
|
+
n.length !== b.current.length && (d(n), b.current = n);
|
|
82
|
+
}, [n]), /* @__PURE__ */ m(
|
|
81
83
|
"div",
|
|
82
84
|
{
|
|
83
85
|
ref: y,
|
|
84
|
-
className: u(r.multiSelectWrapper, { [r.multiSelectWrapperError]:
|
|
86
|
+
className: u(r.multiSelectWrapper, { [r.multiSelectWrapperError]: B }, q),
|
|
85
87
|
tabIndex: 0,
|
|
86
|
-
onBlur:
|
|
88
|
+
onBlur: M,
|
|
87
89
|
children: [
|
|
88
90
|
/* @__PURE__ */ m("div", { className: u(r.inputWrapper), children: [
|
|
89
|
-
!k && /* @__PURE__ */ m(
|
|
91
|
+
!k && /* @__PURE__ */ m(A, { children: [
|
|
90
92
|
/* @__PURE__ */ o(
|
|
91
93
|
"div",
|
|
92
94
|
{
|
|
@@ -100,7 +102,7 @@ const u = K.bind(r), _ = ({
|
|
|
100
102
|
}
|
|
101
103
|
),
|
|
102
104
|
/* @__PURE__ */ o(
|
|
103
|
-
|
|
105
|
+
j,
|
|
104
106
|
{
|
|
105
107
|
name: "arrowShort",
|
|
106
108
|
deg: f ? "180" : "0",
|
|
@@ -109,7 +111,7 @@ const u = K.bind(r), _ = ({
|
|
|
109
111
|
}
|
|
110
112
|
)
|
|
111
113
|
] }),
|
|
112
|
-
k && /* @__PURE__ */ m(
|
|
114
|
+
k && /* @__PURE__ */ m(A, { children: [
|
|
113
115
|
/* @__PURE__ */ o(
|
|
114
116
|
"button",
|
|
115
117
|
{
|
|
@@ -117,14 +119,16 @@ const u = K.bind(r), _ = ({
|
|
|
117
119
|
r.selectedOptions,
|
|
118
120
|
r.selectedOptionsBtn,
|
|
119
121
|
{ [r.selectOptionsDisabled]: O },
|
|
120
|
-
|
|
122
|
+
G
|
|
121
123
|
),
|
|
122
|
-
onClick: () =>
|
|
123
|
-
|
|
124
|
+
onClick: () => {
|
|
125
|
+
x && x(), S(!f);
|
|
126
|
+
},
|
|
127
|
+
children: H
|
|
124
128
|
}
|
|
125
129
|
),
|
|
126
130
|
/* @__PURE__ */ o(
|
|
127
|
-
|
|
131
|
+
j,
|
|
128
132
|
{
|
|
129
133
|
name: "filter",
|
|
130
134
|
deg: f ? "180" : "0",
|
|
@@ -134,31 +138,31 @@ const u = K.bind(r), _ = ({
|
|
|
134
138
|
)
|
|
135
139
|
] })
|
|
136
140
|
] }),
|
|
137
|
-
f && /* @__PURE__ */ m("div", { className: u(r.optionsList, { [r.listRight]:
|
|
138
|
-
J === "options" && (g == null ? void 0 : g.map((e,
|
|
139
|
-
|
|
141
|
+
f && /* @__PURE__ */ m("div", { className: u(r.optionsList, { [r.listRight]: K }, C), children: [
|
|
142
|
+
J === "options" && (g == null ? void 0 : g.map((e, s) => /* @__PURE__ */ o(
|
|
143
|
+
T,
|
|
140
144
|
{
|
|
141
145
|
disabledOptions: c,
|
|
142
146
|
clickableOptions: F,
|
|
143
147
|
selectedOptions: l,
|
|
144
148
|
sizeIcon: p,
|
|
145
149
|
option: e,
|
|
146
|
-
handleOptionClick:
|
|
150
|
+
handleOptionClick: E
|
|
147
151
|
},
|
|
148
|
-
|
|
152
|
+
s
|
|
149
153
|
))),
|
|
150
|
-
J === "category" && (v == null ? void 0 : v.map((e,
|
|
151
|
-
|
|
154
|
+
J === "category" && (v == null ? void 0 : v.map((e, s) => /* @__PURE__ */ o(
|
|
155
|
+
U,
|
|
152
156
|
{
|
|
153
157
|
disabledOptions: c,
|
|
154
158
|
clickableOptions: F,
|
|
155
159
|
selectedOptions: l,
|
|
156
160
|
sizeIcon: p,
|
|
157
161
|
category: e,
|
|
158
|
-
selectedValues:
|
|
159
|
-
handleOptionClick:
|
|
162
|
+
selectedValues: n,
|
|
163
|
+
handleOptionClick: E
|
|
160
164
|
},
|
|
161
|
-
|
|
165
|
+
s
|
|
162
166
|
)))
|
|
163
167
|
] })
|
|
164
168
|
]
|
|
@@ -166,5 +170,5 @@ const u = K.bind(r), _ = ({
|
|
|
166
170
|
);
|
|
167
171
|
};
|
|
168
172
|
export {
|
|
169
|
-
|
|
173
|
+
I as Select
|
|
170
174
|
};
|