@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.
Files changed (26) hide show
  1. package/dist/index.cjs +194 -151
  2. package/dist/index.js +220 -177
  3. package/dist/styles.css +70 -52
  4. package/dist/types/packages/react/src/data-state.d.cts +3 -1
  5. package/dist/types/packages/react/src/data-state.d.ts +3 -1
  6. package/dist/types/packages/react/src/display.d.cts +1 -1
  7. package/dist/types/packages/react/src/display.d.ts +1 -1
  8. package/dist/types/packages/react/src/kpi.d.cts +5 -1
  9. package/dist/types/packages/react/src/kpi.d.ts +5 -1
  10. package/dist/types/packages/react/src/market-model.d.cts +5 -0
  11. package/dist/types/packages/react/src/market-model.d.ts +5 -0
  12. package/dist/types/packages/react/src/skeletons.d.cts +8 -3
  13. package/dist/types/packages/react/src/skeletons.d.ts +8 -3
  14. package/dist/types/packages/react/src/table-cards.d.cts +1 -1
  15. package/dist/types/packages/react/src/table-cards.d.ts +1 -1
  16. package/dist/types/packages/react/src/table-grid.d.cts +1 -1
  17. package/dist/types/packages/react/src/table-grid.d.ts +1 -1
  18. package/dist/types/shared/package-runtime/chart-skeleton.d.cts +12 -0
  19. package/dist/types/shared/package-runtime/chart-skeleton.d.ts +12 -0
  20. package/dist/types/shared/package-runtime/table-presentation.d.cts +2 -0
  21. package/dist/types/shared/package-runtime/table-presentation.d.ts +2 -0
  22. package/dist/types/shared/package-runtime/table.d.cts +5 -0
  23. package/dist/types/shared/package-runtime/table.d.ts +5 -0
  24. package/dist/types/shared/package-runtime/use-loading-reveal.d.cts +2 -0
  25. package/dist/types/shared/package-runtime/use-loading-reveal.d.ts +2 -0
  26. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -1586,17 +1586,6 @@ function KjunSkeleton({
1586
1586
  },
1587
1587
  row
1588
1588
  )) }),
