@cloudflare/component-button 5.4.0 → 5.4.3

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.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 03d9b64e82: Add optional name attribute to Button.
8
+
9
+ ## 5.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 65f3dbc58e: Add optional name attribute to Button.
14
+
15
+ ## 5.4.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 4396bfb286: Fix dark mode focus state
20
+
3
21
  ## 5.4.0
4
22
 
5
23
  ### Minor Changes
package/dist/Button.d.ts CHANGED
@@ -46,8 +46,9 @@ export declare const buttonStyles: (props: PropsWithTheme) => {
46
46
  readonly width: "auto" | "100%";
47
47
  readonly boxShadow?: string | undefined;
48
48
  readonly '&:focus-visible': {
49
- readonly outlineOffset: 3;
50
- readonly outlineStyle: "auto";
49
+ readonly outlineOffset: 2;
50
+ readonly outlineWidth: 2;
51
+ readonly outlineStyle: "solid";
51
52
  readonly outlineColor: string;
52
53
  };
53
54
  readonly '&[title]': {
@@ -88,6 +89,7 @@ export declare const buttonStyles: (props: PropsWithTheme) => {
88
89
  };
89
90
  declare type Props = {
90
91
  id?: string;
92
+ name?: string;
91
93
  submit?: boolean;
92
94
  spaced?: boolean;
93
95
  space?: number;
@@ -109,6 +111,7 @@ declare type Props = {
109
111
  } & Pick<JSX.IntrinsicElements['button'], 'onClick' | 'disabled' | 'form' | 'tabIndex' | 'className'>;
110
112
  declare type PropsWithTheme = Props & ThemeProp;
111
113
  declare const _default: React.ComponentType<{
114
+ name?: string | undefined;
112
115
  space?: number | undefined;
113
116
  disabled?: boolean | undefined;
114
117
  compact?: boolean | undefined;
package/es/Button.js CHANGED
@@ -169,8 +169,9 @@ export var buttonStyles = props => {
169
169
  '&:focus:active': styles.active
170
170
  }), {}, {
171
171
  '&:focus-visible': {
172
- outlineOffset: 3,
173
- outlineStyle: 'auto',
172
+ outlineOffset: 2,
173
+ outlineWidth: 2,
174
+ outlineStyle: 'solid',
174
175
  outlineColor: type === 'danger' || type === 'plainDestructive' ? theme.colors.red[isDarkMode() ? 3 : 4] : theme.colors.focus
175
176
  },
176
177
  '&[title]': {
@@ -238,6 +239,7 @@ export var buttonStyles = props => {
238
239
  var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
239
240
  var {
240
241
  id,
242
+ name,
241
243
  submit = false,
242
244
  className,
243
245
  disabled,
@@ -258,6 +260,7 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
258
260
  }), {});
259
261
  return /*#__PURE__*/React.createElement("button", _extends({}, ariaAndDataProps, {
260
262
  id: id,
263
+ name: name,
261
264
  type: submit ? 'submit' : 'button',
262
265
  "data-testid": testId,
263
266
  disabled: disabled || loading,
@@ -281,6 +284,7 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
281
284
  });
282
285
  Button.propTypes = {
283
286
  id: PropTypes.string,
287
+ name: PropTypes.string,
284
288
  onClick: PropTypes.func,
285
289
  submit: PropTypes.bool,
286
290
  spaced: PropTypes.bool,
package/lib/Button.js CHANGED
@@ -182,8 +182,9 @@ var buttonStyles = function buttonStyles(props) {
182
182
  '&:focus:active': styles.active
183
183
  }), {}, {
184
184
  '&:focus-visible': {
185
- outlineOffset: 3,
186
- outlineStyle: 'auto',
185
+ outlineOffset: 2,
186
+ outlineWidth: 2,
187
+ outlineStyle: 'solid',
187
188
  outlineColor: type === 'danger' || type === 'plainDestructive' ? theme.colors.red[(0, _styleConst.isDarkMode)() ? 3 : 4] : theme.colors.focus
188
189
  },
189
190
  '&[title]': {
@@ -253,6 +254,7 @@ exports.buttonStyles = buttonStyles;
253
254
 
254
255
  var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
255
256
  var id = props.id,
257
+ name = props.name,
256
258
  _props$submit = props.submit,
257
259
  submit = _props$submit === void 0 ? false : _props$submit,
258
260
  className = props.className,
@@ -277,6 +279,7 @@ var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
277
279
  }, {});
278
280
  return /*#__PURE__*/_react.default.createElement("button", _extends({}, ariaAndDataProps, {
279
281
  id: id,
282
+ name: name,
280
283
  type: submit ? 'submit' : 'button',
281
284
  "data-testid": testId,
282
285
  disabled: disabled || loading,
@@ -301,6 +304,7 @@ var Button = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
301
304
 
302
305
  Button.propTypes = {
303
306
  id: _propTypes.default.string,
307
+ name: _propTypes.default.string,
304
308
  onClick: _propTypes.default.func,
305
309
  submit: _propTypes.default.bool,
306
310
  spaced: _propTypes.default.bool,
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.4.0",
4
+ "version": "5.4.3",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "author": "James Kyle <jkyle@cloudflare.com>",