@homebound/beam 3.107.0 → 3.108.1
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 +49 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +79 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19541,7 +19541,7 @@ function AiCard(props) {
|
|
|
19541
19541
|
"--backgroundColor": "var(--b-surface)"
|
|
19542
19542
|
}],
|
|
19543
19543
|
boxShadow: "bshBasic"
|
|
19544
|
-
}), ...tid.card, children })
|
|
19544
|
+
}), ...others, ...tid.card, children })
|
|
19545
19545
|
] });
|
|
19546
19546
|
}
|
|
19547
19547
|
var aiBackgroundPaddingCss = {
|
|
@@ -19727,13 +19727,14 @@ var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
|
19727
19727
|
function AiLoadingPanel(props) {
|
|
19728
19728
|
const {
|
|
19729
19729
|
title = "Importing Details...",
|
|
19730
|
-
message = defaultMessage
|
|
19730
|
+
message = defaultMessage,
|
|
19731
|
+
omitBg = false
|
|
19731
19732
|
} = props;
|
|
19732
19733
|
const tid = useTestIds(props, "aiLoadingPanel");
|
|
19733
|
-
|
|
19734
|
+
const card = (
|
|
19734
19735
|
// `status` rather than `alert` so assistive tech waits for a pause instead of interrupting, and
|
|
19735
19736
|
// `aria-busy` so it knows the surrounding content is still settling.
|
|
19736
|
-
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
19737
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(AiCard, { role: "status", "aria-busy": true, size: "lg", ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "df fdc aic gap1 w100 pt2 pb2 pl3 pr3", children: [
|
|
19737
19738
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(AiLoader, {}),
|
|
19738
19739
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("span", { className: "fw6 fz_18px lh_28px purple700 aiBoldBg bgcl_text WebkitBackgroundClip_text wktfc_transparent", ...tid.title, children: title }),
|
|
19739
19740
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("span", { ...(0, import_runtime85.trussProps)({
|
|
@@ -19745,8 +19746,9 @@ function AiLoadingPanel(props) {
|
|
|
19745
19746
|
}],
|
|
19746
19747
|
textAlign: "tac"
|
|
19747
19748
|
}), ...tid.message, children: message })
|
|
19748
|
-
] }) })
|
|
19749
|
+
] }) })
|
|
19749
19750
|
);
|
|
19751
|
+
return omitBg ? card : /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(AiPanel, { padding: "lg", ...tid, children: card });
|
|
19750
19752
|
}
|
|
19751
19753
|
var defaultMessage = "This process can take a few minutes. Feel free to keep working in another tab. Once imported, you may edit or add to content before saving.";
|
|
19752
19754
|
|
|
@@ -21774,7 +21776,8 @@ function DnDGrid(props) {
|
|
|
21774
21776
|
children,
|
|
21775
21777
|
gridStyles,
|
|
21776
21778
|
onReorder,
|
|
21777
|
-
activeItemStyles
|
|
21779
|
+
activeItemStyles,
|
|
21780
|
+
lockAxis
|
|
21778
21781
|
} = props;
|
|
21779
21782
|
const gridEl = (0, import_react107.useRef)(null);
|
|
21780
21783
|
const dragEl = (0, import_react107.useRef)();
|
|
@@ -21841,15 +21844,15 @@ function DnDGrid(props) {
|
|
|
21841
21844
|
const clientY = "clientY" in e ? e.clientY : e.touches[0].clientY;
|
|
21842
21845
|
const left = dragEl.current.style.left ? parseInt(dragEl.current.style.left) : 0;
|
|
21843
21846
|
const top = dragEl.current.style.top ? parseInt(dragEl.current.style.top) : 0;
|
|
21844
|
-
const x = clientX - transformFrom.current.x - left;
|
|
21845
|
-
const y = clientY - transformFrom.current.y - top;
|
|
21847
|
+
const x = lockAxis === "y" ? 0 : clientX - transformFrom.current.x - left;
|
|
21848
|
+
const y = lockAxis === "x" ? 0 : clientY - transformFrom.current.y - top;
|
|
21846
21849
|
dragEl.current.style.transform = `translate(${x}px, ${y}px)`;
|
|
21847
21850
|
const maybeTarget = "touches" in e ? document.elementFromPoint(clientX, clientY) : e.target;
|
|
21848
21851
|
const target = maybeTarget instanceof HTMLElement ? maybeTarget?.closest(`[${gridItemIdKey}]`) : void 0;
|
|
21849
21852
|
if (target instanceof HTMLElement && target !== cloneEl.current && target !== dragEl.current) {
|
|
21850
21853
|
const targetPos = target.getBoundingClientRect();
|
|
21851
21854
|
const clonePos = cloneEl.current.getBoundingClientRect();
|
|
21852
|
-
const useYAxis = Math.abs(targetPos.top - clonePos.top) >= Math.abs(targetPos.left - clonePos.left);
|
|
21855
|
+
const useYAxis = lockAxis === "y" ? true : lockAxis === "x" ? false : Math.abs(targetPos.top - clonePos.top) >= Math.abs(targetPos.left - clonePos.left);
|
|
21853
21856
|
const isHalfwayPassedTarget = useYAxis ? (clientY - targetPos.top) / (targetPos.bottom - targetPos.top) > 0.5 : (clientX - targetPos.left) / (targetPos.right - targetPos.left) > 0.5;
|
|
21854
21857
|
const shouldInsert = isHalfwayPassedTarget && target.nextSibling !== cloneEl.current || !isHalfwayPassedTarget && target.previousSibling !== cloneEl.current;
|
|
21855
21858
|
if (shouldInsert) {
|
|
@@ -21857,7 +21860,18 @@ function DnDGrid(props) {
|
|
|
21857
21860
|
}
|
|
21858
21861
|
}
|
|
21859
21862
|
}
|
|
21860
|
-
}, []);
|
|
21863
|
+
}, [lockAxis]);
|
|
21864
|
+
const onDragEnd = (0, import_react107.useCallback)((e) => {
|
|
21865
|
+
if (!reorderViaKeyboard.current && dragEl.current && cloneEl.current && gridEl.current) {
|
|
21866
|
+
e.preventDefault();
|
|
21867
|
+
cloneEl.current.replaceWith(dragEl.current);
|
|
21868
|
+
gridEl.current.querySelectorAll(`[${gridCloneKey}]`).forEach((el) => el.remove());
|
|
21869
|
+
gridEl.current.style.cursor = "auto";
|
|
21870
|
+
cloneEl.current = void 0;
|
|
21871
|
+
commitReorder();
|
|
21872
|
+
removePointerDragListeners(onMove, onDragEnd);
|
|
21873
|
+
}
|
|
21874
|
+
}, [commitReorder, onMove]);
|
|
21861
21875
|
const onDragStart = (0, import_react107.useCallback)((e) => {
|
|
21862
21876
|
if (!reorderViaKeyboard.current && dragEl.current && gridEl.current) {
|
|
21863
21877
|
const rect = dragEl.current.getBoundingClientRect();
|
|
@@ -21883,22 +21897,12 @@ function DnDGrid(props) {
|
|
|
21883
21897
|
dragEl.current.style.width = `${rect.width}px`;
|
|
21884
21898
|
dragEl.current.style.height = `${rect.height}px`;
|
|
21885
21899
|
gridEl.current.style.cursor = "grabbing";
|
|
21886
|
-
|
|
21887
|
-
gridEl.current.addEventListener("touchmove", onMove);
|
|
21888
|
-
}
|
|
21889
|
-
}, [initReorder, onMove]);
|
|
21890
|
-
const onDragEnd = (0, import_react107.useCallback)((e) => {
|
|
21891
|
-
if (!reorderViaKeyboard.current && dragEl.current && cloneEl.current && gridEl.current) {
|
|
21892
|
-
e.preventDefault();
|
|
21893
|
-
cloneEl.current.replaceWith(dragEl.current);
|
|
21894
|
-
gridEl.current.querySelectorAll(`[${gridCloneKey}]`).forEach((el) => el.remove());
|
|
21895
|
-
gridEl.current.style.cursor = "auto";
|
|
21896
|
-
cloneEl.current = void 0;
|
|
21897
|
-
commitReorder();
|
|
21898
|
-
gridEl.current.removeEventListener("mousemove", onMove);
|
|
21899
|
-
gridEl.current.removeEventListener("touchmove", onMove);
|
|
21900
|
+
addPointerDragListeners(onMove, onDragEnd);
|
|
21900
21901
|
}
|
|
21901
|
-
}, [
|
|
21902
|
+
}, [initReorder, onMove, onDragEnd]);
|
|
21903
|
+
(0, import_react107.useEffect)(() => {
|
|
21904
|
+
return () => removePointerDragListeners(onMove, onDragEnd);
|
|
21905
|
+
}, [onMove, onDragEnd]);
|
|
21902
21906
|
const onDragHandleKeyDown = (0, import_react107.useCallback)((e) => {
|
|
21903
21907
|
const moveHandle = e.target;
|
|
21904
21908
|
if (dragEl.current instanceof HTMLElement && moveHandle instanceof HTMLElement && gridEl.current) {
|
|
@@ -21932,8 +21936,8 @@ function DnDGrid(props) {
|
|
|
21932
21936
|
document.removeEventListener("pointerdown", cancelReorder);
|
|
21933
21937
|
return;
|
|
21934
21938
|
}
|
|
21935
|
-
const movingLeft =
|
|
21936
|
-
const movingRight =
|
|
21939
|
+
const movingLeft = lockAxis !== "x" && e.key === "ArrowUp" || lockAxis !== "y" && e.key === "ArrowLeft";
|
|
21940
|
+
const movingRight = lockAxis !== "x" && e.key === "ArrowDown" || lockAxis !== "y" && e.key === "ArrowRight";
|
|
21937
21941
|
if (movingLeft || movingRight) {
|
|
21938
21942
|
e.preventDefault();
|
|
21939
21943
|
const gridItems = getGridItems();
|
|
@@ -21946,7 +21950,7 @@ function DnDGrid(props) {
|
|
|
21946
21950
|
moveHandle.focus();
|
|
21947
21951
|
}
|
|
21948
21952
|
}
|
|
21949
|
-
}, [cancelReorder, commitReorder, initReorder, getGridItems]);
|
|
21953
|
+
}, [cancelReorder, commitReorder, initReorder, getGridItems, lockAxis]);
|
|
21950
21954
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(DnDGridContext.Provider, { value: {
|
|
21951
21955
|
dragEl,
|
|
21952
21956
|
onDragHandleKeyDown
|
|
@@ -21960,6 +21964,22 @@ function DnDGrid(props) {
|
|
|
21960
21964
|
}
|
|
21961
21965
|
var gridItemIdKey = "dndgrid-itemid";
|
|
21962
21966
|
var gridCloneKey = "dndgrid-clone";
|
|
21967
|
+
function addPointerDragListeners(onMove, onEnd) {
|
|
21968
|
+
document.addEventListener("mousemove", onMove);
|
|
21969
|
+
document.addEventListener("touchmove", onMove);
|
|
21970
|
+
document.addEventListener("mouseup", onEnd);
|
|
21971
|
+
document.addEventListener("touchend", onEnd);
|
|
21972
|
+
document.addEventListener("pointercancel", onEnd);
|
|
21973
|
+
document.addEventListener("touchcancel", onEnd);
|
|
21974
|
+
}
|
|
21975
|
+
function removePointerDragListeners(onMove, onEnd) {
|
|
21976
|
+
document.removeEventListener("mousemove", onMove);
|
|
21977
|
+
document.removeEventListener("touchmove", onMove);
|
|
21978
|
+
document.removeEventListener("mouseup", onEnd);
|
|
21979
|
+
document.removeEventListener("touchend", onEnd);
|
|
21980
|
+
document.removeEventListener("pointercancel", onEnd);
|
|
21981
|
+
document.removeEventListener("touchcancel", onEnd);
|
|
21982
|
+
}
|
|
21963
21983
|
function applyActiveStyles(el, activeStyles3) {
|
|
21964
21984
|
const {
|
|
21965
21985
|
className,
|
|
@@ -22348,7 +22368,7 @@ function DraggableChildren(props) {
|
|
|
22348
22368
|
}
|
|
22349
22369
|
});
|
|
22350
22370
|
};
|
|
22351
|
-
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DnDGrid, { onReorder: handleReorder, gridStyles: {
|
|
22371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DnDGrid, { onReorder: handleReorder, lockAxis: "y", gridStyles: {
|
|
22352
22372
|
gridTemplateColumns: "gtc_minmax_0_1fr",
|
|
22353
22373
|
gap: "gap3"
|
|
22354
22374
|
}, children: sorted.map((child) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(FormSectionChild, { ...child, ...tid }, child.id)) });
|