@spark-web/button 5.5.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 +18 -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 -37
- package/dist/spark-web-button.cjs.prod.js +12 -37
- package/dist/spark-web-button.esm.js +12 -37
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
3
21
|
## 5.5.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -86,7 +104,6 @@
|
|
|
86
104
|
### Minor Changes
|
|
87
105
|
|
|
88
106
|
- This release covers the following changes:
|
|
89
|
-
|
|
90
107
|
- Updates the primary color palette of the Brighte theme
|
|
91
108
|
- Add new Storybook story for the `rounded` prop for button components
|
|
92
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" | "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" | "
|
|
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: "
|
|
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');
|
|
@@ -122,20 +122,14 @@ var variants = {
|
|
|
122
122
|
background: 'primaryDark',
|
|
123
123
|
backgroundHover: 'primaryHover',
|
|
124
124
|
backgroundActive: 'primaryActive'
|
|
125
|
-
}, highDisabledStyles),
|
|
126
|
-
dark: _objectSpread({
|
|
127
|
-
background: 'dark',
|
|
128
|
-
backgroundHover: 'darkHover',
|
|
129
|
-
backgroundActive: 'darkActive'
|
|
130
125
|
}, highDisabledStyles)
|
|
131
126
|
},
|
|
132
127
|
low: {
|
|
133
128
|
primary: _objectSpread({
|
|
134
129
|
background: 'surface',
|
|
135
|
-
backgroundFill: 'primarySoft',
|
|
136
130
|
border: 'primary',
|
|
137
131
|
borderWidth: 'large',
|
|
138
|
-
textTone: '
|
|
132
|
+
textTone: 'primary',
|
|
139
133
|
backgroundHover: 'none',
|
|
140
134
|
borderHover: 'primaryHover',
|
|
141
135
|
textToneHover: 'primaryHover',
|
|
@@ -191,16 +185,6 @@ var variants = {
|
|
|
191
185
|
backgroundActive: 'none',
|
|
192
186
|
borderActive: 'primaryActive',
|
|
193
187
|
textToneActive: 'primaryActive'
|
|
194
|
-
}, lowDisabledAltStyles),
|
|
195
|
-
dark: _objectSpread({
|
|
196
|
-
background: 'surface',
|
|
197
|
-
backgroundHover: 'none',
|
|
198
|
-
backgroundActive: 'none',
|
|
199
|
-
textTone: 'dark',
|
|
200
|
-
borderWidth: 'large',
|
|
201
|
-
border: 'dark',
|
|
202
|
-
borderHover: 'darkHover',
|
|
203
|
-
borderActive: 'darkActive'
|
|
204
188
|
}, lowDisabledAltStyles)
|
|
205
189
|
},
|
|
206
190
|
none: {
|
|
@@ -251,12 +235,6 @@ var variants = {
|
|
|
251
235
|
textTone: 'primaryActive',
|
|
252
236
|
backgroundHover: 'primaryLowHover',
|
|
253
237
|
backgroundActive: 'primaryLowActive'
|
|
254
|
-
}, noneDisabledStyles),
|
|
255
|
-
dark: _objectSpread({
|
|
256
|
-
background: 'surface',
|
|
257
|
-
textTone: 'dark',
|
|
258
|
-
backgroundHover: 'darkLowHover',
|
|
259
|
-
backgroundActive: 'darkLowActive'
|
|
260
238
|
}, noneDisabledStyles)
|
|
261
239
|
}
|
|
262
240
|
};
|
|
@@ -339,15 +317,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
339
317
|
* passed to Emotion's `css` function.
|
|
340
318
|
*/
|
|
341
319
|
function useButtonStyles(_ref) {
|
|
342
|
-
var
|
|
320
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
343
321
|
var iconOnly = _ref.iconOnly,
|
|
344
322
|
prominence = _ref.prominence,
|
|
345
323
|
_ref$rounded = _ref.rounded,
|
|
346
324
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
347
325
|
size = _ref.size,
|
|
348
|
-
tone = _ref.tone
|
|
349
|
-
_ref$filled = _ref.filled,
|
|
350
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
326
|
+
tone = _ref.tone;
|
|
351
327
|
var theme$1 = theme.useTheme();
|
|
352
328
|
var focusRingStyles = a11y.useFocusRing({
|
|
353
329
|
tone: tone,
|
|
@@ -365,7 +341,7 @@ function useButtonStyles(_ref) {
|
|
|
365
341
|
};
|
|
366
342
|
return [{
|
|
367
343
|
alignItems: 'center',
|
|
368
|
-
background:
|
|
344
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
369
345
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
370
346
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
371
347
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -418,7 +394,7 @@ function useButtonStyles(_ref) {
|
|
|
418
394
|
}];
|
|
419
395
|
}
|
|
420
396
|
|
|
421
|
-
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"];
|
|
422
398
|
/**
|
|
423
399
|
* Buttons are used to initialize an action, their label should express what
|
|
424
400
|
* action will occur when the user interacts with it.
|
|
@@ -444,8 +420,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
444
420
|
_ref$tone = _ref.tone,
|
|
445
421
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
446
422
|
type = _ref.type,
|
|
447
|
-
_ref$filled = _ref.filled,
|
|
448
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
449
423
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
450
424
|
var iconOnly = Boolean(props.label);
|
|
451
425
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -453,8 +427,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
453
427
|
rounded: rounded,
|
|
454
428
|
size: size,
|
|
455
429
|
tone: tone,
|
|
456
|
-
prominence: prominence
|
|
457
|
-
filled: filled
|
|
430
|
+
prominence: prominence
|
|
458
431
|
}),
|
|
459
432
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
460
433
|
boxProps = _useButtonStyles2[0],
|
|
@@ -487,7 +460,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
487
460
|
Button.displayName = 'Button';
|
|
488
461
|
function Loading(_ref2) {
|
|
489
462
|
var tone = _ref2.tone;
|
|
490
|
-
return jsxRuntime.
|
|
463
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
491
464
|
as: "span",
|
|
492
465
|
position: "absolute",
|
|
493
466
|
top: 0,
|
|
@@ -497,10 +470,12 @@ function Loading(_ref2) {
|
|
|
497
470
|
display: "flex",
|
|
498
471
|
alignItems: "center",
|
|
499
472
|
justifyContent: "center",
|
|
500
|
-
children: jsxRuntime.jsx(
|
|
473
|
+
children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
|
|
474
|
+
children: "button loading indicator"
|
|
475
|
+
}), jsxRuntime.jsx(spinner.Spinner, {
|
|
501
476
|
size: "xsmall",
|
|
502
477
|
tone: tone
|
|
503
|
-
})
|
|
478
|
+
})]
|
|
504
479
|
});
|
|
505
480
|
}
|
|
506
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');
|
|
@@ -122,20 +122,14 @@ var variants = {
|
|
|
122
122
|
background: 'primaryDark',
|
|
123
123
|
backgroundHover: 'primaryHover',
|
|
124
124
|
backgroundActive: 'primaryActive'
|
|
125
|
-
}, highDisabledStyles),
|
|
126
|
-
dark: _objectSpread({
|
|
127
|
-
background: 'dark',
|
|
128
|
-
backgroundHover: 'darkHover',
|
|
129
|
-
backgroundActive: 'darkActive'
|
|
130
125
|
}, highDisabledStyles)
|
|
131
126
|
},
|
|
132
127
|
low: {
|
|
133
128
|
primary: _objectSpread({
|
|
134
129
|
background: 'surface',
|
|
135
|
-
backgroundFill: 'primarySoft',
|
|
136
130
|
border: 'primary',
|
|
137
131
|
borderWidth: 'large',
|
|
138
|
-
textTone: '
|
|
132
|
+
textTone: 'primary',
|
|
139
133
|
backgroundHover: 'none',
|
|
140
134
|
borderHover: 'primaryHover',
|
|
141
135
|
textToneHover: 'primaryHover',
|
|
@@ -191,16 +185,6 @@ var variants = {
|
|
|
191
185
|
backgroundActive: 'none',
|
|
192
186
|
borderActive: 'primaryActive',
|
|
193
187
|
textToneActive: 'primaryActive'
|
|
194
|
-
}, lowDisabledAltStyles),
|
|
195
|
-
dark: _objectSpread({
|
|
196
|
-
background: 'surface',
|
|
197
|
-
backgroundHover: 'none',
|
|
198
|
-
backgroundActive: 'none',
|
|
199
|
-
textTone: 'dark',
|
|
200
|
-
borderWidth: 'large',
|
|
201
|
-
border: 'dark',
|
|
202
|
-
borderHover: 'darkHover',
|
|
203
|
-
borderActive: 'darkActive'
|
|
204
188
|
}, lowDisabledAltStyles)
|
|
205
189
|
},
|
|
206
190
|
none: {
|
|
@@ -251,12 +235,6 @@ var variants = {
|
|
|
251
235
|
textTone: 'primaryActive',
|
|
252
236
|
backgroundHover: 'primaryLowHover',
|
|
253
237
|
backgroundActive: 'primaryLowActive'
|
|
254
|
-
}, noneDisabledStyles),
|
|
255
|
-
dark: _objectSpread({
|
|
256
|
-
background: 'surface',
|
|
257
|
-
textTone: 'dark',
|
|
258
|
-
backgroundHover: 'darkLowHover',
|
|
259
|
-
backgroundActive: 'darkLowActive'
|
|
260
238
|
}, noneDisabledStyles)
|
|
261
239
|
}
|
|
262
240
|
};
|
|
@@ -339,15 +317,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
339
317
|
* passed to Emotion's `css` function.
|
|
340
318
|
*/
|
|
341
319
|
function useButtonStyles(_ref) {
|
|
342
|
-
var
|
|
320
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
343
321
|
var iconOnly = _ref.iconOnly,
|
|
344
322
|
prominence = _ref.prominence,
|
|
345
323
|
_ref$rounded = _ref.rounded,
|
|
346
324
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
347
325
|
size = _ref.size,
|
|
348
|
-
tone = _ref.tone
|
|
349
|
-
_ref$filled = _ref.filled,
|
|
350
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
326
|
+
tone = _ref.tone;
|
|
351
327
|
var theme$1 = theme.useTheme();
|
|
352
328
|
var focusRingStyles = a11y.useFocusRing({
|
|
353
329
|
tone: tone,
|
|
@@ -365,7 +341,7 @@ function useButtonStyles(_ref) {
|
|
|
365
341
|
};
|
|
366
342
|
return [{
|
|
367
343
|
alignItems: 'center',
|
|
368
|
-
background:
|
|
344
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
369
345
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
370
346
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
371
347
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -418,7 +394,7 @@ function useButtonStyles(_ref) {
|
|
|
418
394
|
}];
|
|
419
395
|
}
|
|
420
396
|
|
|
421
|
-
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"];
|
|
422
398
|
/**
|
|
423
399
|
* Buttons are used to initialize an action, their label should express what
|
|
424
400
|
* action will occur when the user interacts with it.
|
|
@@ -444,8 +420,6 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
444
420
|
_ref$tone = _ref.tone,
|
|
445
421
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
446
422
|
type = _ref.type,
|
|
447
|
-
_ref$filled = _ref.filled,
|
|
448
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
449
423
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
450
424
|
var iconOnly = Boolean(props.label);
|
|
451
425
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -453,8 +427,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
453
427
|
rounded: rounded,
|
|
454
428
|
size: size,
|
|
455
429
|
tone: tone,
|
|
456
|
-
prominence: prominence
|
|
457
|
-
filled: filled
|
|
430
|
+
prominence: prominence
|
|
458
431
|
}),
|
|
459
432
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
460
433
|
boxProps = _useButtonStyles2[0],
|
|
@@ -487,7 +460,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
487
460
|
Button.displayName = 'Button';
|
|
488
461
|
function Loading(_ref2) {
|
|
489
462
|
var tone = _ref2.tone;
|
|
490
|
-
return jsxRuntime.
|
|
463
|
+
return jsxRuntime.jsxs(box.Box, {
|
|
491
464
|
as: "span",
|
|
492
465
|
position: "absolute",
|
|
493
466
|
top: 0,
|
|
@@ -497,10 +470,12 @@ function Loading(_ref2) {
|
|
|
497
470
|
display: "flex",
|
|
498
471
|
alignItems: "center",
|
|
499
472
|
justifyContent: "center",
|
|
500
|
-
children: jsxRuntime.jsx(
|
|
473
|
+
children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
|
|
474
|
+
children: "button loading indicator"
|
|
475
|
+
}), jsxRuntime.jsx(spinner.Spinner, {
|
|
501
476
|
size: "xsmall",
|
|
502
477
|
tone: tone
|
|
503
|
-
})
|
|
478
|
+
})]
|
|
504
479
|
});
|
|
505
480
|
}
|
|
506
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';
|
|
@@ -118,20 +118,14 @@ var variants = {
|
|
|
118
118
|
background: 'primaryDark',
|
|
119
119
|
backgroundHover: 'primaryHover',
|
|
120
120
|
backgroundActive: 'primaryActive'
|
|
121
|
-
}, highDisabledStyles),
|
|
122
|
-
dark: _objectSpread({
|
|
123
|
-
background: 'dark',
|
|
124
|
-
backgroundHover: 'darkHover',
|
|
125
|
-
backgroundActive: 'darkActive'
|
|
126
121
|
}, highDisabledStyles)
|
|
127
122
|
},
|
|
128
123
|
low: {
|
|
129
124
|
primary: _objectSpread({
|
|
130
125
|
background: 'surface',
|
|
131
|
-
backgroundFill: 'primarySoft',
|
|
132
126
|
border: 'primary',
|
|
133
127
|
borderWidth: 'large',
|
|
134
|
-
textTone: '
|
|
128
|
+
textTone: 'primary',
|
|
135
129
|
backgroundHover: 'none',
|
|
136
130
|
borderHover: 'primaryHover',
|
|
137
131
|
textToneHover: 'primaryHover',
|
|
@@ -187,16 +181,6 @@ var variants = {
|
|
|
187
181
|
backgroundActive: 'none',
|
|
188
182
|
borderActive: 'primaryActive',
|
|
189
183
|
textToneActive: 'primaryActive'
|
|
190
|
-
}, lowDisabledAltStyles),
|
|
191
|
-
dark: _objectSpread({
|
|
192
|
-
background: 'surface',
|
|
193
|
-
backgroundHover: 'none',
|
|
194
|
-
backgroundActive: 'none',
|
|
195
|
-
textTone: 'dark',
|
|
196
|
-
borderWidth: 'large',
|
|
197
|
-
border: 'dark',
|
|
198
|
-
borderHover: 'darkHover',
|
|
199
|
-
borderActive: 'darkActive'
|
|
200
184
|
}, lowDisabledAltStyles)
|
|
201
185
|
},
|
|
202
186
|
none: {
|
|
@@ -247,12 +231,6 @@ var variants = {
|
|
|
247
231
|
textTone: 'primaryActive',
|
|
248
232
|
backgroundHover: 'primaryLowHover',
|
|
249
233
|
backgroundActive: 'primaryLowActive'
|
|
250
|
-
}, noneDisabledStyles),
|
|
251
|
-
dark: _objectSpread({
|
|
252
|
-
background: 'surface',
|
|
253
|
-
textTone: 'dark',
|
|
254
|
-
backgroundHover: 'darkLowHover',
|
|
255
|
-
backgroundActive: 'darkLowActive'
|
|
256
234
|
}, noneDisabledStyles)
|
|
257
235
|
}
|
|
258
236
|
};
|
|
@@ -335,15 +313,13 @@ function HiddenWhenLoading(_ref2) {
|
|
|
335
313
|
* passed to Emotion's `css` function.
|
|
336
314
|
*/
|
|
337
315
|
function useButtonStyles(_ref) {
|
|
338
|
-
var
|
|
316
|
+
var _theme$components$but, _theme$components, _theme$components2;
|
|
339
317
|
var iconOnly = _ref.iconOnly,
|
|
340
318
|
prominence = _ref.prominence,
|
|
341
319
|
_ref$rounded = _ref.rounded,
|
|
342
320
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
343
321
|
size = _ref.size,
|
|
344
|
-
tone = _ref.tone
|
|
345
|
-
_ref$filled = _ref.filled,
|
|
346
|
-
filled = _ref$filled === void 0 ? false : _ref$filled;
|
|
322
|
+
tone = _ref.tone;
|
|
347
323
|
var theme = useTheme();
|
|
348
324
|
var focusRingStyles = useFocusRing({
|
|
349
325
|
tone: tone,
|
|
@@ -361,7 +337,7 @@ function useButtonStyles(_ref) {
|
|
|
361
337
|
};
|
|
362
338
|
return [{
|
|
363
339
|
alignItems: 'center',
|
|
364
|
-
background:
|
|
340
|
+
background: variant === null || variant === void 0 ? void 0 : variant.background,
|
|
365
341
|
border: variant === null || variant === void 0 ? void 0 : variant.border,
|
|
366
342
|
borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
|
|
367
343
|
borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
|
|
@@ -414,7 +390,7 @@ function useButtonStyles(_ref) {
|
|
|
414
390
|
}];
|
|
415
391
|
}
|
|
416
392
|
|
|
417
|
-
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"];
|
|
418
394
|
/**
|
|
419
395
|
* Buttons are used to initialize an action, their label should express what
|
|
420
396
|
* action will occur when the user interacts with it.
|
|
@@ -440,8 +416,6 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
440
416
|
_ref$tone = _ref.tone,
|
|
441
417
|
tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
|
|
442
418
|
type = _ref.type,
|
|
443
|
-
_ref$filled = _ref.filled,
|
|
444
|
-
filled = _ref$filled === void 0 ? false : _ref$filled,
|
|
445
419
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
446
420
|
var iconOnly = Boolean(props.label);
|
|
447
421
|
var _useButtonStyles = useButtonStyles({
|
|
@@ -449,8 +423,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
449
423
|
rounded: rounded,
|
|
450
424
|
size: size,
|
|
451
425
|
tone: tone,
|
|
452
|
-
prominence: prominence
|
|
453
|
-
filled: filled
|
|
426
|
+
prominence: prominence
|
|
454
427
|
}),
|
|
455
428
|
_useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
|
|
456
429
|
boxProps = _useButtonStyles2[0],
|
|
@@ -483,7 +456,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
483
456
|
Button.displayName = 'Button';
|
|
484
457
|
function Loading(_ref2) {
|
|
485
458
|
var tone = _ref2.tone;
|
|
486
|
-
return
|
|
459
|
+
return jsxs(Box, {
|
|
487
460
|
as: "span",
|
|
488
461
|
position: "absolute",
|
|
489
462
|
top: 0,
|
|
@@ -493,10 +466,12 @@ function Loading(_ref2) {
|
|
|
493
466
|
display: "flex",
|
|
494
467
|
alignItems: "center",
|
|
495
468
|
justifyContent: "center",
|
|
496
|
-
children: jsx(
|
|
469
|
+
children: [jsx(VisuallyHidden, {
|
|
470
|
+
children: "button loading indicator"
|
|
471
|
+
}), jsx(Spinner, {
|
|
497
472
|
size: "xsmall",
|
|
498
473
|
tone: tone
|
|
499
|
-
})
|
|
474
|
+
})]
|
|
500
475
|
});
|
|
501
476
|
}
|
|
502
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"
|