@stokr/components-library 4.1.0 → 4.1.1
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/dist/components/AgreementItem/AgreementItem.js +12 -3
- package/dist/components/Checkbox/Checkbox.d.ts +16 -0
- package/dist/components/Checkbox/Checkbox.js +4 -26
- package/dist/components/Checkbox/Checkbox.styles.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.styles.js +38 -28
- package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
- package/dist/components/MaterialIcon/requiredIcons.js +1 -0
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Fragment } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { InfoIcon } from "../InfoIcon/InfoIcon.js";
|
|
5
5
|
import { Text } from "../Text/Text.styles.js";
|
|
6
|
-
import
|
|
6
|
+
import { Checkbox } from "../Checkbox/Checkbox.js";
|
|
7
7
|
import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js";
|
|
8
8
|
import { Container, InfoBox } from "./AgreementItem.styles.js";
|
|
9
9
|
const AgreementItem = ({ title = "", text, checkbox, info = "" }) => /* @__PURE__ */ jsxs(Container, { children: [
|
|
@@ -12,7 +12,7 @@ const AgreementItem = ({ title = "", text, checkbox, info = "" }) => /* @__PURE_
|
|
|
12
12
|
text && /* @__PURE__ */ jsx("p", { children: text })
|
|
13
13
|
] }),
|
|
14
14
|
checkbox && /* @__PURE__ */ jsx(ComponentWrapper, { noPaddingHorizontal: true, noPaddingBottom: true, children: /* @__PURE__ */ jsx(
|
|
15
|
-
|
|
15
|
+
Checkbox,
|
|
16
16
|
{
|
|
17
17
|
id: checkbox.id,
|
|
18
18
|
name: checkbox.name || checkbox.id,
|
|
@@ -32,7 +32,16 @@ AgreementItem.propTypes = {
|
|
|
32
32
|
title: PropTypes.string,
|
|
33
33
|
text: PropTypes.string.isRequired,
|
|
34
34
|
info: PropTypes.string,
|
|
35
|
-
checkbox: PropTypes.shape(
|
|
35
|
+
checkbox: PropTypes.shape({
|
|
36
|
+
id: PropTypes.string.isRequired,
|
|
37
|
+
name: PropTypes.string,
|
|
38
|
+
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
39
|
+
value: PropTypes.string,
|
|
40
|
+
checked: PropTypes.bool,
|
|
41
|
+
onChange: PropTypes.func,
|
|
42
|
+
onBlur: PropTypes.func,
|
|
43
|
+
onClick: PropTypes.func
|
|
44
|
+
}).isRequired
|
|
36
45
|
};
|
|
37
46
|
export {
|
|
38
47
|
AgreementItem
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export declare const CheckBoxCaption: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'> {
|
|
4
|
+
id: string;
|
|
5
|
+
text?: ReactNode;
|
|
6
|
+
/** Heading above the checkbox. */
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
large?: boolean;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
touched?: boolean;
|
|
12
|
+
textStyle?: CSSProperties;
|
|
13
|
+
marginTop?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Checkbox: ({ id, name, text, label, value, checked, large, error, touched, onChange, onBlur, onFocus, textStyle, disabled, onClick, marginTop, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default Checkbox;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import styled from "styled-components";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
3
|
import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
|
|
6
4
|
import { Wrapper, Label, Input } from "./Checkbox.styles.js";
|
|
7
5
|
const CheckBoxCaption = styled.div`
|
|
@@ -32,9 +30,9 @@ const Checkbox = ({
|
|
|
32
30
|
},
|
|
33
31
|
marginTop,
|
|
34
32
|
...props
|
|
35
|
-
}) => /* @__PURE__ */ jsxs(Wrapper, { marginTop, children: [
|
|
33
|
+
}) => /* @__PURE__ */ jsxs(Wrapper, { $marginTop: marginTop, children: [
|
|
36
34
|
label && /* @__PURE__ */ jsx(Label, { error: error && touched, htmlFor: id, children: label }),
|
|
37
|
-
/* @__PURE__ */ jsxs(Input, { error, large, disabled, children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(Input, { $error: error, $large: large, $disabled: disabled, children: [
|
|
38
36
|
/* @__PURE__ */ jsx(
|
|
39
37
|
"input",
|
|
40
38
|
{
|
|
@@ -52,33 +50,13 @@ const Checkbox = ({
|
|
|
52
50
|
}
|
|
53
51
|
),
|
|
54
52
|
/* @__PURE__ */ jsxs("label", { htmlFor: id, style: textStyle, children: [
|
|
55
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "check", size: 18 }),
|
|
53
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "check", weight: 600, size: 18 }),
|
|
56
54
|
text
|
|
57
55
|
] })
|
|
58
56
|
] })
|
|
59
57
|
] });
|
|
60
|
-
const CheckboxPropTypes = {
|
|
61
|
-
id: PropTypes.string.isRequired,
|
|
62
|
-
name: PropTypes.string,
|
|
63
|
-
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
64
|
-
label: PropTypes.string,
|
|
65
|
-
value: PropTypes.string,
|
|
66
|
-
checked: PropTypes.bool,
|
|
67
|
-
large: PropTypes.bool,
|
|
68
|
-
error: PropTypes.bool,
|
|
69
|
-
touched: PropTypes.bool,
|
|
70
|
-
onChange: PropTypes.func,
|
|
71
|
-
onBlur: PropTypes.func,
|
|
72
|
-
onFocus: PropTypes.func,
|
|
73
|
-
onClick: PropTypes.func,
|
|
74
|
-
textStyle: PropTypes.object,
|
|
75
|
-
defaultChecked: PropTypes.bool
|
|
76
|
-
};
|
|
77
|
-
Checkbox.propTypes = CheckboxPropTypes;
|
|
78
|
-
var stdin_default = Checkbox;
|
|
79
58
|
export {
|
|
80
59
|
CheckBoxCaption,
|
|
81
60
|
Checkbox,
|
|
82
|
-
|
|
83
|
-
stdin_default as default
|
|
61
|
+
Checkbox as default
|
|
84
62
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
+
$marginTop?: boolean;
|
|
3
|
+
}>> & string;
|
|
4
|
+
export declare const Label: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "active" | "autoHeightLabel" | "isUp" | "error"> & {
|
|
5
|
+
autoHeightLabel?: boolean;
|
|
6
|
+
isUp?: boolean;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
error?: boolean;
|
|
9
|
+
}, never>> & string;
|
|
10
|
+
export declare const Input: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
11
|
+
$error?: boolean;
|
|
12
|
+
$large?: boolean;
|
|
13
|
+
$disabled?: boolean;
|
|
14
|
+
}>> & string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { Label as Label$1 } from "../Input/Input.styles.js";
|
|
3
3
|
import theme from "../../styles/theme.js";
|
|
4
|
-
const Wrapper = styled.div
|
|
5
|
-
shouldForwardProp: (props) => !["marginTop"].includes(props)
|
|
6
|
-
})`
|
|
4
|
+
const Wrapper = styled.div`
|
|
7
5
|
position: relative;
|
|
8
6
|
display: block;
|
|
9
|
-
margin-top: ${({ marginTop }) => marginTop && "7px"};
|
|
7
|
+
margin-top: ${({ $marginTop }) => $marginTop && "7px"};
|
|
10
8
|
`;
|
|
11
9
|
const Label = styled(Label$1)`
|
|
12
10
|
position: relative;
|
|
@@ -15,9 +13,7 @@ const Label = styled(Label$1)`
|
|
|
15
13
|
font-size: 10px;
|
|
16
14
|
margin-bottom: 5px;
|
|
17
15
|
`;
|
|
18
|
-
const Input = styled.div
|
|
19
|
-
shouldForwardProp: (props) => !["error", "large", "disabled"].includes(props)
|
|
20
|
-
})`
|
|
16
|
+
const Input = styled.div`
|
|
21
17
|
position: relative;
|
|
22
18
|
|
|
23
19
|
& > input {
|
|
@@ -45,39 +41,33 @@ const Input = styled.div.withConfig({
|
|
|
45
41
|
|
|
46
42
|
p {
|
|
47
43
|
margin: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${(props) => props.error && `color: ${theme.cWarning}`};
|
|
51
|
-
|
|
52
|
-
p {
|
|
53
44
|
font-size: 12px;
|
|
54
45
|
}
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
display: block;
|
|
58
|
-
position: absolute;
|
|
59
|
-
}
|
|
47
|
+
${(props) => props.$error && `color: ${theme.cWarning}`};
|
|
60
48
|
|
|
61
49
|
&:before {
|
|
62
50
|
content: '';
|
|
51
|
+
display: block;
|
|
52
|
+
position: absolute;
|
|
63
53
|
top: 0;
|
|
64
54
|
left: 0;
|
|
65
55
|
width: 16px;
|
|
66
56
|
height: 16px;
|
|
67
57
|
border-radius: 3px;
|
|
68
58
|
border: 1px solid #9b9b9b;
|
|
59
|
+
background-color: transparent;
|
|
69
60
|
box-shadow: none;
|
|
70
|
-
transition:
|
|
61
|
+
transition:
|
|
62
|
+
background-color 0.2s ease,
|
|
63
|
+
border-color 0.2s ease;
|
|
71
64
|
|
|
72
|
-
${(props) => props
|
|
65
|
+
${(props) => props.$large && `
|
|
73
66
|
width: 20px;
|
|
74
67
|
height: 20px;
|
|
75
68
|
border-radius: 4px;
|
|
76
69
|
`}
|
|
77
|
-
${(props) => props
|
|
78
|
-
background-color: #9b9b9b30;
|
|
79
|
-
|
|
80
|
-
`}
|
|
70
|
+
${(props) => props.$disabled && `background-color: #9b9b9b30;`}
|
|
81
71
|
}
|
|
82
72
|
|
|
83
73
|
> [data-icon] {
|
|
@@ -86,11 +76,14 @@ const Input = styled.div.withConfig({
|
|
|
86
76
|
left: -1px;
|
|
87
77
|
width: 18px;
|
|
88
78
|
height: 18px;
|
|
89
|
-
color:
|
|
79
|
+
color: #fff;
|
|
80
|
+
opacity: 0;
|
|
81
|
+
clip-path: inset(0 100% 0 0);
|
|
82
|
+
transition:
|
|
83
|
+
clip-path 0.15s ease-in,
|
|
84
|
+
opacity 0.15s ease-in;
|
|
90
85
|
|
|
91
|
-
${(props) => props
|
|
92
|
-
top: -1px;
|
|
93
|
-
left: -1px;
|
|
86
|
+
${(props) => props.$large && `
|
|
94
87
|
width: 22px;
|
|
95
88
|
height: 22px;
|
|
96
89
|
`};
|
|
@@ -100,13 +93,30 @@ const Input = styled.div.withConfig({
|
|
|
100
93
|
&:focus + label,
|
|
101
94
|
&:hover + label {
|
|
102
95
|
&:before {
|
|
103
|
-
border-color: ${(props) => props
|
|
96
|
+
border-color: ${(props) => props.$disabled ? "none" : theme.cPrimary};
|
|
104
97
|
}
|
|
105
98
|
}
|
|
106
99
|
|
|
107
100
|
&:checked + label {
|
|
101
|
+
&:before {
|
|
102
|
+
background-color: ${(props) => props.$disabled ? "#9b9b9b" : theme.cPrimary};
|
|
103
|
+
border-color: ${(props) => props.$disabled ? "#9b9b9b" : theme.cPrimary};
|
|
104
|
+
}
|
|
105
|
+
|
|
108
106
|
> [data-icon] {
|
|
109
|
-
|
|
107
|
+
opacity: 1;
|
|
108
|
+
clip-path: inset(0 0 0 0);
|
|
109
|
+
transition:
|
|
110
|
+
clip-path 0.25s ease-out 0.08s,
|
|
111
|
+
opacity 0.1s ease-out 0.08s;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (prefers-reduced-motion: reduce) {
|
|
116
|
+
& + label,
|
|
117
|
+
& + label:before,
|
|
118
|
+
& + label > [data-icon] {
|
|
119
|
+
transition: none !important;
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* The Material Symbols (`<variant>/<name>[-fill]`) the library's own components draw. The host registers them with
|
|
3
3
|
* `registerMaterialIcons`; a component whose icon is not registered renders it empty.
|
|
4
4
|
*/
|
|
5
|
-
export declare const requiredMaterialIcons: readonly ["outlined/add_circle", "outlined/cancel-fill", "outlined/check", "outlined/check_circle-fill", "outlined/chevron_left", "outlined/chevron_right", "outlined/close", "outlined/content_copy", "outlined/edit", "outlined/info", "outlined/info-fill", "outlined/keyboard_arrow_down", "outlined/search_activity", "outlined/visibility", "outlined/visibility_off", "outlined/warning"];
|
|
5
|
+
export declare const requiredMaterialIcons: readonly ["outlined/add_circle", "outlined/cancel-fill", "outlined/check", "outlined/check@600", "outlined/check_circle-fill", "outlined/chevron_left", "outlined/chevron_right", "outlined/close", "outlined/content_copy", "outlined/edit", "outlined/info", "outlined/info-fill", "outlined/keyboard_arrow_down", "outlined/search_activity", "outlined/visibility", "outlined/visibility_off", "outlined/warning"];
|
package/dist/index.d.ts
CHANGED
|
@@ -188,7 +188,8 @@ export declare const Background: AnyComponent
|
|
|
188
188
|
export declare const HeroVideoBlock: AnyComponent
|
|
189
189
|
export declare const BasicTable: AnyComponent
|
|
190
190
|
export declare const ChartLegend: AnyComponent
|
|
191
|
-
export
|
|
191
|
+
export { Checkbox, CheckBoxCaption } from './components/Checkbox/Checkbox'
|
|
192
|
+
export type { CheckboxProps } from './components/Checkbox/Checkbox'
|
|
192
193
|
export declare const ComponentScroll: AnyComponent
|
|
193
194
|
export declare const MemoCryptoAddress: AnyComponent, CryptoAddress: AnyComponent
|
|
194
195
|
export declare const CryptoAddressWrapper: AnyComponent
|