@storybook/addon-onboarding 11.0.0-alpha.6 → 11.0.0-alpha.8

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.
@@ -5549,14 +5549,30 @@ var ONBOARDING_ARROW_STYLE_ID = "storybook-onboarding-arrow-style", TooltipBody
5549
5549
  )), React10.createElement(TooltipContent, null, step.content)), React10.createElement(TooltipFooter, { id: "buttonNext" }, React10.createElement(Count, null, index + 1, " of ", size), !step.hideNextButton && React10.createElement(NextButton, { ...primaryProps }, index + 1 === size ? "Done" : "Next"))));
5550
5550
 
5551
5551
  // ../../core/src/manager/components/TourGuide/TourGuide.tsx
5552
- var TourGuide = ({
5552
+ var keepTooltipInViewport = {
5553
+ enabled: !0,
5554
+ order: 350,
5555
+ fn: (data) => {
5556
+ let { popper } = data.offsets, parent = data.instance.popper.offsetParent, parentTop = parent ? parent.getBoundingClientRect().top : 0, bottomOverflow = parentTop + popper.top + popper.height - (window.innerHeight - 8);
5557
+ bottomOverflow > 0 && (popper.top -= bottomOverflow);
5558
+ let topOverflow = 8 - (parentTop + popper.top);
5559
+ return topOverflow > 0 && (popper.top += topOverflow), data;
5560
+ }
5561
+ }, TourGuide = ({
5553
5562
  step,
5554
5563
  steps,
5555
5564
  onNext,
5556
5565
  onComplete,
5557
5566
  onDismiss
5558
5567
  }) => {
5559
- let [stepIndex, setStepIndex] = useState(step ? null : 0), theme2 = useTheme(), timeoutRef = useRef(void 0), updateStepIndex = useCallback((index) => {
5568
+ let [stepIndex, setStepIndex] = useState(step ? null : 0), theme2 = useTheme(), resizeObserverRef = useRef(void 0);
5569
+ useEffect3(() => () => resizeObserverRef.current?.disconnect(), []);
5570
+ let followTooltipSize = useCallback(
5571
+ (popper, origin) => {
5572
+ origin === "floater" && (resizeObserverRef.current?.disconnect(), resizeObserverRef.current = new ResizeObserver(() => popper.instance.update()), resizeObserverRef.current.observe(popper.instance.popper));
5573
+ },
5574
+ []
5575
+ ), timeoutRef = useRef(void 0), updateStepIndex = useCallback((index) => {
5560
5576
  clearTimeout(timeoutRef.current), setStepIndex((current) => index === -1 ? null : current === null || current === index ? index : (timeoutRef.current = setTimeout(setStepIndex, 300, index), null));
5561
5577
  }, []);
5562
5578
  useEffect3(
@@ -5570,6 +5586,9 @@ var TourGuide = ({
5570
5586
  disableOverlay: !0,
5571
5587
  spotlightClicks: !0,
5572
5588
  offset: 0,
5589
+ // Joyride would otherwise set `overflow: initial` on a target's scroll container when that
5590
+ // container has nothing to scroll, which the sidebar's scroll area has on a short index.
5591
+ disableScrollParentFix: !0,
5573
5592
  ...step2,
5574
5593
  content: React11.createElement(React11.Fragment, null, step2.content, step2.highlight && React11.createElement(HighlightElement, { targetSelector: step2.highlight, pulsating: !0 })),
5575
5594
  onNext: step2.onNext ? () => step2.onNext?.({ next }) : onNext && (() => onNext?.({ next }))
@@ -5593,7 +5612,13 @@ var TourGuide = ({
5593
5612
  callback,
5594
5613
  tooltipComponent: TourTooltip,
5595
5614
  floaterProps: {
5615
+ getPopper: followTooltipSize,
5596
5616
  disableAnimation: !0,
5617
+ // Popper's own overflow prevention does not hold in the manager, whose body is pinned:
5618
+ // a tooltip next to a target low on the screen runs off the bottom, with its buttons out
5619
+ // of reach. This modifier clamps the tooltip to the viewport after popper has placed it
5620
+ // and before the arrow is positioned, so the arrow still points at the target.
5621
+ options: { keepInViewport: keepTooltipInViewport },
5597
5622
  styles: {
5598
5623
  arrow: {
5599
5624
  length: 20,
package/dist/manager.js CHANGED
@@ -9,7 +9,7 @@ import React, { Suspense, lazy } from "react";
9
9
  import { createRoot } from "react-dom/client";
10
10
  import { STORY_SPECIFIED } from "storybook/internal/core-events";
11
11
  import { addons, internal_universalChecklistStore as checklistStore } from "storybook/manager-api";
12
- var Onboarding = lazy(() => import("./_browser-chunks/Onboarding-GSIT5DYS.js")), Survey = lazy(() => import("./_browser-chunks/Survey-ONUNS54C.js")), root = null, render = (node) => {
12
+ var Onboarding = lazy(() => import("./_browser-chunks/Onboarding-MO6RLPMV.js")), Survey = lazy(() => import("./_browser-chunks/Survey-ONUNS54C.js")), root = null, render = (node) => {
13
13
  let container = document.getElementById("storybook-addon-onboarding");
14
14
  container || (container = document.createElement("div"), container.id = "storybook-addon-onboarding", document.body.appendChild(container)), root = root ?? createRoot(container), root.render(React.createElement(Suspense, { fallback: React.createElement("div", null) }, node));
15
15
  };
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_dmty8t5d51f from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_dmty8t5d51f from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_dmty8t5d51f from "node:module";
1
+ import CJS_COMPAT_NODE_URL_pcrce1bdqsd from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_pcrce1bdqsd from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_pcrce1bdqsd from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_dmty8t5d51f.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_dmty8t5d51f.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_dmty8t5d51f.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_pcrce1bdqsd.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_pcrce1bdqsd.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_pcrce1bdqsd.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,7 +14,7 @@ var require = CJS_COMPAT_NODE_MODULE_dmty8t5d51f.createRequire(import.meta.url);
14
14
  import { telemetry } from "storybook/internal/telemetry";
15
15
 
16
16
  // package.json
17
- var version = "11.0.0-alpha.6";
17
+ var version = "11.0.0-alpha.8";
18
18
 
19
19
  // src/constants.ts
20
20
  var ADDON_ID = "storybook/onboarding", ADDON_ONBOARDING_CHANNEL = `${ADDON_ID}/channel`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-onboarding",
3
- "version": "11.0.0-alpha.6",
3
+ "version": "11.0.0-alpha.8",
4
4
  "description": "Storybook Onboarding: Help new users learn how to write stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -56,7 +56,7 @@
56
56
  "typescript": "^6.0.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "storybook": "^11.0.0-alpha.6"
59
+ "storybook": "^11.0.0-alpha.8"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"