1589
- type === "chart" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "kjun-skeleton-chart", style: { height: height || import_tokens10.tokens.extensions.skeleton.chartHeight }, children: [
1590
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "kjun-skeleton-chart-bars", children: [40, 65, 50, 80, 60, 90, 75].map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1591
- "div",
1592
- {
1593
- className: "kjun-skeleton-chart-bar",
1594
- style: { height: h + "%" }
1595
- },
1596
- i
1597
- )) }),
1598
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "kjun-skeleton-chart-axis" })
1599
- ] }),
1600
1589
  type === "stat" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "kjun-skeleton-stat", children: [
1601
1590
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "kjun-skeleton-stat-content", children: [
1602
1591
  line("40%", 0, import_tokens10.tokens.extensions.skeleton.lineHeights.sm),
@@ -4329,7 +4318,8 @@ function KjunIconToggle({
4329
4318
  filled: active,
4330
4319
  size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens25.tokens.button.iconSizes[size],
4331
4320
  style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
4332
- className: active ? activeColorClass : inactiveColorClass
4321
+ className: active ? activeColorClass : inactiveColorClass,
4322
+ "data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
4333
4323
  }
4334
4324
  )
4335
4325
  }
@@ -4530,11 +4520,26 @@ function KjunScrollFade({ children }) {
4530
4520
 
4531
4521
  // packages/react/src/data-state.tsx
4532
4522
  var import_tokens26 = require("@kjun-ui/tokens");
4523
+ var import_react39 = require("react");
4524
+
4525
+ // shared/package-runtime/use-loading-reveal.ts
4533
4526
  var import_react38 = require("react");
4527
+ function useLoadingReveal(active, delay = 0) {
4528
+ const [revealed, setRevealed] = (0, import_react38.useState)(false);
4529
+ (0, import_react38.useEffect)(() => {
4530
+ setRevealed(false);
4531
+ if (!active || delay <= 0) return;
4532
+ const timer = setTimeout(() => setRevealed(true), delay);
4533
+ return () => clearTimeout(timer);
4534
+ }, [active, delay]);
4535
+ return delay <= 0 || revealed;
4536
+ }
4537
+
4538
+ // packages/react/src/data-state.tsx
4534
4539
  var import_jsx_runtime24 = require("react/jsx-runtime");
4535
4540
  function useQueryDisplay(props) {
4536
4541
  var _a;
4537
- const [state, setState] = (0, import_react38.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
4542
+ const [state, setState] = (0, import_react39.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
4538
4543
  let next = state;
4539
4544
  if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
4540
4545
  next = (0, import_tokens26.advanceQueryDisplay)(state, props);
@@ -4553,6 +4558,7 @@ function KjunDataState({
4553
4558
  emptyIcon,
4554
4559
  emptyActionText,
4555
4560
  loadingText = "\uB85C\uB529 \uC911...",
4561
+ loadingDelay = 0,
4556
4562
  retryText = "\uB2E4\uC2DC \uC2DC\uB3C4",
4557
4563
  size = "md",
4558
4564
  skeleton = false,
@@ -4566,7 +4572,7 @@ function KjunDataState({
4566
4572
  onEmptyAction,
4567
4573
  ...query2
4568
4574
  }) {
4569
- 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 = import_tokens26.tokens.extensions.state.padding[size];
4575
+ 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 = import_tokens26.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
4570
4576
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
4571
4577
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-data-status", role: "status", children: [
4572
4578
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSpinner, { size: "xs" }),
@@ -4575,9 +4581,10 @@ function KjunDataState({
4575
4581
  state.initialLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4576
4582
  "div",
4577
4583
  {
4578
- role: "status",
4579
- "aria-label": loadingText,
4580
- style: { paddingBlock: loadingPadding === "none" ? 0 : padding },
4584
+ role: revealed ? "status" : void 0,
4585
+ "aria-label": revealed ? loadingText : void 0,
4586
+ "aria-hidden": revealed ? void 0 : true,
4587
+ style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
4581
4588
  children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { display: "grid", gap: import_tokens26.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-data-loading", children: [
4582
4589
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSpinner, { size: "md" }),
4583
4590
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: loadingText })
@@ -4603,7 +4610,7 @@ function KjunDataState({
4603
4610
  ] }) })
4604
4611
  ] });
4605
4612
  }
4606
- var KjunErrorBoundary = class extends import_react38.Component {
4613
+ var KjunErrorBoundary = class extends import_react39.Component {
4607
4614
  constructor() {
4608
4615
  super(...arguments);
4609
4616
  this.state = { error: false };
@@ -4636,7 +4643,17 @@ var KjunErrorBoundary = class extends import_react38.Component {
4636
4643
 
4637
4644
  // packages/react/src/skeletons.tsx
4638
4645
  var import_tokens29 = require("@kjun-ui/tokens");
4639
- var import_react39 = require("react");
4646
+
4647
+ // shared/package-runtime/chart-skeleton.ts
4648
+ var chartFrameViewBox = "0 0 600 240";
4649
+ var chartFramePath = "M20 10V220H590 M20 65H590 M20 120H590 M20 175H590";
4650
+ var chartSkeletonMaxCount = 100;
4651
+ function chartSkeletonCount(value) {
4652
+ return Number.isFinite(value) ? Math.min(chartSkeletonMaxCount, Math.max(1, Math.floor(value))) : 1;
4653
+ }
4654
+ function chartMatrixMuted(row, column) {
4655
+ return (row + column + 2) % 3 === 0;
4656
+ }
4640
4657
 
4641
4658
  // packages/react/src/market-skeleton.tsx
4642
4659
  var import_tokens28 = require("@kjun-ui/tokens");
@@ -4755,67 +4772,71 @@ function KjunFormSkeleton({
4755
4772
  );
4756
4773
  }
4757
4774
  function KjunChartSkeleton({
4775
+ kind = "frame",
4776
+ height = import_tokens29.tokens.extensions.chartSkeleton.height,
4758
4777
  loadingText = "\uCC28\uD2B8\uB97C \uBD88\uB7EC\uC624\uB294 \uC911",
4759
- kind = "line",
4760
- height = import_tokens29.tokens.extensions.chartSkeleton.height
4778
+ skeleton = true,
4779
+ loadingDelay = 0,
4780
+ rows = 8,
4781
+ columns = 14
4761
4782
  }) {
4762
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "kjun-chart-skeleton", style: { height }, "aria-hidden": "true", children: [
4763
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "kjun-chart-skeleton-status", children: loadingText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: loadingText }) }),
4764
- kind === "donut" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "kjun-chart-skeleton-donut", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: import_tokens29.tokens.extensions.chartSkeleton.donutLabelWidth, height: import_tokens29.tokens.extensions.chartSkeleton.donutLabelHeight }) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4765
- "svg",
4766
- {
4767
- viewBox: "0 0 600 240",
4768
- preserveAspectRatio: "none",
4769
- className: "kjun-chart-skeleton-plot",
4770
- children: [
4771
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4772
- "path",
4773
- {
4774
- d: "M20 10V220H590 M20 65H590 M20 120H590 M20 175H590",
4775
- fill: "none",
4776
- stroke: "var(--_kjun-color-border)",
4777
- strokeWidth: 1
4778
- }
4779
- ),
4780
- kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M20 190 L100 160 L180 172 L260 120 L340 140 L420 96 L500 110 L590 64", fill: "none", stroke: "var(--_kjun-color-skeleton)", strokeWidth: 4, strokeLinecap: "round", strokeLinejoin: "round" }),
4781
- kind === "matrix" ? Array.from({ length: 8 }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("g", { children: Array.from({ length: 14 }, (_2, col) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4782
- "rect",
4783
- {
4784
- x: 24 + col * 40,
4785
- y: 12 + row * 26,
4786
- width: 36,
4787
- height: 22,
4788
- rx: 2,
4789
- fill: "var(--_kjun-color-skeleton)",
4790
- opacity: (row + col + 2) % 3 === 0 ? 0.55 : 1
4783
+ const revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
4784
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4785
+ "div",
4786
+ {
4787
+ className: "kjun-chart-skeleton",
4788
+ "data-kjun-chart-kind": kind,
4789
+ "data-skeleton": skeleton ? void 0 : "false",
4790
+ "aria-hidden": revealed ? void 0 : true,
4791
+ style: { height, visibility: revealed ? void 0 : "hidden" },
4792
+ children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
4793
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSpinner, { size: "md" }) }),
4794
+ loadingText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: loadingText })
4795
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4796
+ kind === "donut" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4797
+ "div",
4798
+ {
4799
+ className: "kjun-chart-skeleton-matrix",
4800
+ "data-kjun-chart-part": "matrix",
4801
+ "aria-hidden": "true",
4802
+ style: {
4803
+ gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
4804
+ gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
4791
4805
  },
4792
- col
4793
- )) }, row)) : (kind === "bar" || kind === "candle") && [60, 100, 85, 140, 110, 165, 180].map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react39.Fragment, { children: [
4794
- kind === "candle" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4806
+ children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4807
+ "div",
4808
+ {
4809
+ className: "kjun-chart-skeleton-cell",
4810
+ "data-kjun-chart-part": "cell",
4811
+ "data-muted": chartMatrixMuted(Math.floor(i / columnCount), i % columnCount) ? "" : void 0
4812
+ },
4813
+ i
4814
+ ))
4815
+ }
4816
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4817
+ "svg",
4818
+ {
4819
+ viewBox: chartFrameViewBox,
4820
+ preserveAspectRatio: "none",
4821
+ className: "kjun-chart-skeleton-plot",
4822
+ "data-kjun-chart-part": "plot",
4823
+ "aria-hidden": "true",
4824
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4795
4825
  "path",
4796
4826
  {
4797
- d: `M${55 + i * 75} ${195 - h}V${225 - h / 2}`,
4827
+ d: chartFramePath,
4798
4828
  fill: "none",
4799
- stroke: "var(--_kjun-color-skeleton)",
4800
- strokeWidth: 4
4801
- }
4802
- ),
4803
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4804
- "rect",
4805
- {
4806
- x: 35 + i * 75,
4807
- y: kind === "candle" ? 210 - h : 220 - h,
4808
- width: kind === "candle" ? 28 : 42,
4809
- height: kind === "candle" ? h / 2 : h,
4810
- rx: 3,
4811
- fill: "var(--_kjun-color-skeleton)"
4829
+ stroke: "var(--_kjun-color-chart-grid)",
4830
+ strokeWidth: import_tokens29.tokens.border.defaultWidth,
4831
+ vectorEffect: "non-scaling-stroke"
4812
4832
  }
