datocms-react-ui 0.3.26 → 0.3.30
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/cjs/FieldHint/styles.module.css.json +1 -1
- package/dist/esm/FieldHint/styles.module.css.json +1 -1
- package/package.json +4 -3
- package/src/Button/index.tsx +173 -0
- package/src/Button/styles.module.css +149 -0
- package/src/Button/styles.module.css.json +1 -0
- package/src/ButtonGroup/Button/index.tsx +40 -0
- package/src/ButtonGroup/Button/styles.module.css +72 -0
- package/src/ButtonGroup/Button/styles.module.css.json +1 -0
- package/src/ButtonGroup/Group/index.tsx +31 -0
- package/src/ButtonGroup/Group/styles.module.css +6 -0
- package/src/ButtonGroup/Group/styles.module.css.json +1 -0
- package/src/ButtonGroup/index.ts +4 -0
- package/src/Canvas/index.tsx +556 -0
- package/src/Canvas/styles.module.css +75 -0
- package/src/Canvas/styles.module.css.json +1 -0
- package/src/ContextInspector/index.tsx +316 -0
- package/src/ContextInspector/styles.module.css +90 -0
- package/src/ContextInspector/styles.module.css.json +1 -0
- package/src/Dropdown/Dropdown.tsx +171 -0
- package/src/Dropdown/DropdownContext.tsx +10 -0
- package/src/Dropdown/Group.tsx +16 -0
- package/src/Dropdown/Menu.tsx +351 -0
- package/src/Dropdown/MenuContext.tsx +18 -0
- package/src/Dropdown/Option.tsx +148 -0
- package/src/Dropdown/OptionAction.tsx +42 -0
- package/src/Dropdown/Portal.tsx +46 -0
- package/src/Dropdown/Separator.tsx +13 -0
- package/src/Dropdown/Text.tsx +8 -0
- package/src/Dropdown/index.tsx +26 -0
- package/src/Dropdown/styles.module.css +331 -0
- package/src/Dropdown/styles.module.css.json +1 -0
- package/src/FieldError/index.tsx +10 -0
- package/src/FieldError/styles.module.css +6 -0
- package/src/FieldError/styles.module.css.json +1 -0
- package/src/FieldGroup/index.tsx +25 -0
- package/src/FieldGroup/styles.module.css +12 -0
- package/src/FieldGroup/styles.module.css.json +1 -0
- package/src/FieldHint/index.tsx +10 -0
- package/src/FieldHint/styles.module.css +14 -0
- package/src/FieldHint/styles.module.css.json +1 -0
- package/src/Form/index.tsx +145 -0
- package/src/Form/styles.module.css +19 -0
- package/src/Form/styles.module.css.json +1 -0
- package/src/FormLabel/index.tsx +36 -0
- package/src/FormLabel/styles.module.css +31 -0
- package/src/FormLabel/styles.module.css.json +1 -0
- package/src/Section/index.tsx +104 -0
- package/src/Section/styles.module.css +100 -0
- package/src/Section/styles.module.css.json +1 -0
- package/src/SelectField/index.tsx +244 -0
- package/src/SelectInput/index.tsx +233 -0
- package/src/SidebarPanel/index.tsx +110 -0
- package/src/SidebarPanel/styles.module.css +49 -0
- package/src/SidebarPanel/styles.module.css.json +1 -0
- package/src/Spinner/index.tsx +68 -0
- package/src/Spinner/styles.module.css +31 -0
- package/src/Spinner/styles.module.css.json +1 -0
- package/src/SwitchField/index.tsx +67 -0
- package/src/SwitchField/styles.module.css +25 -0
- package/src/SwitchField/styles.module.css.json +1 -0
- package/src/SwitchInput/index.tsx +74 -0
- package/src/SwitchInput/styles.module.css +100 -0
- package/src/SwitchInput/styles.module.css.json +1 -0
- package/src/TextField/index.tsx +58 -0
- package/src/TextField/styles.module.css +0 -0
- package/src/TextField/styles.module.css.json +1 -0
- package/src/TextInput/index.tsx +73 -0
- package/src/TextInput/styles.module.css +52 -0
- package/src/TextInput/styles.module.css.json +1 -0
- package/src/Toolbar/Button/index.tsx +32 -0
- package/src/Toolbar/Button/styles.module.css +43 -0
- package/src/Toolbar/Button/styles.module.css.json +1 -0
- package/src/Toolbar/Stack/index.tsx +33 -0
- package/src/Toolbar/Stack/styles.module.css +18 -0
- package/src/Toolbar/Stack/styles.module.css.json +1 -0
- package/src/Toolbar/Title/index.tsx +17 -0
- package/src/Toolbar/Title/styles.module.css +12 -0
- package/src/Toolbar/Title/styles.module.css.json +1 -0
- package/src/Toolbar/Toolbar/index.tsx +112 -0
- package/src/Toolbar/Toolbar/styles.module.css +15 -0
- package/src/Toolbar/Toolbar/styles.module.css.json +1 -0
- package/src/Toolbar/index.ts +8 -0
- package/src/base.css +89 -0
- package/src/generateStyleFromCtx/index.ts +25 -0
- package/src/global.css +23 -0
- package/src/icons.tsx +108 -0
- package/src/index.ts +23 -0
- package/src/mergeRefs/index.ts +8 -0
- package/src/useClickOutside/index.ts +30 -0
- package/src/useMediaQuery/index.ts +185 -0
- package/styles.css +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "fieldHint": "
|
|
1
|
+
{ "fieldHint": "_fieldHint_1avon_1" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "fieldHint": "
|
|
1
|
+
{ "fieldHint": "_fieldHint_1avon_1" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-react-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.30",
|
|
4
4
|
"description": "React components to use inside DatoCMS plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"test": "__tests__"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
+
"src",
|
|
22
23
|
"dist",
|
|
23
24
|
"styles.css",
|
|
24
25
|
"types.json"
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"classnames": "^2.3.1",
|
|
43
|
-
"datocms-plugin-sdk": "^0.3.
|
|
44
|
+
"datocms-plugin-sdk": "^0.3.30",
|
|
44
45
|
"react-intersection-observer": "^8.31.0",
|
|
45
46
|
"react-select": "^5.2.1",
|
|
46
47
|
"scroll-into-view-if-needed": "^2.2.20"
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"postcss-nested": "^5.0.6",
|
|
57
58
|
"typedoc": "^0.22.8"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ff419344f09be141cc04bf3e3cc28bd5f1d77903"
|
|
60
61
|
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React, { CSSProperties, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import styles from './styles.module.css.json';
|
|
4
|
+
|
|
5
|
+
export type ButtonProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
8
|
+
className?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClick?: MouseEventHandler;
|
|
11
|
+
buttonType?: 'primary' | 'muted' | 'negative';
|
|
12
|
+
buttonSize?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
13
|
+
leftIcon?: ReactNode;
|
|
14
|
+
rightIcon?: ReactNode;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @example Button types
|
|
21
|
+
*
|
|
22
|
+
* ```js
|
|
23
|
+
* <Canvas ctx={ctx}>
|
|
24
|
+
* <div style={{ marginBottom: 'var(--spacing-m)' }}>
|
|
25
|
+
* <Button buttonType="muted">Submit</Button>{' '}
|
|
26
|
+
* <Button buttonType="primary">Submit</Button>{' '}
|
|
27
|
+
* <Button buttonType="negative">Submit</Button>
|
|
28
|
+
* </div>
|
|
29
|
+
* <div>
|
|
30
|
+
* <Button buttonType="muted" disabled>
|
|
31
|
+
* Submit
|
|
32
|
+
* </Button>{' '}
|
|
33
|
+
* <Button buttonType="primary" disabled>
|
|
34
|
+
* Submit
|
|
35
|
+
* </Button>{' '}
|
|
36
|
+
* <Button buttonType="negative" disabled>
|
|
37
|
+
* Submit
|
|
38
|
+
* </Button>
|
|
39
|
+
* </div>
|
|
40
|
+
* </Canvas>;
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Full-width
|
|
44
|
+
*
|
|
45
|
+
* ```js
|
|
46
|
+
* <Canvas ctx={ctx}>
|
|
47
|
+
* <Button fullWidth>Submit</Button>
|
|
48
|
+
* </Canvas>;
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Sizing
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* <Canvas ctx={ctx}>
|
|
55
|
+
* <Button buttonSize="xxs">Submit</Button>{' '}
|
|
56
|
+
* <Button buttonSize="xs">Submit</Button>{' '}
|
|
57
|
+
* <Button buttonSize="s">Submit</Button>{' '}
|
|
58
|
+
* <Button buttonSize="m">Submit</Button>{' '}
|
|
59
|
+
* <Button buttonSize="l">Submit</Button>{' '}
|
|
60
|
+
* <Button buttonSize="xl">Submit</Button>{' '}
|
|
61
|
+
* </Canvas>;
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Icons
|
|
65
|
+
*
|
|
66
|
+
* ```js
|
|
67
|
+
* <Canvas ctx={ctx}>
|
|
68
|
+
* <div style={{ marginBottom: 'var(--spacing-m)' }}>
|
|
69
|
+
* <Button leftIcon={<PlusIcon />}>Submit</Button>
|
|
70
|
+
* </div>
|
|
71
|
+
* <div style={{ marginBottom: 'var(--spacing-m)' }}>
|
|
72
|
+
* <Button rightIcon={<ChevronDownIcon />}>Options</Button>
|
|
73
|
+
* </div>
|
|
74
|
+
* <div>
|
|
75
|
+
* <Button leftIcon={<PlusIcon />} />
|
|
76
|
+
* </div>
|
|
77
|
+
* </Canvas>;
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function Button({
|
|
81
|
+
children,
|
|
82
|
+
className,
|
|
83
|
+
disabled,
|
|
84
|
+
buttonType = 'muted',
|
|
85
|
+
buttonSize = 'm',
|
|
86
|
+
fullWidth,
|
|
87
|
+
onClick,
|
|
88
|
+
style,
|
|
89
|
+
leftIcon,
|
|
90
|
+
rightIcon,
|
|
91
|
+
type = 'button',
|
|
92
|
+
}: ButtonProps): JSX.Element {
|
|
93
|
+
return (
|
|
94
|
+
<button
|
|
95
|
+
type={type}
|
|
96
|
+
className={cn(
|
|
97
|
+
styles.button,
|
|
98
|
+
styles[`buttonType-${buttonType}`],
|
|
99
|
+
styles[`buttonSize-${buttonSize}`],
|
|
100
|
+
{
|
|
101
|
+
[styles.disabled]: disabled,
|
|
102
|
+
[styles.fullWidth]: fullWidth,
|
|
103
|
+
},
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
onClick={onClick}
|
|
108
|
+
style={style}
|
|
109
|
+
>
|
|
110
|
+
{leftIcon && (
|
|
111
|
+
<span className={styles['button__leftIcon']}>{leftIcon}</span>
|
|
112
|
+
)}
|
|
113
|
+
{children && <span>{children}</span>}
|
|
114
|
+
{rightIcon && (
|
|
115
|
+
<span className={styles['button__rightIcon']}>{rightIcon}</span>
|
|
116
|
+
)}
|
|
117
|
+
</button>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type ButtonLinkProps = {
|
|
122
|
+
children?: ReactNode;
|
|
123
|
+
href: string;
|
|
124
|
+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
125
|
+
className?: string;
|
|
126
|
+
onClick?: MouseEventHandler;
|
|
127
|
+
buttonType?: 'primary' | 'muted' | 'negative';
|
|
128
|
+
buttonSize?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
129
|
+
fullWidth?: boolean;
|
|
130
|
+
style?: CSSProperties;
|
|
131
|
+
leftIcon?: ReactNode;
|
|
132
|
+
rightIcon?: ReactNode;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export function ButtonLink({
|
|
136
|
+
children,
|
|
137
|
+
href,
|
|
138
|
+
target = '_blank',
|
|
139
|
+
className,
|
|
140
|
+
buttonType = 'muted',
|
|
141
|
+
buttonSize = 'm',
|
|
142
|
+
onClick,
|
|
143
|
+
fullWidth,
|
|
144
|
+
leftIcon,
|
|
145
|
+
rightIcon,
|
|
146
|
+
style,
|
|
147
|
+
}: ButtonLinkProps): JSX.Element {
|
|
148
|
+
return (
|
|
149
|
+
<a
|
|
150
|
+
href={href}
|
|
151
|
+
target={target}
|
|
152
|
+
className={cn(
|
|
153
|
+
styles.button,
|
|
154
|
+
styles[`buttonType-${buttonType}`],
|
|
155
|
+
styles[`buttonSize-${buttonSize}`],
|
|
156
|
+
{
|
|
157
|
+
[styles.fullWidth]: fullWidth,
|
|
158
|
+
},
|
|
159
|
+
className,
|
|
160
|
+
)}
|
|
161
|
+
style={style}
|
|
162
|
+
onClick={onClick}
|
|
163
|
+
>
|
|
164
|
+
{leftIcon && (
|
|
165
|
+
<span className={styles['button__leftIcon']}>{leftIcon}</span>
|
|
166
|
+
)}
|
|
167
|
+
{children && <span>{children}</span>}
|
|
168
|
+
{rightIcon && (
|
|
169
|
+
<span className={styles['button__rightIcon']}>{rightIcon}</span>
|
|
170
|
+
)}
|
|
171
|
+
</a>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
text-decoration: none;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
white-space: nowrap;
|
|
6
|
+
font-family: inherit;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
line-height: inherit;
|
|
9
|
+
background-color: transparent;
|
|
10
|
+
color: var(--base-body-color);
|
|
11
|
+
-webkit-appearance: none;
|
|
12
|
+
-moz-appearance: none;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
transition: all 0.3s var(--material-ease);
|
|
16
|
+
font-weight: var(--font-weight-bold);
|
|
17
|
+
border: 0;
|
|
18
|
+
opacity: 1;
|
|
19
|
+
|
|
20
|
+
&:hover,
|
|
21
|
+
&:focus {
|
|
22
|
+
opacity: 0.8;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:active {
|
|
26
|
+
opacity: 0.7;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.disabled {
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.buttonType-muted {
|
|
35
|
+
background-color: var(--light-color);
|
|
36
|
+
color: var(--accent-color);
|
|
37
|
+
|
|
38
|
+
&.disabled {
|
|
39
|
+
background-color: var(--light-bg-color);
|
|
40
|
+
color: rgba(0, 0, 0, 0.2);
|
|
41
|
+
|
|
42
|
+
&:hover,
|
|
43
|
+
&:focus,
|
|
44
|
+
&:active {
|
|
45
|
+
color: rgba(0, 0, 0, 0.2);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.buttonType-primary {
|
|
51
|
+
background-color: var(--accent-color);
|
|
52
|
+
color: white;
|
|
53
|
+
|
|
54
|
+
&:hover,
|
|
55
|
+
&:focus,
|
|
56
|
+
&:active {
|
|
57
|
+
color: white;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.disabled {
|
|
61
|
+
background-color: var(--disabled-bg-color);
|
|
62
|
+
color: rgba(0, 0, 0, 0.2);
|
|
63
|
+
&:hover,
|
|
64
|
+
&:focus,
|
|
65
|
+
&:active {
|
|
66
|
+
color: rgba(0, 0, 0, 0.2);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.buttonType-negative {
|
|
72
|
+
background-color: var(--alert-color);
|
|
73
|
+
color: white;
|
|
74
|
+
|
|
75
|
+
&:hover,
|
|
76
|
+
&:focus,
|
|
77
|
+
&:active {
|
|
78
|
+
color: white;
|
|
79
|
+
background-color: var(--alert-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.disabled {
|
|
83
|
+
background-color: var(--disabled-bg-color);
|
|
84
|
+
color: rgba(0, 0, 0, 0.2);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.buttonSize-xxs {
|
|
89
|
+
font-size: 1em;
|
|
90
|
+
padding: 0.5em 0.8em;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.buttonSize-xs {
|
|
94
|
+
font-size: 1em;
|
|
95
|
+
padding: 0.6em 0.8em;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.buttonSize-s {
|
|
99
|
+
padding: 0.7em 1em;
|
|
100
|
+
font-size: 1em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.buttonSize-m {
|
|
104
|
+
padding: 0.7em 1em;
|
|
105
|
+
font-size: 1.1em;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.buttonSize-l {
|
|
109
|
+
padding: 0.7em 1em;
|
|
110
|
+
font-size: 1.2em;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.buttonSize-xl {
|
|
114
|
+
font-size: 1.2em;
|
|
115
|
+
padding: 1em 1em;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.fullWidth {
|
|
119
|
+
text-align: center;
|
|
120
|
+
display: block;
|
|
121
|
+
width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.button__leftIcon,
|
|
125
|
+
.button__rightIcon {
|
|
126
|
+
display: inline-block;
|
|
127
|
+
vertical-align: middle;
|
|
128
|
+
line-height: 0.6;
|
|
129
|
+
|
|
130
|
+
svg {
|
|
131
|
+
fill: var(--accent-color);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.button__leftIcon {
|
|
136
|
+
margin-right: 0.5em;
|
|
137
|
+
|
|
138
|
+
&:last-child {
|
|
139
|
+
margin-right: 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.button__rightIcon {
|
|
144
|
+
margin-left: 0.5em;
|
|
145
|
+
|
|
146
|
+
&:first-child {
|
|
147
|
+
margin-left: 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"button":"_button_474wk_1","disabled":"_disabled_474wk_30","buttonType-muted":"_buttonType-muted_474wk_34","buttonType-primary":"_buttonType-primary_474wk_50","buttonType-negative":"_buttonType-negative_474wk_71","buttonSize-xxs":"_buttonSize-xxs_474wk_88","buttonSize-xs":"_buttonSize-xs_474wk_93","buttonSize-s":"_buttonSize-s_474wk_98","buttonSize-m":"_buttonSize-m_474wk_103","buttonSize-l":"_buttonSize-l_474wk_108","buttonSize-xl":"_buttonSize-xl_474wk_113","fullWidth":"_fullWidth_474wk_118","button__leftIcon":"_button__leftIcon_474wk_124","button__rightIcon":"_button__rightIcon_474wk_125"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React, { CSSProperties, MouseEventHandler, ReactNode } from 'react';
|
|
3
|
+
import s from './styles.module.css.json';
|
|
4
|
+
|
|
5
|
+
export type ButtonProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
onClick?: MouseEventHandler;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function Button({
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
className,
|
|
18
|
+
selected,
|
|
19
|
+
disabled,
|
|
20
|
+
onClick,
|
|
21
|
+
}: ButtonProps): JSX.Element {
|
|
22
|
+
return (
|
|
23
|
+
<button
|
|
24
|
+
type="button"
|
|
25
|
+
onClick={onClick}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
className={classNames(
|
|
28
|
+
s['Button'],
|
|
29
|
+
{
|
|
30
|
+
[s['Button--selected']]: selected,
|
|
31
|
+
[s['Button--disabled']]: disabled,
|
|
32
|
+
},
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
style={style}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
.Button {
|
|
2
|
+
font-family: inherit;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
line-height: inherit;
|
|
5
|
+
background-color: white;
|
|
6
|
+
color: var(--base-body-color);
|
|
7
|
+
-webkit-appearance: none;
|
|
8
|
+
-moz-appearance: none;
|
|
9
|
+
font-size: inherit;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
border: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
padding: 7px 13px;
|
|
14
|
+
border-right: 1px solid var(--border-color);
|
|
15
|
+
border: 1px solid var(--border-color);
|
|
16
|
+
border-left-width: 0;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-column: center;
|
|
21
|
+
color: rgba(var(--base-body-color-rgb-components, 0.6));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Button:hover {
|
|
25
|
+
background-color: var(--light-bg-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.Button svg {
|
|
29
|
+
fill: var(--light-body-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.Button--s {
|
|
33
|
+
padding: 3px 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.Button--disabled {
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
color: var(--light-body-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.Button--disabled:hover {
|
|
42
|
+
background: white;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.Button--selected {
|
|
46
|
+
background-color: var(--accent-color);
|
|
47
|
+
border-color: var(--accent-color);
|
|
48
|
+
color: white;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.Button--selected svg {
|
|
52
|
+
fill: white;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.Button--selected:hover {
|
|
56
|
+
background-color: var(--accent-color);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.Button--selected:hover,
|
|
60
|
+
.Button--selected.Button--disabled {
|
|
61
|
+
background-color: rgba(var(--accent-color-rgb-components), 0.8);
|
|
62
|
+
border-color: rgba(var(--accent-color-rgb-components), 0.8);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.Button:first-child {
|
|
66
|
+
border-radius: 4px 0 0 4px;
|
|
67
|
+
border-left-width: 1px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.Button:last-child {
|
|
71
|
+
border-radius: 0 4px 4px 0;
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Button":"_Button_1h1w1_1","Button--s":"_Button--s_1h1w1_32","Button--disabled":"_Button--disabled_1h1w1_36","Button--selected":"_Button--selected_1h1w1_45"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import s from './styles.module.css.json';
|
|
4
|
+
|
|
5
|
+
export type GroupProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @example Basic example
|
|
13
|
+
*
|
|
14
|
+
* ```js
|
|
15
|
+
* <Canvas ctx={ctx}>
|
|
16
|
+
* <ButtonGroup>
|
|
17
|
+
* <ButtonGroupButton>First</ButtonGroupButton>
|
|
18
|
+
* <ButtonGroupButton selected>Second</ButtonGroupButton>
|
|
19
|
+
* <ButtonGroupButton>Third</ButtonGroupButton>
|
|
20
|
+
* <ButtonGroupButton disabled>Fourth</ButtonGroupButton>
|
|
21
|
+
* </ButtonGroup>
|
|
22
|
+
* </Canvas>;
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function Group({ children, style, className }: GroupProps): JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<div className={classNames(s['Group'], className)} style={style}>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"Group":"_Group_10mj4_1"}
|