@homebound/beam 4.33.0 → 4.34.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.js CHANGED
@@ -30435,12 +30435,15 @@ function EnvironmentBannerLayout(props) {
30435
30435
  import { trussProps as trussProps143, maybeCssVar as maybeCssVar68 } from "@homebound/truss/runtime";
30436
30436
 
30437
30437
  // src/forms/FormSection/FormSection.tsx
30438
+ import { useCheckboxGroup as useCheckboxGroup4, useRadioGroup as useRadioGroup3 } from "react-aria";
30439
+ import { useCheckboxGroupState as useCheckboxGroupState4, useRadioGroupState as useRadioGroupState3 } from "react-stately";
30438
30440
  import { trussProps as trussProps141, maybeCssVar as maybeCssVar66 } from "@homebound/truss/runtime";
30439
30441
 
30440
30442
  // src/forms/FormSection/FormSectionChild.tsx
30441
30443
  import { useRef as useRef72 } from "react";
30444
+ import { mergeProps as mergeProps43, useCheckboxGroupItem as useCheckboxGroupItem4, useFocusRing as useFocusRing22, useRadio as useRadio3, VisuallyHidden as VisuallyHidden11 } from "react-aria";
30442
30445
  import { trussProps as trussProps140 } from "@homebound/truss/runtime";
30443
- import { jsx as jsx242, jsxs as jsxs130 } from "react/jsx-runtime";
30446
+ import { Fragment as Fragment52, jsx as jsx242, jsxs as jsxs130 } from "react/jsx-runtime";
30444
30447
  function FormSectionChild(props) {
30445
30448
  const {
30446
30449
  title,
@@ -30448,7 +30451,10 @@ function FormSectionChild(props) {
30448
30451
  actions,
30449
30452
  fields,
30450
30453
  orderField,
30451
- tag
30454
+ tag,
30455
+ value = title,
30456
+ selection,
30457
+ group
30452
30458
  } = props;
30453
30459
  const tid = useTestIds(props, "formSectionChild");
30454
30460
  const itemRef = useRef72(null);
@@ -30460,6 +30466,7 @@ function FormSectionChild(props) {
30460
30466
  id: props.id ?? title,
30461
30467
  itemRef
30462
30468
  });
30469
+ const control = group?.mode === "single" ? /* @__PURE__ */ jsx242(FormSectionChildRadio, { state: group.state, value, label: title, ...tid.radio }) : group?.mode === "multiple" ? /* @__PURE__ */ jsx242(FormSectionChildCheckbox, { state: group.state, value, label: title, ...tid.checkbox }) : selection ? /* @__PURE__ */ jsx242(BoundCheckboxField, { field: selection.field, label: title, checkboxOnly: true, ...tid.checkbox }) : void 0;
30463
30470
  return /* @__PURE__ */ jsxs130("div", { ...isDraggable ? {
30464
30471
  ...dragItemProps,
30465
30472
  ref: itemRef
@@ -30479,10 +30486,73 @@ function FormSectionChild(props) {
30479
30486
  borderStyle: "lot_bsn",
30480
30487
  borderWidth: "lot_bw_0"
30481
30488
  }), ...tid, children: [
30482
- /* @__PURE__ */ jsx242(ContentHeader, { ...tid.header, title, description, actions, level: 4, rightSlotLead: tag && /* @__PURE__ */ jsx242(Tag, { ...tag, ...tid.tag }), startAdornment: isDraggable ? /* @__PURE__ */ jsx242(DnDGridItemHandle, { dragHandleProps, icon: "drag", compact: true }) : void 0 }),
30489
+ /* @__PURE__ */ jsx242(ContentHeader, { ...tid.header, title, description, actions, level: 4, rightSlotLead: tag && /* @__PURE__ */ jsx242(Tag, { ...tag, ...tid.tag }), startAdornment: isDraggable || control ? /* @__PURE__ */ jsxs130(Fragment52, { children: [
30490
+ isDraggable && /* @__PURE__ */ jsx242(DnDGridItemHandle, { dragHandleProps, icon: "drag", compact: true }),
30491
+ control
30492
+ ] }) : void 0 }),
30483
30493
  fields
30484
30494
  ] });
30485
30495
  }
30496
+ function FormSectionChildRadio(props) {
30497
+ const {
30498
+ state,
30499
+ value,
30500
+ label
30501
+ } = props;
30502
+ const ref = useRef72(null);
30503
+ const {
30504
+ inputProps,
30505
+ isDisabled,
30506
+ isSelected
30507
+ } = useRadio3({
30508
+ value,
30509
+ "aria-label": label
30510
+ }, state, ref);
30511
+ const {
30512
+ focusProps,
30513
+ isFocusVisible
30514
+ } = useFocusRing22();
30515
+ const tid = useTestIds(props);
30516
+ return /* @__PURE__ */ jsx242(StyledRadio, { isDisabled, isSelected, isFocusVisible, inputProps: {
30517
+ ...mergeProps43(inputProps, focusProps),
30518
+ ref,
30519
+ ...tid
30520
+ } });
30521
+ }
30522
+ function FormSectionChildCheckbox(props) {
30523
+ const {
30524
+ state,
30525
+ value,
30526
+ label
30527
+ } = props;
30528
+ const ref = useRef72(null);
30529
+ const {
30530
+ inputProps,
30531
+ isDisabled,
30532
+ isSelected
30533
+ } = useCheckboxGroupItem4({
30534
+ value,
30535
+ "aria-label": label
30536
+ }, state, ref);
30537
+ const {
30538
+ focusProps,
30539
+ isFocusVisible
30540
+ } = useFocusRing22();
30541
+ const tid = useTestIds(props);
30542
+ return (
30543
+ // `StyledCheckbox` is just the visual box, so the label makes clicking it toggle the hidden input
30544
+ /* @__PURE__ */ jsxs130("label", { ...trussProps140({
30545
+ display: "df",
30546
+ cursor: "cur_pointer",
30547
+ ...isDisabled ? {
30548
+ cursor: "cur_not_allowed"
30549
+ } : {}
30550
+ }), children: [
30551
+ /* @__PURE__ */ jsx242(VisuallyHidden11, { children: /* @__PURE__ */ jsx242("input", { ref, ...mergeProps43(inputProps, focusProps), ...tid }) }),
30552
+ /* @__PURE__ */ jsx242(StyledCheckbox, { isDisabled, isSelected, isFocusVisible })
30553
+ ] })
30554
+ );
30555
+ }
30486
30556
 
30487
30557
  // src/forms/FormSection/FormSection.tsx
30488
30558
  import { jsx as jsx243, jsxs as jsxs131 } from "react/jsx-runtime";
@@ -30492,7 +30562,8 @@ function FormSection(props) {
30492
30562
  description,
30493
30563
  actions,
30494
30564
  fields,
30495
- childSections
30565
+ childSections,
30566
+ selection
30496
30567
  } = props;
30497
30568
  const tid = useTestIds(props, "formSection");
30498
30569
  return /* @__PURE__ */ jsxs131("div", { id: defaultTestId(title), ...trussProps141({
@@ -30505,15 +30576,94 @@ function FormSection(props) {
30505
30576
  }), ...tid.section, children: [
30506
30577
  /* @__PURE__ */ jsx243(ContentHeader, { ...tid, title, description, actions, level: 3 }),
30507
30578
  fields,
30508
- childSections && (isReorderable(childSections) ? /* @__PURE__ */ jsx243(DraggableChildren, { childSections, ...tid.childSection }) : /* @__PURE__ */ jsx243("div", { className: "df fdc g_3", children: childSections.map((child) => /* @__PURE__ */ jsx243(FormSectionChild, { ...child, ...tid.childSection }, child.id ?? child.title)) }))
30579
+ childSections && (selection?.mode === "single" ? /* @__PURE__ */ jsx243(FormSectionRadioGroup, { field: selection.field, label: title, childSections, ...tid }) : selection?.mode === "multiple" ? /* @__PURE__ */ jsx243(FormSectionCheckboxGroup, { field: selection.field, label: title, childSections, ...tid }) : /* @__PURE__ */ jsx243(ChildSectionList, { childSections, ...tid.childSection }))
30509
30580
  ] });
30510
30581
  }
30582
+ function FormSectionRadioGroup(props) {
30583
+ const {
30584
+ field,
30585
+ label,
30586
+ childSections
30587
+ } = props;
30588
+ const tid = useTestIds(props);
30589
+ const {
30590
+ value,
30591
+ readOnly
30592
+ } = useComputed(() => ({
30593
+ value: field.value ?? null,
30594
+ readOnly: field.readOnly
30595
+ }), [field]);
30596
+ const state = useRadioGroupState3({
30597
+ value,
30598
+ onChange: (value2) => {
30599
+ field.set(value2);
30600
+ field.maybeAutoSave();
30601
+ },
30602
+ isDisabled: readOnly
30603
+ });
30604
+ const {
30605
+ radioGroupProps
30606
+ } = useRadioGroup3({
30607
+ "aria-label": label,
30608
+ isDisabled: readOnly,
30609
+ onFocus: () => field.focus(),
30610
+ onBlur: () => field.blur()
30611
+ }, state);
30612
+ return /* @__PURE__ */ jsx243("div", { ...radioGroupProps, ...tid.childGroup, children: /* @__PURE__ */ jsx243(ChildSectionList, { childSections, group: {
30613
+ mode: "single",
30614
+ state
30615
+ }, ...tid.childSection }) });
30616
+ }
30617
+ function FormSectionCheckboxGroup(props) {
30618
+ const {
30619
+ field,
30620
+ label,
30621
+ childSections
30622
+ } = props;
30623
+ const tid = useTestIds(props);
30624
+ const {
30625
+ value,
30626
+ readOnly
30627
+ } = useComputed(() => ({
30628
+ value: field.value ?? [],
30629
+ readOnly: field.readOnly
30630
+ }), [field]);
30631
+ const state = useCheckboxGroupState4({
30632
+ value,
30633
+ onChange: (values) => {
30634
+ field.set(values);
30635
+ field.maybeAutoSave();
30636
+ },
30637
+ isDisabled: readOnly
30638
+ });
30639
+ const {
30640
+ groupProps
30641
+ } = useCheckboxGroup4({
30642
+ "aria-label": label,
30643
+ isDisabled: readOnly,
30644
+ onFocus: () => field.focus(),
30645
+ onBlur: () => field.blur()
30646
+ }, state);
30647
+ return /* @__PURE__ */ jsx243("div", { ...groupProps, ...tid.childGroup, children: /* @__PURE__ */ jsx243(ChildSectionList, { childSections, group: {
30648
+ mode: "multiple",
30649
+ state
30650
+ }, ...tid.childSection }) });
30651
+ }
30652
+ function ChildSectionList(props) {
30653
+ const {
30654
+ childSections,
30655
+ group,
30656
+ ...tid
30657
+ } = props;
30658
+ return isReorderable(childSections) ? /* @__PURE__ */ jsx243(DraggableChildren, { childSections, group, ...tid }) : /* @__PURE__ */ jsx243("div", { className: "df fdc g_3", children: childSections.map((child) => /* @__PURE__ */ jsx243(FormSectionChild, { ...child, group, ...tid }, child.id ?? child.title)) });
30659
+ }
30511
30660
  function isReorderable(childSections) {
30512
30661
  return childSections.length > 0 && childSections.every((c) => !!c.orderField);
30513
30662
  }
30514
30663
  function DraggableChildren(props) {
30515
30664
  const {
30516
30665
  childSections,
30666
+ group,
30517
30667
  ...tid
30518
30668
  } = props;
30519
30669
  const sorted = sortByOrderField(childSections);
@@ -30531,7 +30681,7 @@ function DraggableChildren(props) {
30531
30681
  return /* @__PURE__ */ jsx243(DnDGrid, { onReorder: handleReorder, lockAxis: "y", gridStyles: {
30532
30682
  gridTemplateColumns: "gtc_minmax_0_1fr",
30533
30683
  gap: "g_3"
30534
- }, children: sorted.map((child) => /* @__PURE__ */ jsx243(FormSectionChild, { ...child, ...tid }, child.id)) });
30684
+ }, children: sorted.map((child) => /* @__PURE__ */ jsx243(FormSectionChild, { ...child, group, ...tid }, child.id)) });
30535
30685
  }
