@homebound/beam 4.27.0 → 4.29.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
@@ -20859,6 +20859,7 @@ function ContentHeader(props) {
20859
20859
  level = 2,
20860
20860
  aiMode = false,
20861
20861
  startAdornment,
20862
+ rightSlotLead,
20862
20863
  tooltip,
20863
20864
  xss
20864
20865
  } = props;
@@ -20873,7 +20874,7 @@ function ContentHeader(props) {
20873
20874
  bottomSlotActions,
20874
20875
  rightSlotActions
20875
20876
  } = splitHeaderActionsOnSm(actions, sm);
20876
- const showActionsSlot = !!withAutoSave || rightSlotActions.length > 0;
20877
+ const showActionsSlot = !!withAutoSave || !!rightSlotLead || rightSlotActions.length > 0;
20877
20878
  const {
20878
20879
  tag: Heading,
20879
20880
  css: headingCss
@@ -20921,7 +20922,8 @@ function ContentHeader(props) {
20921
20922
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Heading, { ...(0, import_runtime89.trussProps)(titleCss), ...tid.title, children: title }),
20922
20923
  tooltip && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Icon, { icon: "infoCircle", tooltip, inc: 2 })
20923
20924
  ] }) : descriptionEl,
20924
- showActionsSlot && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "df g_2 fs0", ...tid.actions, children: [
20925
+ showActionsSlot && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "df aic g_2 fs0", ...tid.actions, children: [
20926
+ rightSlotLead,
20925
20927
  withAutoSave && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(AutoSaveIndicator, {}),
20926
20928
  rightSlotActions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(HeaderActions, { actions: rightSlotActions })
20927
20929
  ] })
@@ -23064,6 +23066,7 @@ function RadioGroupField(props) {
23064
23066
  isDisabled: disabled,
23065
23067
  isRequired: required
23066
23068
  }, state);
23069
+ const isThumbnail = layout === "thumbnail";
23067
23070
  return (
23068
23071
  // default styling to position `<Label />` above.
23069
23072
  /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...(0, import_runtime106.trussProps)({
@@ -23081,20 +23084,24 @@ function RadioGroupField(props) {
23081
23084
  /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...radioGroupProps, children: [
23082
23085
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { ...(0, import_runtime106.trussProps)({
23083
23086
  display: "df",
23084
- ...layout === "horizontal" ? {
23087
+ flexDirection: "fdc",
23088
+ gap: "g_1",
23089
+ ...layout !== "vertical" ? {
23085
23090
  flexDirection: "fdr",
23086
- flexWrap: "fww",
23091
+ flexWrap: "fww"
23092
+ } : {},
23093
+ ...layout === "horizontal" ? {
23087
23094
  gap: "g_3"
23088
- } : {
23089
- flexDirection: "fdc",
23090
- gap: "g_1"
23091
- }
23095
+ } : {}
23092
23096
  }), children: options.map((option) => {
23093
- return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_react101.Fragment, { children: maybeTooltip({
23094
- title: resolveTooltip(option.disabled),
23095
- placement: "bottom",
23096
- children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Radio, { parentId: name, option, state, isOptionDisabled: !!option.disabled, ...otherProps, ...tid[option.value] })
23097
- }) }, option.value);
23097
+ const radioProps = {
23098
+ option,
23099
+ state,
23100
+ isOptionDisabled: !!option.disabled,
23101
+ ...otherProps,
23102
+ ...tid[option.value]
23103
+ };
23104
+ return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_react101.Fragment, { children: isThumbnail ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ThumbnailRadio, { ...radioProps }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Radio, { parentId: name, ...radioProps }) }, option.value);
23098
23105
  }) }),
23099
23106
  errorMsg && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ErrorMessage, { errorMsg, ...tid.errorMsg }),
23100
23107
  helperText && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(HelperText, { helperText })
