@homebound/beam 2.385.1 → 2.386.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.d.cts CHANGED
@@ -6463,7 +6463,8 @@ interface CheckboxProps {
6463
6463
  onChange: (selected: boolean) => void;
6464
6464
  /** Additional text displayed below label */
6465
6465
  description?: string;
6466
- disabled?: boolean;
6466
+ /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
6467
+ disabled?: boolean | ReactNode;
6467
6468
  errorMsg?: string;
6468
6469
  helperText?: string | ReactNode;
6469
6470
  /** Callback fired when focus removes from the component */
@@ -7490,11 +7491,11 @@ type TReactNodePrefix<S extends string> = `${typeof reactNodePrefix}${Capitalize
7490
7491
  type CustomReactNodeKey = `${typeof reactNodePrefix}${string}`;
7491
7492
  type BoundFormRowInputs<F> = Partial<{
7492
7493
  [K in keyof F]: BoundFieldInputFn<F>;
7493
- }> & {
7494
+ } & {
7494
7495
  [K in CustomReactNodeKey]: ReactNode;
7495
7496
  } & {
7496
7497
  [K in keyof F as TReactNodePrefix<K & string>]: ReactNode;
7497
- };
7498
+ }>;
7498
7499
  type BoundFormInputConfig<F> = BoundFormRowInputs<F>[];
7499
7500
  type BoundFormProps<F> = {
7500
7501
  rows: BoundFormInputConfig<F>;
@@ -7637,7 +7638,7 @@ type FormPageLayoutProps<F> = {
7637
7638
  breadCrumb?: HeaderBreadcrumb | HeaderBreadcrumb[];
7638
7639
  formState: ObjectState<F>;
7639
7640
  formSections: FormSectionConfig<F>;
7640
- submitAction?: ActionButtonProps;
7641
+ submitAction: ActionButtonProps;
7641
7642
  cancelAction?: ActionButtonProps;
7642
7643
  tertiaryAction?: ActionButtonProps;
7643
7644
  rightSideBar?: SidebarContentProps[];
package/dist/index.d.ts CHANGED
@@ -6463,7 +6463,8 @@ interface CheckboxProps {
6463
6463
  onChange: (selected: boolean) => void;
6464
6464
  /** Additional text displayed below label */
6465
6465
  description?: string;
6466
- disabled?: boolean;
6466
+ /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
6467
+ disabled?: boolean | ReactNode;
6467
6468
  errorMsg?: string;
6468
6469
  helperText?: string | ReactNode;
6469
6470
  /** Callback fired when focus removes from the component */
@@ -7490,11 +7491,11 @@ type TReactNodePrefix<S extends string> = `${typeof reactNodePrefix}${Capitalize
7490
7491
  type CustomReactNodeKey = `${typeof reactNodePrefix}${string}`;
7491
7492
  type BoundFormRowInputs<F> = Partial<{
7492
7493
  [K in keyof F]: BoundFieldInputFn<F>;
7493
- }> & {
7494
+ } & {
7494
7495
  [K in CustomReactNodeKey]: ReactNode;
7495
7496
  } & {
7496
7497
  [K in keyof F as TReactNodePrefix<K & string>]: ReactNode;
7497
- };
7498
+ }>;
7498
7499
  type BoundFormInputConfig<F> = BoundFormRowInputs<F>[];
7499
7500
  type BoundFormProps<F> = {
7500
7501
  rows: BoundFormInputConfig<F>;
@@ -7637,7 +7638,7 @@ type FormPageLayoutProps<F> = {
7637
7638
  breadCrumb?: HeaderBreadcrumb | HeaderBreadcrumb[];
7638
7639
  formState: ObjectState<F>;
7639
7640
  formSections: FormSectionConfig<F>;
7640
- submitAction?: ActionButtonProps;
7641
+ submitAction: ActionButtonProps;
7641
7642
  cancelAction?: ActionButtonProps;
7642
7643
  tertiaryAction?: ActionButtonProps;
7643
7644
  rightSideBar?: SidebarContentProps[];
package/dist/index.js CHANGED
@@ -9198,31 +9198,36 @@ function CheckboxBase(props) {
9198
9198
  errorMsg,
9199
9199
  helperText,
9200
9200
  checkboxOnly = false,
9201
- withLabelElement = true
9201
+ withLabelElement = true,
9202
+ tooltip
9202
9203
  } = props;
9203
9204
  const ref = useRef17(null);
9204
9205
  const { isFocusVisible, focusProps } = useFocusRing5(ariaProps);
9205
9206
  const tid = useTestIds(props, defaultTestId(label));
9206
9207
  const Tag2 = withLabelElement ? "label" : "div";
9207
- return /* @__PURE__ */ jsxs27(
9208
- Tag2,
9209
- {
9210
- css: Css.df.cursorPointer.relative.w("max-content").maxw(px(320)).if(description !== void 0).maxw(px(344)).if(isDisabled).cursorNotAllowed.$,
9211
- "aria-label": label,
9212
- children: [
9213
- /* @__PURE__ */ jsx47(VisuallyHidden3, { children: /* @__PURE__ */ jsx47("input", { ref, ...mergeProps6(inputProps, focusProps), ...tid, "data-indeterminate": isIndeterminate }) }),
9214
- /* @__PURE__ */ jsx47(StyledCheckbox, { ...props, isFocusVisible, ...tid }),
9215
- !checkboxOnly && // Use a mtPx(-2) to better align the label with the checkbox.
9216
- // Not using align-items: center as the checkbox would align with all content below, where we really want it to stay only aligned with the label
9217
- /* @__PURE__ */ jsxs27("div", { css: Css.ml1.mtPx(-2).$, children: [
9218
- label && /* @__PURE__ */ jsx47("div", { css: { ...labelStyles, ...isDisabled && disabledColor }, children: label }),
9219
- description && /* @__PURE__ */ jsx47("div", { css: { ...descStyles, ...isDisabled && disabledColor }, children: description }),
9220
- errorMsg && /* @__PURE__ */ jsx47(ErrorMessage, { errorMsg, ...tid.errorMsg }),
9221
- helperText && /* @__PURE__ */ jsx47(HelperText, { helperText, ...tid.helperText })
9222
- ] })
9223
- ]
9224
- }
9225
- );
9208
+ return maybeTooltip({
9209
+ title: tooltip,
9210
+ placement: "top",
9211
+ children: /* @__PURE__ */ jsxs27(
9212
+ Tag2,
9213
+ {
9214
+ css: Css.df.cursorPointer.relative.w("max-content").maxw(px(320)).if(description !== void 0).maxw(px(344)).if(isDisabled).cursorNotAllowed.$,
9215
+ "aria-label": label,
9216
+ children: [
9217
+ /* @__PURE__ */ jsx47(VisuallyHidden3, { children: /* @__PURE__ */ jsx47("input", { ref, ...mergeProps6(inputProps, focusProps), ...tid, "data-indeterminate": isIndeterminate }) }),
9218
+ /* @__PURE__ */ jsx47(StyledCheckbox, { ...props, isFocusVisible, ...tid }),
9219
+ !checkboxOnly && // Use a mtPx(-2) to better align the label with the checkbox.
9220
+ // Not using align-items: center as the checkbox would align with all content below, where we really want it to stay only aligned with the label
9221
+ /* @__PURE__ */ jsxs27("div", { css: Css.ml1.mtPx(-2).$, children: [
9222
+ label && /* @__PURE__ */ jsx47("div", { css: { ...labelStyles, ...isDisabled && disabledColor }, children: label }),
9223
+ description && /* @__PURE__ */ jsx47("div", { css: { ...descStyles, ...isDisabled && disabledColor }, children: description }),
9224
+ errorMsg && /* @__PURE__ */ jsx47(ErrorMessage, { errorMsg, ...tid.errorMsg }),
9225
+ helperText && /* @__PURE__ */ jsx47(HelperText, { helperText, ...tid.helperText })
9226
+ ] })
9227
+ ]
9228
+ }
9229
+ )
9230
+ });
9226
9231
  }
9227
9232
  var baseStyles2 = Css.hPx(16).mw(px(16)).relative.ba.bcGray300.br4.bgWhite.transition.$;
9228
9233
  var filledBoxStyles = Css.bcBlue700.bgBlue700.$;
@@ -10660,10 +10665,10 @@ import { useCheckbox } from "react-aria";
10660
10665
  import { useToggleState } from "react-stately";
10661
10666
  import { jsx as jsx57 } from "@emotion/react/jsx-runtime";
10662
10667
  function Checkbox(props) {
10663
- const { label, disabled: isDisabled = false, selected, ...otherProps } = props;
10668
+ const { label, disabled = false, selected, ...otherProps } = props;
10664
10669
  const isSelected = selected === true;
10665
10670
  const isIndeterminate = selected === "indeterminate";
10666
- const ariaProps = { isSelected, isDisabled, isIndeterminate, ...otherProps };
10671
+ const ariaProps = { isSelected, isDisabled: !!disabled, isIndeterminate, ...otherProps };
10667
10672
  const checkboxProps = { ...ariaProps, "aria-label": label };
10668
10673
  const ref = useRef24(null);
10669
10674
  const toggleState = useToggleState(ariaProps);
@@ -10672,11 +10677,12 @@ function Checkbox(props) {
10672
10677
  CheckboxBase,
10673
10678
  {
10674
10679
  ariaProps,
10675
- isDisabled,
10680
+ isDisabled: ariaProps.isDisabled,
10676
10681
  isIndeterminate,
10677
10682
  isSelected,
10678
10683
  inputProps,
10679
10684
  label,
10685
+ tooltip: resolveTooltip(disabled),
10680
10686
  ...otherProps
10681
10687
  }
10682
10688
  );
@@ -14030,7 +14036,6 @@ function SuperDrawer() {
14030
14036
  }
14031
14037
 
14032
14038
  // src/components/Layout/FormPageLayout.tsx
14033
- import { Observer as Observer19 } from "mobx-react";
14034
14039
  import React13, { createRef, useCallback as useCallback16, useEffect as useEffect21, useMemo as useMemo28, useRef as useRef41, useState as useState32 } from "react";
14035
14040
  import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
14036
14041
 
@@ -14886,7 +14891,7 @@ function BoundForm(props) {
14886
14891
  function FormRow({ row, formState }) {
14887
14892
  const tid = useTestIds({}, "boundFormRow");
14888
14893
  const componentsWithConfig = useMemo27(() => {
14889
- return safeEntries(row).map(([key, fieldFnOrCustomNode]) => {
14894
+ return Object.entries(row).map(([key, fieldFnOrCustomNode]) => {
14890
14895
  if (typeof fieldFnOrCustomNode === "function" && !isCustomReactNodeKey(key)) {
14891
14896
  const field = formState[key] ?? fail(`Field ${key.toString()} not found in formState`);
14892
14897
  const fieldFn = fieldFnOrCustomNode ?? fail(`Field function not defined for key ${key.toLocaleString()}`);
@@ -15252,7 +15257,7 @@ function PageHeader(props) {
15252
15257
  breadCrumb && /* @__PURE__ */ jsx120(PageHeaderBreadcrumbs, { breadcrumb: breadCrumb }),
15253
15258
  /* @__PURE__ */ jsx120("h1", { css: Css.xl3Sb.$, ...tids.pageTitle, children: pageTitle })
15254
15259
  ] }),
15255
- /* @__PURE__ */ jsx120(Observer19, { children: () => /* @__PURE__ */ jsxs58("div", { css: Css.df.gap1.$, children: [
15260
+ /* @__PURE__ */ jsxs58("div", { css: Css.df.gap1.$, children: [
15256
15261
  tertiaryAction && /* @__PURE__ */ jsx120(
15257
15262
  Button,
15258
15263
  {
@@ -15260,8 +15265,7 @@ function PageHeader(props) {
15260
15265
  onClick: tertiaryAction.onClick,
15261
15266
  variant: "tertiary",
15262
15267
  disabled: tertiaryAction.disabled,
15263
- tooltip: tertiaryAction.tooltip,
15264
- ...tids.tertiaryAction
15268
+ tooltip: tertiaryAction.tooltip
15265
15269
  }
15266
15270
  ),
15267
15271
  cancelAction && /* @__PURE__ */ jsx120(
@@ -15271,22 +15275,11 @@ function PageHeader(props) {
15271
15275
  onClick: cancelAction.onClick,
15272
15276
  variant: "secondary",
15273
15277
  disabled: cancelAction.disabled,
15274
- tooltip: cancelAction.tooltip,
15275
- ...tids.cancelAction
15278
+ tooltip: cancelAction.tooltip
15276
15279
  }
15277
15280
  ),
15278
- submitAction && /* @__PURE__ */ jsx120(
15279
- Button,
15280
- {
15281
- label: submitAction.label,
15282
- onClick: submitAction.onClick,
15283
- variant: "primary",
15284
- disabled: !formState.valid || submitAction.disabled,
15285
- tooltip: submitAction.tooltip,
15286
- ...tids.submitAction
15287
- }
15288
- )
15289
- ] }) })
15281
+ /* @__PURE__ */ jsx120(SubmitButton, { form: formState, ...submitAction })
15282
+ ] })
15290
15283
  ] }) });
15291
15284
  }
15292
15285
  function FormSections(props) {