@homebound/beam 3.59.0 → 3.60.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/index.cjs CHANGED
@@ -14885,6 +14885,7 @@ var import_jsx_runtime75 = require("react/jsx-runtime");
14885
14885
  function SelectCardShell(props) {
14886
14886
  const {
14887
14887
  view,
14888
+ layout = "vertical",
14888
14889
  label,
14889
14890
  selected: isSelected = false,
14890
14891
  disabled: isDisabled = false,
@@ -14908,7 +14909,8 @@ function SelectCardShell(props) {
14908
14909
  pressProps,
14909
14910
  isPressed: isPressedFromEvents
14910
14911
  } = (0, import_react_aria35.usePress)({
14911
- isDisabled
14912
+ isDisabled,
14913
+ preventFocusOnPress: true
14912
14914
  });
14913
14915
  const isHovered = __storyState?.hovered ?? isHoveredFromEvents;
14914
14916
  const isFocusVisible = __storyState?.focusVisible ?? isFocusVisibleFromEvents;
@@ -14924,7 +14926,15 @@ function SelectCardShell(props) {
14924
14926
  borderColor: "bcGray300",
14925
14927
  width: "w100"
14926
14928
  },
14927
- ...view === "grid" ? {
14929
+ ...view === "grid" ? layout === "horizontal" ? {
14930
+ flexDirection: "fdr",
14931
+ alignItems: "aic",
14932
+ gap: "gap2",
14933
+ paddingTop: "pt2",
14934
+ paddingBottom: "pb2",
14935
+ paddingRight: "pr2",
14936
+ paddingLeft: "pl2"
14937
+ } : {
14928
14938
  alignItems: "aic",
14929
14939
  gap: "gap1",
14930
14940
  paddingLeft: "pl2",
@@ -14960,7 +14970,7 @@ function SelectCardShell(props) {
14960
14970
  ...isFocusVisible ? {
14961
14971
  boxShadow: "bshFocus"
14962
14972
  } : {}
14963
- }), [view, isDisabled, isHovered, isSelected, isFocusVisible, isPressed]);
14973
+ }), [view, layout, isDisabled, isHovered, isSelected, isFocusVisible, isPressed]);
14964
14974
  const tid = useTestIds(props, defaultTestId(label));
