@x-plat/design-system 0.15.6 → 0.16.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/components/Tour/index.cjs +338 -0
- package/dist/components/Tour/index.css +117 -0
- package/dist/components/Tour/index.d.cts +79 -0
- package/dist/components/Tour/index.d.ts +79 -0
- package/dist/components/Tour/index.js +301 -0
- package/dist/components/index.cjs +213 -53
- package/dist/components/index.css +116 -0
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +212 -53
- package/dist/index.cjs +237 -77
- package/dist/index.css +116 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +236 -77
- package/guidelines/Guidelines.md +1 -0
- package/guidelines/components/tour.md +93 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11589,7 +11589,7 @@ var Tooltip = (props) => {
|
|
|
11589
11589
|
const delayTimer = React43.useRef(0);
|
|
11590
11590
|
const rafRef = React43.useRef(0);
|
|
11591
11591
|
const cursor = React43.useRef(null);
|
|
11592
|
-
const
|
|
11592
|
+
const clamp2 = React43.useCallback((left, top, w, h) => {
|
|
11593
11593
|
const vw = window.innerWidth;
|
|
11594
11594
|
const vh = window.innerHeight;
|
|
11595
11595
|
return {
|
|
@@ -11606,8 +11606,8 @@ var Tooltip = (props) => {
|
|
|
11606
11606
|
let top = y - h - OFFSET;
|
|
11607
11607
|
if (left + w > window.innerWidth - GAP) left = x - w - OFFSET;
|
|
11608
11608
|
if (top < GAP) top = y + OFFSET;
|
|
11609
|
-
setPos(
|
|
11610
|
-
}, [
|
|
11609
|
+
setPos(clamp2(left, top, w, h));
|
|
11610
|
+
}, [clamp2]);
|
|
11611
11611
|
const placeAtTrigger = React43.useCallback(() => {
|
|
11612
11612
|
const el = tooltipRef.current;
|
|
11613
11613
|
const trigger = triggerRef.current;
|
|
@@ -11618,8 +11618,8 @@ var Tooltip = (props) => {
|
|
|
11618
11618
|
let top = rect.top - h - GAP;
|
|
11619
11619
|
if (top < GAP) top = rect.bottom + GAP;
|
|
11620
11620
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
11621
|
-
setPos(
|
|
11622
|
-
}, [
|
|
11621
|
+
setPos(clamp2(left, top, w, h));
|
|
11622
|
+
}, [clamp2]);
|
|
11623
11623
|
const reposition = React43.useCallback(() => {
|
|
11624
11624
|
if (follow && cursor.current) {
|
|
11625
11625
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
@@ -11706,12 +11706,170 @@ var Tooltip = (props) => {
|
|
|
11706
11706
|
Tooltip.displayName = "Tooltip";
|
|
11707
11707
|
var Tooltip_default = Tooltip;
|
|
11708
11708
|
|
|
11709
|
-
// src/components/
|
|
11709
|
+
// src/components/Tour/Tour.tsx
|
|
11710
11710
|
import React44 from "react";
|
|
11711
11711
|
import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
|
|
11712
|
-
var
|
|
11713
|
-
|
|
11714
|
-
|
|
11712
|
+
var VIEWPORT_MARGIN = 16;
|
|
11713
|
+
var DEFAULT_PADDING = 8;
|
|
11714
|
+
var clamp = (v, min, max) => Math.max(min, Math.min(v, max));
|
|
11715
|
+
var resolve = (target) => {
|
|
11716
|
+
if (typeof target === "string") return document.querySelector(target);
|
|
11717
|
+
return target.current;
|
|
11718
|
+
};
|
|
11719
|
+
var Tour = (props) => {
|
|
11720
|
+
const {
|
|
11721
|
+
open,
|
|
11722
|
+
steps,
|
|
11723
|
+
onClose,
|
|
11724
|
+
current,
|
|
11725
|
+
onStepChange,
|
|
11726
|
+
nextLabel = "\uB2E4\uC74C",
|
|
11727
|
+
prevLabel = "\uC774\uC804",
|
|
11728
|
+
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
11729
|
+
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
11730
|
+
} = props;
|
|
11731
|
+
const [uncontrolled, setUncontrolled] = React44.useState(0);
|
|
11732
|
+
const index = current ?? uncontrolled;
|
|
11733
|
+
const step = steps[index];
|
|
11734
|
+
const isLast = index === steps.length - 1;
|
|
11735
|
+
const spotRef = React44.useRef(null);
|
|
11736
|
+
const cardRef = React44.useRef(null);
|
|
11737
|
+
const [targetFound, setTargetFound] = React44.useState(true);
|
|
11738
|
+
const goTo = React44.useCallback(
|
|
11739
|
+
(next) => {
|
|
11740
|
+
if (current === void 0) setUncontrolled(next);
|
|
11741
|
+
onStepChange?.(next);
|
|
11742
|
+
},
|
|
11743
|
+
[current, onStepChange]
|
|
11744
|
+
);
|
|
11745
|
+
useEscapeKey(open, () => onClose("skip"));
|
|
11746
|
+
useFocusTrap(cardRef, open, { trap: true });
|
|
11747
|
+
React44.useEffect(() => {
|
|
11748
|
+
if (!open || !step) return;
|
|
11749
|
+
const el = resolve(step.target);
|
|
11750
|
+
setTargetFound(!!el);
|
|
11751
|
+
el?.scrollIntoView({ block: "center", inline: "nearest", behavior: "smooth" });
|
|
11752
|
+
}, [open, step]);
|
|
11753
|
+
const place = React44.useCallback(() => {
|
|
11754
|
+
const spot = spotRef.current;
|
|
11755
|
+
const card = cardRef.current;
|
|
11756
|
+
if (!spot || !card || !step) return;
|
|
11757
|
+
const el = resolve(step.target);
|
|
11758
|
+
const pad = step.padding ?? DEFAULT_PADDING;
|
|
11759
|
+
let hole;
|
|
11760
|
+
if (el) {
|
|
11761
|
+
const r2 = el.getBoundingClientRect();
|
|
11762
|
+
hole = {
|
|
11763
|
+
top: r2.top - pad,
|
|
11764
|
+
left: r2.left - pad,
|
|
11765
|
+
width: r2.width + pad * 2,
|
|
11766
|
+
height: r2.height + pad * 2
|
|
11767
|
+
};
|
|
11768
|
+
spot.style.visibility = "visible";
|
|
11769
|
+
} else {
|
|
11770
|
+
hole = { top: window.innerHeight / 2, left: window.innerWidth / 2, width: 0, height: 0 };
|
|
11771
|
+
spot.style.visibility = "hidden";
|
|
11772
|
+
}
|
|
11773
|
+
spot.style.top = `${hole.top}px`;
|
|
11774
|
+
spot.style.left = `${hole.left}px`;
|
|
11775
|
+
spot.style.width = `${hole.width}px`;
|
|
11776
|
+
spot.style.height = `${hole.height}px`;
|
|
11777
|
+
const placed = computePlacement(
|
|
11778
|
+
{
|
|
11779
|
+
top: hole.top,
|
|
11780
|
+
bottom: hole.top + hole.height,
|
|
11781
|
+
left: hole.left,
|
|
11782
|
+
right: hole.left + hole.width
|
|
11783
|
+
},
|
|
11784
|
+
card.offsetWidth,
|
|
11785
|
+
Math.max(card.offsetHeight, card.scrollHeight),
|
|
11786
|
+
{
|
|
11787
|
+
top: VIEWPORT_MARGIN,
|
|
11788
|
+
bottom: window.innerHeight - VIEWPORT_MARGIN,
|
|
11789
|
+
left: VIEWPORT_MARGIN,
|
|
11790
|
+
right: window.innerWidth - VIEWPORT_MARGIN
|
|
11791
|
+
}
|
|
11792
|
+
);
|
|
11793
|
+
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
11794
|
+
const cardH = Math.min(placed.maxHeight ?? card.offsetHeight, limit);
|
|
11795
|
+
const cardW = card.offsetWidth;
|
|
11796
|
+
card.style.maxHeight = `${cardH}px`;
|
|
11797
|
+
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
11798
|
+
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
11799
|
+
}, [step]);
|
|
11800
|
+
React44.useLayoutEffect(() => {
|
|
11801
|
+
if (!open) return;
|
|
11802
|
+
place();
|
|
11803
|
+
const t = setTimeout(place, 400);
|
|
11804
|
+
return () => clearTimeout(t);
|
|
11805
|
+
}, [open, place]);
|
|
11806
|
+
React44.useEffect(() => {
|
|
11807
|
+
if (!open) return;
|
|
11808
|
+
const onMove = () => place();
|
|
11809
|
+
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
11810
|
+
window.addEventListener("resize", onMove, { passive: true });
|
|
11811
|
+
return () => {
|
|
11812
|
+
window.removeEventListener("scroll", onMove, true);
|
|
11813
|
+
window.removeEventListener("resize", onMove);
|
|
11814
|
+
};
|
|
11815
|
+
}, [open, place]);
|
|
11816
|
+
if (!open || !step) return null;
|
|
11817
|
+
return /* @__PURE__ */ jsx355(Portal_default, { children: /* @__PURE__ */ jsxs225("div", { className: "lib-xplat-tour", role: "presentation", children: [
|
|
11818
|
+
!targetFound && /* @__PURE__ */ jsx355("div", { className: "lib-xplat-tour-dim" }),
|
|
11819
|
+
/* @__PURE__ */ jsx355("div", { ref: spotRef, className: "lib-xplat-tour-spotlight", "aria-hidden": true }),
|
|
11820
|
+
/* @__PURE__ */ jsxs225(
|
|
11821
|
+
"div",
|
|
11822
|
+
{
|
|
11823
|
+
ref: cardRef,
|
|
11824
|
+
className: "lib-xplat-tour-card",
|
|
11825
|
+
role: "dialog",
|
|
11826
|
+
"aria-modal": "true",
|
|
11827
|
+
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
11828
|
+
children: [
|
|
11829
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
11830
|
+
index + 1,
|
|
11831
|
+
" / ",
|
|
11832
|
+
steps.length
|
|
11833
|
+
] }),
|
|
11834
|
+
step.title && /* @__PURE__ */ jsx355("div", { className: "tour-card-title", children: step.title }),
|
|
11835
|
+
step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }),
|
|
11836
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-actions", children: [
|
|
11837
|
+
/* @__PURE__ */ jsx355("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
11838
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-nav", children: [
|
|
11839
|
+
index > 0 && /* @__PURE__ */ jsx355(
|
|
11840
|
+
"button",
|
|
11841
|
+
{
|
|
11842
|
+
type: "button",
|
|
11843
|
+
className: clsx_default("tour-nav", "secondary"),
|
|
11844
|
+
onClick: () => goTo(index - 1),
|
|
11845
|
+
children: prevLabel
|
|
11846
|
+
}
|
|
11847
|
+
),
|
|
11848
|
+
/* @__PURE__ */ jsx355(
|
|
11849
|
+
"button",
|
|
11850
|
+
{
|
|
11851
|
+
type: "button",
|
|
11852
|
+
className: clsx_default("tour-nav", "primary"),
|
|
11853
|
+
onClick: () => isLast ? onClose("done") : goTo(index + 1),
|
|
11854
|
+
children: isLast ? doneLabel : nextLabel
|
|
11855
|
+
}
|
|
11856
|
+
)
|
|
11857
|
+
] })
|
|
11858
|
+
] })
|
|
11859
|
+
]
|
|
11860
|
+
}
|
|
11861
|
+
)
|
|
11862
|
+
] }) });
|
|
11863
|
+
};
|
|
11864
|
+
Tour.displayName = "Tour";
|
|
11865
|
+
var Tour_default = Tour;
|
|
11866
|
+
|
|
11867
|
+
// src/components/Video/Video.tsx
|
|
11868
|
+
import React45 from "react";
|
|
11869
|
+
import { jsx as jsx356, jsxs as jsxs226 } from "react/jsx-runtime";
|
|
11870
|
+
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: [
|
|
11871
|
+
/* @__PURE__ */ jsx356("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
11872
|
+
/* @__PURE__ */ jsx356("rect", { x: "12", y: "11", width: "7", height: "6", rx: "1", fill: "currentColor" })
|
|
11715
11873
|
] });
|
|
11716
11874
|
var formatTime = (sec) => {
|
|
11717
11875
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -11719,7 +11877,7 @@ var formatTime = (sec) => {
|
|
|
11719
11877
|
const s = Math.floor(sec % 60);
|
|
11720
11878
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
11721
11879
|
};
|
|
11722
|
-
var Video =
|
|
11880
|
+
var Video = React45.forwardRef((props, ref) => {
|
|
11723
11881
|
const {
|
|
11724
11882
|
src,
|
|
11725
11883
|
poster,
|
|
@@ -11743,21 +11901,21 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11743
11901
|
children,
|
|
11744
11902
|
...rest
|
|
11745
11903
|
} = props;
|
|
11746
|
-
const containerRef =
|
|
11747
|
-
const videoRef =
|
|
11748
|
-
const [isPlaying, setIsPlaying] =
|
|
11749
|
-
const [isLoaded, setIsLoaded] =
|
|
11750
|
-
const [currentTime, setCurrentTime] =
|
|
11751
|
-
const [duration, setDuration] =
|
|
11752
|
-
const [buffered, setBuffered] =
|
|
11753
|
-
const [volume, setVolume] =
|
|
11754
|
-
const [isMuted, setIsMuted] =
|
|
11755
|
-
const [isFullscreen, setIsFullscreen] =
|
|
11756
|
-
const [playbackRate, setPlaybackRate] =
|
|
11757
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
11758
|
-
const [captionsOn, setCaptionsOn] =
|
|
11759
|
-
const [isPip, setIsPip] =
|
|
11760
|
-
const setRefs =
|
|
11904
|
+
const containerRef = React45.useRef(null);
|
|
11905
|
+
const videoRef = React45.useRef(null);
|
|
11906
|
+
const [isPlaying, setIsPlaying] = React45.useState(Boolean(autoPlay));
|
|
11907
|
+
const [isLoaded, setIsLoaded] = React45.useState(false);
|
|
11908
|
+
const [currentTime, setCurrentTime] = React45.useState(0);
|
|
11909
|
+
const [duration, setDuration] = React45.useState(0);
|
|
11910
|
+
const [buffered, setBuffered] = React45.useState(0);
|
|
11911
|
+
const [volume, setVolume] = React45.useState(1);
|
|
11912
|
+
const [isMuted, setIsMuted] = React45.useState(Boolean(muted));
|
|
11913
|
+
const [isFullscreen, setIsFullscreen] = React45.useState(false);
|
|
11914
|
+
const [playbackRate, setPlaybackRate] = React45.useState(1);
|
|
11915
|
+
const [rateMenuOpen, setRateMenuOpen] = React45.useState(false);
|
|
11916
|
+
const [captionsOn, setCaptionsOn] = React45.useState(false);
|
|
11917
|
+
const [isPip, setIsPip] = React45.useState(false);
|
|
11918
|
+
const setRefs = React45.useCallback(
|
|
11761
11919
|
(el) => {
|
|
11762
11920
|
videoRef.current = el;
|
|
11763
11921
|
if (typeof ref === "function") ref(el);
|
|
@@ -11765,14 +11923,14 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11765
11923
|
},
|
|
11766
11924
|
[ref]
|
|
11767
11925
|
);
|
|
11768
|
-
|
|
11926
|
+
React45.useEffect(() => {
|
|
11769
11927
|
const onFsChange = () => {
|
|
11770
11928
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
11771
11929
|
};
|
|
11772
11930
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
11773
11931
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
11774
11932
|
}, []);
|
|
11775
|
-
|
|
11933
|
+
React45.useEffect(() => {
|
|
11776
11934
|
const v = videoRef.current;
|
|
11777
11935
|
if (!v) return;
|
|
11778
11936
|
const onEnter = () => setIsPip(true);
|
|
@@ -11886,13 +12044,13 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11886
12044
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
11887
12045
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
11888
12046
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
11889
|
-
return /* @__PURE__ */
|
|
12047
|
+
return /* @__PURE__ */ jsxs226(
|
|
11890
12048
|
"div",
|
|
11891
12049
|
{
|
|
11892
12050
|
ref: containerRef,
|
|
11893
12051
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
11894
12052
|
children: [
|
|
11895
|
-
/* @__PURE__ */
|
|
12053
|
+
/* @__PURE__ */ jsx356(
|
|
11896
12054
|
"video",
|
|
11897
12055
|
{
|
|
11898
12056
|
ref: setRefs,
|
|
@@ -11913,7 +12071,7 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11913
12071
|
children
|
|
11914
12072
|
}
|
|
11915
12073
|
),
|
|
11916
|
-
showCenterPlay && /* @__PURE__ */
|
|
12074
|
+
showCenterPlay && /* @__PURE__ */ jsx356(
|
|
11917
12075
|
"button",
|
|
11918
12076
|
{
|
|
11919
12077
|
type: "button",
|
|
@@ -11925,11 +12083,11 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11925
12083
|
onClick: togglePlay,
|
|
11926
12084
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
11927
12085
|
tabIndex: -1,
|
|
11928
|
-
children: /* @__PURE__ */
|
|
12086
|
+
children: /* @__PURE__ */ jsx356("span", { className: "center-play-icon", children: /* @__PURE__ */ jsx356(PlayCircleIcon_default, {}) })
|
|
11929
12087
|
}
|
|
11930
12088
|
),
|
|
11931
|
-
showControls && /* @__PURE__ */
|
|
11932
|
-
/* @__PURE__ */
|
|
12089
|
+
showControls && /* @__PURE__ */ jsxs226("div", { className: "controls", onClick: (e) => e.stopPropagation(), children: [
|
|
12090
|
+
/* @__PURE__ */ jsx356(
|
|
11933
12091
|
"input",
|
|
11934
12092
|
{
|
|
11935
12093
|
type: "range",
|
|
@@ -11946,29 +12104,29 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11946
12104
|
}
|
|
11947
12105
|
}
|
|
11948
12106
|
),
|
|
11949
|
-
/* @__PURE__ */
|
|
11950
|
-
/* @__PURE__ */
|
|
12107
|
+
/* @__PURE__ */ jsxs226("div", { className: "controls-row", children: [
|
|
12108
|
+
/* @__PURE__ */ jsx356(
|
|
11951
12109
|
"button",
|
|
11952
12110
|
{
|
|
11953
12111
|
type: "button",
|
|
11954
12112
|
className: "control-btn",
|
|
11955
12113
|
onClick: togglePlay,
|
|
11956
12114
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
11957
|
-
children: isPlaying ? /* @__PURE__ */
|
|
12115
|
+
children: isPlaying ? /* @__PURE__ */ jsx356(PauseIcon_default, {}) : /* @__PURE__ */ jsx356(PlayIcon_default, {})
|
|
11958
12116
|
}
|
|
11959
12117
|
),
|
|
11960
|
-
/* @__PURE__ */
|
|
11961
|
-
/* @__PURE__ */
|
|
12118
|
+
/* @__PURE__ */ jsxs226("div", { className: "volume-group", children: [
|
|
12119
|
+
/* @__PURE__ */ jsx356(
|
|
11962
12120
|
"button",
|
|
11963
12121
|
{
|
|
11964
12122
|
type: "button",
|
|
11965
12123
|
className: "control-btn",
|
|
11966
12124
|
onClick: toggleMute,
|
|
11967
12125
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
11968
|
-
children: /* @__PURE__ */
|
|
12126
|
+
children: /* @__PURE__ */ jsx356(VolumeGlyph, {})
|
|
11969
12127
|
}
|
|
11970
12128
|
),
|
|
11971
|
-
/* @__PURE__ */
|
|
12129
|
+
/* @__PURE__ */ jsx356(
|
|
11972
12130
|
"input",
|
|
11973
12131
|
{
|
|
11974
12132
|
type: "range",
|
|
@@ -11983,14 +12141,14 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
11983
12141
|
}
|
|
11984
12142
|
)
|
|
11985
12143
|
] }),
|
|
11986
|
-
/* @__PURE__ */
|
|
12144
|
+
/* @__PURE__ */ jsxs226("span", { className: "time", children: [
|
|
11987
12145
|
formatTime(currentTime),
|
|
11988
12146
|
" / ",
|
|
11989
12147
|
formatTime(duration)
|
|
11990
12148
|
] }),
|
|
11991
|
-
/* @__PURE__ */
|
|
11992
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */
|
|
11993
|
-
/* @__PURE__ */
|
|
12149
|
+
/* @__PURE__ */ jsx356("div", { className: "controls-spacer" }),
|
|
12150
|
+
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ jsxs226("div", { className: clsx_default("rate-group", rateMenuOpen && "is-open"), children: [
|
|
12151
|
+
/* @__PURE__ */ jsxs226(
|
|
11994
12152
|
"button",
|
|
11995
12153
|
{
|
|
11996
12154
|
type: "button",
|
|
@@ -12004,7 +12162,7 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
12004
12162
|
]
|
|
12005
12163
|
}
|
|
12006
12164
|
),
|
|
12007
|
-
rateMenuOpen && /* @__PURE__ */
|
|
12165
|
+
rateMenuOpen && /* @__PURE__ */ jsx356("ul", { className: "rate-menu", role: "menu", children: playbackRates.map((r2) => /* @__PURE__ */ jsx356("li", { children: /* @__PURE__ */ jsxs226(
|
|
12008
12166
|
"button",
|
|
12009
12167
|
{
|
|
12010
12168
|
type: "button",
|
|
@@ -12018,7 +12176,7 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
12018
12176
|
}
|
|
12019
12177
|
) }, r2)) })
|
|
12020
12178
|
] }),
|
|
12021
|
-
showCaptions && /* @__PURE__ */
|
|
12179
|
+
showCaptions && /* @__PURE__ */ jsx356(
|
|
12022
12180
|
"button",
|
|
12023
12181
|
{
|
|
12024
12182
|
type: "button",
|
|
@@ -12026,37 +12184,37 @@ var Video = React44.forwardRef((props, ref) => {
|
|
|
12026
12184
|
onClick: toggleCaptions,
|
|
12027
12185
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
12028
12186
|
"aria-pressed": captionsOn,
|
|
12029
|
-
children: /* @__PURE__ */
|
|
12187
|
+
children: /* @__PURE__ */ jsx356(TypeIcon_default, {})
|
|
12030
12188
|
}
|
|
12031
12189
|
),
|
|
12032
|
-
showPip && pipSupported && /* @__PURE__ */
|
|
12190
|
+
showPip && pipSupported && /* @__PURE__ */ jsx356(
|
|
12033
12191
|
"button",
|
|
12034
12192
|
{
|
|
12035
12193
|
type: "button",
|
|
12036
12194
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
12037
12195
|
onClick: togglePip,
|
|
12038
12196
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
12039
|
-
children: /* @__PURE__ */
|
|
12197
|
+
children: /* @__PURE__ */ jsx356(PipIcon, {})
|
|
12040
12198
|
}
|
|
12041
12199
|
),
|
|
12042
|
-
showDownload && /* @__PURE__ */
|
|
12200
|
+
showDownload && /* @__PURE__ */ jsx356(
|
|
12043
12201
|
"a",
|
|
12044
12202
|
{
|
|
12045
12203
|
className: "control-btn",
|
|
12046
12204
|
href: src,
|
|
12047
12205
|
download: downloadFileName ?? true,
|
|
12048
12206
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
12049
|
-
children: /* @__PURE__ */
|
|
12207
|
+
children: /* @__PURE__ */ jsx356(DownloadIcon_default, {})
|
|
12050
12208
|
}
|
|
12051
12209
|
),
|
|
12052
|
-
/* @__PURE__ */
|
|
12210
|
+
/* @__PURE__ */ jsx356(
|
|
12053
12211
|
"button",
|
|
12054
12212
|
{
|
|
12055
12213
|
type: "button",
|
|
12056
12214
|
className: "control-btn",
|
|
12057
12215
|
onClick: toggleFullscreen,
|
|
12058
12216
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
12059
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
12217
|
+
children: isFullscreen ? /* @__PURE__ */ jsx356(MinimizeIcon_default, {}) : /* @__PURE__ */ jsx356(MaximizeIcon_default, {})
|
|
12060
12218
|
}
|
|
12061
12219
|
)
|
|
12062
12220
|
] })
|
|
@@ -12069,7 +12227,7 @@ Video.displayName = "Video";
|
|
|
12069
12227
|
var Video_default = Video;
|
|
12070
12228
|
|
|
12071
12229
|
// src/layout/Grid/FullGrid/FullGrid.tsx
|
|
12072
|
-
import { jsx as
|
|
12230
|
+
import { jsx as jsx357 } from "react/jsx-runtime";
|
|
12073
12231
|
var GAP_MAP = {
|
|
12074
12232
|
none: "var(--spacing-space-none)",
|
|
12075
12233
|
xs: "var(--spacing-space-1)",
|
|
@@ -12082,13 +12240,13 @@ var GAP_MAP = {
|
|
|
12082
12240
|
var FullGrid = (props) => {
|
|
12083
12241
|
const { children, gap } = props;
|
|
12084
12242
|
const style = gap != null ? { gap: GAP_MAP[gap] } : void 0;
|
|
12085
|
-
return /* @__PURE__ */
|
|
12243
|
+
return /* @__PURE__ */ jsx357("div", { className: "lib-xplat-full-grid", style, children });
|
|
12086
12244
|
};
|
|
12087
12245
|
FullGrid.displayName = "FullGrid";
|
|
12088
12246
|
var FullGrid_default = FullGrid;
|
|
12089
12247
|
|
|
12090
12248
|
// src/layout/Grid/FullScreen/FullScreen.tsx
|
|
12091
|
-
import { jsx as
|
|
12249
|
+
import { jsx as jsx358 } from "react/jsx-runtime";
|
|
12092
12250
|
var GAP_MAP2 = {
|
|
12093
12251
|
none: "var(--spacing-space-none)",
|
|
12094
12252
|
xs: "var(--spacing-space-1)",
|
|
@@ -12101,13 +12259,13 @@ var GAP_MAP2 = {
|
|
|
12101
12259
|
var FullScreen = (props) => {
|
|
12102
12260
|
const { children, gap } = props;
|
|
12103
12261
|
const style = gap != null ? { gap: GAP_MAP2[gap] } : void 0;
|
|
12104
|
-
return /* @__PURE__ */
|
|
12262
|
+
return /* @__PURE__ */ jsx358("div", { className: "lib-xplat-full-screen", style, children });
|
|
12105
12263
|
};
|
|
12106
12264
|
FullScreen.displayName = "FullScreen";
|
|
12107
12265
|
var FullScreen_default = FullScreen;
|
|
12108
12266
|
|
|
12109
12267
|
// src/layout/Grid/Item/Item.tsx
|
|
12110
|
-
import { jsx as
|
|
12268
|
+
import { jsx as jsx359 } from "react/jsx-runtime";
|
|
12111
12269
|
var calculateSpans = (column) => {
|
|
12112
12270
|
const spans = {};
|
|
12113
12271
|
let inherited = column.default;
|
|
@@ -12124,36 +12282,36 @@ var GridItem = ({ column, children, className }) => {
|
|
|
12124
12282
|
Object.entries(spans).forEach(([key, value]) => {
|
|
12125
12283
|
style[`--column-${key}`] = value;
|
|
12126
12284
|
});
|
|
12127
|
-
return /* @__PURE__ */
|
|
12285
|
+
return /* @__PURE__ */ jsx359("div", { className: clsx_default("lib-xplat-grid-item", className), style, children });
|
|
12128
12286
|
};
|
|
12129
12287
|
GridItem.displayName = "GridItem";
|
|
12130
12288
|
var Item_default = GridItem;
|
|
12131
12289
|
|
|
12132
12290
|
// src/layout/Header/Header.tsx
|
|
12133
|
-
import { jsx as
|
|
12291
|
+
import { jsx as jsx360, jsxs as jsxs227 } from "react/jsx-runtime";
|
|
12134
12292
|
var Header = ({
|
|
12135
12293
|
leftContent,
|
|
12136
12294
|
logo,
|
|
12137
12295
|
centerContent,
|
|
12138
12296
|
rightContent
|
|
12139
12297
|
}) => {
|
|
12140
|
-
return /* @__PURE__ */
|
|
12141
|
-
/* @__PURE__ */
|
|
12142
|
-
/* @__PURE__ */
|
|
12143
|
-
/* @__PURE__ */
|
|
12298
|
+
return /* @__PURE__ */ jsxs227("div", { className: "lib-xplat-layout-header", children: [
|
|
12299
|
+
/* @__PURE__ */ jsx360("div", { children: leftContent ?? logo }),
|
|
12300
|
+
/* @__PURE__ */ jsx360("div", { children: centerContent }),
|
|
12301
|
+
/* @__PURE__ */ jsx360("div", { children: rightContent })
|
|
12144
12302
|
] });
|
|
12145
12303
|
};
|
|
12146
12304
|
Header.displayName = "Header";
|
|
12147
12305
|
var Header_default = Header;
|
|
12148
12306
|
|
|
12149
12307
|
// src/layout/Layout/Layout.tsx
|
|
12150
|
-
import { Fragment as Fragment7, jsx as
|
|
12308
|
+
import { Fragment as Fragment7, jsx as jsx361, jsxs as jsxs228 } from "react/jsx-runtime";
|
|
12151
12309
|
var Layout = (props) => {
|
|
12152
12310
|
const { header, sideBar, children } = props;
|
|
12153
|
-
return /* @__PURE__ */
|
|
12154
|
-
sideBar && /* @__PURE__ */
|
|
12155
|
-
/* @__PURE__ */
|
|
12156
|
-
header && /* @__PURE__ */
|
|
12311
|
+
return /* @__PURE__ */ jsx361("div", { className: "lib-xplat-layout", children: /* @__PURE__ */ jsxs228("div", { className: "lib-xplat-layout-content-wrapper", children: [
|
|
12312
|
+
sideBar && /* @__PURE__ */ jsx361(Fragment7, { children: sideBar }),
|
|
12313
|
+
/* @__PURE__ */ jsxs228("div", { className: "lib-xplat-layout-content", children: [
|
|
12314
|
+
header && /* @__PURE__ */ jsx361("div", { className: "lib-xplat-layout-content-header", children: header }),
|
|
12157
12315
|
children
|
|
12158
12316
|
] })
|
|
12159
12317
|
] }) });
|
|
@@ -12162,31 +12320,31 @@ Layout.displayName = "Layout";
|
|
|
12162
12320
|
var Layout_default = Layout;
|
|
12163
12321
|
|
|
12164
12322
|
// src/layout/SideBar/SideBar.tsx
|
|
12165
|
-
import
|
|
12323
|
+
import React47 from "react";
|
|
12166
12324
|
|
|
12167
12325
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12168
|
-
import
|
|
12169
|
-
var SideBarContext =
|
|
12326
|
+
import React46 from "react";
|
|
12327
|
+
var SideBarContext = React46.createContext(null);
|
|
12170
12328
|
var useSideBarContext = () => {
|
|
12171
|
-
const ctx =
|
|
12329
|
+
const ctx = React46.useContext(SideBarContext);
|
|
12172
12330
|
if (!ctx) throw new Error("Error");
|
|
12173
12331
|
return ctx;
|
|
12174
12332
|
};
|
|
12175
12333
|
var SideBarContext_default = SideBarContext;
|
|
12176
12334
|
|
|
12177
12335
|
// src/layout/SideBar/SideBar.tsx
|
|
12178
|
-
import { jsx as
|
|
12336
|
+
import { jsx as jsx362 } from "react/jsx-runtime";
|
|
12179
12337
|
var SideBar = (props) => {
|
|
12180
12338
|
const { children, className } = props;
|
|
12181
|
-
const [isOpen, setIsOpen] =
|
|
12339
|
+
const [isOpen, setIsOpen] = React47.useState(true);
|
|
12182
12340
|
const handleSwitchSideBar = () => {
|
|
12183
12341
|
setIsOpen((prev) => !prev);
|
|
12184
12342
|
};
|
|
12185
|
-
return /* @__PURE__ */
|
|
12343
|
+
return /* @__PURE__ */ jsx362(
|
|
12186
12344
|
SideBarContext_default.Provider,
|
|
12187
12345
|
{
|
|
12188
12346
|
value: { isSidebarOpen: isOpen, handleSwitchSideBar },
|
|
12189
|
-
children: /* @__PURE__ */
|
|
12347
|
+
children: /* @__PURE__ */ jsx362(
|
|
12190
12348
|
"div",
|
|
12191
12349
|
{
|
|
12192
12350
|
className: clsx_default(
|
|
@@ -12525,6 +12683,7 @@ export {
|
|
|
12525
12683
|
ToggleRightIcon_default as ToggleRightIcon,
|
|
12526
12684
|
ToolIcon_default as ToolIcon,
|
|
12527
12685
|
Tooltip_default as Tooltip,
|
|
12686
|
+
Tour_default as Tour,
|
|
12528
12687
|
Trash2Icon_default as Trash2Icon,
|
|
12529
12688
|
TrashIcon_default as TrashIcon,
|
|
12530
12689
|
TrelloIcon_default as TrelloIcon,
|
package/guidelines/Guidelines.md
CHANGED
|
@@ -67,6 +67,7 @@ React 기반 디자인 시스템 라이브러리이다. Figma Make Kit과 1:1
|
|
|
67
67
|
- [파일 & 미디어](./components/file-media.md) - FileUpload, ImageSelector, Video
|
|
68
68
|
- [Swiper](./components/swiper.md)
|
|
69
69
|
- [Editor](./components/editor.md)
|
|
70
|
+
- [Tour](./components/tour.md) - 화면 안내(딤 + 구멍 + 단계)
|
|
70
71
|
- [Link](./components/link.md)
|
|
71
72
|
- [Stat](./components/stat.md)
|
|
72
73
|
- [TimePicker](./components/time-picker.md)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Tour
|
|
2
|
+
|
|
3
|
+
화면을 어둡게 덮고 **가리킬 요소만 밝게 뚫어** 설명을 붙인다. 단계로 이어
|
|
4
|
+
가며 "어디를 누르면 무엇이 되는지" 를 보여 줄 때 쓴다.
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
import { Tour, type TourStep } from "@x-plat/design-system";
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
const [guide, setGuide] = useState(true);
|
|
12
|
+
|
|
13
|
+
<Tour
|
|
14
|
+
open={guide}
|
|
15
|
+
onClose={(why) => {
|
|
16
|
+
if (why === "done") localStorage.setItem("seen-guide", "1");
|
|
17
|
+
setGuide(false);
|
|
18
|
+
}}
|
|
19
|
+
steps={[
|
|
20
|
+
{ target: "#save", title: "저장", description: "여기를 누르면 바로 반영돼요" },
|
|
21
|
+
{ target: filterRef, title: "거르개", description: "목록을 좁힐 수 있어요" },
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Prop | 타입 | 기본값 | 설명 |
|
|
27
|
+
|------|------|--------|------|
|
|
28
|
+
| open `*` | `boolean` | — | 띄울지 |
|
|
29
|
+
| steps `*` | `TourStep[]` | — | 단계 목록. 순서대로 돈다 |
|
|
30
|
+
| onClose `*` | `(reason: "done" \| "skip") => void` | — | 닫힐 때. 끝까지 봤는지 건너뛴 건지 알려 준다 |
|
|
31
|
+
| current | `number` | — | 지금 단계. 주면 controlled |
|
|
32
|
+
| onStepChange | `(index: number) => void` | — | 단계가 바뀔 때 |
|
|
33
|
+
| nextLabel | `string` | `"다음"` | |
|
|
34
|
+
| prevLabel | `string` | `"이전"` | |
|
|
35
|
+
| skipLabel | `string` | `"건너뛰기"` | |
|
|
36
|
+
| doneLabel | `string` | `"다 봤어요"` | |
|
|
37
|
+
|
|
38
|
+
### TourStep
|
|
39
|
+
|
|
40
|
+
| 키 | 타입 | 설명 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| target `*` | `string \| RefObject<HTMLElement>` | CSS 선택자나 ref |
|
|
43
|
+
| title | `ReactNode` | |
|
|
44
|
+
| description | `ReactNode` | |
|
|
45
|
+
| padding | `number` | 구멍 둘레 여백(px). 기본 `8` |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 대상 고르기 — 선택자와 ref
|
|
50
|
+
|
|
51
|
+
**선택자는 단계로 넘어갈 때 찾는다.** 그래서 아직 안 그려진 요소도 가리킬 수
|
|
52
|
+
있다 — 앞 단계에서 눌러야 나타나는 것 같은 경우.
|
|
53
|
+
|
|
54
|
+
{ target: "#save" } // 그때 찾는다
|
|
55
|
+
{ target: saveRef } // 이미 들고 있는 것
|
|
56
|
+
|
|
57
|
+
못 찾으면 **구멍 없이 가운데에 말풍선만** 띄운다. 투어가 통째로 멎지 않는다.
|
|
58
|
+
|
|
59
|
+
## 스크롤
|
|
60
|
+
|
|
61
|
+
대상이 화면 밖이면 데려온다. **페이지가 스크롤하든 안쪽 상자가 스크롤하든**
|
|
62
|
+
브라우저가 알아서 한다.
|
|
63
|
+
|
|
64
|
+
그 뒤 사용자가 굴리면 구멍이 **한 프레임 늦게** 따라온다. 화면 전체가 어두운
|
|
65
|
+
상태라 눈에 잘 띄지 않지만, 알고는 있어야 한다.
|
|
66
|
+
|
|
67
|
+
## 다시 보지 않기
|
|
68
|
+
|
|
69
|
+
**DS 가 저장하지 않는다.** `onClose` 가 `"done"`(끝까지 봄) 인지 `"skip"`
|
|
70
|
+
(건너뜀) 인지만 알려 주고, 저장할지·어디에 할지는 쓰는 쪽이 정한다 —
|
|
71
|
+
화면마다 다르고 저장 자리(로컬·서버)도 제각각이다.
|
|
72
|
+
|
|
73
|
+
## 눌림
|
|
74
|
+
|
|
75
|
+
안내 중에는 **아무것도 안 눌린다** — 구멍 안쪽까지 포함해서. 가리키는 것만
|
|
76
|
+
보여 주고, 실제로 누르는 것은 안내가 끝난 뒤다.
|
|
77
|
+
|
|
78
|
+
## 키보드
|
|
79
|
+
|
|
80
|
+
Esc 건너뛰기 (onClose("skip"))
|
|
81
|
+
Tab 말풍선 안에서만 돈다 (포커스 가둠)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 의사결정
|
|
86
|
+
|
|
87
|
+
| 상황 | 사용할 것 |
|
|
88
|
+
|------|----------|
|
|
89
|
+
| 첫 방문 때 화면을 단계로 안내 | **Tour** |
|
|
90
|
+
| 요소 하나에 짧은 설명 (호버) | Tooltip |
|
|
91
|
+
| 요소 하나에 눌러서 여는 설명 | PopOver |
|
|
92
|
+
| 페이지 안 진행 단계 표시 | Steps |
|
|
93
|
+
| 할 일이 없는 빈 화면 안내 | EmptyState |
|