4813
4833
  )
4814
- ] }, i))
4815
- ]
4816
- }
4817
- )
4818
- ] });
4834
+ }
4835
+ ),
4836
+ loadingText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "kjun-chart-skeleton-status", "data-kjun-chart-part": "status", role: status, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: loadingText }) })
4837
+ ] })
4838
+ }
4839
+ );
4819
4840
  }
4820
4841
 
4821
4842
  // packages/react/src/financial-display.tsx
@@ -5016,6 +5037,7 @@ function KjunSignedValue({
5016
5037
 
5017
5038
  // packages/react/src/financial-display.tsx
5018
5039
  var import_jsx_runtime29 = require("react/jsx-runtime");
5040
+ var deviationFill = { neutral: 1, low: import_tokens32.tokens.states.opacity.deviationLow, medium: import_tokens32.tokens.states.opacity.deviationMedium, strong: import_tokens32.tokens.states.opacity.deviationStrong };
5019
5041
  function KjunDeviation({
5020
5042
  value,
5021
5043
  variant = "pill",
@@ -5026,7 +5048,7 @@ function KjunDeviation({
5026
5048
  const n = finiteNumber(value);
5027
5049
  if (n === null)
5028
5050
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
5029
- const abs = Math.abs(n), signal = abs >= signalThreshold, neutral = abs < 0.1, role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
5051
+ const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens32.deviationLevel)(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
5030
5052
  if (variant === "badge")
5031
5053
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "kjun-deviation-badge", children: [
5032
5054
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
@@ -5059,7 +5081,7 @@ function KjunDeviation({
5059
5081
  className: "kjun-deviation",
5060
5082
  ref: domainColorRef(!neutral),
5061
5083
  "data-variant": variant,
5062
- style: { color: `var(--_kjun-color-${role2})`, fontWeight: abs >= 1 ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
5084
+ style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
5063
5085
  children: [
5064
5086
  variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5065
5087
  "span",
@@ -5068,7 +5090,7 @@ function KjunDeviation({
5068
5090
  className: "kjun-heat-layer",
5069
5091
  style: {
5070
5092
  background: neutral ? "var(--_kjun-color-secondary)" : `var(--_kjun-color-${role2})`,
5071
- opacity: neutral ? 1 : abs < 0.5 ? 0.08 : abs < 1 ? 0.14 : 0.22
5093
+ opacity: deviationFill[level]
5072
5094
  }
5073
5095
  }
5074
5096
  ),
@@ -5437,8 +5459,8 @@ var TableCheck = (0, import_react43.forwardRef)(
5437
5459
 
5438
5460
  // packages/react/src/table-grid.tsx
5439
5461
  var import_jsx_runtime32 = require("react/jsx-runtime");
5440
- function TableGrid({ initialLoading, skeletonRows, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }) {
5441
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "kjun-table-scroll", style: { maxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5462
+ 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 }) {
5463
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "kjun-table-scroll", style: { maxHeight, visibility: skeletonHidden ? "hidden" : void 0 }, "aria-hidden": skeletonHidden || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
5442
5464
  "table",
5443
5465
  {
5444
5466
  className: "kjun-table",
@@ -5555,6 +5577,7 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
5555
5577
  function TableCards({
5556
5578
  initialLoading,
5557
5579
  skeletonRows,
5580
+ skeletonHidden,
5558
5581
  state,
5559
5582
  onRowClick,
5560
5583
  selectable,
@@ -5571,77 +5594,87 @@ function TableCards({
5571
5594
  rowKeyDown
5572
5595
  }) {
5573
5596
  const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
5574
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-cards", role: "list", "aria-label": ariaLabel, children: [
5575
- initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunSkeleton, { type: "card" }) }, i)) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5576
- "div",
5577
- {
5578
- role: "listitem",
5579
- className: "kjun-table-card kjun-table-row-action " + customClass(row, i),
5580
- tabIndex: onRowClick ? 0 : void 0,
5581
- onKeyDown: (event) => rowKeyDown(event, row, i),
5582
- onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
5583
- children: [
5584
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header", children: [
5585
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header-left", children: [
5586
- selectable && checkbox(row, i),
5587
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
5588
- ] }),
5589
- badges.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-badges", children: badges.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: cell(col, row, i) }, col.key)) }) : subtitle ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-subtitle", children: cell(subtitle, row, i) }) : null,
5590
- inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5591
- "div",
5592
- {
5593
- className: "kjun-table-card-header-actions",
5594
- onClick: (e) => e.stopPropagation(),
5595
- children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: cell(col, row, i) }, col.key))
5596
- }
5597
- )
5598
- ] }),
5599
- sections.map((section, index) => {
5600
- const cols = columnsForSection(row, section);
5601
- return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5602
- "section",
5603
- {
5604
- className: "kjun-table-card-section",
5605
- children: [
5606
- section.label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-section-label", children: section.label }),
5607
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5608
- "div",
5609
- {
5610
- className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
5611
- children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5597
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5598
+ "div",
5599
+ {
5600
+ className: "kjun-table-cards",
5601
+ role: "list",
5602
+ "aria-label": ariaLabel,
5603
+ style: skeletonHidden ? { visibility: "hidden" } : void 0,
5604
+ "aria-hidden": skeletonHidden || void 0,
5605
+ children: [
5606
+ initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunSkeleton, { type: "card" }) }, i)) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5607
+ "div",
5608
+ {
5609
+ role: "listitem",
5610
+ className: "kjun-table-card kjun-table-row-action " + customClass(row, i),
5611
+ tabIndex: onRowClick ? 0 : void 0,
5612
+ onKeyDown: (event) => rowKeyDown(event, row, i),
5613
+ onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
5614
+ children: [
5615
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header", children: [
5616
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header-left", children: [
5617
+ selectable && checkbox(row, i),
5618
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
5619
+ ] }),
5620
+ badges.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-badges", children: badges.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: cell(col, row, i) }, col.key)) }) : subtitle ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-subtitle", children: cell(subtitle, row, i) }) : null,
5621
+ inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5622
+ "div",
5623
+ {
5624
+ className: "kjun-table-card-header-actions",
5625
+ onClick: (e) => e.stopPropagation(),
5626
+ children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: cell(col, row, i) }, col.key))
5627
+ }
5628
+ )
5629
+ ] }),
5630
+ sections.map((section, index) => {
5631
+ const cols = columnsForSection(row, section);
5632
+ return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5633
+ "section",
5634
+ {
5635
+ className: "kjun-table-card-section",
5636
+ children: [
5637
+ section.label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-section-label", children: section.label }),
5638
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5612
5639
  "div",
5613
5640
  {
5614
- className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
5615
- children: [
5616
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-label", children: col.label }),
5617
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
5618
- ]
5619
- },
5620
- col.key
5621
- ))
5622
- }
5623
- )
5624
- ]
5625
- },
5626
- section.key || index
5627
- ) : null;
5628
- }),
5629
- expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
5630
- expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-expand-content", children: renderExpand == null ? void 0 : renderExpand(row, i) }),
5631
- actions && !actions.inlineInCard && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5632
- "div",
5633
- {
5634
- className: "kjun-table-card-actions",
5635
- onClick: (e) => e.stopPropagation(),
5636
- children: cell(actions, row, i)
5637
- }
5638
- )
5639
- ]
5640
- },
5641
- state.key(row, i)
5642
- )),
5643
- !initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
5644
- ] });
5641
+ className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
5642
+ children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
5643
+ "div",
5644
+ {
5645
+ className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
5646
+ children: [
5647
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-label", children: col.label }),
5648
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
5649
+ ]
5650
+ },
5651
+ col.key
5652
+ ))
5653
+ }
5654
+ )
5655
+ ]
5656
+ },
5657
+ section.key || index
5658
+ ) : null;
5659
+ }),
5660
+ expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
5661
+ expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-expand-content", children: renderExpand == null ? void 0 : renderExpand(row, i) }),
5662
+ actions && !actions.inlineInCard && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5663
+ "div",
5664
+ {
5665
+ className: "kjun-table-card-actions",
5666
+ onClick: (e) => e.stopPropagation(),
5667
+ children: cell(actions, row, i)
5668
+ }
5669
+ )
5670
+ ]
5671
+ },
5672
+ state.key(row, i)
5673
+ )),
5674
+ !initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
5675
+ ]
5676
+ }
5677
+ );
5645
5678
  }
