@spark-web/button 5.4.0 → 5.6.0-rc.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 +34 -1
- package/dist/declarations/src/button-link.d.ts +1 -1
- package/dist/declarations/src/button.d.ts +0 -2
- package/dist/declarations/src/types.d.ts +0 -2
- package/dist/declarations/src/use-button-styles.d.ts +3 -3
- package/dist/declarations/src/utils.d.ts +0 -1
- package/dist/spark-web-button.cjs.dev.js +12 -16
- package/dist/spark-web-button.cjs.prod.js +12 -16
- package/dist/spark-web-button.esm.js +12 -16
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @spark-web/button
|
|
2
2
|
|
|
3
|
+
## 5.6.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- update react version and other packages
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @spark-web/spinner@5.1.0-rc.0
|
|
13
|
+
- @spark-web/theme@5.12.0-rc.0
|
|
14
|
+
- @spark-web/utils@5.1.0-rc.0
|
|
15
|
+
- @spark-web/a11y@5.3.0-rc.0
|
|
16
|
+
- @spark-web/icon@5.1.0-rc.0
|
|
17
|
+
- @spark-web/link@5.1.0-rc.0
|
|
18
|
+
- @spark-web/text@5.3.0-rc.0
|
|
19
|
+
- @spark-web/box@6.0.0-rc.0
|
|
20
|
+
|
|
21
|
+
## 5.5.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [#659](https://github.com/brighte-labs/spark-web/pull/659)
|
|
26
|
+
[`6b8615a`](https://github.com/brighte-labs/spark-web/commit/6b8615a0e63d51a6757fd569bf21798a3bceaeea)
|
|
27
|
+
Thanks [@mkt-brighte](https://github.com/mkt-brighte)! - Added dark tone for
|
|
28
|
+
button component and add dark tokens
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
[[`6b8615a`](https://github.com/brighte-labs/spark-web/commit/6b8615a0e63d51a6757fd569bf21798a3bceaeea)]:
|
|
34
|
+
- @spark-web/a11y@5.2.0
|
|
35
|
+
- @spark-web/theme@5.11.1
|
|
36
|
+
|
|
3
37
|
## 5.4.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -70,7 +104,6 @@
|
|
|
70
104
|
### Minor Changes
|
|
71
105
|
|
|
72
106
|
- This release covers the following changes:
|
|
73
|
-
|
|
74
107
|
- Updates the primary color palette of the Brighte theme
|
|
75
108
|
- Add new Storybook story for the `rounded` prop for button components
|
|
76
109
|
- Tweak focus state styling of buttons at Pantheon theme
|
|
@@ -5,5 +5,5 @@ export declare type ButtonLinkProps = LinkComponentProps & CommonButtonProps;
|
|
|
5
5
|
/** The appearance of a `Button`, with the semantics of a link. */
|
|
6
6
|
export declare const ButtonLink: <Comp extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "a">(props: {
|
|
7
7
|
as?: Comp | undefined;
|
|
8
|
-
ref?: import("react").Ref<Comp extends "symbol" | "text" | "
|
|
8
|
+
ref?: import("react").Ref<Comp extends "symbol" | "text" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "text" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
|
|
9
9
|
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & ButtonLinkProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -22,8 +22,6 @@ export declare type ButtonProps = CommonButtonProps & {
|
|
|
22
22
|
size?: CommonButtonProps['size'];
|
|
23
23
|
/** Provide an alternate type if the button is within a form. */
|
|
24
24
|
type?: 'button' | 'submit' | 'reset';
|
|
25
|
-
/** When true, the button will be filled depending on the variant. */
|
|
26
|
-
filled?: boolean;
|
|
27
25
|
};
|
|
28
26
|
/**
|
|
29
27
|
* Buttons are used to initialize an action, their label should express what
|
|
@@ -7,7 +7,7 @@ import type { ButtonStyleProps } from "./types.js";
|
|
|
7
7
|
* underlying `Box` component, and the second item is a CSS object that can be
|
|
8
8
|
* passed to Emotion's `css` function.
|
|
9
9
|
*/
|
|
10
|
-
export declare function useButtonStyles({ iconOnly, prominence, rounded, size, tone,
|
|
10
|
+
export declare function useButtonStyles({ iconOnly, prominence, rounded, size, tone, }: UseButtonStylesProps): readonly [{
|
|
11
11
|
readonly alignItems: "center";
|
|
12
12
|
readonly background: string | number | undefined;
|
|
13
13
|
readonly border: import("@spark-web/theme").ResponsiveProp<string> | undefined;
|
|
@@ -93,9 +93,9 @@ export declare function useButtonStyles({ iconOnly, prominence, rounded, size, t
|
|
|
93
93
|
readonly transitionTimingFunction: string;
|
|
94
94
|
readonly transitionDuration: string;
|
|
95
95
|
}, {
|
|
96
|
-
readonly fontWeight: "medium" | "light" | "bold" | "thin" | "
|
|
96
|
+
readonly fontWeight: "medium" | "light" | "bold" | "thin" | "black" | "extralight" | "regular" | "semibold" | "extrabold" | undefined;
|
|
97
97
|
}];
|
|
98
|
-
export declare type UseButtonStylesProps = Omit<Required<ButtonStyleProps>, 'css' | 'rounded'
|
|
98
|
+
export declare type UseButtonStylesProps = Omit<Required<ButtonStyleProps>, 'css' | 'rounded'> & Partial<Pick<ButtonStyleProps, 'rounded'>> & {
|
|
99
99
|
/** Whether the children of the button is a single icon or not. */
|
|
100
100
|
iconOnly: boolean;
|
|
101
101
|
};
|
|
@@ -4,7 +4,6 @@ import type { SparkTheme } from '@spark-web/theme';
|
|
|
4
4
|
import type { ButtonProminence, ButtonTone } from "./types.js";
|
|
5
5
|
declare type BaseButtonStyles = {
|
|
6
6
|
background: BoxProps['background'];
|
|
7
|
-
backgroundFill?: BoxProps['background'];
|
|
8
7
|
border?: BoxProps['border'];
|
|
9
8
|
borderWidth?: BoxProps['borderWidth'];
|
|
10
9
|
textTone?: ForegroundTone;
|
|
@@ -10,9 +10,9 @@ var react = require('react');
|
|
|
10
10
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
11
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
12
12
|
var react$1 = require('@emotion/react');
|
|
13
|
+
var a11y = require('@spark-web/a11y');
|
|
13
14
|
var spinner = require('@spark-web/spinner');
|
|
14
15
|
var text = require('@spark-web/text');
|
|
15
|
-
var a11y = require('@spark-web/a11y');
|
|
16
16
|
var theme = require('@spark-web/theme');
|
|
17
17
|
var link = require('@spark-web/link');
|
|
18
18
|
var ts = require('@spark-web/utils/ts');
|
|
@@ -127,10 +127,9 @@ var variants = {
|
|
|
127
127
|
low: {
|
|
128
128
|
primary: _objectSpread({
|
|
129
129
|
background: 'surface',
|
|
130
|
-
backgroundFill: 'primarySoft',
|
|
131
130
|
border: 'primary',
|
|
132
131
|
borderWidth: 'large',
|
|
133
|
-
textTone: '
|
|
132
|
+
textTone: 'primary',
|
|
134
133
|
backgroundHover: 'none',
|
|
135
134
|
borderHover: 'primaryHover',
|
|
136
135
|
textToneHover: 'primaryHover',
|
|
@@ -318,15 +317,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
318
317
|
* passed to Emotion's `css` function.
|
|
319
318
|
*/
|
|
320
319
|
function useButtonStyles(_ref) {
|
|
321
|
-
var
|
|
320
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
322
321
|
var iconOnly = _ref.iconOnly,
|
|
323
322
|
prominence = _ref.prominence,
|
|
324
323
|
_ref$rounded = _ref.rounded,
|
|
325
324
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
326
325
|
size = _ref.size,
|
|
327
|
-
tone = _ref.tone
|
|
328
|
-
_ref$filled = _ref.filled,
|
|
329
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
326
|
+
tone = _ref.tone;
|
|
330
327
|
var theme$1 = theme.useTheme();
|
|
331
328
|
var focusRingStyles = a11y.useFocusRing({
|
|
332
329
|
tone: tone,
|
|
@@ -344,7 +341,7 @@ function useButtonStyles(_ref) {
|
|
|
344
341
|
};
|
|
345
342
|
return [{
|
|
346
343
|
alignItems: 'center',
|
|
347
|
-
background:
|
|
344
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
348
345
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
349
346
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
350
347
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -397,7 +394,7 @@ function useButtonStyles(_ref) {
|
|
|
397
394
|
}];
|
|
398
395
|
}
|
|
399
396
|
|
|
400
|
-
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"
|
|
397
|
+
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
|
|
401
398
|
/**
|
|
402
399
|
* Buttons are used to initialize an action, their label should express what
|
|
403
400
|
* action will occur when the user interacts with it.
|
|
@@ -423,8 +420,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
423
420
|
_ref$tone = _ref.tone,
|
|
424
421
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
425
422
|
type = _ref.type,
|
|
426
|
-
_ref$filled = _ref.filled,
|
|
427
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
428
423
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
429
424
|
var iconOnly = Boolean(props.label);
|
|
430
425
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -432,8 +427,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
432
427
|
rounded: rounded,
|
|
433
428
|
size: size,
|
|
434
429
|
tone: tone,
|
|
435
|
-
prominence: prominence
|
|
436
|
-
filled: filled
|
|
430
|
+
prominence: prominence
|
|
437
431
|
}),
|
|
438
432
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
439
433
|
boxProps = _useButtonStyles2[0],
|
|
@@ -466,7 +460,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
466
460
|
Button.displayName = 'Button';
|
|
467
461
|
function Loading(_ref2) {
|
|
468
462
|
var tone = _ref2.tone;
|
|
469
|
-
return jsxRuntime.
|
|
463
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
470
464
|
as: "span",
|
|
471
465
|
position: "absolute",
|
|
472
466
|
top: 0,
|
|
@@ -476,10 +470,12 @@ function Loading(_ref2) {
|
|
|
476
470
|
display: "flex",
|
|
477
471
|
alignItems: "center",
|
|
478
472
|
justifyContent: "center",
|
|
479
|
-
children: jsxRuntime.jsx(
|
|
473
|
+
children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
|
|
474
|
+
children: "button loading indicator"
|
|
475
|
+
}), jsxRuntime.jsx(spinner.Spinner, {
|
|
480
476
|
size: "xsmall",
|
|
481
477
|
tone: tone
|
|
482
|
-
})
|
|
478
|
+
})]
|
|
483
479
|
});
|
|
484
480
|
}
|
|
485
481
|
|
|
@@ -10,9 +10,9 @@ var react = require('react');
|
|
|
10
10
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
11
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
12
12
|
var react$1 = require('@emotion/react');
|
|
13
|
+
var a11y = require('@spark-web/a11y');
|
|
13
14
|
var spinner = require('@spark-web/spinner');
|
|
14
15
|
var text = require('@spark-web/text');
|
|
15
|
-
var a11y = require('@spark-web/a11y');
|
|
16
16
|
var theme = require('@spark-web/theme');
|
|
17
17
|
var link = require('@spark-web/link');
|
|
18
18
|
var ts = require('@spark-web/utils/ts');
|
|
@@ -127,10 +127,9 @@ var variants = {
|
|
|
127
127
|
low: {
|
|
128
128
|
primary: _objectSpread({
|
|
129
129
|
background: 'surface',
|
|
130
|
-
backgroundFill: 'primarySoft',
|
|
131
130
|
border: 'primary',
|
|
132
131
|
borderWidth: 'large',
|
|
133
|
-
textTone: '
|
|
132
|
+
textTone: 'primary',
|
|
134
133
|
backgroundHover: 'none',
|
|
135
134
|
borderHover: 'primaryHover',
|
|
136
135
|
textToneHover: 'primaryHover',
|
|
@@ -318,15 +317,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
318
317
|
* passed to Emotion's `css` function.
|
|
319
318
|
*/
|
|
320
319
|
function useButtonStyles(_ref) {
|
|
321
|
-
var
|
|
320
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
322
321
|
var iconOnly = _ref.iconOnly,
|
|
323
322
|
prominence = _ref.prominence,
|
|
324
323
|
_ref$rounded = _ref.rounded,
|
|
325
324
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
326
325
|
size = _ref.size,
|
|
327
|
-
tone = _ref.tone
|
|
328
|
-
_ref$filled = _ref.filled,
|
|
329
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
326
|
+
tone = _ref.tone;
|
|
330
327
|
var theme$1 = theme.useTheme();
|
|
331
328
|
var focusRingStyles = a11y.useFocusRing({
|
|
332
329
|
tone: tone,
|
|
@@ -344,7 +341,7 @@ function useButtonStyles(_ref) {
|
|
|
344
341
|
};
|
|
345
342
|
return [{
|
|
346
343
|
alignItems: 'center',
|
|
347
|
-
background:
|
|
344
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
348
345
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
349
346
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
350
347
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -397,7 +394,7 @@ function useButtonStyles(_ref) {
|
|
|
397
394
|
}];
|
|
398
395
|
}
|
|
399
396
|
|
|
400
|
-
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"
|
|
397
|
+
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
|
|
401
398
|
/**
|
|
402
399
|
* Buttons are used to initialize an action, their label should express what
|
|
403
400
|
* action will occur when the user interacts with it.
|
|
@@ -423,8 +420,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
423
420
|
_ref$tone = _ref.tone,
|
|
424
421
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
425
422
|
type = _ref.type,
|
|
426
|
-
_ref$filled = _ref.filled,
|
|
427
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
428
423
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
429
424
|
var iconOnly = Boolean(props.label);
|
|
430
425
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -432,8 +427,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
432
427
|
rounded: rounded,
|
|
433
428
|
size: size,
|
|
434
429
|
tone: tone,
|
|
435
|
-
prominence: prominence
|
|
436
|
-
filled: filled
|
|
430
|
+
prominence: prominence
|
|
437
431
|
}),
|
|
438
432
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
439
433
|
boxProps = _useButtonStyles2[0],
|
|
@@ -466,7 +460,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
466
460
|
Button.displayName = 'Button';
|
|
467
461
|
function Loading(_ref2) {
|
|
468
462
|
var tone = _ref2.tone;
|
|
469
|
-
return jsxRuntime.
|
|
463
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
470
464
|
as: "span",
|
|
471
465
|
position: "absolute",
|
|
472
466
|
top: 0,
|
|
@@ -476,10 +470,12 @@ function Loading(_ref2) {
|
|
|
476
470
|
display: "flex",
|
|
477
471
|
alignItems: "center",
|
|
478
472
|
justifyContent: "center",
|
|
479
|
-
children: jsxRuntime.jsx(
|
|
473
|
+
children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
|
|
474
|
+
children: "button loading indicator"
|
|
475
|
+
}), jsxRuntime.jsx(spinner.Spinner, {
|
|
480
476
|
size: "xsmall",
|
|
481
477
|
tone: tone
|
|
482
|
-
})
|
|
478
|
+
})]
|
|
483
479
|
});
|
|
484
480
|
}
|
|
485
481
|
|
|
@@ -6,9 +6,9 @@ import { forwardRef, useRef, useCallback, Children, isValidElement, cloneElement
|
|
|
6
6
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
7
7
|
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
8
8
|
import { css } from '@emotion/react';
|
|
9
|
+
import { useFocusRing, VisuallyHidden } from '@spark-web/a11y';
|
|
9
10
|
import { Spinner } from '@spark-web/spinner';
|
|
10
11
|
import { Text } from '@spark-web/text';
|
|
11
|
-
import { useFocusRing } from '@spark-web/a11y';
|
|
12
12
|
import { useTheme } from '@spark-web/theme';
|
|
13
13
|
import { useLinkComponent } from '@spark-web/link';
|
|
14
14
|
import { forwardRefWithAs } from '@spark-web/utils/ts';
|
|
@@ -123,10 +123,9 @@ var variants = {
|
|
|
123
123
|
low: {
|
|
124
124
|
primary: _objectSpread({
|
|
125
125
|
background: 'surface',
|
|
126
|
-
backgroundFill: 'primarySoft',
|
|
127
126
|
border: 'primary',
|
|
128
127
|
borderWidth: 'large',
|
|
129
|
-
textTone: '
|
|
128
|
+
textTone: 'primary',
|
|
130
129
|
backgroundHover: 'none',
|
|
131
130
|
borderHover: 'primaryHover',
|
|
132
131
|
textToneHover: 'primaryHover',
|
|
@@ -314,15 +313,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
314
313
|
* passed to Emotion's `css` function.
|
|
315
314
|
*/
|
|
316
315
|
function useButtonStyles(_ref) {
|
|
317
|
-
var
|
|
316
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
318
317
|
var iconOnly = _ref.iconOnly,
|
|
319
318
|
prominence = _ref.prominence,
|
|
320
319
|
_ref$rounded = _ref.rounded,
|
|
321
320
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
322
321
|
size = _ref.size,
|
|
323
|
-
tone = _ref.tone
|
|
324
|
-
_ref$filled = _ref.filled,
|
|
325
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
322
|
+
tone = _ref.tone;
|
|
326
323
|
var theme = useTheme();
|
|
327
324
|
var focusRingStyles = useFocusRing({
|
|
328
325
|
tone: tone,
|
|
@@ -340,7 +337,7 @@ function useButtonStyles(_ref) {
|
|
|
340
337
|
};
|
|
341
338
|
return [{
|
|
342
339
|
alignItems: 'center',
|
|
343
|
-
background:
|
|
340
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
344
341
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
345
342
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
346
343
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -393,7 +390,7 @@ function useButtonStyles(_ref) {
|
|
|
393
390
|
}];
|
|
394
391
|
}
|
|
395
392
|
|
|
396
|
-
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"
|
|
393
|
+
var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
|
|
397
394
|
/**
|
|
398
395
|
* Buttons are used to initialize an action, their label should express what
|
|
399
396
|
* action will occur when the user interacts with it.
|
|
@@ -419,8 +416,6 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
419
416
|
_ref$tone = _ref.tone,
|
|
420
417
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
421
418
|
type = _ref.type,
|
|
422
|
-
_ref$filled = _ref.filled,
|
|
423
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
424
419
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
425
420
|
var iconOnly = Boolean(props.label);
|
|
426
421
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -428,8 +423,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
428
423
|
rounded: rounded,
|
|
429
424
|
size: size,
|
|
430
425
|
tone: tone,
|
|
431
|
-
prominence: prominence
|
|
432
|
-
filled: filled
|
|
426
|
+
prominence: prominence
|
|
433
427
|
}),
|
|
434
428
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
435
429
|
boxProps = _useButtonStyles2[0],
|
|
@@ -462,7 +456,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
462
456
|
Button.displayName = 'Button';
|
|
463
457
|
function Loading(_ref2) {
|
|
464
458
|
var tone = _ref2.tone;
|
|
465
|
-
return
|
|
459
|
+
return jsxs(Box, {
|
|
466
460
|
as: "span",
|
|
467
461
|
position: "absolute",
|
|
468
462
|
top: 0,
|
|
@@ -472,10 +466,12 @@ function Loading(_ref2) {
|
|
|
472
466
|
display: "flex",
|
|
473
467
|
alignItems: "center",
|
|
474
468
|
justifyContent: "center",
|
|
475
|
-
children: jsx(
|
|
469
|
+
children: [jsx(VisuallyHidden, {
|
|
470
|
+
children: "button loading indicator"
|
|
471
|
+
}), jsx(Spinner, {
|
|
476
472
|
size: "xsmall",
|
|
477
473
|
tone: tone
|
|
478
|
-
})
|
|
474
|
+
})]
|
|
479
475
|
});
|
|
480
476
|
}
|
|
481
477
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/button",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0-rc.0",
|
|
4
4
|
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.25.0",
|
|
19
19
|
"@emotion/react": "^11.14.0",
|
|
20
|
-
"@spark-web/a11y": "^5.
|
|
21
|
-
"@spark-web/box": "^
|
|
22
|
-
"@spark-web/icon": "^5.0.0",
|
|
23
|
-
"@spark-web/link": "^5.0.0",
|
|
24
|
-
"@spark-web/spinner": "^5.0.
|
|
25
|
-
"@spark-web/text": "^5.
|
|
26
|
-
"@spark-web/theme": "^5.
|
|
27
|
-
"@spark-web/utils": "^5.0.0"
|
|
20
|
+
"@spark-web/a11y": "^5.3.0-rc.0",
|
|
21
|
+
"@spark-web/box": "^6.0.0-rc.0",
|
|
22
|
+
"@spark-web/icon": "^5.1.0-rc.0",
|
|
23
|
+
"@spark-web/link": "^5.1.0-rc.0",
|
|
24
|
+
"@spark-web/spinner": "^5.1.0-rc.0",
|
|
25
|
+
"@spark-web/text": "^5.3.0-rc.0",
|
|
26
|
+
"@spark-web/theme": "^5.12.0-rc.0",
|
|
27
|
+
"@spark-web/utils": "^5.1.0-rc.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/react": "^
|
|
31
|
-
"react": "^
|
|
30
|
+
"@types/react": "^19.1.0",
|
|
31
|
+
"react": "^19.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"react": ">=
|
|
34
|
+
"react": ">=19.1.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=14"
|