@x-plat/design-system 0.16.3 → 0.18.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 +86 -31
- package/dist/components/Table/index.css +173 -146
- package/dist/components/Table/index.d.cts +10 -0
- package/dist/components/Table/index.d.ts +10 -0
- package/dist/components/Table/index.js +90 -35
- package/dist/components/index.cjs +164 -109
- package/dist/components/index.css +173 -146
- package/dist/components/index.js +195 -140
- package/dist/index.cjs +169 -114
- package/dist/index.css +173 -146
- package/dist/index.js +205 -150
- package/guidelines/components/table.md +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11453,6 +11453,9 @@ var Switch = (props) => {
|
|
|
11453
11453
|
Switch.displayName = "Switch";
|
|
11454
11454
|
var Switch_default = Switch;
|
|
11455
11455
|
|
|
11456
|
+
// src/components/Table/Table.tsx
|
|
11457
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
11458
|
+
|
|
11456
11459
|
// src/components/Table/TableContext.tsx
|
|
11457
11460
|
var import_react35 = __toESM(require("react"), 1);
|
|
11458
11461
|
var TableContext = import_react35.default.createContext(null);
|
|
@@ -11464,7 +11467,42 @@ var useTableContext = () => {
|
|
|
11464
11467
|
var TableContext_default = TableContext;
|
|
11465
11468
|
|
|
11466
11469
|
// src/components/Table/Table.tsx
|
|
11467
|
-
var import_jsx_runtime344 =
|
|
11470
|
+
var import_jsx_runtime344 = (
|
|
11471
|
+
/**
|
|
11472
|
+
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
11473
|
+
* 자리 잡는 데 쓰고 있을 수 있어서다. 스크롤은 안쪽 `-scroller` 가 맡는다.
|
|
11474
|
+
*/
|
|
11475
|
+
require("react/jsx-runtime")
|
|
11476
|
+
);
|
|
11477
|
+
var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
11478
|
+
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
11479
|
+
import_react36.default.useEffect(() => {
|
|
11480
|
+
const el = scrollerRef.current;
|
|
11481
|
+
if (!el) return;
|
|
11482
|
+
const update = () => {
|
|
11483
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
11484
|
+
const can = max > 1;
|
|
11485
|
+
setScrollable(can);
|
|
11486
|
+
const thumb = thumbRef.current;
|
|
11487
|
+
if (!thumb) return;
|
|
11488
|
+
const ratio = can ? el.clientWidth / el.scrollWidth : 1;
|
|
11489
|
+
const w = Math.max(ratio * 100, 8);
|
|
11490
|
+
thumb.style.width = `${w.toFixed(2)}%`;
|
|
11491
|
+
thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
|
|
11492
|
+
};
|
|
11493
|
+
update();
|
|
11494
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
11495
|
+
const ro = new ResizeObserver(update);
|
|
11496
|
+
ro.observe(el);
|
|
11497
|
+
const table = el.firstElementChild;
|
|
11498
|
+
if (table) ro.observe(table);
|
|
11499
|
+
return () => {
|
|
11500
|
+
el.removeEventListener("scroll", update);
|
|
11501
|
+
ro.disconnect();
|
|
11502
|
+
};
|
|
11503
|
+
}, [scrollerRef, thumbRef]);
|
|
11504
|
+
return scrollable;
|
|
11505
|
+
};
|
|
11468
11506
|
var Table = (props) => {
|
|
11469
11507
|
const {
|
|
11470
11508
|
children,
|
|
@@ -11472,25 +11510,42 @@ var Table = (props) => {
|
|
|
11472
11510
|
rowBorderUse = true,
|
|
11473
11511
|
colBorderUse = true,
|
|
11474
11512
|
headerSticky = false,
|
|
11475
|
-
stickyShadow = true
|
|
11513
|
+
stickyShadow = true,
|
|
11514
|
+
minWidth
|
|
11476
11515
|
} = props;
|
|
11477
|
-
|
|
11516
|
+
const scrollerRef = import_react36.default.useRef(null);
|
|
11517
|
+
const thumbRef = import_react36.default.useRef(null);
|
|
11518
|
+
const scrollable = useScrollExtent(scrollerRef, thumbRef);
|
|
11519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
11478
11520
|
"div",
|
|
11479
11521
|
{
|
|
11480
11522
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11523
|
+
style: minWidth === void 0 ? void 0 : {
|
|
11524
|
+
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
11525
|
+
},
|
|
11526
|
+
children: [
|
|
11527
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11528
|
+
"div",
|
|
11529
|
+
{
|
|
11530
|
+
ref: scrollerRef,
|
|
11531
|
+
className: "lib-xplat-table-scroller",
|
|
11532
|
+
"data-xplat-overlay-escape": "",
|
|
11533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11534
|
+
TableContext_default.Provider,
|
|
11535
|
+
{
|
|
11536
|
+
value: {
|
|
11537
|
+
rowBorderUse,
|
|
11538
|
+
colBorderUse,
|
|
11539
|
+
headerSticky,
|
|
11540
|
+
stickyShadow
|
|
11541
|
+
},
|
|
11542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
11543
|
+
}
|
|
11544
|
+
)
|
|
11545
|
+
}
|
|
11546
|
+
),
|
|
11547
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
|
|
11548
|
+
]
|
|
11494
11549
|
}
|
|
11495
11550
|
);
|
|
11496
11551
|
};
|
|
@@ -11507,24 +11562,24 @@ TableBody.displayName = "TableBody";
|
|
|
11507
11562
|
var TableBody_default = TableBody;
|
|
11508
11563
|
|
|
11509
11564
|
// src/components/Table/TableCell.tsx
|
|
11510
|
-
var
|
|
11565
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
11511
11566
|
|
|
11512
11567
|
// src/components/Table/TableHeadContext.tsx
|
|
11513
|
-
var
|
|
11514
|
-
var TableHeadContext =
|
|
11568
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
11569
|
+
var TableHeadContext = import_react37.default.createContext(
|
|
11515
11570
|
null
|
|
11516
11571
|
);
|
|
11517
11572
|
var useTableHeadContext = () => {
|
|
11518
|
-
const ctx =
|
|
11573
|
+
const ctx = import_react37.default.useContext(TableHeadContext);
|
|
11519
11574
|
return ctx;
|
|
11520
11575
|
};
|
|
11521
11576
|
var TableHeadContext_default = TableHeadContext;
|
|
11522
11577
|
|
|
11523
11578
|
// src/components/Table/TableRowContext.tsx
|
|
11524
|
-
var
|
|
11525
|
-
var TableRowContext =
|
|
11579
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
11580
|
+
var TableRowContext = import_react38.default.createContext(null);
|
|
11526
11581
|
var useTableRowContext = () => {
|
|
11527
|
-
const ctx =
|
|
11582
|
+
const ctx = import_react38.default.useContext(TableRowContext);
|
|
11528
11583
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11529
11584
|
return ctx;
|
|
11530
11585
|
};
|
|
@@ -11532,7 +11587,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
11532
11587
|
|
|
11533
11588
|
// src/components/Table/TableCell.tsx
|
|
11534
11589
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
11535
|
-
var TableCell =
|
|
11590
|
+
var TableCell = import_react39.default.memo((props) => {
|
|
11536
11591
|
const {
|
|
11537
11592
|
children,
|
|
11538
11593
|
align = "center",
|
|
@@ -11546,9 +11601,9 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
11546
11601
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
11547
11602
|
const { stickyShadow } = useTableContext();
|
|
11548
11603
|
const headContext = useTableHeadContext();
|
|
11549
|
-
const [left, setLeft] =
|
|
11550
|
-
const cellRef =
|
|
11551
|
-
const calculateLeft =
|
|
11604
|
+
const [left, setLeft] = import_react39.default.useState(0);
|
|
11605
|
+
const cellRef = import_react39.default.useRef(null);
|
|
11606
|
+
const calculateLeft = import_react39.default.useCallback(() => {
|
|
11552
11607
|
if (!cellRef.current) return 0;
|
|
11553
11608
|
let totalLeft = 0;
|
|
11554
11609
|
for (const ref of stickyCells) {
|
|
@@ -11557,7 +11612,7 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
11557
11612
|
}
|
|
11558
11613
|
return totalLeft;
|
|
11559
11614
|
}, [stickyCells]);
|
|
11560
|
-
|
|
11615
|
+
import_react39.default.useEffect(() => {
|
|
11561
11616
|
if (!isSticky || !cellRef.current) return;
|
|
11562
11617
|
registerStickyCell(cellRef);
|
|
11563
11618
|
setLeft(calculateLeft());
|
|
@@ -11615,9 +11670,9 @@ TableHead.displayName = "TableHead";
|
|
|
11615
11670
|
var TableHead_default = TableHead;
|
|
11616
11671
|
|
|
11617
11672
|
// src/components/Table/TableRow.tsx
|
|
11618
|
-
var
|
|
11673
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
11619
11674
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
11620
|
-
var TableRow =
|
|
11675
|
+
var TableRow = import_react40.default.memo((props) => {
|
|
11621
11676
|
const {
|
|
11622
11677
|
children,
|
|
11623
11678
|
type = "secondary",
|
|
@@ -11626,7 +11681,7 @@ var TableRow = import_react39.default.memo((props) => {
|
|
|
11626
11681
|
onClick
|
|
11627
11682
|
} = props;
|
|
11628
11683
|
const { rowBorderUse } = useTableContext();
|
|
11629
|
-
const [stickyCells, setStickyCells] =
|
|
11684
|
+
const [stickyCells, setStickyCells] = import_react40.default.useState([]);
|
|
11630
11685
|
const registerStickyCell = (ref) => {
|
|
11631
11686
|
setStickyCells((prev) => {
|
|
11632
11687
|
if (prev.includes(ref)) return prev;
|
|
@@ -11690,9 +11745,9 @@ Tag.displayName = "Tag";
|
|
|
11690
11745
|
var Tag_default = Tag;
|
|
11691
11746
|
|
|
11692
11747
|
// src/components/TextArea/TextArea.tsx
|
|
11693
|
-
var
|
|
11748
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
11694
11749
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
11695
|
-
var TextArea =
|
|
11750
|
+
var TextArea = import_react41.default.forwardRef(
|
|
11696
11751
|
(props, ref) => {
|
|
11697
11752
|
const {
|
|
11698
11753
|
className,
|
|
@@ -11705,7 +11760,7 @@ var TextArea = import_react40.default.forwardRef(
|
|
|
11705
11760
|
disabled,
|
|
11706
11761
|
...textareaProps
|
|
11707
11762
|
} = props;
|
|
11708
|
-
const autoId =
|
|
11763
|
+
const autoId = import_react41.default.useId();
|
|
11709
11764
|
const fieldId = props.id ?? autoId;
|
|
11710
11765
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
11711
11766
|
"textarea",
|
|
@@ -11727,7 +11782,7 @@ TextArea.displayName = "TextArea";
|
|
|
11727
11782
|
var TextArea_default = TextArea;
|
|
11728
11783
|
|
|
11729
11784
|
// src/components/TimePicker/TimePicker.tsx
|
|
11730
|
-
var
|
|
11785
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11731
11786
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
11732
11787
|
var ANIMATION_DURATION_MS4 = 200;
|
|
11733
11788
|
var toMinutes = (hhmm) => {
|
|
@@ -11765,13 +11820,13 @@ var TimePicker = (props) => {
|
|
|
11765
11820
|
required,
|
|
11766
11821
|
validations
|
|
11767
11822
|
} = props;
|
|
11768
|
-
const fieldId =
|
|
11769
|
-
const triggerRef =
|
|
11770
|
-
const contentRef =
|
|
11771
|
-
const [isOpen, setOpen] =
|
|
11772
|
-
const [mounted, setMounted] =
|
|
11773
|
-
const [visible, setVisible] =
|
|
11774
|
-
const options =
|
|
11823
|
+
const fieldId = import_react42.default.useId();
|
|
11824
|
+
const triggerRef = import_react42.default.useRef(null);
|
|
11825
|
+
const contentRef = import_react42.default.useRef(null);
|
|
11826
|
+
const [isOpen, setOpen] = import_react42.default.useState(false);
|
|
11827
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
11828
|
+
const [visible, setVisible] = import_react42.default.useState(false);
|
|
11829
|
+
const options = import_react42.default.useMemo(() => {
|
|
11775
11830
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11776
11831
|
const lo = toMinutes(min) ?? 0;
|
|
11777
11832
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -11779,7 +11834,7 @@ var TimePicker = (props) => {
|
|
|
11779
11834
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11780
11835
|
return out;
|
|
11781
11836
|
}, [step, min, max]);
|
|
11782
|
-
const close =
|
|
11837
|
+
const close = import_react42.default.useCallback(() => setOpen(false), []);
|
|
11783
11838
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11784
11839
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
11785
11840
|
useEscapeKey(isOpen, () => {
|
|
@@ -11788,10 +11843,10 @@ var TimePicker = (props) => {
|
|
|
11788
11843
|
});
|
|
11789
11844
|
const host = useOverlayHost_default(triggerRef, mounted);
|
|
11790
11845
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11791
|
-
|
|
11846
|
+
import_react42.default.useEffect(() => {
|
|
11792
11847
|
if (disabled && isOpen) setOpen(false);
|
|
11793
11848
|
}, [disabled, isOpen]);
|
|
11794
|
-
|
|
11849
|
+
import_react42.default.useEffect(() => {
|
|
11795
11850
|
if (isOpen) {
|
|
11796
11851
|
setMounted(true);
|
|
11797
11852
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -11863,20 +11918,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
11863
11918
|
var TimePicker_default = TimePicker;
|
|
11864
11919
|
|
|
11865
11920
|
// src/components/Toast/Toast.tsx
|
|
11866
|
-
var
|
|
11921
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11867
11922
|
var import_react_dom4 = require("react-dom");
|
|
11868
11923
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11869
|
-
var ToastContext =
|
|
11924
|
+
var ToastContext = import_react43.default.createContext(null);
|
|
11870
11925
|
var useToast = () => {
|
|
11871
|
-
const ctx =
|
|
11926
|
+
const ctx = import_react43.default.useContext(ToastContext);
|
|
11872
11927
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
11873
11928
|
return ctx;
|
|
11874
11929
|
};
|
|
11875
11930
|
var EXIT_DURATION = 300;
|
|
11876
11931
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
11877
|
-
const ref =
|
|
11878
|
-
const [height, setHeight] =
|
|
11879
|
-
|
|
11932
|
+
const ref = import_react43.default.useRef(null);
|
|
11933
|
+
const [height, setHeight] = import_react43.default.useState(void 0);
|
|
11934
|
+
import_react43.default.useEffect(() => {
|
|
11880
11935
|
if (ref.current && !isExiting) {
|
|
11881
11936
|
setHeight(ref.current.offsetHeight);
|
|
11882
11937
|
}
|
|
@@ -11908,13 +11963,13 @@ var ToastProvider = ({
|
|
|
11908
11963
|
children,
|
|
11909
11964
|
position = "top-right"
|
|
11910
11965
|
}) => {
|
|
11911
|
-
const [toasts, setToasts] =
|
|
11912
|
-
const [removing, setRemoving] =
|
|
11913
|
-
const [mounted, setMounted] =
|
|
11914
|
-
|
|
11966
|
+
const [toasts, setToasts] = import_react43.default.useState([]);
|
|
11967
|
+
const [removing, setRemoving] = import_react43.default.useState(/* @__PURE__ */ new Set());
|
|
11968
|
+
const [mounted, setMounted] = import_react43.default.useState(false);
|
|
11969
|
+
import_react43.default.useEffect(() => {
|
|
11915
11970
|
setMounted(true);
|
|
11916
11971
|
}, []);
|
|
11917
|
-
const remove =
|
|
11972
|
+
const remove = import_react43.default.useCallback((id) => {
|
|
11918
11973
|
setRemoving((prev) => new Set(prev).add(id));
|
|
11919
11974
|
setTimeout(() => {
|
|
11920
11975
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -11925,7 +11980,7 @@ var ToastProvider = ({
|
|
|
11925
11980
|
});
|
|
11926
11981
|
}, EXIT_DURATION);
|
|
11927
11982
|
}, []);
|
|
11928
|
-
const toast =
|
|
11983
|
+
const toast = import_react43.default.useCallback(
|
|
11929
11984
|
(type, message, duration = 3e3) => {
|
|
11930
11985
|
const id = `${Date.now()}-${Math.random()}`;
|
|
11931
11986
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -11978,7 +12033,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
11978
12033
|
var ToggleChip_default = ToggleChip;
|
|
11979
12034
|
|
|
11980
12035
|
// src/components/Tooltip/Tooltip.tsx
|
|
11981
|
-
var
|
|
12036
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
11982
12037
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11983
12038
|
var OFFSET = 12;
|
|
11984
12039
|
var GAP = 8;
|
|
@@ -11994,14 +12049,14 @@ var Tooltip = (props) => {
|
|
|
11994
12049
|
disabled = false
|
|
11995
12050
|
} = props;
|
|
11996
12051
|
const shape = variant ?? type ?? "dark";
|
|
11997
|
-
const triggerRef =
|
|
11998
|
-
const tooltipRef =
|
|
11999
|
-
const [visible, setVisible] =
|
|
12000
|
-
const [pos, setPos] =
|
|
12001
|
-
const delayTimer =
|
|
12002
|
-
const rafRef =
|
|
12003
|
-
const cursor =
|
|
12004
|
-
const clamp2 =
|
|
12052
|
+
const triggerRef = import_react44.default.useRef(null);
|
|
12053
|
+
const tooltipRef = import_react44.default.useRef(null);
|
|
12054
|
+
const [visible, setVisible] = import_react44.default.useState(false);
|
|
12055
|
+
const [pos, setPos] = import_react44.default.useState({ left: 0, top: 0 });
|
|
12056
|
+
const delayTimer = import_react44.default.useRef(0);
|
|
12057
|
+
const rafRef = import_react44.default.useRef(0);
|
|
12058
|
+
const cursor = import_react44.default.useRef(null);
|
|
12059
|
+
const clamp2 = import_react44.default.useCallback((left, top, w, h) => {
|
|
12005
12060
|
const vw = window.innerWidth;
|
|
12006
12061
|
const vh = window.innerHeight;
|
|
12007
12062
|
return {
|
|
@@ -12009,7 +12064,7 @@ var Tooltip = (props) => {
|
|
|
12009
12064
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
12010
12065
|
};
|
|
12011
12066
|
}, []);
|
|
12012
|
-
const placeAtCursor =
|
|
12067
|
+
const placeAtCursor = import_react44.default.useCallback((x, y) => {
|
|
12013
12068
|
const el = tooltipRef.current;
|
|
12014
12069
|
if (!el) return;
|
|
12015
12070
|
const w = el.offsetWidth;
|
|
@@ -12020,7 +12075,7 @@ var Tooltip = (props) => {
|
|
|
12020
12075
|
if (top < GAP) top = y + OFFSET;
|
|
12021
12076
|
setPos(clamp2(left, top, w, h));
|
|
12022
12077
|
}, [clamp2]);
|
|
12023
|
-
const placeAtTrigger =
|
|
12078
|
+
const placeAtTrigger = import_react44.default.useCallback(() => {
|
|
12024
12079
|
const el = tooltipRef.current;
|
|
12025
12080
|
const trigger = triggerRef.current;
|
|
12026
12081
|
if (!el || !trigger) return;
|
|
@@ -12032,19 +12087,19 @@ var Tooltip = (props) => {
|
|
|
12032
12087
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
12033
12088
|
setPos(clamp2(left, top, w, h));
|
|
12034
12089
|
}, [clamp2]);
|
|
12035
|
-
const reposition =
|
|
12090
|
+
const reposition = import_react44.default.useCallback(() => {
|
|
12036
12091
|
if (follow && cursor.current) {
|
|
12037
12092
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12038
12093
|
} else {
|
|
12039
12094
|
placeAtTrigger();
|
|
12040
12095
|
}
|
|
12041
12096
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
12042
|
-
const handleMouseEnter =
|
|
12097
|
+
const handleMouseEnter = import_react44.default.useCallback((e) => {
|
|
12043
12098
|
if (disabled) return;
|
|
12044
12099
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12045
12100
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
12046
12101
|
}, [disabled]);
|
|
12047
|
-
const handleMouseMove =
|
|
12102
|
+
const handleMouseMove = import_react44.default.useCallback((e) => {
|
|
12048
12103
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12049
12104
|
if (!visible || !follow) return;
|
|
12050
12105
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12052,25 +12107,25 @@ var Tooltip = (props) => {
|
|
|
12052
12107
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12053
12108
|
});
|
|
12054
12109
|
}, [visible, follow, placeAtCursor]);
|
|
12055
|
-
const close =
|
|
12110
|
+
const close = import_react44.default.useCallback(() => {
|
|
12056
12111
|
window.clearTimeout(delayTimer.current);
|
|
12057
12112
|
cancelAnimationFrame(rafRef.current);
|
|
12058
12113
|
setVisible(false);
|
|
12059
12114
|
}, []);
|
|
12060
|
-
const handleMouseLeave =
|
|
12115
|
+
const handleMouseLeave = import_react44.default.useCallback(() => {
|
|
12061
12116
|
cursor.current = null;
|
|
12062
12117
|
close();
|
|
12063
12118
|
}, [close]);
|
|
12064
|
-
const handleFocus =
|
|
12119
|
+
const handleFocus = import_react44.default.useCallback(() => {
|
|
12065
12120
|
if (disabled) return;
|
|
12066
12121
|
cursor.current = null;
|
|
12067
12122
|
setVisible(true);
|
|
12068
12123
|
}, [disabled]);
|
|
12069
|
-
|
|
12124
|
+
import_react44.default.useLayoutEffect(() => {
|
|
12070
12125
|
if (!visible) return;
|
|
12071
12126
|
reposition();
|
|
12072
12127
|
}, [visible, reposition]);
|
|
12073
|
-
|
|
12128
|
+
import_react44.default.useEffect(() => {
|
|
12074
12129
|
if (!visible || follow) return;
|
|
12075
12130
|
const onChange = () => placeAtTrigger();
|
|
12076
12131
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -12080,7 +12135,7 @@ var Tooltip = (props) => {
|
|
|
12080
12135
|
window.removeEventListener("resize", onChange);
|
|
12081
12136
|
};
|
|
12082
12137
|
}, [visible, follow, placeAtTrigger]);
|
|
12083
|
-
|
|
12138
|
+
import_react44.default.useEffect(() => () => {
|
|
12084
12139
|
window.clearTimeout(delayTimer.current);
|
|
12085
12140
|
cancelAnimationFrame(rafRef.current);
|
|
12086
12141
|
}, []);
|
|
@@ -12119,10 +12174,10 @@ Tooltip.displayName = "Tooltip";
|
|
|
12119
12174
|
var Tooltip_default = Tooltip;
|
|
12120
12175
|
|
|
12121
12176
|
// src/components/Tour/Tour.tsx
|
|
12122
|
-
var
|
|
12177
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12123
12178
|
|
|
12124
12179
|
// src/tokens/hooks/useScrollLock.ts
|
|
12125
|
-
var
|
|
12180
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12126
12181
|
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
12127
12182
|
" ",
|
|
12128
12183
|
"PageUp",
|
|
@@ -12135,7 +12190,7 @@ var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
|
12135
12190
|
"ArrowRight"
|
|
12136
12191
|
]);
|
|
12137
12192
|
var useScrollLock = (enabled, allowRef) => {
|
|
12138
|
-
|
|
12193
|
+
import_react45.default.useEffect(() => {
|
|
12139
12194
|
if (!enabled) return;
|
|
12140
12195
|
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
12141
12196
|
const block = (e) => {
|
|
@@ -12185,14 +12240,14 @@ var Tour = (props) => {
|
|
|
12185
12240
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
12186
12241
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
12187
12242
|
} = props;
|
|
12188
|
-
const [uncontrolled, setUncontrolled] =
|
|
12243
|
+
const [uncontrolled, setUncontrolled] = import_react46.default.useState(0);
|
|
12189
12244
|
const index = current ?? uncontrolled;
|
|
12190
12245
|
const step = steps[index];
|
|
12191
12246
|
const isLast = index === steps.length - 1;
|
|
12192
|
-
const spotRef =
|
|
12193
|
-
const cardRef =
|
|
12194
|
-
const [targetFound, setTargetFound] =
|
|
12195
|
-
const goTo =
|
|
12247
|
+
const spotRef = import_react46.default.useRef(null);
|
|
12248
|
+
const cardRef = import_react46.default.useRef(null);
|
|
12249
|
+
const [targetFound, setTargetFound] = import_react46.default.useState(true);
|
|
12250
|
+
const goTo = import_react46.default.useCallback(
|
|
12196
12251
|
(next) => {
|
|
12197
12252
|
if (current === void 0) setUncontrolled(next);
|
|
12198
12253
|
onStepChange?.(next);
|
|
@@ -12202,9 +12257,9 @@ var Tour = (props) => {
|
|
|
12202
12257
|
useEscapeKey(open, () => onClose("skip"));
|
|
12203
12258
|
useFocusTrap(cardRef, open, { trap: true });
|
|
12204
12259
|
useScrollLock_default(open, cardRef);
|
|
12205
|
-
const stepsRef =
|
|
12260
|
+
const stepsRef = import_react46.default.useRef(steps);
|
|
12206
12261
|
stepsRef.current = steps;
|
|
12207
|
-
|
|
12262
|
+
import_react46.default.useEffect(() => {
|
|
12208
12263
|
if (!open) return;
|
|
12209
12264
|
const target = stepsRef.current[index]?.target;
|
|
12210
12265
|
if (!target) return;
|
|
@@ -12229,7 +12284,7 @@ var Tour = (props) => {
|
|
|
12229
12284
|
stop = true;
|
|
12230
12285
|
};
|
|
12231
12286
|
}, [open, index]);
|
|
12232
|
-
const place =
|
|
12287
|
+
const place = import_react46.default.useCallback(() => {
|
|
12233
12288
|
const spot = spotRef.current;
|
|
12234
12289
|
const card = cardRef.current;
|
|
12235
12290
|
if (!spot || !card || !step) return;
|
|
@@ -12276,7 +12331,7 @@ var Tour = (props) => {
|
|
|
12276
12331
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
12277
12332
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
12278
12333
|
}, [step]);
|
|
12279
|
-
|
|
12334
|
+
import_react46.default.useLayoutEffect(() => {
|
|
12280
12335
|
if (!open) return;
|
|
12281
12336
|
place();
|
|
12282
12337
|
let raf = 0;
|
|
@@ -12293,7 +12348,7 @@ var Tour = (props) => {
|
|
|
12293
12348
|
raf = requestAnimationFrame(follow);
|
|
12294
12349
|
return () => cancelAnimationFrame(raf);
|
|
12295
12350
|
}, [open, index, place]);
|
|
12296
|
-
|
|
12351
|
+
import_react46.default.useEffect(() => {
|
|
12297
12352
|
if (!open) return;
|
|
12298
12353
|
const onMove = () => place();
|
|
12299
12354
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -12358,7 +12413,7 @@ Tour.displayName = "Tour";
|
|
|
12358
12413
|
var Tour_default = Tour;
|
|
12359
12414
|
|
|
12360
12415
|
// src/components/Video/Video.tsx
|
|
12361
|
-
var
|
|
12416
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
12362
12417
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
12363
12418
|
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: [
|
|
12364
12419
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12370,7 +12425,7 @@ var formatTime = (sec) => {
|
|
|
12370
12425
|
const s = Math.floor(sec % 60);
|
|
12371
12426
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12372
12427
|
};
|
|
12373
|
-
var Video =
|
|
12428
|
+
var Video = import_react47.default.forwardRef((props, ref) => {
|
|
12374
12429
|
const {
|
|
12375
12430
|
src,
|
|
12376
12431
|
poster,
|
|
@@ -12394,21 +12449,21 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
12394
12449
|
children,
|
|
12395
12450
|
...rest
|
|
12396
12451
|
} = props;
|
|
12397
|
-
const containerRef =
|
|
12398
|
-
const videoRef =
|
|
12399
|
-
const [isPlaying, setIsPlaying] =
|
|
12400
|
-
const [isLoaded, setIsLoaded] =
|
|
12401
|
-
const [currentTime, setCurrentTime] =
|
|
12402
|
-
const [duration, setDuration] =
|
|
12403
|
-
const [buffered, setBuffered] =
|
|
12404
|
-
const [volume, setVolume] =
|
|
12405
|
-
const [isMuted, setIsMuted] =
|
|
12406
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12407
|
-
const [playbackRate, setPlaybackRate] =
|
|
12408
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12409
|
-
const [captionsOn, setCaptionsOn] =
|
|
12410
|
-
const [isPip, setIsPip] =
|
|
12411
|
-
const setRefs =
|
|
12452
|
+
const containerRef = import_react47.default.useRef(null);
|
|
12453
|
+
const videoRef = import_react47.default.useRef(null);
|
|
12454
|
+
const [isPlaying, setIsPlaying] = import_react47.default.useState(Boolean(autoPlay));
|
|
12455
|
+
const [isLoaded, setIsLoaded] = import_react47.default.useState(false);
|
|
12456
|
+
const [currentTime, setCurrentTime] = import_react47.default.useState(0);
|
|
12457
|
+
const [duration, setDuration] = import_react47.default.useState(0);
|
|
12458
|
+
const [buffered, setBuffered] = import_react47.default.useState(0);
|
|
12459
|
+
const [volume, setVolume] = import_react47.default.useState(1);
|
|
12460
|
+
const [isMuted, setIsMuted] = import_react47.default.useState(Boolean(muted));
|
|
12461
|
+
const [isFullscreen, setIsFullscreen] = import_react47.default.useState(false);
|
|
12462
|
+
const [playbackRate, setPlaybackRate] = import_react47.default.useState(1);
|
|
12463
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react47.default.useState(false);
|
|
12464
|
+
const [captionsOn, setCaptionsOn] = import_react47.default.useState(false);
|
|
12465
|
+
const [isPip, setIsPip] = import_react47.default.useState(false);
|
|
12466
|
+
const setRefs = import_react47.default.useCallback(
|
|
12412
12467
|
(el) => {
|
|
12413
12468
|
videoRef.current = el;
|
|
12414
12469
|
if (typeof ref === "function") ref(el);
|
|
@@ -12416,14 +12471,14 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
12416
12471
|
},
|
|
12417
12472
|
[ref]
|
|
12418
12473
|
);
|
|
12419
|
-
|
|
12474
|
+
import_react47.default.useEffect(() => {
|
|
12420
12475
|
const onFsChange = () => {
|
|
12421
12476
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12422
12477
|
};
|
|
12423
12478
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12424
12479
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12425
12480
|
}, []);
|
|
12426
|
-
|
|
12481
|
+
import_react47.default.useEffect(() => {
|
|
12427
12482
|
const v = videoRef.current;
|
|
12428
12483
|
if (!v) return;
|
|
12429
12484
|
const onEnter = () => setIsPip(true);
|
|
@@ -12813,13 +12868,13 @@ Layout.displayName = "Layout";
|
|
|
12813
12868
|
var Layout_default = Layout;
|
|
12814
12869
|
|
|
12815
12870
|
// src/layout/SideBar/SideBar.tsx
|
|
12816
|
-
var
|
|
12871
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
12817
12872
|
|
|
12818
12873
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12819
|
-
var
|
|
12820
|
-
var SideBarContext =
|
|
12874
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
12875
|
+
var SideBarContext = import_react48.default.createContext(null);
|
|
12821
12876
|
var useSideBarContext = () => {
|
|
12822
|
-
const ctx =
|
|
12877
|
+
const ctx = import_react48.default.useContext(SideBarContext);
|
|
12823
12878
|
if (!ctx) throw new Error("Error");
|
|
12824
12879
|
return ctx;
|
|
12825
12880
|
};
|
|
@@ -12829,7 +12884,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12829
12884
|
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
12830
12885
|
var SideBar = (props) => {
|
|
12831
12886
|
const { children, className } = props;
|
|
12832
|
-
const [isOpen, setIsOpen] =
|
|
12887
|
+
const [isOpen, setIsOpen] = import_react49.default.useState(true);
|
|
12833
12888
|
const handleSwitchSideBar = () => {
|
|
12834
12889
|
setIsOpen((prev) => !prev);
|
|
12835
12890
|
};
|