@ohhwells/bridge 0.1.117-next.328 → 0.1.117-next.330

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
@@ -1742,6 +1742,8 @@ function ButtonEl({
1742
1742
  "a",
1743
1743
  {
1744
1744
  href: href || void 0,
1745
+ className: `btn btn--${variant}`,
1746
+ "data-ohw-btn-variant": variant,
1745
1747
  ...linkAttrs,
1746
1748
  style: {
1747
1749
  display: fullWidth ? "flex" : "inline-flex",
@@ -2979,6 +2981,9 @@ function renderNode(node, ctx, path) {
2979
2981
  "button",
2980
2982
  {
2981
2983
  type: "submit",
2984
+ className: "btn btn--primary",
2985
+ "data-ohw-btn-variant": "primary",
2986
+ "data-ohw-role": "button",
2982
2987
  style: {
2983
2988
  alignSelf: submitAlign,
2984
2989
  border: "none",
@@ -15552,10 +15557,10 @@ function FloatingPanel({
15552
15557
  y: fittedY
15553
15558
  };
15554
15559
  (0, import_react14.useEffect)(() => {
15555
- if (!open) {
15556
- setLiveScroll(parentScroll);
15557
- return;
15558
- }
15560
+ setLiveScroll(parentScroll);
15561
+ }, [parentScroll]);
15562
+ (0, import_react14.useEffect)(() => {
15563
+ if (!open) return;
15559
15564
  const onParentScroll = (e) => {
15560
15565
  if (e.data?.type !== "ow:parent-scroll") return;
15561
15566
  const { iframeOffsetTop, headerH, canvasH, promptBarH = 0 } = e.data;
@@ -15563,7 +15568,18 @@ function FloatingPanel({
15563
15568
  };
15564
15569
  window.addEventListener("message", onParentScroll);
15565
15570
  return () => window.removeEventListener("message", onParentScroll);
15566
- }, [open, parentScroll]);
15571
+ }, [open]);
15572
+ const positionRef = (0, import_react14.useRef)(position);
15573
+ (0, import_react14.useLayoutEffect)(() => {
15574
+ if (!open) {
15575
+ positionRef.current = position;
15576
+ return;
15577
+ }
15578
+ if (position == null && positionRef.current != null) {
15579
+ homeRef.current = defaultFloatingPanelPosition(liveScroll ?? parentScroll);
15580
+ }
15581
+ positionRef.current = position;
15582
+ }, [open, position, liveScroll, parentScroll]);
15567
15583
  (0, import_react14.useLayoutEffect)(() => {
15568
15584
  if (!open || !panelRef.current) return;
15569
15585
  const el = panelRef.current;
@@ -21912,6 +21928,7 @@ function OhhwellsBridge() {
21912
21928
  if (id && panel.buttonId !== id) {
21913
21929
  captureButtonOrigin(anchor);
21914
21930
  setFloatingPanelPos(null);
21931
+ setParentScrollSnap(parentScrollRef.current);
21915
21932
  setFloatingPanel({
21916
21933
  ...panel,
21917
21934
  key: `button-style:${id}`,