@cloudflare/component-button 5.1.0 → 5.3.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ebecfbb551: Change inverted styles, add plainDestructive type
8
+
9
+ ### Patch Changes
10
+
11
+ - 97244e8fe0: Increase transition time
12
+ - d74e81de82: Fix default button hover effect, plainDestructive focus outline color
13
+
14
+ ## 5.2.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 8dfd2c3a82: Add plain and plainMono button types
19
+ - 658c7bd8b6: Update colors and states, added buttonState prop to lock appearance to a particular state (e.g. hover)
20
+
3
21
  ## 5.1.0
4
22
 
5
23
  ### Minor Changes
package/dist/Button.d.ts CHANGED
@@ -2,58 +2,10 @@ import React from 'react';
2
2
  import { ThemeProp } from '@cloudflare/style-container';
3
3
  import { IconType } from '@cloudflare/component-icon';
4
4
  export declare const buttonStyles: (props: PropsWithTheme) => {
5
- readonly '&:hover': {
6
- backgroundColor: string | undefined;
7
- color: string | undefined;
8
- } | undefined;
9
- readonly '&:active': {
10
- backgroundColor: string | undefined;
11
- color: string | undefined;
12
- } | undefined;
13
- readonly '&:focus': {
14
- backgroundColor: string | undefined;
15
- color: string | undefined;
16
- } | undefined;
17
- readonly '&:focus-visible': {
18
- readonly outlineOffset: 3;
19
- readonly outlineStyle: "auto";
20
- readonly outlineColor: string;
21
- };
22
- readonly '&:focus-within:hover': {
23
- backgroundColor: string | undefined;
24
- color: string | undefined;
25
- } | undefined;
26
- readonly '&:active:hover': {
27
- backgroundColor: string | undefined;
28
- color: string | undefined;
29
- } | undefined;
30
- readonly '&[title]': {
31
- readonly pointerEvents: "none" | "auto";
32
- };
33
- readonly backgroundColor: string | undefined;
34
- readonly color: string | undefined;
35
- readonly cursor: "default" | "pointer";
36
- readonly display: "inline-flex";
37
- readonly flexGrow: 1 | undefined;
38
- readonly alignItems: "center";
39
- readonly justifyContent: "center";
40
- readonly fontFamily: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, \"Helvetica Neue\", Arial, sans-serif";
41
- readonly fontSize: 2;
42
- readonly fontWeight: 400;
43
- readonly lineHeight: 1.2;
44
- readonly borderBottomWidth: 0 | "1px";
45
- readonly borderLeftWidth: 0 | "1px";
46
- readonly borderRightWidth: 0 | "1px";
47
- readonly borderTopWidth: 0 | "1px";
48
- readonly borderBottomStyle: "solid";
49
- readonly borderTopStyle: "solid";
50
- readonly borderLeftStyle: "solid";
51
- readonly borderRightStyle: "solid";
52
- readonly borderColor: string | undefined;
53
- readonly borderTopRightRadius: 0 | 5;
54
- readonly borderTopLeftRadius: 0 | 5;
55
- readonly borderBottomLeftRadius: 0 | 5;
56
- readonly borderBottomRightRadius: 0 | 5;
5
+ readonly borderTopRightRadius: 0 | "4px";
6
+ readonly borderTopLeftRadius: 0 | "4px";
7
+ readonly borderBottomLeftRadius: 0 | "4px";
8
+ readonly borderBottomRightRadius: 0 | "4px";
57
9
  readonly '&::before': {
58
10
  content: string;
59
11
  color: string | undefined;
@@ -84,22 +36,64 @@ export declare const buttonStyles: (props: PropsWithTheme) => {
84
36
  readonly pointerEvents: "none" | "auto";
85
37
  readonly position: "relative";
86
38
  readonly textAlign: "center";
87
- readonly transitionProperty: "background-color,border-color" | "background-color,border-color,color";
88
- readonly transitionDuration: "200ms";
39
+ readonly transitionProperty: "all";
40
+ readonly transitionDuration: "300ms";
89
41
  readonly transitionTimingFunction: "ease";
90
42
  readonly userSelect: "none";
91
43
  readonly maxWidth: "initial";
92
44
  readonly float: "none";
93
45
  readonly whiteSpace: "normal" | "nowrap";
94
46
  readonly width: "auto" | "100%";
47
+ readonly boxShadow?: string | undefined;
48
+ readonly '&:focus-visible': {
49
+ readonly outlineOffset: 3;
50
+ readonly outlineStyle: "auto";
51
+ readonly outlineColor: string;
52
+ };
53
+ readonly '&[title]': {
54
+ readonly pointerEvents: "none" | "auto";
55
+ };
56
+ readonly backgroundColor: string | undefined;
57
+ readonly color: string | undefined;
58
+ readonly cursor: "default" | "pointer";
59
+ readonly display: "inline-flex";
60
+ readonly flexGrow: 1 | undefined;
61
+ readonly alignItems: "center";
62
+ readonly justifyContent: "center";
63
+ readonly fontFamily: "-apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, \"Helvetica Neue\", Arial, sans-serif";
64
+ readonly fontSize: 2;
65
+ readonly fontWeight: 400;
66
+ readonly lineHeight: 1.2;
67
+ readonly border: "none";
68
+ readonly '&:focus'?: {
69
+ backgroundColor: string | undefined;
70
+ color: string | undefined;
71
+ boxShadow: string | undefined;
72
+ } | undefined;
73
+ readonly '&:hover'?: {
74
+ backgroundColor: string | undefined;
75
+ color: string | undefined;
76
+ boxShadow: string | undefined;
77
+ } | undefined;
78
+ readonly '&:active'?: {
79
+ backgroundColor: string | undefined;
80
+ color: string | undefined;
81
+ boxShadow: string | undefined;
82
+ } | undefined;
83
+ readonly '&:focus:active'?: {
84
+ backgroundColor: string | undefined;
85
+ color: string | undefined;
86
+ boxShadow: string | undefined;
87
+ } | undefined;
95
88
  };
96
89
  declare type Props = {
90
+ id?: string;
97
91
  submit?: boolean;
98
92
  spaced?: boolean;
99
93
  space?: number;
100
94
  direction?: 'column' | 'row';
101
95
  group?: 'first' | 'inbetween' | 'last';
102
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
96
+ type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'plain' | 'plainMono' | 'plainDestructive';
103
97
  testId?: string;
104
98
  loading?: boolean;
105
99
  inverted?: boolean;
@@ -110,21 +104,23 @@ declare type Props = {
110
104
  ariaLabel?: string;
111
105
  stretch?: boolean;
112
106
  noWrapText?: boolean;
107
+ buttonState?: 'hover' | 'active' | 'focus';
113
108
  } & Pick<JSX.IntrinsicElements['button'], 'onClick' | 'disabled' | 'form' | 'tabIndex' | 'className'>;
114
109
  declare type PropsWithTheme = Props & ThemeProp;
115
110
  declare const _default: React.ComponentType<{
116
111
  space?: number | undefined;
117
112
  disabled?: boolean | undefined;
118
- submit?: boolean | undefined;
119
113
  form?: string | undefined;
120
114
  className?: string | undefined;
115
+ id?: string | undefined;
121
116
  tabIndex?: number | undefined;
122
- type?: "default" | "primary" | "success" | "warning" | "danger" | undefined;
117
+ type?: "default" | "primary" | "success" | "warning" | "danger" | "plain" | "plainMono" | "plainDestructive" | undefined;
123
118
  direction?: "column" | "row" | undefined;
124
119
  key?: React.Key | null | undefined;
125
120
  onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
126
121
  loading?: boolean | undefined;
127
122
  stretch?: boolean | undefined;
123
+ submit?: boolean | undefined;
128
124
  inverted?: boolean | undefined;
129
125
  spaced?: boolean | undefined;
130
126
  group?: "first" | "last" | "inbetween" | undefined;
@@ -135,6 +131,7 @@ declare const _default: React.ComponentType<{
135
131
  iconPosition?: "right" | "left" | undefined;
136
132
  ariaLabel?: string | undefined;
137
133
  noWrapText?: boolean | undefined;
134
+ buttonState?: "focus" | "active" | "hover" | undefined;
138
135
  color?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
139
136
  borderColor?: string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined] | undefined;
140
137
  p?: import("csstype").PaddingProperty<string | number> | [import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined] | [import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined, import("csstype").PaddingProperty<string | number> | undefined] | undefined;
@@ -4,11 +4,11 @@ declare const TextButton: import("react").ComponentType<{
4
4
  name?: string | undefined;
5
5
  disabled?: boolean | undefined;
6
6
  color?: (string & (string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined])) | undefined;
7
- children?: import("react").ReactNode;
8
7
  form?: string | undefined;
9
8
  slot?: string | undefined;
10
9
  style?: import("react").CSSProperties | undefined;
11
10
  title?: string | undefined;
11
+ children?: import("react").ReactNode;
12
12
  value?: string | number | readonly string[] | undefined;
13
13
  defaultChecked?: boolean | undefined;
14
14
  defaultValue?: string | number | readonly string[] | undefined;
@@ -52,7 +52,7 @@ declare const TextButton: import("react").ComponentType<{
52
52
  unselectable?: "on" | "off" | undefined;
53
53
  'aria-activedescendant'?: string | undefined;
54
54
  'aria-atomic'?: boolean | "true" | "false" | undefined;
55
- 'aria-autocomplete'?: "none" | "list" | "both" | "inline" | undefined;
55
+ 'aria-autocomplete'?: "inline" | "none" | "list" | "both" | undefined;
56
56
  'aria-busy'?: boolean | "true" | "false" | undefined;
57
57
  'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
58
58
  'aria-colcount'?: number | undefined;
@@ -98,7 +98,7 @@ declare const TextButton: import("react").ComponentType<{
98
98
  'aria-valuemin'?: number | undefined;
99
99
  'aria-valuenow'?: number | undefined;
100
100
  'aria-valuetext'?: string | undefined;
101
- type?: "reset" | "submit" | "button" | undefined;
101
+ type?: "button" | "reset" | "submit" | undefined;
102
102
  autoFocus?: boolean | undefined;
103
103
  formAction?: string | undefined;
104
104
  formEncType?: string | undefined;
@@ -4,11 +4,11 @@ declare const UnstyledButton: import("react").ComponentType<{
4
4
  name?: string | undefined;
5
5
  disabled?: boolean | undefined;
6
6
  color?: (string & (string | [string | undefined, string | undefined] | [string | undefined, string | undefined, string | undefined])) | undefined;
7
- children?: import("react").ReactNode;
8
7
  form?: string | undefined;
9
8
  slot?: string | undefined;
10
9
  style?: import("react").CSSProperties | undefined;
11
10
  title?: string | undefined;
11
+ children?: import("react").ReactNode;
12
12
  value?: string | number | readonly string[] | undefined;
13
13
  defaultChecked?: boolean | undefined;
14
14
  defaultValue?: string | number | readonly string[] | undefined;
@@ -52,7 +52,7 @@ declare const UnstyledButton: import("react").ComponentType<{
52
52
  unselectable?: "on" | "off" | undefined;
53
53
  'aria-activedescendant'?: string | undefined;
54
54
  'aria-atomic'?: boolean | "true" | "false" | undefined;
55
- 'aria-autocomplete'?: "none" | "list" | "both" | "inline" | undefined;
55
+ 'aria-autocomplete'?: "inline" | "none" | "list" | "both" | undefined;
56
56
  'aria-busy'?: boolean | "true" | "false" | undefined;
57
57
  'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
58
58
  'aria-colcount'?: number | undefined;
@@ -98,7 +98,7 @@ declare const UnstyledButton: import("react").ComponentType<{
98
98
  'aria-valuemin'?: number | undefined;
99
99
  'aria-valuenow'?: number | undefined;
100
100
  'aria-valuetext'?: string | undefined;
101
- type?: "reset" | "submit" | "button" | undefined;
101
+ type?: "button" | "reset" | "submit" | undefined;
102
102
  autoFocus?: boolean | undefined;
103
103
  formAction?: string | undefined;
104
104
  formEncType?: string | undefined;
package/es/Button.js CHANGED
@@ -11,19 +11,25 @@ import PropTypes from 'prop-types';
11
11
  import { isDarkMode } from '@cloudflare/style-const';
12
12
  import { ariaAttributes, createStyledComponent } from '@cloudflare/style-container';
13
13
  import { Icon } from '@cloudflare/component-icon';
14
+ var borderRadius = '4px';
15
+
16
+ var standardColors = (theme, state) => {
17
+ var _theme$colors$button$, _theme$colors$button$2, _theme$colors$button$3, _theme$colors$button$4, _theme$colors$button$5, _theme$colors$button$6, _theme$colors$button$7;
14
18
 
15
- var standardColors = theme => {
16
19
  var color = theme.colors.gray[9];
17
20
  return {
18
21
  default: isDarkMode() ? color : theme.colors.gray[1],
19
- primary: color,
20
22
  success: color,
21
23
  warning: color,
22
- danger: color,
23
24
  inverted: {
24
- danger: theme.colors.red[3],
25
- primary: theme.colors.blue[3]
26
- }
25
+ danger: (_theme$colors$button$ = theme.colors.button.plainDestructive[state]) === null || _theme$colors$button$ === void 0 ? void 0 : _theme$colors$button$.text,
26
+ primary: (_theme$colors$button$2 = theme.colors.button.plain[state]) === null || _theme$colors$button$2 === void 0 ? void 0 : _theme$colors$button$2.text
27
+ },
28
+ primary: ((_theme$colors$button$3 = theme.colors.button.primary[state]) === null || _theme$colors$button$3 === void 0 ? void 0 : _theme$colors$button$3.text) || color,
29
+ danger: ((_theme$colors$button$4 = theme.colors.button.danger[state]) === null || _theme$colors$button$4 === void 0 ? void 0 : _theme$colors$button$4.text) || color,
30
+ plain: ((_theme$colors$button$5 = theme.colors.button.plain[state]) === null || _theme$colors$button$5 === void 0 ? void 0 : _theme$colors$button$5.text) || color,
31
+ plainMono: ((_theme$colors$button$6 = theme.colors.button.plainMono[state]) === null || _theme$colors$button$6 === void 0 ? void 0 : _theme$colors$button$6.text) || color,
32
+ plainDestructive: ((_theme$colors$button$7 = theme.colors.button.plainDestructive[state]) === null || _theme$colors$button$7 === void 0 ? void 0 : _theme$colors$button$7.text) || color
27
33
  };
28
34
  };
29
35
 
@@ -35,95 +41,77 @@ var buttonColors = theme => {
35
41
  normal: {
36
42
  backgroundColor: {
37
43
  default: isDarkMode() ? theme.colors.gray[standardIndex] : theme.colors.gray[8],
38
- primary: theme.colors.blue[standardIndex],
44
+ primary: theme.colors.button.primary.normal.background,
39
45
  success: theme.colors.green[standardIndex],
40
46
  warning: theme.colors.orange[standardIndex],
41
- danger: theme.colors.red[standardIndex],
47
+ danger: theme.colors.button.danger.normal.background,
42
48
  inverted: {
43
- danger: 'transparent',
44
- primary: 'transparent'
45
- }
49
+ danger: theme.colors.button.plainDestructive.normal.background,
50
+ primary: theme.colors.button.plain.normal.background
51
+ },
52
+ plain: theme.colors.button.plain.normal.background,
53
+ plainMono: theme.colors.button.plainMono.normal.background,
54
+ plainDestructive: theme.colors.button.plainDestructive.normal.background
46
55
  },
47
- color: standardColors(theme)
56
+ color: standardColors(theme, 'normal')
48
57
  },
49
58
  // Hover
50
59
  hover: {
51
60
  backgroundColor: {
52
61
  default: theme.colors.gray[isDarkMode() ? 2 : 7],
53
- primary: theme.colors.blue[hoverIndex],
62
+ primary: theme.colors.button.primary.hover.background,
54
63
  success: theme.colors.green[hoverIndex],
55
64
  warning: theme.colors.orange[hoverIndex],
56
- danger: theme.colors.red[hoverIndex],
65
+ danger: theme.colors.button.danger.hover.background,
57
66
  inverted: {
58
- danger: theme.colors.red[hoverIndex],
59
- primary: theme.colors.blue[hoverIndex]
60
- }
67
+ danger: theme.colors.button.plainDestructive.hover.background,
68
+ primary: theme.colors.button.plain.hover.background
69
+ },
70
+ plain: theme.colors.button.plain.hover.background,
71
+ plainMono: theme.colors.button.plainMono.hover.background,
72
+ plainDestructive: theme.colors.button.plainDestructive.hover.background
61
73
  },
62
- color: _objectSpread(_objectSpread({}, standardColors(theme)), {}, {
63
- inverted: {
64
- danger: theme.colors.white,
65
- primary: theme.colors.white
66
- }
67
- })
74
+ color: standardColors(theme, 'hover')
68
75
  },
69
76
  // Active
70
77
  active: {
71
78
  backgroundColor: {
72
- default: theme.colors.gray[isDarkMode() ? 3 : 8],
73
- primary: theme.colors.blue[standardIndex],
79
+ default: theme.colors.gray[isDarkMode() ? 3 : 6],
80
+ primary: theme.colors.button.primary.active.background,
74
81
  success: theme.colors.green[standardIndex],
75
82
  warning: theme.colors.orange[standardIndex],
76
- danger: theme.colors.red[standardIndex],
83
+ danger: theme.colors.button.danger.active.background,
77
84
  inverted: {
78
- danger: theme.colors.red[standardIndex],
79
- primary: theme.colors.blue[standardIndex]
80
- }
85
+ danger: theme.colors.button.plainDestructive.active.background,
86
+ primary: theme.colors.button.plain.active.background
87
+ },
88
+ plain: theme.colors.button.plain.active.background,
89
+ plainMono: theme.colors.button.plainMono.active.background,
90
+ plainDestructive: theme.colors.button.plainDestructive.active.background
81
91
  },
82
- color: _objectSpread(_objectSpread({}, standardColors(theme)), {}, {
83
- inverted: {
84
- danger: theme.colors.gray[9],
85
- primary: theme.colors.gray[9]
86
- }
87
- })
92
+ color: standardColors(theme, 'active')
88
93
  },
89
94
  // Focus
90
95
  focus: {
91
96
  backgroundColor: {
92
- default: theme.colors.gray[isDarkMode() ? 3 : 8],
93
- primary: theme.colors.blue[standardIndex],
97
+ default: theme.colors.gray[isDarkMode() ? 2 : 7],
98
+ primary: theme.colors.button.primary.focus.background,
94
99
  success: theme.colors.green[standardIndex],
95
100
  warning: theme.colors.orange[standardIndex],
96
- danger: theme.colors.red[standardIndex],
101
+ danger: theme.colors.button.danger.focus.background,
97
102
  inverted: {
98
- danger: 'transparent',
99
- primary: 'transparent'
100
- }
103
+ danger: theme.colors.button.plainDestructive.focus.background,
104
+ primary: theme.colors.button.plain.focus.background
105
+ },
106
+ plain: theme.colors.button.plain.focus.background,
107
+ plainMono: theme.colors.button.plainMono.focus.background,
108
+ plainDestructive: theme.colors.button.plainDestructive.focus.background
101
109
  },
102
- color: standardColors(theme)
110
+ color: standardColors(theme, 'focus')
103
111
  }
104
112
  };
105
113
  };
106
114
 
107
- var getFocusOutlineColor = (theme, type, inverted) => {
108
- var _invertedOutlines$typ;
109
-
110
- var standardIndex = isDarkMode() ? 3 : 4;
111
- var FOCUS_OFFSET_INDEX = 2;
112
- var focusIndex = standardIndex - FOCUS_OFFSET_INDEX;
113
- var outlines = {
114
- default: isDarkMode() ? theme.colors.gray[focusIndex] : theme.colors.gray[8 - FOCUS_OFFSET_INDEX],
115
- primary: theme.colors.blue[focusIndex],
116
- success: theme.colors.green[focusIndex],
117
- warning: theme.colors.orange[focusIndex],
118
- danger: theme.colors.red[focusIndex]
119
- };
120
- var invertedOutlines = {
121
- danger: theme.colors.red[focusIndex],
122
- primary: theme.colors.blue[focusIndex]
123
- };
124
- return inverted ? (_invertedOutlines$typ = invertedOutlines[type]) !== null && _invertedOutlines$typ !== void 0 ? _invertedOutlines$typ : outlines[type] : outlines[type];
125
- };
126
-
127
115
  var colorAccessor = (property, _ref) => {
128
116
  var {
129
117
  inverted = false,
@@ -140,46 +128,55 @@ var interactionStyleAccessor = (interactionState, props) => {
140
128
  } = props;
141
129
  var isInteractive = !(loading || disabled);
142
130
  var stateStyles = buttonColors(theme)[interactionState];
131
+ var color = colorAccessor(stateStyles.color, props);
132
+ var backgroundColor = colorAccessor(stateStyles.backgroundColor, props);
143
133
  return isInteractive ? {
144
- backgroundColor: colorAccessor(stateStyles.backgroundColor, props),
145
- color: colorAccessor(stateStyles.color, props)
134
+ backgroundColor,
135
+ color,
136
+ boxShadow: props.inverted ? "inset 0px 0px 0px 1px ".concat(color) : undefined
146
137
  } : undefined;
147
138
  };
148
139
 
149
140
  export var buttonStyles = props => {
141
+ var _styles$buttonState, _styles$buttonState2;
142
+
150
143
  var {
151
144
  theme,
152
145
  loading = false,
153
146
  disabled,
154
147
  direction,
155
- inverted = false,
156
148
  group,
157
149
  spaced,
158
150
  space = 2,
159
151
  type = 'default',
160
152
  stretch,
161
- noWrapText
153
+ noWrapText,
154
+ buttonState
162
155
  } = props;
163
- var normalStyles = buttonColors(theme).normal;
164
- var hoverStyles = interactionStyleAccessor('hover', props);
165
- var activeStyles = interactionStyleAccessor('active', props);
166
- var focusStyles = interactionStyleAccessor('focus', props);
167
- return {
168
- '&:hover': hoverStyles,
169
- '&:active': activeStyles,
170
- '&:focus': focusStyles,
156
+ var styles = {
157
+ normal: buttonColors(theme).normal,
158
+ hover: interactionStyleAccessor('hover', props),
159
+ active: interactionStyleAccessor('active', props),
160
+ focus: interactionStyleAccessor('focus', props)
161
+ };
162
+ var color = buttonState && styles[buttonState] ? (_styles$buttonState = styles[buttonState]) === null || _styles$buttonState === void 0 ? void 0 : _styles$buttonState.color : colorAccessor(styles.normal.color, props);
163
+ var backgroundColor = buttonState && styles[buttonState] ? (_styles$buttonState2 = styles[buttonState]) === null || _styles$buttonState2 === void 0 ? void 0 : _styles$buttonState2.backgroundColor : colorAccessor(styles.normal.backgroundColor, props);
164
+ return _objectSpread(_objectSpread(_objectSpread({}, buttonState ? {} : {
165
+ '&:focus': styles.focus,
166
+ '&:hover': styles.hover,
167
+ '&:active': styles.active,
168
+ '&:focus:active': styles.active
169
+ }), {}, {
171
170
  '&:focus-visible': {
172
171
  outlineOffset: 3,
173
172
  outlineStyle: 'auto',
174
- outlineColor: getFocusOutlineColor(theme, type, inverted)
173
+ outlineColor: type === 'danger' || type === 'plainDestructive' ? theme.colors.red[isDarkMode() ? 3 : 4] : theme.colors.focus
175
174
  },
176
- '&:focus-within:hover': focusStyles,
177
- '&:active:hover': activeStyles,
178
175
  '&[title]': {
179
176
  pointerEvents: disabled ? 'auto' : 'none'
180
177
  },
181
- backgroundColor: colorAccessor(normalStyles.backgroundColor, props),
182
- color: loading ? 'transparent' : colorAccessor(normalStyles.color, props),
178
+ backgroundColor,
179
+ color: loading ? 'transparent' : color,
183
180
  cursor: disabled || loading ? 'default' : 'pointer',
184
181
  display: 'inline-flex',
185
182
  flexGrow: stretch ? 1 : undefined,
@@ -189,22 +186,17 @@ export var buttonStyles = props => {
189
186
  fontSize: 2,
190
187
  fontWeight: 400,
191
188
  lineHeight: 1.2,
192
- borderBottomWidth: inverted ? '1px' : 0,
193
- borderLeftWidth: inverted ? '1px' : 0,
194
- borderRightWidth: inverted ? '1px' : 0,
195
- borderTopWidth: inverted ? '1px' : 0,
196
- borderBottomStyle: 'solid',
197
- borderTopStyle: 'solid',
198
- borderLeftStyle: 'solid',
199
- borderRightStyle: 'solid',
200
- borderColor: inverted ? colorAccessor(normalStyles.color, props) : 'currentColor',
201
- borderTopRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
202
- borderTopLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
203
- borderBottomLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
204
- borderBottomRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
189
+ border: 'none'
190
+ }, props.inverted ? {
191
+ boxShadow: "inset 0px 0px 0px 1px ".concat(color)
192
+ } : {}), {}, {
193
+ borderTopRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : borderRadius,
194
+ borderTopLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : borderRadius,
195
+ borderBottomLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : borderRadius,
196
+ borderBottomRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : borderRadius,
205
197
  '&::before': loading ? {
206
198
  content: '"•••"',
207
- color: colorAccessor(normalStyles.color, props),
199
+ color,
208
200
  display: 'flex',
209
201
  alignItems: 'center',
210
202
  justifyContent: 'center',
@@ -232,18 +224,19 @@ export var buttonStyles = props => {
232
224
  pointerEvents: disabled ? 'none' : 'auto',
233
225
  position: 'relative',
234
226
  textAlign: 'center',
235
- transitionProperty: loading ? 'background-color,border-color' : 'background-color,border-color,color',
236
- transitionDuration: '200ms',
227
+ transitionProperty: 'all',
228
+ transitionDuration: '300ms',
237
229
  transitionTimingFunction: 'ease',
238
230
  userSelect: 'none',
239
231
  maxWidth: 'initial',
240
232
  float: 'none',
241
233
  whiteSpace: noWrapText ? 'nowrap' : 'normal',
242
234
  width: direction === 'column' ? '100%' : 'auto'
243
- };
235
+ });
244
236
  };
245
237
  var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
246
238
  var {
239
+ id,
247
240
  submit = false,
248
241
  className,
249
242
  disabled,
@@ -263,6 +256,7 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
263
256
  [propName]: props[propName]
264
257
  }), {});
265
258
  return /*#__PURE__*/React.createElement("button", _extends({}, ariaAndDataProps, {
259
+ id: id,
266
260
  type: submit ? 'submit' : 'button',
267
261
  "data-testid": testId,
268
262
  disabled: disabled || loading,
@@ -285,6 +279,7 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
285
279
  }));
286
280
  });
287
281
  Button.propTypes = {
282
+ id: PropTypes.string,
288
283
  onClick: PropTypes.func,
289
284
  submit: PropTypes.bool,
290
285
  spaced: PropTypes.bool,
@@ -292,7 +287,7 @@ Button.propTypes = {
292
287
  direction: PropTypes.oneOf(['column', 'row']),
293
288
  className: PropTypes.string,
294
289
  group: PropTypes.oneOf(['first', 'inbetween', 'last']),
295
- type: PropTypes.oneOf(['default', 'primary', 'success', 'warning', 'danger']),
290
+ type: PropTypes.oneOf(['default', 'primary', 'success', 'warning', 'danger', 'plain', 'plainMono', 'plainDestructive']),
296
291
  testId: PropTypes.string,
297
292
  disabled: PropTypes.bool,
298
293
  loading: PropTypes.bool,
@@ -304,7 +299,8 @@ Button.propTypes = {
304
299
  tabIndex: PropTypes.number,
305
300
  ariaLabel: PropTypes.string,
306
301
  stretch: PropTypes.bool,
307
- noWrapText: PropTypes.bool
302
+ noWrapText: PropTypes.bool,
303
+ buttonState: PropTypes.oneOf(['hover', 'active', 'focus'])
308
304
  };
309
305
  Button.displayName = 'Button';
310
306
  export default createStyledComponent(buttonStyles, Button);
@@ -8,13 +8,15 @@ import { createStyledComponent } from '@cloudflare/style-container';
8
8
  var UnstyledButton = createStyledComponent(_ref => {
9
9
  var {
10
10
  theme,
11
- focus
11
+ focus,
12
+ disabled
12
13
  } = _ref;
13
14
  return _objectSpread({
14
15
  background: 'none',
15
16
  color: 'inherit',
16
17
  border: 'none',
17
18
  padding: 0,
19
+ opacity: disabled ? 0.5 : undefined,
18
20
  font: 'inherit',
19
21
  cursor: 'pointer',
20
22
  outline: 'inherit'
package/lib/Button.js CHANGED
@@ -25,18 +25,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
25
25
 
26
26
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
 
28
- var standardColors = function standardColors(theme) {
28
+ var borderRadius = '4px';
29
+
30
+ var standardColors = function standardColors(theme, state) {
31
+ var _theme$colors$button$, _theme$colors$button$2, _theme$colors$button$3, _theme$colors$button$4, _theme$colors$button$5, _theme$colors$button$6, _theme$colors$button$7;
32
+
29
33
  var color = theme.colors.gray[9];
30
34
  return {
31
35
  default: (0, _styleConst.isDarkMode)() ? color : theme.colors.gray[1],
32
- primary: color,
33
36
  success: color,
34
37
  warning: color,
35
- danger: color,
36
38
  inverted: {
37
- danger: theme.colors.red[3],
38
- primary: theme.colors.blue[3]
39
- }
39
+ danger: (_theme$colors$button$ = theme.colors.button.plainDestructive[state]) === null || _theme$colors$button$ === void 0 ? void 0 : _theme$colors$button$.text,
40
+ primary: (_theme$colors$button$2 = theme.colors.button.plain[state]) === null || _theme$colors$button$2 === void 0 ? void 0 : _theme$colors$button$2.text
41
+ },
42
+ primary: ((_theme$colors$button$3 = theme.colors.button.primary[state]) === null || _theme$colors$button$3 === void 0 ? void 0 : _theme$colors$button$3.text) || color,
43
+ danger: ((_theme$colors$button$4 = theme.colors.button.danger[state]) === null || _theme$colors$button$4 === void 0 ? void 0 : _theme$colors$button$4.text) || color,
44
+ plain: ((_theme$colors$button$5 = theme.colors.button.plain[state]) === null || _theme$colors$button$5 === void 0 ? void 0 : _theme$colors$button$5.text) || color,
45
+ plainMono: ((_theme$colors$button$6 = theme.colors.button.plainMono[state]) === null || _theme$colors$button$6 === void 0 ? void 0 : _theme$colors$button$6.text) || color,
46
+ plainDestructive: ((_theme$colors$button$7 = theme.colors.button.plainDestructive[state]) === null || _theme$colors$button$7 === void 0 ? void 0 : _theme$colors$button$7.text) || color
40
47
  };
41
48
  };
42
49
 
@@ -48,95 +55,77 @@ var buttonColors = function buttonColors(theme) {
48
55
  normal: {
49
56
  backgroundColor: {
50
57
  default: (0, _styleConst.isDarkMode)() ? theme.colors.gray[standardIndex] : theme.colors.gray[8],
51
- primary: theme.colors.blue[standardIndex],
58
+ primary: theme.colors.button.primary.normal.background,
52
59
  success: theme.colors.green[standardIndex],
53
60
  warning: theme.colors.orange[standardIndex],
54
- danger: theme.colors.red[standardIndex],
61
+ danger: theme.colors.button.danger.normal.background,
55
62
  inverted: {
56
- danger: 'transparent',
57
- primary: 'transparent'
58
- }
63
+ danger: theme.colors.button.plainDestructive.normal.background,
64
+ primary: theme.colors.button.plain.normal.background
65
+ },
66
+ plain: theme.colors.button.plain.normal.background,
67
+ plainMono: theme.colors.button.plainMono.normal.background,
68
+ plainDestructive: theme.colors.button.plainDestructive.normal.background
59
69
  },
60
- color: standardColors(theme)
70
+ color: standardColors(theme, 'normal')
61
71
  },
62
72
  // Hover
63
73
  hover: {
64
74
  backgroundColor: {
65
75
  default: theme.colors.gray[(0, _styleConst.isDarkMode)() ? 2 : 7],
66
- primary: theme.colors.blue[hoverIndex],
76
+ primary: theme.colors.button.primary.hover.background,
67
77
  success: theme.colors.green[hoverIndex],
68
78
  warning: theme.colors.orange[hoverIndex],
69
- danger: theme.colors.red[hoverIndex],
79
+ danger: theme.colors.button.danger.hover.background,
70
80
  inverted: {
71
- danger: theme.colors.red[hoverIndex],
72
- primary: theme.colors.blue[hoverIndex]
73
- }
81
+ danger: theme.colors.button.plainDestructive.hover.background,
82
+ primary: theme.colors.button.plain.hover.background
83
+ },
84
+ plain: theme.colors.button.plain.hover.background,
85
+ plainMono: theme.colors.button.plainMono.hover.background,
86
+ plainDestructive: theme.colors.button.plainDestructive.hover.background
74
87
  },
75
- color: _objectSpread(_objectSpread({}, standardColors(theme)), {}, {
76
- inverted: {
77
- danger: theme.colors.white,
78
- primary: theme.colors.white
79
- }
80
- })
88
+ color: standardColors(theme, 'hover')
81
89
  },
82
90
  // Active
83
91
  active: {
84
92
  backgroundColor: {
85
- default: theme.colors.gray[(0, _styleConst.isDarkMode)() ? 3 : 8],
86
- primary: theme.colors.blue[standardIndex],
93
+ default: theme.colors.gray[(0, _styleConst.isDarkMode)() ? 3 : 6],
94
+ primary: theme.colors.button.primary.active.background,
87
95
  success: theme.colors.green[standardIndex],
88
96
  warning: theme.colors.orange[standardIndex],
89
- danger: theme.colors.red[standardIndex],
97
+ danger: theme.colors.button.danger.active.background,
90
98
  inverted: {
91
- danger: theme.colors.red[standardIndex],
92
- primary: theme.colors.blue[standardIndex]
93
- }
99
+ danger: theme.colors.button.plainDestructive.active.background,
100
+ primary: theme.colors.button.plain.active.background
101
+ },
102
+ plain: theme.colors.button.plain.active.background,
103
+ plainMono: theme.colors.button.plainMono.active.background,
104
+ plainDestructive: theme.colors.button.plainDestructive.active.background
94
105
  },
95
- color: _objectSpread(_objectSpread({}, standardColors(theme)), {}, {
96
- inverted: {
97
- danger: theme.colors.gray[9],
98
- primary: theme.colors.gray[9]
99
- }
100
- })
106
+ color: standardColors(theme, 'active')
101
107
  },
102
108
  // Focus
103
109
  focus: {
104
110
  backgroundColor: {
105
- default: theme.colors.gray[(0, _styleConst.isDarkMode)() ? 3 : 8],
106
- primary: theme.colors.blue[standardIndex],
111
+ default: theme.colors.gray[(0, _styleConst.isDarkMode)() ? 2 : 7],
112
+ primary: theme.colors.button.primary.focus.background,
107
113
  success: theme.colors.green[standardIndex],
108
114
  warning: theme.colors.orange[standardIndex],
109
- danger: theme.colors.red[standardIndex],
115
+ danger: theme.colors.button.danger.focus.background,
110
116
  inverted: {
111
- danger: 'transparent',
112
- primary: 'transparent'
113
- }
117
+ danger: theme.colors.button.plainDestructive.focus.background,
118
+ primary: theme.colors.button.plain.focus.background
119
+ },
120
+ plain: theme.colors.button.plain.focus.background,
121
+ plainMono: theme.colors.button.plainMono.focus.background,
122
+ plainDestructive: theme.colors.button.plainDestructive.focus.background
114
123
  },
115
- color: standardColors(theme)
124
+ color: standardColors(theme, 'focus')
116
125
  }
117
126
  };
118
127
  };
119
128
 
120
- var getFocusOutlineColor = function getFocusOutlineColor(theme, type, inverted) {
121
- var _invertedOutlines$typ;
122
-
123
- var standardIndex = (0, _styleConst.isDarkMode)() ? 3 : 4;
124
- var FOCUS_OFFSET_INDEX = 2;
125
- var focusIndex = standardIndex - FOCUS_OFFSET_INDEX;
126
- var outlines = {
127
- default: (0, _styleConst.isDarkMode)() ? theme.colors.gray[focusIndex] : theme.colors.gray[8 - FOCUS_OFFSET_INDEX],
128
- primary: theme.colors.blue[focusIndex],
129
- success: theme.colors.green[focusIndex],
130
- warning: theme.colors.orange[focusIndex],
131
- danger: theme.colors.red[focusIndex]
132
- };
133
- var invertedOutlines = {
134
- danger: theme.colors.red[focusIndex],
135
- primary: theme.colors.blue[focusIndex]
136
- };
137
- return inverted ? (_invertedOutlines$typ = invertedOutlines[type]) !== null && _invertedOutlines$typ !== void 0 ? _invertedOutlines$typ : outlines[type] : outlines[type];
138
- };
139
-
140
129
  var colorAccessor = function colorAccessor(property, _ref) {
141
130
  var _ref$inverted = _ref.inverted,
142
131
  inverted = _ref$inverted === void 0 ? false : _ref$inverted,
@@ -151,20 +140,23 @@ var interactionStyleAccessor = function interactionStyleAccessor(interactionStat
151
140
  disabled = props.disabled;
152
141
  var isInteractive = !(loading || disabled);
153
142
  var stateStyles = buttonColors(theme)[interactionState];
143
+ var color = colorAccessor(stateStyles.color, props);
144
+ var backgroundColor = colorAccessor(stateStyles.backgroundColor, props);
154
145
  return isInteractive ? {
155
- backgroundColor: colorAccessor(stateStyles.backgroundColor, props),
156
- color: colorAccessor(stateStyles.color, props)
146
+ backgroundColor: backgroundColor,
147
+ color: color,
148
+ boxShadow: props.inverted ? "inset 0px 0px 0px 1px ".concat(color) : undefined
157
149
  } : undefined;
158
150
  };
159
151
 
160
152
  var buttonStyles = function buttonStyles(props) {
153
+ var _styles$buttonState, _styles$buttonState2;
154
+
161
155
  var theme = props.theme,
162
156
  _props$loading = props.loading,
163
157
  loading = _props$loading === void 0 ? false : _props$loading,
164
158
  disabled = props.disabled,
165
159
  direction = props.direction,
166
- _props$inverted = props.inverted,
167
- inverted = _props$inverted === void 0 ? false : _props$inverted,
168
160
  group = props.group,
169
161
  spaced = props.spaced,
170
162
  _props$space = props.space,
@@ -172,27 +164,32 @@ var buttonStyles = function buttonStyles(props) {
172
164
  _props$type = props.type,
173
165
  type = _props$type === void 0 ? 'default' : _props$type,
174
166
  stretch = props.stretch,
175
- noWrapText = props.noWrapText;
176
- var normalStyles = buttonColors(theme).normal;
177
- var hoverStyles = interactionStyleAccessor('hover', props);
178
- var activeStyles = interactionStyleAccessor('active', props);
179
- var focusStyles = interactionStyleAccessor('focus', props);
180
- return {
181
- '&:hover': hoverStyles,
182
- '&:active': activeStyles,
183
- '&:focus': focusStyles,
167
+ noWrapText = props.noWrapText,
168
+ buttonState = props.buttonState;
169
+ var styles = {
170
+ normal: buttonColors(theme).normal,
171
+ hover: interactionStyleAccessor('hover', props),
172
+ active: interactionStyleAccessor('active', props),
173
+ focus: interactionStyleAccessor('focus', props)
174
+ };
175
+ var color = buttonState && styles[buttonState] ? (_styles$buttonState = styles[buttonState]) === null || _styles$buttonState === void 0 ? void 0 : _styles$buttonState.color : colorAccessor(styles.normal.color, props);
176
+ var backgroundColor = buttonState && styles[buttonState] ? (_styles$buttonState2 = styles[buttonState]) === null || _styles$buttonState2 === void 0 ? void 0 : _styles$buttonState2.backgroundColor : colorAccessor(styles.normal.backgroundColor, props);
177
+ return _objectSpread(_objectSpread(_objectSpread({}, buttonState ? {} : {
178
+ '&:focus': styles.focus,
179
+ '&:hover': styles.hover,
180
+ '&:active': styles.active,
181
+ '&:focus:active': styles.active
182
+ }), {}, {
184
183
  '&:focus-visible': {
185
184
  outlineOffset: 3,
186
185
  outlineStyle: 'auto',
187
- outlineColor: getFocusOutlineColor(theme, type, inverted)
186
+ outlineColor: type === 'danger' || type === 'plainDestructive' ? theme.colors.red[(0, _styleConst.isDarkMode)() ? 3 : 4] : theme.colors.focus
188
187
  },
189
- '&:focus-within:hover': focusStyles,
190
- '&:active:hover': activeStyles,
191
188
  '&[title]': {
192
189
  pointerEvents: disabled ? 'auto' : 'none'
193
190
  },
194
- backgroundColor: colorAccessor(normalStyles.backgroundColor, props),
195
- color: loading ? 'transparent' : colorAccessor(normalStyles.color, props),
191
+ backgroundColor: backgroundColor,
192
+ color: loading ? 'transparent' : color,
196
193
  cursor: disabled || loading ? 'default' : 'pointer',
197
194
  display: 'inline-flex',
198
195
  flexGrow: stretch ? 1 : undefined,
@@ -202,22 +199,17 @@ var buttonStyles = function buttonStyles(props) {
202
199
  fontSize: 2,
203
200
  fontWeight: 400,
204
201
  lineHeight: 1.2,
205
- borderBottomWidth: inverted ? '1px' : 0,
206
- borderLeftWidth: inverted ? '1px' : 0,
207
- borderRightWidth: inverted ? '1px' : 0,
208
- borderTopWidth: inverted ? '1px' : 0,
209
- borderBottomStyle: 'solid',
210
- borderTopStyle: 'solid',
211
- borderLeftStyle: 'solid',
212
- borderRightStyle: 'solid',
213
- borderColor: inverted ? colorAccessor(normalStyles.color, props) : 'currentColor',
214
- borderTopRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
215
- borderTopLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
216
- borderBottomLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
217
- borderBottomRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : theme.radii[2],
202
+ border: 'none'
203
+ }, props.inverted ? {
204
+ boxShadow: "inset 0px 0px 0px 1px ".concat(color)
205
+ } : {}), {}, {
206
+ borderTopRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : borderRadius,
207
+ borderTopLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : borderRadius,
208
+ borderBottomLeftRadius: (group === 'last' || group === 'inbetween') && !spaced ? 0 : borderRadius,
209
+ borderBottomRightRadius: (group === 'first' || group === 'inbetween') && !spaced ? 0 : borderRadius,
218
210
  '&::before': loading ? {
219
211
  content: '"•••"',
220
- color: colorAccessor(normalStyles.color, props),
212
+ color: color,
221
213
  display: 'flex',
222
214
  alignItems: 'center',
223
215
  justifyContent: 'center',
@@ -245,21 +237,22 @@ var buttonStyles = function buttonStyles(props) {
245
237
  pointerEvents: disabled ? 'none' : 'auto',
246
238
  position: 'relative',
247
239
  textAlign: 'center',
248
- transitionProperty: loading ? 'background-color,border-color' : 'background-color,border-color,color',
249
- transitionDuration: '200ms',
240
+ transitionProperty: 'all',
241
+ transitionDuration: '300ms',
250
242
  transitionTimingFunction: 'ease',
251
243
  userSelect: 'none',
252
244
  maxWidth: 'initial',
253
245
  float: 'none',
254
246
  whiteSpace: noWrapText ? 'nowrap' : 'normal',
255
247
  width: direction === 'column' ? '100%' : 'auto'
256
- };
248
+ });
257
249
  };
258
250
 
259
251
  exports.buttonStyles = buttonStyles;
260
252
 
261
253
  var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
262
- var _props$submit = props.submit,
254
+ var id = props.id,
255
+ _props$submit = props.submit,
263
256
  submit = _props$submit === void 0 ? false : _props$submit,
264
257
  className = props.className,
265
258
  disabled = props.disabled,
@@ -282,6 +275,7 @@ var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
282
275
  return _objectSpread(_objectSpread({}, memo), {}, _defineProperty({}, propName, props[propName]));
283
276
  }, {});
284
277
  return /*#__PURE__*/_react.default.createElement("button", _extends({}, ariaAndDataProps, {
278
+ id: id,
285
279
  type: submit ? 'submit' : 'button',
286
280
  "data-testid": testId,
287
281
  disabled: disabled || loading,
@@ -305,6 +299,7 @@ var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
305
299
  });
306
300
 
307
301
  Button.propTypes = {
302
+ id: _propTypes.default.string,
308
303
  onClick: _propTypes.default.func,
309
304
  submit: _propTypes.default.bool,
310
305
  spaced: _propTypes.default.bool,
@@ -312,7 +307,7 @@ Button.propTypes = {
312
307
  direction: _propTypes.default.oneOf(['column', 'row']),
313
308
  className: _propTypes.default.string,
314
309
  group: _propTypes.default.oneOf(['first', 'inbetween', 'last']),
315
- type: _propTypes.default.oneOf(['default', 'primary', 'success', 'warning', 'danger']),
310
+ type: _propTypes.default.oneOf(['default', 'primary', 'success', 'warning', 'danger', 'plain', 'plainMono', 'plainDestructive']),
316
311
  testId: _propTypes.default.string,
317
312
  disabled: _propTypes.default.bool,
318
313
  loading: _propTypes.default.bool,
@@ -324,7 +319,8 @@ Button.propTypes = {
324
319
  tabIndex: _propTypes.default.number,
325
320
  ariaLabel: _propTypes.default.string,
326
321
  stretch: _propTypes.default.bool,
327
- noWrapText: _propTypes.default.bool
322
+ noWrapText: _propTypes.default.bool,
323
+ buttonState: _propTypes.default.oneOf(['hover', 'active', 'focus'])
328
324
  };
329
325
  Button.displayName = 'Button';
330
326
 
@@ -15,12 +15,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
15
15
 
16
16
  var UnstyledButton = (0, _styleContainer.createStyledComponent)(function (_ref) {
17
17
  var theme = _ref.theme,
18
- focus = _ref.focus;
18
+ focus = _ref.focus,
19
+ disabled = _ref.disabled;
19
20
  return _objectSpread({
20
21
  background: 'none',
21
22
  color: 'inherit',
22
23
  border: 'none',
23
24
  padding: 0,
25
+ opacity: disabled ? 0.5 : undefined,
24
26
  font: 'inherit',
25
27
  cursor: 'pointer',
26
28
  outline: 'inherit'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudflare/component-button",
3
3
  "description": "Cloudflare Button Component",
4
- "version": "5.1.0",
4
+ "version": "5.3.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",