design-zystem 1.0.402 → 1.0.404
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/ui/index.d.mts +26 -5
- package/dist/ui/index.d.ts +26 -5
- package/dist/ui/index.js +208 -289
- package/dist/ui/index.mjs +210 -298
- package/dist/ui/style.css +3 -1
- package/package.json +2 -1
package/dist/ui/index.js
CHANGED
|
@@ -6608,12 +6608,61 @@ var BG_CLASS = {
|
|
|
6608
6608
|
"orange-600": "bg-orange-600",
|
|
6609
6609
|
"purple-700": "bg-purple-700"
|
|
6610
6610
|
};
|
|
6611
|
+
var BulkActionSections = ({ sections }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
6612
|
+
Layout,
|
|
6613
|
+
{
|
|
6614
|
+
role: "group",
|
|
6615
|
+
fullHeight: true,
|
|
6616
|
+
align: "stretch",
|
|
6617
|
+
className: "[&>button:not(:last-child)]:rounded-r-none",
|
|
6618
|
+
children: sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
6619
|
+
"button",
|
|
6620
|
+
{
|
|
6621
|
+
type: "button",
|
|
6622
|
+
disabled: section.disabled,
|
|
6623
|
+
onClick: section.disabled ? void 0 : section.action,
|
|
6624
|
+
className: cn(
|
|
6625
|
+
"flex h-full items-center justify-center gap-1.5 whitespace-nowrap rounded-r-xl px-4 text-sm font-bold text-white transition-[filter]",
|
|
6626
|
+
section.disabled ? "cursor-not-allowed bg-grey-500" : "hover:brightness-90"
|
|
6627
|
+
),
|
|
6628
|
+
children: [
|
|
6629
|
+
section.icon,
|
|
6630
|
+
section.title
|
|
6631
|
+
]
|
|
6632
|
+
},
|
|
6633
|
+
index
|
|
6634
|
+
))
|
|
6635
|
+
}
|
|
6636
|
+
);
|
|
6637
|
+
var BulkDisplaySections = ({ sections }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Layout, { align: "center", gap: 3, className: "px-4", children: sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Layout, { align: "center", gap: 3, children: [
|
|
6638
|
+
index > 0 && (section.divider ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "h-11 w-px shrink-0 bg-white/40" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "h-0.5 w-4 shrink-0 rounded-full bg-white/50" })),
|
|
6639
|
+
section.action ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
6640
|
+
"button",
|
|
6641
|
+
{
|
|
6642
|
+
type: "button",
|
|
6643
|
+
disabled: section.disabled,
|
|
6644
|
+
onClick: section.disabled ? void 0 : section.action,
|
|
6645
|
+
className: "flex items-center gap-1.5 whitespace-nowrap text-sm font-bold text-white hover:opacity-80",
|
|
6646
|
+
children: [
|
|
6647
|
+
section.icon,
|
|
6648
|
+
section.title
|
|
6649
|
+
]
|
|
6650
|
+
}
|
|
6651
|
+
) : section.caption ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Layout, { column: true, fullWidth: false, className: "leading-tight text-white", children: [
|
|
6652
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "whitespace-nowrap text-[10px] font-bold uppercase tracking-wide opacity-70", children: section.caption }),
|
|
6653
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "whitespace-nowrap text-sm font-bold", children: section.title })
|
|
6654
|
+
] }) : section.badge ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "whitespace-nowrap rounded-full bg-white/15 px-2.5 py-1 text-xs font-bold text-white", children: section.title }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "flex items-center gap-1.5 whitespace-nowrap text-sm font-bold text-white", children: [
|
|
6655
|
+
section.icon,
|
|
6656
|
+
section.title
|
|
6657
|
+
] })
|
|
6658
|
+
] }, index)) });
|
|
6611
6659
|
var Bulk = ({
|
|
6612
6660
|
onClose,
|
|
6613
6661
|
leftTitle,
|
|
6614
6662
|
sections,
|
|
6615
6663
|
color = "blue-700",
|
|
6616
|
-
className
|
|
6664
|
+
className,
|
|
6665
|
+
variant = "actions"
|
|
6617
6666
|
}) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
6618
6667
|
"div",
|
|
6619
6668
|
{
|
|
@@ -6637,32 +6686,7 @@ var Bulk = ({
|
|
|
6637
6686
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "whitespace-nowrap text-sm font-bold", children: leftTitle }),
|
|
6638
6687
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "h-11 w-px bg-white/40" })
|
|
6639
6688
|
] }),
|
|
6640
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
6641
|
-
Layout,
|
|
6642
|
-
{
|
|
6643
|
-
role: "group",
|
|
6644
|
-
fullHeight: true,
|
|
6645
|
-
align: "stretch",
|
|
6646
|
-
className: "[&>button:not(:last-child)]:rounded-r-none",
|
|
6647
|
-
children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
6648
|
-
"button",
|
|
6649
|
-
{
|
|
6650
|
-
type: "button",
|
|
6651
|
-
disabled: section.disabled,
|
|
6652
|
-
onClick: section.disabled ? void 0 : section.action,
|
|
6653
|
-
className: cn(
|
|
6654
|
-
"flex h-full items-center justify-center gap-1.5 whitespace-nowrap rounded-r-xl px-4 text-sm font-bold text-white transition-[filter]",
|
|
6655
|
-
section.disabled ? "cursor-not-allowed bg-grey-500" : "hover:brightness-90"
|
|
6656
|
-
),
|
|
6657
|
-
children: [
|
|
6658
|
-
section.icon,
|
|
6659
|
-
section.title
|
|
6660
|
-
]
|
|
6661
|
-
},
|
|
6662
|
-
section.title
|
|
6663
|
-
))
|
|
6664
|
-
}
|
|
6665
|
-
)
|
|
6689
|
+
variant === "display" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BulkDisplaySections, { sections }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BulkActionSections, { sections })
|
|
6666
6690
|
]
|
|
6667
6691
|
}
|
|
6668
6692
|
);
|
|
@@ -8652,7 +8676,7 @@ var optimizeImage = async (file, desiredBaseName, opts = {}) => {
|
|
|
8652
8676
|
|
|
8653
8677
|
// src/ui/components/ui/Tour.tsx
|
|
8654
8678
|
var import_react57 = require("react");
|
|
8655
|
-
var
|
|
8679
|
+
var import_driver = require("driver.js");
|
|
8656
8680
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
8657
8681
|
var TOUR_TARGET_ATTRIBUTE = "data-tour-target";
|
|
8658
8682
|
var DEFAULT_LABELS = {
|
|
@@ -8662,23 +8686,13 @@ var DEFAULT_LABELS = {
|
|
|
8662
8686
|
close: "Quitter le tutoriel",
|
|
8663
8687
|
counter: (current, total) => `${current} / ${total}`
|
|
8664
8688
|
};
|
|
8665
|
-
var
|
|
8666
|
-
var
|
|
8667
|
-
var
|
|
8668
|
-
var MARGIN = 12;
|
|
8689
|
+
var STAGE_PADDING = 6;
|
|
8690
|
+
var GHOST_TRANSITION_MS = 200;
|
|
8691
|
+
var HIGHLIGHT_DURATION_MS = 400;
|
|
8669
8692
|
var TourTarget = ({ id, children }) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", __spreadProps(__spreadValues({}, { [TOUR_TARGET_ATTRIBUTE]: id }), { className: "contents", children }));
|
|
8670
|
-
var
|
|
8671
|
-
const ids = Array.isArray(target) ? target : target ? [target] : [];
|
|
8672
|
-
for (const id of ids) {
|
|
8673
|
-
const element = document.querySelector(
|
|
8674
|
-
`[${TOUR_TARGET_ATTRIBUTE}="${id.replace(/"/g, '\\"')}"]`
|
|
8675
|
-
);
|
|
8676
|
-
if (element && measure(element)) return element;
|
|
8677
|
-
}
|
|
8678
|
-
return null;
|
|
8679
|
-
};
|
|
8693
|
+
var isContents = (element) => getComputedStyle(element).display === "contents";
|
|
8680
8694
|
var measure = (element) => {
|
|
8681
|
-
if (
|
|
8695
|
+
if (!isContents(element)) {
|
|
8682
8696
|
const { top: top2, left: left2, width, height } = element.getBoundingClientRect();
|
|
8683
8697
|
return width || height ? { top: top2, left: left2, width, height } : null;
|
|
8684
8698
|
}
|
|
@@ -8690,47 +8704,18 @@ var measure = (element) => {
|
|
|
8690
8704
|
const right = Math.max(...rects.map((r) => r.left + r.width));
|
|
8691
8705
|
return { top, left, width: right - left, height: bottom - top };
|
|
8692
8706
|
};
|
|
8693
|
-
var
|
|
8694
|
-
var
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
const vw = window.innerWidth;
|
|
8699
|
-
const vh = window.innerHeight;
|
|
8700
|
-
const fits = {
|
|
8701
|
-
bottom: vh - (hole.top + hole.height) >= cardHeight + GAP2 + MARGIN,
|
|
8702
|
-
top: hole.top >= cardHeight + GAP2 + MARGIN,
|
|
8703
|
-
right: vw - (hole.left + hole.width) >= CARD_WIDTH + GAP2 + MARGIN,
|
|
8704
|
-
left: hole.left >= CARD_WIDTH + GAP2 + MARGIN
|
|
8705
|
-
};
|
|
8706
|
-
const order = ["bottom", "top", "left", "right"];
|
|
8707
|
-
const side = (_a = preferred && fits[preferred] ? preferred : order.find((p) => fits[p])) != null ? _a : "bottom";
|
|
8708
|
-
const centerX = hole.left + hole.width / 2;
|
|
8709
|
-
const centerY = hole.top + hole.height / 2;
|
|
8710
|
-
if (side === "bottom" || side === "top") {
|
|
8711
|
-
const left2 = clamp(
|
|
8712
|
-
centerX - CARD_WIDTH / 2,
|
|
8713
|
-
MARGIN,
|
|
8714
|
-
vw - CARD_WIDTH - MARGIN
|
|
8707
|
+
var boxesOf = (element) => isContents(element) ? Array.from(element.children).flatMap(boxesOf) : [element];
|
|
8708
|
+
var findTarget = (ids) => {
|
|
8709
|
+
for (const id of ids) {
|
|
8710
|
+
const element = document.querySelector(
|
|
8711
|
+
`[${TOUR_TARGET_ATTRIBUTE}="${id.replace(/"/g, '\\"')}"]`
|
|
8715
8712
|
);
|
|
8716
|
-
|
|
8717
|
-
return {
|
|
8718
|
-
side,
|
|
8719
|
-
top: top2,
|
|
8720
|
-
left: left2,
|
|
8721
|
-
arrow: clamp(centerX - left2, 18, CARD_WIDTH - 18)
|
|
8722
|
-
};
|
|
8713
|
+
if (element && measure(element)) return element;
|
|
8723
8714
|
}
|
|
8724
|
-
|
|
8725
|
-
const left = side === "right" ? hole.left + hole.width + GAP2 : hole.left - GAP2 - CARD_WIDTH;
|
|
8726
|
-
return { side, top, left, arrow: clamp(centerY - top, 18, cardHeight - 18) };
|
|
8727
|
-
};
|
|
8728
|
-
var ARROW_CLASS = {
|
|
8729
|
-
bottom: "-top-[7px] -translate-x-1/2",
|
|
8730
|
-
top: "-bottom-[7px] -translate-x-1/2",
|
|
8731
|
-
right: "-left-[7px] -translate-y-1/2",
|
|
8732
|
-
left: "-right-[7px] -translate-y-1/2"
|
|
8715
|
+
return null;
|
|
8733
8716
|
};
|
|
8717
|
+
var sameRect = (a, b) => a === b || !!a && !!b && Math.abs(a.top - b.top) < 0.5 && Math.abs(a.left - b.left) < 0.5 && Math.abs(a.width - b.width) < 0.5 && Math.abs(a.height - b.height) < 0.5;
|
|
8718
|
+
var isOutOfView = (rect) => rect.top < 0 || rect.left < 0 || rect.top + rect.height > window.innerHeight || rect.left + rect.width > window.innerWidth;
|
|
8734
8719
|
var Tour = ({
|
|
8735
8720
|
steps,
|
|
8736
8721
|
open,
|
|
@@ -8743,234 +8728,168 @@ var Tour = ({
|
|
|
8743
8728
|
var _a;
|
|
8744
8729
|
const text = __spreadValues(__spreadValues({}, DEFAULT_LABELS), labels);
|
|
8745
8730
|
const current = steps[step];
|
|
8746
|
-
const hasStep = Boolean(current);
|
|
8747
|
-
const targetKey = [(_a = current == null ? void 0 : current.target) != null ? _a : []].flat().join("|");
|
|
8748
8731
|
const total = steps.length;
|
|
8749
8732
|
const isLast = step === total - 1;
|
|
8750
|
-
const
|
|
8751
|
-
const
|
|
8752
|
-
const
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8733
|
+
const driverRef = (0, import_react57.useRef)(null);
|
|
8734
|
+
const ghostRef = (0, import_react57.useRef)(null);
|
|
8735
|
+
const actions = (0, import_react57.useRef)({
|
|
8736
|
+
next: () => {
|
|
8737
|
+
},
|
|
8738
|
+
previous: () => {
|
|
8739
|
+
},
|
|
8740
|
+
close: () => {
|
|
8741
|
+
}
|
|
8742
|
+
});
|
|
8743
|
+
actions.current = {
|
|
8744
|
+
next: () => isLast ? onClose("finish") : onStepChange(step + 1),
|
|
8745
|
+
previous: () => {
|
|
8746
|
+
if (step > 0) onStepChange(step - 1);
|
|
8747
|
+
},
|
|
8748
|
+
close: () => onClose("close")
|
|
8749
|
+
};
|
|
8756
8750
|
(0, import_react57.useEffect)(() => {
|
|
8757
|
-
if (!open
|
|
8758
|
-
const
|
|
8751
|
+
if (!open) return;
|
|
8752
|
+
const ghost = document.createElement("div");
|
|
8753
|
+
ghost.className = "dz-tour-target";
|
|
8754
|
+
document.body.appendChild(ghost);
|
|
8755
|
+
const instance = (0, import_driver.driver)({
|
|
8756
|
+
duration: HIGHLIGHT_DURATION_MS,
|
|
8757
|
+
allowKeyboardControl: false,
|
|
8758
|
+
overlayClickBehavior: () => {
|
|
8759
|
+
},
|
|
8760
|
+
overlayColor: "rgb(15, 23, 42)",
|
|
8761
|
+
overlayOpacity: 0.6,
|
|
8762
|
+
stagePadding: STAGE_PADDING,
|
|
8763
|
+
stageRadius: 8,
|
|
8764
|
+
popoverOffset: 8,
|
|
8765
|
+
popoverClass: "dz-tour"
|
|
8766
|
+
});
|
|
8767
|
+
driverRef.current = instance;
|
|
8768
|
+
ghostRef.current = ghost;
|
|
8769
|
+
return () => {
|
|
8770
|
+
instance.destroy();
|
|
8771
|
+
ghost.remove();
|
|
8772
|
+
driverRef.current = null;
|
|
8773
|
+
ghostRef.current = null;
|
|
8774
|
+
};
|
|
8775
|
+
}, [open]);
|
|
8776
|
+
(0, import_react57.useEffect)(() => {
|
|
8777
|
+
if (!open) return;
|
|
8778
|
+
const onKeyDown = (event) => {
|
|
8779
|
+
if (event.key === "Escape") {
|
|
8780
|
+
event.stopPropagation();
|
|
8781
|
+
actions.current.close();
|
|
8782
|
+
} else if (event.key === "ArrowRight") actions.current.next();
|
|
8783
|
+
else if (event.key === "ArrowLeft") actions.current.previous();
|
|
8784
|
+
};
|
|
8785
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
8786
|
+
return () => window.removeEventListener("keydown", onKeyDown, true);
|
|
8787
|
+
}, [open]);
|
|
8788
|
+
const view = (0, import_react57.useRef)({ current, text, step, total, isLast });
|
|
8789
|
+
view.current = { current, text, step, total, isLast };
|
|
8790
|
+
const targetKey = [(_a = current == null ? void 0 : current.target) != null ? _a : []].flat().join("|");
|
|
8791
|
+
const popoverKey = [
|
|
8792
|
+
current == null ? void 0 : current.title,
|
|
8793
|
+
current == null ? void 0 : current.content,
|
|
8794
|
+
current == null ? void 0 : current.placement,
|
|
8795
|
+
current == null ? void 0 : current.interactive,
|
|
8796
|
+
text.counter(step + 1, total),
|
|
8797
|
+
text.previous,
|
|
8798
|
+
isLast ? text.finish : text.next,
|
|
8799
|
+
text.close
|
|
8800
|
+
].join("|");
|
|
8801
|
+
(0, import_react57.useEffect)(() => {
|
|
8802
|
+
const instance = driverRef.current;
|
|
8803
|
+
const ghost = ghostRef.current;
|
|
8804
|
+
const { current: current2, text: text2, step: step2, total: total2, isLast: isLast2 } = view.current;
|
|
8805
|
+
if (!open || !current2 || !instance || !ghost) return;
|
|
8806
|
+
const targets = targetKey ? targetKey.split("|") : [];
|
|
8807
|
+
const interactive = current2.interactive !== false;
|
|
8808
|
+
const popover = {
|
|
8809
|
+
title: current2.title,
|
|
8810
|
+
description: current2.content,
|
|
8811
|
+
side: current2.placement,
|
|
8812
|
+
showButtons: step2 > 0 ? ["next", "previous", "close"] : ["next", "close"],
|
|
8813
|
+
showProgress: true,
|
|
8814
|
+
progressText: text2.counter(step2 + 1, total2),
|
|
8815
|
+
nextBtnText: isLast2 ? text2.finish : text2.next,
|
|
8816
|
+
prevBtnText: text2.previous,
|
|
8817
|
+
onNextClick: () => actions.current.next(),
|
|
8818
|
+
onPrevClick: () => actions.current.previous(),
|
|
8819
|
+
onCloseClick: () => actions.current.close(),
|
|
8820
|
+
onPopoverRender: (dom) => {
|
|
8821
|
+
var _a2;
|
|
8822
|
+
dom.closeButton.setAttribute("aria-label", text2.close);
|
|
8823
|
+
dom.wrapper.setAttribute("aria-label", (_a2 = current2.title) != null ? _a2 : current2.content);
|
|
8824
|
+
dom.nextButton.focus({ preventScroll: true });
|
|
8825
|
+
}
|
|
8826
|
+
};
|
|
8759
8827
|
const startedAt = performance.now();
|
|
8828
|
+
let shown = "none";
|
|
8760
8829
|
let scrolled = false;
|
|
8830
|
+
let lastRect = null;
|
|
8831
|
+
let refreshUntil = 0;
|
|
8832
|
+
let animatingUntil = 0;
|
|
8833
|
+
let clickable = [];
|
|
8761
8834
|
let frame = 0;
|
|
8762
|
-
|
|
8763
|
-
|
|
8835
|
+
const setClickable = (elements) => {
|
|
8836
|
+
clickable.forEach((el) => el.classList.remove("driver-active-element"));
|
|
8837
|
+
clickable = elements;
|
|
8838
|
+
clickable.forEach((el) => el.classList.add("driver-active-element"));
|
|
8839
|
+
};
|
|
8764
8840
|
const track = () => {
|
|
8841
|
+
var _a2;
|
|
8765
8842
|
const element = findTarget(targets);
|
|
8766
|
-
const
|
|
8767
|
-
if (element &&
|
|
8843
|
+
const rect = element ? measure(element) : null;
|
|
8844
|
+
if (element && rect) {
|
|
8768
8845
|
if (!scrolled) {
|
|
8769
8846
|
scrolled = true;
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
firstBox(element).scrollIntoView({
|
|
8847
|
+
if (isOutOfView(rect)) {
|
|
8848
|
+
(_a2 = boxesOf(element)[0]) == null ? void 0 : _a2.scrollIntoView({
|
|
8773
8849
|
block: "center",
|
|
8774
8850
|
inline: "nearest"
|
|
8775
8851
|
});
|
|
8776
8852
|
}
|
|
8777
8853
|
}
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8854
|
+
if (!sameRect(lastRect, rect)) {
|
|
8855
|
+
lastRect = rect;
|
|
8856
|
+
refreshUntil = Math.max(
|
|
8857
|
+
refreshUntil,
|
|
8858
|
+
performance.now() + GHOST_TRANSITION_MS + 50
|
|
8859
|
+
);
|
|
8860
|
+
Object.assign(ghost.style, {
|
|
8861
|
+
top: `${rect.top}px`,
|
|
8862
|
+
left: `${rect.left}px`,
|
|
8863
|
+
width: `${rect.width}px`,
|
|
8864
|
+
height: `${rect.height}px`
|
|
8865
|
+
});
|
|
8866
|
+
}
|
|
8867
|
+
if (shown !== "target") {
|
|
8868
|
+
shown = "target";
|
|
8869
|
+
ghost.style.pointerEvents = interactive ? "none" : "auto";
|
|
8870
|
+
ghost.style.display = "block";
|
|
8871
|
+
instance.highlight({ element: ghost, popover });
|
|
8872
|
+
animatingUntil = performance.now() + HIGHLIGHT_DURATION_MS;
|
|
8873
|
+
refreshUntil = animatingUntil + GHOST_TRANSITION_MS;
|
|
8874
|
+
setClickable(interactive ? boxesOf(element) : []);
|
|
8875
|
+
} else if (performance.now() >= animatingUntil && performance.now() < refreshUntil) {
|
|
8876
|
+
instance.refresh();
|
|
8877
|
+
}
|
|
8878
|
+
} else if (shown !== "center" && (!targets.length || performance.now() - startedAt > targetTimeout)) {
|
|
8879
|
+
shown = "center";
|
|
8880
|
+
ghost.style.display = "none";
|
|
8881
|
+
setClickable([]);
|
|
8882
|
+
instance.highlight({ popover });
|
|
8785
8883
|
}
|
|
8786
8884
|
frame = requestAnimationFrame(track);
|
|
8787
8885
|
};
|
|
8788
8886
|
track();
|
|
8789
|
-
return () =>
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
if (cardRef.current) setCardHeight(cardRef.current.offsetHeight);
|
|
8793
|
-
});
|
|
8794
|
-
(0, import_react57.useEffect)(() => {
|
|
8795
|
-
var _a2;
|
|
8796
|
-
if (open && status !== "pending")
|
|
8797
|
-
(_a2 = nextRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
|
|
8798
|
-
}, [open, step, status]);
|
|
8799
|
-
const goNext = (0, import_react57.useCallback)(() => {
|
|
8800
|
-
if (isLast) onClose("finish");
|
|
8801
|
-
else onStepChange(step + 1);
|
|
8802
|
-
}, [isLast, onClose, onStepChange, step]);
|
|
8803
|
-
const goPrevious = (0, import_react57.useCallback)(() => {
|
|
8804
|
-
if (step > 0) onStepChange(step - 1);
|
|
8805
|
-
}, [onStepChange, step]);
|
|
8806
|
-
(0, import_react57.useEffect)(() => {
|
|
8807
|
-
if (!open) return;
|
|
8808
|
-
const onKeyDown = (event) => {
|
|
8809
|
-
if (event.key === "Escape") {
|
|
8810
|
-
event.stopPropagation();
|
|
8811
|
-
onClose("close");
|
|
8812
|
-
} else if (event.key === "ArrowRight") goNext();
|
|
8813
|
-
else if (event.key === "ArrowLeft") goPrevious();
|
|
8887
|
+
return () => {
|
|
8888
|
+
cancelAnimationFrame(frame);
|
|
8889
|
+
setClickable([]);
|
|
8814
8890
|
};
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
}, [open, goNext, goPrevious, onClose]);
|
|
8818
|
-
if (!open || !current) return null;
|
|
8819
|
-
const hole = rect && {
|
|
8820
|
-
top: rect.top - HOLE_PADDING,
|
|
8821
|
-
left: rect.left - HOLE_PADDING,
|
|
8822
|
-
width: rect.width + HOLE_PADDING * 2,
|
|
8823
|
-
height: rect.height + HOLE_PADDING * 2
|
|
8824
|
-
};
|
|
8825
|
-
const placement = hole && placeCard(hole, cardHeight, current.placement);
|
|
8826
|
-
const blockClick = (event) => event.stopPropagation();
|
|
8827
|
-
const blocker = "fixed z-[10000]";
|
|
8828
|
-
return (0, import_react_dom.createPortal)(
|
|
8829
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
8830
|
-
hole ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
8831
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8832
|
-
"div",
|
|
8833
|
-
{
|
|
8834
|
-
"aria-hidden": true,
|
|
8835
|
-
className: "pointer-events-none fixed z-[10000] rounded-[8px] shadow-[0_0_0_9999px_rgba(15,23,42,0.6)] ring-[3px] ring-yellow-300 transition-all duration-200 ease-out",
|
|
8836
|
-
style: hole
|
|
8837
|
-
}
|
|
8838
|
-
),
|
|
8839
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8840
|
-
"div",
|
|
8841
|
-
{
|
|
8842
|
-
className: cn(blocker, "inset-x-0 top-0"),
|
|
8843
|
-
style: { height: Math.max(hole.top, 0) },
|
|
8844
|
-
onMouseDown: blockClick,
|
|
8845
|
-
onClick: blockClick
|
|
8846
|
-
}
|
|
8847
|
-
),
|
|
8848
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8849
|
-
"div",
|
|
8850
|
-
{
|
|
8851
|
-
className: cn(blocker, "inset-x-0 bottom-0"),
|
|
8852
|
-
style: { top: hole.top + hole.height },
|
|
8853
|
-
onMouseDown: blockClick,
|
|
8854
|
-
onClick: blockClick
|
|
8855
|
-
}
|
|
8856
|
-
),
|
|
8857
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8858
|
-
"div",
|
|
8859
|
-
{
|
|
8860
|
-
className: cn(blocker, "left-0"),
|
|
8861
|
-
style: {
|
|
8862
|
-
top: hole.top,
|
|
8863
|
-
height: hole.height,
|
|
8864
|
-
width: Math.max(hole.left, 0)
|
|
8865
|
-
},
|
|
8866
|
-
onMouseDown: blockClick,
|
|
8867
|
-
onClick: blockClick
|
|
8868
|
-
}
|
|
8869
|
-
),
|
|
8870
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8871
|
-
"div",
|
|
8872
|
-
{
|
|
8873
|
-
className: cn(blocker, "right-0"),
|
|
8874
|
-
style: {
|
|
8875
|
-
top: hole.top,
|
|
8876
|
-
height: hole.height,
|
|
8877
|
-
left: hole.left + hole.width
|
|
8878
|
-
},
|
|
8879
|
-
onMouseDown: blockClick,
|
|
8880
|
-
onClick: blockClick
|
|
8881
|
-
}
|
|
8882
|
-
),
|
|
8883
|
-
current.interactive === false && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: blocker, style: hole, onClick: blockClick })
|
|
8884
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8885
|
-
"div",
|
|
8886
|
-
{
|
|
8887
|
-
className: cn(blocker, "inset-0 bg-[rgba(15,23,42,0.6)]"),
|
|
8888
|
-
onMouseDown: blockClick,
|
|
8889
|
-
onClick: blockClick
|
|
8890
|
-
}
|
|
8891
|
-
),
|
|
8892
|
-
status !== "pending" && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
8893
|
-
"div",
|
|
8894
|
-
{
|
|
8895
|
-
ref: cardRef,
|
|
8896
|
-
role: "dialog",
|
|
8897
|
-
"aria-modal": "true",
|
|
8898
|
-
"aria-labelledby": titleId,
|
|
8899
|
-
className: cn(
|
|
8900
|
-
"fixed z-[10001] rounded-[12px] bg-yellow-300 p-5 shadow-[0_10px_30px_rgba(0,0,0,0.25)]",
|
|
8901
|
-
!placement && "left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
8902
|
-
placement && "transition-[top,left] duration-200 ease-out"
|
|
8903
|
-
),
|
|
8904
|
-
style: __spreadValues({
|
|
8905
|
-
width: CARD_WIDTH
|
|
8906
|
-
}, placement && { top: placement.top, left: placement.left }),
|
|
8907
|
-
children: [
|
|
8908
|
-
placement && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8909
|
-
"span",
|
|
8910
|
-
{
|
|
8911
|
-
"aria-hidden": true,
|
|
8912
|
-
className: cn(
|
|
8913
|
-
"absolute h-3 w-3 rotate-45 bg-yellow-300",
|
|
8914
|
-
ARROW_CLASS[placement.side]
|
|
8915
|
-
),
|
|
8916
|
-
style: placement.side === "bottom" || placement.side === "top" ? { left: placement.arrow } : { top: placement.arrow }
|
|
8917
|
-
}
|
|
8918
|
-
),
|
|
8919
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { column: true, gap: 3, children: [
|
|
8920
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { row: true, justify: "between", align: "center", children: [
|
|
8921
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { size: "xs", weight: "semibold", color: "white", children: text.counter(step + 1, total) }),
|
|
8922
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8923
|
-
Icon,
|
|
8924
|
-
{
|
|
8925
|
-
name: "xmark",
|
|
8926
|
-
size: "s",
|
|
8927
|
-
color: "white",
|
|
8928
|
-
onClick: () => onClose("close"),
|
|
8929
|
-
"aria-label": text.close
|
|
8930
|
-
}
|
|
8931
|
-
)
|
|
8932
|
-
] }),
|
|
8933
|
-
current.title && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { id: titleId, size: "m", weight: "bold", color: "white", children: current.title }),
|
|
8934
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8935
|
-
Text,
|
|
8936
|
-
{
|
|
8937
|
-
id: current.title ? void 0 : titleId,
|
|
8938
|
-
size: "m",
|
|
8939
|
-
weight: "medium",
|
|
8940
|
-
color: "white",
|
|
8941
|
-
className: "leading-relaxed",
|
|
8942
|
-
children: current.content
|
|
8943
|
-
}
|
|
8944
|
-
),
|
|
8945
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Layout, { row: true, justify: "end", gap: 2, children: [
|
|
8946
|
-
step > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8947
|
-
Button,
|
|
8948
|
-
{
|
|
8949
|
-
label: text.previous,
|
|
8950
|
-
variant: "outline",
|
|
8951
|
-
size: "s",
|
|
8952
|
-
className: "border-white text-white",
|
|
8953
|
-
onClick: goPrevious
|
|
8954
|
-
}
|
|
8955
|
-
),
|
|
8956
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8957
|
-
Button,
|
|
8958
|
-
{
|
|
8959
|
-
ref: nextRef,
|
|
8960
|
-
label: isLast ? text.finish : text.next,
|
|
8961
|
-
size: "s",
|
|
8962
|
-
className: "bg-white text-yellow-500",
|
|
8963
|
-
onClick: goNext
|
|
8964
|
-
}
|
|
8965
|
-
)
|
|
8966
|
-
] })
|
|
8967
|
-
] })
|
|
8968
|
-
]
|
|
8969
|
-
}
|
|
8970
|
-
)
|
|
8971
|
-
] }),
|
|
8972
|
-
document.body
|
|
8973
|
-
);
|
|
8891
|
+
}, [open, step, targetKey, popoverKey, targetTimeout]);
|
|
8892
|
+
return null;
|
|
8974
8893
|
};
|
|
8975
8894
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8976
8895
|
0 && (module.exports = {
|