@homebound/beam 2.214.0 → 2.215.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.
@@ -17,6 +17,8 @@ export interface ButtonProps extends BeamButtonProps, BeamFocusableProps {
17
17
  /** Denotes if this button is used to download a resource. Uses the anchor tag with the `download` attribute */
18
18
  download?: boolean;
19
19
  contrast?: boolean;
20
+ /** Additional text to further customize button during an async request is in progress. */
21
+ labelInFlight?: string;
20
22
  }
21
23
  export declare function Button(props: ButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
22
24
  export declare type ButtonSize = "sm" | "md" | "lg";
@@ -10,7 +10,7 @@ const utils_1 = require("../utils");
10
10
  const getInteractiveElement_1 = require("../utils/getInteractiveElement");
11
11
  const useTestIds_1 = require("../utils/useTestIds");
12
12
  function Button(props) {
13
- const { onClick: onPress, disabled, endAdornment, menuTriggerProps, tooltip, openInNew, download, contrast = false, forceFocusStyles = false, ...otherProps } = props;
13
+ const { onClick: onPress, disabled, endAdornment, menuTriggerProps, tooltip, openInNew, download, contrast = false, forceFocusStyles = false, labelInFlight, ...otherProps } = props;
14
14
  const asLink = typeof onPress === "string";
15
15
  const showExternalLinkIcon = (asLink && (0, utils_1.isAbsoluteUrl)(onPress)) || openInNew;
16
16
  const [asyncInProgress, setAsyncInProgress] = (0, react_1.useState)(false);
@@ -38,7 +38,7 @@ function Button(props) {
38
38
  const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)(ariaProps);
39
39
  const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
40
40
  const { baseStyles, hoverStyles, disabledStyles, pressedStyles, focusStyles } = (0, react_1.useMemo)(() => getButtonStyles(variant, size, contrast), [variant, size, contrast]);
41
- const buttonContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon && (0, jsx_runtime_1.jsx)(components_1.Icon, { xss: iconStyles[size], icon: icon }, void 0), label, endAdornment && (0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.ml1.$ }, { children: endAdornment }), void 0)] }, void 0));
41
+ const buttonContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon && (0, jsx_runtime_1.jsx)(components_1.Icon, { xss: iconStyles[size], icon: icon }, void 0), labelInFlight && asyncInProgress ? labelInFlight : label, (endAdornment || asyncInProgress) && ((0, jsx_runtime_1.jsx)("span", Object.assign({ css: Css_1.Css.ml1.$ }, { children: asyncInProgress ? (0, jsx_runtime_1.jsx)(components_1.Loader, { size: "xs", contrast: contrast }, void 0) : endAdornment }), void 0))] }, void 0));
42
42
  const buttonAttrs = {
43
43
  ref: ref,
44
44
  ...buttonProps,
@@ -1,5 +1,5 @@
1
1
  interface LoaderProps {
2
- size?: "sm" | "md" | "lg";
2
+ size?: "xs" | "sm" | "md" | "lg";
3
3
  contrast?: boolean;
4
4
  }
5
5
  export declare function Loader({ size, contrast }: LoaderProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -21,6 +21,7 @@ function Loader({ size = "lg", contrast = false }) {
21
21
  }
22
22
  exports.Loader = Loader;
23
23
  const sizeToPixels = {
24
+ xs: [16, 2],
24
25
  sm: [32, 4],
25
26
  md: [64, 8],
26
27
  lg: [96, 12],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.214.0",
3
+ "version": "2.215.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",