@x-plat/design-system 0.16.2 → 0.16.3
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/components/Tour/index.cjs +66 -19
- package/dist/components/Tour/index.css +28 -5
- package/dist/components/Tour/index.d.cts +6 -0
- package/dist/components/Tour/index.d.ts +6 -0
- package/dist/components/Tour/index.js +66 -19
- package/dist/components/index.cjs +86 -37
- package/dist/components/index.css +28 -5
- package/dist/components/index.js +86 -37
- package/dist/index.cjs +91 -42
- package/dist/index.css +28 -5
- package/dist/index.js +91 -42
- package/guidelines/components/tour.md +20 -3
- package/package.json +1 -1
|
@@ -5899,14 +5899,39 @@
|
|
|
5899
5899
|
position: fixed;
|
|
5900
5900
|
pointer-events: auto;
|
|
5901
5901
|
box-sizing: border-box;
|
|
5902
|
-
width:
|
|
5902
|
+
width: var(--tour-card-width, 380px);
|
|
5903
5903
|
max-width: calc(100vw - var(--spacing-space-8));
|
|
5904
|
-
|
|
5905
|
-
|
|
5904
|
+
display: flex;
|
|
5905
|
+
flex-direction: column;
|
|
5906
|
+
overflow: hidden;
|
|
5906
5907
|
border-radius: var(--spacing-radius-md);
|
|
5907
5908
|
background-color: var(--semantic-surface-neutral-primary);
|
|
5908
5909
|
box-shadow: var(--semantic-shadow-lg);
|
|
5909
5910
|
}
|
|
5911
|
+
.lib-xplat-tour-card > .tour-card-head,
|
|
5912
|
+
.lib-xplat-tour-card > .tour-card-body,
|
|
5913
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5914
|
+
padding-left: var(--spacing-space-4);
|
|
5915
|
+
padding-right: var(--spacing-space-4);
|
|
5916
|
+
}
|
|
5917
|
+
.lib-xplat-tour-card > .tour-card-head {
|
|
5918
|
+
padding-top: var(--spacing-space-4);
|
|
5919
|
+
flex: 0 0 auto;
|
|
5920
|
+
}
|
|
5921
|
+
.lib-xplat-tour-card {
|
|
5922
|
+
}
|
|
5923
|
+
.lib-xplat-tour-card > .tour-card-body {
|
|
5924
|
+
flex: 1 1 auto;
|
|
5925
|
+
min-height: 0;
|
|
5926
|
+
overflow-y: auto;
|
|
5927
|
+
padding-top: var(--spacing-space-2);
|
|
5928
|
+
padding-bottom: var(--spacing-space-2);
|
|
5929
|
+
}
|
|
5930
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5931
|
+
flex: 0 0 auto;
|
|
5932
|
+
padding-bottom: var(--spacing-space-4);
|
|
5933
|
+
padding-top: var(--spacing-space-2);
|
|
5934
|
+
}
|
|
5910
5935
|
.lib-xplat-tour-card .tour-card-progress {
|
|
5911
5936
|
font-family: var(--semantic-typo-caption-2-r-font);
|
|
5912
5937
|
font-size: var(--semantic-typo-caption-2-r-size);
|
|
@@ -5923,7 +5948,6 @@
|
|
|
5923
5948
|
font-weight: var(--semantic-typo-label-1-sb-weight);
|
|
5924
5949
|
letter-spacing: var(--semantic-typo-label-1-sb-ls);
|
|
5925
5950
|
color: var(--semantic-text-primary);
|
|
5926
|
-
margin-bottom: var(--spacing-space-2);
|
|
5927
5951
|
}
|
|
5928
5952
|
.lib-xplat-tour-card .tour-card-description {
|
|
5929
5953
|
font-family: var(--semantic-typo-caption-1-r-font);
|
|
@@ -5939,7 +5963,6 @@
|
|
|
5939
5963
|
align-items: center;
|
|
5940
5964
|
justify-content: space-between;
|
|
5941
5965
|
gap: var(--spacing-space-2);
|
|
5942
|
-
margin-top: var(--spacing-space-4);
|
|
5943
5966
|
}
|
|
5944
5967
|
.lib-xplat-tour-card .tour-card-nav {
|
|
5945
5968
|
display: flex;
|
package/dist/components/index.js
CHANGED
|
@@ -7604,7 +7604,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
7604
7604
|
var Tooltip_default = Tooltip;
|
|
7605
7605
|
|
|
7606
7606
|
// src/components/Tour/Tour.tsx
|
|
7607
|
+
import React45 from "react";
|
|
7608
|
+
|
|
7609
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
7607
7610
|
import React44 from "react";
|
|
7611
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7612
|
+
" ",
|
|
7613
|
+
"PageUp",
|
|
7614
|
+
"PageDown",
|
|
7615
|
+
"Home",
|
|
7616
|
+
"End",
|
|
7617
|
+
"ArrowUp",
|
|
7618
|
+
"ArrowDown",
|
|
7619
|
+
"ArrowLeft",
|
|
7620
|
+
"ArrowRight"
|
|
7621
|
+
]);
|
|
7622
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
7623
|
+
React44.useEffect(() => {
|
|
7624
|
+
if (!enabled) return;
|
|
7625
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7626
|
+
const block = (e) => {
|
|
7627
|
+
if (allowed(e.target)) return;
|
|
7628
|
+
e.preventDefault();
|
|
7629
|
+
};
|
|
7630
|
+
const onKey = (e) => {
|
|
7631
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
7632
|
+
if (allowed(e.target)) return;
|
|
7633
|
+
const el = e.target;
|
|
7634
|
+
const tag = el?.tagName;
|
|
7635
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
7636
|
+
e.preventDefault();
|
|
7637
|
+
};
|
|
7638
|
+
const opts = { passive: false, capture: true };
|
|
7639
|
+
window.addEventListener("wheel", block, opts);
|
|
7640
|
+
window.addEventListener("touchmove", block, opts);
|
|
7641
|
+
window.addEventListener("keydown", onKey, opts);
|
|
7642
|
+
return () => {
|
|
7643
|
+
window.removeEventListener("wheel", block, true);
|
|
7644
|
+
window.removeEventListener("touchmove", block, true);
|
|
7645
|
+
window.removeEventListener("keydown", onKey, true);
|
|
7646
|
+
};
|
|
7647
|
+
}, [enabled, allowRef]);
|
|
7648
|
+
};
|
|
7649
|
+
var useScrollLock_default = useScrollLock;
|
|
7650
|
+
|
|
7651
|
+
// src/components/Tour/Tour.tsx
|
|
7608
7652
|
import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
|
|
7609
7653
|
var VIEWPORT_MARGIN = 16;
|
|
7610
7654
|
var DEFAULT_PADDING = 8;
|
|
@@ -7620,19 +7664,20 @@ var Tour = (props) => {
|
|
|
7620
7664
|
onClose,
|
|
7621
7665
|
current,
|
|
7622
7666
|
onStepChange,
|
|
7667
|
+
width = 380,
|
|
7623
7668
|
nextLabel = "\uB2E4\uC74C",
|
|
7624
7669
|
prevLabel = "\uC774\uC804",
|
|
7625
7670
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7626
7671
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7627
7672
|
} = props;
|
|
7628
|
-
const [uncontrolled, setUncontrolled] =
|
|
7673
|
+
const [uncontrolled, setUncontrolled] = React45.useState(0);
|
|
7629
7674
|
const index = current ?? uncontrolled;
|
|
7630
7675
|
const step = steps[index];
|
|
7631
7676
|
const isLast = index === steps.length - 1;
|
|
7632
|
-
const spotRef =
|
|
7633
|
-
const cardRef =
|
|
7634
|
-
const [targetFound, setTargetFound] =
|
|
7635
|
-
const goTo =
|
|
7677
|
+
const spotRef = React45.useRef(null);
|
|
7678
|
+
const cardRef = React45.useRef(null);
|
|
7679
|
+
const [targetFound, setTargetFound] = React45.useState(true);
|
|
7680
|
+
const goTo = React45.useCallback(
|
|
7636
7681
|
(next) => {
|
|
7637
7682
|
if (current === void 0) setUncontrolled(next);
|
|
7638
7683
|
onStepChange?.(next);
|
|
@@ -7641,9 +7686,10 @@ var Tour = (props) => {
|
|
|
7641
7686
|
);
|
|
7642
7687
|
useEscapeKey(open, () => onClose("skip"));
|
|
7643
7688
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7644
|
-
|
|
7689
|
+
useScrollLock_default(open, cardRef);
|
|
7690
|
+
const stepsRef = React45.useRef(steps);
|
|
7645
7691
|
stepsRef.current = steps;
|
|
7646
|
-
|
|
7692
|
+
React45.useEffect(() => {
|
|
7647
7693
|
if (!open) return;
|
|
7648
7694
|
const target = stepsRef.current[index]?.target;
|
|
7649
7695
|
if (!target) return;
|
|
@@ -7668,7 +7714,7 @@ var Tour = (props) => {
|
|
|
7668
7714
|
stop = true;
|
|
7669
7715
|
};
|
|
7670
7716
|
}, [open, index]);
|
|
7671
|
-
const place =
|
|
7717
|
+
const place = React45.useCallback(() => {
|
|
7672
7718
|
const spot = spotRef.current;
|
|
7673
7719
|
const card = cardRef.current;
|
|
7674
7720
|
if (!spot || !card || !step) return;
|
|
@@ -7709,13 +7755,13 @@ var Tour = (props) => {
|
|
|
7709
7755
|
}
|
|
7710
7756
|
);
|
|
7711
7757
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
7712
|
-
const cardH = Math.min(
|
|
7758
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
7713
7759
|
const cardW = card.offsetWidth;
|
|
7714
|
-
card.style.maxHeight = `${
|
|
7760
|
+
card.style.maxHeight = `${limit}px`;
|
|
7715
7761
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7716
7762
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7717
7763
|
}, [step]);
|
|
7718
|
-
|
|
7764
|
+
React45.useLayoutEffect(() => {
|
|
7719
7765
|
if (!open) return;
|
|
7720
7766
|
place();
|
|
7721
7767
|
let raf = 0;
|
|
@@ -7732,7 +7778,7 @@ var Tour = (props) => {
|
|
|
7732
7778
|
raf = requestAnimationFrame(follow);
|
|
7733
7779
|
return () => cancelAnimationFrame(raf);
|
|
7734
7780
|
}, [open, index, place]);
|
|
7735
|
-
|
|
7781
|
+
React45.useEffect(() => {
|
|
7736
7782
|
if (!open) return;
|
|
7737
7783
|
const onMove = () => place();
|
|
7738
7784
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7751,17 +7797,20 @@ var Tour = (props) => {
|
|
|
7751
7797
|
{
|
|
7752
7798
|
ref: cardRef,
|
|
7753
7799
|
className: "lib-xplat-tour-card",
|
|
7800
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
7754
7801
|
role: "dialog",
|
|
7755
7802
|
"aria-modal": "true",
|
|
7756
7803
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
7757
7804
|
children: [
|
|
7758
|
-
/* @__PURE__ */ jsxs225("div", { className: "tour-card-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7805
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-head", children: [
|
|
7806
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
7807
|
+
index + 1,
|
|
7808
|
+
" / ",
|
|
7809
|
+
steps.length
|
|
7810
|
+
] }),
|
|
7811
|
+
step.title && /* @__PURE__ */ jsx355("div", { className: "tour-card-title", children: step.title })
|
|
7762
7812
|
] }),
|
|
7763
|
-
step.
|
|
7764
|
-
step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }),
|
|
7813
|
+
/* @__PURE__ */ jsx355("div", { className: "tour-card-body", children: step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }) }),
|
|
7765
7814
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-actions", children: [
|
|
7766
7815
|
/* @__PURE__ */ jsx355("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
7767
7816
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-nav", children: [
|
|
@@ -7794,7 +7843,7 @@ Tour.displayName = "Tour";
|
|
|
7794
7843
|
var Tour_default = Tour;
|
|
7795
7844
|
|
|
7796
7845
|
// src/components/Video/Video.tsx
|
|
7797
|
-
import
|
|
7846
|
+
import React46 from "react";
|
|
7798
7847
|
import { jsx as jsx356, jsxs as jsxs226 } from "react/jsx-runtime";
|
|
7799
7848
|
var PipIcon = () => /* @__PURE__ */ jsxs226("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
7800
7849
|
/* @__PURE__ */ jsx356("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7806,7 +7855,7 @@ var formatTime = (sec) => {
|
|
|
7806
7855
|
const s = Math.floor(sec % 60);
|
|
7807
7856
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7808
7857
|
};
|
|
7809
|
-
var Video =
|
|
7858
|
+
var Video = React46.forwardRef((props, ref) => {
|
|
7810
7859
|
const {
|
|
7811
7860
|
src,
|
|
7812
7861
|
poster,
|
|
@@ -7830,21 +7879,21 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
7830
7879
|
children,
|
|
7831
7880
|
...rest
|
|
7832
7881
|
} = props;
|
|
7833
|
-
const containerRef =
|
|
7834
|
-
const videoRef =
|
|
7835
|
-
const [isPlaying, setIsPlaying] =
|
|
7836
|
-
const [isLoaded, setIsLoaded] =
|
|
7837
|
-
const [currentTime, setCurrentTime] =
|
|
7838
|
-
const [duration, setDuration] =
|
|
7839
|
-
const [buffered, setBuffered] =
|
|
7840
|
-
const [volume, setVolume] =
|
|
7841
|
-
const [isMuted, setIsMuted] =
|
|
7842
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7843
|
-
const [playbackRate, setPlaybackRate] =
|
|
7844
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7845
|
-
const [captionsOn, setCaptionsOn] =
|
|
7846
|
-
const [isPip, setIsPip] =
|
|
7847
|
-
const setRefs =
|
|
7882
|
+
const containerRef = React46.useRef(null);
|
|
7883
|
+
const videoRef = React46.useRef(null);
|
|
7884
|
+
const [isPlaying, setIsPlaying] = React46.useState(Boolean(autoPlay));
|
|
7885
|
+
const [isLoaded, setIsLoaded] = React46.useState(false);
|
|
7886
|
+
const [currentTime, setCurrentTime] = React46.useState(0);
|
|
7887
|
+
const [duration, setDuration] = React46.useState(0);
|
|
7888
|
+
const [buffered, setBuffered] = React46.useState(0);
|
|
7889
|
+
const [volume, setVolume] = React46.useState(1);
|
|
7890
|
+
const [isMuted, setIsMuted] = React46.useState(Boolean(muted));
|
|
7891
|
+
const [isFullscreen, setIsFullscreen] = React46.useState(false);
|
|
7892
|
+
const [playbackRate, setPlaybackRate] = React46.useState(1);
|
|
7893
|
+
const [rateMenuOpen, setRateMenuOpen] = React46.useState(false);
|
|
7894
|
+
const [captionsOn, setCaptionsOn] = React46.useState(false);
|
|
7895
|
+
const [isPip, setIsPip] = React46.useState(false);
|
|
7896
|
+
const setRefs = React46.useCallback(
|
|
7848
7897
|
(el) => {
|
|
7849
7898
|
videoRef.current = el;
|
|
7850
7899
|
if (typeof ref === "function") ref(el);
|
|
@@ -7852,14 +7901,14 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
7852
7901
|
},
|
|
7853
7902
|
[ref]
|
|
7854
7903
|
);
|
|
7855
|
-
|
|
7904
|
+
React46.useEffect(() => {
|
|
7856
7905
|
const onFsChange = () => {
|
|
7857
7906
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7858
7907
|
};
|
|
7859
7908
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7860
7909
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7861
7910
|
}, []);
|
|
7862
|
-
|
|
7911
|
+
React46.useEffect(() => {
|
|
7863
7912
|
const v = videoRef.current;
|
|
7864
7913
|
if (!v) return;
|
|
7865
7914
|
const onEnter = () => setIsPip(true);
|
package/dist/index.cjs
CHANGED
|
@@ -12119,7 +12119,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
12119
12119
|
var Tooltip_default = Tooltip;
|
|
12120
12120
|
|
|
12121
12121
|
// src/components/Tour/Tour.tsx
|
|
12122
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12123
|
+
|
|
12124
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
12122
12125
|
var import_react44 = __toESM(require("react"), 1);
|
|
12126
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
12127
|
+
" ",
|
|
12128
|
+
"PageUp",
|
|
12129
|
+
"PageDown",
|
|
12130
|
+
"Home",
|
|
12131
|
+
"End",
|
|
12132
|
+
"ArrowUp",
|
|
12133
|
+
"ArrowDown",
|
|
12134
|
+
"ArrowLeft",
|
|
12135
|
+
"ArrowRight"
|
|
12136
|
+
]);
|
|
12137
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
12138
|
+
import_react44.default.useEffect(() => {
|
|
12139
|
+
if (!enabled) return;
|
|
12140
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
12141
|
+
const block = (e) => {
|
|
12142
|
+
if (allowed(e.target)) return;
|
|
12143
|
+
e.preventDefault();
|
|
12144
|
+
};
|
|
12145
|
+
const onKey = (e) => {
|
|
12146
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
12147
|
+
if (allowed(e.target)) return;
|
|
12148
|
+
const el = e.target;
|
|
12149
|
+
const tag = el?.tagName;
|
|
12150
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
12151
|
+
e.preventDefault();
|
|
12152
|
+
};
|
|
12153
|
+
const opts = { passive: false, capture: true };
|
|
12154
|
+
window.addEventListener("wheel", block, opts);
|
|
12155
|
+
window.addEventListener("touchmove", block, opts);
|
|
12156
|
+
window.addEventListener("keydown", onKey, opts);
|
|
12157
|
+
return () => {
|
|
12158
|
+
window.removeEventListener("wheel", block, true);
|
|
12159
|
+
window.removeEventListener("touchmove", block, true);
|
|
12160
|
+
window.removeEventListener("keydown", onKey, true);
|
|
12161
|
+
};
|
|
12162
|
+
}, [enabled, allowRef]);
|
|
12163
|
+
};
|
|
12164
|
+
var useScrollLock_default = useScrollLock;
|
|
12165
|
+
|
|
12166
|
+
// src/components/Tour/Tour.tsx
|
|
12123
12167
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
12124
12168
|
var VIEWPORT_MARGIN = 16;
|
|
12125
12169
|
var DEFAULT_PADDING = 8;
|
|
@@ -12135,19 +12179,20 @@ var Tour = (props) => {
|
|
|
12135
12179
|
onClose,
|
|
12136
12180
|
current,
|
|
12137
12181
|
onStepChange,
|
|
12182
|
+
width = 380,
|
|
12138
12183
|
nextLabel = "\uB2E4\uC74C",
|
|
12139
12184
|
prevLabel = "\uC774\uC804",
|
|
12140
12185
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
12141
12186
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
12142
12187
|
} = props;
|
|
12143
|
-
const [uncontrolled, setUncontrolled] =
|
|
12188
|
+
const [uncontrolled, setUncontrolled] = import_react45.default.useState(0);
|
|
12144
12189
|
const index = current ?? uncontrolled;
|
|
12145
12190
|
const step = steps[index];
|
|
12146
12191
|
const isLast = index === steps.length - 1;
|
|
12147
|
-
const spotRef =
|
|
12148
|
-
const cardRef =
|
|
12149
|
-
const [targetFound, setTargetFound] =
|
|
12150
|
-
const goTo =
|
|
12192
|
+
const spotRef = import_react45.default.useRef(null);
|
|
12193
|
+
const cardRef = import_react45.default.useRef(null);
|
|
12194
|
+
const [targetFound, setTargetFound] = import_react45.default.useState(true);
|
|
12195
|
+
const goTo = import_react45.default.useCallback(
|
|
12151
12196
|
(next) => {
|
|
12152
12197
|
if (current === void 0) setUncontrolled(next);
|
|
12153
12198
|
onStepChange?.(next);
|
|
@@ -12156,9 +12201,10 @@ var Tour = (props) => {
|
|
|
12156
12201
|
);
|
|
12157
12202
|
useEscapeKey(open, () => onClose("skip"));
|
|
12158
12203
|
useFocusTrap(cardRef, open, { trap: true });
|
|
12159
|
-
|
|
12204
|
+
useScrollLock_default(open, cardRef);
|
|
12205
|
+
const stepsRef = import_react45.default.useRef(steps);
|
|
12160
12206
|
stepsRef.current = steps;
|
|
12161
|
-
|
|
12207
|
+
import_react45.default.useEffect(() => {
|
|
12162
12208
|
if (!open) return;
|
|
12163
12209
|
const target = stepsRef.current[index]?.target;
|
|
12164
12210
|
if (!target) return;
|
|
@@ -12183,7 +12229,7 @@ var Tour = (props) => {
|
|
|
12183
12229
|
stop = true;
|
|
12184
12230
|
};
|
|
12185
12231
|
}, [open, index]);
|
|
12186
|
-
const place =
|
|
12232
|
+
const place = import_react45.default.useCallback(() => {
|
|
12187
12233
|
const spot = spotRef.current;
|
|
12188
12234
|
const card = cardRef.current;
|
|
12189
12235
|
if (!spot || !card || !step) return;
|
|
@@ -12224,13 +12270,13 @@ var Tour = (props) => {
|
|
|
12224
12270
|
}
|
|
12225
12271
|
);
|
|
12226
12272
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
12227
|
-
const cardH = Math.min(
|
|
12273
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
12228
12274
|
const cardW = card.offsetWidth;
|
|
12229
|
-
card.style.maxHeight = `${
|
|
12275
|
+
card.style.maxHeight = `${limit}px`;
|
|
12230
12276
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
12231
12277
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
12232
12278
|
}, [step]);
|
|
12233
|
-
|
|
12279
|
+
import_react45.default.useLayoutEffect(() => {
|
|
12234
12280
|
if (!open) return;
|
|
12235
12281
|
place();
|
|
12236
12282
|
let raf = 0;
|
|
@@ -12247,7 +12293,7 @@ var Tour = (props) => {
|
|
|
12247
12293
|
raf = requestAnimationFrame(follow);
|
|
12248
12294
|
return () => cancelAnimationFrame(raf);
|
|
12249
12295
|
}, [open, index, place]);
|
|
12250
|
-
|
|
12296
|
+
import_react45.default.useEffect(() => {
|
|
12251
12297
|
if (!open) return;
|
|
12252
12298
|
const onMove = () => place();
|
|
12253
12299
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -12266,17 +12312,20 @@ var Tour = (props) => {
|
|
|
12266
12312
|
{
|
|
12267
12313
|
ref: cardRef,
|
|
12268
12314
|
className: "lib-xplat-tour-card",
|
|
12315
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
12269
12316
|
role: "dialog",
|
|
12270
12317
|
"aria-modal": "true",
|
|
12271
12318
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
12272
12319
|
children: [
|
|
12273
|
-
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12320
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-head", children: [
|
|
12321
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
12322
|
+
index + 1,
|
|
12323
|
+
" / ",
|
|
12324
|
+
steps.length
|
|
12325
|
+
] }),
|
|
12326
|
+
step.title && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-title", children: step.title })
|
|
12277
12327
|
] }),
|
|
12278
|
-
step.
|
|
12279
|
-
step.description && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-description", children: step.description }),
|
|
12328
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-body", children: step.description && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-description", children: step.description }) }),
|
|
12280
12329
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-actions", children: [
|
|
12281
12330
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
12282
12331
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-nav", children: [
|
|
@@ -12309,7 +12358,7 @@ Tour.displayName = "Tour";
|
|
|
12309
12358
|
var Tour_default = Tour;
|
|
12310
12359
|
|
|
12311
12360
|
// src/components/Video/Video.tsx
|
|
12312
|
-
var
|
|
12361
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12313
12362
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
12314
12363
|
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime356.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
12315
12364
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12321,7 +12370,7 @@ var formatTime = (sec) => {
|
|
|
12321
12370
|
const s = Math.floor(sec % 60);
|
|
12322
12371
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12323
12372
|
};
|
|
12324
|
-
var Video =
|
|
12373
|
+
var Video = import_react46.default.forwardRef((props, ref) => {
|
|
12325
12374
|
const {
|
|
12326
12375
|
src,
|
|
12327
12376
|
poster,
|
|
@@ -12345,21 +12394,21 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
12345
12394
|
children,
|
|
12346
12395
|
...rest
|
|
12347
12396
|
} = props;
|
|
12348
|
-
const containerRef =
|
|
12349
|
-
const videoRef =
|
|
12350
|
-
const [isPlaying, setIsPlaying] =
|
|
12351
|
-
const [isLoaded, setIsLoaded] =
|
|
12352
|
-
const [currentTime, setCurrentTime] =
|
|
12353
|
-
const [duration, setDuration] =
|
|
12354
|
-
const [buffered, setBuffered] =
|
|
12355
|
-
const [volume, setVolume] =
|
|
12356
|
-
const [isMuted, setIsMuted] =
|
|
12357
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12358
|
-
const [playbackRate, setPlaybackRate] =
|
|
12359
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12360
|
-
const [captionsOn, setCaptionsOn] =
|
|
12361
|
-
const [isPip, setIsPip] =
|
|
12362
|
-
const setRefs =
|
|
12397
|
+
const containerRef = import_react46.default.useRef(null);
|
|
12398
|
+
const videoRef = import_react46.default.useRef(null);
|
|
12399
|
+
const [isPlaying, setIsPlaying] = import_react46.default.useState(Boolean(autoPlay));
|
|
12400
|
+
const [isLoaded, setIsLoaded] = import_react46.default.useState(false);
|
|
12401
|
+
const [currentTime, setCurrentTime] = import_react46.default.useState(0);
|
|
12402
|
+
const [duration, setDuration] = import_react46.default.useState(0);
|
|
12403
|
+
const [buffered, setBuffered] = import_react46.default.useState(0);
|
|
12404
|
+
const [volume, setVolume] = import_react46.default.useState(1);
|
|
12405
|
+
const [isMuted, setIsMuted] = import_react46.default.useState(Boolean(muted));
|
|
12406
|
+
const [isFullscreen, setIsFullscreen] = import_react46.default.useState(false);
|
|
12407
|
+
const [playbackRate, setPlaybackRate] = import_react46.default.useState(1);
|
|
12408
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react46.default.useState(false);
|
|
12409
|
+
const [captionsOn, setCaptionsOn] = import_react46.default.useState(false);
|
|
12410
|
+
const [isPip, setIsPip] = import_react46.default.useState(false);
|
|
12411
|
+
const setRefs = import_react46.default.useCallback(
|
|
12363
12412
|
(el) => {
|
|
12364
12413
|
videoRef.current = el;
|
|
12365
12414
|
if (typeof ref === "function") ref(el);
|
|
@@ -12367,14 +12416,14 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
12367
12416
|
},
|
|
12368
12417
|
[ref]
|
|
12369
12418
|
);
|
|
12370
|
-
|
|
12419
|
+
import_react46.default.useEffect(() => {
|
|
12371
12420
|
const onFsChange = () => {
|
|
12372
12421
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12373
12422
|
};
|
|
12374
12423
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12375
12424
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12376
12425
|
}, []);
|
|
12377
|
-
|
|
12426
|
+
import_react46.default.useEffect(() => {
|
|
12378
12427
|
const v = videoRef.current;
|
|
12379
12428
|
if (!v) return;
|
|
12380
12429
|
const onEnter = () => setIsPip(true);
|
|
@@ -12764,13 +12813,13 @@ Layout.displayName = "Layout";
|
|
|
12764
12813
|
var Layout_default = Layout;
|
|
12765
12814
|
|
|
12766
12815
|
// src/layout/SideBar/SideBar.tsx
|
|
12767
|
-
var
|
|
12816
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
12768
12817
|
|
|
12769
12818
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12770
|
-
var
|
|
12771
|
-
var SideBarContext =
|
|
12819
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
12820
|
+
var SideBarContext = import_react47.default.createContext(null);
|
|
12772
12821
|
var useSideBarContext = () => {
|
|
12773
|
-
const ctx =
|
|
12822
|
+
const ctx = import_react47.default.useContext(SideBarContext);
|
|
12774
12823
|
if (!ctx) throw new Error("Error");
|
|
12775
12824
|
return ctx;
|
|
12776
12825
|
};
|
|
@@ -12780,7 +12829,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12780
12829
|
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
12781
12830
|
var SideBar = (props) => {
|
|
12782
12831
|
const { children, className } = props;
|
|
12783
|
-
const [isOpen, setIsOpen] =
|
|
12832
|
+
const [isOpen, setIsOpen] = import_react48.default.useState(true);
|
|
12784
12833
|
const handleSwitchSideBar = () => {
|
|
12785
12834
|
setIsOpen((prev) => !prev);
|
|
12786
12835
|
};
|
package/dist/index.css
CHANGED
|
@@ -5899,14 +5899,39 @@
|
|
|
5899
5899
|
position: fixed;
|
|
5900
5900
|
pointer-events: auto;
|
|
5901
5901
|
box-sizing: border-box;
|
|
5902
|
-
width:
|
|
5902
|
+
width: var(--tour-card-width, 380px);
|
|
5903
5903
|
max-width: calc(100vw - var(--spacing-space-8));
|
|
5904
|
-
|
|
5905
|
-
|
|
5904
|
+
display: flex;
|
|
5905
|
+
flex-direction: column;
|
|
5906
|
+
overflow: hidden;
|
|
5906
5907
|
border-radius: var(--spacing-radius-md);
|
|
5907
5908
|
background-color: var(--semantic-surface-neutral-primary);
|
|
5908
5909
|
box-shadow: var(--semantic-shadow-lg);
|
|
5909
5910
|
}
|
|
5911
|
+
.lib-xplat-tour-card > .tour-card-head,
|
|
5912
|
+
.lib-xplat-tour-card > .tour-card-body,
|
|
5913
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5914
|
+
padding-left: var(--spacing-space-4);
|
|
5915
|
+
padding-right: var(--spacing-space-4);
|
|
5916
|
+
}
|
|
5917
|
+
.lib-xplat-tour-card > .tour-card-head {
|
|
5918
|
+
padding-top: var(--spacing-space-4);
|
|
5919
|
+
flex: 0 0 auto;
|
|
5920
|
+
}
|
|
5921
|
+
.lib-xplat-tour-card {
|
|
5922
|
+
}
|
|
5923
|
+
.lib-xplat-tour-card > .tour-card-body {
|
|
5924
|
+
flex: 1 1 auto;
|
|
5925
|
+
min-height: 0;
|
|
5926
|
+
overflow-y: auto;
|
|
5927
|
+
padding-top: var(--spacing-space-2);
|
|
5928
|
+
padding-bottom: var(--spacing-space-2);
|
|
5929
|
+
}
|
|
5930
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5931
|
+
flex: 0 0 auto;
|
|
5932
|
+
padding-bottom: var(--spacing-space-4);
|
|
5933
|
+
padding-top: var(--spacing-space-2);
|
|
5934
|
+
}
|
|
5910
5935
|
.lib-xplat-tour-card .tour-card-progress {
|
|
5911
5936
|
font-family: var(--semantic-typo-caption-2-r-font);
|
|
5912
5937
|
font-size: var(--semantic-typo-caption-2-r-size);
|
|
@@ -5923,7 +5948,6 @@
|
|
|
5923
5948
|
font-weight: var(--semantic-typo-label-1-sb-weight);
|
|
5924
5949
|
letter-spacing: var(--semantic-typo-label-1-sb-ls);
|
|
5925
5950
|
color: var(--semantic-text-primary);
|
|
5926
|
-
margin-bottom: var(--spacing-space-2);
|
|
5927
5951
|
}
|
|
5928
5952
|
.lib-xplat-tour-card .tour-card-description {
|
|
5929
5953
|
font-family: var(--semantic-typo-caption-1-r-font);
|
|
@@ -5939,7 +5963,6 @@
|
|
|
5939
5963
|
align-items: center;
|
|
5940
5964
|
justify-content: space-between;
|
|
5941
5965
|
gap: var(--spacing-space-2);
|
|
5942
|
-
margin-top: var(--spacing-space-4);
|
|
5943
5966
|
}
|
|
5944
5967
|
.lib-xplat-tour-card .tour-card-nav {
|
|
5945
5968
|
display: flex;
|