@spark-web/button 1.5.1 → 1.5.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
  # @spark-web/button
2
2
 
3
+ ## 1.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#511](https://github.com/brighte-labs/spark-web/pull/511)
8
+ [`a2b6d91`](https://github.com/brighte-labs/spark-web/commit/a2b6d9160b7e50c6a3a9747cddc6a2891ce99ec5)
9
+ Thanks [@michtntbrighte](https://github.com/michtntbrighte)! - Add target to
10
+ ButtonLink props to support opening on new tab.
11
+
12
+ ## 1.5.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#451](https://github.com/brighte-labs/spark-web/pull/451)
17
+ [`02b6077`](https://github.com/brighte-labs/spark-web/commit/02b60775c2ea8e2f2c3ef27c5d4030e1b343fb92)
18
+ Thanks [@michtntbrighte](https://github.com/michtntbrighte)! - Fix button
19
+ loading and disabled state
20
+
3
21
  ## 1.5.1
4
22
 
5
23
  ### Patch Changes
@@ -397,8 +397,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
397
397
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 2),
398
398
  boxProps = _useButtonStyles2[0],
399
399
  buttonStyles = _useButtonStyles2[1];
400
- var isDisabled = disabled || loading;
401
- var isLoading = loading && !disabled;
402
400
  var variant = variants[prominence][tone];
403
401
  return /*#__PURE__*/jsxRuntime.jsxs(BaseButton, _objectSpread(_objectSpread({}, boxProps), {}, {
404
402
  "aria-controls": ariaControls,
@@ -407,17 +405,17 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
407
405
  "aria-label": props.label,
408
406
  className: css.css(buttonStyles),
409
407
  data: data,
410
- disabled: isDisabled,
408
+ disabled: loading || disabled,
411
409
  id: id,
412
410
  onClick: onClick,
413
411
  ref: forwardedRef,
414
412
  type: type,
415
413
  children: [resolveButtonChildren(_objectSpread(_objectSpread({}, props), {}, {
416
- isLoading: isLoading,
414
+ isLoading: loading,
417
415
  prominence: prominence,
418
416
  size: size,
419
417
  tone: tone
420
- })), isLoading && /*#__PURE__*/jsxRuntime.jsx(Loading, {
418
+ })), loading && /*#__PURE__*/jsxRuntime.jsx(Loading, {
421
419
  tone: variant === null || variant === void 0 ? void 0 : variant.textTone
422
420
  })]
423
421
  }));
@@ -444,11 +442,12 @@ function Loading(_ref2) {
444
442
  });
445
443
  }
446
444
 
447
- var _excluded = ["data", "href", "id", "prominence", "size", "tone"];
445
+ var _excluded = ["data", "href", "target", "id", "prominence", "size", "tone"];
448
446
  /** The appearance of a `Button`, with the semantics of a link. */
