@cloudflare/component-button 5.3.1 → 5.4.0
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/CHANGELOG.md +12 -0
- package/dist/Button.d.ts +5 -3
- package/es/Button.js +10 -8
- package/lib/Button.js +10 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/Button.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export declare const buttonStyles: (props: PropsWithTheme) => {
|
|
|
31
31
|
readonly mr: 0;
|
|
32
32
|
readonly mb: 0;
|
|
33
33
|
readonly ml: number;
|
|
34
|
-
readonly px: 3;
|
|
35
|
-
readonly py: 2;
|
|
34
|
+
readonly px: 3 | "11px";
|
|
35
|
+
readonly py: 1 | 2;
|
|
36
36
|
readonly pointerEvents: "none" | "auto";
|
|
37
37
|
readonly position: "relative";
|
|
38
38
|
readonly textAlign: "center";
|
|
@@ -61,7 +61,7 @@ export declare const buttonStyles: (props: PropsWithTheme) => {
|
|
|
61
61
|
readonly alignItems: "center";
|
|
62
62
|
readonly justifyContent: "center";
|
|
63
63
|
readonly fontFamily: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, \"Helvetica Neue\", Arial, sans-serif";
|
|
64
|
-
readonly fontSize: 2;
|
|
64
|
+
readonly fontSize: 1 | 2;
|
|
65
65
|
readonly fontWeight: 400;
|
|
66
66
|
readonly lineHeight: 1.2;
|
|
67
67
|
readonly border: "none";
|
|
@@ -105,11 +105,13 @@ declare type Props = {
|
|
|
105
105
|
stretch?: boolean;
|
|
106
106
|
noWrapText?: boolean;
|
|
107
107
|
buttonState?: 'hover' | 'active' | 'focus';
|
|
108
|
+
compact?: boolean;
|
|
108
109
|
} & Pick<JSX.IntrinsicElements['button'], 'onClick' | 'disabled' | 'form' | 'tabIndex' | 'className'>;
|
|
109
110
|
declare type PropsWithTheme = Props & ThemeProp;
|
|
110
111
|
declare const _default: React.ComponentType<{
|
|
111
112
|
space?: number | undefined;
|
|
112
113
|
disabled?: boolean | undefined;
|
|
114
|
+
compact?: boolean | undefined;
|
|
113
115
|
form?: string | undefined;
|
|
114
116
|
className?: string | undefined;
|
|
115
117
|
id?: string | undefined;
|
package/es/Button.js
CHANGED
|
@@ -49,9 +49,9 @@ var buttonColors = theme => {
|
|
|
49
49
|
danger: theme.colors.button.plainDestructive.normal.background,
|
|
50
50
|
primary: theme.colors.button.plain.normal.background
|
|
51
51
|
},
|
|
52
|
-
plain:
|
|
53
|
-
plainMono:
|
|
54
|
-
plainDestructive:
|
|
52
|
+
plain: 'transparent',
|
|
53
|
+
plainMono: 'transparent',
|
|
54
|
+
plainDestructive: 'transparent'
|
|
55
55
|
},
|
|
56
56
|
color: standardColors(theme, 'normal')
|
|
57
57
|
},
|
|
@@ -151,7 +151,8 @@ export var buttonStyles = props => {
|
|
|
151
151
|
type = 'default',
|
|
152
152
|
stretch,
|
|
153
153
|
noWrapText,
|
|
154
|
-
buttonState
|
|
154
|
+
buttonState,
|
|
155
|
+
compact
|
|
155
156
|
} = props;
|
|
156
157
|
var styles = {
|
|
157
158
|
normal: buttonColors(theme).normal,
|
|
@@ -183,7 +184,7 @@ export var buttonStyles = props => {
|
|
|
183
184
|
alignItems: 'center',
|
|
184
185
|
justifyContent: 'center',
|
|
185
186
|
fontFamily: theme.fontFamily,
|
|
186
|
-
fontSize: 2,
|
|
187
|
+
fontSize: compact ? 1 : 2,
|
|
187
188
|
fontWeight: 400,
|
|
188
189
|
lineHeight: 1.2,
|
|
189
190
|
border: 'none'
|
|
@@ -219,8 +220,8 @@ export var buttonStyles = props => {
|
|
|
219
220
|
mr: 0,
|
|
220
221
|
mb: 0,
|
|
221
222
|
ml: spaced && direction === 'row' && group !== 'first' ? space : 0,
|
|
222
|
-
px: 3,
|
|
223
|
-
py: 2,
|
|
223
|
+
px: compact ? '11px' : 3,
|
|
224
|
+
py: compact ? 1 : 2,
|
|
224
225
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
225
226
|
position: 'relative',
|
|
226
227
|
textAlign: 'center',
|
|
@@ -300,7 +301,8 @@ Button.propTypes = {
|
|
|
300
301
|
ariaLabel: PropTypes.string,
|
|
301
302
|
stretch: PropTypes.bool,
|
|
302
303
|
noWrapText: PropTypes.bool,
|
|
303
|
-
buttonState: PropTypes.oneOf(['hover', 'active', 'focus'])
|
|
304
|
+
buttonState: PropTypes.oneOf(['hover', 'active', 'focus']),
|
|
305
|
+
compact: PropTypes.bool
|
|
304
306
|
};
|
|
305
307
|
Button.displayName = 'Button';
|
|
306
308
|
export default createStyledComponent(buttonStyles, Button);
|
package/lib/Button.js
CHANGED
|
@@ -63,9 +63,9 @@ var buttonColors = function buttonColors(theme) {
|
|
|
63
63
|
danger: theme.colors.button.plainDestructive.normal.background,
|
|
64
64
|
primary: theme.colors.button.plain.normal.background
|
|
65
65
|
},
|
|
66
|
-
plain:
|
|
67
|
-
plainMono:
|
|
68
|
-
plainDestructive:
|
|
66
|
+
plain: 'transparent',
|
|
67
|
+
plainMono: 'transparent',
|
|
68
|
+
plainDestructive: 'transparent'
|
|
69
69
|
},
|
|
70
70
|
color: standardColors(theme, 'normal')
|
|
71
71
|
},
|
|
@@ -165,7 +165,8 @@ var buttonStyles = function buttonStyles(props) {
|
|
|
165
165
|
type = _props$type === void 0 ? 'default' : _props$type,
|
|
166
166
|
stretch = props.stretch,
|
|
167
167
|
noWrapText = props.noWrapText,
|
|
168
|
-
buttonState = props.buttonState
|
|
168
|
+
buttonState = props.buttonState,
|
|
169
|
+
compact = props.compact;
|
|
169
170
|
var styles = {
|
|
170
171
|
normal: buttonColors(theme).normal,
|
|
171
172
|
hover: interactionStyleAccessor('hover', props),
|
|
@@ -196,7 +197,7 @@ var buttonStyles = function buttonStyles(props) {
|
|
|
196
197
|
alignItems: 'center',
|
|
197
198
|
justifyContent: 'center',
|
|
198
199
|
fontFamily: theme.fontFamily,
|
|
199
|
-
fontSize: 2,
|
|
200
|
+
fontSize: compact ? 1 : 2,
|
|
200
201
|
fontWeight: 400,
|
|
201
202
|
lineHeight: 1.2,
|
|
202
203
|
border: 'none'
|
|
@@ -232,8 +233,8 @@ var buttonStyles = function buttonStyles(props) {
|
|
|
232
233
|
mr: 0,
|
|
233
234
|
mb: 0,
|
|
234
235
|
ml: spaced && direction === 'row' && group !== 'first' ? space : 0,
|
|
235
|
-
px: 3,
|
|
236
|
-
py: 2,
|
|
236
|
+
px: compact ? '11px' : 3,
|
|
237
|
+
py: compact ? 1 : 2,
|
|
237
238
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
238
239
|
position: 'relative',
|
|
239
240
|
textAlign: 'center',
|
|
@@ -320,7 +321,8 @@ Button.propTypes = {
|
|
|
320
321
|
ariaLabel: _propTypes.default.string,
|
|
321
322
|
stretch: _propTypes.default.bool,
|
|
322
323
|
noWrapText: _propTypes.default.bool,
|
|
323
|
-
buttonState: _propTypes.default.oneOf(['hover', 'active', 'focus'])
|
|
324
|
+
buttonState: _propTypes.default.oneOf(['hover', 'active', 'focus']),
|
|
325
|
+
compact: _propTypes.default.bool
|
|
324
326
|
};
|
|
325
327
|
Button.displayName = 'Button';
|
|
326
328
|
|
package/package.json
CHANGED