5646
5679
 
5647
5680
  // packages/react/src/table-view.tsx
@@ -5651,6 +5684,9 @@ var import_jsx_runtime34 = require("react/jsx-runtime");
5651
5684
  function KjunTable(props) {
5652
5685
  const {
5653
5686
  skeletonRows = 8,
5687
+ skeleton = true,
5688
+ loadingText = "\uB85C\uB529 \uC911...",
5689
+ loadingDelay = 0,
5654
5690
  emptyText = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
5655
5691
  hoverable = true,
5656
5692
  searchable = false,
@@ -5672,7 +5708,7 @@ function KjunTable(props) {
5672
5708
  onRowClick,
5673
5709
  onRetry
5674
5710
  } = props;
5675
- const state = useTableModel2(props), query2 = useQueryDisplay(props), [mobile, setMobile] = (0, import_react45.useState)(false);
5711
+ const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react45.useState)(false);
5676
5712
  (0, import_react45.useEffect)(() => {
5677
5713
  const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
5678
5714
  const update = () => setMobile(media.matches);
@@ -5751,8 +5787,11 @@ function KjunTable(props) {
5751
5787
  refreshing: query2.queryRefreshing,
5752
5788
  loadingPadding: "none",
5753
5789
  onRetry,
5790
+ loading: skeleton ? void 0 : props.loading,
5791
+ loadingText,
5792
+ loadingDelay: skeleton ? 0 : loadingDelay,
5754
5793
  children: [
5755
- card ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(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 }),
5794
+ card ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(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 }),
5756
5795
  pagination && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5757
5796
  KjunPagination,
5758
5797
  {
@@ -5799,6 +5838,7 @@ function KjunKpiHero(props) {
5799
5838
  secondary = [],
5800
5839
  animated = true,
5801
5840
  size = "md",
5841
+ surface = "card",
5802
5842
  aside,
5803
5843
  formatter,
5804
5844
  deltaFormatter,
@@ -5820,6 +5860,7 @@ function KjunKpiHero(props) {
5820
5860
  "div",
5821
5861
  {
5822
5862
  className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
5863
+ "data-surface": surface === "none" ? "none" : void 0,
5823
5864
  ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
5824
5865
  "aria-busy": loading,
5825
5866
  children: [
@@ -5903,6 +5944,7 @@ function KjunKpiRow({
5903
5944
  loading = false,
5904
5945
  items,
5905
5946
  size = "md",
5947
+ surface = "card",
5906
5948
  mobileSummary = true,
5907
5949
  onItemClick,
5908
5950
  renderValue
@@ -5945,6 +5987,7 @@ function KjunKpiRow({
5945
5987
  "div",
5946
5988
  {
5947
5989
  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" : ""),
5990
+ "data-surface": surface === "none" ? "none" : void 0,
5948
5991
  "aria-busy": loading || items.some((item) => item.loading),
5949
5992
  ref: domainColorRef(!loading && items.some((item) => {
5950
5993
  var _a2, _b;
@@ -6210,7 +6253,7 @@ function KjunMarketCards(props) {
6210
6253
  ...props,
6211
6254
  loadingPadding: "none",
6212
6255
  empty: !rows.length,
6213
- loadingContent: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunListSkeleton, { variant: "compact" }),
6256
+ loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunListSkeleton, { variant: "compact" }),
6214
6257
  emptyContent: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
6215
6258
  children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6216
6259
  state.pill && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-market-column-label", children: state.pill.label }),
@@ -6295,7 +6338,7 @@ function KjunMarketSimpleList(props) {
6295
6338
  loadingPadding: "none",
6296
6339
  empty: !rows.length,
6297
6340
  emptyText: emptyMessage,
6298
- loadingContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, {}),
6341
+ loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, {}),
6299
6342
  emptyContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
6300
6343
  children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: rows.map((row, i) => {
6301
6344
  var _a, _b;
@@ -6483,7 +6526,7 @@ function KjunMarketTable(props) {
6483
6526
  loadingPadding: "none",
6484
6527
  empty: !rows.length,
6485
6528
  emptyText: emptyMessage,
6486
- loadingContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
6529
+ loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
6487
6530
  emptyContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
6488
6531
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "kjun-table-scroll", ref: scroller, "data-fade-end": fadeEnd || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("table", { "aria-label": "\uC2DC\uC7A5 \uB370\uC774\uD130", className: "kjun-market-table-grid", style: webMarketLayout(columns, showActions).tableStyle, children: [
6489
6532
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MarketColumns, { columns, showActions }),