@kjun-ui/react 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/index.cjs +172 -132
- package/dist/index.js +151 -111
- package/dist/styles.css +46 -10
- 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/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/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/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
|
@@ -4288,7 +4288,8 @@ function KjunIconToggle({
|
|
|
4288
4288
|
filled: active,
|
|
4289
4289
|
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens21.button.iconSizes[size],
|
|
4290
4290
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4291
|
-
className: active ? activeColorClass : inactiveColorClass
|
|
4291
|
+
className: active ? activeColorClass : inactiveColorClass,
|
|
4292
|
+
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
4292
4293
|
}
|
|
4293
4294
|
)
|
|
4294
4295
|
}
|
|
@@ -4494,11 +4495,26 @@ import {
|
|
|
4494
4495
|
initialQueryDisplay,
|
|
4495
4496
|
queryDisplayStatus
|
|
4496
4497
|
} from "@kjun-ui/tokens";
|
|
4497
|
-
import { Component, useState as
|
|
4498
|
+
import { Component, useState as useState23 } from "react";
|
|
4499
|
+
|
|
4500
|
+
// shared/package-runtime/use-loading-reveal.ts
|
|
4501
|
+
import { useEffect as useEffect15, useState as useState22 } from "react";
|
|
4502
|
+
function useLoadingReveal(active, delay = 0) {
|
|
4503
|
+
const [revealed, setRevealed] = useState22(false);
|
|
4504
|
+
useEffect15(() => {
|
|
4505
|
+
setRevealed(false);
|
|
4506
|
+
if (!active || delay <= 0) return;
|
|
4507
|
+
const timer = setTimeout(() => setRevealed(true), delay);
|
|
4508
|
+
return () => clearTimeout(timer);
|
|
4509
|
+
}, [active, delay]);
|
|
4510
|
+
return delay <= 0 || revealed;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
// packages/react/src/data-state.tsx
|
|
4498
4514
|
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4499
4515
|
function useQueryDisplay(props) {
|
|
4500
4516
|
var _a;
|
|
4501
|
-
const [state, setState] =
|
|
4517
|
+
const [state, setState] = useState23(() => initialQueryDisplay(props));
|
|
4502
4518
|
let next = state;
|
|
4503
4519
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4504
4520
|
next = advanceQueryDisplay(state, props);
|
|
@@ -4517,6 +4533,7 @@ function KjunDataState({
|
|
|
4517
4533
|
emptyIcon,
|
|
4518
4534
|
emptyActionText,
|
|
4519
4535
|
loadingText = "\uB85C\uB529 \uC911...",
|
|
4536
|
+
loadingDelay = 0,
|
|
4520
4537
|
retryText = "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
4521
4538
|
size = "md",
|
|
4522
4539
|
skeleton = false,
|
|
@@ -4530,7 +4547,7 @@ function KjunDataState({
|
|
|
4530
4547
|
onEmptyAction,
|
|
4531
4548
|
...query2
|
|
4532
4549
|
}) {
|
|
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];
|
|
4550
|
+
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
4551
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4535
4552
|
/* @__PURE__ */ jsx24("div", { children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
4536
4553
|
/* @__PURE__ */ jsx24(KjunSpinner, { size: "xs" }),
|
|
@@ -4539,9 +4556,10 @@ function KjunDataState({
|
|
|
4539
4556
|
state.initialLoading ? /* @__PURE__ */ jsx24(
|
|
4540
4557
|
"div",
|
|
4541
4558
|
{
|
|
4542
|
-
role: "status",
|
|
4543
|
-
"aria-label": loadingText,
|
|
4544
|
-
|
|
4559
|
+
role: revealed ? "status" : void 0,
|
|
4560
|
+
"aria-label": revealed ? loadingText : void 0,
|
|
4561
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4562
|
+
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4545
4563
|
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
4564
|
/* @__PURE__ */ jsx24(KjunSpinner, { size: "md" }),
|
|
4547
4565
|
/* @__PURE__ */ jsx24("p", { children: loadingText })
|
|
@@ -4783,7 +4801,7 @@ function KjunChartSkeleton({
|
|
|
4783
4801
|
}
|
|
4784
4802
|
|
|
4785
4803
|
// packages/react/src/financial-display.tsx
|
|
4786
|
-
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
4804
|
+
import { deviationLevel, tokens as tokens28 } from "@kjun-ui/tokens";
|
|
4787
4805
|
import {
|
|
4788
4806
|
useId as useId11
|
|
4789
4807
|
} from "react";
|
|
@@ -4792,7 +4810,7 @@ import {
|
|
|
4792
4810
|
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
4793
4811
|
|
|
4794
4812
|
// shared/package-runtime/use-number-motion.ts
|
|
4795
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as useRef24, useState as
|
|
4813
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef24, useState as useState24 } from "react";
|
|
4796
4814
|
|
|
4797
4815
|
// shared/package-runtime/number-motion.ts
|
|
4798
4816
|
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
@@ -4838,7 +4856,7 @@ function createNumberMotion(apply) {
|
|
|
4838
4856
|
|
|
4839
4857
|
// shared/package-runtime/use-number-motion.ts
|
|
4840
4858
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
4841
|
-
const [display, setDisplay] =
|
|
4859
|
+
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
4842
4860
|
const motion = useRef24(null);
|
|
4843
4861
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4844
4862
|
useLayoutEffect13(() => {
|
|
@@ -4982,6 +5000,7 @@ function KjunSignedValue({
|
|
|
4982
5000
|
|
|
4983
5001
|
// packages/react/src/financial-display.tsx
|
|
4984
5002
|
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5003
|
+
var deviationFill = { neutral: 1, low: tokens28.states.opacity.deviationLow, medium: tokens28.states.opacity.deviationMedium, strong: tokens28.states.opacity.deviationStrong };
|
|
4985
5004
|
function KjunDeviation({
|
|
4986
5005
|
value,
|
|
4987
5006
|
variant = "pill",
|
|
@@ -4992,7 +5011,7 @@ function KjunDeviation({
|
|
|
4992
5011
|
const n = finiteNumber(value);
|
|
4993
5012
|
if (n === null)
|
|
4994
5013
|
return /* @__PURE__ */ jsx29("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
4995
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, neutral =
|
|
5014
|
+
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
5015
|
if (variant === "badge")
|
|
4997
5016
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-deviation-badge", children: [
|
|
4998
5017
|
/* @__PURE__ */ jsx29(
|
|
@@ -5025,7 +5044,7 @@ function KjunDeviation({
|
|
|
5025
5044
|
className: "kjun-deviation",
|
|
5026
5045
|
ref: domainColorRef(!neutral),
|
|
5027
5046
|
"data-variant": variant,
|
|
5028
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight:
|
|
5047
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens28.typography.numberLg.fontWeight : tokens28.typography.control.fontWeight },
|
|
5029
5048
|
children: [
|
|
5030
5049
|
variant === "pill" && /* @__PURE__ */ jsx29(
|
|
5031
5050
|
"span",
|
|
@@ -5034,7 +5053,7 @@ function KjunDeviation({
|
|
|
5034
5053
|
className: "kjun-heat-layer",
|
|
5035
5054
|
style: {
|
|
5036
5055
|
background: neutral ? "var(--_kjun-color-secondary)" : `var(--_kjun-color-${role2})`,
|
|
5037
|
-
opacity:
|
|
5056
|
+
opacity: deviationFill[level]
|
|
5038
5057
|
}
|
|
5039
5058
|
}
|
|
5040
5059
|
),
|
|
@@ -5188,7 +5207,7 @@ function KjunSparkline({
|
|
|
5188
5207
|
|
|
5189
5208
|
// shared/package-runtime/table.ts
|
|
5190
5209
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
5191
|
-
import { useEffect as
|
|
5210
|
+
import { useEffect as useEffect16, useRef as useRef25, useState as useState25 } from "react";
|
|
5192
5211
|
|
|
5193
5212
|
// shared/package-runtime/table-model.ts
|
|
5194
5213
|
function getValue(row, key) {
|
|
@@ -5232,11 +5251,11 @@ function useTableModel(props) {
|
|
|
5232
5251
|
expandSingle = false,
|
|
5233
5252
|
onExpandedRowsChange
|
|
5234
5253
|
} = props;
|
|
5235
|
-
const [internalSort, setSort] =
|
|
5254
|
+
const [internalSort, setSort] = useState25({
|
|
5236
5255
|
key: "",
|
|
5237
5256
|
order: "asc"
|
|
5238
|
-
}), [internalExpanded, setExpanded] =
|
|
5239
|
-
|
|
5257
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef25(void 0);
|
|
5258
|
+
useEffect16(() => () => clearTimeout(timer.current), []);
|
|
5240
5259
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5241
5260
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5242
5261
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5403,8 +5422,8 @@ var TableCheck = forwardRef4(
|
|
|
5403
5422
|
|
|
5404
5423
|
// packages/react/src/table-grid.tsx
|
|
5405
5424
|
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(
|
|
5425
|
+
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 }) {
|
|
5426
|
+
return /* @__PURE__ */ jsx32("div", { className: "kjun-table-scroll", style: { maxHeight, visibility: skeletonHidden ? "hidden" : void 0 }, "aria-hidden": skeletonHidden || void 0, children: /* @__PURE__ */ jsxs26(
|
|
5408
5427
|
"table",
|
|
5409
5428
|
{
|
|
5410
5429
|
className: "kjun-table",
|
|
@@ -5521,6 +5540,7 @@ import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
|
5521
5540
|
function TableCards({
|
|
5522
5541
|
initialLoading,
|
|
5523
5542
|
skeletonRows,
|
|
5543
|
+
skeletonHidden,
|
|
5524
5544
|
state,
|
|
5525
5545
|
onRowClick,
|
|
5526
5546
|
selectable,
|
|
@@ -5537,86 +5557,99 @@ function TableCards({
|
|
|
5537
5557
|
rowKeyDown
|
|
5538
5558
|
}) {
|
|
5539
5559
|
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
|
-
|
|
5560
|
+
return /* @__PURE__ */ jsxs27(
|
|
5561
|
+
"div",
|
|
5562
|
+
{
|
|
5563
|
+
className: "kjun-table-cards",
|
|
5564
|
+
role: "list",
|
|
5565
|
+
"aria-label": ariaLabel,
|
|
5566
|
+
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5567
|
+
"aria-hidden": skeletonHidden || void 0,
|
|
5568
|
+
children: [
|
|
5569
|
+
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(
|
|
5570
|
+
"div",
|
|
5571
|
+
{
|
|
5572
|
+
role: "listitem",
|
|
5573
|
+
className: "kjun-table-card kjun-table-row-action " + customClass(row, i),
|
|
5574
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
5575
|
+
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5576
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5577
|
+
children: [
|
|
5578
|
+
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header", children: [
|
|
5579
|
+
/* @__PURE__ */ jsxs27("div", { className: "kjun-table-card-header-left", children: [
|
|
5580
|
+
selectable && checkbox(row, i),
|
|
5581
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5582
|
+
] }),
|
|
5583
|
+
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,
|
|
5584
|
+
inline.length > 0 && /* @__PURE__ */ jsx33(
|
|
5585
|
+
"div",
|
|
5586
|
+
{
|
|
5587
|
+
className: "kjun-table-card-header-actions",
|
|
5588
|
+
onClick: (e) => e.stopPropagation(),
|
|
5589
|
+
children: inline.map((col) => /* @__PURE__ */ jsx33("span", { children: cell(col, row, i) }, col.key))
|
|
5590
|
+
}
|
|
5591
|
+
)
|
|
5592
|
+
] }),
|
|
5593
|
+
sections.map((section, index) => {
|
|
5594
|
+
const cols = columnsForSection(row, section);
|
|
5595
|
+
return cols.length ? /* @__PURE__ */ jsxs27(
|
|
5596
|
+
"section",
|
|
5597
|
+
{
|
|
5598
|
+
className: "kjun-table-card-section",
|
|
5599
|
+
children: [
|
|
5600
|
+
section.label && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
5601
|
+
/* @__PURE__ */ jsx33(
|
|
5578
5602
|
"div",
|
|
5579
5603
|
{
|
|
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
|
-
|
|
5604
|
+
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5605
|
+
children: cols.map((col) => /* @__PURE__ */ jsxs27(
|
|
5606
|
+
"div",
|
|
5607
|
+
{
|
|
5608
|
+
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5609
|
+
children: [
|
|
5610
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-label", children: col.label }),
|
|
5611
|
+
/* @__PURE__ */ jsx33("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5612
|
+
]
|
|
5613
|
+
},
|
|
5614
|
+
col.key
|
|
5615
|
+
))
|
|
5616
|
+
}
|
|
5617
|
+
)
|
|
5618
|
+
]
|
|
5619
|
+
},
|
|
5620
|
+
section.key || index
|
|
5621
|
+
) : null;
|
|
5622
|
+
}),
|
|
5623
|
+
expandable && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
5624
|
+
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) }),
|
|
5625
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ jsx33(
|
|
5626
|
+
"div",
|
|
5627
|
+
{
|
|
5628
|
+
className: "kjun-table-card-actions",
|
|
5629
|
+
onClick: (e) => e.stopPropagation(),
|
|
5630
|
+
children: cell(actions, row, i)
|
|
5631
|
+
}
|
|
5632
|
+
)
|
|
5633
|
+
]
|
|
5634
|
+
},
|
|
5635
|
+
state.key(row, i)
|
|
5636
|
+
)),
|
|
5637
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx33("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5638
|
+
]
|
|
5639
|
+
}
|
|
5640
|
+
);
|
|
5611
5641
|
}
|
|
5612
5642
|
|
|
5613
5643
|
// packages/react/src/table-view.tsx
|
|
5614
|
-
import { useEffect as
|
|
5644
|
+
import { useEffect as useEffect17, useState as useState26 } from "react";
|
|
5615
5645
|
import { isComposingKey as isComposingKey4, tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5616
5646
|
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5617
5647
|
function KjunTable(props) {
|
|
5618
5648
|
const {
|
|
5619
5649
|
skeletonRows = 8,
|
|
5650
|
+
skeleton = true,
|
|
5651
|
+
loadingText = "\uB85C\uB529 \uC911...",
|
|
5652
|
+
loadingDelay = 0,
|
|
5620
5653
|
emptyText = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
5621
5654
|
hoverable = true,
|
|
5622
5655
|
searchable = false,
|
|
@@ -5638,8 +5671,8 @@ function KjunTable(props) {
|
|
|
5638
5671
|
onRowClick,
|
|
5639
5672
|
onRetry
|
|
5640
5673
|
} = props;
|
|
5641
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), [mobile, setMobile] =
|
|
5642
|
-
|
|
5674
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
5675
|
+
useEffect17(() => {
|
|
5643
5676
|
const media = matchMedia(`(width < ${tokens32.table.mobileBreakpoint}px)`);
|
|
5644
5677
|
const update = () => setMobile(media.matches);
|
|
5645
5678
|
update();
|
|
@@ -5717,8 +5750,11 @@ function KjunTable(props) {
|
|
|
5717
5750
|
refreshing: query2.queryRefreshing,
|
|
5718
5751
|
loadingPadding: "none",
|
|
5719
5752
|
onRetry,
|
|
5753
|
+
loading: skeleton ? void 0 : props.loading,
|
|
5754
|
+
loadingText,
|
|
5755
|
+
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
5720
5756
|
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 }),
|
|
5757
|
+
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
5758
|
pagination && /* @__PURE__ */ jsx34(
|
|
5723
5759
|
KjunPagination,
|
|
5724
5760
|
{
|
|
@@ -5765,6 +5801,7 @@ function KjunKpiHero(props) {
|
|
|
5765
5801
|
secondary = [],
|
|
5766
5802
|
animated = true,
|
|
5767
5803
|
size = "md",
|
|
5804
|
+
surface = "card",
|
|
5768
5805
|
aside,
|
|
5769
5806
|
formatter,
|
|
5770
5807
|
deltaFormatter,
|
|
@@ -5786,6 +5823,7 @@ function KjunKpiHero(props) {
|
|
|
5786
5823
|
"div",
|
|
5787
5824
|
{
|
|
5788
5825
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
5826
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5789
5827
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
5790
5828
|
"aria-busy": loading,
|
|
5791
5829
|
children: [
|
|
@@ -5869,6 +5907,7 @@ function KjunKpiRow({
|
|
|
5869
5907
|
loading = false,
|
|
5870
5908
|
items,
|
|
5871
5909
|
size = "md",
|
|
5910
|
+
surface = "card",
|
|
5872
5911
|
mobileSummary = true,
|
|
5873
5912
|
onItemClick,
|
|
5874
5913
|
renderValue
|
|
@@ -5911,6 +5950,7 @@ function KjunKpiRow({
|
|
|
5911
5950
|
"div",
|
|
5912
5951
|
{
|
|
5913
5952
|
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" : ""),
|
|
5953
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5914
5954
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
5915
5955
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
5916
5956
|
var _a2, _b;
|
|
@@ -5998,7 +6038,7 @@ function KjunKpiRow({
|
|
|
5998
6038
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
5999
6039
|
|
|
6000
6040
|
// shared/package-runtime/market-cards.ts
|
|
6001
|
-
import { useEffect as
|
|
6041
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState27 } from "react";
|
|
6002
6042
|
function useMarketCardsModel(props, persistence) {
|
|
6003
6043
|
const {
|
|
6004
6044
|
columns,
|
|
@@ -6014,7 +6054,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6014
6054
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6015
6055
|
isDefaultSort: c.defaultSort
|
|
6016
6056
|
}));
|
|
6017
|
-
const [key, setKey] =
|
|
6057
|
+
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6018
6058
|
const mounted = useRef26("");
|
|
6019
6059
|
const save = (key2) => {
|
|
6020
6060
|
var _a;
|
|
@@ -6023,7 +6063,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6023
6063
|
} catch (e) {
|
|
6024
6064
|
}
|
|
6025
6065
|
};
|
|
6026
|
-
|
|
6066
|
+
useEffect18(() => {
|
|
6027
6067
|
var _a, _b;
|
|
6028
6068
|
if (mounted.current === restoreSignature) return;
|
|
6029
6069
|
mounted.current = restoreSignature;
|
|
@@ -6176,7 +6216,7 @@ function KjunMarketCards(props) {
|
|
|
6176
6216
|
...props,
|
|
6177
6217
|
loadingPadding: "none",
|
|
6178
6218
|
empty: !rows.length,
|
|
6179
|
-
loadingContent: /* @__PURE__ */ jsx37(KjunListSkeleton, { variant: "compact" }),
|
|
6219
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx37(KjunListSkeleton, { variant: "compact" }),
|
|
6180
6220
|
emptyContent: /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6181
6221
|
children: /* @__PURE__ */ jsxs31("div", { children: [
|
|
6182
6222
|
state.pill && /* @__PURE__ */ jsx37("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
@@ -6261,7 +6301,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6261
6301
|
loadingPadding: "none",
|
|
6262
6302
|
empty: !rows.length,
|
|
6263
6303
|
emptyText: emptyMessage,
|
|
6264
|
-
loadingContent: /* @__PURE__ */ jsx38(KjunListSkeleton, {}),
|
|
6304
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx38(KjunListSkeleton, {}),
|
|
6265
6305
|
emptyContent: /* @__PURE__ */ jsx38(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6266
6306
|
children: /* @__PURE__ */ jsx38("div", { children: rows.map((row, i) => {
|
|
6267
6307
|
var _a, _b;
|
|
@@ -6359,7 +6399,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6359
6399
|
}
|
|
6360
6400
|
|
|
6361
6401
|
// packages/react/src/market-table.tsx
|
|
6362
|
-
import { useEffect as
|
|
6402
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState28 } from "react";
|
|
6363
6403
|
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6364
6404
|
function KjunMarketTable(props) {
|
|
6365
6405
|
const {
|
|
@@ -6380,8 +6420,8 @@ function KjunMarketTable(props) {
|
|
|
6380
6420
|
formatMetric,
|
|
6381
6421
|
renderCell
|
|
6382
6422
|
} = props;
|
|
6383
|
-
const scroller = useRef27(null), [fadeEnd, setFadeEnd] =
|
|
6384
|
-
|
|
6423
|
+
const scroller = useRef27(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
6424
|
+
useEffect19(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6385
6425
|
const render = (row, col) => {
|
|
6386
6426
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6387
6427
|
if (cellLoading(row, col))
|
|
@@ -6449,7 +6489,7 @@ function KjunMarketTable(props) {
|
|
|
6449
6489
|
loadingPadding: "none",
|
|
6450
6490
|
empty: !rows.length,
|
|
6451
6491
|
emptyText: emptyMessage,
|
|
6452
|
-
loadingContent: /* @__PURE__ */ jsx40(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6492
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx40(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6453
6493
|
emptyContent: /* @__PURE__ */ jsx40(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6454
6494
|
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
6495
|
/* @__PURE__ */ jsx40(MarketColumns, { columns, showActions }),
|
|
@@ -6651,14 +6691,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
6651
6691
|
}
|
|
6652
6692
|
|
|
6653
6693
|
// packages/react/src/media.tsx
|
|
6654
|
-
import { useRef as useRef28, useState as
|
|
6694
|
+
import { useRef as useRef28, useState as useState29 } from "react";
|
|
6655
6695
|
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
6656
6696
|
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6657
6697
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6658
6698
|
const current = useRef28({ src, version: 0 });
|
|
6659
6699
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6660
6700
|
const version = current.current.version;
|
|
6661
|
-
const [result, setResult] =
|
|
6701
|
+
const [result, setResult] = useState29({ version, state: "loading" });
|
|
6662
6702
|
const state = result.version === version ? result.state : "loading";
|
|
6663
6703
|
const failed = !src || state === "error";
|
|
6664
6704
|
return /* @__PURE__ */ jsxs37("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -6690,7 +6730,7 @@ function KjunChip({ label, icon, removable = false, disabled = false, size = "md
|
|
|
6690
6730
|
}
|
|
6691
6731
|
|
|
6692
6732
|
// packages/react/src/range-input.tsx
|
|
6693
|
-
import { useEffect as
|
|
6733
|
+
import { useEffect as useEffect20, useRef as useRef29 } from "react";
|
|
6694
6734
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
6695
6735
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
6696
6736
|
import { Fragment as Fragment18, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -6702,7 +6742,7 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
6702
6742
|
const latest = useRef29(value);
|
|
6703
6743
|
latest.current = value;
|
|
6704
6744
|
const active = useRef29(false);
|
|
6705
|
-
|
|
6745
|
+
useEffect20(() => {
|
|
6706
6746
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6707
6747
|
}, [valid]);
|
|
6708
6748
|
const change = (next) => {
|
|
@@ -6739,7 +6779,7 @@ function KjunRangeSlider(props) {
|
|
|
6739
6779
|
}
|
|
6740
6780
|
|
|
6741
6781
|
// packages/react/src/quantity-stepper.tsx
|
|
6742
|
-
import { useEffect as
|
|
6782
|
+
import { useEffect as useEffect21, useRef as useRef30, useState as useState30 } from "react";
|
|
6743
6783
|
import { createNumberDomain, quantityKeyAction, tokens as tokens41 } from "@kjun-ui/tokens";
|
|
6744
6784
|
import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6745
6785
|
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 +6787,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6747
6787
|
const buttonStyle = { width: tokens41.input[size].height, padding: 0 };
|
|
6748
6788
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
6749
6789
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
6750
|
-
const [draft, setDraft] =
|
|
6790
|
+
const [draft, setDraft] = useState30(String(value));
|
|
6751
6791
|
const field = useKjunField();
|
|
6752
6792
|
const composing = useRef30(false), dirty = useRef30(false), accepted = useRef30(value);
|
|
6753
|
-
|
|
6793
|
+
useEffect21(() => {
|
|
6754
6794
|
setDraft(String(value));
|
|
6755
6795
|
accepted.current = value;
|
|
6756
6796
|
dirty.current = false;
|
|
6757
6797
|
}, [value, precision, min, max, step]);
|
|
6758
|
-
|
|
6798
|
+
useEffect21(() => {
|
|
6759
6799
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6760
6800
|
}, [valid]);
|
|
6761
6801
|
const emit = (next) => {
|
|
@@ -6830,7 +6870,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6830
6870
|
}
|
|
6831
6871
|
|
|
6832
6872
|
// packages/react/src/time-picker.tsx
|
|
6833
|
-
import { Fragment as Fragment19, useEffect as
|
|
6873
|
+
import { Fragment as Fragment19, useEffect as useEffect22, useId as useId13, useMemo as useMemo2, useRef as useRef31 } from "react";
|
|
6834
6874
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
6835
6875
|
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6836
6876
|
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 +6879,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
6839
6879
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
6840
6880
|
const domain = useMemo2(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
6841
6881
|
const valid = domain.valid && domain.accepts(value);
|
|
6842
|
-
|
|
6882
|
+
useEffect22(() => {
|
|
6843
6883
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6844
6884
|
}, [valid]);
|
|
6845
6885
|
const change = (next) => {
|