@homebound/beam 2.128.2 → 2.129.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/dist/Css.d.ts CHANGED
@@ -545,6 +545,27 @@ declare class CssBuilder<T extends Properties1> {
545
545
  jc(value: Properties["justifyContent"]): CssBuilder<T & {
546
546
  justifyContent: import("csstype").Property.JustifyContent | undefined;
547
547
  }>;
548
+ get jifs(): CssBuilder<T & {
549
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
550
+ }>;
551
+ get jife(): CssBuilder<T & {
552
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
553
+ }>;
554
+ get jic(): CssBuilder<T & {
555
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
556
+ }>;
557
+ get jisb(): CssBuilder<T & {
558
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
559
+ }>;
560
+ get jisa(): CssBuilder<T & {
561
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
562
+ }>;
563
+ get jise(): CssBuilder<T & {
564
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
565
+ }>;
566
+ ji(value: Properties["justifyItems"]): CssBuilder<T & {
567
+ justifyItems: import("csstype").Property.JustifyItems | undefined;
568
+ }>;
548
569
  get asfs(): CssBuilder<T & {
549
570
  alignSelf: import("csstype").Property.AlignSelf | undefined;
550
571
  }>;
package/dist/Css.js CHANGED
@@ -196,6 +196,13 @@ class CssBuilder {
196
196
  get jcsa() { return this.add("justifyContent", "space-around"); }
197
197
  get jcse() { return this.add("justifyContent", "space-evenly"); }
198
198
  jc(value) { return this.add("justifyContent", value); }
199
+ get jifs() { return this.add("justifyItems", "flex-start"); }
200
+ get jife() { return this.add("justifyItems", "flex-end"); }
201
+ get jic() { return this.add("justifyItems", "center"); }
202
+ get jisb() { return this.add("justifyItems", "space-between"); }
203
+ get jisa() { return this.add("justifyItems", "space-around"); }
204
+ get jise() { return this.add("justifyItems", "space-evenly"); }
205
+ ji(value) { return this.add("justifyItems", value); }
199
206
  get asfs() { return this.add("alignSelf", "flex-start"); }
200
207
  get asfe() { return this.add("alignSelf", "flex-end"); }
201
208
  get asc() { return this.add("alignSelf", "center"); }
@@ -16,8 +16,8 @@ export interface ButtonProps extends BeamButtonProps, BeamFocusableProps {
16
16
  type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
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
+ contrast?: boolean;
19
20
  }
20
21
  export declare function Button(props: ButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
21
- declare type ButtonSize = "sm" | "md" | "lg";
22
- declare type ButtonVariant = "primary" | "secondary" | "tertiary" | "danger" | "text";
23
- export {};
22
+ export declare type ButtonSize = "sm" | "md" | "lg";
23
+ export declare type ButtonVariant = "primary" | "secondary" | "tertiary" | "danger" | "text";
@@ -10,7 +10,7 @@ const Css_1 = require("../Css");
10
10
  const utils_1 = require("../utils");
11
11
  const useTestIds_1 = require("../utils/useTestIds");
12
12
  function Button(props) {
13
- const { onClick: onPress, disabled, endAdornment, menuTriggerProps, tooltip, openInNew, download, ...otherProps } = props;
13
+ const { onClick: onPress, disabled, endAdornment, menuTriggerProps, tooltip, openInNew, download, contrast = false, ...otherProps } = props;
14
14
  const showExternalLinkIcon = (typeof onPress === "string" && (0, utils_1.isAbsoluteUrl)(onPress)) || openInNew;
15
15
  const isDisabled = !!disabled;
16
16
  const ariaProps = { onPress, isDisabled, ...otherProps, ...menuTriggerProps };
@@ -26,8 +26,12 @@ function Button(props) {
26
26
  }, ref);
27
27
  const { isFocusVisible, focusProps } = (0, react_aria_1.useFocusRing)(ariaProps);
28
28
  const { hoverProps, isHovered } = (0, react_aria_1.useHover)(ariaProps);
29
- const { baseStyles, hoverStyles, disabledStyles, pressedStyles } = (0, react_1.useMemo)(() => getButtonStyles(variant, size), [variant, size]);
30
- const focusRingStyles = (0, react_1.useMemo)(() => (variant === "danger" ? Css_1.Css.bshDanger.$ : Css_1.Css.bshFocus.$), [variant]);
29
+ const { baseStyles, hoverStyles, disabledStyles, pressedStyles } = (0, react_1.useMemo)(() => getButtonStyles(variant, size, contrast), [variant, size, contrast]);
30
+ const focusStyles = (0, react_1.useMemo)(() => !contrast
31
+ ? variant === "danger"
32
+ ? Css_1.Css.bshDanger.$
33
+ : Css_1.Css.bshFocus.$
34
+ : Css_1.Css.boxShadow(`0 0 0 2px ${variant === "tertiary" ? Css_1.Palette.LightBlue700 : Css_1.Palette.White}`).if(variant === "tertiary").bgGray700.white.$, [variant, contrast]);
31
35
  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));
32
36
  const buttonAttrs = {
33
37
  ref: ref,
@@ -40,7 +44,7 @@ function Button(props) {
40
44
  ...(isHovered && !isPressed ? hoverStyles : {}),
41
45
  ...(isPressed ? pressedStyles : {}),
42
46
  ...(isDisabled ? { ...disabledStyles, ...Css_1.Css.cursorNotAllowed.$ } : {}),
43
- ...(isFocusVisible ? focusRingStyles : {}),
47
+ ...(isFocusVisible ? focusStyles : {}),
44
48
  },
45
49
  ...tid,
46
50
  };
@@ -53,48 +57,49 @@ function Button(props) {
53
57
  });
