@homebound/beam 4.28.0 → 4.29.1

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
@@ -13196,7 +13196,9 @@ function Popover(props) {
13196
13196
  if (triggerRef.current?.contains(e)) {
13197
13197
  return true;
13198
13198
  }
13199
- return !(e.closest(".tribute-container") || e.closest("[role='dialog']") || e.closest("[role='alert']"));
13199
+ const dialog = e.closest("[role='dialog']");
13200
+ const isDialogOnTop = !!dialog && !dialog.contains(triggerRef.current);
13201
+ return !(e.closest(".tribute-container") || isDialogOnTop || e.closest("[role='alert']"));
13200
13202
  },
13201
13203
  ...others
13202
13204
  },
@@ -23066,6 +23068,7 @@ function RadioGroupField(props) {
23066
23068
  isDisabled: disabled,
23067
23069
  isRequired: required
23068
23070
  }, state);
23071
+ const isThumbnail = layout === "thumbnail";
23069
23072
  return (
23070
23073
  // default styling to position `<Label />` above.
23071
23074
  /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...(0, import_runtime106.trussProps)({
@@ -23083,20 +23086,24 @@ function RadioGroupField(props) {
23083
23086
  /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...radioGroupProps, children: [
23084
23087
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { ...(0, import_runtime106.trussProps)({
23085
23088
  display: "df",
23086
- ...layout === "horizontal" ? {
23089
+ flexDirection: "fdc",
23090
+ gap: "g_1",
23091
+ ...layout !== "vertical" ? {
23087
23092
  flexDirection: "fdr",
23088
- flexWrap: "fww",
23093
+ flexWrap: "fww"
23094
+ } : {},
23095
+ ...layout === "horizontal" ? {
23089
23096
  gap: "g_3"
23090
- } : {
23091
- flexDirection: "fdc",
23092
- gap: "g_1"
23093
- }
23097
+ } : {}
23094
23098
  }), children: options.map((option) => {
23095
- return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_react101.Fragment, { children: maybeTooltip({
23096
- title: resolveTooltip(option.disabled),
23097
- placement: "bottom",
23098
- children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Radio, { parentId: name, option, state, isOptionDisabled: !!option.disabled, ...otherProps, ...tid[option.value] })
23099
- }) }, option.value);
23099
+ const radioProps = {
23100
+ option,
23101
+ state,
23102
+ isOptionDisabled: !!option.disabled,
23103
+ ...otherProps,
23104
+ ...tid[option.value]
23105
+ };
23106
+ 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);
23100
23107
  }) }),
23101
23108
  errorMsg && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ErrorMessage, { errorMsg, ...tid.errorMsg }),
23102
23109
  helperText && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(HelperText, { helperText })
