@homebound/beam 3.59.1 → 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,
@@ -14925,7 +14926,15 @@ function SelectCardShell(props) {
14925
14926
  borderColor: "bcGray300",
14926
14927
  width: "w100"
14927
14928
  },
14928
- ...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
+ } : {
14929
14938
  alignItems: "aic",
14930
14939
  gap: "gap1",
14931
14940
  paddingLeft: "pl2",
@@ -14961,7 +14970,7 @@ function SelectCardShell(props) {
14961
14970
  ...isFocusVisible ? {
14962
14971
  boxShadow: "bshFocus"
14963
14972
  } : {}
14964
- }), [view, isDisabled, isHovered, isSelected, isFocusVisible, isPressed]);
14973
+ }), [view, layout, isDisabled, isHovered, isSelected, isFocusVisible, isPressed]);
14965
14974
  const tid = useTestIds(props, defaultTestId(label));
14966
14975
  return maybeTooltip({
14967
14976
  title: resolveTooltip(isDisabled, tooltip),
@@ -14984,6 +14993,8 @@ var import_jsx_runtime76 = require("react/jsx-runtime");
14984
14993
  function GridSelectCard(props) {
14985
14994
  const {
14986
14995
  icon,
14996
+ image,
14997
+ layout,
14987
14998
  label,
14988
14999
  description,
14989
15000
  selected: isSelected = false,
@@ -14994,9 +15005,17 @@ function GridSelectCard(props) {
14994
15005
  ...others
14995
15006
  } = props;
14996
15007
  const tid = useTestIds(props, defaultTestId(label));
14997
- 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: [
14998
15009
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react_aria36.VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("input", { ...inputProps, ...tid.value }) }),
14999
- /* @__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 */ }),
15000
15019
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "df fdc gap_4px w100", children: [
15001
15020
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { ...(0, import_runtime51.trussProps)({
15002
15021
  fontWeight: "fw6",
@@ -15110,7 +15129,7 @@ function ListSelectCard(props) {
15110
15129
  // src/inputs/SelectCard/SelectCardCheckboxGroupItem.tsx
15111
15130
  var import_jsx_runtime79 = require("react/jsx-runtime");
15112
15131
  function SelectCardCheckboxGroupItem(props) {
15113
- const { option, groupState, isSelected, view, ...others } = props;
15132
+ const { option, groupState, isSelected, view, layout, ...others } = props;
15114
15133
  const { label, description, disabled, tooltip, value } = option;
15115
15134
  const ref = (0, import_react65.useRef)(null);
15116
15135
  const { inputProps, isDisabled: isOptionDisabled } = (0, import_react_aria39.useCheckboxGroupItem)(
@@ -15130,7 +15149,8 @@ function SelectCardCheckboxGroupItem(props) {
15130
15149
  if (view === "list") {
15131
15150
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ListSelectCard, { ...layoutProps });
15132
15151
  }
15133
- 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 });
15134
15154
  }
15135
15155
 
15136
15156
  // src/inputs/SelectCard/utils.ts
@@ -15157,14 +15177,20 @@ function findToggledSelectCardGroupValue(prev, next) {
15157
15177
  if (added !== void 0) return added;
15158
15178
  return prev.find((v) => !next.includes(v));
15159
15179
  }
15160
- function getSelectCardOptionsCss(view, hasDescription) {
15161
- const cardWidth = hasDescription ? 192 : 142;
15162
- return view === "list" ? {
15180
+ function getSelectCardOptionsCss({
15181
+ view,
15182
+ hasDescription,
15183
+ layout,
15184
+ hasImage
15185
+ }) {
15186
+ if (view === "list") return {
15163
15187
  display: "df",
15164
15188
  flexDirection: "fdc",
15165
15189
  gap: "gap2",
15166
15190
  width: "w100"
15167
- } : {
15191
+ };
15192
+ const cardWidth = layout === "horizontal" ? hasImage ? 360 : 240 : hasImage || hasDescription ? 192 : 142;
15193
+ return {
15168
15194
  display: "dg",
15169
15195
  gridTemplateColumns: ["gtc_var", {
15170
15196
  "--gridTemplateColumns": (0, import_runtime54.maybeCssVar)(`repeat(auto-fill, minmax(${cardWidth}px, 1fr))`)
@@ -15189,9 +15215,11 @@ function MultiSelectCardGroup(props) {
15189
15215
  helperText,
15190
15216
  disabled: isDisabled = false,
15191
15217
  onChange,
15192
- view = "grid"
15218
+ view = "grid",
15219
+ layout
15193
15220
  } = props;
15194
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]);
15195
15223
  const tid = useTestIds(props, defaultTestId(label));
15196
15224
  const handleChange = (0, import_react66.useCallback)((nextFromAria) => {
15197
15225
  const clicked = findToggledSelectCardGroupValue(values, nextFromAria);
@@ -15214,7 +15242,12 @@ function MultiSelectCardGroup(props) {
15214
15242
  label,
15215
15243
  isDisabled
15216
15244
  }, state);
15217
- 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))) }) });
15218
15251
  }
15219
15252
 
15220
15253
  // src/inputs/SelectCard/SelectCardGroup.tsx
@@ -15227,7 +15260,7 @@ var import_react67 = require("react");
15227
15260
  var import_react_aria41 = require("react-aria");
15228
15261
  var import_jsx_runtime81 = require("react/jsx-runtime");
15229
15262
  function SelectCardRadioGroupItem(props) {
15230
- const { option, groupState, isSelected, view, ...others } = props;
15263
+ const { option, groupState, isSelected, view, layout, ...others } = props;
15231
15264
  const { label, description, disabled, tooltip, value } = option;
15232
15265
  const ref = (0, import_react67.useRef)(null);
15233
15266
  const { inputProps, isDisabled: isOptionDisabled } = (0, import_react_aria41.useRadio)(
@@ -15247,7 +15280,8 @@ function SelectCardRadioGroupItem(props) {
15247
15280
  if (view === "list") {
15248
15281
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ListSelectCard, { ...layoutProps });
15249
15282
  }
15250
- 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 });
15251
15285
  }
15252
15286
 
15253
15287
  // src/inputs/SelectCard/SelectCardGroup.tsx
@@ -15266,9 +15300,11 @@ function SelectCardGroup(props) {
15266
15300
  helperText,
15267
15301
  disabled: isDisabled = false,
15268
15302
  onChange,
15269
- view = "grid"
15303
+ view = "grid",
15304
+ layout
15270
15305
  } = props;
15271
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]);
15272
15308
  const tid = useTestIds(props, defaultTestId(label));