54
58
  }
55
59
  exports.Button = Button;
56
- function getButtonStyles(variant, size) {
60
+ function getButtonStyles(variant, size, contrast) {
61
+ const styles = variantStyles(contrast)[variant];
57
62
  if (variant === "text") {
58
63
  // The text variant does not support the 'size'. The 'size' prop only effects the button's height and padding which is not relevant for this variant.
59
- return variantStyles[variant];
64
+ return styles;
60
65
  }
61
66
  return {
62
- ...variantStyles[variant],
63
- baseStyles: { ...variantStyles[variant].baseStyles, ...sizeStyles[size] },
67
+ ...styles,
68
+ baseStyles: { ...styles.baseStyles, ...sizeStyles[size] },
64
69
  };
65
70
  }
66
- const variantStyles = {
71
+ const variantStyles = (contrast) => ({
67
72
  primary: {
68
- baseStyles: Css_1.Css.bgLightBlue700.white.$,
69
- hoverStyles: Css_1.Css.bgLightBlue900.$,
70
- pressedStyles: Css_1.Css.bgLightBlue500.$,
71
- disabledStyles: Css_1.Css.bgLightBlue200.$,
73
+ baseStyles: Css_1.Css.bgLightBlue700.white.if(contrast).bgLightBlue400.$,
74
+ hoverStyles: Css_1.Css.bgLightBlue900.if(contrast).bgLightBlue500.$,
75
+ pressedStyles: Css_1.Css.bgLightBlue500.if(contrast).bgLightBlue900.$,
76
+ disabledStyles: Css_1.Css.bgLightBlue200.if(contrast).gray600.bgLightBlue900.$,
72
77
  },
73
78
  secondary: {
74
79
  baseStyles: Css_1.Css.bgWhite.bGray300.bw1.ba.gray800.$,
75
- hoverStyles: Css_1.Css.bgGray100.$,
76
- pressedStyles: Css_1.Css.bgGray200.$,
80
+ hoverStyles: Css_1.Css.bgGray100.if(contrast).bgGray300.$,
81
+ pressedStyles: Css_1.Css.bgGray200.if(contrast).bgGray100.$,
77
82
  disabledStyles: Css_1.Css.bgWhite.gray400.$,
78
83
  },
79
84
  tertiary: {
80
- baseStyles: Css_1.Css.bgTransparent.lightBlue700.$,
81
- hoverStyles: Css_1.Css.bgGray100.$,
82
- pressedStyles: Css_1.Css.lightBlue900.$,
83
- disabledStyles: Css_1.Css.gray400.$,
85
+ baseStyles: Css_1.Css.bgTransparent.lightBlue700.if(contrast).lightBlue400.$,
86
+ hoverStyles: Css_1.Css.bgGray100.if(contrast).bgGray700.white.$,
87
+ pressedStyles: Css_1.Css.lightBlue900.if(contrast).bgWhite.gray900.$,
88
+ disabledStyles: Css_1.Css.gray400.if(contrast).gray700.$,
84
89
  },
85
90
  danger: {
86
- baseStyles: Css_1.Css.bgRed900.white.$,
87
- hoverStyles: Css_1.Css.bgRed500.$,
88
- pressedStyles: Css_1.Css.bgRed900.$,
89
- disabledStyles: Css_1.Css.bgRed200.$,
91
+ baseStyles: Css_1.Css.bgRed900.white.if(contrast).bgRed800.$,
92
+ hoverStyles: Css_1.Css.bgRed500.if(contrast).bgRed600.$,
93
+ pressedStyles: Css_1.Css.bgRed900.if(contrast).bgRed800.$,
94
+ disabledStyles: Css_1.Css.bgRed200.if(contrast).bgRed900.gray600.$,
90
95
  },
91
96
  text: {
92
- baseStyles: Css_1.Css.lightBlue700.add("fontSize", "inherit").$,
93
- hoverStyles: {},
94
- pressedStyles: {},
95
- disabledStyles: Css_1.Css.lightBlue300.$,
97
+ baseStyles: Css_1.Css.lightBlue700.add("fontSize", "inherit").if(contrast).lightBlue400.$,
98
+ hoverStyles: Css_1.Css.lightBlue600.if(contrast).lightBlue300.$,
99
+ pressedStyles: Css_1.Css.lightBlue700.if(contrast).lightBlue200.$,
100
+ disabledStyles: Css_1.Css.lightBlue300.if(contrast).lightBlue700.$,
96
101
  },
97
- };
102
+ });
98
103
  const sizeStyles = {
99
104
  sm: Css_1.Css.hPx(32).pxPx(12).$,
100
105
  md: Css_1.Css.hPx(40).px2.$,
@@ -77,9 +77,9 @@ function SuperDrawer() {
77
77
  // Custom transitions settings for the translateX animation
78
78
  transition: { ease: "linear", duration: 0.2, delay: 0.2 }, exit: { transition: { ease: "linear", duration: 0.2 }, x: 1040 },
79
79
  // Preventing clicks from triggering parent onClick
80
- onClick: (e) => e.stopPropagation() }, { children: [(0, jsx_runtime_1.jsxs)("header", Object.assign({ css: Css_1.Css.df.p3.bb.bGray200.df.aic.jcsb.$ }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.aic.$ }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.xl2Em.gray900.mr2.$ }, testId.title, { ref: drawerHeaderRef }, { children: !modalState.current && (title || null) }), void 0), !modalState.current && (titleLeftContent || null)] }), void 0), !modalState.current && (
80
+ onClick: (e) => e.stopPropagation() }, { children: [(0, jsx_runtime_1.jsxs)("header", Object.assign({ css: Css_1.Css.df.p3.bb.bGray200.df.aic.jcsb.gap2.$ }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.aic.$ }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.xl2Em.gray900.mr2.$ }, testId.title, { ref: drawerHeaderRef }, { children: !modalState.current && (title || null) }), void 0), !modalState.current && (titleLeftContent || null)] }), void 0), !modalState.current && (
81
81
  // Forcing height to 32px to match title height
82
- (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.childGap3.aic.hPx(32).$ }, { children: [titleRightContent || null, (0, jsx_runtime_1.jsx)(components_1.ButtonGroup, Object.assign({ buttons: [
82
+ (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: Css_1.Css.df.childGap3.aic.hPx(32).fs0.$ }, { children: [titleRightContent || null, (0, jsx_runtime_1.jsx)(components_1.ButtonGroup, Object.assign({ buttons: [
83
83
  {
84
84
  icon: "chevronLeft",
85
85
  onClick: () => onPrevClick && onPrevClick(),
@@ -28,10 +28,10 @@ function Menu(props) {
28
28
  // Bulk updates of MenuItems below. If we find this to be of sluggish performance, then we can change to be more surgical in our updating.
29
29
  // If our list of items change, update the "items" menu section. (key is based on label in `getKey` above)
30
30
  (0, react_1.useEffect)(() => tree.update("items", { label: "items", items }), [items]);
31
- return ((0, jsx_runtime_1.jsx)(react_aria_1.FocusScope, Object.assign({ restoreFocus: true }, { children: (0, jsx_runtime_1.jsx)("ul", Object.assign({ css: {
31
+ return ((0, jsx_runtime_1.jsx)(react_aria_1.FocusScope, { children: (0, jsx_runtime_1.jsx)("ul", Object.assign({ css: {
32
32
  // Using `max-height: inherit` allows us to take advantage of the height set on the overlay container, which updates based on the available space for the overlay within the viewport
33
33
  ...Css_1.Css.df.fdc.myPx(4).bgWhite.outline0.br4.bshBasic.listReset.maxh("inherit").overflowAuto.$,
34
34
  "&:hover, &:focus": Css_1.Css.bshHover.$,
35
- } }, menuProps, { ref: menuRef }, tid.menu, { children: [...state.collection].map((item) => ((0, jsx_runtime_1.jsx)(MenuSection_1.MenuSectionImpl, Object.assign({ section: item, state: state, onClose: onClose }, tid), item.key))) }), void 0) }), void 0));
35
+ } }, menuProps, { ref: menuRef }, tid.menu, { children: [...state.collection].map((item) => ((0, jsx_runtime_1.jsx)(MenuSection_1.MenuSectionImpl, Object.assign({ section: item, state: state, onClose: onClose }, tid), item.key))) }), void 0) }, void 0));
36
36
  }
37
37
  exports.Menu = Menu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.128.2",
3
+ "version": "2.129.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -78,7 +78,7 @@
78
78
  "@emotion/react": "^11.1.5",
79
79
  "@homebound/rtl-react-router-utils": "^1.0.3",
80
80
  "@homebound/rtl-utils": "^2.59.3",
81
- "@homebound/truss": "^1.111.3",
81
+ "@homebound/truss": "^1.113.0",
82
82
  "@homebound/tsconfig": "^1.0.3",
83
83
  "@semantic-release/exec": "^6.0.3",
84
84
  "@semantic-release/git": "^9.0.0",