@@ -23110,7 +23117,8 @@ function Radio(props) {
23110
23117
  option: {
23111
23118
  description,
23112
23119
  label,
23113
- value
23120
+ value,
23121
+ disabled: disabledReason
23114
23122
  },
23115
23123
  state,
23116
23124
  isOptionDisabled,
@@ -23139,71 +23147,198 @@ function Radio(props) {
23139
23147
  } = (0, import_react_aria49.useHover)({
23140
23148
  isDisabled: disabled
23141
23149
  });
23142
- return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23143
- display: "df",
23144
- cursor: "cur_pointer",
23145
- ...disabled ? {
23146
- cursor: "cur_initial"
23147
- } : {}
23148
- }), ...hoverProps, children: [
23149
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
23150
- "input",
23151
- {
23152
- type: "radio",
23153
- ref,
23154
- ...(0, import_runtime106.trussProps)({
23155
- ...radioReset,
23156
- ...radioDefault,
23157
- ...getRadioStateStyles({
23158
- isDisabled: disabled,
23159
- isSelected
23150
+ return maybeTooltip({
23151
+ title: resolveTooltip(disabledReason),
23152
+ placement: "bottom",
23153
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23154
+ display: "df",
23155
+ cursor: "cur_pointer",
23156
+ ...disabled ? {
23157
+ cursor: "cur_initial"
23158
+ } : {}
23159
+ }), ...hoverProps, children: [
23160
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
23161
+ "input",
23162
+ {
23163
+ type: "radio",
23164
+ ref,
23165
+ ...(0, import_runtime106.trussProps)({
23166
+ ...radioReset,
23167
+ ...radioDefault,
23168
+ ...getRadioStateStyles({
23169
+ isDisabled: disabled,
23170
+ isSelected
23171
+ }),
23172
+ ...isHovered && !disabled ? radioHover : {},
23173
+ ...isFocusVisible ? radioFocus : {},
23174
+ // Nudge down so the center of the circle lines up with the label text
23175
+ ...{
23176
+ marginTop: "mt_2px",
23177
+ marginRight: "mr1"
23178
+ }
23160
23179
  }),
23161
- ...isHovered && !disabled ? radioHover : {},
23162
- ...isFocusVisible ? radioFocus : {},
23163
- // Nudge down so the center of the circle lines up with the label text
23164
- ...{
23165
- marginTop: "mt_2px",
23166
- marginRight: "mr1"
23167
- }
23168
- }),
23169
- disabled,
23170
- "aria-labelledby": labelId,
23171
- ...inputProps,
23172
- ...focusProps,
23173
- ...others
23174
- }
23175
- ),
23176
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { children: [
23177
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: labelId, ...(0, import_runtime106.trussProps)({
23178
- fontWeight: "fw4",
23179
- fontSize: "fz_14px",
23180
- lineHeight: "lh_20px",
23181
- color: ["color_var", {
23182
- "--color": "var(--b-on-surface)"
23183
- }],
23184
- ...disabled ? {
23180
+ disabled,
23181
+ "aria-labelledby": labelId,
23182
+ ...inputProps,
23183
+ ...focusProps,
23184
+ ...others
23185
+ }
23186
+ ),
23187
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { children: [
23188
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: labelId, ...(0, import_runtime106.trussProps)({
23189
+ fontWeight: "fw4",
23190
+ fontSize: "fz_14px",
23191
+ lineHeight: "lh_20px",
23185
23192
  color: ["color_var", {
23186
- "--color": "var(--b-text-disabled)"
23187
- }]
23188
- } : {}
23189
- }), ...description ? {
23190
- "aria-describedby": descriptionId
23191
- } : {}, children: label }),
23192
- description && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: descriptionId, ...(0, import_runtime106.trussProps)({
23193
- fontWeight: "fw4",
23194
- fontSize: "fz_14px",
23195
- lineHeight: "lh_20px",
23196
- color: ["color_var", {
23197
- "--color": "var(--b-on-surface-muted)"
23198
- }],
23199
- ...disabled ? {
23193
+ "--color": "var(--b-on-surface)"
23194
+ }],
23195
+ ...disabled ? {
23196
+ color: ["color_var", {
23197
+ "--color": "var(--b-text-disabled)"
23198
+ }]
23199
+ } : {}
23200
+ }), ...description ? {
23201
+ "aria-describedby": descriptionId
23202
+ } : {}, children: label }),
23203
+ description && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { id: descriptionId, ...(0, import_runtime106.trussProps)({
23204
+ fontWeight: "fw4",
23205
+ fontSize: "fz_14px",
23206
+ lineHeight: "lh_20px",
23200
23207
  color: ["color_var", {
23201
- "--color": "var(--b-text-disabled)"
23202
- }]
23203
- } : {}
23204
- }), children: typeof description === "function" ? description() : description })
23208
+ "--color": "var(--b-on-surface-muted)"
23209
+ }],
23210
+ ...disabled ? {
23211
+ color: ["color_var", {
23212
+ "--color": "var(--b-text-disabled)"
23213
+ }]
23214
+ } : {}
23215
+ }), children: typeof description === "function" ? description() : description })
23216
+ ] })
23205
23217
  ] })
