@homebound/beam 4.9.1 → 4.10.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
@@ -11189,6 +11189,8 @@ function TextFieldBase(props) {
11189
11189
  const compactFieldHeight = 32;
11190
11190
  const showProposal = proposedValue !== void 0;
11191
11191
  const showOriginal = originalValue !== void 0 && originalValue !== "";
11192
+ const originalBelow = showOriginal && !inputProps.readOnly && !compound ? originalValue : void 0;
11193
+ const showErrorAndHelper = alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly;
11192
11194
  const [bgColor, hoverBgColor, disabledBgColor] = showProposal ? ["--b-ai-field-bg" /* AiFieldBg */, "rgba(237, 233, 254, 1)" /* Purple100 */, "--b-field-bg-disabled" /* FieldBgDisabled */] : inputStylePalette ? getInputStylePalette(inputStylePalette) : borderOnHover ? (
11193
11195
  // Use transparent backgrounds to blend with the table row hover color
11194
11196
  ["rgba(0,0,0,0)" /* Transparent */, "rgba(219, 234, 254, 1)" /* Blue100 */, "rgba(247, 245, 245, 1)" /* Gray100 */]
@@ -11514,21 +11516,6 @@ function TextFieldBase(props) {
11514
11516
  children: [
11515
11517
  labelStyle === "inline" && label && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(InlineLabel, { multiline, labelProps, label, ...tid.label }),
11516
11518
  startAdornment && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "df aic asc fs0 br4 pr1", children: startAdornment }),
11517
- showOriginal && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { ...(0, import_runtime31.trussProps)({
11518
- display: "df",
11519
- alignItems: "aic",
11520
- flexShrink: "fs0",
11521
- paddingRight: "pr1",
11522
- textDecoration: "tdlt",
11523
- color: ["color_var", {
11524
- "--color": "var(--b-on-surface-muted)"
11525
- }],
11526
- ...multiline ? {
11527
- alignSelf: "asfs",
11528
- paddingTop: "pt_11px",
11529
- paddingBottom: "pb_11px"
11530
- } : {}
11531
- }), ...tid.originalValue, children: originalValue }),
11532
11519
  unfocusedPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11533
11520
  "div",
11534
11521
  {
@@ -11578,18 +11565,40 @@ function TextFieldBase(props) {
11578
11565
  }
11579
11566
  )
11580
11567
  }),
11581
- labelStyle !== "left" && (alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11582
- errorMsg && !errorInTooltip && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
11583
- helperText && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HelperText, { helperText, ...tid.helperText })
11568
+ labelStyle !== "left" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11569
+ originalBelow && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(OriginalValue, { originalValue: originalBelow, ...tid.originalValue }),
11570
+ showErrorAndHelper && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11571
+ errorMsg && !errorInTooltip && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
11572
+ helperText && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HelperText, { helperText, ...tid.helperText })
11573
+ ] })
11584
11574
  ] })
11585
11575
  ] }),
11586
- labelStyle === "left" && (alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly && (errorMsg && !errorInTooltip || helperText)) && // Reduces the margin between the error/helper text and input field
11576
+ labelStyle === "left" && (originalBelow || alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly && (errorMsg && !errorInTooltip || helperText)) && // Reduces the margin between the error/helper text and input field
11587
11577
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mt_neg8px", children: [
11588
- errorMsg && !errorInTooltip && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
11589
- helperText && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HelperText, { helperText, ...tid.helperText })
11578
+ originalBelow && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(OriginalValue, { originalValue: originalBelow, ...tid.originalValue }),
11579
+ showErrorAndHelper && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11580
+ errorMsg && !errorInTooltip && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
11581
+ helperText && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HelperText, { helperText, ...tid.helperText })
11582
+ ] })
11590
11583
  ] })
11591
11584
  ] });
11592
11585
  }
11586
+ function OriginalValue(props) {
11587
+ const {
11588
+ originalValue,
11589
+ ...others
11590
+ } = props;
11591
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ...(0, import_runtime31.trussProps)({
11592
+ color: ["color_var", {
11593
+ "--color": "var(--b-text-helper)"
11594
+ }],
11595
+ fontWeight: "fw4",
11596
+ fontSize: "fz_12px",
11597
+ lineHeight: "lh_16px",
11598
+ marginTop: "mt_4px",
11599
+ textDecoration: "tdlt"
11600
+ }), ...others, children: originalValue });
11601
+ }
11593
11602
  function getInputStylePalette(inputStylePalette) {
11594
11603
  switch (inputStylePalette) {
11595
11604
  case "success":
@@ -29407,6 +29416,7 @@ function useUnsavedChangesGuard(options) {
29407
29416
  isDirtyRef.current = isDirty;
29408
29417
  const allowNavigationRef = (0, import_react167.useRef)(allowNavigation);
29409
29418
  allowNavigationRef.current = allowNavigation;
29419
+ const allowCancelNavigationRef = (0, import_react167.useRef)(false);
29410
29420
  (0, import_react167.useEffect)(() => {
29411
29421
  const onBeforeUnload = (e) => {
29412
29422
  if (isDirtyRef.current?.()) {
@@ -29417,8 +29427,16 @@ function useUnsavedChangesGuard(options) {
29417
29427
  return () => window.removeEventListener("beforeunload", onBeforeUnload);
29418
29428
  }, []);
29419
29429
  const blocker = (0, import_react_router_dom9.useBlocker)((args) => {
29430
+ if (allowCancelNavigationRef.current) {
29431
+ return false;
29432
+ }
29420
29433
  return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
29421
29434
  });
29435
+ const confirmCancel = (e) => {
29436
+ allowCancelNavigationRef.current = true;
29437
+ onCancel(e);
29438
+ allowCancelNavigationRef.current = false;
29439
+ };
29422
29440
  const onCancelClick = (e) => {
29423
29441
  if (!isDirty?.()) {
29424
29442
  onCancel(e);
@@ -29426,7 +29444,7 @@ function useUnsavedChangesGuard(options) {
29426
29444
  }
29427
29445
  openModal({
29428
29446
  allowClosing: false,
29429
- content: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(ConfirmCloseModal, { onClose: () => onCancel(e) })
29447
+ content: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(ConfirmCloseModal, { onClose: () => confirmCancel(e) })
29430
29448
  });
29431
29449
  };
29432
29450
  const navigationBlocker = blocker.state === "blocked" ? { proceed: () => blocker.proceed?.(), cancelNavigation: () => blocker.reset?.() } : void 0;