@tent-official/react-walkthrough 1.5.1 → 1.6.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.mjs CHANGED
@@ -623,7 +623,7 @@ var WalkthroughOverlay = ({
623
623
  prevColor,
624
624
  skipColor
625
625
  } = {}) => {
626
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
626
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
627
627
  injectKeyframes();
628
628
  const { activeTour } = useGlobalState();
629
629
  const instanceIdRef = useRef(null);
@@ -946,11 +946,12 @@ var WalkthroughOverlay = ({
946
946
  nextLabel: tourNextLabel = "Next",
947
947
  prevLabel: tourPrevLabel = "Back",
948
948
  skipLabel: tourSkipLabel = "Skip",
949
- doneLabel = "Done"
949
+ doneLabel: tourDoneLabel = "Done"
950
950
  } = activeTour;
951
951
  const nextLabel = (_h = step.nextLabel) != null ? _h : tourNextLabel;
952
952
  const prevLabel = (_i = step.prevLabel) != null ? _i : tourPrevLabel;
953
953
  const skipLabel = (_j = step.skipLabel) != null ? _j : tourSkipLabel;
954
+ const doneLabel = (_k = step.doneLabel) != null ? _k : tourDoneLabel;
954
955
  const advanceStep = (hasTrigger) => {
955
956
  var _a2;
956
957
  const currentOrigIdx = validSteps[currentValidPos]._originalIdx;
@@ -992,12 +993,13 @@ var WalkthroughOverlay = ({
992
993
  const SETTLE_DELAY = 150;
993
994
  const targetEl = document.getElementById(nextElId);
994
995
  if (targetEl) {
995
- let targetStepIdx = -1;
996
- for (let i = currentOrigIdx + 1; i < activeTour.steps.length; i++) {
997
- if (resolveElId(activeTour.steps[i].el) === nextElId) {
998
- targetStepIdx = i;
999
- break;
1000
- }
996
+ let targetStepIdx = activeTour.steps.findIndex(
997
+ (s, i) => i > currentOrigIdx && resolveElId(s.el) === nextElId
998
+ );
999
+ if (targetStepIdx === -1) {
1000
+ targetStepIdx = activeTour.steps.findIndex(
1001
+ (s) => resolveElId(s.el) === nextElId
1002
+ );
1001
1003
  }
1002
1004
  if (targetStepIdx !== -1) {
1003
1005
  const targetStepDef = activeTour.steps[targetStepIdx];
@@ -1142,10 +1144,10 @@ var WalkthroughOverlay = ({
1142
1144
  displayPosRef.current = currentValidPos;
1143
1145
  }
1144
1146
  const ds = displayStepRef.current;
1145
- const dir = (_k = popoverPos == null ? void 0 : popoverPos.dir) != null ? _k : "bottom";
1146
- const align = (_l = popoverPos == null ? void 0 : popoverPos.align) != null ? _l : "start";
1147
- const offsetX = (_m = popoverPos == null ? void 0 : popoverPos.offsetX) != null ? _m : 0;
1148
- const offsetY = (_n = popoverPos == null ? void 0 : popoverPos.offsetY) != null ? _n : 0;
1147
+ const dir = (_l = popoverPos == null ? void 0 : popoverPos.dir) != null ? _l : "bottom";
1148
+ const align = (_m = popoverPos == null ? void 0 : popoverPos.align) != null ? _m : "start";
1149
+ const offsetX = (_n = popoverPos == null ? void 0 : popoverPos.offsetX) != null ? _n : 0;
1150
+ const offsetY = (_o = popoverPos == null ? void 0 : popoverPos.offsetY) != null ? _o : 0;
1149
1151
  const anchorStyle = popoverReady ? {
1150
1152
  position: "fixed",
1151
1153
  top: rect.top,
@@ -1244,7 +1246,7 @@ var WalkthroughOverlay = ({
1244
1246
  /* @__PURE__ */ jsxs(PopoverBody, { children: [
1245
1247
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row", justifyContent: "space-between" }, children: [
1246
1248
  pStep.title ? /* @__PURE__ */ jsx(PopoverTitle, { children: pStep.title }) : "",
1247
- ((_o = pStep.isShowStep) != null ? _o : pIsShowStep) && /* @__PURE__ */ jsxs("span", { style: { color: "#a1a1aa", fontSize: "12px", fontWeight: "400" }, children: [
1249
+ ((_p = pStep.isShowStep) != null ? _p : pIsShowStep) && /* @__PURE__ */ jsxs("span", { style: { color: "#a1a1aa", fontSize: "12px", fontWeight: "400" }, children: [
1248
1250
  pDisplayCurrentStep,
1249
1251
  "/",
1250
1252
  pDisplayTotalSteps
@@ -1269,7 +1271,7 @@ var WalkthroughOverlay = ({
1269
1271
  }
1270
1272
  ) }),
1271
1273
  /* @__PURE__ */ jsxs(ButtonGroup, { children: [
1272
- ((_p = pStep.isShowPrev) != null ? _p : pIsShowPrev) && pCurrentValidPos > 0 && /* @__PURE__ */ jsx(
1274
+ ((_q = pStep.isShowPrev) != null ? _q : pIsShowPrev) && pCurrentValidPos > 0 && /* @__PURE__ */ jsx(
1273
1275
  "button",
1274
1276
  {
1275
1277
  className: "wt-btn",