449
447
  var ButtonLink = ts.forwardRefWithAs(function (_ref, forwardedRef) {
450
448
  var data = _ref.data,
451
449
  href = _ref.href,
450
+ target = _ref.target,
452
451
  id = _ref.id,
453
452
  _ref$prominence = _ref.prominence,
454
453
  prominence = _ref$prominence === void 0 ? 'high' : _ref$prominence,
@@ -476,6 +475,7 @@ var ButtonLink = ts.forwardRefWithAs(function (_ref, forwardedRef) {
476
475
  data: data,
477
476
  href: href,
478
477
  id: id,
478
+ target: target,
479
479
  ref: forwardedRef,
480
480
  children: resolveButtonChildren(_objectSpread(_objectSpread({}, consumerProps), {}, {
481
481
  isLoading: false,
@@ -397,8 +397,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
397
397
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 2),
398
398
  boxProps = _useButtonStyles2[0],
399
399
  buttonStyles = _useButtonStyles2[1];
400
- var isDisabled = disabled || loading;
401
- var isLoading = loading && !disabled;
402
400
  var variant = variants[prominence][tone];
403
401
  return /*#__PURE__*/jsxRuntime.jsxs(BaseButton, _objectSpread(_objectSpread({}, boxProps), {}, {
404
402
  "aria-controls": ariaControls,
@@ -407,17 +405,17 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
407
405
  "aria-label": props.label,
408
406
  className: css.css(buttonStyles),
409
407
  data: data,
410
- disabled: isDisabled,
408
+ disabled: loading || disabled,
411
409
  id: id,
412
410
  onClick: onClick,
413
411
  ref: forwardedRef,
414
412
  type: type,
415
413
  children: [resolveButtonChildren(_objectSpread(_objectSpread({}, props), {}, {
416
- isLoading: isLoading,
414
+ isLoading: loading,
417
415
  prominence: prominence,
418
416
  size: size,
419
417
  tone: tone
420
- })), isLoading && /*#__PURE__*/jsxRuntime.jsx(Loading, {
418
+ })), loading && /*#__PURE__*/jsxRuntime.jsx(Loading, {
421
419
  tone: variant === null || variant === void 0 ? void 0 : variant.textTone
422
420
  })]
423
421
  }));
@@ -444,11 +442,12 @@ function Loading(_ref2) {
444
442
  });
445
443
  }
446
444
 
447
- var _excluded = ["data", "href", "id", "prominence", "size", "tone"];
445
+ var _excluded = ["data", "href", "target", "id", "prominence", "size", "tone"];
448
446
  /** The appearance of a `Button`, with the semantics of a link. */
449
447
  var ButtonLink = ts.forwardRefWithAs(function (_ref, forwardedRef) {
450
448
  var data = _ref.data,
451
449
  href = _ref.href,
450
+ target = _ref.target,
452
451
  id = _ref.id,
453
452
  _ref$prominence = _ref.prominence,
454
453
  prominence = _ref$prominence === void 0 ? 'high' : _ref$prominence,
@@ -476,6 +475,7 @@ var ButtonLink = ts.forwardRefWithAs(function (_ref, forwardedRef) {
476
475
  data: data,
477
476
  href: href,
478
477
  id: id,
478
+ target: target,
479
479
  ref: forwardedRef,
480
480
  children: resolveButtonChildren(_objectSpread(_objectSpread({}, consumerProps), {}, {
481
481
  isLoading: false,
@@ -393,8 +393,6 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
393
393
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 2),
394
394
  boxProps = _useButtonStyles2[0],
395
395
  buttonStyles = _useButtonStyles2[1];
396
- var isDisabled = disabled || loading;
397
- var isLoading = loading && !disabled;
398
396
  var variant = variants[prominence][tone];
399
397
  return /*#__PURE__*/jsxs(BaseButton, _objectSpread(_objectSpread({}, boxProps), {}, {
400
398
  "aria-controls": ariaControls,
@@ -403,17 +401,17 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
403
401
  "aria-label": props.label,
404
402
  className: css(buttonStyles),
405
403
  data: data,
406
- disabled: isDisabled,
404
+ disabled: loading || disabled,
407
405
  id: id,
408
406
  onClick: onClick,
409
407
  ref: forwardedRef,
410
408
  type: type,
411
409
  children: [resolveButtonChildren(_objectSpread(_objectSpread({}, props), {}, {
412
- isLoading: isLoading,
410
+ isLoading: loading,
413
411
  prominence: prominence,
414
412
  size: size,
415
413
  tone: tone
416
- })), isLoading && /*#__PURE__*/jsx(Loading, {
414
+ })), loading && /*#__PURE__*/jsx(Loading, {
417
415
  tone: variant === null || variant === void 0 ? void 0 : variant.textTone
418
416
  })]
419
417
  }));
@@ -440,11 +438,12 @@ function Loading(_ref2) {
440
438
  });
441
439
  }
442
440
 
443
- var _excluded = ["data", "href", "id", "prominence", "size", "tone"];
441
+ var _excluded = ["data", "href", "target", "id", "prominence", "size", "tone"];
444
442
  /** The appearance of a `Button`, with the semantics of a link. */
445
443
  var ButtonLink = forwardRefWithAs(function (_ref, forwardedRef) {
446
444
  var data = _ref.data,
447
445
  href = _ref.href,
446
+ target = _ref.target,
448
447
  id = _ref.id,
449
448
  _ref$prominence = _ref.prominence,
450
449
  prominence = _ref$prominence === void 0 ? 'high' : _ref$prominence,
@@ -472,6 +471,7 @@ var ButtonLink = forwardRefWithAs(function (_ref, forwardedRef) {
472
471
  data: data,
473
472
  href: href,
474
473
  id: id,
474
+ target: target,
475
475
  ref: forwardedRef,
476
476
  children: resolveButtonChildren(_objectSpread(_objectSpread({}, consumerProps), {}, {
477
477
  isLoading: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-web/button",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "homepage": "https://github.com/brighte-labs/spark-web#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "README.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@babel/runtime": "^7.19.0",
18
+ "@babel/runtime": "^7.25.0",
19
19
  "@emotion/css": "^11.11.2",
20
20
  "@spark-web/a11y": "^1.4.0",
21
21
  "@spark-web/box": "^1.2.0",