@spark-web/button 5.6.0-rc.0 → 5.6.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,22 +1,66 @@
1
1
  # @spark-web/button
2
2
 
3
- ## 5.6.0-rc.0
3
+ ## 5.6.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - update react version and other packages
7
+ - [#667](https://github.com/brighte-labs/spark-web/pull/667)
8
+ [`80d9c15`](https://github.com/brighte-labs/spark-web/commit/80d9c156a40bbcd2b1a91a2d0403b3c8e9b47b4e)
9
+ Thanks [@Leo704099](https://github.com/Leo704099)! - Support react 17 to 19
8
10
 
9
11
  ### Patch Changes
10
12
 
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
13
+ - Updated dependencies
14
+ [[`80d9c15`](https://github.com/brighte-labs/spark-web/commit/80d9c156a40bbcd2b1a91a2d0403b3c8e9b47b4e)]:
15
+ - @spark-web/spinner@5.1.0
16
+ - @spark-web/theme@5.13.0
17
+ - @spark-web/utils@5.1.0
18
+ - @spark-web/a11y@5.3.0
19
+ - @spark-web/icon@5.1.0
20
+ - @spark-web/link@5.1.0
21
+ - @spark-web/text@5.3.0
22
+ - @spark-web/box@6.0.0
23
+
24
+ ## 5.5.3
25
+
26
+ ### Patch Changes
27
+
28
+ - [#704](https://github.com/brighte-labs/spark-web/pull/704)
29
+ [`67ad8de`](https://github.com/brighte-labs/spark-web/commit/67ad8de8ce99bedb733293bbb23d554ae48a9f1f)
30
+ Thanks [@mkt-brighte](https://github.com/mkt-brighte)! - Support bravo theme
31
+ for button component
32
+
33
+ - Updated dependencies
34
+ [[`67ad8de`](https://github.com/brighte-labs/spark-web/commit/67ad8de8ce99bedb733293bbb23d554ae48a9f1f)]:
35
+ - @spark-web/theme@5.12.4
36
+
37
+ ## 5.5.2
38
+
39
+ ### Patch Changes
40
+
41
+ - [#698](https://github.com/brighte-labs/spark-web/pull/698)
42
+ [`814b373`](https://github.com/brighte-labs/spark-web/commit/814b373cbe9fcf0757738c78eef6b516624df62c)
43
+ Thanks [@michtntbrighte](https://github.com/michtntbrighte)! - Bump version
44
+
45
+ - Updated dependencies
46
+ [[`814b373`](https://github.com/brighte-labs/spark-web/commit/814b373cbe9fcf0757738c78eef6b516624df62c)]:
47
+ - @spark-web/box@5.2.2
48
+ - @spark-web/link@5.0.2
49
+ - @spark-web/text@5.2.3
50
+ - @spark-web/theme@5.12.1
51
+
52
+ ## 5.5.1
53
+
54
+ ### Patch Changes
55
+
56
+ - [#693](https://github.com/brighte-labs/spark-web/pull/693)
57
+ [`1995db7`](https://github.com/brighte-labs/spark-web/commit/1995db7f4342803732c7648ab3ca6d32442cc347)
58
+ Thanks [@michtntbrighte](https://github.com/michtntbrighte)! - Add Bravo theme
59
+
60
+ - Updated dependencies
61
+ [[`1995db7`](https://github.com/brighte-labs/spark-web/commit/1995db7f4342803732c7648ab3ca6d32442cc347)]:
62
+ - @spark-web/theme@5.12.0
63
+ - @spark-web/text@5.2.2
20
64
 
21
65
  ## 5.5.0
22
66
 
@@ -1,7 +1,7 @@
1
1
  import type { BoxProps } from '@spark-web/box';
2
2
  import type { MouseEvent as ReactMouseEvent } from 'react';
3
3
  import type { NativeButtonProps } from "./types.js";
4
- export declare type BaseButtonProps = NativeButtonProps & Partial<BoxProps>;
4
+ export type BaseButtonProps = NativeButtonProps & Partial<BoxProps>;
5
5
  export declare const BaseButton: import("react").ForwardRefExoticComponent<NativeButtonProps & Partial<BoxProps> & import("react").RefAttributes<HTMLButtonElement>>;
6
6
  /**
7
7
  * handle "disabled" behaviour w/o disabling buttons
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  import type { LinkComponentProps } from '@spark-web/link';
3
2
  import type { CommonButtonProps } from "./types.js";
4
- export declare type ButtonLinkProps = LinkComponentProps & CommonButtonProps;
3
+ export type ButtonLinkProps = LinkComponentProps & CommonButtonProps;
5
4
  /** The appearance of a `Button`, with the semantics of a link. */
6
- export declare const ButtonLink: <Comp extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "a">(props: {
5
+ export declare const ButtonLink: <Comp extends import("react").ElementType = "a">(props: {
7
6
  as?: Comp | undefined;
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
- } & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & ButtonLinkProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ 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" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "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" | "text" | "textPath" | "tspan" | "use" | "view">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined;
8
+ } & (Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & ButtonLinkProps)) => import("react").ReactElement;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import type { CommonButtonProps, NativeButtonProps } from "./types.js";
3
- export declare type ButtonProps = CommonButtonProps & {
2
+ export type ButtonProps = CommonButtonProps & {
4
3
  /**
5
4
  * Identifies the element (or elements) whose contents or presence
6
5
  * are controlled by the current element.
@@ -22,6 +21,8 @@ export declare type ButtonProps = CommonButtonProps & {
22
21
  size?: CommonButtonProps['size'];
23
22
  /** Provide an alternate type if the button is within a form. */
24
23
  type?: 'button' | 'submit' | 'reset';
24
+ /** When true, the button will be filled depending on the variant. */
25
+ filled?: boolean;
25
26
  };
26
27
  /**
27
28
  * Buttons are used to initialize an action, their label should express what
@@ -4,14 +4,14 @@ import type { IconProps } from '@spark-web/icon';
4
4
  import type { DataAttributeMap } from '@spark-web/utils/internal';
5
5
  import type { ButtonHTMLAttributes, ReactElement } from 'react';
6
6
  import type { mapTokens } from "./utils.js";
7
- export declare type ButtonSize = keyof (typeof mapTokens)[keyof typeof mapTokens];
8
- export declare type ButtonProminence = 'high' | 'low' | 'none';
9
- export declare type ButtonTone = Exclude<BackgroundTone, 'disabled'>;
10
- declare type ChildrenWithText = {
7
+ export type ButtonSize = keyof (typeof mapTokens)[keyof typeof mapTokens];
8
+ export type ButtonProminence = 'high' | 'low' | 'none';
9
+ export type ButtonTone = Exclude<BackgroundTone, 'disabled'>;
10
+ type ChildrenWithText = {
11
11
  label?: never;
12
12
  children: string | number | [ReactElement<IconProps>, string | number] | [string | number, ReactElement<IconProps>];
13
13
  };
14
- declare type IconOnly = {
14
+ type IconOnly = {
15
15
  /**
16
16
  * Implicit label for buttons only required for icon-only buttons
17
17
  * for accessibility reasons.
@@ -19,15 +19,15 @@ declare type IconOnly = {
19
19
  label: string;
20
20
  children: ReactElement<IconProps>;
21
21
  };
22
- export declare type ButtonChildrenProps = ChildrenWithText | IconOnly;
23
- export declare type NativeButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
24
- export declare type CommonButtonProps = {
22
+ export type ButtonChildrenProps = ChildrenWithText | IconOnly;
23
+ export type NativeButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
24
+ export type CommonButtonProps = {
25
25
  /** Sets data attributes for the element. */
26
26
  data?: DataAttributeMap;
27
27
  /** Unique identifier for the underlying element. */
28
28
  id?: string;
29
29
  } & ButtonStyleProps & ButtonChildrenProps;
30
- export declare type ButtonStyleProps = {
30
+ export type ButtonStyleProps = {
31
31
  /** Sets override styles for the button. */
32
32
  css?: CSSObject;
33
33
  /** Sets the visual prominence of the button. */
@@ -38,5 +38,7 @@ export declare type ButtonStyleProps = {
38
38
  size?: ButtonSize;
39
39
  /** Sets the tone of the button. */
40
40
  tone?: ButtonTone;
41
+ /** Sets the background color of the button. */
42
+ filled?: boolean;
41
43
  };
42
44
  export {};
@@ -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, }: UseButtonStylesProps): readonly [{
10
+ export declare function useButtonStyles({ iconOnly, prominence, rounded, size, tone, filled, }: 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;
@@ -47,29 +47,20 @@ export declare function useButtonStyles({ iconOnly, prominence, rounded, size, t
47
47
  };
48
48
  };
49
49
  readonly ':focus': {
50
+ boxShadow: string;
51
+ outline: string;
52
+ outlineOffset: string;
53
+ } | {
54
+ "[data-brighte-focus-visible] &": {
55
+ boxShadow: string;
56
+ };
50
57
  outline: string;
51
58
  outlineOffset: string;
52
59
  } | {
53
- border?: string | undefined;
54
- outline?: string | undefined;
55
- /**
56
- * useButtonStyles
57
- *
58
- * Custom hook for styling buttons and certain links.
59
- * Returns a tuple where the first item is an object of props to spread onto the
60
- * underlying `Box` component, and the second item is a CSS object that can be
61
- * passed to Emotion's `css` function.
62
- */
63
- outlineOffset?: string | undefined;
64
- /**
65
- * useButtonStyles
66
- *
67
- * Custom hook for styling buttons and certain links.
68
- * Returns a tuple where the first item is an object of props to spread onto the
69
- * underlying `Box` component, and the second item is a CSS object that can be
70
- * passed to Emotion's `css` function.
71
- */
72
- boxShadow?: string | undefined;
60
+ border?: string;
61
+ outline?: string;
62
+ outlineOffset?: string;
63
+ boxShadow?: string;
73
64
  };
74
65
  };
75
66
  readonly '&[aria-disabled=true]': {
@@ -85,6 +76,9 @@ export declare function useButtonStyles({ iconOnly, prominence, rounded, size, t
85
76
  outline: string;
86
77
  outlineOffset: string;
87
78
  } | {
79
+ "[data-brighte-focus-visible] &": {
80
+ boxShadow: string;
81
+ };
88
82
  outline: string;
89
83
  outlineOffset: string;
90
84
  };
@@ -93,9 +87,9 @@ export declare function useButtonStyles({ iconOnly, prominence, rounded, size, t
93
87
  readonly transitionTimingFunction: string;
94
88
  readonly transitionDuration: string;
95
89
  }, {
96
- readonly fontWeight: "medium" | "light" | "bold" | "thin" | "black" | "extralight" | "regular" | "semibold" | "extrabold" | undefined;
90
+ readonly fontWeight: "bold" | "medium" | "light" | "thin" | "black" | "extralight" | "regular" | "semibold" | "extrabold" | undefined;
97
91
  }];
98
- export declare type UseButtonStylesProps = Omit<Required<ButtonStyleProps>, 'css' | 'rounded'> & Partial<Pick<ButtonStyleProps, 'rounded'>> & {
92
+ export type UseButtonStylesProps = Omit<Required<ButtonStyleProps>, 'css' | 'rounded' | 'filled'> & Partial<Pick<ButtonStyleProps, 'rounded' | 'filled'>> & {
99
93
  /** Whether the children of the button is a single icon or not. */
100
94
  iconOnly: boolean;
101
95
  };
@@ -2,29 +2,30 @@ import type { BoxProps } from '@spark-web/box';
2
2
  import type { ForegroundTone } from '@spark-web/text';
3
3
  import type { SparkTheme } from '@spark-web/theme';
4
4
  import type { ButtonProminence, ButtonTone } from "./types.js";
5
- declare type BaseButtonStyles = {
5
+ type BaseButtonStyles = {
6
6
  background: BoxProps['background'];
7
+ backgroundFill?: BoxProps['background'];
7
8
  border?: BoxProps['border'];
8
9
  borderWidth?: BoxProps['borderWidth'];
9
10
  textTone?: ForegroundTone;
10
11
  };
11
- declare type HoverButtonStyles = {
12
+ type HoverButtonStyles = {
12
13
  backgroundHover: keyof SparkTheme['backgroundInteractions'];
13
14
  borderHover?: keyof SparkTheme['border']['color'];
14
15
  textToneHover?: keyof SparkTheme['color']['foreground'];
15
16
  };
16
- declare type ActiveButtonStyles = {
17
+ type ActiveButtonStyles = {
17
18
  backgroundActive: keyof SparkTheme['backgroundInteractions'];
18
19
  borderActive?: keyof SparkTheme['border']['color'];
19
20
  textToneActive?: keyof SparkTheme['color']['foreground'];
20
21
  };
21
- declare type DisabledButtonStyles = {
22
+ type DisabledButtonStyles = {
22
23
  backgroundDisabled: keyof SparkTheme['color']['background'];
23
24
  borderDisabled?: keyof SparkTheme['border']['color'];
24
25
  textToneDisabled: keyof SparkTheme['color']['foreground'];
25
26
  };
26
- declare type ButtonStyles = BaseButtonStyles & HoverButtonStyles & ActiveButtonStyles & DisabledButtonStyles;
27
- declare type Variants = Record<ButtonProminence, Record<ButtonTone, ButtonStyles | undefined>>;
27
+ type ButtonStyles = BaseButtonStyles & HoverButtonStyles & ActiveButtonStyles & DisabledButtonStyles;
28
+ type Variants = Record<ButtonProminence, Record<ButtonTone, ButtonStyles | undefined>>;
28
29
  export declare const variants: Variants;
29
30
  export declare const mapTokens: {
30
31
  readonly fontSize: {
@@ -1,2 +1,2 @@
1
- export * from "./declarations/src/index";
1
+ export * from "./declarations/src/index.js";
2
2
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLWJ1dHRvbi5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -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');
14
13
  var spinner = require('@spark-web/spinner');
15
14
  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');
@@ -93,7 +93,8 @@ var variants = {
93
93
  primary: _objectSpread({
94
94
  background: 'primary',
95
95
  backgroundHover: 'primaryHover',
96
- backgroundActive: 'primaryActive'
96
+ backgroundActive: 'primaryActive',
97
+ textTone: 'dark'
97
98
  }, highDisabledStyles),
98
99
  secondary: _objectSpread({
99
100
  background: 'secondary',
@@ -122,14 +123,20 @@ var variants = {
122
123
  background: 'primaryDark',
123
124
  backgroundHover: 'primaryHover',
124
125
  backgroundActive: 'primaryActive'
126
+ }, highDisabledStyles),
127
+ dark: _objectSpread({
128
+ background: 'dark',
129
+ backgroundHover: 'darkHover',
130
+ backgroundActive: 'darkActive'
125
131
  }, highDisabledStyles)
126
132
  },
127
133
  low: {
128
134
  primary: _objectSpread({
129
135
  background: 'surface',
136
+ backgroundFill: 'primarySoft',
130
137
  border: 'primary',
131
138
  borderWidth: 'large',
132
- textTone: 'primary',
139
+ textTone: 'dark',
133
140
  backgroundHover: 'none',
134
141
  borderHover: 'primaryHover',
135
142
  textToneHover: 'primaryHover',
@@ -185,6 +192,16 @@ var variants = {
185
192
  backgroundActive: 'none',
186
193
  borderActive: 'primaryActive',
187
194
  textToneActive: 'primaryActive'
195
+ }, lowDisabledAltStyles),
196
+ dark: _objectSpread({
197
+ background: 'surface',
198
+ backgroundHover: 'none',
199
+ backgroundActive: 'none',
200
+ textTone: 'dark',
201
+ borderWidth: 'large',
202
+ border: 'dark',
203
+ borderHover: 'darkHover',
204
+ borderActive: 'darkActive'
188
205
  }, lowDisabledAltStyles)
189
206
  },
190
207
  none: {
@@ -235,6 +252,12 @@ var variants = {
235
252
  textTone: 'primaryActive',
236
253
  backgroundHover: 'primaryLowHover',
237
254
  backgroundActive: 'primaryLowActive'
255
+ }, noneDisabledStyles),
256
+ dark: _objectSpread({
257
+ background: 'surface',
258
+ textTone: 'dark',
259
+ backgroundHover: 'darkLowHover',
260
+ backgroundActive: 'darkLowActive'
238
261
  }, noneDisabledStyles)
239
262
  }
240
263
  };
@@ -276,7 +299,7 @@ var resolveButtonChildren = function resolveButtonChildren(_ref) {
276
299
  })
277
300
  });
278
301
  }
279
- if ( /*#__PURE__*/react.isValidElement(child)) {
302
+ if (/*#__PURE__*/react.isValidElement(child)) {
280
303
  return jsxRuntime.jsx(HiddenWhenLoading, {
281
304
  isLoading: isLoading,
282
305
  children: /*#__PURE__*/react.cloneElement(child, {
@@ -317,13 +340,15 @@ function HiddenWhenLoading(_ref2) {
317
340
  * passed to Emotion's `css` function.
318
341
  */
319
342
  function useButtonStyles(_ref) {
320
- var _theme$components$but, _theme$components, _theme$components2;
343
+ var _variant$backgroundFi, _theme$components$but, _theme$components, _theme$components2;
321
344
  var iconOnly = _ref.iconOnly,
322
345
  prominence = _ref.prominence,
323
346
  _ref$rounded = _ref.rounded,
324
347
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
325
348
  size = _ref.size,
326
- tone = _ref.tone;
349
+ tone = _ref.tone,
350
+ _ref$filled = _ref.filled,
351
+ filled = _ref$filled === void 0 ? false : _ref$filled;
327
352
  var theme$1 = theme.useTheme();
328
353
  var focusRingStyles = a11y.useFocusRing({
329
354
  tone: tone,
@@ -341,7 +366,7 @@ function useButtonStyles(_ref) {
341
366
  };
342
367
  return [{
343
368
  alignItems: 'center',
344
- background: variant === null || variant === void 0 ? void 0 : variant.background,
369
+ background: filled ? (_variant$backgroundFi = variant === null || variant === void 0 ? void 0 : variant.backgroundFill) !== null && _variant$backgroundFi !== void 0 ? _variant$backgroundFi : variant === null || variant === void 0 ? void 0 : variant.background : variant === null || variant === void 0 ? void 0 : variant.background,
345
370
  border: variant === null || variant === void 0 ? void 0 : variant.border,
346
371
  borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
347
372
  borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
@@ -394,7 +419,7 @@ function useButtonStyles(_ref) {
394
419
  }];
395
420
  }
396
421
 
397
- var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
422
+ var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type", "filled"];
398
423
  /**
399
424
  * Buttons are used to initialize an action, their label should express what
400
425
  * action will occur when the user interacts with it.
@@ -420,6 +445,8 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
420
445
  _ref$tone = _ref.tone,
421
446
  tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
422
447
  type = _ref.type,
448
+ _ref$filled = _ref.filled,
449
+ filled = _ref$filled === void 0 ? false : _ref$filled,
423
450
  props = _objectWithoutProperties(_ref, _excluded$1);
424
451
  var iconOnly = Boolean(props.label);
425
452
  var _useButtonStyles = useButtonStyles({
@@ -427,7 +454,8 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
427
454
  rounded: rounded,
428
455
  size: size,
429
456
  tone: tone,
430
- prominence: prominence
457
+ prominence: prominence,
458
+ filled: filled
431
459
  }),
432
460
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
433
461
  boxProps = _useButtonStyles2[0],
@@ -460,7 +488,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
460
488
  Button.displayName = 'Button';
461
489
  function Loading(_ref2) {
462
490
  var tone = _ref2.tone;
463
- return jsxRuntime.jsxs(box.Box, {
491
+ return jsxRuntime.jsx(box.Box, {
464
492
  as: "span",
465
493
  position: "absolute",
466
494
  top: 0,
@@ -470,12 +498,10 @@ function Loading(_ref2) {
470
498
  display: "flex",
471
499
  alignItems: "center",
472
500
  justifyContent: "center",
473
- children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
474
- children: "button loading indicator"
475
- }), jsxRuntime.jsx(spinner.Spinner, {
501
+ children: jsxRuntime.jsx(spinner.Spinner, {
476
502
  size: "xsmall",
477
503
  tone: tone
478
- })]
504
+ })
479
505
  });
480
506
  }
481
507
 
@@ -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');
14
13
  var spinner = require('@spark-web/spinner');
15
14
  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');
@@ -93,7 +93,8 @@ var variants = {
93
93
  primary: _objectSpread({
94
94
  background: 'primary',
95
95
  backgroundHover: 'primaryHover',
96
- backgroundActive: 'primaryActive'
96
+ backgroundActive: 'primaryActive',
97
+ textTone: 'dark'
97
98
  }, highDisabledStyles),
98
99
  secondary: _objectSpread({
99
100
  background: 'secondary',
@@ -122,14 +123,20 @@ var variants = {
122
123
  background: 'primaryDark',
123
124
  backgroundHover: 'primaryHover',
124
125
  backgroundActive: 'primaryActive'
126
+ }, highDisabledStyles),
127
+ dark: _objectSpread({
128
+ background: 'dark',
129
+ backgroundHover: 'darkHover',
130
+ backgroundActive: 'darkActive'
125
131
  }, highDisabledStyles)
126
132
  },
127
133
  low: {
128
134
  primary: _objectSpread({
129
135
  background: 'surface',
136
+ backgroundFill: 'primarySoft',
130
137
  border: 'primary',
131
138
  borderWidth: 'large',
132
- textTone: 'primary',
139
+ textTone: 'dark',
133
140
  backgroundHover: 'none',
134
141
  borderHover: 'primaryHover',
135
142
  textToneHover: 'primaryHover',
@@ -185,6 +192,16 @@ var variants = {
185
192
  backgroundActive: 'none',
186
193
  borderActive: 'primaryActive',
187
194
  textToneActive: 'primaryActive'
195
+ }, lowDisabledAltStyles),
196
+ dark: _objectSpread({
197
+ background: 'surface',
198
+ backgroundHover: 'none',
199
+ backgroundActive: 'none',
200
+ textTone: 'dark',
201
+ borderWidth: 'large',
202
+ border: 'dark',
203
+ borderHover: 'darkHover',
204
+ borderActive: 'darkActive'
188
205
  }, lowDisabledAltStyles)
189
206
  },
190
207
  none: {
@@ -235,6 +252,12 @@ var variants = {
235
252
  textTone: 'primaryActive',
236
253
  backgroundHover: 'primaryLowHover',
237
254
  backgroundActive: 'primaryLowActive'
255
+ }, noneDisabledStyles),
256
+ dark: _objectSpread({
257
+ background: 'surface',
258
+ textTone: 'dark',
259
+ backgroundHover: 'darkLowHover',
260
+ backgroundActive: 'darkLowActive'
238
261
  }, noneDisabledStyles)
239
262
  }
240
263
  };
@@ -276,7 +299,7 @@ var resolveButtonChildren = function resolveButtonChildren(_ref) {
276
299
  })
277
300
  });
278
301
  }
279
- if ( /*#__PURE__*/react.isValidElement(child)) {
302
+ if (/*#__PURE__*/react.isValidElement(child)) {
280
303
  return jsxRuntime.jsx(HiddenWhenLoading, {
281
304
  isLoading: isLoading,
282
305
  children: /*#__PURE__*/react.cloneElement(child, {
@@ -317,13 +340,15 @@ function HiddenWhenLoading(_ref2) {
317
340
  * passed to Emotion's `css` function.
318
341
  */
319
342
  function useButtonStyles(_ref) {
320
- var _theme$components$but, _theme$components, _theme$components2;
343
+ var _variant$backgroundFi, _theme$components$but, _theme$components, _theme$components2;
321
344
  var iconOnly = _ref.iconOnly,
322
345
  prominence = _ref.prominence,
323
346
  _ref$rounded = _ref.rounded,
324
347
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
325
348
  size = _ref.size,
326
- tone = _ref.tone;
349
+ tone = _ref.tone,
350
+ _ref$filled = _ref.filled,
351
+ filled = _ref$filled === void 0 ? false : _ref$filled;
327
352
  var theme$1 = theme.useTheme();
328
353
  var focusRingStyles = a11y.useFocusRing({
329
354
  tone: tone,
@@ -341,7 +366,7 @@ function useButtonStyles(_ref) {
341
366
  };
342
367
  return [{
343
368
  alignItems: 'center',
344
- background: variant === null || variant === void 0 ? void 0 : variant.background,
369
+ background: filled ? (_variant$backgroundFi = variant === null || variant === void 0 ? void 0 : variant.backgroundFill) !== null && _variant$backgroundFi !== void 0 ? _variant$backgroundFi : variant === null || variant === void 0 ? void 0 : variant.background : variant === null || variant === void 0 ? void 0 : variant.background,
345
370
  border: variant === null || variant === void 0 ? void 0 : variant.border,
346
371
  borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
347
372
  borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
@@ -394,7 +419,7 @@ function useButtonStyles(_ref) {
394
419
  }];
395
420
  }
396
421
 
397
- var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
422
+ var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type", "filled"];
398
423
  /**
399
424
  * Buttons are used to initialize an action, their label should express what
400
425
  * action will occur when the user interacts with it.
@@ -420,6 +445,8 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
420
445
  _ref$tone = _ref.tone,
421
446
  tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
422
447
  type = _ref.type,
448
+ _ref$filled = _ref.filled,
449
+ filled = _ref$filled === void 0 ? false : _ref$filled,
423
450
  props = _objectWithoutProperties(_ref, _excluded$1);
424
451
  var iconOnly = Boolean(props.label);
425
452
  var _useButtonStyles = useButtonStyles({
@@ -427,7 +454,8 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
427
454
  rounded: rounded,
428
455
  size: size,
429
456
  tone: tone,
430
- prominence: prominence
457
+ prominence: prominence,
458
+ filled: filled
431
459
  }),
432
460
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
433
461
  boxProps = _useButtonStyles2[0],
@@ -460,7 +488,7 @@ var Button = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
460
488
  Button.displayName = 'Button';
461
489
  function Loading(_ref2) {
462
490
  var tone = _ref2.tone;
463
- return jsxRuntime.jsxs(box.Box, {
491
+ return jsxRuntime.jsx(box.Box, {
464
492
  as: "span",
465
493
  position: "absolute",
466
494
  top: 0,
@@ -470,12 +498,10 @@ function Loading(_ref2) {
470
498
  display: "flex",
471
499
  alignItems: "center",
472
500
  justifyContent: "center",
473
- children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
474
- children: "button loading indicator"
475
- }), jsxRuntime.jsx(spinner.Spinner, {
501
+ children: jsxRuntime.jsx(spinner.Spinner, {
476
502
  size: "xsmall",
477
503
  tone: tone
478
- })]
504
+ })
479
505
  });
480
506
  }
481
507
 
@@ -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';
10
9
  import { Spinner } from '@spark-web/spinner';
11
10
  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';
@@ -89,7 +89,8 @@ var variants = {
89
89
  primary: _objectSpread({
90
90
  background: 'primary',
91
91
  backgroundHover: 'primaryHover',
92
- backgroundActive: 'primaryActive'
92
+ backgroundActive: 'primaryActive',
93
+ textTone: 'dark'
93
94
  }, highDisabledStyles),
94
95
  secondary: _objectSpread({
95
96
  background: 'secondary',
@@ -118,14 +119,20 @@ var variants = {
118
119
  background: 'primaryDark',
119
120
  backgroundHover: 'primaryHover',
120
121
  backgroundActive: 'primaryActive'
122
+ }, highDisabledStyles),
123
+ dark: _objectSpread({
124
+ background: 'dark',
125
+ backgroundHover: 'darkHover',
126
+ backgroundActive: 'darkActive'
121
127
  }, highDisabledStyles)
122
128
  },
123
129
  low: {
124
130
  primary: _objectSpread({
125
131
  background: 'surface',
132
+ backgroundFill: 'primarySoft',
126
133
  border: 'primary',
127
134
  borderWidth: 'large',
128
- textTone: 'primary',
135
+ textTone: 'dark',
129
136
  backgroundHover: 'none',
130
137
  borderHover: 'primaryHover',
131
138
  textToneHover: 'primaryHover',
@@ -181,6 +188,16 @@ var variants = {
181
188
  backgroundActive: 'none',
182
189
  borderActive: 'primaryActive',
183
190
  textToneActive: 'primaryActive'
191
+ }, lowDisabledAltStyles),
192
+ dark: _objectSpread({
193
+ background: 'surface',
194
+ backgroundHover: 'none',
195
+ backgroundActive: 'none',
196
+ textTone: 'dark',
197
+ borderWidth: 'large',
198
+ border: 'dark',
199
+ borderHover: 'darkHover',
200
+ borderActive: 'darkActive'
184
201
  }, lowDisabledAltStyles)
185
202
  },
186
203
  none: {
@@ -231,6 +248,12 @@ var variants = {
231
248
  textTone: 'primaryActive',
232
249
  backgroundHover: 'primaryLowHover',
233
250
  backgroundActive: 'primaryLowActive'
251
+ }, noneDisabledStyles),
252
+ dark: _objectSpread({
253
+ background: 'surface',
254
+ textTone: 'dark',
255
+ backgroundHover: 'darkLowHover',
256
+ backgroundActive: 'darkLowActive'
234
257
  }, noneDisabledStyles)
235
258
  }
236
259
  };
@@ -272,7 +295,7 @@ var resolveButtonChildren = function resolveButtonChildren(_ref) {
272
295
  })
273
296
  });
274
297
  }
275
- if ( /*#__PURE__*/isValidElement(child)) {
298
+ if (/*#__PURE__*/isValidElement(child)) {
276
299
  return jsx(HiddenWhenLoading, {
277
300
  isLoading: isLoading,
278
301
  children: /*#__PURE__*/cloneElement(child, {
@@ -313,13 +336,15 @@ function HiddenWhenLoading(_ref2) {
313
336
  * passed to Emotion's `css` function.
314
337
  */
315
338
  function useButtonStyles(_ref) {
316
- var _theme$components$but, _theme$components, _theme$components2;
339
+ var _variant$backgroundFi, _theme$components$but, _theme$components, _theme$components2;
317
340
  var iconOnly = _ref.iconOnly,
318
341
  prominence = _ref.prominence,
319
342
  _ref$rounded = _ref.rounded,
320
343
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
321
344
  size = _ref.size,
322
- tone = _ref.tone;
345
+ tone = _ref.tone,
346
+ _ref$filled = _ref.filled,
347
+ filled = _ref$filled === void 0 ? false : _ref$filled;
323
348
  var theme = useTheme();
324
349
  var focusRingStyles = useFocusRing({
325
350
  tone: tone,
@@ -337,7 +362,7 @@ function useButtonStyles(_ref) {
337
362
  };
338
363
  return [{
339
364
  alignItems: 'center',
340
- background: variant === null || variant === void 0 ? void 0 : variant.background,
365
+ background: filled ? (_variant$backgroundFi = variant === null || variant === void 0 ? void 0 : variant.backgroundFill) !== null && _variant$backgroundFi !== void 0 ? _variant$backgroundFi : variant === null || variant === void 0 ? void 0 : variant.background : variant === null || variant === void 0 ? void 0 : variant.background,
341
366
  border: variant === null || variant === void 0 ? void 0 : variant.border,
342
367
  borderWidth: variant === null || variant === void 0 ? void 0 : variant.borderWidth,
343
368
  borderRadius: rounded ? 'full' : isLarge ? 'medium' : 'small',
@@ -390,7 +415,7 @@ function useButtonStyles(_ref) {
390
415
  }];
391
416
  }
392
417
 
393
- var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type"];
418
+ var _excluded$1 = ["aria-controls", "aria-describedby", "aria-expanded", "aria-label", "data", "disabled", "id", "loading", "onClick", "css", "rounded", "prominence", "size", "tone", "type", "filled"];
394
419
  /**
395
420
  * Buttons are used to initialize an action, their label should express what
396
421
  * action will occur when the user interacts with it.
@@ -416,6 +441,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
416
441
  _ref$tone = _ref.tone,
417
442
  tone = _ref$tone === void 0 ? 'primary' : _ref$tone,
418
443
  type = _ref.type,
444
+ _ref$filled = _ref.filled,
445
+ filled = _ref$filled === void 0 ? false : _ref$filled,
419
446
  props = _objectWithoutProperties(_ref, _excluded$1);
420
447
  var iconOnly = Boolean(props.label);
421
448
  var _useButtonStyles = useButtonStyles({
@@ -423,7 +450,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
423
450
  rounded: rounded,
424
451
  size: size,
425
452
  tone: tone,
426
- prominence: prominence
453
+ prominence: prominence,
454
+ filled: filled
427
455
  }),
428
456
  _useButtonStyles2 = _slicedToArray(_useButtonStyles, 3),
429
457
  boxProps = _useButtonStyles2[0],
@@ -456,7 +484,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
456
484
  Button.displayName = 'Button';
457
485
  function Loading(_ref2) {
458
486
  var tone = _ref2.tone;
459
- return jsxs(Box, {
487
+ return jsx(Box, {
460
488
  as: "span",
461
489
  position: "absolute",
462
490
  top: 0,
@@ -466,12 +494,10 @@ function Loading(_ref2) {
466
494
  display: "flex",
467
495
  alignItems: "center",
468
496
  justifyContent: "center",
469
- children: [jsx(VisuallyHidden, {
470
- children: "button loading indicator"
471
- }), jsx(Spinner, {
497
+ children: jsx(Spinner, {
472
498
  size: "xsmall",
473
499
  tone: tone
474
- })]
500
+ })
475
501
  });
476
502
  }
477
503
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-web/button",
3
- "version": "5.6.0-rc.0",
3
+ "version": "5.6.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.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"
20
+ "@spark-web/a11y": "^5.3.0",
21
+ "@spark-web/box": "^6.0.0",
22
+ "@spark-web/icon": "^5.1.0",
23
+ "@spark-web/link": "^5.1.0",
24
+ "@spark-web/spinner": "^5.1.0",
25
+ "@spark-web/text": "^5.3.0",
26
+ "@spark-web/theme": "^5.13.0",
27
+ "@spark-web/utils": "^5.1.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/react": "^19.1.0",
31
31
  "react": "^19.1.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "react": ">=19.1.0"
34
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
35
35
  },
36
36
  "engines": {
37
37
  "node": ">=14"