@kjun-ui/react 0.6.1 → 0.8.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/index.cjs +194 -151
- package/dist/index.js +220 -177
- package/dist/styles.css +70 -52
- package/dist/types/packages/react/src/data-state.d.cts +3 -1
- package/dist/types/packages/react/src/data-state.d.ts +3 -1
- package/dist/types/packages/react/src/display.d.cts +1 -1
- package/dist/types/packages/react/src/display.d.ts +1 -1
- package/dist/types/packages/react/src/kpi.d.cts +5 -1
- package/dist/types/packages/react/src/kpi.d.ts +5 -1
- package/dist/types/packages/react/src/market-model.d.cts +5 -0
- package/dist/types/packages/react/src/market-model.d.ts +5 -0
- package/dist/types/packages/react/src/skeletons.d.cts +8 -3
- package/dist/types/packages/react/src/skeletons.d.ts +8 -3
- package/dist/types/packages/react/src/table-cards.d.cts +1 -1
- package/dist/types/packages/react/src/table-cards.d.ts +1 -1
- package/dist/types/packages/react/src/table-grid.d.cts +1 -1
- package/dist/types/packages/react/src/table-grid.d.ts +1 -1
- package/dist/types/shared/package-runtime/chart-skeleton.d.cts +12 -0
- package/dist/types/shared/package-runtime/chart-skeleton.d.ts +12 -0
- package/dist/types/shared/package-runtime/table-presentation.d.cts +2 -0
- package/dist/types/shared/package-runtime/table-presentation.d.ts +2 -0
- package/dist/types/shared/package-runtime/table.d.cts +5 -0
- package/dist/types/shared/package-runtime/table.d.ts +5 -0
- package/dist/types/shared/package-runtime/use-loading-reveal.d.cts +2 -0
- package/dist/types/shared/package-runtime/use-loading-reveal.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1501,17 +1501,6 @@ function KjunSkeleton({
|
|
|
1501
1501
|
},
|
|
1502
1502
|
row
|
|
1503
1503
|
)) }),
|
|
1504
|
-
type === "chart" && /* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-chart", style: { height: height || tokens7.extensions.skeleton.chartHeight }, children: [
|
|
1505
|
-
/* @__PURE__ */ jsx8("div", { className: "kjun-skeleton-chart-bars", children: [40, 65, 50, 80, 60, 90, 75].map((h, i) => /* @__PURE__ */ jsx8(
|
|
1506
|
-
"div",
|
|
1507
|
-
{
|
|
1508
|
-
className: "kjun-skeleton-chart-bar",
|
|
1509
|
-
style: { height: h + "%" }
|
|
1510
|
-
},
|
|
1511
|
-
i
|
|
1512
|
-
)) }),
|
|
1513
|
-
/* @__PURE__ */ jsx8("div", { className: "kjun-skeleton-chart-axis" })
|
|
1514
|
-
] }),
|
|
1515
1504
|
type === "stat" && /* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat", children: [
|
|
1516
1505
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat-content", children: [
|
|
1517
1506
|
line("40%", 0, tokens7.extensions.skeleton.lineHeights.sm),
|
|
@@ -4288,7 +4277,8 @@ function KjunIconToggle({
|
|
|
4288
4277
|
filled: active,
|
|
4289
4278
|
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens21.button.iconSizes[size],
|
|
4290
4279
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4291
|
-
className: active ? activeColorClass : inactiveColorClass
|
|
4280
|
+
className: active ? activeColorClass : inactiveColorClass,
|
|
4281
|
+
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
4292
4282
|
}
|
|
4293
4283
|
)
|
|
4294
4284
|
}
|
|
@@ -4494,11 +4484,26 @@ import {
|
|
|
4494
4484
|
initialQueryDisplay,
|
|
4495
4485
|
queryDisplayStatus
|
|
4496
4486
|
} from "@kjun-ui/tokens";
|
|
4497
|
-
import { Component, useState as
|
|
4487
|
+
import { Component, useState as useState23 } from "react";
|
|
4488
|
+
|
|
4489
|
+
// shared/package-runtime/use-loading-reveal.ts
|
|
4490
|
+
import { useEffect as useEffect15, useState as useState22 } from "react";
|
|
4491
|
+
function useLoadingReveal(active, delay = 0) {
|
|
4492
|
+
const [revealed, setRevealed] = useState22(false);
|
|
4493
|
+
useEffect15(() => {
|
|
4494
|
+
setRevealed(false);
|
|
4495
|
+
if (!active || delay <= 0) return;
|
|
4496
|
+
const timer = setTimeout(() => setRevealed(true), delay);
|
|
4497
|
+
return () => clearTimeout(timer);
|
|
4498
|
+
}, [active, delay]);
|
|
4499
|
+
return delay <= 0 || revealed;
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
// packages/react/src/data-state.tsx
|
|
4498
4503
|
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4499
4504
|
function useQueryDisplay(props) {
|
|
4500
4505
|
var _a;
|
|
4501
|
-
const [state, setState] =
|
|
4506
|
+
const [state, setState] = useState23(() => initialQueryDisplay(props));
|
|
4502
4507
|
let next = state;
|
|
4503
4508
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4504
4509
|
next = advanceQueryDisplay(state, props);
|
|
@@ -4517,6 +4522,7 @@ function KjunDataState({
|
|
|
4517
4522
|
emptyIcon,
|
|
4518
4523
|
emptyActionText,
|
|
4519
4524
|
loadingText = "\uB85C\uB529 \uC911...",
|
|
4525
|
+
loadingDelay = 0,
|
|
4520
4526
|
retryText = "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
4521
4527
|
size = "md",
|
|
4522
4528
|
skeleton = false,
|
|
@@ -4530,7 +4536,7 @@ function KjunDataState({
|
|
|
4530
4536
|
onEmptyAction,
|
|
4531
4537
|
...query2
|
|
4532
4538
|
}) {
|
|
4533
|
-
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = tokens22.extensions.state.padding[size];
|
|
4539
|
+
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = tokens22.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
4534
4540
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4535
4541
|
/* @__PURE__ */ jsx24("div", { children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
4536
4542
|
/* @__PURE__ */ jsx24(KjunSpinner, { size: "xs" }),
|
|
@@ -4539,9 +4545,10 @@ function KjunDataState({
|
|
|
4539
4545
|
state.initialLoading ? /* @__PURE__ */ jsx24(
|
|
4540
4546
|
"div",
|
|
4541
4547
|
{
|
|
4542
|
-
role: "status",
|
|
4543
|
-
"aria-label": loadingText,
|
|
4544
|
-
|
|
4548
|
+
role: revealed ? "status" : void 0,
|
|
4549
|
+
"aria-label": revealed ? loadingText : void 0,
|
|
4550
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4551
|
+
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4545
4552
|
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx24("div", { style: { display: "grid", gap: tokens22.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx24(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs18("div", { className: "kjun-data-loading", children: [
|
|
4546
4553
|
/* @__PURE__ */ jsx24(KjunSpinner, { size: "md" }),
|
|
4547
4554
|
/* @__PURE__ */ jsx24("p", { children: loadingText })
|
|
@@ -4600,7 +4607,17 @@ var KjunErrorBoundary = class extends Component {
|
|
|
4600
4607
|
|
|
4601
4608
|
// packages/react/src/skeletons.tsx
|
|
4602
4609
|
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
4603
|
-
|
|
4610
|
+
|
|
4611
|
+
// shared/package-runtime/chart-skeleton.ts
|
|
4612
|
+
var chartFrameViewBox = "0 0 600 240";
|
|
4613
|
+
var chartFramePath = "M20 10V220H590 M20 65H590 M20 120H590 M20 175H590";
|
|
4614
|
+
var chartSkeletonMaxCount = 100;
|
|
4615
|
+
function chartSkeletonCount(value) {
|
|
4616
|
+
return Number.isFinite(value) ? Math.min(chartSkeletonMaxCount, Math.max(1, Math.floor(value))) : 1;
|
|
4617
|
+
}
|
|
4618
|
+
function chartMatrixMuted(row, column) {
|
|
4619
|
+
return (row + column + 2) % 3 === 0;
|
|
4620
|
+
}
|
|
4604
4621
|
|
|
4605
4622
|
// packages/react/src/market-skeleton.tsx
|
|
4606
4623
|
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
@@ -4662,7 +4679,7 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
4662
4679
|
}
|
|
4663
4680
|
|
|
4664
4681
|
// packages/react/src/skeletons.tsx
|
|
4665
|
-
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4682
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4666
4683
|
function KjunListSkeleton({
|
|
4667
4684
|
rows = 8,
|
|
4668
4685
|
variant = "market",
|
|
@@ -4719,71 +4736,75 @@ function KjunFormSkeleton({
|
|
|
4719
4736
|
);
|
|
4720
4737
|
}
|
|
4721
4738
|
function KjunChartSkeleton({
|
|
4739
|
+
kind = "frame",
|
|
4740
|
+
height = tokens25.extensions.chartSkeleton.height,
|
|
4722
4741
|
loadingText = "\uCC28\uD2B8\uB97C \uBD88\uB7EC\uC624\uB294 \uC911",
|
|
4723
|
-
|
|
4724
|
-
|
|
4742
|
+
skeleton = true,
|
|
4743
|
+
loadingDelay = 0,
|
|
4744
|
+
rows = 8,
|
|
4745
|
+
columns = 14
|
|
4725
4746
|
}) {
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
x: 24 + col * 40,
|
|
4749
|
-
y: 12 + row * 26,
|
|
4750
|
-
width: 36,
|
|
4751
|
-
height: 22,
|
|
4752
|
-
rx: 2,
|
|
4753
|
-
fill: "var(--_kjun-color-skeleton)",
|
|
4754
|
-
opacity: (row + col + 2) % 3 === 0 ? 0.55 : 1
|
|
4747
|
+
const revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
4748
|
+
return /* @__PURE__ */ jsx27(
|
|
4749
|
+
"div",
|
|
4750
|
+
{
|
|
4751
|
+
className: "kjun-chart-skeleton",
|
|
4752
|
+
"data-kjun-chart-kind": kind,
|
|
4753
|
+
"data-skeleton": skeleton ? void 0 : "false",
|
|
4754
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4755
|
+
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
4756
|
+
children: !skeleton ? /* @__PURE__ */ jsxs21("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
4757
|
+
/* @__PURE__ */ jsx27("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27(KjunSpinner, { size: "md" }) }),
|
|
4758
|
+
loadingText && /* @__PURE__ */ jsx27("p", { children: loadingText })
|
|
4759
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
4760
|
+
kind === "donut" ? /* @__PURE__ */ jsx27("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ jsx27(
|
|
4761
|
+
"div",
|
|
4762
|
+
{
|
|
4763
|
+
className: "kjun-chart-skeleton-matrix",
|
|
4764
|
+
"data-kjun-chart-part": "matrix",
|
|
4765
|
+
"aria-hidden": "true",
|
|
4766
|
+
style: {
|
|
4767
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
4768
|
+
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
4755
4769
|
},
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4770
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ jsx27(
|
|
4771
|
+
"div",
|
|
4772
|
+
{
|
|
4773
|
+
className: "kjun-chart-skeleton-cell",
|
|
4774
|
+
"data-kjun-chart-part": "cell",
|
|
4775
|
+
"data-muted": chartMatrixMuted(Math.floor(i / columnCount), i % columnCount) ? "" : void 0
|
|
4776
|
+
},
|
|
4777
|
+
i
|
|
4778
|
+
))
|
|
4779
|
+
}
|
|
4780
|
+
) : /* @__PURE__ */ jsx27(
|
|
4781
|
+
"svg",
|
|
4782
|
+
{
|
|
4783
|
+
viewBox: chartFrameViewBox,
|
|
4784
|
+
preserveAspectRatio: "none",
|
|
4785
|
+
className: "kjun-chart-skeleton-plot",
|
|
4786
|
+
"data-kjun-chart-part": "plot",
|
|
4787
|
+
"aria-hidden": "true",
|
|
4788
|
+
children: /* @__PURE__ */ jsx27(
|
|
4759
4789
|
"path",
|
|
4760
4790
|
{
|
|
4761
|
-
d:
|
|
4791
|
+
d: chartFramePath,
|
|
4762
4792
|
fill: "none",
|
|
4763
|
-
stroke: "var(--_kjun-color-
|
|
4764
|
-
strokeWidth:
|
|
4765
|
-
|
|
4766
|
-
),
|
|
4767
|
-
/* @__PURE__ */ jsx27(
|
|
4768
|
-
"rect",
|
|
4769
|
-
{
|
|
4770
|
-
x: 35 + i * 75,
|
|
4771
|
-
y: kind === "candle" ? 210 - h : 220 - h,
|
|
4772
|
-
width: kind === "candle" ? 28 : 42,
|
|
4773
|
-
height: kind === "candle" ? h / 2 : h,
|
|
4774
|
-
rx: 3,
|
|
4775
|
-
fill: "var(--_kjun-color-skeleton)"
|
|
4793
|
+
stroke: "var(--_kjun-color-chart-grid)",
|
|
4794
|
+
strokeWidth: tokens25.border.defaultWidth,
|
|
4795
|
+
vectorEffect: "non-scaling-stroke"
|
|
4776
4796
|
}
|
|
4777
4797
|
)
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4798
|
+
}
|
|
4799
|
+
),
|
|
4800
|
+
loadingText && /* @__PURE__ */ jsx27("div", { className: "kjun-chart-skeleton-status", "data-kjun-chart-part": "status", role: status, children: /* @__PURE__ */ jsx27("span", { children: loadingText }) })
|
|
4801
|
+
] })
|
|
4802
|
+
}
|
|
4803
|
+
);
|
|
4783
4804
|
}
|
|
4784
4805
|
|
|
4785
4806
|
// packages/react/src/financial-display.tsx
|
|
4786
|
-
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
4807
|
+
import { deviationLevel, tokens as tokens28 } from "@kjun-ui/tokens";
|
|
4787
4808
|
import {
|
|
4788
4809
|
useId as useId11
|
|
4789
4810
|
} from "react";
|
|
@@ -4792,7 +4813,7 @@ import {
|
|
|
4792
4813
|
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
4793
4814
|
|
|
4794
4815
|
// shared/package-runtime/use-number-motion.ts
|
|
4795
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as useRef24, useState as
|
|
4816
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef24, useState as useState24 } from "react";
|
|
4796
4817
|
|
|
4797
4818
|
// shared/package-runtime/number-motion.ts
|
|
4798
4819
|
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
@@ -4838,7 +4859,7 @@ function createNumberMotion(apply) {
|
|
|
4838
4859
|
|
|
4839
4860
|
// shared/package-runtime/use-number-motion.ts
|
|
4840
4861
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
4841
|
-
const [display, setDisplay] =
|
|
4862
|
+
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
4842
4863
|
const motion = useRef24(null);
|
|
4843
4864
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4844
4865
|
useLayoutEffect13(() => {
|
|
@@ -4982,6 +5003,7 @@ function KjunSignedValue({
|
|
|
4982
5003
|
|
|
4983
5004
|
// packages/react/src/financial-display.tsx
|
|
4984
5005
|
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5006
|
+
var deviationFill = { neutral: 1, low: tokens28.states.opacity.deviationLow, medium: tokens28.states.opacity.deviationMedium, strong: tokens28.states.opacity.deviationStrong };
|
|
4985
5007
|
function KjunDeviation({
|
|
4986
5008
|
value,
|
|
4987
5009
|
variant = "pill",
|
|
@@ -4992,7 +5014,7 @@ function KjunDeviation({
|
|
|
4992
5014
|
const n = finiteNumber(value);
|
|
4993
5015
|
if (n === null)
|
|
4994
5016
|
return /* @__PURE__ */ jsx29("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
4995
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, neutral =
|
|
5017
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = deviationLevel(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
4996
5018
|
if (variant === "badge")
|
|
4997
5019
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-deviation-badge", children: [
|
|
4998
5020
|
/* @__PURE__ */ jsx29(
|
|
@@ -5025,7 +5047,7 @@ function KjunDeviation({
|
|
|
5025
5047
|
className: "kjun-deviation",
|
|
5026
5048
|
ref: domainColorRef(!neutral),
|
|
5027
5049
|
"data-variant": variant,
|
|
5028
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight:
|
|
5050
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens28.typography.numberLg.fontWeight : tokens28.typography.control.fontWeight },
|
|
5029
5051
|
children: [
|
|
5030
5052
|
variant === "pill" && /* @__PURE__ */ jsx29(
|
|
5031
5053
|
"span",
|
|
@@ -5034,7 +5056,7 @@ function KjunDeviation({
|
|
|
5034
5056
|
className: "kjun-heat-layer",
|
|
5035
5057
|
style: {
|
|
5036
5058
|
background: neutral ? "var(--_kjun-color-secondary)" : `var(--_kjun-color-${role2})`,
|
|
5037
|
-
opacity:
|
|
5059
|
+
opacity: deviationFill[level]
|
|
5038
5060
|
}
|
|
5039
5061
|
}
|
|
5040
5062
|
),
|
|
@@ -5188,7 +5210,7 @@ function KjunSparkline({
|
|
|
5188
5210
|
|
|
5189
5211
|
// shared/package-runtime/table.ts
|
|
5190
5212
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
5191
|
-
import { useEffect as
|
|
5213
|
+
import { useEffect as useEffect16, useRef as useRef25, useState as useState25 } from "react";
|
|
5192
5214
|
|
|
5193
5215
|
// shared/package-runtime/table-model.ts
|
|
5194
5216
|
function getValue(row, key) {
|
|
@@ -5232,11 +5254,11 @@ function useTableModel(props) {
|
|
|
5232
5254
|
expandSingle = false,
|
|
5233
5255
|
onExpandedRowsChange
|
|
5234
5256
|
} = props;
|
|
5235
|
-
const [internalSort, setSort] =
|
|
5257
|
+
const [internalSort, setSort] = useState25({
|
|
5236
5258
|
key: "",
|
|
5237
5259
|
order: "asc"
|
|
5238
|
-
}), [internalExpanded, setExpanded] =
|
|
5239
|
-
|
|
5260
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef25(void 0);
|
|
5261
|
+
useEffect16(() => () => clearTimeout(timer.current), []);
|
|
5240
5262
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5241
5263
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5242
5264
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5403,8 +5425,8 @@ var TableCheck = forwardRef4(
|
|
|
5403
5425
|
|
|
5404
5426
|
// packages/react/src/table-grid.tsx
|
|
5405
5427
|
import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5406
|
-
function TableGrid({ initialLoading, skeletonRows, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }) {
|
|
5407
|
-
return /* @__PURE__ */ jsx32("div", { className: "kjun-table-scroll", style: { maxHeight }, children: /* @__PURE__ */ jsxs26(
|
|
5428
|
+
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }) {
|
|
5429
|
+
return /* @__PURE__ */ jsx32("div", { className: "kjun-table-scroll", style: { maxHeight, visibility: skeletonHidden ? "hidden" : void 0 }, "aria-hidden": skeletonHidden || void 0, children: /* @__PURE__ */ jsxs26(
|
|
5408
5430
|
"table",
|
|
5409
5431
|
{
|
|
5410
5432
|
className: "kjun-table",
|
|
@@ -5521,6 +5543,7 @@ import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
|
5521
5543
|
function TableCards({
|
|
5522
5544
|
initialLoading,
|
|
5523
5545
|
skeletonRows,
|
|
5546
|
+
skeletonHidden,
|
|
5524
5547
|
state,
|
|
5525
5548
|
onRowClick,
|
|
5526
5549
|
selectable,
|
|
@@ -5537,86 +5560,99 @@ function TableCards({
|
|
|
5537
5560
|
rowKeyDown
|
|
5538
5561
|
}) {
|
|
5539
5562
|
const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
|
|
5540
|
-
return /* @__PURE__ */ jsxs27(
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
children:
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
{
|
|
5559
|
-
className: "kjun-table-card-header-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5563
|
+
return /* @__PURE__ */ jsxs27(
|
|
5564
|
+
"div",
|
|
5565
|
+
{
|
|
5566
|
+
className: "kjun-table-cards",
|
|
5567
|
+
role: "list",
|
|
5568
|
+
"aria-label": ariaLabel,
|
|
5569
|
+
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5570
|
+
"aria-hidden": skeletonHidden || void 0,
|
|
5571
|
+
children: [
|
|
5572
|
+
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsx33("div", { className: "kjun-table-card", children: /* @__PURE__ */ jsx33(KjunSkeleton, { type: "card" }) }, i)) : state.rows.map((row, i) => /* @__PURE__ */ jsxs27(
|
|
5573
|
+
"div",
|
|
5574
|
+
{
|
|
5575
|
+
role: "listitem",
|
|
5576
|
+
className: "kjun-table-card kjun-table-row-action " + customClass(row, i),
|
|
5577
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
5578
|
+
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5579
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5580
|
+
children: [
|
|
5581
|
+
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header", children: [
|
|
5582
|
+
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header-left", children: [
|
|
5583
|
+
selectable && checkbox(row, i),
|
|
5584
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5585
|
+
] }),
|
|
5586
|
+
badges.length ? /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-badges", children: badges.map((col) => /* @__PURE__ */ jsx33("span", { children: cell(col, row, i) }, col.key)) }) : subtitle ? /* @__PURE__ */ jsx33("span", { className: "kjun-table-card-subtitle", children: cell(subtitle, row, i) }) : null,
|
|
5587
|
+
inline.length > 0 && /* @__PURE__ */ jsx33(
|
|
5588
|
+
"div",
|
|
5589
|
+
{
|
|
5590
|
+
className: "kjun-table-card-header-actions",
|
|
5591
|
+
onClick: (e) => e.stopPropagation(),
|
|
5592
|
+
children: inline.map((col) => /* @__PURE__ */ jsx33("span", { children: cell(col, row, i) }, col.key))
|
|
5593
|
+
}
|
|
5594
|
+
)
|
|
5595
|
+
] }),
|
|
5596
|
+
sections.map((section, index) => {
|
|
5597
|
+
const cols = columnsForSection(row, section);
|
|
5598
|
+
return cols.length ? /* @__PURE__ */ jsxs27(
|
|
5599
|
+
"section",
|
|
5600
|
+
{
|
|
5601
|
+
className: "kjun-table-card-section",
|
|
5602
|
+
children: [
|
|
5603
|
+
section.label && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
5604
|
+
/* @__PURE__ */ jsx33(
|
|
5578
5605
|
"div",
|
|
5579
5606
|
{
|
|
5580
|
-
className: "kjun-table-card-
|
|
5581
|
-
children:
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
className: "kjun-table-card-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5607
|
+
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5608
|
+
children: cols.map((col) => /* @__PURE__ */ jsxs27(
|
|
5609
|
+
"div",
|
|
5610
|
+
{
|
|
5611
|
+
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5612
|
+
children: [
|
|
5613
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-label", children: col.label }),
|
|
5614
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5615
|
+
]
|
|
5616
|
+
},
|
|
5617
|
+
col.key
|
|
5618
|
+
))
|
|
5619
|
+
}
|
|
5620
|
+
)
|
|
5621
|
+
]
|
|
5622
|
+
},
|
|
5623
|
+
section.key || index
|
|
5624
|
+
) : null;
|
|
5625
|
+
}),
|
|
5626
|
+
expandable && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
5627
|
+
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-expand-content", children: renderExpand == null ? void 0 : renderExpand(row, i) }),
|
|
5628
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ jsx33(
|
|
5629
|
+
"div",
|
|
5630
|
+
{
|
|
5631
|
+
className: "kjun-table-card-actions",
|
|
5632
|
+
onClick: (e) => e.stopPropagation(),
|
|
5633
|
+
children: cell(actions, row, i)
|
|
5634
|
+
}
|
|
5635
|
+
)
|
|
5636
|
+
]
|
|
5637
|
+
},
|
|
5638
|
+
state.key(row, i)
|
|
5639
|
+
)),
|
|
5640
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5641
|
+
]
|
|
5642
|
+
}
|
|
5643
|
+
);
|
|
5611
5644
|
}
|
|
5612
5645
|
|
|
5613
5646
|
// packages/react/src/table-view.tsx
|
|
5614
|
-
import { useEffect as
|
|
5647
|
+
import { useEffect as useEffect17, useState as useState26 } from "react";
|
|
5615
5648
|
import { isComposingKey as isComposingKey4, tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5616
5649
|
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5617
5650
|
function KjunTable(props) {
|
|
5618
5651
|
const {
|
|
5619
5652
|
skeletonRows = 8,
|
|
5653
|
+
skeleton = true,
|
|
5654
|
+
loadingText = "\uB85C\uB529 \uC911...",
|
|
5655
|
+
loadingDelay = 0,
|
|
5620
5656
|
emptyText = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
5621
5657
|
hoverable = true,
|
|
5622
5658
|
searchable = false,
|
|
@@ -5638,8 +5674,8 @@ function KjunTable(props) {
|
|
|
5638
5674
|
onRowClick,
|
|
5639
5675
|
onRetry
|
|
5640
5676
|
} = props;
|
|
5641
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), [mobile, setMobile] =
|
|
5642
|
-
|
|
5677
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
5678
|
+
useEffect17(() => {
|
|
5643
5679
|
const media = matchMedia(`(width < ${tokens32.table.mobileBreakpoint}px)`);
|
|
5644
5680
|
const update = () => setMobile(media.matches);
|
|
5645
5681
|
update();
|
|
@@ -5717,8 +5753,11 @@ function KjunTable(props) {
|
|
|
5717
5753
|
refreshing: query2.queryRefreshing,
|
|
5718
5754
|
loadingPadding: "none",
|
|
5719
5755
|
onRetry,
|
|
5756
|
+
loading: skeleton ? void 0 : props.loading,
|
|
5757
|
+
loadingText,
|
|
5758
|
+
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
5720
5759
|
children: [
|
|
5721
|
-
card ? /* @__PURE__ */ jsx34(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ jsx34(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }, sortable: props.sortable }),
|
|
5760
|
+
card ? /* @__PURE__ */ jsx34(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ jsx34(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }, sortable: props.sortable }),
|
|
5722
5761
|
pagination && /* @__PURE__ */ jsx34(
|
|
5723
5762
|
KjunPagination,
|
|
5724
5763
|
{
|
|
@@ -5765,6 +5804,7 @@ function KjunKpiHero(props) {
|
|
|
5765
5804
|
secondary = [],
|
|
5766
5805
|
animated = true,
|
|
5767
5806
|
size = "md",
|
|
5807
|
+
surface = "card",
|
|
5768
5808
|
aside,
|
|
5769
5809
|
formatter,
|
|
5770
5810
|
deltaFormatter,
|
|
@@ -5786,6 +5826,7 @@ function KjunKpiHero(props) {
|
|
|
5786
5826
|
"div",
|
|
5787
5827
|
{
|
|
5788
5828
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
5829
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5789
5830
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
5790
5831
|
"aria-busy": loading,
|
|
5791
5832
|
children: [
|
|
@@ -5869,6 +5910,7 @@ function KjunKpiRow({
|
|
|
5869
5910
|
loading = false,
|
|
5870
5911
|
items,
|
|
5871
5912
|
size = "md",
|
|
5913
|
+
surface = "card",
|
|
5872
5914
|
mobileSummary = true,
|
|
5873
5915
|
onItemClick,
|
|
5874
5916
|
renderValue
|
|
@@ -5911,6 +5953,7 @@ function KjunKpiRow({
|
|
|
5911
5953
|
"div",
|
|
5912
5954
|
{
|
|
5913
5955
|
className: "kjun-kpi-row" + (size === "sm" ? " kjun-kpi-row--sm" : "") + (((_a = items[0]) == null ? void 0 : _a.mobileFull) ? " kjun-kpi-row--hero-first" : "") + (mobileSummary && size !== "sm" ? " kjun-kpi-row--mobile-summary" : ""),
|
|
5956
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5914
5957
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
5915
5958
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
5916
5959
|
var _a2, _b;
|
|
@@ -5998,7 +6041,7 @@ function KjunKpiRow({
|
|
|
5998
6041
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
5999
6042
|
|
|
6000
6043
|
// shared/package-runtime/market-cards.ts
|
|
6001
|
-
import { useEffect as
|
|
6044
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState27 } from "react";
|
|
6002
6045
|
function useMarketCardsModel(props, persistence) {
|
|
6003
6046
|
const {
|
|
6004
6047
|
columns,
|
|
@@ -6014,7 +6057,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6014
6057
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6015
6058
|
isDefaultSort: c.defaultSort
|
|
6016
6059
|
}));
|
|
6017
|
-
const [key, setKey] =
|
|
6060
|
+
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6018
6061
|
const mounted = useRef26("");
|
|
6019
6062
|
const save = (key2) => {
|
|
6020
6063
|
var _a;
|
|
@@ -6023,7 +6066,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6023
6066
|
} catch (e) {
|
|
6024
6067
|
}
|
|
6025
6068
|
};
|
|
6026
|
-
|
|
6069
|
+
useEffect18(() => {
|
|
6027
6070
|
var _a, _b;
|
|
6028
6071
|
if (mounted.current === restoreSignature) return;
|
|
6029
6072
|
mounted.current = restoreSignature;
|
|
@@ -6176,7 +6219,7 @@ function KjunMarketCards(props) {
|
|
|
6176
6219
|
...props,
|
|
6177
6220
|
loadingPadding: "none",
|
|
6178
6221
|
empty: !rows.length,
|
|
6179
|
-
loadingContent: /* @__PURE__ */ jsx37(KjunListSkeleton, { variant: "compact" }),
|
|
6222
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx37(KjunListSkeleton, { variant: "compact" }),
|
|
6180
6223
|
emptyContent: /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6181
6224
|
children: /* @__PURE__ */ jsxs31("div", { children: [
|
|
6182
6225
|
state.pill && /* @__PURE__ */ jsx37("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
@@ -6261,7 +6304,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6261
6304
|
loadingPadding: "none",
|
|
6262
6305
|
empty: !rows.length,
|
|
6263
6306
|
emptyText: emptyMessage,
|
|
6264
|
-
loadingContent: /* @__PURE__ */ jsx38(KjunListSkeleton, {}),
|
|
6307
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx38(KjunListSkeleton, {}),
|
|
6265
6308
|
emptyContent: /* @__PURE__ */ jsx38(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6266
6309
|
children: /* @__PURE__ */ jsx38("div", { children: rows.map((row, i) => {
|
|
6267
6310
|
var _a, _b;
|
|
@@ -6359,7 +6402,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6359
6402
|
}
|
|
6360
6403
|
|
|
6361
6404
|
// packages/react/src/market-table.tsx
|
|
6362
|
-
import { useEffect as
|
|
6405
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState28 } from "react";
|
|
6363
6406
|
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6364
6407
|
function KjunMarketTable(props) {
|
|
6365
6408
|
const {
|
|
@@ -6380,8 +6423,8 @@ function KjunMarketTable(props) {
|
|
|
6380
6423
|
formatMetric,
|
|
6381
6424
|
renderCell
|
|
6382
6425
|
} = props;
|
|
6383
|
-
const scroller = useRef27(null), [fadeEnd, setFadeEnd] =
|
|
6384
|
-
|
|
6426
|
+
const scroller = useRef27(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
6427
|
+
useEffect19(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6385
6428
|
const render = (row, col) => {
|
|
6386
6429
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6387
6430
|
if (cellLoading(row, col))
|
|
@@ -6449,7 +6492,7 @@ function KjunMarketTable(props) {
|
|
|
6449
6492
|
loadingPadding: "none",
|
|
6450
6493
|
empty: !rows.length,
|
|
6451
6494
|
emptyText: emptyMessage,
|
|
6452
|
-
loadingContent: /* @__PURE__ */ jsx40(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6495
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx40(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6453
6496
|
emptyContent: /* @__PURE__ */ jsx40(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6454
6497
|
children: /* @__PURE__ */ jsx40("div", { className: "kjun-table-scroll", ref: scroller, "data-fade-end": fadeEnd || void 0, children: /* @__PURE__ */ jsxs34("table", { "aria-label": "\uC2DC\uC7A5 \uB370\uC774\uD130", className: "kjun-market-table-grid", style: webMarketLayout(columns, showActions).tableStyle, children: [
|
|
6455
6498
|
/* @__PURE__ */ jsx40(MarketColumns, { columns, showActions }),
|
|
@@ -6651,14 +6694,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
6651
6694
|
}
|
|
6652
6695
|
|
|
6653
6696
|
// packages/react/src/media.tsx
|
|
6654
|
-
import { useRef as useRef28, useState as
|
|
6697
|
+
import { useRef as useRef28, useState as useState29 } from "react";
|
|
6655
6698
|
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
6656
6699
|
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6657
6700
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6658
6701
|
const current = useRef28({ src, version: 0 });
|
|
6659
6702
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6660
6703
|
const version = current.current.version;
|
|
6661
|
-
const [result, setResult] =
|
|
6704
|
+
const [result, setResult] = useState29({ version, state: "loading" });
|
|
6662
6705
|
const state = result.version === version ? result.state : "loading";
|
|
6663
6706
|
const failed = !src || state === "error";
|
|
6664
6707
|
return /* @__PURE__ */ jsxs37("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -6690,7 +6733,7 @@ function KjunChip({ label, icon, removable = false, disabled = false, size = "md
|
|
|
6690
6733
|
}
|
|
6691
6734
|
|
|
6692
6735
|
// packages/react/src/range-input.tsx
|
|
6693
|
-
import { useEffect as
|
|
6736
|
+
import { useEffect as useEffect20, useRef as useRef29 } from "react";
|
|
6694
6737
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
6695
6738
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
6696
6739
|
import { Fragment as Fragment18, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -6702,7 +6745,7 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
6702
6745
|
const latest = useRef29(value);
|
|
6703
6746
|
latest.current = value;
|
|
6704
6747
|
const active = useRef29(false);
|
|
6705
|
-
|
|
6748
|
+
useEffect20(() => {
|
|
6706
6749
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6707
6750
|
}, [valid]);
|
|
6708
6751
|
const change = (next) => {
|
|
@@ -6739,7 +6782,7 @@ function KjunRangeSlider(props) {
|
|
|
6739
6782
|
}
|
|
6740
6783
|
|
|
6741
6784
|
// packages/react/src/quantity-stepper.tsx
|
|
6742
|
-
import { useEffect as
|
|
6785
|
+
import { useEffect as useEffect21, useRef as useRef30, useState as useState30 } from "react";
|
|
6743
6786
|
import { createNumberDomain, quantityKeyAction, tokens as tokens41 } from "@kjun-ui/tokens";
|
|
6744
6787
|
import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6745
6788
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
@@ -6747,15 +6790,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6747
6790
|
const buttonStyle = { width: tokens41.input[size].height, padding: 0 };
|
|
6748
6791
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
6749
6792
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
6750
|
-
const [draft, setDraft] =
|
|
6793
|
+
const [draft, setDraft] = useState30(String(value));
|
|
6751
6794
|
const field = useKjunField();
|
|
6752
6795
|
const composing = useRef30(false), dirty = useRef30(false), accepted = useRef30(value);
|
|
6753
|
-
|
|
6796
|
+
useEffect21(() => {
|
|
6754
6797
|
setDraft(String(value));
|
|
6755
6798
|
accepted.current = value;
|
|
6756
6799
|
dirty.current = false;
|
|
6757
6800
|
}, [value, precision, min, max, step]);
|
|
6758
|
-
|
|
6801
|
+
useEffect21(() => {
|
|
6759
6802
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6760
6803
|
}, [valid]);
|
|
6761
6804
|
const emit = (next) => {
|
|
@@ -6830,7 +6873,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6830
6873
|
}
|
|
6831
6874
|
|
|
6832
6875
|
// packages/react/src/time-picker.tsx
|
|
6833
|
-
import { Fragment as Fragment19, useEffect as
|
|
6876
|
+
import { Fragment as Fragment19, useEffect as useEffect22, useId as useId13, useMemo as useMemo2, useRef as useRef31 } from "react";
|
|
6834
6877
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
6835
6878
|
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6836
6879
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel = "\uC2DC\uAC04", onValueChange, onChangeCommit }) {
|
|
@@ -6839,7 +6882,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
6839
6882
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
6840
6883
|
const domain = useMemo2(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
6841
6884
|
const valid = domain.valid && domain.accepts(value);
|
|
6842
|
-
|
|
6885
|
+
useEffect22(() => {
|
|
6843
6886
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6844
6887
|
}, [valid]);
|
|
6845
6888
|
const change = (next) => {
|