@homebound/beam 4.8.0 → 4.9.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
@@ -29391,10 +29391,12 @@ var import_react167 = require("react");
29391
29391
  var import_react_router_dom9 = require("react-router-dom");
29392
29392
  var import_jsx_runtime237 = require("react/jsx-runtime");
29393
29393
  function useUnsavedChangesGuard(options) {
29394
- const { isDirty, onCancel } = options;
29394
+ const { isDirty, allowNavigation, onCancel } = options;
29395
29395
  const { openModal } = useModal();
29396
29396
  const isDirtyRef = (0, import_react167.useRef)(isDirty);
29397
29397
  isDirtyRef.current = isDirty;
29398
+ const allowNavigationRef = (0, import_react167.useRef)(allowNavigation);
29399
+ allowNavigationRef.current = allowNavigation;
29398
29400
  (0, import_react167.useEffect)(() => {
29399
29401
  const onBeforeUnload = (e) => {
29400
29402
  if (isDirtyRef.current?.()) {
@@ -29404,7 +29406,9 @@ function useUnsavedChangesGuard(options) {
29404
29406
  window.addEventListener("beforeunload", onBeforeUnload);
29405
29407
  return () => window.removeEventListener("beforeunload", onBeforeUnload);
29406
29408
  }, []);
29407
- const blocker = (0, import_react_router_dom9.useBlocker)(() => !!isDirtyRef.current?.());
29409
+ const blocker = (0, import_react_router_dom9.useBlocker)((args) => {
29410
+ return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
29411
+ });
29408
29412
  const onCancelClick = (e) => {
29409
29413
  if (!isDirty?.()) {
29410
29414
  onCancel(e);
@@ -29474,6 +29478,7 @@ function WorkflowPageLayout(props) {
29474
29478
  stepperTabs,
29475
29479
  aiMode,
29476
29480
  isDirty,
29481
+ allowNavigation,
29477
29482
  children,
29478
29483
  title,
29479
29484
  documentTitleSuffix,
@@ -29490,6 +29495,7 @@ function WorkflowPageLayout(props) {
29490
29495
  navigationBlocker
29491
29496
  } = useUnsavedChangesGuard({
29492
29497
  isDirty,
29498
+ allowNavigation,
29493
29499
  onCancel
29494
29500
  });
29495
29501
  const actions = /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(WorkflowActions, { ...actionProps, aiMode, onCancel: onCancelClick });
@@ -29603,6 +29609,7 @@ function FocusedFormLayout(props) {
29603
29609
  onSaveAndExit,
29604
29610
  primaryDisabled,
29605
29611
  isDirty,
29612
+ allowNavigation,
29606
29613
  aiMode,
29607
29614
  children,
29608
29615
  ...headerProps
@@ -29615,6 +29622,7 @@ function FocusedFormLayout(props) {
29615
29622
  ...headerProps,
29616
29623
  aiMode,
29617
29624
  isDirty,
29625
+ allowNavigation,
29618
29626
  onCancel,
29619
29627
  onSaveAndExit,
29620
29628
  completeLabel,
@@ -29629,7 +29637,18 @@ function FocusedFormLayout(props) {
29629
29637
  var import_react169 = require("react");
29630
29638
  var import_jsx_runtime241 = require("react/jsx-runtime");
29631
29639
  function StepperLayout(props) {
29632
- const { steps, defaultStep, onCancel, completeLabel, onComplete, onSaveAndExit, isDirty, aiMode, ...headerProps } = props;
29640
+ const {
29641
+ steps,
29642
+ defaultStep,
29643
+ onCancel,
29644
+ completeLabel,
29645
+ onComplete,
29646
+ onSaveAndExit,
29647
+ isDirty,
29648
+ allowNavigation,
29649
+ aiMode,
29650
+ ...headerProps
29651
+ } = props;
29633
29652
  const stepTabs = steps.map((step) => ({ ...step, value: defaultTestId(step.label) }));
29634
29653
  const [currentStep, setCurrentStep] = (0, import_react169.useState)(() => getInitialStep(stepTabs, defaultStep));
29635
29654
  const tid = useTestIds(props, "stepperLayout");
@@ -29645,6 +29664,7 @@ function StepperLayout(props) {
29645
29664
  aiMode,
29646
29665
  stepperTabs: { steps: stepTabs, currentStep, onChange: setCurrentStep },
29647
29666
  isDirty,
29667
+ allowNavigation,
29648
29668
  isFirstStep,
29649
29669
  isLastStep,
29650
29670
  onBack: () => {