@x-plat/design-system 0.17.0 → 0.19.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/Chart/index.cjs +5 -4
- package/dist/components/Chart/index.d.cts +9 -0
- package/dist/components/Chart/index.d.ts +9 -0
- package/dist/components/Chart/index.js +5 -4
- package/dist/components/Table/index.cjs +81 -30
- package/dist/components/Table/index.css +172 -145
- package/dist/components/Table/index.js +88 -37
- package/dist/components/index.cjs +164 -112
- package/dist/components/index.css +172 -145
- package/dist/components/index.js +198 -146
- package/dist/index.cjs +169 -117
- package/dist/index.css +172 -145
- package/dist/index.js +208 -156
- package/guidelines/components/chart.md +52 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7230,9 +7230,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
7230
7230
|
}
|
|
7231
7231
|
);
|
|
7232
7232
|
};
|
|
7233
|
-
var ChartLegend = ({ data, labels,
|
|
7233
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
7234
7234
|
const entries = Object.entries(data);
|
|
7235
|
-
if (
|
|
7235
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
7236
7236
|
const values = entries.flatMap(([, v]) => v);
|
|
7237
7237
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
7238
7238
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -7269,8 +7269,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
7269
7269
|
}) });
|
|
7270
7270
|
};
|
|
7271
7271
|
var Chart = import_react6.default.memo((props) => {
|
|
7272
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7272
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7273
7273
|
const shape = variant ?? type ?? "line";
|
|
7274
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
7274
7275
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
7275
7276
|
const { width, height } = useChartSize(containerRef);
|
|
7276
7277
|
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -7284,7 +7285,7 @@ var Chart = import_react6.default.memo((props) => {
|
|
|
7284
7285
|
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7285
7286
|
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7286
7287
|
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
7287
|
-
ready &&
|
|
7288
|
+
ready && showLegend && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
7288
7289
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
7289
7290
|
] });
|
|
7290
7291
|
});
|
|
@@ -11453,6 +11454,9 @@ var Switch = (props) => {
|
|
|
11453
11454
|
Switch.displayName = "Switch";
|
|
11454
11455
|
var Switch_default = Switch;
|
|
11455
11456
|
|
|
11457
|
+
// src/components/Table/Table.tsx
|
|
11458
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
11459
|
+
|
|
11456
11460
|
// src/components/Table/TableContext.tsx
|
|
11457
11461
|
var import_react35 = __toESM(require("react"), 1);
|
|
11458
11462
|
var TableContext = import_react35.default.createContext(null);
|
|
@@ -11464,7 +11468,42 @@ var useTableContext = () => {
|
|
|
11464
11468
|
var TableContext_default = TableContext;
|
|
11465
11469
|
|
|
11466
11470
|
// src/components/Table/Table.tsx
|
|
11467
|
-
var import_jsx_runtime344 =
|
|
11471
|
+
var import_jsx_runtime344 = (
|
|
11472
|
+
/**
|
|
11473
|
+
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
11474
|
+
* 자리 잡는 데 쓰고 있을 수 있어서다. 스크롤은 안쪽 `-scroller` 가 맡는다.
|
|
11475
|
+
*/
|
|
11476
|
+
require("react/jsx-runtime")
|
|
11477
|
+
);
|
|
11478
|
+
var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
11479
|
+
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
11480
|
+
import_react36.default.useEffect(() => {
|
|
11481
|
+
const el = scrollerRef.current;
|
|
11482
|
+
if (!el) return;
|
|
11483
|
+
const update = () => {
|
|
11484
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
11485
|
+
const can = max > 1;
|
|
11486
|
+
setScrollable(can);
|
|
11487
|
+
const thumb = thumbRef.current;
|
|
11488
|
+
if (!thumb) return;
|
|
11489
|
+
const ratio = can ? el.clientWidth / el.scrollWidth : 1;
|
|
11490
|
+
const w = Math.max(ratio * 100, 8);
|
|
11491
|
+
thumb.style.width = `${w.toFixed(2)}%`;
|
|
11492
|
+
thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
|
|
11493
|
+
};
|
|
11494
|
+
update();
|
|
11495
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
11496
|
+
const ro = new ResizeObserver(update);
|
|
11497
|
+
ro.observe(el);
|
|
11498
|
+
const table = el.firstElementChild;
|
|
11499
|
+
if (table) ro.observe(table);
|
|
11500
|
+
return () => {
|
|
11501
|
+
el.removeEventListener("scroll", update);
|
|
11502
|
+
ro.disconnect();
|
|
11503
|
+
};
|
|
11504
|
+
}, [scrollerRef, thumbRef]);
|
|
11505
|
+
return scrollable;
|
|
11506
|
+
};
|
|
11468
11507
|
var Table = (props) => {
|
|
11469
11508
|
const {
|
|
11470
11509
|
children,
|
|
@@ -11475,26 +11514,39 @@ var Table = (props) => {
|
|
|
11475
11514
|
stickyShadow = true,
|
|
11476
11515
|
minWidth
|
|
11477
11516
|
} = props;
|
|
11478
|
-
|
|
11517
|
+
const scrollerRef = import_react36.default.useRef(null);
|
|
11518
|
+
const thumbRef = import_react36.default.useRef(null);
|
|
11519
|
+
const scrollable = useScrollExtent(scrollerRef, thumbRef);
|
|
11520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
11479
11521
|
"div",
|
|
11480
11522
|
{
|
|
11481
11523
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
11482
|
-
"data-xplat-overlay-escape": "",
|
|
11483
11524
|
style: minWidth === void 0 ? void 0 : {
|
|
11484
11525
|
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
11485
11526
|
},
|
|
11486
|
-
children:
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11527
|
+
children: [
|
|
11528
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11529
|
+
"div",
|
|
11530
|
+
{
|
|
11531
|
+
ref: scrollerRef,
|
|
11532
|
+
className: "lib-xplat-table-scroller",
|
|
11533
|
+
"data-xplat-overlay-escape": "",
|
|
11534
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11535
|
+
TableContext_default.Provider,
|
|
11536
|
+
{
|
|
11537
|
+
value: {
|
|
11538
|
+
rowBorderUse,
|
|
11539
|
+
colBorderUse,
|
|
11540
|
+
headerSticky,
|
|
11541
|
+
stickyShadow
|
|
11542
|
+
},
|
|
11543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
11544
|
+
}
|
|
11545
|
+
)
|
|
11546
|
+
}
|
|
11547
|
+
),
|
|
11548
|
+
/* @__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" }) })
|
|
11549
|
+
]
|
|
11498
11550
|
}
|
|
11499
11551
|
);
|
|
11500
11552
|
};
|
|
@@ -11511,24 +11563,24 @@ TableBody.displayName = "TableBody";
|
|
|
11511
11563
|
var TableBody_default = TableBody;
|
|
11512
11564
|
|
|
11513
11565
|
// src/components/Table/TableCell.tsx
|
|
11514
|
-
var
|
|
11566
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
11515
11567
|
|
|
11516
11568
|
// src/components/Table/TableHeadContext.tsx
|
|
11517
|
-
var
|
|
11518
|
-
var TableHeadContext =
|
|
11569
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
11570
|
+
var TableHeadContext = import_react37.default.createContext(
|
|
11519
11571
|
null
|
|
11520
11572
|
);
|
|
11521
11573
|
var useTableHeadContext = () => {
|
|
11522
|
-
const ctx =
|
|
11574
|
+
const ctx = import_react37.default.useContext(TableHeadContext);
|
|
11523
11575
|
return ctx;
|
|
11524
11576
|
};
|
|
11525
11577
|
var TableHeadContext_default = TableHeadContext;
|
|
11526
11578
|
|
|
11527
11579
|
// src/components/Table/TableRowContext.tsx
|
|
11528
|
-
var
|
|
11529
|
-
var TableRowContext =
|
|
11580
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
11581
|
+
var TableRowContext = import_react38.default.createContext(null);
|
|
11530
11582
|
var useTableRowContext = () => {
|
|
11531
|
-
const ctx =
|
|
11583
|
+
const ctx = import_react38.default.useContext(TableRowContext);
|
|
11532
11584
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
11533
11585
|
return ctx;
|
|
11534
11586
|
};
|
|
@@ -11536,7 +11588,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
11536
11588
|
|
|
11537
11589
|
// src/components/Table/TableCell.tsx
|
|
11538
11590
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
11539
|
-
var TableCell =
|
|
11591
|
+
var TableCell = import_react39.default.memo((props) => {
|
|
11540
11592
|
const {
|
|
11541
11593
|
children,
|
|
11542
11594
|
align = "center",
|
|
@@ -11550,9 +11602,9 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
11550
11602
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
11551
11603
|
const { stickyShadow } = useTableContext();
|
|
11552
11604
|
const headContext = useTableHeadContext();
|
|
11553
|
-
const [left, setLeft] =
|
|
11554
|
-
const cellRef =
|
|
11555
|
-
const calculateLeft =
|
|
11605
|
+
const [left, setLeft] = import_react39.default.useState(0);
|
|
11606
|
+
const cellRef = import_react39.default.useRef(null);
|
|
11607
|
+
const calculateLeft = import_react39.default.useCallback(() => {
|
|
11556
11608
|
if (!cellRef.current) return 0;
|
|
11557
11609
|
let totalLeft = 0;
|
|
11558
11610
|
for (const ref of stickyCells) {
|
|
@@ -11561,7 +11613,7 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
11561
11613
|
}
|
|
11562
11614
|
return totalLeft;
|
|
11563
11615
|
}, [stickyCells]);
|
|
11564
|
-
|
|
11616
|
+
import_react39.default.useEffect(() => {
|
|
11565
11617
|
if (!isSticky || !cellRef.current) return;
|
|
11566
11618
|
registerStickyCell(cellRef);
|
|
11567
11619
|
setLeft(calculateLeft());
|
|
@@ -11619,9 +11671,9 @@ TableHead.displayName = "TableHead";
|
|
|
11619
11671
|
var TableHead_default = TableHead;
|
|
11620
11672
|
|
|
11621
11673
|
// src/components/Table/TableRow.tsx
|
|
11622
|
-
var
|
|
11674
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
11623
11675
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
11624
|
-
var TableRow =
|
|
11676
|
+
var TableRow = import_react40.default.memo((props) => {
|
|
11625
11677
|
const {
|
|
11626
11678
|
children,
|
|
11627
11679
|
type = "secondary",
|
|
@@ -11630,7 +11682,7 @@ var TableRow = import_react39.default.memo((props) => {
|
|
|
11630
11682
|
onClick
|
|
11631
11683
|
} = props;
|
|
11632
11684
|
const { rowBorderUse } = useTableContext();
|
|
11633
|
-
const [stickyCells, setStickyCells] =
|
|
11685
|
+
const [stickyCells, setStickyCells] = import_react40.default.useState([]);
|
|
11634
11686
|
const registerStickyCell = (ref) => {
|
|
11635
11687
|
setStickyCells((prev) => {
|
|
11636
11688
|
if (prev.includes(ref)) return prev;
|
|
@@ -11694,9 +11746,9 @@ Tag.displayName = "Tag";
|
|
|
11694
11746
|
var Tag_default = Tag;
|
|
11695
11747
|
|
|
11696
11748
|
// src/components/TextArea/TextArea.tsx
|
|
11697
|
-
var
|
|
11749
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
11698
11750
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
11699
|
-
var TextArea =
|
|
11751
|
+
var TextArea = import_react41.default.forwardRef(
|
|
11700
11752
|
(props, ref) => {
|
|
11701
11753
|
const {
|
|
11702
11754
|
className,
|
|
@@ -11709,7 +11761,7 @@ var TextArea = import_react40.default.forwardRef(
|
|
|
11709
11761
|
disabled,
|
|
11710
11762
|
...textareaProps
|
|
11711
11763
|
} = props;
|
|
11712
|
-
const autoId =
|
|
11764
|
+
const autoId = import_react41.default.useId();
|
|
11713
11765
|
const fieldId = props.id ?? autoId;
|
|
11714
11766
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
11715
11767
|
"textarea",
|
|
@@ -11731,7 +11783,7 @@ TextArea.displayName = "TextArea";
|
|
|
11731
11783
|
var TextArea_default = TextArea;
|
|
11732
11784
|
|
|
11733
11785
|
// src/components/TimePicker/TimePicker.tsx
|
|
11734
|
-
var
|
|
11786
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
11735
11787
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
11736
11788
|
var ANIMATION_DURATION_MS4 = 200;
|
|
11737
11789
|
var toMinutes = (hhmm) => {
|
|
@@ -11769,13 +11821,13 @@ var TimePicker = (props) => {
|
|
|
11769
11821
|
required,
|
|
11770
11822
|
validations
|
|
11771
11823
|
} = props;
|
|
11772
|
-
const fieldId =
|
|
11773
|
-
const triggerRef =
|
|
11774
|
-
const contentRef =
|
|
11775
|
-
const [isOpen, setOpen] =
|
|
11776
|
-
const [mounted, setMounted] =
|
|
11777
|
-
const [visible, setVisible] =
|
|
11778
|
-
const options =
|
|
11824
|
+
const fieldId = import_react42.default.useId();
|
|
11825
|
+
const triggerRef = import_react42.default.useRef(null);
|
|
11826
|
+
const contentRef = import_react42.default.useRef(null);
|
|
11827
|
+
const [isOpen, setOpen] = import_react42.default.useState(false);
|
|
11828
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
11829
|
+
const [visible, setVisible] = import_react42.default.useState(false);
|
|
11830
|
+
const options = import_react42.default.useMemo(() => {
|
|
11779
11831
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
11780
11832
|
const lo = toMinutes(min) ?? 0;
|
|
11781
11833
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -11783,7 +11835,7 @@ var TimePicker = (props) => {
|
|
|
11783
11835
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
11784
11836
|
return out;
|
|
11785
11837
|
}, [step, min, max]);
|
|
11786
|
-
const close =
|
|
11838
|
+
const close = import_react42.default.useCallback(() => setOpen(false), []);
|
|
11787
11839
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
11788
11840
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
11789
11841
|
useEscapeKey(isOpen, () => {
|
|
@@ -11792,10 +11844,10 @@ var TimePicker = (props) => {
|
|
|
11792
11844
|
});
|
|
11793
11845
|
const host = useOverlayHost_default(triggerRef, mounted);
|
|
11794
11846
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
11795
|
-
|
|
11847
|
+
import_react42.default.useEffect(() => {
|
|
11796
11848
|
if (disabled && isOpen) setOpen(false);
|
|
11797
11849
|
}, [disabled, isOpen]);
|
|
11798
|
-
|
|
11850
|
+
import_react42.default.useEffect(() => {
|
|
11799
11851
|
if (isOpen) {
|
|
11800
11852
|
setMounted(true);
|
|
11801
11853
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -11867,20 +11919,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
11867
11919
|
var TimePicker_default = TimePicker;
|
|
11868
11920
|
|
|
11869
11921
|
// src/components/Toast/Toast.tsx
|
|
11870
|
-
var
|
|
11922
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
11871
11923
|
var import_react_dom4 = require("react-dom");
|
|
11872
11924
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
11873
|
-
var ToastContext =
|
|
11925
|
+
var ToastContext = import_react43.default.createContext(null);
|
|
11874
11926
|
var useToast = () => {
|
|
11875
|
-
const ctx =
|
|
11927
|
+
const ctx = import_react43.default.useContext(ToastContext);
|
|
11876
11928
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
11877
11929
|
return ctx;
|
|
11878
11930
|
};
|
|
11879
11931
|
var EXIT_DURATION = 300;
|
|
11880
11932
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
11881
|
-
const ref =
|
|
11882
|
-
const [height, setHeight] =
|
|
11883
|
-
|
|
11933
|
+
const ref = import_react43.default.useRef(null);
|
|
11934
|
+
const [height, setHeight] = import_react43.default.useState(void 0);
|
|
11935
|
+
import_react43.default.useEffect(() => {
|
|
11884
11936
|
if (ref.current && !isExiting) {
|
|
11885
11937
|
setHeight(ref.current.offsetHeight);
|
|
11886
11938
|
}
|
|
@@ -11912,13 +11964,13 @@ var ToastProvider = ({
|
|
|
11912
11964
|
children,
|
|
11913
11965
|
position = "top-right"
|
|
11914
11966
|
}) => {
|
|
11915
|
-
const [toasts, setToasts] =
|
|
11916
|
-
const [removing, setRemoving] =
|
|
11917
|
-
const [mounted, setMounted] =
|
|
11918
|
-
|
|
11967
|
+
const [toasts, setToasts] = import_react43.default.useState([]);
|
|
11968
|
+
const [removing, setRemoving] = import_react43.default.useState(/* @__PURE__ */ new Set());
|
|
11969
|
+
const [mounted, setMounted] = import_react43.default.useState(false);
|
|
11970
|
+
import_react43.default.useEffect(() => {
|
|
11919
11971
|
setMounted(true);
|
|
11920
11972
|
}, []);
|
|
11921
|
-
const remove =
|
|
11973
|
+
const remove = import_react43.default.useCallback((id) => {
|
|
11922
11974
|
setRemoving((prev) => new Set(prev).add(id));
|
|
11923
11975
|
setTimeout(() => {
|
|
11924
11976
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -11929,7 +11981,7 @@ var ToastProvider = ({
|
|
|
11929
11981
|
});
|
|
11930
11982
|
}, EXIT_DURATION);
|
|
11931
11983
|
}, []);
|
|
11932
|
-
const toast =
|
|
11984
|
+
const toast = import_react43.default.useCallback(
|
|
11933
11985
|
(type, message, duration = 3e3) => {
|
|
11934
11986
|
const id = `${Date.now()}-${Math.random()}`;
|
|
11935
11987
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -11982,7 +12034,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
11982
12034
|
var ToggleChip_default = ToggleChip;
|
|
11983
12035
|
|
|
11984
12036
|
// src/components/Tooltip/Tooltip.tsx
|
|
11985
|
-
var
|
|
12037
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
11986
12038
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
11987
12039
|
var OFFSET = 12;
|
|
11988
12040
|
var GAP = 8;
|
|
@@ -11998,14 +12050,14 @@ var Tooltip = (props) => {
|
|
|
11998
12050
|
disabled = false
|
|
11999
12051
|
} = props;
|
|
12000
12052
|
const shape = variant ?? type ?? "dark";
|
|
12001
|
-
const triggerRef =
|
|
12002
|
-
const tooltipRef =
|
|
12003
|
-
const [visible, setVisible] =
|
|
12004
|
-
const [pos, setPos] =
|
|
12005
|
-
const delayTimer =
|
|
12006
|
-
const rafRef =
|
|
12007
|
-
const cursor =
|
|
12008
|
-
const clamp2 =
|
|
12053
|
+
const triggerRef = import_react44.default.useRef(null);
|
|
12054
|
+
const tooltipRef = import_react44.default.useRef(null);
|
|
12055
|
+
const [visible, setVisible] = import_react44.default.useState(false);
|
|
12056
|
+
const [pos, setPos] = import_react44.default.useState({ left: 0, top: 0 });
|
|
12057
|
+
const delayTimer = import_react44.default.useRef(0);
|
|
12058
|
+
const rafRef = import_react44.default.useRef(0);
|
|
12059
|
+
const cursor = import_react44.default.useRef(null);
|
|
12060
|
+
const clamp2 = import_react44.default.useCallback((left, top, w, h) => {
|
|
12009
12061
|
const vw = window.innerWidth;
|
|
12010
12062
|
const vh = window.innerHeight;
|
|
12011
12063
|
return {
|
|
@@ -12013,7 +12065,7 @@ var Tooltip = (props) => {
|
|
|
12013
12065
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
12014
12066
|
};
|
|
12015
12067
|
}, []);
|
|
12016
|
-
const placeAtCursor =
|
|
12068
|
+
const placeAtCursor = import_react44.default.useCallback((x, y) => {
|
|
12017
12069
|
const el = tooltipRef.current;
|
|
12018
12070
|
if (!el) return;
|
|
12019
12071
|
const w = el.offsetWidth;
|
|
@@ -12024,7 +12076,7 @@ var Tooltip = (props) => {
|
|
|
12024
12076
|
if (top < GAP) top = y + OFFSET;
|
|
12025
12077
|
setPos(clamp2(left, top, w, h));
|
|
12026
12078
|
}, [clamp2]);
|
|
12027
|
-
const placeAtTrigger =
|
|
12079
|
+
const placeAtTrigger = import_react44.default.useCallback(() => {
|
|
12028
12080
|
const el = tooltipRef.current;
|
|
12029
12081
|
const trigger = triggerRef.current;
|
|
12030
12082
|
if (!el || !trigger) return;
|
|
@@ -12036,19 +12088,19 @@ var Tooltip = (props) => {
|
|
|
12036
12088
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
12037
12089
|
setPos(clamp2(left, top, w, h));
|
|
12038
12090
|
}, [clamp2]);
|
|
12039
|
-
const reposition =
|
|
12091
|
+
const reposition = import_react44.default.useCallback(() => {
|
|
12040
12092
|
if (follow && cursor.current) {
|
|
12041
12093
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12042
12094
|
} else {
|
|
12043
12095
|
placeAtTrigger();
|
|
12044
12096
|
}
|
|
12045
12097
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
12046
|
-
const handleMouseEnter =
|
|
12098
|
+
const handleMouseEnter = import_react44.default.useCallback((e) => {
|
|
12047
12099
|
if (disabled) return;
|
|
12048
12100
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12049
12101
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
12050
12102
|
}, [disabled]);
|
|
12051
|
-
const handleMouseMove =
|
|
12103
|
+
const handleMouseMove = import_react44.default.useCallback((e) => {
|
|
12052
12104
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
12053
12105
|
if (!visible || !follow) return;
|
|
12054
12106
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12056,25 +12108,25 @@ var Tooltip = (props) => {
|
|
|
12056
12108
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
12057
12109
|
});
|
|
12058
12110
|
}, [visible, follow, placeAtCursor]);
|
|
12059
|
-
const close =
|
|
12111
|
+
const close = import_react44.default.useCallback(() => {
|
|
12060
12112
|
window.clearTimeout(delayTimer.current);
|
|
12061
12113
|
cancelAnimationFrame(rafRef.current);
|
|
12062
12114
|
setVisible(false);
|
|
12063
12115
|
}, []);
|
|
12064
|
-
const handleMouseLeave =
|
|
12116
|
+
const handleMouseLeave = import_react44.default.useCallback(() => {
|
|
12065
12117
|
cursor.current = null;
|
|
12066
12118
|
close();
|
|
12067
12119
|
}, [close]);
|
|
12068
|
-
const handleFocus =
|
|
12120
|
+
const handleFocus = import_react44.default.useCallback(() => {
|
|
12069
12121
|
if (disabled) return;
|
|
12070
12122
|
cursor.current = null;
|
|
12071
12123
|
setVisible(true);
|
|
12072
12124
|
}, [disabled]);
|
|
12073
|
-
|
|
12125
|
+
import_react44.default.useLayoutEffect(() => {
|
|
12074
12126
|
if (!visible) return;
|
|
12075
12127
|
reposition();
|
|
12076
12128
|
}, [visible, reposition]);
|
|
12077
|
-
|
|
12129
|
+
import_react44.default.useEffect(() => {
|
|
12078
12130
|
if (!visible || follow) return;
|
|
12079
12131
|
const onChange = () => placeAtTrigger();
|
|
12080
12132
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -12084,7 +12136,7 @@ var Tooltip = (props) => {
|
|
|
12084
12136
|
window.removeEventListener("resize", onChange);
|
|
12085
12137
|
};
|
|
12086
12138
|
}, [visible, follow, placeAtTrigger]);
|
|
12087
|
-
|
|
12139
|
+
import_react44.default.useEffect(() => () => {
|
|
12088
12140
|
window.clearTimeout(delayTimer.current);
|
|
12089
12141
|
cancelAnimationFrame(rafRef.current);
|
|
12090
12142
|
}, []);
|
|
@@ -12123,10 +12175,10 @@ Tooltip.displayName = "Tooltip";
|
|
|
12123
12175
|
var Tooltip_default = Tooltip;
|
|
12124
12176
|
|
|
12125
12177
|
// src/components/Tour/Tour.tsx
|
|
12126
|
-
var
|
|
12178
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12127
12179
|
|
|
12128
12180
|
// src/tokens/hooks/useScrollLock.ts
|
|
12129
|
-
var
|
|
12181
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12130
12182
|
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
12131
12183
|
" ",
|
|
12132
12184
|
"PageUp",
|
|
@@ -12139,7 +12191,7 @@ var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
|
12139
12191
|
"ArrowRight"
|
|
12140
12192
|
]);
|
|
12141
12193
|
var useScrollLock = (enabled, allowRef) => {
|
|
12142
|
-
|
|
12194
|
+
import_react45.default.useEffect(() => {
|
|
12143
12195
|
if (!enabled) return;
|
|
12144
12196
|
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
12145
12197
|
const block = (e) => {
|
|
@@ -12189,14 +12241,14 @@ var Tour = (props) => {
|
|
|
12189
12241
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
12190
12242
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
12191
12243
|
} = props;
|
|
12192
|
-
const [uncontrolled, setUncontrolled] =
|
|
12244
|
+
const [uncontrolled, setUncontrolled] = import_react46.default.useState(0);
|
|
12193
12245
|
const index = current ?? uncontrolled;
|
|
12194
12246
|
const step = steps[index];
|
|
12195
12247
|
const isLast = index === steps.length - 1;
|
|
12196
|
-
const spotRef =
|
|
12197
|
-
const cardRef =
|
|
12198
|
-
const [targetFound, setTargetFound] =
|
|
12199
|
-
const goTo =
|
|
12248
|
+
const spotRef = import_react46.default.useRef(null);
|
|
12249
|
+
const cardRef = import_react46.default.useRef(null);
|
|
12250
|
+
const [targetFound, setTargetFound] = import_react46.default.useState(true);
|
|
12251
|
+
const goTo = import_react46.default.useCallback(
|
|
12200
12252
|
(next) => {
|
|
12201
12253
|
if (current === void 0) setUncontrolled(next);
|
|
12202
12254
|
onStepChange?.(next);
|
|
@@ -12206,9 +12258,9 @@ var Tour = (props) => {
|
|
|
12206
12258
|
useEscapeKey(open, () => onClose("skip"));
|
|
12207
12259
|
useFocusTrap(cardRef, open, { trap: true });
|
|
12208
12260
|
useScrollLock_default(open, cardRef);
|
|
12209
|
-
const stepsRef =
|
|
12261
|
+
const stepsRef = import_react46.default.useRef(steps);
|
|
12210
12262
|
stepsRef.current = steps;
|
|
12211
|
-
|
|
12263
|
+
import_react46.default.useEffect(() => {
|
|
12212
12264
|
if (!open) return;
|
|
12213
12265
|
const target = stepsRef.current[index]?.target;
|
|
12214
12266
|
if (!target) return;
|
|
@@ -12233,7 +12285,7 @@ var Tour = (props) => {
|
|
|
12233
12285
|
stop = true;
|
|
12234
12286
|
};
|
|
12235
12287
|
}, [open, index]);
|
|
12236
|
-
const place =
|
|
12288
|
+
const place = import_react46.default.useCallback(() => {
|
|
12237
12289
|
const spot = spotRef.current;
|
|
12238
12290
|
const card = cardRef.current;
|
|
12239
12291
|
if (!spot || !card || !step) return;
|
|
@@ -12280,7 +12332,7 @@ var Tour = (props) => {
|
|
|
12280
12332
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
12281
12333
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
12282
12334
|
}, [step]);
|
|
12283
|
-
|
|
12335
|
+
import_react46.default.useLayoutEffect(() => {
|
|
12284
12336
|
if (!open) return;
|
|
12285
12337
|
place();
|
|
12286
12338
|
let raf = 0;
|
|
@@ -12297,7 +12349,7 @@ var Tour = (props) => {
|
|
|
12297
12349
|
raf = requestAnimationFrame(follow);
|
|
12298
12350
|
return () => cancelAnimationFrame(raf);
|
|
12299
12351
|
}, [open, index, place]);
|
|
12300
|
-
|
|
12352
|
+
import_react46.default.useEffect(() => {
|
|
12301
12353
|
if (!open) return;
|
|
12302
12354
|
const onMove = () => place();
|
|
12303
12355
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -12362,7 +12414,7 @@ Tour.displayName = "Tour";
|
|
|
12362
12414
|
var Tour_default = Tour;
|
|
12363
12415
|
|
|
12364
12416
|
// src/components/Video/Video.tsx
|
|
12365
|
-
var
|
|
12417
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
12366
12418
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
12367
12419
|
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: [
|
|
12368
12420
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12374,7 +12426,7 @@ var formatTime = (sec) => {
|
|
|
12374
12426
|
const s = Math.floor(sec % 60);
|
|
12375
12427
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12376
12428
|
};
|
|
12377
|
-
var Video =
|
|
12429
|
+
var Video = import_react47.default.forwardRef((props, ref) => {
|
|
12378
12430
|
const {
|
|
12379
12431
|
src,
|
|
12380
12432
|
poster,
|
|
@@ -12398,21 +12450,21 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
12398
12450
|
children,
|
|
12399
12451
|
...rest
|
|
12400
12452
|
} = props;
|
|
12401
|
-
const containerRef =
|
|
12402
|
-
const videoRef =
|
|
12403
|
-
const [isPlaying, setIsPlaying] =
|
|
12404
|
-
const [isLoaded, setIsLoaded] =
|
|
12405
|
-
const [currentTime, setCurrentTime] =
|
|
12406
|
-
const [duration, setDuration] =
|
|
12407
|
-
const [buffered, setBuffered] =
|
|
12408
|
-
const [volume, setVolume] =
|
|
12409
|
-
const [isMuted, setIsMuted] =
|
|
12410
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12411
|
-
const [playbackRate, setPlaybackRate] =
|
|
12412
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12413
|
-
const [captionsOn, setCaptionsOn] =
|
|
12414
|
-
const [isPip, setIsPip] =
|
|
12415
|
-
const setRefs =
|
|
12453
|
+
const containerRef = import_react47.default.useRef(null);
|
|
12454
|
+
const videoRef = import_react47.default.useRef(null);
|
|
12455
|
+
const [isPlaying, setIsPlaying] = import_react47.default.useState(Boolean(autoPlay));
|
|
12456
|
+
const [isLoaded, setIsLoaded] = import_react47.default.useState(false);
|
|
12457
|
+
const [currentTime, setCurrentTime] = import_react47.default.useState(0);
|
|
12458
|
+
const [duration, setDuration] = import_react47.default.useState(0);
|
|
12459
|
+
const [buffered, setBuffered] = import_react47.default.useState(0);
|
|
12460
|
+
const [volume, setVolume] = import_react47.default.useState(1);
|
|
12461
|
+
const [isMuted, setIsMuted] = import_react47.default.useState(Boolean(muted));
|
|
12462
|
+
const [isFullscreen, setIsFullscreen] = import_react47.default.useState(false);
|
|
12463
|
+
const [playbackRate, setPlaybackRate] = import_react47.default.useState(1);
|
|
12464
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react47.default.useState(false);
|
|
12465
|
+
const [captionsOn, setCaptionsOn] = import_react47.default.useState(false);
|
|
12466
|
+
const [isPip, setIsPip] = import_react47.default.useState(false);
|
|
12467
|
+
const setRefs = import_react47.default.useCallback(
|
|
12416
12468
|
(el) => {
|
|
12417
12469
|
videoRef.current = el;
|
|
12418
12470
|
if (typeof ref === "function") ref(el);
|
|
@@ -12420,14 +12472,14 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
12420
12472
|
},
|
|
12421
12473
|
[ref]
|
|
12422
12474
|
);
|
|
12423
|
-
|
|
12475
|
+
import_react47.default.useEffect(() => {
|
|
12424
12476
|
const onFsChange = () => {
|
|
12425
12477
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12426
12478
|
};
|
|
12427
12479
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12428
12480
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12429
12481
|
}, []);
|
|
12430
|
-
|
|
12482
|
+
import_react47.default.useEffect(() => {
|
|
12431
12483
|
const v = videoRef.current;
|
|
12432
12484
|
if (!v) return;
|
|
12433
12485
|
const onEnter = () => setIsPip(true);
|
|
@@ -12817,13 +12869,13 @@ Layout.displayName = "Layout";
|
|
|
12817
12869
|
var Layout_default = Layout;
|
|
12818
12870
|
|
|
12819
12871
|
// src/layout/SideBar/SideBar.tsx
|
|
12820
|
-
var
|
|
12872
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
12821
12873
|
|
|
12822
12874
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12823
|
-
var
|
|
12824
|
-
var SideBarContext =
|
|
12875
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
12876
|
+
var SideBarContext = import_react48.default.createContext(null);
|
|
12825
12877
|
var useSideBarContext = () => {
|
|
12826
|
-
const ctx =
|
|
12878
|
+
const ctx = import_react48.default.useContext(SideBarContext);
|
|
12827
12879
|
if (!ctx) throw new Error("Error");
|
|
12828
12880
|
return ctx;
|
|
12829
12881
|
};
|
|
@@ -12833,7 +12885,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12833
12885
|
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
12834
12886
|
var SideBar = (props) => {
|
|
12835
12887
|
const { children, className } = props;
|
|
12836
|
-
const [isOpen, setIsOpen] =
|
|
12888
|
+
const [isOpen, setIsOpen] = import_react49.default.useState(true);
|
|
12837
12889
|
const handleSwitchSideBar = () => {
|
|
12838
12890
|
setIsOpen((prev) => !prev);
|
|
12839
12891
|
};
|