@@ -23108,7 +23115,8 @@ function Radio(props) {
23108
23115
  option: {
23109
23116
  description,
23110
23117
  label,
23111
- value
23118
+ value,
23119
+ disabled: disabledReason
23112
23120
  },
23113
23121
  state,
23114
23122
  isOptionDisabled,
@@ -23137,71 +23145,198 @@ function Radio(props) {
23137
23145
  } = (0, import_react_aria49.useHover)({
23138
23146
  isDisabled: disabled
23139
23147
  });
23140
- return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23141
- display: "df",
23142
- cursor: "cur_pointer",
23143
- ...disabled ? {
23144
- cursor: "cur_initial"
23145
- } : {}
23146
- }), ...hoverProps, children: [
23147
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
23148
- "input",
23149
- {
23150
- type: "radio",
23151
- ref,
23152
- ...(0, import_runtime106.trussProps)({
23153
- ...radioReset,
23154
- ...radioDefault,
23155
- ...getRadioStateStyles({
23156
- isDisabled: disabled,
23157
- isSelected
23148
+ return maybeTooltip({
23149
+ title: resolveTooltip(disabledReason),
23150
+ placement: "bottom",
23151
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23152
+ display: "df",
23153
+ cursor: "cur_pointer",
23154
+ ...disabled ? {
23155
+ cursor: "cur_initial"
23156
+ } : {}
23157
+ }), ...hoverProps, children: [
23158
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
23159
+ "input",
23160
+ {
23161
+ type: "radio",
23162
+ ref,
23163
+ ...(0, import_runtime106.trussProps)({
23164
+ ...radioReset,
23165
+ ...radioDefault,
23166
+ ...getRadioStateStyles({
23167
+ isDisabled: disabled,
23168
+ isSelected
23169
+ }),
23170
+ ...isHovered && !disabled ? radioHover : {},
23171
+ ...isFocusVisible ? radioFocus : {},
23172
+ // Nudge down so the center of the circle lines up with the label text
23173
+ ...{
23174
+ marginTop: "mt_2px",
23175
+ marginRight: "mr1"
23176
+ }
23158
23177
  }),
23159
- ...isHovered && !disabled ? radioHover : {},
23160
- ...isFocusVisible ? radioFocus : {},
23161
- // Nudge down so the center of the circle lines up with the label text
23162
- ...{
23163
- marginTop: "mt_2px",
23164
- marginRight: "mr1"
23165
- }
23166
- }),
23167
- disabled,
23168
- "aria-labelledby": labelId,
23169
- ...inputProps,
23170
- ...focusProps,
23171
- ...others
23172
- }
23173
- ),
23174
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { children: [
23175
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: labelId, ...(0, import_runtime106.trussProps)({
23176
- fontWeight: "fw4",
23177
- fontSize: "fz_14px",
23178
- lineHeight: "lh_20px",
23179
- color: ["color_var", {
23180
- "--color": "var(--b-on-surface)"
23181
- }],
23182
- ...disabled ? {
23178
+ disabled,
23179
+ "aria-labelledby": labelId,
23180
+ ...inputProps,
23181
+ ...focusProps,
23182
+ ...others
23183
+ }
23184
+ ),
23185
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { children: [
23186
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: labelId, ...(0, import_runtime106.trussProps)({
23187
+ fontWeight: "fw4",
23188
+ fontSize: "fz_14px",
23189
+ lineHeight: "lh_20px",
23183
23190
  color: ["color_var", {
23184
- "--color": "var(--b-text-disabled)"
23185
- }]
23186
- } : {}
23187
- }), ...description ? {
23188
- "aria-describedby": descriptionId
23189
- } : {}, children: label }),
23190
- description && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: descriptionId, ...(0, import_runtime106.trussProps)({
23191
- fontWeight: "fw4",
23192
- fontSize: "fz_14px",
23193
- lineHeight: "lh_20px",
23194
- color: ["color_var", {
23195
- "--color": "var(--b-on-surface-muted)"
23196
- }],
23197
- ...disabled ? {
23191
+ "--color": "var(--b-on-surface)"
23192
+ }],
23193
+ ...disabled ? {
23194
+ color: ["color_var", {
23195
+ "--color": "var(--b-text-disabled)"
23196
+ }]
23197
+ } : {}
23198
+ }), ...description ? {
23199
+ "aria-describedby": descriptionId
23200
+ } : {}, children: label }),
23201
+ description && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: descriptionId, ...(0, import_runtime106.trussProps)({
23202
+ fontWeight: "fw4",
23203
+ fontSize: "fz_14px",
23204
+ lineHeight: "lh_20px",
23198
23205
  color: ["color_var", {
23199
- "--color": "var(--b-text-disabled)"
23200
- }]
23201
- } : {}
23202
- }), children: typeof description === "function" ? description() : description })
23206
+ "--color": "var(--b-on-surface-muted)"
23207
+ }],
23208
+ ...disabled ? {
23209
+ color: ["color_var", {
23210
+ "--color": "var(--b-text-disabled)"
23211
+ }]
23212
+ } : {}
23213
+ }), children: typeof description === "function" ? description() : description })
23214
+ ] })
23203
23215
  ] })
