@homebound/beam 4.31.0 → 4.32.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
@@ -207,6 +207,7 @@ __export(index_exports, {
207
207
  StepperLayout: () => StepperLayout,
208
208
  StepperTab: () => StepperTab,
209
209
  StepperTabs: () => StepperTabs,
210
+ StyledRadio: () => StyledRadio,
210
211
  SubmitButton: () => SubmitButton,
211
212
  SuperDrawerContent: () => SuperDrawerContent,
212
213
  SuperDrawerHeader: () => SuperDrawerHeader,
@@ -22292,7 +22293,7 @@ function GridSelectCard(props) {
22292
22293
  // src/inputs/SelectCard/ListSelectCard.tsx
22293
22294
  var import_react_aria45 = require("react-aria");
22294
22295
 
22295
- // src/inputs/SelectCard/StyledRadio.tsx
22296
+ // src/inputs/StyledRadio.tsx
22296
22297
  var import_react_aria44 = require("react-aria");
22297
22298
  var import_runtime101 = require("@homebound/truss/runtime");
22298
22299
 
@@ -22406,12 +22407,13 @@ function getRadioStateStyles({
22406
22407
  return radioUnchecked;
22407
22408
  }
22408
22409
 
22409
- // src/inputs/SelectCard/StyledRadio.tsx
22410
+ // src/inputs/StyledRadio.tsx
22410
22411
  var import_jsx_runtime142 = require("react/jsx-runtime");
22411
22412
  function StyledRadio(props) {
22412
22413
  const {
22413
22414
  isDisabled = false,
22414
22415
  isSelected = false,
22416
+ isFocusVisible = false,
22415
22417
  label,
22416
22418
  inputProps
22417
22419
  } = props;
@@ -22422,18 +22424,29 @@ function StyledRadio(props) {
22422
22424
  isDisabled
22423
22425
  });
22424
22426
  const tid = useTestIds(props, label ? defaultTestId(label) : void 0);
22425
- return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("input", { type: "radio", ...(0, import_runtime101.trussProps)({
22426
- ...radioReset,
22427
- ...radioDefault,
22428
- ...getRadioStateStyles({
22429
- isDisabled,
22430
- isSelected
22431
- }),
22432
- ...isHovered && !isDisabled ? radioHover : {},
22433
- ...{
22434
- flexShrink: "fs0"
22427
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
22428
+ "input",
22429
+ {
22430
+ type: "radio",
22431
+ ...(0, import_runtime101.trussProps)({
22432
+ ...radioReset,
22433
+ ...radioDefault,
22434
+ ...getRadioStateStyles({
22435
+ isDisabled,
22436
+ isSelected
22437
+ }),
22438
+ ...isHovered && !isDisabled ? radioHover : {},
22439
+ ...isFocusVisible ? radioFocus : {},
22440
+ ...{
22441
+ flexShrink: "fs0"
22442
+ }
22443
+ }),
22444
+ disabled: isDisabled,
22445
+ ...hoverProps,
22446
+ ...tid.value,
22447
+ ...inputProps
22435
22448
  }
22436
- }), disabled: isDisabled, ...hoverProps, ...inputProps, ...tid.value });
22449
+ );
22437
22450
  }
22438
22451
 
22439
22452
  // src/inputs/SelectCard/ListSelectCard.tsx
@@ -23077,6 +23090,7 @@ function RadioGroupField(props) {
23077
23090
  helperText,
23078
23091
  layout = "vertical",
23079
23092
  tooltip,
23093
+ renderOption,
23080
23094
  ...otherProps
23081
23095
  } = props;
23082
23096
  const name = (0, import_react101.useMemo)(() => `radio-group-${++nextNameId}`, []);
@@ -23098,6 +23112,7 @@ function RadioGroupField(props) {
23098
23112
  isRequired: required
23099
23113
  }, state);
23100
23114
  const isThumbnail = layout === "thumbnail";
23115
+ const stretchOptions = !!renderOption && !isThumbnail;
23101
23116
  return (
23102
23117
  // default styling to position `<Label />` above.
23103
23118
  /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...(0, import_runtime106.trussProps)({
@@ -23112,7 +23127,14 @@ function RadioGroupField(props) {
23112
23127
  } : {}
23113
23128
  }), ...tid, children: [
23114
23129
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Label, { label, ...labelProps, ...tid.label, suffix: labelSuffix, tooltip, hidden: labelStyle === "hidden" }),
23115
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...radioGroupProps, children: [
23130
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { ...radioGroupProps, ...(0, import_runtime106.trussProps)({
23131
+ ...stretchOptions && labelStyle === "left" ? {
23132
+ flexGrow: "fg1"
23133
+ } : {},
23134
+ ...stretchOptions && labelStyle !== "left" ? {
23135
+ width: "w100"
23136
+ } : {}
23137
+ }), children: [
23116
23138
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { ...(0, import_runtime106.trussProps)({
23117
23139
  display: "df",
23118
23140
  flexDirection: "fdc",
@@ -23132,7 +23154,7 @@ function RadioGroupField(props) {
23132
23154
  ...otherProps,
23133
23155
  ...tid[option.value]
23134
23156
  };
23135
- 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);
23157
+ return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_react101.Fragment, { children: isThumbnail ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ThumbnailRadio, { ...radioProps }) : renderOption ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(CustomRadio, { ...radioProps, renderOption }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Radio, { parentId: name, ...radioProps }) }, option.value);
23136
23158
  }) }),
23137
23159
  errorMsg && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ErrorMessage, { errorMsg, ...tid.errorMsg }),
23138
23160
  helperText && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(HelperText, { helperText })
@@ -23246,6 +23268,43 @@ function Radio(props) {
23246
23268
  ] })
23247
23269
  });
23248
23270
  }
23271
+ function CustomRadio(props) {
23272
+ const {
23273
+ option,
23274
+ state,
23275
+ isOptionDisabled,
23276
+ renderOption,
23277
+ ...others
23278
+ } = props;
23279
+ const ref = (0, import_react101.useRef)(null);
23280
+ const {
23281
+ inputProps,
23282
+ isDisabled
23283
+ } = (0, import_react_aria49.useRadio)({
23284
+ value: option.value,
23285
+ "aria-label": option.label,
23286
+ isDisabled: isOptionDisabled
23287
+ }, state, ref);
23288
+ const isSelected = !isDisabled && state.selectedValue === option.value;
23289
+ const {
23290
+ focusProps,
23291
+ isFocusVisible
23292
+ } = (0, import_react_aria49.useFocusRing)();
23293
+ return maybeTooltip({
23294
+ title: resolveTooltip(option.disabled),
23295
+ placement: "bottom",
23296
+ children: renderOption(option, {
23297
+ // Merge others last b/c it could have data-testid in it or onX events.
23298
+ inputProps: {
23299
+ ...(0, import_react_aria49.mergeProps)(inputProps, focusProps, others),
23300
+ ref
23301
+ },
23302
+ isSelected,
23303
+ isDisabled,
23304
+ isFocusVisible
23305
+ })
23306
+ });
23307
+ }
23249
23308
  function ThumbnailRadio(props) {
23250
23309
  const {
23251
23310
  option: {
@@ -32585,6 +32644,7 @@ var togglePressStyles = {
32585
32644
  StepperLayout,
32586
32645
  StepperTab,
32587
32646
  StepperTabs,
32647
+ StyledRadio,
32588
32648
  SubmitButton,
32589
32649
  SuperDrawerContent,
32590
32650
  SuperDrawerHeader,