@x-plat/design-system 0.16.2 → 0.17.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/components/Table/index.cjs +5 -1
- package/dist/components/Table/index.css +1 -1
- package/dist/components/Table/index.d.cts +10 -0
- package/dist/components/Table/index.d.ts +10 -0
- package/dist/components/Table/index.js +5 -1
- 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 +91 -38
- package/dist/components/index.css +29 -6
- package/dist/components/index.js +91 -38
- package/dist/index.cjs +96 -43
- package/dist/index.css +29 -6
- package/dist/index.js +96 -43
- package/guidelines/components/table.md +1 -0
- package/guidelines/components/tour.md +20 -3
- package/package.json +1 -1
|
@@ -7060,13 +7060,17 @@ var Table = (props) => {
|
|
|
7060
7060
|
rowBorderUse = true,
|
|
7061
7061
|
colBorderUse = true,
|
|
7062
7062
|
headerSticky = false,
|
|
7063
|
-
stickyShadow = true
|
|
7063
|
+
stickyShadow = true,
|
|
7064
|
+
minWidth
|
|
7064
7065
|
} = props;
|
|
7065
7066
|
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7066
7067
|
"div",
|
|
7067
7068
|
{
|
|
7068
7069
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
7069
7070
|
"data-xplat-overlay-escape": "",
|
|
7071
|
+
style: minWidth === void 0 ? void 0 : {
|
|
7072
|
+
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
7073
|
+
},
|
|
7070
7074
|
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7071
7075
|
TableContext_default.Provider,
|
|
7072
7076
|
{
|
|
@@ -7707,7 +7711,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
7707
7711
|
var Tooltip_default = Tooltip;
|
|
7708
7712
|
|
|
7709
7713
|
// src/components/Tour/Tour.tsx
|
|
7714
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
7715
|
+
|
|
7716
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
7710
7717
|
var import_react44 = __toESM(require("react"), 1);
|
|
7718
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7719
|
+
" ",
|
|
7720
|
+
"PageUp",
|
|
7721
|
+
"PageDown",
|
|
7722
|
+
"Home",
|
|
7723
|
+
"End",
|
|
7724
|
+
"ArrowUp",
|
|
7725
|
+
"ArrowDown",
|
|
7726
|
+
"ArrowLeft",
|
|
7727
|
+
"ArrowRight"
|
|
7728
|
+
]);
|
|
7729
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
7730
|
+
import_react44.default.useEffect(() => {
|
|
7731
|
+
if (!enabled) return;
|
|
7732
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7733
|
+
const block = (e) => {
|
|
7734
|
+
if (allowed(e.target)) return;
|
|
7735
|
+
e.preventDefault();
|
|
7736
|
+
};
|
|
7737
|
+
const onKey = (e) => {
|
|
7738
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
7739
|
+
if (allowed(e.target)) return;
|
|
7740
|
+
const el = e.target;
|
|
7741
|
+
const tag = el?.tagName;
|
|
7742
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
7743
|
+
e.preventDefault();
|
|
7744
|
+
};
|
|
7745
|
+
const opts = { passive: false, capture: true };
|
|
7746
|
+
window.addEventListener("wheel", block, opts);
|
|
7747
|
+
window.addEventListener("touchmove", block, opts);
|
|
7748
|
+
window.addEventListener("keydown", onKey, opts);
|
|
7749
|
+
return () => {
|
|
7750
|
+
window.removeEventListener("wheel", block, true);
|
|
7751
|
+
window.removeEventListener("touchmove", block, true);
|
|
7752
|
+
window.removeEventListener("keydown", onKey, true);
|
|
7753
|
+
};
|
|
7754
|
+
}, [enabled, allowRef]);
|
|
7755
|
+
};
|
|
7756
|
+
var useScrollLock_default = useScrollLock;
|
|
7757
|
+
|
|
7758
|
+
// src/components/Tour/Tour.tsx
|
|
7711
7759
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
7712
7760
|
var VIEWPORT_MARGIN = 16;
|
|
7713
7761
|
var DEFAULT_PADDING = 8;
|
|
@@ -7723,19 +7771,20 @@ var Tour = (props) => {
|
|
|
7723
7771
|
onClose,
|
|
7724
7772
|
current,
|
|
7725
7773
|
onStepChange,
|
|
7774
|
+
width = 380,
|
|
7726
7775
|
nextLabel = "\uB2E4\uC74C",
|
|
7727
7776
|
prevLabel = "\uC774\uC804",
|
|
7728
7777
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7729
7778
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7730
7779
|
} = props;
|
|
7731
|
-
const [uncontrolled, setUncontrolled] =
|
|
7780
|
+
const [uncontrolled, setUncontrolled] = import_react45.default.useState(0);
|
|
7732
7781
|
const index = current ?? uncontrolled;
|
|
7733
7782
|
const step = steps[index];
|
|
7734
7783
|
const isLast = index === steps.length - 1;
|
|
7735
|
-
const spotRef =
|
|
7736
|
-
const cardRef =
|
|
7737
|
-
const [targetFound, setTargetFound] =
|
|
7738
|
-
const goTo =
|
|
7784
|
+
const spotRef = import_react45.default.useRef(null);
|
|
7785
|
+
const cardRef = import_react45.default.useRef(null);
|
|
7786
|
+
const [targetFound, setTargetFound] = import_react45.default.useState(true);
|
|
7787
|
+
const goTo = import_react45.default.useCallback(
|
|
7739
7788
|
(next) => {
|
|
7740
7789
|
if (current === void 0) setUncontrolled(next);
|
|
7741
7790
|
onStepChange?.(next);
|
|
@@ -7744,9 +7793,10 @@ var Tour = (props) => {
|
|
|
7744
7793
|
);
|
|
7745
7794
|
useEscapeKey(open, () => onClose("skip"));
|
|
7746
7795
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7747
|
-
|
|
7796
|
+
useScrollLock_default(open, cardRef);
|
|
7797
|
+
const stepsRef = import_react45.default.useRef(steps);
|
|
7748
7798
|
stepsRef.current = steps;
|
|
7749
|
-
|
|
7799
|
+
import_react45.default.useEffect(() => {
|
|
7750
7800
|
if (!open) return;
|
|
7751
7801
|
const target = stepsRef.current[index]?.target;
|
|
7752
7802
|
if (!target) return;
|
|
@@ -7771,7 +7821,7 @@ var Tour = (props) => {
|
|
|
7771
7821
|
stop = true;
|
|
7772
7822
|
};
|
|
7773
7823
|
}, [open, index]);
|
|
7774
|
-
const place =
|
|
7824
|
+
const place = import_react45.default.useCallback(() => {
|
|
7775
7825
|
const spot = spotRef.current;
|
|
7776
7826
|
const card = cardRef.current;
|
|
7777
7827
|
if (!spot || !card || !step) return;
|
|
@@ -7812,13 +7862,13 @@ var Tour = (props) => {
|
|
|
7812
7862
|
}
|
|
7813
7863
|
);
|
|
7814
7864
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
7815
|
-
const cardH = Math.min(
|
|
7865
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
7816
7866
|
const cardW = card.offsetWidth;
|
|
7817
|
-
card.style.maxHeight = `${
|
|
7867
|
+
card.style.maxHeight = `${limit}px`;
|
|
7818
7868
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7819
7869
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7820
7870
|
}, [step]);
|
|
7821
|
-
|
|
7871
|
+
import_react45.default.useLayoutEffect(() => {
|
|
7822
7872
|
if (!open) return;
|
|
7823
7873
|
place();
|
|
7824
7874
|
let raf = 0;
|
|
@@ -7835,7 +7885,7 @@ var Tour = (props) => {
|
|
|
7835
7885
|
raf = requestAnimationFrame(follow);
|
|
7836
7886
|
return () => cancelAnimationFrame(raf);
|
|
7837
7887
|
}, [open, index, place]);
|
|
7838
|
-
|
|
7888
|
+
import_react45.default.useEffect(() => {
|
|
7839
7889
|
if (!open) return;
|
|
7840
7890
|
const onMove = () => place();
|
|
7841
7891
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7854,17 +7904,20 @@ var Tour = (props) => {
|
|
|
7854
7904
|
{
|
|
7855
7905
|
ref: cardRef,
|
|
7856
7906
|
className: "lib-xplat-tour-card",
|
|
7907
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
7857
7908
|
role: "dialog",
|
|
7858
7909
|
"aria-modal": "true",
|
|
7859
7910
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
7860
7911
|
children: [
|
|
7861
|
-
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7912
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-head", children: [
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
7914
|
+
index + 1,
|
|
7915
|
+
" / ",
|
|
7916
|
+
steps.length
|
|
7917
|
+
] }),
|
|
7918
|
+
step.title && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-title", children: step.title })
|
|
7865
7919
|
] }),
|
|
7866
|
-
step.
|
|
7867
|
-
step.description && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-description", children: step.description }),
|
|
7920
|
+
/* @__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 }) }),
|
|
7868
7921
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-actions", children: [
|
|
7869
7922
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
7870
7923
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-nav", children: [
|
|
@@ -7897,7 +7950,7 @@ Tour.displayName = "Tour";
|
|
|
7897
7950
|
var Tour_default = Tour;
|
|
7898
7951
|
|
|
7899
7952
|
// src/components/Video/Video.tsx
|
|
7900
|
-
var
|
|
7953
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
7901
7954
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
7902
7955
|
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: [
|
|
7903
7956
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7909,7 +7962,7 @@ var formatTime = (sec) => {
|
|
|
7909
7962
|
const s = Math.floor(sec % 60);
|
|
7910
7963
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7911
7964
|
};
|
|
7912
|
-
var Video =
|
|
7965
|
+
var Video = import_react46.default.forwardRef((props, ref) => {
|
|
7913
7966
|
const {
|
|
7914
7967
|
src,
|
|
7915
7968
|
poster,
|
|
@@ -7933,21 +7986,21 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
7933
7986
|
children,
|
|
7934
7987
|
...rest
|
|
7935
7988
|
} = props;
|
|
7936
|
-
const containerRef =
|
|
7937
|
-
const videoRef =
|
|
7938
|
-
const [isPlaying, setIsPlaying] =
|
|
7939
|
-
const [isLoaded, setIsLoaded] =
|
|
7940
|
-
const [currentTime, setCurrentTime] =
|
|
7941
|
-
const [duration, setDuration] =
|
|
7942
|
-
const [buffered, setBuffered] =
|
|
7943
|
-
const [volume, setVolume] =
|
|
7944
|
-
const [isMuted, setIsMuted] =
|
|
7945
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7946
|
-
const [playbackRate, setPlaybackRate] =
|
|
7947
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7948
|
-
const [captionsOn, setCaptionsOn] =
|
|
7949
|
-
const [isPip, setIsPip] =
|
|
7950
|
-
const setRefs =
|
|
7989
|
+
const containerRef = import_react46.default.useRef(null);
|
|
7990
|
+
const videoRef = import_react46.default.useRef(null);
|
|
7991
|
+
const [isPlaying, setIsPlaying] = import_react46.default.useState(Boolean(autoPlay));
|
|
7992
|
+
const [isLoaded, setIsLoaded] = import_react46.default.useState(false);
|
|
7993
|
+
const [currentTime, setCurrentTime] = import_react46.default.useState(0);
|
|
7994
|
+
const [duration, setDuration] = import_react46.default.useState(0);
|
|
7995
|
+
const [buffered, setBuffered] = import_react46.default.useState(0);
|
|
7996
|
+
const [volume, setVolume] = import_react46.default.useState(1);
|
|
7997
|
+
const [isMuted, setIsMuted] = import_react46.default.useState(Boolean(muted));
|
|
7998
|
+
const [isFullscreen, setIsFullscreen] = import_react46.default.useState(false);
|
|
7999
|
+
const [playbackRate, setPlaybackRate] = import_react46.default.useState(1);
|
|
8000
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react46.default.useState(false);
|
|
8001
|
+
const [captionsOn, setCaptionsOn] = import_react46.default.useState(false);
|
|
8002
|
+
const [isPip, setIsPip] = import_react46.default.useState(false);
|
|
8003
|
+
const setRefs = import_react46.default.useCallback(
|
|
7951
8004
|
(el) => {
|
|
7952
8005
|
videoRef.current = el;
|
|
7953
8006
|
if (typeof ref === "function") ref(el);
|
|
@@ -7955,14 +8008,14 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
7955
8008
|
},
|
|
7956
8009
|
[ref]
|
|
7957
8010
|
);
|
|
7958
|
-
|
|
8011
|
+
import_react46.default.useEffect(() => {
|
|
7959
8012
|
const onFsChange = () => {
|
|
7960
8013
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7961
8014
|
};
|
|
7962
8015
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7963
8016
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7964
8017
|
}, []);
|
|
7965
|
-
|
|
8018
|
+
import_react46.default.useEffect(() => {
|
|
7966
8019
|
const v = videoRef.current;
|
|
7967
8020
|
if (!v) return;
|
|
7968
8021
|
const onEnter = () => setIsPip(true);
|
|
@@ -5169,7 +5169,7 @@
|
|
|
5169
5169
|
}
|
|
5170
5170
|
.lib-xplat-table-wrapper > .lib-xplat-table {
|
|
5171
5171
|
width: 100%;
|
|
5172
|
-
min-width: 600px;
|
|
5172
|
+
min-width: var(--table-min-width, 600px);
|
|
5173
5173
|
}
|
|
5174
5174
|
.lib-xplat-table-wrapper > .lib-xplat-table > thead.table-sticky {
|
|
5175
5175
|
position: sticky;
|
|
@@ -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
|
@@ -6957,13 +6957,17 @@ var Table = (props) => {
|
|
|
6957
6957
|
rowBorderUse = true,
|
|
6958
6958
|
colBorderUse = true,
|
|
6959
6959
|
headerSticky = false,
|
|
6960
|
-
stickyShadow = true
|
|
6960
|
+
stickyShadow = true,
|
|
6961
|
+
minWidth
|
|
6961
6962
|
} = props;
|
|
6962
6963
|
return /* @__PURE__ */ jsx344(
|
|
6963
6964
|
"div",
|
|
6964
6965
|
{
|
|
6965
6966
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
6966
6967
|
"data-xplat-overlay-escape": "",
|
|
6968
|
+
style: minWidth === void 0 ? void 0 : {
|
|
6969
|
+
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
6970
|
+
},
|
|
6967
6971
|
children: /* @__PURE__ */ jsx344(
|
|
6968
6972
|
TableContext_default.Provider,
|
|
6969
6973
|
{
|
|
@@ -7604,7 +7608,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
7604
7608
|
var Tooltip_default = Tooltip;
|
|
7605
7609
|
|
|
7606
7610
|
// src/components/Tour/Tour.tsx
|
|
7611
|
+
import React45 from "react";
|
|
7612
|
+
|
|
7613
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
7607
7614
|
import React44 from "react";
|
|
7615
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7616
|
+
" ",
|
|
7617
|
+
"PageUp",
|
|
7618
|
+
"PageDown",
|
|
7619
|
+
"Home",
|
|
7620
|
+
"End",
|
|
7621
|
+
"ArrowUp",
|
|
7622
|
+
"ArrowDown",
|
|
7623
|
+
"ArrowLeft",
|
|
7624
|
+
"ArrowRight"
|
|
7625
|
+
]);
|
|
7626
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
7627
|
+
React44.useEffect(() => {
|
|
7628
|
+
if (!enabled) return;
|
|
7629
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7630
|
+
const block = (e) => {
|
|
7631
|
+
if (allowed(e.target)) return;
|
|
7632
|
+
e.preventDefault();
|
|
7633
|
+
};
|
|
7634
|
+
const onKey = (e) => {
|
|
7635
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
7636
|
+
if (allowed(e.target)) return;
|
|
7637
|
+
const el = e.target;
|
|
7638
|
+
const tag = el?.tagName;
|
|
7639
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
7640
|
+
e.preventDefault();
|
|
7641
|
+
};
|
|
7642
|
+
const opts = { passive: false, capture: true };
|
|
7643
|
+
window.addEventListener("wheel", block, opts);
|
|
7644
|
+
window.addEventListener("touchmove", block, opts);
|
|
7645
|
+
window.addEventListener("keydown", onKey, opts);
|
|
7646
|
+
return () => {
|
|
7647
|
+
window.removeEventListener("wheel", block, true);
|
|
7648
|
+
window.removeEventListener("touchmove", block, true);
|
|
7649
|
+
window.removeEventListener("keydown", onKey, true);
|
|
7650
|
+
};
|
|
7651
|
+
}, [enabled, allowRef]);
|
|
7652
|
+
};
|
|
7653
|
+
var useScrollLock_default = useScrollLock;
|
|
7654
|
+
|
|
7655
|
+
// src/components/Tour/Tour.tsx
|
|
7608
7656
|
import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
|
|
7609
7657
|
var VIEWPORT_MARGIN = 16;
|
|
7610
7658
|
var DEFAULT_PADDING = 8;
|
|
@@ -7620,19 +7668,20 @@ var Tour = (props) => {
|
|
|
7620
7668
|
onClose,
|
|
7621
7669
|
current,
|
|
7622
7670
|
onStepChange,
|
|
7671
|
+
width = 380,
|
|
7623
7672
|
nextLabel = "\uB2E4\uC74C",
|
|
7624
7673
|
prevLabel = "\uC774\uC804",
|
|
7625
7674
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7626
7675
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7627
7676
|
} = props;
|
|
7628
|
-
const [uncontrolled, setUncontrolled] =
|
|
7677
|
+
const [uncontrolled, setUncontrolled] = React45.useState(0);
|
|
7629
7678
|
const index = current ?? uncontrolled;
|
|
7630
7679
|
const step = steps[index];
|
|
7631
7680
|
const isLast = index === steps.length - 1;
|
|
7632
|
-
const spotRef =
|
|
7633
|
-
const cardRef =
|
|
7634
|
-
const [targetFound, setTargetFound] =
|
|
7635
|
-
const goTo =
|
|
7681
|
+
const spotRef = React45.useRef(null);
|
|
7682
|
+
const cardRef = React45.useRef(null);
|
|
7683
|
+
const [targetFound, setTargetFound] = React45.useState(true);
|
|
7684
|
+
const goTo = React45.useCallback(
|
|
7636
7685
|
(next) => {
|
|
7637
7686
|
if (current === void 0) setUncontrolled(next);
|
|
7638
7687
|
onStepChange?.(next);
|
|
@@ -7641,9 +7690,10 @@ var Tour = (props) => {
|
|
|
7641
7690
|
);
|
|
7642
7691
|
useEscapeKey(open, () => onClose("skip"));
|
|
7643
7692
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7644
|
-
|
|
7693
|
+
useScrollLock_default(open, cardRef);
|
|
7694
|
+
const stepsRef = React45.useRef(steps);
|
|
7645
7695
|
stepsRef.current = steps;
|
|
7646
|
-
|
|
7696
|
+
React45.useEffect(() => {
|
|
7647
7697
|
if (!open) return;
|
|
7648
7698
|
const target = stepsRef.current[index]?.target;
|
|
7649
7699
|
if (!target) return;
|
|
@@ -7668,7 +7718,7 @@ var Tour = (props) => {
|
|
|
7668
7718
|
stop = true;
|
|
7669
7719
|
};
|
|
7670
7720
|
}, [open, index]);
|
|
7671
|
-
const place =
|
|
7721
|
+
const place = React45.useCallback(() => {
|
|
7672
7722
|
const spot = spotRef.current;
|
|
7673
7723
|
const card = cardRef.current;
|
|
7674
7724
|
if (!spot || !card || !step) return;
|
|
@@ -7709,13 +7759,13 @@ var Tour = (props) => {
|
|
|
7709
7759
|
}
|
|
7710
7760
|
);
|
|
7711
7761
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
7712
|
-
const cardH = Math.min(
|
|
7762
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
7713
7763
|
const cardW = card.offsetWidth;
|
|
7714
|
-
card.style.maxHeight = `${
|
|
7764
|
+
card.style.maxHeight = `${limit}px`;
|
|
7715
7765
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7716
7766
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7717
7767
|
}, [step]);
|
|
7718
|
-
|
|
7768
|
+
React45.useLayoutEffect(() => {
|
|
7719
7769
|
if (!open) return;
|
|
7720
7770
|
place();
|
|
7721
7771
|
let raf = 0;
|
|
@@ -7732,7 +7782,7 @@ var Tour = (props) => {
|
|
|
7732
7782
|
raf = requestAnimationFrame(follow);
|
|
7733
7783
|
return () => cancelAnimationFrame(raf);
|
|
7734
7784
|
}, [open, index, place]);
|
|
7735
|
-
|
|
7785
|
+
React45.useEffect(() => {
|
|
7736
7786
|
if (!open) return;
|
|
7737
7787
|
const onMove = () => place();
|
|
7738
7788
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7751,17 +7801,20 @@ var Tour = (props) => {
|
|
|
7751
7801
|
{
|
|
7752
7802
|
ref: cardRef,
|
|
7753
7803
|
className: "lib-xplat-tour-card",
|
|
7804
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
7754
7805
|
role: "dialog",
|
|
7755
7806
|
"aria-modal": "true",
|
|
7756
7807
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
7757
7808
|
children: [
|
|
7758
|
-
/* @__PURE__ */ jsxs225("div", { className: "tour-card-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7809
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-head", children: [
|
|
7810
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
7811
|
+
index + 1,
|
|
7812
|
+
" / ",
|
|
7813
|
+
steps.length
|
|
7814
|
+
] }),
|
|
7815
|
+
step.title && /* @__PURE__ */ jsx355("div", { className: "tour-card-title", children: step.title })
|
|
7762
7816
|
] }),
|
|
7763
|
-
step.
|
|
7764
|
-
step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }),
|
|
7817
|
+
/* @__PURE__ */ jsx355("div", { className: "tour-card-body", children: step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }) }),
|
|
7765
7818
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-actions", children: [
|
|
7766
7819
|
/* @__PURE__ */ jsx355("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
7767
7820
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-nav", children: [
|
|
@@ -7794,7 +7847,7 @@ Tour.displayName = "Tour";
|
|
|
7794
7847
|
var Tour_default = Tour;
|
|
7795
7848
|
|
|
7796
7849
|
// src/components/Video/Video.tsx
|
|
7797
|
-
import
|
|
7850
|
+
import React46 from "react";
|
|
7798
7851
|
import { jsx as jsx356, jsxs as jsxs226 } from "react/jsx-runtime";
|
|
7799
7852
|
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
7853
|
/* @__PURE__ */ jsx356("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7806,7 +7859,7 @@ var formatTime = (sec) => {
|
|
|
7806
7859
|
const s = Math.floor(sec % 60);
|
|
7807
7860
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7808
7861
|
};
|
|
7809
|
-
var Video =
|
|
7862
|
+
var Video = React46.forwardRef((props, ref) => {
|
|
7810
7863
|
const {
|
|
7811
7864
|
src,
|
|
7812
7865
|
poster,
|
|
@@ -7830,21 +7883,21 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
7830
7883
|
children,
|
|
7831
7884
|
...rest
|
|
7832
7885
|
} = 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 =
|
|
7886
|
+
const containerRef = React46.useRef(null);
|
|
7887
|
+
const videoRef = React46.useRef(null);
|
|
7888
|
+
const [isPlaying, setIsPlaying] = React46.useState(Boolean(autoPlay));
|
|
7889
|
+
const [isLoaded, setIsLoaded] = React46.useState(false);
|
|
7890
|
+
const [currentTime, setCurrentTime] = React46.useState(0);
|
|
7891
|
+
const [duration, setDuration] = React46.useState(0);
|
|
7892
|
+
const [buffered, setBuffered] = React46.useState(0);
|
|
7893
|
+
const [volume, setVolume] = React46.useState(1);
|
|
7894
|
+
const [isMuted, setIsMuted] = React46.useState(Boolean(muted));
|
|
7895
|
+
const [isFullscreen, setIsFullscreen] = React46.useState(false);
|
|
7896
|
+
const [playbackRate, setPlaybackRate] = React46.useState(1);
|
|
7897
|
+
const [rateMenuOpen, setRateMenuOpen] = React46.useState(false);
|
|
7898
|
+
const [captionsOn, setCaptionsOn] = React46.useState(false);
|
|
7899
|
+
const [isPip, setIsPip] = React46.useState(false);
|
|
7900
|
+
const setRefs = React46.useCallback(
|
|
7848
7901
|
(el) => {
|
|
7849
7902
|
videoRef.current = el;
|
|
7850
7903
|
if (typeof ref === "function") ref(el);
|
|
@@ -7852,14 +7905,14 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
7852
7905
|
},
|
|
7853
7906
|
[ref]
|
|
7854
7907
|
);
|
|
7855
|
-
|
|
7908
|
+
React46.useEffect(() => {
|
|
7856
7909
|
const onFsChange = () => {
|
|
7857
7910
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
7858
7911
|
};
|
|
7859
7912
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
7860
7913
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
7861
7914
|
}, []);
|
|
7862
|
-
|
|
7915
|
+
React46.useEffect(() => {
|
|
7863
7916
|
const v = videoRef.current;
|
|
7864
7917
|
if (!v) return;
|
|
7865
7918
|
const onEnter = () => setIsPip(true);
|