23204
- ] });
23216
+ });
23217
+ }
23218
+ function ThumbnailRadio(props) {
23219
+ const {
23220
+ option: {
23221
+ label,
23222
+ value,
23223
+ imgSrc,
23224
+ disabled: disabledReason
23225
+ },
23226
+ state,
23227
+ isOptionDisabled,
23228
+ ...others
23229
+ } = props;
23230
+ const ref = (0, import_react101.useRef)(null);
23231
+ const {
23232
+ inputProps,
23233
+ isDisabled
23234
+ } = (0, import_react_aria49.useRadio)({
23235
+ value,
23236
+ "aria-label": label,
23237
+ isDisabled: isOptionDisabled
23238
+ }, state, ref);
23239
+ const isSelected = !isDisabled && state.selectedValue === value;
23240
+ const {
23241
+ focusProps,
23242
+ isFocusVisible
23243
+ } = (0, import_react_aria49.useFocusRing)();
23244
+ const {
23245
+ hoverProps,
23246
+ isHovered
23247
+ } = (0, import_react_aria49.useHover)({
23248
+ isDisabled
23249
+ });
23250
+ const {
23251
+ pressProps,
23252
+ isPressed
23253
+ } = (0, import_react_aria49.usePress)({
23254
+ isDisabled,
23255
+ preventFocusOnPress: true
23256
+ });
23257
+ return maybeTooltip({
23258
+ // Thumbnails have no visible text, so their label doubles as the tooltip, unless there's a disabled reason.
23259
+ title: resolveTooltip(disabledReason) ?? label,
23260
+ placement: "top",
23261
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23262
+ // The padding over the white background is the inner ring between the border and the image.
23263
+ ...{
23264
+ display: "db",
23265
+ flexShrink: "fs0",
23266
+ height: "h_32px",
23267
+ width: "w_32px",
23268
+ paddingTop: "pt_2px",
23269
+ paddingBottom: "pb_2px",
23270
+ paddingRight: "pr_2px",
23271
+ paddingLeft: "pl_2px",
23272
+ borderRadius: "br8",
23273
+ borderStyle: "bss",
23274
+ borderWidth: "bw1",
23275
+ borderColor: ["bc_var", {
23276
+ "--borderColor": "var(--b-field-border-default)"
23277
+ }],
23278
+ backgroundColor: ["bgColor_var", {
23279
+ "--backgroundColor": "var(--b-surface-raised)"
23280
+ }],
23281
+ outline: "ol_0",
23282
+ cursor: "cur_pointer"
23283
+ },
23284
+ // Lets a wrapping `Carousel` snap to each thumbnail.
23285
+ ...{
23286
+ scrollSnapAlign: "ssa_start"
23287
+ },
23288
+ ...isHovered && !isFocusVisible ? {
23289
+ boxShadow: "bshHover"
23290
+ } : {},
23291
+ ...isSelected || isPressed ? {
23292
+ borderColor: ["bc_var", {
23293
+ "--borderColor": "var(--b-primary)"
23294
+ }]
23295
+ } : {},
23296
+ ...isFocusVisible ? {
23297
+ boxShadow: "bshFocus"
23298
+ } : {},
23299
+ ...isDisabled ? {
23300
+ cursor: "cur_not_allowed"
23301
+ } : {}
23302
+ }), "data-selected": isSelected, "data-disabled": isDisabled, ...(0, import_react_aria49.mergeProps)(hoverProps, pressProps), children: [
23303
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_react_aria49.VisuallyHidden, { elementType: "span", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("input", { ...(0, import_react_aria49.mergeProps)(inputProps, focusProps, others), ref }) }),
23304
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "relative db w100 h100 oh br4", children: [
23305
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("img", { src: imgSrc, alt: label, loading: "lazy", ...(0, import_runtime106.trussProps)({
23306
+ width: "w100",
23307
+ height: "h100",
23308
+ objectFit: "obf_cover",
23309
+ display: "db",
23310
+ ...isDisabled ? {
23311
+ opacity: "o50"
23312
+ } : {}
23313
+ }) }),
23314
+ (isSelected || isPressed) && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { ...(0, import_runtime106.trussProps)({
23315
+ ...{
23316
+ position: "absolute",
23317
+ top: "top0",
23318
+ left: "l_0",
23319
+ width: "w100",
23320
+ height: "h100",
23321
+ pointerEvents: "pen"
23322
+ },
23323
+ ...isSelected ? {
23324
+ backgroundColor: ["bgColor_var", {
23325
+ "--backgroundColor": "var(--b-selection-fill)"
23326
+ }],
23327
+ mixBlendMode: "mbm_multiply"
23328
+ } : {},
23329
+ ...isPressed ? {
23330
+ backgroundColor: ["bgColor_var", {
23331
+ "--backgroundColor": "var(--b-primary)"
23332
+ }],
23333
+ opacity: "o_0_28",
23334
+ mixBlendMode: "mbm_normal"
23335
+ } : {}
23336
+ }) })
23337
+ ] })
23338
+ ] })
23339
+ });
23205
23340
  }
23206
23341
 
23207
23342
  // src/forms/BoundRadioGroupField.tsx
@@ -30604,7 +30739,8 @@ function FormSectionChild(props) {
30604
30739
  description,
30605
30740
  actions,
30606
30741
  fields,
30607
- orderField
30742
+ orderField,
30743
+ tag
30608
30744
  } = props;
30609
30745
  const tid = useTestIds(props, "formSectionChild");
30610
30746
  const itemRef = (0, import_react163.useRef)(null);
@@ -30635,7 +30771,7 @@ function FormSectionChild(props) {
30635
30771
  borderStyle: "lot_bsn",
30636
30772
  borderWidth: "lot_bw_0"
30637
30773
  }), ...tid, children: [
30638
- /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(ContentHeader, { ...tid.header, title, description, actions, level: 4, startAdornment: isDraggable ? /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(DnDGridItemHandle, { dragHandleProps, icon: "drag", compact: true }) : void 0 }),
30774
+ /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(ContentHeader, { ...tid.header, title, description, actions, level: 4, rightSlotLead: tag && /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(Tag, { ...tag, ...tid.tag }), startAdornment: isDraggable ? /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(DnDGridItemHandle, { dragHandleProps, icon: "drag", compact: true }) : void 0 }),
30639
30775
  fields
30640
30776
  ] });
30641
30777
  }