23206
- ] });
23218
+ });
23219
+ }
23220
+ function ThumbnailRadio(props) {
23221
+ const {
23222
+ option: {
23223
+ label,
23224
+ value,
23225
+ imgSrc,
23226
+ disabled: disabledReason
23227
+ },
23228
+ state,
23229
+ isOptionDisabled,
23230
+ ...others
23231
+ } = props;
23232
+ const ref = (0, import_react101.useRef)(null);
23233
+ const {
23234
+ inputProps,
23235
+ isDisabled
23236
+ } = (0, import_react_aria49.useRadio)({
23237
+ value,
23238
+ "aria-label": label,
23239
+ isDisabled: isOptionDisabled
23240
+ }, state, ref);
23241
+ const isSelected = !isDisabled && state.selectedValue === value;
23242
+ const {
23243
+ focusProps,
23244
+ isFocusVisible
23245
+ } = (0, import_react_aria49.useFocusRing)();
23246
+ const {
23247
+ hoverProps,
23248
+ isHovered
23249
+ } = (0, import_react_aria49.useHover)({
23250
+ isDisabled
23251
+ });
23252
+ const {
23253
+ pressProps,
23254
+ isPressed
23255
+ } = (0, import_react_aria49.usePress)({
23256
+ isDisabled,
23257
+ preventFocusOnPress: true
23258
+ });
23259
+ return maybeTooltip({
23260
+ // Thumbnails have no visible text, so their label doubles as the tooltip, unless there's a disabled reason.
23261
+ title: resolveTooltip(disabledReason) ?? label,
23262
+ placement: "top",
23263
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("label", { ...(0, import_runtime106.trussProps)({
23264
+ // The padding over the white background is the inner ring between the border and the image.
23265
+ ...{
23266
+ display: "db",
23267
+ flexShrink: "fs0",
23268
+ height: "h_32px",
23269
+ width: "w_32px",
23270
+ paddingTop: "pt_2px",
23271
+ paddingBottom: "pb_2px",
23272
+ paddingRight: "pr_2px",
23273
+ paddingLeft: "pl_2px",
23274
+ borderRadius: "br8",
23275
+ borderStyle: "bss",
23276
+ borderWidth: "bw1",
23277
+ borderColor: ["bc_var", {
23278
+ "--borderColor": "var(--b-field-border-default)"
23279
+ }],
23280
+ backgroundColor: ["bgColor_var", {
23281
+ "--backgroundColor": "var(--b-surface-raised)"
23282
+ }],
23283
+ outline: "ol_0",
23284
+ cursor: "cur_pointer"
23285
+ },
23286
+ // Lets a wrapping `Carousel` snap to each thumbnail.
23287
+ ...{
23288
+ scrollSnapAlign: "ssa_start"
23289
+ },
23290
+ ...isHovered && !isFocusVisible ? {
23291
+ boxShadow: "bshHover"
23292
+ } : {},
23293
+ ...isSelected || isPressed ? {
23294
+ borderColor: ["bc_var", {
23295
+ "--borderColor": "var(--b-primary)"
23296
+ }]
23297
+ } : {},
23298
+ ...isFocusVisible ? {
23299
+ boxShadow: "bshFocus"
23300
+ } : {},
23301
+ ...isDisabled ? {
23302
+ cursor: "cur_not_allowed"
23303
+ } : {}
23304
+ }), "data-selected": isSelected, "data-disabled": isDisabled, ...(0, import_react_aria49.mergeProps)(hoverProps, pressProps), children: [
23305
+ /* @__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 }) }),
23306
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "relative db w100 h100 oh br4", children: [
23307
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("img", { src: imgSrc, alt: label, loading: "lazy", ...(0, import_runtime106.trussProps)({
23308
+ width: "w100",
23309
+ height: "h100",
23310
+ objectFit: "obf_cover",
23311
+ display: "db",
23312
+ ...isDisabled ? {
23313
+ opacity: "o50"
23314
+ } : {}
23315
+ }) }),
23316
+ (isSelected || isPressed) && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { ...(0, import_runtime106.trussProps)({
23317
+ ...{
23318
+ position: "absolute",
23319
+ top: "top0",
23320
+ left: "l_0",
23321
+ width: "w100",
23322
+ height: "h100",
23323
+ pointerEvents: "pen"
23324
+ },
23325
+ ...isSelected ? {
23326
+ backgroundColor: ["bgColor_var", {
23327
+ "--backgroundColor": "var(--b-selection-fill)"
23328
+ }],
23329
+ mixBlendMode: "mbm_multiply"
23330
+ } : {},
23331
+ ...isPressed ? {
23332
+ backgroundColor: ["bgColor_var", {
23333
+ "--backgroundColor": "var(--b-primary)"
23334
+ }],
23335
+ opacity: "o_0_28",
23336
+ mixBlendMode: "mbm_normal"
23337
+ } : {}
23338
+ }) })
23339
+ ] })
23340
+ ] })
23341
+ });
23207
23342
  }
23208
23343
 
23209
23344
  // src/forms/BoundRadioGroupField.tsx