datocms-react-ui 0.3.27 → 0.3.31
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/cjs/FieldWrapper/index.js +29 -0
- package/dist/cjs/FieldWrapper/index.js.map +1 -0
- package/dist/cjs/SelectField/index.js +8 -20
- package/dist/cjs/SelectField/index.js.map +1 -1
- package/dist/cjs/TextField/index.js +2 -5
- package/dist/cjs/TextField/index.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/FieldHint/styles.module.css.json +1 -1
- package/dist/esm/FieldWrapper/index.d.ts +13 -0
- package/dist/esm/FieldWrapper/index.js +22 -0
- package/dist/esm/FieldWrapper/index.js.map +1 -0
- package/dist/esm/SelectField/index.js +9 -21
- package/dist/esm/SelectField/index.js.map +1 -1
- package/dist/esm/TextField/index.js +3 -6
- package/dist/esm/TextField/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/FieldWrapper/index.d.ts +13 -0
- package/dist/types/index.d.ts +1 -0
- 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/FieldWrapper/index.tsx +38 -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 +242 -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 +51 -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 +24 -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
- package/types.json +801 -760
|
@@ -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"}
|