30536
30686
  function sortByOrderField(childSections) {
30537
30687
  return [...childSections].sort((a, b) => (a.orderField.value ?? 0) - (b.orderField.value ?? 0));
@@ -30730,7 +30880,7 @@ function PageBanner(props) {
30730
30880
 
30731
30881
  // src/layouts/NavbarLayout/NavbarLayout.tsx
30732
30882
  import { useMemo as useMemo59, useRef as useRef74 } from "react";
30733
- import { mergeProps as mergeProps43, maybeCssVar as maybeCssVar69 } from "@homebound/truss/runtime";
30883
+ import { mergeProps as mergeProps44, maybeCssVar as maybeCssVar69 } from "@homebound/truss/runtime";
30734
30884
 
30735
30885
  // src/layouts/useAutoHideOnScroll.ts
30736
30886
  import { useLayoutEffect as useLayoutEffect15, useRef as useRef73, useState as useState64 } from "react";
@@ -30893,18 +31043,18 @@ function NavbarLayout(props) {
30893
31043
  top: autoHideState === "hidden" ? `calc(${bannerTop} - ${navHeight}px)` : bannerTop
30894
31044
  };
30895
31045
  const navbarEl = useMemo59(() => /* @__PURE__ */ jsx247(Navbar, { ...navbar }), [navbar]);
30896
- return /* @__PURE__ */ jsx247(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsx247(NavbarLayoutHeightProvider, { value: navbarOffsetPx, children: /* @__PURE__ */ jsx247(MobileSubNavProvider, { children: /* @__PURE__ */ jsxs133("div", { ...mergeProps43(void 0, cssVars, {
31046
+ return /* @__PURE__ */ jsx247(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsx247(NavbarLayoutHeightProvider, { value: navbarOffsetPx, children: /* @__PURE__ */ jsx247(MobileSubNavProvider, { children: /* @__PURE__ */ jsxs133("div", { ...mergeProps44(void 0, cssVars, {
30897
31047
  display: "df",
30898
31048
  flexDirection: "fdc",
30899
31049
  width: "wfc",
30900
31050
  minWidth: "mw100"
30901
31051
  }), ...tid, children: [
30902
- /* @__PURE__ */ jsx247("div", { ref: spacerRef, ...mergeProps43(void 0, {
31052
+ /* @__PURE__ */ jsx247("div", { ref: spacerRef, ...mergeProps44(void 0, {
30903
31053
  height: navHeight
30904
31054
  }, {
30905
31055
  flexShrink: "fs0",
30906
31056
  width: "w100"
30907
- }), children: /* @__PURE__ */ jsx247("div", { ref: navMetricsRef, ...mergeProps43(void 0, innerStyle, innerCss), ...tid.navbar, children: navbarEl }) }),
31057
+ }), children: /* @__PURE__ */ jsx247("div", { ref: navMetricsRef, ...mergeProps44(void 0, innerStyle, innerCss), ...tid.navbar, children: navbarEl }) }),
30908
31058
  /* @__PURE__ */ jsx247("div", { className: "df fdc mh0 mw100 w100", ...tid.body, children })
30909
31059
  ] }) }) }) });
30910
31060
  }
@@ -30989,7 +31139,7 @@ function BaseHeader(props) {
30989
31139
 
30990
31140
  // src/components/Headers/PageHeader.tsx
30991
31141
  import { trussProps as trussProps145 } from "@homebound/truss/runtime";
30992
- import { Fragment as Fragment52, jsx as jsx249, jsxs as jsxs135 } from "react/jsx-runtime";
31142
+ import { Fragment as Fragment53, jsx as jsx249, jsxs as jsxs135 } from "react/jsx-runtime";
30993
31143
  function PageHeader2(props) {
30994
31144
  const {
30995
31145
  tabs,
@@ -31009,7 +31159,7 @@ function PageHeader2(props) {
31009
31159
  /* @__PURE__ */ jsx249(AutoSaveIndicator, { hideOnIdle: true }),
31010
31160
  rightSlotActions.length > 0 && /* @__PURE__ */ jsx249(HeaderActions, { actions: rightSlotActions, collapseOnSm: true }),
31011
31161
  rightSlot
31012
- ] }), bottomSlot: (bottomSlotActions.length > 0 || tabs) && /* @__PURE__ */ jsxs135(Fragment52, { children: [
31162
+ ] }), bottomSlot: (bottomSlotActions.length > 0 || tabs) && /* @__PURE__ */ jsxs135(Fragment53, { children: [
31013
31163
  bottomSlotActions.length > 0 && /* @__PURE__ */ jsx249("div", { ...trussProps145({
31014
31164
  ...pageContentPaddingX,
31015
31165
  ...{
@@ -31085,7 +31235,7 @@ function useBannerAndNavbarHeight() {
31085
31235
  }
31086
31236
 
31087
31237
  // src/layouts/PageHeaderLayout/PageHeaderLayout.tsx
31088
- import { mergeProps as mergeProps44, maybeCssVar as maybeCssVar71 } from "@homebound/truss/runtime";
31238
+ import { mergeProps as mergeProps45, maybeCssVar as maybeCssVar71 } from "@homebound/truss/runtime";
31089
31239
  import { jsx as jsx252, jsxs as jsxs136 } from "react/jsx-runtime";
31090
31240
  var __maybeInc35 = (inc) => {
31091
31241
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
@@ -31140,17 +31290,17 @@ function PageHeaderLayout(props) {
31140
31290
  top: autoHideState === "hidden" ? `calc(${outerTop} - ${headerHeight}px)` : outerTop
31141
31291
  };
31142
31292
  const pageHeaderEl = useMemo60(() => /* @__PURE__ */ jsx252(PageHeader2, { ...pageHeader }), [pageHeader]);
31143
- return /* @__PURE__ */ jsx252(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsxs136("div", { ...mergeProps44(void 0, style, {
31293
+ return /* @__PURE__ */ jsx252(DocumentScrollLayoutProvider, { children: /* @__PURE__ */ jsxs136("div", { ...mergeProps45(void 0, style, {
31144
31294
  display: "df",
31145
31295
  flexDirection: "fdc",
31146
31296
  width: "w100"
31147
31297
  }), ...tid, children: [
31148
- /* @__PURE__ */ jsx252("div", { ref: spacerRef, ...mergeProps44(void 0, {
31298
+ /* @__PURE__ */ jsx252("div", { ref: spacerRef, ...mergeProps45(void 0, {
31149
31299
  height: headerHeight
31150
31300
  }, {
31151
31301
  flexShrink: "fs0",
31152
31302
  width: "w100"
31153
- }), children: /* @__PURE__ */ jsx252("div", { ref: headerMetricsRef, ...mergeProps44(void 0, innerStyle, innerCss), ...tid.pageHeader, children: pageHeaderEl }) }),
31303
+ }), children: /* @__PURE__ */ jsx252("div", { ref: headerMetricsRef, ...mergeProps45(void 0, innerStyle, innerCss), ...tid.pageHeader, children: pageHeaderEl }) }),
31154
31304
  bannerSlot,
31155
31305
  /* @__PURE__ */ jsx252("div", { className: "df fdc fg1 mh0 w100 n_has_data_self_top_spaced_first_child_pt3", ...tid.body, children })
31156
31306
  ] }) });
@@ -31327,7 +31477,7 @@ function WorkflowActions(props) {
31327
31477
  }
31328
31478
 
31329
31479
  // src/layouts/Workflow/WorkflowPageLayout.tsx
31330
- import { trussProps as trussProps148, mergeProps as mergeProps45, maybeCssVar as maybeCssVar73 } from "@homebound/truss/runtime";
31480
+ import { trussProps as trussProps148, mergeProps as mergeProps46, maybeCssVar as maybeCssVar73 } from "@homebound/truss/runtime";
31331
31481
  import { jsx as jsx257, jsxs as jsxs138 } from "react/jsx-runtime";
31332
31482
  var __maybeInc37 = (inc) => {
31333
31483
  return typeof inc === "string" ? inc : `calc(var(--t-spacing) * ${inc})`;
@@ -31393,12 +31543,12 @@ function WorkflowPageLayout(props) {
31393
31543
  };
31394
31544
  }, [showFooter]);
31395
31545
  return /* @__PURE__ */ jsxs138(DocumentScrollLayoutProvider, { children: [
31396
- /* @__PURE__ */ jsxs138("div", { ...mergeProps45(void 0, style, {
31546
+ /* @__PURE__ */ jsxs138("div", { ...mergeProps46(void 0, style, {
31397
31547
  display: "df",
31398
31548
  flexDirection: "fdc",
31399
31549
  width: "w100"
31400
31550
  }), ...tid, children: [
31401
- /* @__PURE__ */ jsx257("div", { ...mergeProps45(void 0, {
31551
+ /* @__PURE__ */ jsx257("div", { ...mergeProps46(void 0, {
31402
31552
  height: headerHeight
31403
31553
  }, {
31404
31554
  flexShrink: "fs0",
@@ -31748,7 +31898,7 @@ function useFilter4({ filterDefs }) {
31748
31898
  import { useCallback as useCallback49, useRef as useRef79 } from "react";
31749
31899
  import { useComboBox as useComboBox3, useOverlayPosition as useOverlayPosition6 } from "react-aria";
31750
31900
  import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stately";
31751
- import { Fragment as Fragment53, jsx as jsx264, jsxs as jsxs141 } from "react/jsx-runtime";
31901
+ import { Fragment as Fragment54, jsx as jsx264, jsxs as jsxs141 } from "react/jsx-runtime";
31752
31902
  function Autocomplete(props) {
31753
31903
  const {
31754
31904
  onSelect,
@@ -31819,7 +31969,7 @@ function Autocomplete(props) {
31819
31969
  // Ensures the menu never gets too small.
31820
31970
  minWidth: 200
31821
31971
  };
31822
- return /* @__PURE__ */ jsxs141(Fragment53, { children: [
31972
+ return /* @__PURE__ */ jsxs141(Fragment54, { children: [
31823
31973
  /* @__PURE__ */ jsx264(
31824
31974
  TextFieldBase,
31825
31975
  {
@@ -31862,7 +32012,7 @@ function Autocomplete(props) {
31862
32012
 
31863
32013
  // src/inputs/ToggleButton.tsx
31864
32014
  import { useRef as useRef80, useState as useState69 } from "react";
31865
- import { useFocusRing as useFocusRing22, useHover as useHover26, usePress as usePress3, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden11 } from "react-aria";
32015
+ import { useFocusRing as useFocusRing23, useHover as useHover26, usePress as usePress3, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden12 } from "react-aria";
31866
32016
  import { useToggleState as useToggleState2 } from "react-stately";
31867
32017
  import { trussProps as trussProps151 } from "@homebound/truss/runtime";
31868
32018
  import { jsx as jsx265, jsxs as jsxs142 } from "react/jsx-runtime";
@@ -31911,7 +32061,7 @@ function ToggleButton(props) {
31911
32061
  const {
31912
32062
  isFocusVisible: isFocusVisibleFromEvents,
31913
32063
  focusProps
31914
- } = useFocusRing22({
32064
+ } = useFocusRing23({
31915
32065
  ...otherProps,
31916
32066
  within: true
31917
32067
  });
@@ -31972,7 +32122,7 @@ function ToggleButton(props) {
31972
32122
  children: /* @__PURE__ */ jsxs142("label", { ...labelAttrs, children: [
31973
32123
  icon && /* @__PURE__ */ jsx265(Icon, { icon }),
31974
32124
  label,
31975
- /* @__PURE__ */ jsx265(VisuallyHidden11, { children: /* @__PURE__ */ jsx265("input", { ref, ...inputProps, ...tid.value }) })
32125
+ /* @__PURE__ */ jsx265(VisuallyHidden12, { children: /* @__PURE__ */ jsx265("input", { ref, ...inputProps, ...tid.value }) })
31976
32126
  ] })
31977
32127
  });
31978
32128
  }