@x-plat/design-system 0.3.0 → 0.3.2
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/Swiper/index.cjs +257 -5939
- package/dist/components/Swiper/index.css +52 -211
- package/dist/components/Swiper/index.d.cts +35 -16
- package/dist/components/Swiper/index.d.ts +35 -16
- package/dist/components/Swiper/index.js +251 -5944
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/index.cjs +356 -93
- package/dist/components/index.css +71 -0
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +356 -94
- package/dist/index.cjs +380 -117
- package/dist/index.css +71 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +380 -118
- package/package.json +3 -9
package/dist/components/index.js
CHANGED
|
@@ -28261,9 +28261,270 @@ var Steps = (props) => {
|
|
|
28261
28261
|
Steps.displayName = "Steps";
|
|
28262
28262
|
var Steps_default = Steps;
|
|
28263
28263
|
|
|
28264
|
-
// src/components/
|
|
28264
|
+
// src/components/Swiper/Swiper.tsx
|
|
28265
28265
|
import React27 from "react";
|
|
28266
|
-
import { jsx as jsx334 } from "react/jsx-runtime";
|
|
28266
|
+
import { jsx as jsx334, jsxs as jsxs213 } from "react/jsx-runtime";
|
|
28267
|
+
var Swiper = (props) => {
|
|
28268
|
+
const {
|
|
28269
|
+
auto = false,
|
|
28270
|
+
swiperRef,
|
|
28271
|
+
renderItems = [],
|
|
28272
|
+
viewItemCount = 1,
|
|
28273
|
+
maxItems,
|
|
28274
|
+
loop = false,
|
|
28275
|
+
spaceBetween = 16,
|
|
28276
|
+
showProgress = false,
|
|
28277
|
+
autoplayDelay = 3e3,
|
|
28278
|
+
speed = 300,
|
|
28279
|
+
slideBy = 1,
|
|
28280
|
+
index: indexProp,
|
|
28281
|
+
onChange,
|
|
28282
|
+
className
|
|
28283
|
+
} = props;
|
|
28284
|
+
const items = maxItems ? renderItems.slice(0, maxItems) : renderItems;
|
|
28285
|
+
const totalSlides = items.length;
|
|
28286
|
+
const canSlide = totalSlides > viewItemCount;
|
|
28287
|
+
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
28288
|
+
const useLoop = loop && canSlide;
|
|
28289
|
+
const cloneCount = useLoop ? totalSlides : 0;
|
|
28290
|
+
const extendedItems = React27.useMemo(() => {
|
|
28291
|
+
if (!useLoop) return items;
|
|
28292
|
+
return [...items, ...items, ...items];
|
|
28293
|
+
}, [items, useLoop]);
|
|
28294
|
+
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
28295
|
+
const [innerIndex, setInnerIndex] = React27.useState(
|
|
28296
|
+
useLoop ? cloneCount + initialIdx : initialIdx
|
|
28297
|
+
);
|
|
28298
|
+
const [isDragging, setIsDragging] = React27.useState(false);
|
|
28299
|
+
const [dragOffset, setDragOffset] = React27.useState(0);
|
|
28300
|
+
const [animated, setAnimated] = React27.useState(true);
|
|
28301
|
+
const [containerWidth, setContainerWidth] = React27.useState(0);
|
|
28302
|
+
const containerRef = React27.useRef(null);
|
|
28303
|
+
const startXRef = React27.useRef(0);
|
|
28304
|
+
const startTimeRef = React27.useRef(0);
|
|
28305
|
+
const autoplayTimerRef = React27.useRef(null);
|
|
28306
|
+
React27.useEffect(() => {
|
|
28307
|
+
const el = containerRef.current;
|
|
28308
|
+
if (!el) return;
|
|
28309
|
+
const ro = new ResizeObserver((entries) => {
|
|
28310
|
+
for (const entry of entries) {
|
|
28311
|
+
setContainerWidth(entry.contentRect.width);
|
|
28312
|
+
}
|
|
28313
|
+
});
|
|
28314
|
+
ro.observe(el);
|
|
28315
|
+
setContainerWidth(el.offsetWidth);
|
|
28316
|
+
return () => ro.disconnect();
|
|
28317
|
+
}, []);
|
|
28318
|
+
const slideStep = containerWidth > 0 ? (containerWidth - (viewItemCount - 1) * spaceBetween) / viewItemCount + spaceBetween : 0;
|
|
28319
|
+
const transformPx = -(innerIndex * slideStep) + dragOffset;
|
|
28320
|
+
const getRealIndex = (inner) => {
|
|
28321
|
+
if (!useLoop) return inner;
|
|
28322
|
+
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
28323
|
+
};
|
|
28324
|
+
const realIndex = getRealIndex(innerIndex);
|
|
28325
|
+
const moveToInner = React27.useCallback(
|
|
28326
|
+
(idx, withAnim = true) => {
|
|
28327
|
+
if (useLoop) {
|
|
28328
|
+
setInnerIndex((prev) => {
|
|
28329
|
+
const real = ((prev - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
28330
|
+
const canonical = cloneCount + real;
|
|
28331
|
+
if (prev !== canonical) {
|
|
28332
|
+
const delta = idx - prev;
|
|
28333
|
+
setAnimated(withAnim);
|
|
28334
|
+
return canonical + delta;
|
|
28335
|
+
}
|
|
28336
|
+
setAnimated(withAnim);
|
|
28337
|
+
return idx;
|
|
28338
|
+
});
|
|
28339
|
+
} else {
|
|
28340
|
+
setAnimated(withAnim);
|
|
28341
|
+
setInnerIndex(idx);
|
|
28342
|
+
}
|
|
28343
|
+
},
|
|
28344
|
+
[useLoop, cloneCount, totalSlides]
|
|
28345
|
+
);
|
|
28346
|
+
const handleTransitionEnd = React27.useCallback(() => {
|
|
28347
|
+
if (!useLoop) return;
|
|
28348
|
+
const real = getRealIndex(innerIndex);
|
|
28349
|
+
const canonical = cloneCount + real;
|
|
28350
|
+
if (innerIndex !== canonical) {
|
|
28351
|
+
moveToInner(canonical, false);
|
|
28352
|
+
}
|
|
28353
|
+
onChange?.(Math.min(real, maxIndex));
|
|
28354
|
+
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange, moveToInner]);
|
|
28355
|
+
const slideTo = React27.useCallback(
|
|
28356
|
+
(logicalIndex) => {
|
|
28357
|
+
if (!canSlide) return;
|
|
28358
|
+
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
28359
|
+
const target = useLoop ? cloneCount + clamped : clamped;
|
|
28360
|
+
moveToInner(target, true);
|
|
28361
|
+
if (!useLoop) onChange?.(clamped);
|
|
28362
|
+
},
|
|
28363
|
+
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
28364
|
+
);
|
|
28365
|
+
const slideNext = React27.useCallback(() => {
|
|
28366
|
+
if (!canSlide) return;
|
|
28367
|
+
const nextInner = innerIndex + slideBy;
|
|
28368
|
+
if (useLoop) {
|
|
28369
|
+
moveToInner(nextInner, true);
|
|
28370
|
+
} else {
|
|
28371
|
+
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
28372
|
+
}
|
|
28373
|
+
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
28374
|
+
const slidePrev = React27.useCallback(() => {
|
|
28375
|
+
if (!canSlide) return;
|
|
28376
|
+
const prevInner = innerIndex - slideBy;
|
|
28377
|
+
if (useLoop) {
|
|
28378
|
+
moveToInner(prevInner, true);
|
|
28379
|
+
} else {
|
|
28380
|
+
moveToInner(Math.max(prevInner, 0), true);
|
|
28381
|
+
}
|
|
28382
|
+
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
28383
|
+
React27.useEffect(() => {
|
|
28384
|
+
if (indexProp === void 0) return;
|
|
28385
|
+
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
28386
|
+
const target = useLoop ? cloneCount + clamped : clamped;
|
|
28387
|
+
if (target !== innerIndex) {
|
|
28388
|
+
moveToInner(target, true);
|
|
28389
|
+
}
|
|
28390
|
+
}, [indexProp]);
|
|
28391
|
+
React27.useImperativeHandle(swiperRef, () => ({
|
|
28392
|
+
slidePrev,
|
|
28393
|
+
slideNext,
|
|
28394
|
+
slideTo
|
|
28395
|
+
}));
|
|
28396
|
+
React27.useEffect(() => {
|
|
28397
|
+
if (!auto || !canSlide) return;
|
|
28398
|
+
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
28399
|
+
return () => {
|
|
28400
|
+
if (autoplayTimerRef.current) clearInterval(autoplayTimerRef.current);
|
|
28401
|
+
};
|
|
28402
|
+
}, [auto, autoplayDelay, slideNext, canSlide]);
|
|
28403
|
+
const pauseAutoplay = () => {
|
|
28404
|
+
if (autoplayTimerRef.current) clearInterval(autoplayTimerRef.current);
|
|
28405
|
+
};
|
|
28406
|
+
const getClientX = (e) => {
|
|
28407
|
+
if ("touches" in e) return e.touches[0]?.clientX ?? 0;
|
|
28408
|
+
return e.clientX;
|
|
28409
|
+
};
|
|
28410
|
+
const handleDragStart = (e) => {
|
|
28411
|
+
if (!canSlide) return;
|
|
28412
|
+
if ("button" in e && e.button !== 0) return;
|
|
28413
|
+
pauseAutoplay();
|
|
28414
|
+
setIsDragging(true);
|
|
28415
|
+
setAnimated(false);
|
|
28416
|
+
startXRef.current = getClientX(e);
|
|
28417
|
+
startTimeRef.current = Date.now();
|
|
28418
|
+
};
|
|
28419
|
+
React27.useEffect(() => {
|
|
28420
|
+
if (!isDragging) return;
|
|
28421
|
+
const handleMove = (e) => {
|
|
28422
|
+
setDragOffset(getClientX(e) - startXRef.current);
|
|
28423
|
+
};
|
|
28424
|
+
const handleEnd = () => {
|
|
28425
|
+
setIsDragging(false);
|
|
28426
|
+
const absDrag = Math.abs(dragOffset);
|
|
28427
|
+
const elapsed = Date.now() - startTimeRef.current;
|
|
28428
|
+
const velocity = absDrag / elapsed;
|
|
28429
|
+
if ((absDrag > 30 || velocity > 0.3) && slideStep > 0) {
|
|
28430
|
+
const rawCount = Math.max(1, Math.round(absDrag / slideStep));
|
|
28431
|
+
const count2 = Math.max(slideBy, Math.round(rawCount / slideBy) * slideBy);
|
|
28432
|
+
const direction = dragOffset < 0 ? 1 : -1;
|
|
28433
|
+
const nextInner = innerIndex + direction * count2;
|
|
28434
|
+
if (useLoop) {
|
|
28435
|
+
moveToInner(nextInner, true);
|
|
28436
|
+
} else {
|
|
28437
|
+
moveToInner(Math.max(0, Math.min(nextInner, maxIndex)), true);
|
|
28438
|
+
}
|
|
28439
|
+
} else {
|
|
28440
|
+
setAnimated(true);
|
|
28441
|
+
}
|
|
28442
|
+
setDragOffset(0);
|
|
28443
|
+
};
|
|
28444
|
+
window.addEventListener("mousemove", handleMove);
|
|
28445
|
+
window.addEventListener("mouseup", handleEnd);
|
|
28446
|
+
window.addEventListener("touchmove", handleMove, { passive: true });
|
|
28447
|
+
window.addEventListener("touchend", handleEnd);
|
|
28448
|
+
return () => {
|
|
28449
|
+
window.removeEventListener("mousemove", handleMove);
|
|
28450
|
+
window.removeEventListener("mouseup", handleEnd);
|
|
28451
|
+
window.removeEventListener("touchmove", handleMove);
|
|
28452
|
+
window.removeEventListener("touchend", handleEnd);
|
|
28453
|
+
};
|
|
28454
|
+
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
28455
|
+
const slideWidthPercent = 100 / viewItemCount;
|
|
28456
|
+
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
28457
|
+
const totalSteps = Math.ceil((maxIndex + 1) / slideBy);
|
|
28458
|
+
const currentStep = Math.min(
|
|
28459
|
+
Math.floor(realIndex / slideBy),
|
|
28460
|
+
totalSteps - 1
|
|
28461
|
+
);
|
|
28462
|
+
return /* @__PURE__ */ jsxs213("div", { className: clsx_default("lib-xplat-swiper", className), ref: containerRef, children: [
|
|
28463
|
+
/* @__PURE__ */ jsx334(
|
|
28464
|
+
"div",
|
|
28465
|
+
{
|
|
28466
|
+
className: "lib-xplat-swiper__viewport",
|
|
28467
|
+
onMouseDown: handleDragStart,
|
|
28468
|
+
onTouchStart: handleDragStart,
|
|
28469
|
+
children: /* @__PURE__ */ jsx334(
|
|
28470
|
+
"div",
|
|
28471
|
+
{
|
|
28472
|
+
className: clsx_default(
|
|
28473
|
+
"lib-xplat-swiper__track",
|
|
28474
|
+
animated && !isDragging && "transitioning"
|
|
28475
|
+
),
|
|
28476
|
+
style: {
|
|
28477
|
+
transform: `translateX(${transformPx}px)`,
|
|
28478
|
+
transitionDuration: isDragging || !animated ? "0ms" : `${speed}ms`,
|
|
28479
|
+
gap: `${spaceBetween}px`
|
|
28480
|
+
},
|
|
28481
|
+
onTransitionEnd: handleTransitionEnd,
|
|
28482
|
+
children: extendedItems.map((item, idx) => /* @__PURE__ */ jsx334(
|
|
28483
|
+
"div",
|
|
28484
|
+
{
|
|
28485
|
+
className: "lib-xplat-swiper__slide",
|
|
28486
|
+
style: {
|
|
28487
|
+
minWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`,
|
|
28488
|
+
maxWidth: `calc(${slideWidthPercent}% - ${gapAdjust}px)`
|
|
28489
|
+
},
|
|
28490
|
+
children: item
|
|
28491
|
+
},
|
|
28492
|
+
idx
|
|
28493
|
+
))
|
|
28494
|
+
}
|
|
28495
|
+
)
|
|
28496
|
+
}
|
|
28497
|
+
),
|
|
28498
|
+
showProgress && canSlide && /* @__PURE__ */ jsx334("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ jsx334("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ jsx334(
|
|
28499
|
+
"span",
|
|
28500
|
+
{
|
|
28501
|
+
className: "lib-xplat-swiper__progress-fill",
|
|
28502
|
+
style: {
|
|
28503
|
+
width: `${(currentStep + 1) / totalSteps * 100}%`,
|
|
28504
|
+
transitionDuration: `${speed}ms`
|
|
28505
|
+
}
|
|
28506
|
+
}
|
|
28507
|
+
) }) }),
|
|
28508
|
+
canSlide && /* @__PURE__ */ jsx334("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ jsx334(
|
|
28509
|
+
"button",
|
|
28510
|
+
{
|
|
28511
|
+
className: clsx_default(
|
|
28512
|
+
"lib-xplat-swiper__dot",
|
|
28513
|
+
i === currentStep && "active"
|
|
28514
|
+
),
|
|
28515
|
+
onClick: () => slideTo(i * slideBy),
|
|
28516
|
+
"aria-label": `\uC2AC\uB77C\uC774\uB4DC ${i + 1}`
|
|
28517
|
+
},
|
|
28518
|
+
i
|
|
28519
|
+
)) })
|
|
28520
|
+
] });
|
|
28521
|
+
};
|
|
28522
|
+
Swiper.displayName = "Swiper";
|
|
28523
|
+
var Swiper_default = Swiper;
|
|
28524
|
+
|
|
28525
|
+
// src/components/Switch/Switch.tsx
|
|
28526
|
+
import React28 from "react";
|
|
28527
|
+
import { jsx as jsx335 } from "react/jsx-runtime";
|
|
28267
28528
|
var KNOB_TRANSITION_MS = 250;
|
|
28268
28529
|
var Switch = (props) => {
|
|
28269
28530
|
const {
|
|
@@ -28274,9 +28535,9 @@ var Switch = (props) => {
|
|
|
28274
28535
|
color: color2 = "xplat-blue-500",
|
|
28275
28536
|
className
|
|
28276
28537
|
} = props;
|
|
28277
|
-
const [isAnimating, setIsAnimating] =
|
|
28278
|
-
const timeoutRef =
|
|
28279
|
-
|
|
28538
|
+
const [isAnimating, setIsAnimating] = React28.useState(false);
|
|
28539
|
+
const timeoutRef = React28.useRef(null);
|
|
28540
|
+
React28.useEffect(() => {
|
|
28280
28541
|
return () => {
|
|
28281
28542
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
28282
28543
|
};
|
|
@@ -28292,7 +28553,7 @@ var Switch = (props) => {
|
|
|
28292
28553
|
}, KNOB_TRANSITION_MS);
|
|
28293
28554
|
};
|
|
28294
28555
|
const colorClass = color2;
|
|
28295
|
-
return /* @__PURE__ */
|
|
28556
|
+
return /* @__PURE__ */ jsx335(
|
|
28296
28557
|
"div",
|
|
28297
28558
|
{
|
|
28298
28559
|
className: clsx_default(
|
|
@@ -28306,7 +28567,7 @@ var Switch = (props) => {
|
|
|
28306
28567
|
),
|
|
28307
28568
|
onClick: handleClick,
|
|
28308
28569
|
"aria-disabled": disabled || isAnimating,
|
|
28309
|
-
children: /* @__PURE__ */
|
|
28570
|
+
children: /* @__PURE__ */ jsx335("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
28310
28571
|
}
|
|
28311
28572
|
);
|
|
28312
28573
|
};
|
|
@@ -28314,14 +28575,14 @@ Switch.displayName = "Switch";
|
|
|
28314
28575
|
var Switch_default = Switch;
|
|
28315
28576
|
|
|
28316
28577
|
// src/components/Tab/Tab.tsx
|
|
28317
|
-
import
|
|
28578
|
+
import React30 from "react";
|
|
28318
28579
|
|
|
28319
28580
|
// src/components/Tab/TabItem.tsx
|
|
28320
|
-
import
|
|
28321
|
-
import { jsx as
|
|
28322
|
-
var TabItem =
|
|
28581
|
+
import React29 from "react";
|
|
28582
|
+
import { jsx as jsx336 } from "react/jsx-runtime";
|
|
28583
|
+
var TabItem = React29.forwardRef((props, ref) => {
|
|
28323
28584
|
const { isActive, title, onClick } = props;
|
|
28324
|
-
return /* @__PURE__ */
|
|
28585
|
+
return /* @__PURE__ */ jsx336(
|
|
28325
28586
|
"div",
|
|
28326
28587
|
{
|
|
28327
28588
|
ref,
|
|
@@ -28335,25 +28596,25 @@ TabItem.displayName = "TabItem";
|
|
|
28335
28596
|
var TabItem_default = TabItem;
|
|
28336
28597
|
|
|
28337
28598
|
// src/components/Tab/Tab.tsx
|
|
28338
|
-
import { jsx as
|
|
28599
|
+
import { jsx as jsx337, jsxs as jsxs214 } from "react/jsx-runtime";
|
|
28339
28600
|
var Tab = (props) => {
|
|
28340
28601
|
const { activeIndex, onChange, tabs, type, size: size4 = "md" } = props;
|
|
28341
|
-
const [underlineStyle, setUnderlineStyle] =
|
|
28602
|
+
const [underlineStyle, setUnderlineStyle] = React30.useState({
|
|
28342
28603
|
left: 0,
|
|
28343
28604
|
width: 0
|
|
28344
28605
|
});
|
|
28345
|
-
const itemRefs =
|
|
28606
|
+
const itemRefs = React30.useRef([]);
|
|
28346
28607
|
const handleChangeActiveTab = (tabItem, tabIdx) => {
|
|
28347
28608
|
onChange(tabItem, tabIdx);
|
|
28348
28609
|
};
|
|
28349
|
-
|
|
28610
|
+
React30.useEffect(() => {
|
|
28350
28611
|
const el = itemRefs.current[activeIndex];
|
|
28351
28612
|
if (el) {
|
|
28352
28613
|
setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
|
|
28353
28614
|
}
|
|
28354
28615
|
}, [activeIndex, tabs.length]);
|
|
28355
|
-
return /* @__PURE__ */
|
|
28356
|
-
tabs.map((tab, idx) => /* @__PURE__ */
|
|
28616
|
+
return /* @__PURE__ */ jsxs214("div", { className: clsx_default("lib-xplat-tab", `type-${type}`, size4), children: [
|
|
28617
|
+
tabs.map((tab, idx) => /* @__PURE__ */ jsx337(
|
|
28357
28618
|
TabItem_default,
|
|
28358
28619
|
{
|
|
28359
28620
|
onClick: () => handleChangeActiveTab(tab, idx),
|
|
@@ -28365,7 +28626,7 @@ var Tab = (props) => {
|
|
|
28365
28626
|
},
|
|
28366
28627
|
`${tab.value}_${idx}`
|
|
28367
28628
|
)),
|
|
28368
|
-
type === "toggle" && /* @__PURE__ */
|
|
28629
|
+
type === "toggle" && /* @__PURE__ */ jsx337(
|
|
28369
28630
|
"div",
|
|
28370
28631
|
{
|
|
28371
28632
|
className: "tab-toggle-underline",
|
|
@@ -28381,17 +28642,17 @@ Tab.displayName = "Tab";
|
|
|
28381
28642
|
var Tab_default = Tab;
|
|
28382
28643
|
|
|
28383
28644
|
// src/components/Table/TableContext.tsx
|
|
28384
|
-
import
|
|
28385
|
-
var TableContext =
|
|
28645
|
+
import React31 from "react";
|
|
28646
|
+
var TableContext = React31.createContext(null);
|
|
28386
28647
|
var useTableContext = () => {
|
|
28387
|
-
const ctx =
|
|
28648
|
+
const ctx = React31.useContext(TableContext);
|
|
28388
28649
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
28389
28650
|
return ctx;
|
|
28390
28651
|
};
|
|
28391
28652
|
var TableContext_default = TableContext;
|
|
28392
28653
|
|
|
28393
28654
|
// src/components/Table/Table.tsx
|
|
28394
|
-
import { jsx as
|
|
28655
|
+
import { jsx as jsx338 } from "react/jsx-runtime";
|
|
28395
28656
|
var Table = (props) => {
|
|
28396
28657
|
const {
|
|
28397
28658
|
className,
|
|
@@ -28401,7 +28662,7 @@ var Table = (props) => {
|
|
|
28401
28662
|
headerSticky = false,
|
|
28402
28663
|
stickyShadow = true
|
|
28403
28664
|
} = props;
|
|
28404
|
-
return /* @__PURE__ */
|
|
28665
|
+
return /* @__PURE__ */ jsx338("div", { className: clsx_default("lib-xplat-table-wrapper", className), children: /* @__PURE__ */ jsx338(
|
|
28405
28666
|
TableContext_default.Provider,
|
|
28406
28667
|
{
|
|
28407
28668
|
value: {
|
|
@@ -28410,7 +28671,7 @@ var Table = (props) => {
|
|
|
28410
28671
|
headerSticky,
|
|
28411
28672
|
stickyShadow
|
|
28412
28673
|
},
|
|
28413
|
-
children: /* @__PURE__ */
|
|
28674
|
+
children: /* @__PURE__ */ jsx338("table", { className: "lib-xplat-table", children })
|
|
28414
28675
|
}
|
|
28415
28676
|
) });
|
|
28416
28677
|
};
|
|
@@ -28418,40 +28679,40 @@ Table.displayName = "Table";
|
|
|
28418
28679
|
var Table_default = Table;
|
|
28419
28680
|
|
|
28420
28681
|
// src/components/Table/TableBody.tsx
|
|
28421
|
-
import { jsx as
|
|
28682
|
+
import { jsx as jsx339 } from "react/jsx-runtime";
|
|
28422
28683
|
var TableBody = (props) => {
|
|
28423
28684
|
const { children, className } = props;
|
|
28424
|
-
return /* @__PURE__ */
|
|
28685
|
+
return /* @__PURE__ */ jsx339("tbody", { className, children });
|
|
28425
28686
|
};
|
|
28426
28687
|
TableBody.displayName = "TableBody";
|
|
28427
28688
|
var TableBody_default = TableBody;
|
|
28428
28689
|
|
|
28429
28690
|
// src/components/Table/TableCell.tsx
|
|
28430
|
-
import
|
|
28691
|
+
import React34 from "react";
|
|
28431
28692
|
|
|
28432
28693
|
// src/components/Table/TableHeadContext.tsx
|
|
28433
|
-
import
|
|
28434
|
-
var TableHeadContext =
|
|
28694
|
+
import React32 from "react";
|
|
28695
|
+
var TableHeadContext = React32.createContext(
|
|
28435
28696
|
null
|
|
28436
28697
|
);
|
|
28437
28698
|
var useTableHeadContext = () => {
|
|
28438
|
-
const ctx =
|
|
28699
|
+
const ctx = React32.useContext(TableHeadContext);
|
|
28439
28700
|
return ctx;
|
|
28440
28701
|
};
|
|
28441
28702
|
var TableHeadContext_default = TableHeadContext;
|
|
28442
28703
|
|
|
28443
28704
|
// src/components/Table/TableRowContext.tsx
|
|
28444
|
-
import
|
|
28445
|
-
var TableRowContext =
|
|
28705
|
+
import React33 from "react";
|
|
28706
|
+
var TableRowContext = React33.createContext(null);
|
|
28446
28707
|
var useTableRowContext = () => {
|
|
28447
|
-
const ctx =
|
|
28708
|
+
const ctx = React33.useContext(TableRowContext);
|
|
28448
28709
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
28449
28710
|
return ctx;
|
|
28450
28711
|
};
|
|
28451
28712
|
var TableRowContext_default = TableRowContext;
|
|
28452
28713
|
|
|
28453
28714
|
// src/components/Table/TableCell.tsx
|
|
28454
|
-
import { jsx as
|
|
28715
|
+
import { jsx as jsx340 } from "react/jsx-runtime";
|
|
28455
28716
|
var TableCell = (props) => {
|
|
28456
28717
|
const {
|
|
28457
28718
|
children,
|
|
@@ -28463,9 +28724,9 @@ var TableCell = (props) => {
|
|
|
28463
28724
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
28464
28725
|
const { stickyShadow } = useTableContext();
|
|
28465
28726
|
const headContext = useTableHeadContext();
|
|
28466
|
-
const [left, setLeft] =
|
|
28467
|
-
const cellRef =
|
|
28468
|
-
const calculateLeft =
|
|
28727
|
+
const [left, setLeft] = React34.useState(0);
|
|
28728
|
+
const cellRef = React34.useRef(null);
|
|
28729
|
+
const calculateLeft = React34.useCallback(() => {
|
|
28469
28730
|
if (!cellRef.current) return 0;
|
|
28470
28731
|
let totalLeft = 0;
|
|
28471
28732
|
for (const ref of stickyCells) {
|
|
@@ -28474,7 +28735,7 @@ var TableCell = (props) => {
|
|
|
28474
28735
|
}
|
|
28475
28736
|
return totalLeft;
|
|
28476
28737
|
}, [stickyCells]);
|
|
28477
|
-
|
|
28738
|
+
React34.useEffect(() => {
|
|
28478
28739
|
if (!isSticky || !cellRef.current) return;
|
|
28479
28740
|
registerStickyCell(cellRef);
|
|
28480
28741
|
setLeft(calculateLeft());
|
|
@@ -28492,7 +28753,7 @@ var TableCell = (props) => {
|
|
|
28492
28753
|
const CellTag = cellRef.current?.tagName === "TH" ? "th" : "td";
|
|
28493
28754
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
28494
28755
|
const enableHover = headContext && headContext.cellHover;
|
|
28495
|
-
return /* @__PURE__ */
|
|
28756
|
+
return /* @__PURE__ */ jsx340(
|
|
28496
28757
|
CellTag,
|
|
28497
28758
|
{
|
|
28498
28759
|
ref: cellRef,
|
|
@@ -28514,32 +28775,32 @@ TableCell.displayName = "TableCell";
|
|
|
28514
28775
|
var TableCell_default = TableCell;
|
|
28515
28776
|
|
|
28516
28777
|
// src/components/Table/TableHead.tsx
|
|
28517
|
-
import { jsx as
|
|
28778
|
+
import { jsx as jsx341 } from "react/jsx-runtime";
|
|
28518
28779
|
var TableHead = ({
|
|
28519
28780
|
children,
|
|
28520
28781
|
className = "",
|
|
28521
28782
|
cellHover = false
|
|
28522
28783
|
}) => {
|
|
28523
28784
|
const { headerSticky } = useTableContext();
|
|
28524
|
-
return /* @__PURE__ */
|
|
28785
|
+
return /* @__PURE__ */ jsx341(TableHeadContext_default.Provider, { value: { cellHover }, children: /* @__PURE__ */ jsx341("thead", { className: clsx_default(headerSticky ? "table-sticky" : null, className), children }) });
|
|
28525
28786
|
};
|
|
28526
28787
|
TableHead.displayName = "TableHead";
|
|
28527
28788
|
var TableHead_default = TableHead;
|
|
28528
28789
|
|
|
28529
28790
|
// src/components/Table/TableRow.tsx
|
|
28530
|
-
import
|
|
28531
|
-
import { jsx as
|
|
28791
|
+
import React35 from "react";
|
|
28792
|
+
import { jsx as jsx342 } from "react/jsx-runtime";
|
|
28532
28793
|
var TableRow = (props) => {
|
|
28533
28794
|
const {
|
|
28534
28795
|
children,
|
|
28535
28796
|
className,
|
|
28536
|
-
color: color2 = "xplat-
|
|
28797
|
+
color: color2 = "xplat-neutral-900",
|
|
28537
28798
|
type = "secondary",
|
|
28538
28799
|
isHover,
|
|
28539
28800
|
onClick
|
|
28540
28801
|
} = props;
|
|
28541
28802
|
const { rowBorderUse } = useTableContext();
|
|
28542
|
-
const [stickyCells, setStickyCells] =
|
|
28803
|
+
const [stickyCells, setStickyCells] = React35.useState([]);
|
|
28543
28804
|
const registerStickyCell = (ref) => {
|
|
28544
28805
|
setStickyCells((prev) => {
|
|
28545
28806
|
if (prev.includes(ref)) return prev;
|
|
@@ -28547,7 +28808,7 @@ var TableRow = (props) => {
|
|
|
28547
28808
|
});
|
|
28548
28809
|
};
|
|
28549
28810
|
const colorClass = color2;
|
|
28550
|
-
return /* @__PURE__ */
|
|
28811
|
+
return /* @__PURE__ */ jsx342(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ jsx342(
|
|
28551
28812
|
"tr",
|
|
28552
28813
|
{
|
|
28553
28814
|
className: clsx_default(
|
|
@@ -28567,7 +28828,7 @@ TableRow.displayName = "TableRow";
|
|
|
28567
28828
|
var TableRow_default = TableRow;
|
|
28568
28829
|
|
|
28569
28830
|
// src/components/Tag/Tag.tsx
|
|
28570
|
-
import { jsx as
|
|
28831
|
+
import { jsx as jsx343, jsxs as jsxs215 } from "react/jsx-runtime";
|
|
28571
28832
|
var Tag = (props) => {
|
|
28572
28833
|
const {
|
|
28573
28834
|
children,
|
|
@@ -28577,21 +28838,21 @@ var Tag = (props) => {
|
|
|
28577
28838
|
className
|
|
28578
28839
|
} = props;
|
|
28579
28840
|
const colorClass = color2;
|
|
28580
|
-
return /* @__PURE__ */
|
|
28581
|
-
/* @__PURE__ */
|
|
28582
|
-
onClose && /* @__PURE__ */
|
|
28841
|
+
return /* @__PURE__ */ jsxs215("span", { className: clsx_default("lib-xplat-tag", size4, colorClass, className), children: [
|
|
28842
|
+
/* @__PURE__ */ jsx343("span", { className: "tag-label", children }),
|
|
28843
|
+
onClose && /* @__PURE__ */ jsx343("button", { className: "tag-close", onClick: onClose, "aria-label": "\uC0AD\uC81C", children: /* @__PURE__ */ jsx343(XIcon_default, {}) })
|
|
28583
28844
|
] });
|
|
28584
28845
|
};
|
|
28585
28846
|
Tag.displayName = "Tag";
|
|
28586
28847
|
var Tag_default = Tag;
|
|
28587
28848
|
|
|
28588
28849
|
// src/components/TextArea/TextArea.tsx
|
|
28589
|
-
import
|
|
28590
|
-
import { jsx as
|
|
28591
|
-
var TextArea =
|
|
28850
|
+
import React36 from "react";
|
|
28851
|
+
import { jsx as jsx344 } from "react/jsx-runtime";
|
|
28852
|
+
var TextArea = React36.forwardRef(
|
|
28592
28853
|
(props, ref) => {
|
|
28593
28854
|
const { value, onChange, className, disabled, ...textareaProps } = props;
|
|
28594
|
-
const localRef =
|
|
28855
|
+
const localRef = React36.useRef(null);
|
|
28595
28856
|
const setRefs = (el) => {
|
|
28596
28857
|
localRef.current = el;
|
|
28597
28858
|
if (!ref) return;
|
|
@@ -28611,21 +28872,21 @@ var TextArea = React35.forwardRef(
|
|
|
28611
28872
|
onChange(event);
|
|
28612
28873
|
}
|
|
28613
28874
|
};
|
|
28614
|
-
|
|
28875
|
+
React36.useEffect(() => {
|
|
28615
28876
|
const el = localRef.current;
|
|
28616
28877
|
if (!el) return;
|
|
28617
28878
|
el.style.height = "0px";
|
|
28618
28879
|
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
28619
28880
|
el.style.height = `${nextHeight}px`;
|
|
28620
28881
|
}, [value]);
|
|
28621
|
-
return /* @__PURE__ */
|
|
28882
|
+
return /* @__PURE__ */ jsx344("div", { className: clsx_default("lib-xplat-textarea-wrapper", className), children: /* @__PURE__ */ jsx344(
|
|
28622
28883
|
"div",
|
|
28623
28884
|
{
|
|
28624
28885
|
className: clsx_default(
|
|
28625
28886
|
"lib-xplat-textarea",
|
|
28626
28887
|
disabled ? "disabled" : void 0
|
|
28627
28888
|
),
|
|
28628
|
-
children: /* @__PURE__ */
|
|
28889
|
+
children: /* @__PURE__ */ jsx344(
|
|
28629
28890
|
"textarea",
|
|
28630
28891
|
{
|
|
28631
28892
|
...textareaProps,
|
|
@@ -28643,25 +28904,25 @@ TextArea.displayName = "TextArea";
|
|
|
28643
28904
|
var TextArea_default = TextArea;
|
|
28644
28905
|
|
|
28645
28906
|
// src/components/Toast/Toast.tsx
|
|
28646
|
-
import
|
|
28907
|
+
import React37 from "react";
|
|
28647
28908
|
import { createPortal as createPortal4 } from "react-dom";
|
|
28648
|
-
import { jsx as
|
|
28649
|
-
var ToastContext =
|
|
28909
|
+
import { jsx as jsx345, jsxs as jsxs216 } from "react/jsx-runtime";
|
|
28910
|
+
var ToastContext = React37.createContext(null);
|
|
28650
28911
|
var useToast = () => {
|
|
28651
|
-
const ctx =
|
|
28912
|
+
const ctx = React37.useContext(ToastContext);
|
|
28652
28913
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
28653
28914
|
return ctx;
|
|
28654
28915
|
};
|
|
28655
28916
|
var EXIT_DURATION = 300;
|
|
28656
28917
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
28657
|
-
const ref =
|
|
28658
|
-
const [height, setHeight] =
|
|
28659
|
-
|
|
28918
|
+
const ref = React37.useRef(null);
|
|
28919
|
+
const [height, setHeight] = React37.useState(void 0);
|
|
28920
|
+
React37.useEffect(() => {
|
|
28660
28921
|
if (ref.current && !isExiting) {
|
|
28661
28922
|
setHeight(ref.current.offsetHeight);
|
|
28662
28923
|
}
|
|
28663
28924
|
}, [isExiting]);
|
|
28664
|
-
return /* @__PURE__ */
|
|
28925
|
+
return /* @__PURE__ */ jsx345(
|
|
28665
28926
|
"div",
|
|
28666
28927
|
{
|
|
28667
28928
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -28669,15 +28930,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
28669
28930
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
28670
28931
|
marginBottom: isExiting ? 0 : void 0
|
|
28671
28932
|
},
|
|
28672
|
-
children: /* @__PURE__ */
|
|
28933
|
+
children: /* @__PURE__ */ jsxs216(
|
|
28673
28934
|
"div",
|
|
28674
28935
|
{
|
|
28675
28936
|
ref,
|
|
28676
28937
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
28677
28938
|
role: "alert",
|
|
28678
28939
|
children: [
|
|
28679
|
-
/* @__PURE__ */
|
|
28680
|
-
/* @__PURE__ */
|
|
28940
|
+
/* @__PURE__ */ jsx345("span", { className: "message", children: item.message }),
|
|
28941
|
+
/* @__PURE__ */ jsx345("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
28681
28942
|
]
|
|
28682
28943
|
}
|
|
28683
28944
|
)
|
|
@@ -28688,13 +28949,13 @@ var ToastProvider = ({
|
|
|
28688
28949
|
children,
|
|
28689
28950
|
position = "top-right"
|
|
28690
28951
|
}) => {
|
|
28691
|
-
const [toasts, setToasts] =
|
|
28692
|
-
const [removing, setRemoving] =
|
|
28693
|
-
const [mounted, setMounted] =
|
|
28694
|
-
|
|
28952
|
+
const [toasts, setToasts] = React37.useState([]);
|
|
28953
|
+
const [removing, setRemoving] = React37.useState(/* @__PURE__ */ new Set());
|
|
28954
|
+
const [mounted, setMounted] = React37.useState(false);
|
|
28955
|
+
React37.useEffect(() => {
|
|
28695
28956
|
setMounted(true);
|
|
28696
28957
|
}, []);
|
|
28697
|
-
const remove =
|
|
28958
|
+
const remove = React37.useCallback((id) => {
|
|
28698
28959
|
setRemoving((prev) => new Set(prev).add(id));
|
|
28699
28960
|
setTimeout(() => {
|
|
28700
28961
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -28705,7 +28966,7 @@ var ToastProvider = ({
|
|
|
28705
28966
|
});
|
|
28706
28967
|
}, EXIT_DURATION);
|
|
28707
28968
|
}, []);
|
|
28708
|
-
const toast =
|
|
28969
|
+
const toast = React37.useCallback(
|
|
28709
28970
|
(type, message2, duration = 3e3) => {
|
|
28710
28971
|
const id = `${Date.now()}-${Math.random()}`;
|
|
28711
28972
|
setToasts((prev) => [...prev, { id, type, message: message2 }]);
|
|
@@ -28715,10 +28976,10 @@ var ToastProvider = ({
|
|
|
28715
28976
|
},
|
|
28716
28977
|
[remove]
|
|
28717
28978
|
);
|
|
28718
|
-
return /* @__PURE__ */
|
|
28979
|
+
return /* @__PURE__ */ jsxs216(ToastContext.Provider, { value: { toast }, children: [
|
|
28719
28980
|
children,
|
|
28720
28981
|
mounted && createPortal4(
|
|
28721
|
-
/* @__PURE__ */
|
|
28982
|
+
/* @__PURE__ */ jsx345("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ jsx345(
|
|
28722
28983
|
ToastItemComponent,
|
|
28723
28984
|
{
|
|
28724
28985
|
item: t,
|
|
@@ -28734,8 +28995,8 @@ var ToastProvider = ({
|
|
|
28734
28995
|
ToastProvider.displayName = "ToastProvider";
|
|
28735
28996
|
|
|
28736
28997
|
// src/components/Tooltip/Tooltip.tsx
|
|
28737
|
-
import
|
|
28738
|
-
import { jsx as
|
|
28998
|
+
import React38 from "react";
|
|
28999
|
+
import { jsx as jsx346, jsxs as jsxs217 } from "react/jsx-runtime";
|
|
28739
29000
|
var Tooltip2 = (props) => {
|
|
28740
29001
|
const {
|
|
28741
29002
|
type = "primary",
|
|
@@ -28743,20 +29004,20 @@ var Tooltip2 = (props) => {
|
|
|
28743
29004
|
description,
|
|
28744
29005
|
children
|
|
28745
29006
|
} = props;
|
|
28746
|
-
const iconRef =
|
|
29007
|
+
const iconRef = React38.useRef(null);
|
|
28747
29008
|
const colorClass = color2;
|
|
28748
|
-
return /* @__PURE__ */
|
|
28749
|
-
/* @__PURE__ */
|
|
28750
|
-
/* @__PURE__ */
|
|
29009
|
+
return /* @__PURE__ */ jsxs217("div", { className: "lib-xplat-tooltip", children: [
|
|
29010
|
+
/* @__PURE__ */ jsx346("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
|
|
29011
|
+
/* @__PURE__ */ jsx346("div", { className: clsx_default("tooltip-wrapper", colorClass, type), children: description })
|
|
28751
29012
|
] });
|
|
28752
29013
|
};
|
|
28753
29014
|
Tooltip2.displayName = "Tooltip";
|
|
28754
29015
|
var Tooltip_default = Tooltip2;
|
|
28755
29016
|
|
|
28756
29017
|
// src/components/Video/Video.tsx
|
|
28757
|
-
import
|
|
28758
|
-
import { jsx as
|
|
28759
|
-
var Video =
|
|
29018
|
+
import React39 from "react";
|
|
29019
|
+
import { jsx as jsx347, jsxs as jsxs218 } from "react/jsx-runtime";
|
|
29020
|
+
var Video = React39.forwardRef((props, ref) => {
|
|
28760
29021
|
const {
|
|
28761
29022
|
src,
|
|
28762
29023
|
poster,
|
|
@@ -28770,10 +29031,10 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
28770
29031
|
onPause,
|
|
28771
29032
|
...rest
|
|
28772
29033
|
} = props;
|
|
28773
|
-
const videoRef =
|
|
28774
|
-
const [isPlaying, setIsPlaying] =
|
|
28775
|
-
const [isLoaded, setIsLoaded] =
|
|
28776
|
-
const setRefs =
|
|
29034
|
+
const videoRef = React39.useRef(null);
|
|
29035
|
+
const [isPlaying, setIsPlaying] = React39.useState(Boolean(autoPlay));
|
|
29036
|
+
const [isLoaded, setIsLoaded] = React39.useState(false);
|
|
29037
|
+
const setRefs = React39.useCallback(
|
|
28777
29038
|
(el) => {
|
|
28778
29039
|
videoRef.current = el;
|
|
28779
29040
|
if (typeof ref === "function") ref(el);
|
|
@@ -28801,7 +29062,7 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
28801
29062
|
}
|
|
28802
29063
|
};
|
|
28803
29064
|
const showCustomOverlay = !controls;
|
|
28804
|
-
return /* @__PURE__ */
|
|
29065
|
+
return /* @__PURE__ */ jsxs218(
|
|
28805
29066
|
"div",
|
|
28806
29067
|
{
|
|
28807
29068
|
className: clsx_default(
|
|
@@ -28810,7 +29071,7 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
28810
29071
|
className
|
|
28811
29072
|
),
|
|
28812
29073
|
children: [
|
|
28813
|
-
/* @__PURE__ */
|
|
29074
|
+
/* @__PURE__ */ jsx347(
|
|
28814
29075
|
"video",
|
|
28815
29076
|
{
|
|
28816
29077
|
ref: setRefs,
|
|
@@ -28827,7 +29088,7 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
28827
29088
|
...rest
|
|
28828
29089
|
}
|
|
28829
29090
|
),
|
|
28830
|
-
showCustomOverlay && /* @__PURE__ */
|
|
29091
|
+
showCustomOverlay && /* @__PURE__ */ jsx347(
|
|
28831
29092
|
"button",
|
|
28832
29093
|
{
|
|
28833
29094
|
type: "button",
|
|
@@ -28838,7 +29099,7 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
28838
29099
|
),
|
|
28839
29100
|
onClick: togglePlay,
|
|
28840
29101
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
28841
|
-
children: isPlaying ? /* @__PURE__ */
|
|
29102
|
+
children: isPlaying ? /* @__PURE__ */ jsx347(PauseIcon_default, {}) : /* @__PURE__ */ jsx347("span", { className: "play-icon", children: /* @__PURE__ */ jsx347(PlayCircleIcon_default, {}) })
|
|
28842
29103
|
}
|
|
28843
29104
|
)
|
|
28844
29105
|
]
|
|
@@ -28883,6 +29144,7 @@ export {
|
|
|
28883
29144
|
Skeleton_default as Skeleton,
|
|
28884
29145
|
Spinner_default as Spinner,
|
|
28885
29146
|
Steps_default as Steps,
|
|
29147
|
+
Swiper_default as Swiper,
|
|
28886
29148
|
Switch_default as Switch,
|
|
28887
29149
|
Tab_default as Tab,
|
|
28888
29150
|
Table_default as Table,
|