14965
14975
  return maybeTooltip({
14966
14976
  title: resolveTooltip(isDisabled, tooltip),
@@ -14983,6 +14993,8 @@ var import_jsx_runtime76 = require("react/jsx-runtime");
14983
14993
  function GridSelectCard(props) {
14984
14994
  const {
14985
14995
  icon,
14996
+ image,
14997
+ layout,
14986
14998
  label,
14987
14999
  description,
14988
15000
  selected: isSelected = false,
@@ -14993,9 +15005,17 @@ function GridSelectCard(props) {
14993
15005
  ...others
14994
15006
  } = props;
14995
15007
  const tid = useTestIds(props, defaultTestId(label));
14996
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(SelectCardShell, { label, selected: isSelected, disabled: isDisabled, tooltip, view: "grid", __storyState, ...others, children: [
15008
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(SelectCardShell, { label, selected: isSelected, disabled: isDisabled, tooltip, view: "grid", layout, __storyState, ...others, children: [
14997
15009
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react_aria36.VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("input", { ...inputProps, ...tid.value }) }),
14998
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { icon, inc: 4, color: isDisabled ? "--b-on-surface-disabled" /* OnSurfaceDisabled */ : "--b-on-surface" /* OnSurface */ }),
15010
+ image ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("img", { src: image, alt: "", ...(0, import_runtime51.trussProps)({
15011
+ height: "h_100px",
15012
+ width: "w_100px",
15013
+ objectFit: "objectContain",
15014
+ flexShrink: "fs0",
15015
+ ...isDisabled ? {
15016
+ opacity: "o50"
15017
+ } : {}
15018
+ }), ...tid.img }) : icon && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { icon, inc: 4, color: isDisabled ? "--b-on-surface-disabled" /* OnSurfaceDisabled */ : "--b-on-surface" /* OnSurface */ }),
14999
15019
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "df fdc gap_4px w100", children: [
15000
15020
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { ...(0, import_runtime51.trussProps)({
15001
15021
  fontWeight: "fw6",
@@ -15109,7 +15129,7 @@ function ListSelectCard(props) {
15109
15129
  // src/inputs/SelectCard/SelectCardCheckboxGroupItem.tsx
15110
15130
  var import_jsx_runtime79 = require("react/jsx-runtime");
15111
15131
  function SelectCardCheckboxGroupItem(props) {
15112
- const { option, groupState, isSelected, view, ...others } = props;
15132
+ const { option, groupState, isSelected, view, layout, ...others } = props;
15113
15133
  const { label, description, disabled, tooltip, value } = option;
15114
15134
  const ref = (0, import_react65.useRef)(null);
15115
15135
  const { inputProps, isDisabled: isOptionDisabled } = (0, import_react_aria39.useCheckboxGroupItem)(
@@ -15129,7 +15149,8 @@ function SelectCardCheckboxGroupItem(props) {
15129
15149
  if (view === "list") {
15130
15150
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ListSelectCard, { ...layoutProps });
15131
15151
  }
15132
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(GridSelectCard, { ...layoutProps, icon: option.icon });
15152
+ const gridOption = option;
15153
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(GridSelectCard, { ...layoutProps, layout, icon: gridOption.icon, image: gridOption.image });
15133
15154
  }
15134
15155
 
15135
15156
  // src/inputs/SelectCard/utils.ts
@@ -15156,14 +15177,20 @@ function findToggledSelectCardGroupValue(prev, next) {
15156
15177
  if (added !== void 0) return added;
15157
15178
  return prev.find((v) => !next.includes(v));
15158
15179
  }
15159
- function getSelectCardOptionsCss(view, hasDescription) {
15160
- const cardWidth = hasDescription ? 192 : 142;
15161
- return view === "list" ? {
15180
+ function getSelectCardOptionsCss({
15181
+ view,
15182
+ hasDescription,
15183
+ layout,
15184
+ hasImage
15185
+ }) {
15186
+ if (view === "list") return {
15162
15187
  display: "df",
15163
15188
  flexDirection: "fdc",
15164
15189
  gap: "gap2",
15165
15190
  width: "w100"
15166
- } : {
15191
+ };
15192
+ const cardWidth = layout === "horizontal" ? hasImage ? 360 : 240 : hasImage || hasDescription ? 192 : 142;
15193
+ return {
15167
15194
  display: "dg",
15168
15195
  gridTemplateColumns: ["gtc_var", {
15169
15196
  "--gridTemplateColumns": (0, import_runtime54.maybeCssVar)(`repeat(auto-fill, minmax(${cardWidth}px, 1fr))`)
@@ -15188,9 +15215,11 @@ function MultiSelectCardGroup(props) {
15188
15215
  helperText,
15189
15216
  disabled: isDisabled = false,
15190
15217
  onChange,
15191
- view = "grid"
15218
+ view = "grid",
15219
+ layout
15192
15220
  } = props;
15193
15221
  const hasDescription = (0, import_react66.useMemo)(() => options.some((o) => o.description), [options]);
15222
+ const hasImage = (0, import_react66.useMemo)(() => options.some((o) => "image" in o && o.image), [options]);
15194
15223
  const tid = useTestIds(props, defaultTestId(label));
15195
15224
  const handleChange = (0, import_react66.useCallback)((nextFromAria) => {
15196
15225
  const clicked = findToggledSelectCardGroupValue(values, nextFromAria);
@@ -15213,7 +15242,12 @@ function MultiSelectCardGroup(props) {
15213
15242
  label,
15214
15243
  isDisabled
15215
15244
  }, state);
15216
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(LabeledGroupField, { label, labelStyle, labelProps, groupProps, errorMsg, helperText, tid, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ...(0, import_runtime55.trussProps)(getSelectCardOptionsCss(view, hasDescription)), children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(SelectCardCheckboxGroupItem, { option, groupState: state, isSelected: values.includes(option.value), view, ...tid[defaultTestId(option.label)] }, String(option.value))) }) });
15245
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(LabeledGroupField, { label, labelStyle, labelProps, groupProps, errorMsg, helperText, tid, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ...(0, import_runtime55.trussProps)(getSelectCardOptionsCss({
15246
+ view,
15247
+ hasDescription,
15248
+ layout,
15249
+ hasImage
15250
+ })), children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(SelectCardCheckboxGroupItem, { option, groupState: state, isSelected: values.includes(option.value), view, layout, ...tid[defaultTestId(option.label)] }, String(option.value))) }) });
15217
15251
  }
15218
15252
 
15219
15253
  // src/inputs/SelectCard/SelectCardGroup.tsx
@@ -15226,7 +15260,7 @@ var import_react67 = require("react");
15226
15260
  var import_react_aria41 = require("react-aria");
15227
15261
  var import_jsx_runtime81 = require("react/jsx-runtime");
15228
15262
  function SelectCardRadioGroupItem(props) {
15229
- const { option, groupState, isSelected, view, ...others } = props;
15263
+ const { option, groupState, isSelected, view, layout, ...others } = props;
15230
15264
  const { label, description, disabled, tooltip, value } = option;
15231
15265
  const ref = (0, import_react67.useRef)(null);
15232
15266
  const { inputProps, isDisabled: isOptionDisabled } = (0, import_react_aria41.useRadio)(
@@ -15246,7 +15280,8 @@ function SelectCardRadioGroupItem(props) {
15246
15280
  if (view === "list") {
15247
15281
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ListSelectCard, { ...layoutProps });
15248
15282
  }
15249
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(GridSelectCard, { ...layoutProps, icon: option.icon });
15283
+ const gridOption = option;
15284
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(GridSelectCard, { ...layoutProps, layout, icon: gridOption.icon, image: gridOption.image });
15250
15285
  }
15251
15286
 
15252
15287
  // src/inputs/SelectCard/SelectCardGroup.tsx
@@ -15265,9 +15300,11 @@ function SelectCardGroup(props) {
15265
15300
  helperText,
15266
15301
  disabled: isDisabled = false,
15267
15302
  onChange,
15268
- view = "grid"
15303
+ view = "grid",
15304
+ layout
15269
15305
  } = props;
15270
15306
  const hasDescription = (0, import_react68.useMemo)(() => options.some((o) => o.description), [options]);
15307
+ const hasImage = (0, import_react68.useMemo)(() => options.some((o) => "image" in o && o.image), [options]);
15271
15308
  const tid = useTestIds(props, defaultTestId(label));
15272
15309
  const handleChange = (0, import_react68.useCallback)((nextValue) => {
15273
15310
  onChange(nextValue);
@@ -15284,7 +15321,12 @@ function SelectCardGroup(props) {
15284
15321
  label,
15285
15322
  isDisabled
15286
15323
  }, state);
15287
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LabeledGroupField, { label, labelStyle, labelProps, groupProps: radioGroupProps, errorMsg, helperText, tid, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { ...(0, import_runtime56.trussProps)(getSelectCardOptionsCss(view, hasDescription)), children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SelectCardRadioGroupItem, { option, groupState: state, isSelected: value === option.value, view, ...tid[defaultTestId(option.label)] }, String(option.value))) }) });
15324
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LabeledGroupField, { label, labelStyle, labelProps, groupProps: radioGroupProps, errorMsg, helperText, tid, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { ...(0, import_runtime56.trussProps)(getSelectCardOptionsCss({
15325
+ view,
15326
+ hasDescription,
15327
+ layout,
15328
+ hasImage
15329
+ })), children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(SelectCardRadioGroupItem, { option, groupState: state, isSelected: value === option.value, view, layout, ...tid[defaultTestId(option.label)] }, String(option.value))) }) });
15288
15330
  }
15289
15331
 
15290
15332
  // src/inputs/SelectField.tsx
@@ -22631,6 +22673,7 @@ function Card(props) {
22631
22673
  imgSrc,
22632
22674
  imageFit = "contain",
22633
22675
  type = "card",
22676
+ fullWidth = false,
22634
22677
  bordered = false,
22635
22678
  disabled: isDisabled = false,
22636
22679
  buttonMenuItems,
@@ -22647,11 +22690,12 @@ function Card(props) {
22647
22690
  const imgHeight = isList ? 96 : bordered ? 224 : 256;
22648
22691
  const styles = (0, import_react122.useMemo)(() => ({
22649
22692
  ...baseStyles3(type),
22693
+ ...fullWidth && fullWidthStyles,
22650
22694
  ...isList && listStyles,
22651
22695
  ...bordered && borderedStyles,
22652
22696
  ...isHovered && cardHoverStyles,
22653
22697
  ...isDisabled && disabledStyles2
22654
- }), [isDisabled, isHovered, bordered, type, isList]);
22698
+ }), [isDisabled, isHovered, bordered, type, isList, fullWidth]);
22655
22699
  return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { ...(0, import_runtime95.trussProps)(styles), ...hoverProps, ...tid, children: [
22656
22700
  /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { ...(0, import_runtime95.trussProps)({
22657
22701
  ...{
@@ -22669,6 +22713,10 @@ function Card(props) {
22669
22713
  position: "relative",
22670
22714
  filter: "filter_brightness_1"
22671
22715
  },
22716
+ // Once the card follows its container, keep the image at its own size so the title wraps instead.
22717
+ ...fullWidth && {
22718
+ flexShrink: "fs0"
22719
+ },
22672
22720
  ...isHovered && !isList && imageHoverStyles
22673
22721
  }), children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("img", { ...(0, import_runtime95.trussProps)({
22674
22722
  width: "w100",
@@ -22721,6 +22769,9 @@ var baseStyles3 = (type) => ({
22721
22769
  gap: "gap1",
22722
22770
  position: "relative"
22723
22771
  });
22772
+ var fullWidthStyles = {
22773
+ width: "w100"
22774
+ };
22724
22775
  var listStyles = {
22725
22776
  display: "df",
22726
22777
  flexDirection: "fdr",