@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 +40 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +40 -22
- package/dist/index.js.map +1 -1
- package/dist/truss.css +0 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4892,7 +4892,7 @@ type ProposedValueProps = {
|
|
|
4892
4892
|
* Renders an AI proposal as `original proposed`, with the original struck through.
|
|
4893
4893
|
*
|
|
4894
4894
|
* Only used on the read-only path, which renders no input. Editable fields instead style the input's
|
|
4895
|
-
* own text and render the original
|
|
4895
|
+
* own text and render the original in a slot below the field. See `TextFieldBase`.
|
|
4896
4896
|
*/
|
|
4897
4897
|
declare function ProposedValue$1(props: ProposedValueProps): React$1.JSX.Element;
|
|
4898
4898
|
|
|
@@ -7999,7 +7999,7 @@ type TextFieldBaseProps<X> = {
|
|
|
7999
7999
|
unfocusedPlaceholder?: ReactNode;
|
|
8000
8000
|
/** Value proposed by an AI model; puts the field in AI mode. Pre-formatted for display. */
|
|
8001
8001
|
proposedValue?: string;
|
|
8002
|
-
/** The formatted value on record, rendered struck through
|
|
8002
|
+
/** The formatted value on record, rendered struck through below the field. Independent of `proposedValue`. */
|
|
8003
8003
|
originalValue?: string;
|
|
8004
8004
|
/** Called on any edit the user makes, so the owning field can end AI mode. */
|
|
8005
8005
|
onUserEdit?: VoidFunction;
|
package/dist/index.d.ts
CHANGED
|
@@ -4892,7 +4892,7 @@ type ProposedValueProps = {
|
|
|
4892
4892
|
* Renders an AI proposal as `original proposed`, with the original struck through.
|
|
4893
4893
|
*
|
|
4894
4894
|
* Only used on the read-only path, which renders no input. Editable fields instead style the input's
|
|
4895
|
-
* own text and render the original
|
|
4895
|
+
* own text and render the original in a slot below the field. See `TextFieldBase`.
|
|
4896
4896
|
*/
|
|
4897
4897
|
declare function ProposedValue$1(props: ProposedValueProps): React$1.JSX.Element;
|
|
4898
4898
|
|
|
@@ -7999,7 +7999,7 @@ type TextFieldBaseProps<X> = {
|
|
|
7999
7999
|
unfocusedPlaceholder?: ReactNode;
|
|
8000
8000
|
/** Value proposed by an AI model; puts the field in AI mode. Pre-formatted for display. */
|
|
8001
8001
|
proposedValue?: string;
|
|
8002
|
-
/** The formatted value on record, rendered struck through
|
|
8002
|
+
/** The formatted value on record, rendered struck through below the field. Independent of `proposedValue`. */
|
|
8003
8003
|
originalValue?: string;
|
|
8004
8004
|
/** Called on any edit the user makes, so the owning field can end AI mode. */
|
|
8005
8005
|
onUserEdit?: VoidFunction;
|
package/dist/index.js
CHANGED
|
@@ -10714,6 +10714,8 @@ function TextFieldBase(props) {
|
|
|
10714
10714
|
const compactFieldHeight = 32;
|
|
10715
10715
|
const showProposal = proposedValue !== void 0;
|
|
10716
10716
|
const showOriginal = originalValue !== void 0 && originalValue !== "";
|
|
10717
|
+
const originalBelow = showOriginal && !inputProps.readOnly && !compound ? originalValue : void 0;
|
|
10718
|
+
const showErrorAndHelper = alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly;
|
|
10717
10719
|
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 ? (
|
|
10718
10720
|
// Use transparent backgrounds to blend with the table row hover color
|
|
10719
10721
|
["rgba(0,0,0,0)" /* Transparent */, "rgba(219, 234, 254, 1)" /* Blue100 */, "rgba(247, 245, 245, 1)" /* Gray100 */]
|
|
@@ -11039,21 +11041,6 @@ function TextFieldBase(props) {
|
|
|
11039
11041
|
children: [
|
|
11040
11042
|
labelStyle === "inline" && label && /* @__PURE__ */ jsx36(InlineLabel, { multiline, labelProps, label, ...tid.label }),
|
|
11041
11043
|
startAdornment && /* @__PURE__ */ jsx36("span", { className: "df aic asc fs0 br4 pr1", children: startAdornment }),
|
|
11042
|
-
showOriginal && /* @__PURE__ */ jsx36("span", { ...trussProps24({
|
|
11043
|
-
display: "df",
|
|
11044
|
-
alignItems: "aic",
|
|
11045
|
-
flexShrink: "fs0",
|
|
11046
|
-
paddingRight: "pr1",
|
|
11047
|
-
textDecoration: "tdlt",
|
|
11048
|
-
color: ["color_var", {
|
|
11049
|
-
"--color": "var(--b-on-surface-muted)"
|
|
11050
|
-
}],
|
|
11051
|
-
...multiline ? {
|
|
11052
|
-
alignSelf: "asfs",
|
|
11053
|
-
paddingTop: "pt_11px",
|
|
11054
|
-
paddingBottom: "pb_11px"
|
|
11055
|
-
} : {}
|
|
11056
|
-
}), ...tid.originalValue, children: originalValue }),
|
|
11057
11044
|
unfocusedPlaceholder && /* @__PURE__ */ jsx36(
|
|
11058
11045
|
"div",
|
|
11059
11046
|
{
|
|
@@ -11103,18 +11090,40 @@ function TextFieldBase(props) {
|
|
|
11103
11090
|
}
|
|
11104
11091
|
)
|
|
11105
11092
|
}),
|
|
11106
|
-
labelStyle !== "left" &&
|
|
11107
|
-
|
|
11108
|
-
|
|
11093
|
+
labelStyle !== "left" && /* @__PURE__ */ jsxs20(Fragment13, { children: [
|
|
11094
|
+
originalBelow && /* @__PURE__ */ jsx36(OriginalValue, { originalValue: originalBelow, ...tid.originalValue }),
|
|
11095
|
+
showErrorAndHelper && /* @__PURE__ */ jsxs20(Fragment13, { children: [
|
|
11096
|
+
errorMsg && !errorInTooltip && /* @__PURE__ */ jsx36(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
|
|
11097
|
+
helperText && /* @__PURE__ */ jsx36(HelperText, { helperText, ...tid.helperText })
|
|
11098
|
+
] })
|
|
11109
11099
|
] })
|
|
11110
11100
|
] }),
|
|
11111
|
-
labelStyle === "left" && (alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly && (errorMsg && !errorInTooltip || helperText)) && // Reduces the margin between the error/helper text and input field
|
|
11101
|
+
labelStyle === "left" && (originalBelow || alwaysShowHelperText || !compound && !inputProps.disabled && !inputProps.readOnly && (errorMsg && !errorInTooltip || helperText)) && // Reduces the margin between the error/helper text and input field
|
|
11112
11102
|
/* @__PURE__ */ jsxs20("div", { className: "mt_neg8px", children: [
|
|
11113
|
-
|
|
11114
|
-
|
|
11103
|
+
originalBelow && /* @__PURE__ */ jsx36(OriginalValue, { originalValue: originalBelow, ...tid.originalValue }),
|
|
11104
|
+
showErrorAndHelper && /* @__PURE__ */ jsxs20(Fragment13, { children: [
|
|
11105
|
+
errorMsg && !errorInTooltip && /* @__PURE__ */ jsx36(ErrorMessage, { id: errorMessageId, errorMsg, hidden: hideErrorMessage, ...tid.errorMsg }),
|
|
11106
|
+
helperText && /* @__PURE__ */ jsx36(HelperText, { helperText, ...tid.helperText })
|
|
11107
|
+
] })
|
|
11115
11108
|
] })
|
|
11116
11109
|
] });
|
|
11117
11110
|
}
|
|
11111
|
+
function OriginalValue(props) {
|
|
11112
|
+
const {
|
|
11113
|
+
originalValue,
|
|
11114
|
+
...others
|
|
11115
|
+
} = props;
|
|
11116
|
+
return /* @__PURE__ */ jsx36("div", { ...trussProps24({
|
|
11117
|
+
color: ["color_var", {
|
|
11118
|
+
"--color": "var(--b-text-helper)"
|
|
11119
|
+
}],
|
|
11120
|
+
fontWeight: "fw4",
|
|
11121
|
+
fontSize: "fz_12px",
|
|
11122
|
+
lineHeight: "lh_16px",
|
|
11123
|
+
marginTop: "mt_4px",
|
|
11124
|
+
textDecoration: "tdlt"
|
|
11125
|
+
}), ...others, children: originalValue });
|
|
11126
|
+
}
|
|
11118
11127
|
function getInputStylePalette(inputStylePalette) {
|
|
11119
11128
|
switch (inputStylePalette) {
|
|
11120
11129
|
case "success":
|
|
@@ -28946,6 +28955,7 @@ function useUnsavedChangesGuard(options) {
|
|
|
28946
28955
|
isDirtyRef.current = isDirty;
|
|
28947
28956
|
const allowNavigationRef = useRef74(allowNavigation);
|
|
28948
28957
|
allowNavigationRef.current = allowNavigation;
|
|
28958
|
+
const allowCancelNavigationRef = useRef74(false);
|
|
28949
28959
|
useEffect40(() => {
|
|
28950
28960
|
const onBeforeUnload = (e) => {
|
|
28951
28961
|
if (isDirtyRef.current?.()) {
|
|
@@ -28956,8 +28966,16 @@ function useUnsavedChangesGuard(options) {
|
|
|
28956
28966
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
28957
28967
|
}, []);
|
|
28958
28968
|
const blocker = useBlocker((args) => {
|
|
28969
|
+
if (allowCancelNavigationRef.current) {
|
|
28970
|
+
return false;
|
|
28971
|
+
}
|
|
28959
28972
|
return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
|
|
28960
28973
|
});
|
|
28974
|
+
const confirmCancel = (e) => {
|
|
28975
|
+
allowCancelNavigationRef.current = true;
|
|
28976
|
+
onCancel(e);
|
|
28977
|
+
allowCancelNavigationRef.current = false;
|
|
28978
|
+
};
|
|
28961
28979
|
const onCancelClick = (e) => {
|
|
28962
28980
|
if (!isDirty?.()) {
|
|
28963
28981
|
onCancel(e);
|
|
@@ -28965,7 +28983,7 @@ function useUnsavedChangesGuard(options) {
|
|
|
28965
28983
|
}
|
|
28966
28984
|
openModal({
|
|
28967
28985
|
allowClosing: false,
|
|
28968
|
-
content: /* @__PURE__ */ jsx237(ConfirmCloseModal, { onClose: () =>
|
|
28986
|
+
content: /* @__PURE__ */ jsx237(ConfirmCloseModal, { onClose: () => confirmCancel(e) })
|
|
28969
28987
|
});
|
|
28970
28988
|
};
|
|
28971
28989
|
const navigationBlocker = blocker.state === "blocked" ? { proceed: () => blocker.proceed?.(), cancelNavigation: () => blocker.reset?.() } : void 0;
|