@homebound/beam 2.385.1 → 2.387.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
@@ -6044,6 +6044,7 @@ interface AccordionProps<X = AccordionXss> {
6044
6044
  * Allows multiple accordions to be expanded simultaneously (enabled by default)
6045
6045
  */
6046
6046
  index?: number;
6047
+ onToggle?: VoidFunction;
6047
6048
  setExpandedIndex?: Dispatch<SetStateAction<number | undefined>>;
6048
6049
  /** Turns the title into a button. If provided, disables expand/collapse on title text */
6049
6050
  titleOnClick?: VoidFunction;
@@ -6463,7 +6464,8 @@ interface CheckboxProps {
6463
6464
  onChange: (selected: boolean) => void;
6464
6465
  /** Additional text displayed below label */
6465
6466
  description?: string;
6466
- disabled?: boolean;
6467
+ /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
6468
+ disabled?: boolean | ReactNode;
6467
6469
  errorMsg?: string;
6468
6470
  helperText?: string | ReactNode;
6469
6471
  /** Callback fired when focus removes from the component */
@@ -7490,11 +7492,11 @@ type TReactNodePrefix<S extends string> = `${typeof reactNodePrefix}${Capitalize
7490
7492
  type CustomReactNodeKey = `${typeof reactNodePrefix}${string}`;
7491
7493
  type BoundFormRowInputs<F> = Partial<{
7492
7494
  [K in keyof F]: BoundFieldInputFn<F>;
7493
- }> & {
7495
+ } & {
7494
7496
  [K in CustomReactNodeKey]: ReactNode;
7495
7497
  } & {
7496
7498
  [K in keyof F as TReactNodePrefix<K & string>]: ReactNode;
7497
- };
7499
+ }>;
7498
7500
  type BoundFormInputConfig<F> = BoundFormRowInputs<F>[];
7499
7501
  type BoundFormProps<F> = {
7500
7502
  rows: BoundFormInputConfig<F>;
@@ -7637,7 +7639,7 @@ type FormPageLayoutProps<F> = {
7637
7639
  breadCrumb?: HeaderBreadcrumb | HeaderBreadcrumb[];
7638
7640
  formState: ObjectState<F>;
7639
7641
  formSections: FormSectionConfig<F>;
7640
- submitAction?: ActionButtonProps;
7642
+ submitAction: ActionButtonProps;
7641
7643
  cancelAction?: ActionButtonProps;
7642
7644
  tertiaryAction?: ActionButtonProps;
7643
7645
  rightSideBar?: SidebarContentProps[];
package/dist/index.d.ts CHANGED
@@ -6044,6 +6044,7 @@ interface AccordionProps<X = AccordionXss> {
6044
6044
  * Allows multiple accordions to be expanded simultaneously (enabled by default)
6045
6045
  */
6046
6046
  index?: number;
6047
+ onToggle?: VoidFunction;
6047
6048
  setExpandedIndex?: Dispatch<SetStateAction<number | undefined>>;
6048
6049
  /** Turns the title into a button. If provided, disables expand/collapse on title text */
6049
6050
  titleOnClick?: VoidFunction;
@@ -6463,7 +6464,8 @@ interface CheckboxProps {
6463
6464
  onChange: (selected: boolean) => void;
6464
6465
  /** Additional text displayed below label */
6465
6466
  description?: string;
6466
- disabled?: boolean;
6467
+ /** Whether the field is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
6468
+ disabled?: boolean | ReactNode;
6467
6469
  errorMsg?: string;
6468
6470
  helperText?: string | ReactNode;
6469
6471
  /** Callback fired when focus removes from the component */
@@ -7490,11 +7492,11 @@ type TReactNodePrefix<S extends string> = `${typeof reactNodePrefix}${Capitalize
7490
7492
  type CustomReactNodeKey = `${typeof reactNodePrefix}${string}`;
7491
7493
  type BoundFormRowInputs<F> = Partial<{
7492
7494
  [K in keyof F]: BoundFieldInputFn<F>;
7493
- }> & {
7495
+ } & {
7494
7496
  [K in CustomReactNodeKey]: ReactNode;
7495
7497
  } & {
7496
7498
  [K in keyof F as TReactNodePrefix<K & string>]: ReactNode;
7497
- };
7499
+ }>;
7498
7500
  type BoundFormInputConfig<F> = BoundFormRowInputs<F>[];
7499
7501
  type BoundFormProps<F> = {
7500
7502
  rows: BoundFormInputConfig<F>;
@@ -7637,7 +7639,7 @@ type FormPageLayoutProps<F> = {
7637
7639
  breadCrumb?: HeaderBreadcrumb | HeaderBreadcrumb[];
7638
7640
  formState: ObjectState<F>;
7639
7641
  formSections: FormSectionConfig<F>;
7640
- submitAction?: ActionButtonProps;
7642
+ submitAction: ActionButtonProps;
7641
7643
  cancelAction?: ActionButtonProps;
7642
7644
  tertiaryAction?: ActionButtonProps;
7643
7645
  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
  );
@@ -13488,6 +13494,7 @@ function Accordion(props) {
13488
13494
  index,
13489
13495
  setExpandedIndex,
13490
13496
  titleOnClick,
13497
+ onToggle,
13491
13498
  omitPadding = false,
13492
13499
  xss
13493
13500
  } = props;
@@ -13512,7 +13519,8 @@ function Accordion(props) {
13512
13519
  const toggle = useCallback13(() => {
13513
13520
  setExpanded((prev) => !prev);
13514
13521
  if (setExpandedIndex) setExpandedIndex(index);
13515
- }, [index, setExpandedIndex]);
13522
+ if (onToggle) onToggle();
13523
+ }, [index, setExpandedIndex, onToggle]);
13516
13524
  const touchableStyle = useMemo22(
13517
13525
  () => ({
13518
13526
  ...Css.df.jcsb.gapPx(12).aic.p2.baseMd.outline("none").onHover.bgGray100.if(!!titleOnClick).baseSb.$,
@@ -14030,7 +14038,6 @@ function SuperDrawer() {
14030
14038
  }
14031
14039
 
14032
14040
  // src/components/Layout/FormPageLayout.tsx
14033
- import { Observer as Observer19 } from "mobx-react";
14034
14041
  import React13, { createRef, useCallback as useCallback16, useEffect as useEffect21, useMemo as useMemo28, useRef as useRef41, useState as useState32 } from "react";
14035
14042
  import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
14036
14043
 
@@ -14886,7 +14893,7 @@ function BoundForm(props) {
14886
14893
  function FormRow({ row, formState }) {
14887
14894
  const tid = useTestIds({}, "boundFormRow");
14888
14895
  const componentsWithConfig = useMemo27(() => {
14889
- return safeEntries(row).map(([key, fieldFnOrCustomNode]) => {
14896
+ return Object.entries(row).map(([key, fieldFnOrCustomNode]) => {
14890
14897
  if (typeof fieldFnOrCustomNode === "function" && !isCustomReactNodeKey(key)) {
14891
14898
  const field = formState[key] ?? fail(`Field ${key.toString()} not found in formState`);
14892
14899
  const fieldFn = fieldFnOrCustomNode ?? fail(`Field function not defined for key ${key.toLocaleString()}`);
@@ -15252,7 +15259,7 @@ function PageHeader(props) {
15252
15259
  breadCrumb && /* @__PURE__ */ jsx120(PageHeaderBreadcrumbs, { breadcrumb: breadCrumb }),
15253
15260
  /* @__PURE__ */ jsx120("h1", { css: Css.xl3Sb.$, ...tids.pageTitle, children: pageTitle })
15254
15261
  ] }),
15255
- /* @__PURE__ */ jsx120(Observer19, { children: () => /* @__PURE__ */ jsxs58("div", { css: Css.df.gap1.$, children: [
15262
+ /* @__PURE__ */ jsxs58("div", { css: Css.df.gap1.$, children: [
15256
15263
  tertiaryAction && /* @__PURE__ */ jsx120(
15257
15264
  Button,
15258
15265
  {
@@ -15260,8 +15267,7 @@ function PageHeader(props) {
15260
15267
  onClick: tertiaryAction.onClick,
15261
15268
  variant: "tertiary",
15262
15269
  disabled: tertiaryAction.disabled,
15263
- tooltip: tertiaryAction.tooltip,
15264
- ...tids.tertiaryAction
15270
+ tooltip: tertiaryAction.tooltip
15265
15271
  }
15266
15272
  ),
15267
15273
  cancelAction && /* @__PURE__ */ jsx120(
@@ -15271,22 +15277,11 @@ function PageHeader(props) {
15271
15277
  onClick: cancelAction.onClick,
15272
15278
  variant: "secondary",
15273
15279
  disabled: cancelAction.disabled,
15274
- tooltip: cancelAction.tooltip,
15275
- ...tids.cancelAction
15280
+ tooltip: cancelAction.tooltip
15276
15281
  }
15277
15282
  ),
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
- ] }) })
15283
+ /* @__PURE__ */ jsx120(SubmitButton, { form: formState, ...submitAction })
15284
+ ] })
15290
15285
  ] }) });
15291
15286
  }
15292
15287
  function FormSections(props) {