@tent-official/react-walkthrough 1.5.1 → 1.6.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.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,13 +993,9 @@ 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
- }
1001
- }
996
+ const targetStepIdx = activeTour.steps.findIndex(
997
+ (s) => resolveElId(s.el) === nextElId
998
+ );
1002
999
  if (targetStepIdx !== -1) {
1003
1000
  const targetStepDef = activeTour.steps[targetStepIdx];
1004
1001
  const targetStepWithIdx = { ...targetStepDef, _originalIdx: targetStepIdx };
@@ -1142,10 +1139,10 @@ var WalkthroughOverlay = ({
1142
1139
  displayPosRef.current = currentValidPos;
1143
1140
  }
1144
1141
  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;
1142
+ const dir = (_l = popoverPos == null ? void 0 : popoverPos.dir) != null ? _l : "bottom";
1143
+ const align = (_m = popoverPos == null ? void 0 : popoverPos.align) != null ? _m : "start";
1144
+ const offsetX = (_n = popoverPos == null ? void 0 : popoverPos.offsetX) != null ? _n : 0;
1145
+ const offsetY = (_o = popoverPos == null ? void 0 : popoverPos.offsetY) != null ? _o : 0;
1149
1146
  const anchorStyle = popoverReady ? {
1150
1147
  position: "fixed",
1151
1148
  top: rect.top,
@@ -1244,7 +1241,7 @@ var WalkthroughOverlay = ({
1244
1241
  /* @__PURE__ */ jsxs(PopoverBody, { children: [
1245
1242
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row", justifyContent: "space-between" }, children: [
1246
1243
  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: [
1244
+ ((_p = pStep.isShowStep) != null ? _p : pIsShowStep) && /* @__PURE__ */ jsxs("span", { style: { color: "#a1a1aa", fontSize: "12px", fontWeight: "400" }, children: [
1248
1245
  pDisplayCurrentStep,
1249
1246
  "/",
1250
1247
  pDisplayTotalSteps
@@ -1269,7 +1266,7 @@ var WalkthroughOverlay = ({
1269
1266
  }
1270
1267
  ) }),
1271
1268
  /* @__PURE__ */ jsxs(ButtonGroup, { children: [
1272
- ((_p = pStep.isShowPrev) != null ? _p : pIsShowPrev) && pCurrentValidPos > 0 && /* @__PURE__ */ jsx(
1269
+ ((_q = pStep.isShowPrev) != null ? _q : pIsShowPrev) && pCurrentValidPos > 0 && /* @__PURE__ */ jsx(
1273
1270
  "button",
1274
1271
  {
1275
1272
  className: "wt-btn",