15273
15309
  const handleChange = (0, import_react68.useCallback)((nextValue) => {
15274
15310
  onChange(nextValue);
@@ -15285,7 +15321,12 @@ function SelectCardGroup(props) {
15285
15321
  label,
15286
15322
  isDisabled
15287
15323
  }, state);
15288
- 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))) }) });
15289
15330
  }
15290
15331
 
15291
15332
  // src/inputs/SelectField.tsx
@@ -22632,6 +22673,7 @@ function Card(props) {
22632
22673
  imgSrc,
22633
22674
  imageFit = "contain",
22634
22675
  type = "card",
22676
+ fullWidth = false,
22635
22677
  bordered = false,
22636
22678
  disabled: isDisabled = false,
22637
22679
  buttonMenuItems,
@@ -22648,11 +22690,12 @@ function Card(props) {
22648
22690
  const imgHeight = isList ? 96 : bordered ? 224 : 256;
22649
22691
  const styles = (0, import_react122.useMemo)(() => ({
22650
22692
  ...baseStyles3(type),
22693
+ ...fullWidth && fullWidthStyles,
22651
22694
  ...isList && listStyles,
22652
22695
  ...bordered && borderedStyles,
22653
22696
  ...isHovered && cardHoverStyles,
22654
22697
  ...isDisabled && disabledStyles2
22655
- }), [isDisabled, isHovered, bordered, type, isList]);
22698
+ }), [isDisabled, isHovered, bordered, type, isList, fullWidth]);
22656
22699
  return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { ...(0, import_runtime95.trussProps)(styles), ...hoverProps, ...tid, children: [
22657
22700
  /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { ...(0, import_runtime95.trussProps)({
22658
22701
  ...{
@@ -22670,6 +22713,10 @@ function Card(props) {
22670
22713
  position: "relative",
22671
22714
  filter: "filter_brightness_1"
22672
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
+ },
22673
22720
  ...isHovered && !isList && imageHoverStyles
22674
22721
  }), children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("img", { ...(0, import_runtime95.trussProps)({
22675
22722
  width: "w100",
@@ -22722,6 +22769,9 @@ var baseStyles3 = (type) => ({
22722
22769
  gap: "gap1",
22723
22770
  position: "relative"
22724
22771
  });
22772
+ var fullWidthStyles = {
22773
+ width: "w100"
22774
+ };
22725
22775
  var listStyles = {
22726
22776
  display: "df",
22727
22777
  flexDirection: "fdr",