@kjun-ui/react 0.7.0 → 0.8.1
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 +116 -110
- package/dist/index.js +72 -66
- package/dist/styles.css +26 -42
- 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/skeletons.d.cts +8 -3
- package/dist/types/packages/react/src/skeletons.d.ts +8 -3
- package/dist/types/shared/package-runtime/chart-skeleton.d.cts +16 -0
- package/dist/types/shared/package-runtime/chart-skeleton.d.ts +16 -0
- 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),
|
|
@@ -4654,7 +4643,20 @@ var KjunErrorBoundary = class extends import_react39.Component {
|
|
|
4654
4643
|
|
|
4655
4644
|
// packages/react/src/skeletons.tsx
|
|
4656
4645
|
var import_tokens29 = require("@kjun-ui/tokens");
|
|
4657
|
-
|
|
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
|
+
}
|
|
4657
|
+
function chartSkeletonKind(kind) {
|
|
4658
|
+
return kind === "donut" || kind === "matrix" ? kind : "frame";
|
|
4659
|
+
}
|
|
4658
4660
|
|
|
4659
4661
|
// packages/react/src/market-skeleton.tsx
|
|
4660
4662
|
var import_tokens28 = require("@kjun-ui/tokens");
|
|
@@ -4773,78 +4775,82 @@ function KjunFormSkeleton({
|
|
|
4773
4775
|
);
|
|
4774
4776
|
}
|
|
4775
4777
|
function KjunChartSkeleton({
|
|
4778
|
+
kind: requestedKind = "frame",
|
|
4779
|
+
height = import_tokens29.tokens.extensions.chartSkeleton.height,
|
|
4776
4780
|
loadingText = "\uCC28\uD2B8\uB97C \uBD88\uB7EC\uC624\uB294 \uC911",
|
|
4777
|
-
|
|
4778
|
-
|
|
4781
|
+
skeleton = true,
|
|
4782
|
+
loadingDelay = 0,
|
|
4783
|
+
rows = 8,
|
|
4784
|
+
columns = 14
|
|
4779
4785
|
}) {
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
x: 24 + col * 40,
|
|
4803
|
-
y: 12 + row * 26,
|
|
4804
|
-
width: 36,
|
|
4805
|
-
height: 22,
|
|
4806
|
-
rx: 2,
|
|
4807
|
-
fill: "var(--_kjun-color-skeleton)",
|
|
4808
|
-
opacity: (row + col + 2) % 3 === 0 ? 0.55 : 1
|
|
4786
|
+
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
4787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4788
|
+
"div",
|
|
4789
|
+
{
|
|
4790
|
+
className: "kjun-chart-skeleton",
|
|
4791
|
+
"data-kjun-chart-kind": kind,
|
|
4792
|
+
"data-skeleton": skeleton ? void 0 : "false",
|
|
4793
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4794
|
+
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
4795
|
+
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSpinner, { size: "md" }) }),
|
|
4797
|
+
loadingText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: loadingText })
|
|
4798
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
4799
|
+
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)(
|
|
4800
|
+
"div",
|
|
4801
|
+
{
|
|
4802
|
+
className: "kjun-chart-skeleton-matrix",
|
|
4803
|
+
"data-kjun-chart-part": "matrix",
|
|
4804
|
+
"aria-hidden": "true",
|
|
4805
|
+
style: {
|
|
4806
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
4807
|
+
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
4809
4808
|
},
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4809
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4810
|
+
"div",
|
|
4811
|
+
{
|
|
4812
|
+
className: "kjun-chart-skeleton-cell",
|
|
4813
|
+
"data-kjun-chart-part": "cell",
|
|
4814
|
+
"data-muted": chartMatrixMuted(Math.floor(i / columnCount), i % columnCount) ? "" : void 0
|
|
4815
|
+
},
|
|
4816
|
+
i
|
|
4817
|
+
))
|
|
4818
|
+
}
|
|
4819
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4820
|
+
"svg",
|
|
4821
|
+
{
|
|
4822
|
+
viewBox: chartFrameViewBox,
|
|
4823
|
+
preserveAspectRatio: "none",
|
|
4824
|
+
className: "kjun-chart-skeleton-plot",
|
|
4825
|
+
"data-kjun-chart-part": "plot",
|
|
4826
|
+
"aria-hidden": "true",
|
|
4827
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4813
4828
|
"path",
|
|
4814
4829
|
{
|
|
4815
|
-
d:
|
|
4830
|
+
d: chartFramePath,
|
|
4816
4831
|
fill: "none",
|
|
4817
|
-
stroke: "var(--_kjun-color-
|
|
4818
|
-
strokeWidth:
|
|
4819
|
-
|
|
4820
|
-
),
|
|
4821
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4822
|
-
"rect",
|
|
4823
|
-
{
|
|
4824
|
-
x: 35 + i * 75,
|
|
4825
|
-
y: kind === "candle" ? 210 - h : 220 - h,
|
|
4826
|
-
width: kind === "candle" ? 28 : 42,
|
|
4827
|
-
height: kind === "candle" ? h / 2 : h,
|
|
4828
|
-
rx: 3,
|
|
4829
|
-
fill: "var(--_kjun-color-skeleton)"
|
|
4832
|
+
stroke: "var(--_kjun-color-chart-grid)",
|
|
4833
|
+
strokeWidth: import_tokens29.tokens.border.defaultWidth,
|
|
4834
|
+
vectorEffect: "non-scaling-stroke"
|
|
4830
4835
|
}
|
|
4831
4836
|
)
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
+
}
|
|
4838
|
+
),
|
|
4839
|
+
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 }) })
|
|
4840
|
+
] })
|
|
4841
|
+
}
|
|
4842
|
+
);
|
|
4837
4843
|
}
|
|
4838
4844
|
|
|
4839
4845
|
// packages/react/src/financial-display.tsx
|
|
4840
4846
|
var import_tokens32 = require("@kjun-ui/tokens");
|
|
4841
|
-
var
|
|
4847
|
+
var import_react41 = require("react");
|
|
4842
4848
|
|
|
4843
4849
|
// packages/react/src/number-display.tsx
|
|
4844
4850
|
var import_tokens31 = require("@kjun-ui/tokens");
|
|
4845
4851
|
|
|
4846
4852
|
// shared/package-runtime/use-number-motion.ts
|
|
4847
|
-
var
|
|
4853
|
+
var import_react40 = require("react");
|
|
4848
4854
|
|
|
4849
4855
|
// shared/package-runtime/number-motion.ts
|
|
4850
4856
|
var import_tokens30 = require("@kjun-ui/tokens");
|
|
@@ -4890,14 +4896,14 @@ function createNumberMotion(apply) {
|
|
|
4890
4896
|
|
|
4891
4897
|
// shared/package-runtime/use-number-motion.ts
|
|
4892
4898
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
4893
|
-
const [display, setDisplay] = (0,
|
|
4894
|
-
const motion = (0,
|
|
4899
|
+
const [display, setDisplay] = (0, import_react40.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
4900
|
+
const motion = (0, import_react40.useRef)(null);
|
|
4895
4901
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4896
|
-
(0,
|
|
4902
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4897
4903
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4898
4904
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
4899
4905
|
}, [value, animated, fromPrevious, reduced]);
|
|
4900
|
-
(0,
|
|
4906
|
+
(0, import_react40.useLayoutEffect)(() => () => {
|
|
4901
4907
|
var _a;
|
|
4902
4908
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
4903
4909
|
motion.current = null;
|
|
@@ -5193,7 +5199,7 @@ function KjunSparkline({
|
|
|
5193
5199
|
stretch = false,
|
|
5194
5200
|
ariaLabel
|
|
5195
5201
|
}) {
|
|
5196
|
-
const id = "kjun-" + (0,
|
|
5202
|
+
const id = "kjun-" + (0, import_react41.useId)().replace(/:/g, ""), values = data.filter(Number.isFinite), min = Math.min(...values), max = Math.max(...values), range = max - min || 1, points = values.map(
|
|
5197
5203
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5198
5204
|
).join(" "), change = values.length > 1 ? values[values.length - 1] - values[0] : 0, line = color || `var(--_kjun-color-${change === 0 ? "text-tertiary" : semantic === "status" ? change > 0 ? "success" : "danger" : change > 0 ? "price-up" : "price-down"})`;
|
|
5199
5205
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
@@ -5241,7 +5247,7 @@ function KjunSparkline({
|
|
|
5241
5247
|
|
|
5242
5248
|
// shared/package-runtime/table.ts
|
|
5243
5249
|
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5244
|
-
var
|
|
5250
|
+
var import_react42 = require("react");
|
|
5245
5251
|
|
|
5246
5252
|
// shared/package-runtime/table-model.ts
|
|
5247
5253
|
function getValue(row, key) {
|
|
@@ -5285,11 +5291,11 @@ function useTableModel(props) {
|
|
|
5285
5291
|
expandSingle = false,
|
|
5286
5292
|
onExpandedRowsChange
|
|
5287
5293
|
} = props;
|
|
5288
|
-
const [internalSort, setSort] = (0,
|
|
5294
|
+
const [internalSort, setSort] = (0, import_react42.useState)({
|
|
5289
5295
|
key: "",
|
|
5290
5296
|
order: "asc"
|
|
5291
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5292
|
-
(0,
|
|
5297
|
+
}), [internalExpanded, setExpanded] = (0, import_react42.useState)([]), [search, setSearch] = (0, import_react42.useState)(""), timer = (0, import_react42.useRef)(void 0);
|
|
5298
|
+
(0, import_react42.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5293
5299
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5294
5300
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5295
5301
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5431,10 +5437,10 @@ function TableToolbar({
|
|
|
5431
5437
|
|
|
5432
5438
|
// packages/react/src/table-grid.tsx
|
|
5433
5439
|
var import_tokens36 = require("@kjun-ui/tokens");
|
|
5434
|
-
var
|
|
5440
|
+
var import_react44 = require("react");
|
|
5435
5441
|
|
|
5436
5442
|
// packages/react/src/table-check.tsx
|
|
5437
|
-
var
|
|
5443
|
+
var import_react43 = require("react");
|
|
5438
5444
|
|
|
5439
5445
|
// shared/package-runtime/component-icons.ts
|
|
5440
5446
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -5443,7 +5449,7 @@ var componentIcons = { minus: import_minus.default };
|
|
|
5443
5449
|
// packages/react/src/table-check.tsx
|
|
5444
5450
|
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5445
5451
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5446
|
-
var TableCheck = (0,
|
|
5452
|
+
var TableCheck = (0, import_react43.forwardRef)(
|
|
5447
5453
|
function TableCheck2(props, ref) {
|
|
5448
5454
|
const size = import_tokens35.tokens.extensions.checkbox.iconSizes.sm;
|
|
5449
5455
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-table-check", children: [
|
|
@@ -5531,7 +5537,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5531
5537
|
className: "kjun-table-empty",
|
|
5532
5538
|
children: emptyContent || emptyText
|
|
5533
5539
|
}
|
|
5534
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5540
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react44.Fragment, { children: [
|
|
5535
5541
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5536
5542
|
"tr",
|
|
5537
5543
|
{
|
|
@@ -5675,7 +5681,7 @@ function TableCards({
|
|
|
5675
5681
|
}
|
|
5676
5682
|
|
|
5677
5683
|
// packages/react/src/table-view.tsx
|
|
5678
|
-
var
|
|
5684
|
+
var import_react45 = require("react");
|
|
5679
5685
|
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5680
5686
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5681
5687
|
function KjunTable(props) {
|
|
@@ -5705,8 +5711,8 @@ function KjunTable(props) {
|
|
|
5705
5711
|
onRowClick,
|
|
5706
5712
|
onRetry
|
|
5707
5713
|
} = props;
|
|
5708
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
5709
|
-
(0,
|
|
5714
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react45.useState)(false);
|
|
5715
|
+
(0, import_react45.useEffect)(() => {
|
|
5710
5716
|
const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
|
|
5711
5717
|
const update = () => setMobile(media.matches);
|
|
5712
5718
|
update();
|
|
@@ -6072,7 +6078,7 @@ function KjunKpiRow({
|
|
|
6072
6078
|
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6073
6079
|
|
|
6074
6080
|
// shared/package-runtime/market-cards.ts
|
|
6075
|
-
var
|
|
6081
|
+
var import_react46 = require("react");
|
|
6076
6082
|
function useMarketCardsModel(props, persistence) {
|
|
6077
6083
|
const {
|
|
6078
6084
|
columns,
|
|
@@ -6088,8 +6094,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6088
6094
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6089
6095
|
isDefaultSort: c.defaultSort
|
|
6090
6096
|
}));
|
|
6091
|
-
const [key, setKey] = (0,
|
|
6092
|
-
const mounted = (0,
|
|
6097
|
+
const [key, setKey] = (0, import_react46.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6098
|
+
const mounted = (0, import_react46.useRef)("");
|
|
6093
6099
|
const save = (key2) => {
|
|
6094
6100
|
var _a;
|
|
6095
6101
|
try {
|
|
@@ -6097,7 +6103,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6097
6103
|
} catch (e) {
|
|
6098
6104
|
}
|
|
6099
6105
|
};
|
|
6100
|
-
(0,
|
|
6106
|
+
(0, import_react46.useEffect)(() => {
|
|
6101
6107
|
var _a, _b;
|
|
6102
6108
|
if (mounted.current === restoreSignature) return;
|
|
6103
6109
|
mounted.current = restoreSignature;
|
|
@@ -6433,7 +6439,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6433
6439
|
}
|
|
6434
6440
|
|
|
6435
6441
|
// packages/react/src/market-table.tsx
|
|
6436
|
-
var
|
|
6442
|
+
var import_react47 = require("react");
|
|
6437
6443
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6438
6444
|
function KjunMarketTable(props) {
|
|
6439
6445
|
const {
|
|
@@ -6454,8 +6460,8 @@ function KjunMarketTable(props) {
|
|
|
6454
6460
|
formatMetric,
|
|
6455
6461
|
renderCell
|
|
6456
6462
|
} = props;
|
|
6457
|
-
const scroller = (0,
|
|
6458
|
-
(0,
|
|
6463
|
+
const scroller = (0, import_react47.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react47.useState)(false);
|
|
6464
|
+
(0, import_react47.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6459
6465
|
const render = (row, col) => {
|
|
6460
6466
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6461
6467
|
if (cellLoading(row, col))
|
|
@@ -6652,7 +6658,7 @@ function KjunMarketTable(props) {
|
|
|
6652
6658
|
}
|
|
6653
6659
|
|
|
6654
6660
|
// packages/react/src/list.tsx
|
|
6655
|
-
var
|
|
6661
|
+
var import_react48 = require("react");
|
|
6656
6662
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6657
6663
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
6658
6664
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
@@ -6670,7 +6676,7 @@ function KjunListRow({ title, description, leading, trailing, actions, href, dis
|
|
|
6670
6676
|
] });
|
|
6671
6677
|
}
|
|
6672
6678
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
6673
|
-
const id = "kjun-" + (0,
|
|
6679
|
+
const id = "kjun-" + (0, import_react48.useId)();
|
|
6674
6680
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
6675
6681
|
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
6676
6682
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
@@ -6725,14 +6731,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
6725
6731
|
}
|
|
6726
6732
|
|
|
6727
6733
|
// packages/react/src/media.tsx
|
|
6728
|
-
var
|
|
6734
|
+
var import_react49 = require("react");
|
|
6729
6735
|
var import_tokens44 = require("@kjun-ui/tokens");
|
|
6730
6736
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6731
6737
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6732
|
-
const current = (0,
|
|
6738
|
+
const current = (0, import_react49.useRef)({ src, version: 0 });
|
|
6733
6739
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6734
6740
|
const version = current.current.version;
|
|
6735
|
-
const [result, setResult] = (0,
|
|
6741
|
+
const [result, setResult] = (0, import_react49.useState)({ version, state: "loading" });
|
|
6736
6742
|
const state = result.version === version ? result.state : "loading";
|
|
6737
6743
|
const failed = !src || state === "error";
|
|
6738
6744
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -6764,7 +6770,7 @@ function KjunChip({ label, icon, removable = false, disabled = false, size = "md
|
|
|
6764
6770
|
}
|
|
6765
6771
|
|
|
6766
6772
|
// packages/react/src/range-input.tsx
|
|
6767
|
-
var
|
|
6773
|
+
var import_react50 = require("react");
|
|
6768
6774
|
var import_react_aria_components9 = require("react-aria-components");
|
|
6769
6775
|
var import_tokens46 = require("@kjun-ui/tokens");
|
|
6770
6776
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
@@ -6773,10 +6779,10 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
6773
6779
|
const domain = (0, import_tokens46.createSliderDomain)(min, max, step);
|
|
6774
6780
|
const list = Array.isArray(value) ? value : [value];
|
|
6775
6781
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
6776
|
-
const latest = (0,
|
|
6782
|
+
const latest = (0, import_react50.useRef)(value);
|
|
6777
6783
|
latest.current = value;
|
|
6778
|
-
const active = (0,
|
|
6779
|
-
(0,
|
|
6784
|
+
const active = (0, import_react50.useRef)(false);
|
|
6785
|
+
(0, import_react50.useEffect)(() => {
|
|
6780
6786
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6781
6787
|
}, [valid]);
|
|
6782
6788
|
const change = (next) => {
|
|
@@ -6813,7 +6819,7 @@ function KjunRangeSlider(props) {
|
|
|
6813
6819
|
}
|
|
6814
6820
|
|
|
6815
6821
|
// packages/react/src/quantity-stepper.tsx
|
|
6816
|
-
var
|
|
6822
|
+
var import_react51 = require("react");
|
|
6817
6823
|
var import_tokens47 = require("@kjun-ui/tokens");
|
|
6818
6824
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6819
6825
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
@@ -6821,15 +6827,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6821
6827
|
const buttonStyle = { width: import_tokens47.tokens.input[size].height, padding: 0 };
|
|
6822
6828
|
const domain = (0, import_tokens47.createNumberDomain)({ min, max, step, precision });
|
|
6823
6829
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
6824
|
-
const [draft, setDraft] = (0,
|
|
6830
|
+
const [draft, setDraft] = (0, import_react51.useState)(String(value));
|
|
6825
6831
|
const field = useKjunField();
|
|
6826
|
-
const composing = (0,
|
|
6827
|
-
(0,
|
|
6832
|
+
const composing = (0, import_react51.useRef)(false), dirty = (0, import_react51.useRef)(false), accepted = (0, import_react51.useRef)(value);
|
|
6833
|
+
(0, import_react51.useEffect)(() => {
|
|
6828
6834
|
setDraft(String(value));
|
|
6829
6835
|
accepted.current = value;
|
|
6830
6836
|
dirty.current = false;
|
|
6831
6837
|
}, [value, precision, min, max, step]);
|
|
6832
|
-
(0,
|
|
6838
|
+
(0, import_react51.useEffect)(() => {
|
|
6833
6839
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6834
6840
|
}, [valid]);
|
|
6835
6841
|
const emit = (next) => {
|
|
@@ -6904,16 +6910,16 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6904
6910
|
}
|
|
6905
6911
|
|
|
6906
6912
|
// packages/react/src/time-picker.tsx
|
|
6907
|
-
var
|
|
6913
|
+
var import_react52 = require("react");
|
|
6908
6914
|
var import_tokens48 = require("@kjun-ui/tokens");
|
|
6909
6915
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6910
6916
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel = "\uC2DC\uAC04", onValueChange, onChangeCommit }) {
|
|
6911
|
-
const root = (0,
|
|
6912
|
-
const field = useKjunField(), uid = (0,
|
|
6917
|
+
const root = (0, import_react52.useRef)(null);
|
|
6918
|
+
const field = useKjunField(), uid = (0, import_react52.useId)();
|
|
6913
6919
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
6914
|
-
const domain = (0,
|
|
6920
|
+
const domain = (0, import_react52.useMemo)(() => (0, import_tokens48.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
6915
6921
|
const valid = domain.valid && domain.accepts(value);
|
|
6916
|
-
(0,
|
|
6922
|
+
(0, import_react52.useEffect)(() => {
|
|
6917
6923
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6918
6924
|
}, [valid]);
|
|
6919
6925
|
const change = (next) => {
|
|
@@ -6927,7 +6933,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
6927
6933
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "kjun-time-segments", children: ["\uC2DC", "\uBD84", "\uCD08"].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
6928
6934
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
6929
6935
|
const labelId = `${fieldId}-segment-${index}`;
|
|
6930
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react52.Fragment, { children: [
|
|
6931
6937
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
6932
6938
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "kjun-time-segment", children: [
|
|
6933
6939
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|
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),
|
|
@@ -4618,7 +4607,20 @@ var KjunErrorBoundary = class extends Component {
|
|
|
4618
4607
|
|
|
4619
4608
|
// packages/react/src/skeletons.tsx
|
|
4620
4609
|
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
4621
|
-
|
|
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
|
+
}
|
|
4621
|
+
function chartSkeletonKind(kind) {
|
|
4622
|
+
return kind === "donut" || kind === "matrix" ? kind : "frame";
|
|
4623
|
+
}
|
|
4622
4624
|
|
|
4623
4625
|
// packages/react/src/market-skeleton.tsx
|
|
4624
4626
|
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
@@ -4680,7 +4682,7 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
4680
4682
|
}
|
|
4681
4683
|
|
|
4682
4684
|
// packages/react/src/skeletons.tsx
|
|
4683
|
-
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4685
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4684
4686
|
function KjunListSkeleton({
|
|
4685
4687
|
rows = 8,
|
|
4686
4688
|
variant = "market",
|
|
@@ -4737,67 +4739,71 @@ function KjunFormSkeleton({
|
|
|
4737
4739
|
);
|
|
4738
4740
|
}
|
|
4739
4741
|
function KjunChartSkeleton({
|
|
4742
|
+
kind: requestedKind = "frame",
|
|
4743
|
+
height = tokens25.extensions.chartSkeleton.height,
|
|
4740
4744
|
loadingText = "\uCC28\uD2B8\uB97C \uBD88\uB7EC\uC624\uB294 \uC911",
|
|
4741
|
-
|
|
4742
|
-
|
|
4745
|
+
skeleton = true,
|
|
4746
|
+
loadingDelay = 0,
|
|
4747
|
+
rows = 8,
|
|
4748
|
+
columns = 14
|
|
4743
4749
|
}) {
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
x: 24 + col * 40,
|
|
4767
|
-
y: 12 + row * 26,
|
|
4768
|
-
width: 36,
|
|
4769
|
-
height: 22,
|
|
4770
|
-
rx: 2,
|
|
4771
|
-
fill: "var(--_kjun-color-skeleton)",
|
|
4772
|
-
opacity: (row + col + 2) % 3 === 0 ? 0.55 : 1
|
|
4750
|
+
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
4751
|
+
return /* @__PURE__ */ jsx27(
|
|
4752
|
+
"div",
|
|
4753
|
+
{
|
|
4754
|
+
className: "kjun-chart-skeleton",
|
|
4755
|
+
"data-kjun-chart-kind": kind,
|
|
4756
|
+
"data-skeleton": skeleton ? void 0 : "false",
|
|
4757
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4758
|
+
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
4759
|
+
children: !skeleton ? /* @__PURE__ */ jsxs21("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
4760
|
+
/* @__PURE__ */ jsx27("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx27(KjunSpinner, { size: "md" }) }),
|
|
4761
|
+
loadingText && /* @__PURE__ */ jsx27("p", { children: loadingText })
|
|
4762
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
4763
|
+
kind === "donut" ? /* @__PURE__ */ jsx27("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ jsx27(
|
|
4764
|
+
"div",
|
|
4765
|
+
{
|
|
4766
|
+
className: "kjun-chart-skeleton-matrix",
|
|
4767
|
+
"data-kjun-chart-part": "matrix",
|
|
4768
|
+
"aria-hidden": "true",
|
|
4769
|
+
style: {
|
|
4770
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
4771
|
+
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
4773
4772
|
},
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4773
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ jsx27(
|
|
4774
|
+
"div",
|
|
4775
|
+
{
|
|
4776
|
+
className: "kjun-chart-skeleton-cell",
|
|
4777
|
+
"data-kjun-chart-part": "cell",
|
|
4778
|
+
"data-muted": chartMatrixMuted(Math.floor(i / columnCount), i % columnCount) ? "" : void 0
|
|
4779
|
+
},
|
|
4780
|
+
i
|
|
4781
|
+
))
|
|
4782
|
+
}
|
|
4783
|
+
) : /* @__PURE__ */ jsx27(
|
|
4784
|
+
"svg",
|
|
4785
|
+
{
|
|
4786
|
+
viewBox: chartFrameViewBox,
|
|
4787
|
+
preserveAspectRatio: "none",
|
|
4788
|
+
className: "kjun-chart-skeleton-plot",
|
|
4789
|
+
"data-kjun-chart-part": "plot",
|
|
4790
|
+
"aria-hidden": "true",
|
|
4791
|
+
children: /* @__PURE__ */ jsx27(
|
|
4777
4792
|
"path",
|
|
4778
4793
|
{
|
|
4779
|
-
d:
|
|
4794
|
+
d: chartFramePath,
|
|
4780
4795
|
fill: "none",
|
|
4781
|
-
stroke: "var(--_kjun-color-
|
|
4782
|
-
strokeWidth:
|
|
4783
|
-
|
|
4784
|
-
),
|
|
4785
|
-
/* @__PURE__ */ jsx27(
|
|
4786
|
-
"rect",
|
|
4787
|
-
{
|
|
4788
|
-
x: 35 + i * 75,
|
|
4789
|
-
y: kind === "candle" ? 210 - h : 220 - h,
|
|
4790
|
-
width: kind === "candle" ? 28 : 42,
|
|
4791
|
-
height: kind === "candle" ? h / 2 : h,
|
|
4792
|
-
rx: 3,
|
|
4793
|
-
fill: "var(--_kjun-color-skeleton)"
|
|
4796
|
+
stroke: "var(--_kjun-color-chart-grid)",
|
|
4797
|
+
strokeWidth: tokens25.border.defaultWidth,
|
|
4798
|
+
vectorEffect: "non-scaling-stroke"
|
|
4794
4799
|
}
|
|
4795
4800
|
)
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
+
}
|
|
4802
|
+
),
|
|
4803
|
+
loadingText && /* @__PURE__ */ jsx27("div", { className: "kjun-chart-skeleton-status", "data-kjun-chart-part": "status", role: status, children: /* @__PURE__ */ jsx27("span", { children: loadingText }) })
|
|
4804
|
+
] })
|
|
4805
|
+
}
|
|
4806
|
+
);
|
|
4801
4807
|
}
|
|
4802
4808
|
|
|
4803
4809
|
// packages/react/src/financial-display.tsx
|
package/dist/styles.css
CHANGED
|
@@ -482,9 +482,6 @@
|
|
|
482
482
|
--_kjun-extension-skeleton-avatar-size: 48px;
|
|
483
483
|
--_kjun-extension-skeleton-card-avatar-size: 40px;
|
|
484
484
|
--_kjun-extension-skeleton-table-line-height: 14px;
|
|
485
|
-
--_kjun-extension-skeleton-chart-height: 200px;
|
|
486
|
-
--_kjun-extension-skeleton-chart-bar-max-width: 40px;
|
|
487
|
-
--_kjun-extension-skeleton-chart-axis-height: 2px;
|
|
488
485
|
--_kjun-extension-skeleton-stat-width: 80px;
|
|
489
486
|
--_kjun-extension-skeleton-stat-height: 40px;
|
|
490
487
|
--_kjun-extension-skeleton-block-height: 100px;
|
|
@@ -678,8 +675,6 @@
|
|
|
678
675
|
--_kjun-extension-market-list-change-skeleton-height: 14px;
|
|
679
676
|
--_kjun-extension-chart-skeleton-height: 240px;
|
|
680
677
|
--_kjun-extension-chart-skeleton-donut-thickness: 22px;
|
|
681
|
-
--_kjun-extension-chart-skeleton-donut-label-width: 76px;
|
|
682
|
-
--_kjun-extension-chart-skeleton-donut-label-height: 14px;
|
|
683
678
|
--_kjun-state-opacity-disabled: 0.5;
|
|
684
679
|
--_kjun-state-opacity-disabled-strong: 0.4;
|
|
685
680
|
--_kjun-state-opacity-pressed: 0.8;
|
|
@@ -1950,37 +1945,6 @@
|
|
|
1950
1945
|
height: var(--_kjun-extension-skeleton-table-line-height);
|
|
1951
1946
|
}
|
|
1952
1947
|
|
|
1953
|
-
/* Chart */
|
|
1954
|
-
.kjun-skeleton-chart {
|
|
1955
|
-
display: flex;
|
|
1956
|
-
flex-direction: column;
|
|
1957
|
-
padding: var(--_kjun-extension-skeleton-padding);
|
|
1958
|
-
border: var(--_kjun-border-default-width) solid var(--_kjun-border-primary);
|
|
1959
|
-
border-radius: var(--_kjun-extension-skeleton-radius);
|
|
1960
|
-
background: var(--_kjun-bg-primary);
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
.kjun-skeleton-chart-bars {
|
|
1964
|
-
flex: 1;
|
|
1965
|
-
display: flex;
|
|
1966
|
-
align-items: flex-end;
|
|
1967
|
-
justify-content: space-around;
|
|
1968
|
-
gap: var(--_kjun-extension-skeleton-gap);
|
|
1969
|
-
/* Bars stand on the axis line, like ChartSkeleton. */
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
.kjun-skeleton-chart-bar {
|
|
1973
|
-
flex: 1;
|
|
1974
|
-
max-width: var(--_kjun-extension-skeleton-chart-bar-max-width);
|
|
1975
|
-
background: var(--_kjun-skeleton);
|
|
1976
|
-
border-radius: var(--_kjun-extension-skeleton-line-radius) var(--_kjun-geometry-radius-radius4) 0 0;
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
.kjun-skeleton-chart-axis {
|
|
1980
|
-
height: var(--_kjun-extension-skeleton-chart-axis-height);
|
|
1981
|
-
background: var(--_kjun-border-primary);
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
1948
|
/* Stat Card */
|
|
1985
1949
|
.kjun-skeleton-stat {
|
|
1986
1950
|
display: flex;
|
|
@@ -2021,7 +1985,6 @@
|
|
|
2021
1985
|
/* Animation */
|
|
2022
1986
|
.kjun-skeleton-animated .kjun-skeleton-line,
|
|
2023
1987
|
.kjun-skeleton-animated .kjun-skeleton-avatar,
|
|
2024
|
-
.kjun-skeleton-animated .kjun-skeleton-chart-bar,
|
|
2025
1988
|
.kjun-skeleton-animated .kjun-skeleton-sparkline,
|
|
2026
1989
|
.kjun-skeleton-animated .kjun-skeleton-block {
|
|
2027
1990
|
background: linear-gradient(
|
|
@@ -3116,7 +3079,7 @@
|
|
|
3116
3079
|
}
|
|
3117
3080
|
}
|
|
3118
3081
|
.kjun-chart-skeleton {
|
|
3119
|
-
position:relative;
|
|
3082
|
+
position: relative;
|
|
3120
3083
|
display: flex;
|
|
3121
3084
|
align-items: center;
|
|
3122
3085
|
justify-content: center;
|
|
@@ -3124,18 +3087,38 @@
|
|
|
3124
3087
|
min-width: 0;
|
|
3125
3088
|
animation: kjun-chart-pulse var(--_kjun-motion-shimmer) ease-in-out infinite;
|
|
3126
3089
|
}
|
|
3090
|
+
.kjun-chart-skeleton[data-kjun-chart-kind="donut"] {
|
|
3091
|
+
/* Only the donut label measures the hole against this box's height; size containment elsewhere would
|
|
3092
|
+
drop the frame's intrinsic width inside shrink-to-fit parents. */
|
|
3093
|
+
container-type: size;
|
|
3094
|
+
}
|
|
3095
|
+
.kjun-chart-skeleton[data-skeleton="false"] {
|
|
3096
|
+
animation: none;
|
|
3097
|
+
}
|
|
3127
3098
|
.kjun-chart-skeleton-plot {
|
|
3128
3099
|
width: 100%;
|
|
3129
3100
|
height: 100%;
|
|
3130
3101
|
}
|
|
3131
3102
|
.kjun-chart-skeleton-donut {
|
|
3103
|
+
/* The hole is 80% − 2 × thickness only in border-box, whatever the app's reset. */
|
|
3104
|
+
box-sizing: border-box;
|
|
3132
3105
|
height: 80%;
|
|
3133
3106
|
aspect-ratio: 1;
|
|
3134
3107
|
border: var(--_kjun-extension-chart-skeleton-donut-thickness) solid var(--_kjun-color-skeleton);
|
|
3135
3108
|
border-radius: 50%;
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3109
|
+
}
|
|
3110
|
+
.kjun-chart-skeleton-matrix {
|
|
3111
|
+
display: grid;
|
|
3112
|
+
width: 100%;
|
|
3113
|
+
height: 100%;
|
|
3114
|
+
gap: var(--_kjun-geometry-dimension-value4);
|
|
3115
|
+
}
|
|
3116
|
+
.kjun-chart-skeleton-cell {
|
|
3117
|
+
background: var(--_kjun-color-skeleton);
|
|
3118
|
+
border-radius: var(--_kjun-extension-skeleton-line-radius);
|
|
3119
|
+
}
|
|
3120
|
+
.kjun-chart-skeleton-cell[data-muted] {
|
|
3121
|
+
opacity: var(--_kjun-state-opacity-pending);
|
|
3139
3122
|
}
|
|
3140
3123
|
@keyframes kjun-chart-pulse {
|
|
3141
3124
|
50% {
|
|
@@ -3153,7 +3136,8 @@
|
|
|
3153
3136
|
.kjun-error-fallback p { margin:var(--_kjun-geometry-dimension-value8) 0 var(--_kjun-geometry-dimension-value16); font-size:var(--_kjun-extension-state-description-size); line-height:var(--_kjun-type-caption-line); color:var(--_kjun-color-text-secondary); font-weight:var(--_kjun-type-caption-weight);letter-spacing:var(--_kjun-type-caption-tracking);}
|
|
3154
3137
|
|
|
3155
3138
|
.kjun-chart-skeleton-status { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--_kjun-extension-skeleton-gap); pointer-events:none; }
|
|
3156
|
-
.kjun-chart-skeleton-status>span { max-width:90%; padding:var(--_kjun-geometry-dimension-value4) var(--_kjun-geometry-dimension-value12); border-radius:var(--_kjun-geometry-radius-radius6); font-size:var(--_kjun-type-body-size); text-align:center; overflow-wrap:anywhere; background:var(--_kjun-color-surface); color:var(--_kjun-color-text-secondary); line-height: var(--_kjun-type-body-line); font-weight: var(--_kjun-type-body-weight); letter-spacing: var(--_kjun-type-body-tracking); }
|
|
3139
|
+
.kjun-chart-skeleton-status>span { max-width:90%; padding:var(--_kjun-geometry-dimension-value4) var(--_kjun-geometry-dimension-value12); border-radius:var(--_kjun-geometry-radius-radius6); font-size:var(--_kjun-type-body-size); text-align:center; overflow-wrap:anywhere; background:var(--_kjun-color-surface); color:var(--_kjun-color-text-secondary); line-height: var(--_kjun-type-body-line); font-weight: var(--_kjun-type-body-weight); letter-spacing: var(--_kjun-type-body-tracking); border:var(--_kjun-border-default-width) solid var(--_kjun-color-chart-grid); }
|
|
3140
|
+
.kjun-chart-skeleton[data-kjun-chart-kind="donut"] .kjun-chart-skeleton-status>span { box-sizing:border-box; border:0; max-width:calc(80cqh - 2 * var(--_kjun-extension-chart-skeleton-donut-thickness)); }
|
|
3157
3141
|
|
|
3158
3142
|
.kjun-data-status > .kjun-spinner { flex-shrink: 0; }
|
|
3159
3143
|
.kjun-data-status > span:last-child { min-width: 0; overflow-wrap: anywhere; }
|
|
@@ -44,7 +44,7 @@ export interface KjunProgressProps {
|
|
|
44
44
|
}
|
|
45
45
|
export declare function KjunProgress({ value, max, size, variant, showLabel, label, subLabel, }: KjunProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export interface KjunSkeletonProps {
|
|
47
|
-
type?: "text" | "avatar" | "card" | "table" | "
|
|
47
|
+
type?: "text" | "avatar" | "card" | "table" | "stat" | "block";
|
|
48
48
|
rows?: number;
|
|
49
49
|
columns?: number;
|
|
50
50
|
height?: CSSProperties["height"];
|
|
@@ -44,7 +44,7 @@ export interface KjunProgressProps {
|
|
|
44
44
|
}
|
|
45
45
|
export declare function KjunProgress({ value, max, size, variant, showLabel, label, subLabel, }: KjunProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export interface KjunSkeletonProps {
|
|
47
|
-
type?: "text" | "avatar" | "card" | "table" | "
|
|
47
|
+
type?: "text" | "avatar" | "card" | "table" | "stat" | "block";
|
|
48
48
|
rows?: number;
|
|
49
49
|
columns?: number;
|
|
50
50
|
height?: CSSProperties["height"];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type InputSize } from "@kjun-ui/tokens";
|
|
2
2
|
import { type CSSProperties } from "react";
|
|
3
|
+
import { type KjunChartSkeletonKind } from "../../../shared/package-runtime/chart-skeleton.cjs";
|
|
3
4
|
export interface KjunListSkeletonProps {
|
|
4
5
|
rows?: number;
|
|
5
6
|
variant?: "market" | "compact" | "notification";
|
|
@@ -19,10 +20,14 @@ export interface KjunFormSkeletonProps {
|
|
|
19
20
|
}
|
|
20
21
|
export declare function KjunFormSkeleton({ fields, columns, multiline, size, }: KjunFormSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export interface KjunChartSkeletonProps {
|
|
22
|
-
|
|
23
|
-
kind?: "grid" | "line" | "bar" | "donut" | "candle" | "matrix";
|
|
23
|
+
kind?: KjunChartSkeletonKind;
|
|
24
24
|
height?: CSSProperties["height"];
|
|
25
|
+
loadingText?: string;
|
|
26
|
+
skeleton?: boolean;
|
|
27
|
+
loadingDelay?: number;
|
|
28
|
+
rows?: number;
|
|
29
|
+
columns?: number;
|
|
25
30
|
}
|
|
26
|
-
export declare function KjunChartSkeleton({ loadingText,
|
|
31
|
+
export declare function KjunChartSkeleton({ kind: requestedKind, height, loadingText, skeleton, loadingDelay, rows, columns, }: KjunChartSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
27
32
|
export { KjunMarketTableSkeleton } from "./market-skeleton.cjs";
|
|
28
33
|
export type { KjunMarketTableSkeletonProps } from "./market-skeleton.cjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type InputSize } from "@kjun-ui/tokens";
|
|
2
2
|
import { type CSSProperties } from "react";
|
|
3
|
+
import { type KjunChartSkeletonKind } from "../../../shared/package-runtime/chart-skeleton.js";
|
|
3
4
|
export interface KjunListSkeletonProps {
|
|
4
5
|
rows?: number;
|
|
5
6
|
variant?: "market" | "compact" | "notification";
|
|
@@ -19,10 +20,14 @@ export interface KjunFormSkeletonProps {
|
|
|
19
20
|
}
|
|
20
21
|
export declare function KjunFormSkeleton({ fields, columns, multiline, size, }: KjunFormSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export interface KjunChartSkeletonProps {
|
|
22
|
-
|
|
23
|
-
kind?: "grid" | "line" | "bar" | "donut" | "candle" | "matrix";
|
|
23
|
+
kind?: KjunChartSkeletonKind;
|
|
24
24
|
height?: CSSProperties["height"];
|
|
25
|
+
loadingText?: string;
|
|
26
|
+
skeleton?: boolean;
|
|
27
|
+
loadingDelay?: number;
|
|
28
|
+
rows?: number;
|
|
29
|
+
columns?: number;
|
|
25
30
|
}
|
|
26
|
-
export declare function KjunChartSkeleton({ loadingText,
|
|
31
|
+
export declare function KjunChartSkeleton({ kind: requestedKind, height, loadingText, skeleton, loadingDelay, rows, columns, }: KjunChartSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
27
32
|
export { KjunMarketTableSkeleton } from "./market-skeleton.js";
|
|
28
33
|
export type { KjunMarketTableSkeletonProps } from "./market-skeleton.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type KjunChartSkeletonKind = "frame" | "donut" | "matrix";
|
|
2
|
+
/** Axes plus three horizontal grid lines in the frame's 600×240 viewBox. */
|
|
3
|
+
export declare const chartFrameViewBox = "0 0 600 240";
|
|
4
|
+
export declare const chartFramePath = "M20 10V220H590 M20 65H590 M20 120H590 M20 175H590";
|
|
5
|
+
/** Upper bound for matrix rows and columns, so counts derived from data never render an unbounded grid. */
|
|
6
|
+
export declare const chartSkeletonMaxCount = 100;
|
|
7
|
+
/** Matrix rows and columns: finite values floor into 1–100; anything else is 1. */
|
|
8
|
+
export declare function chartSkeletonCount(value: number): number;
|
|
9
|
+
/** Every third diagonal cell is drawn at the pending opacity so the matrix reads as a heatmap. */
|
|
10
|
+
export declare function chartMatrixMuted(row: number, column: number): boolean;
|
|
11
|
+
/** Donut ring diameter as a share of the skeleton height; data-state.css repeats it as 80% and 80cqh. */
|
|
12
|
+
export declare const chartDonutRatio = 0.8;
|
|
13
|
+
/** Inner diameter of the donut ring. */
|
|
14
|
+
export declare function chartDonutHole(height: number, thickness: number): number;
|
|
15
|
+
/** Kinds removed in 0.8.0 (line, bar, candle, grid) or any other value draw, and are named, frame. */
|
|
16
|
+
export declare function chartSkeletonKind(kind: unknown): KjunChartSkeletonKind;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type KjunChartSkeletonKind = "frame" | "donut" | "matrix";
|
|
2
|
+
/** Axes plus three horizontal grid lines in the frame's 600×240 viewBox. */
|
|
3
|
+
export declare const chartFrameViewBox = "0 0 600 240";
|
|
4
|
+
export declare const chartFramePath = "M20 10V220H590 M20 65H590 M20 120H590 M20 175H590";
|
|
5
|
+
/** Upper bound for matrix rows and columns, so counts derived from data never render an unbounded grid. */
|
|
6
|
+
export declare const chartSkeletonMaxCount = 100;
|
|
7
|
+
/** Matrix rows and columns: finite values floor into 1–100; anything else is 1. */
|
|
8
|
+
export declare function chartSkeletonCount(value: number): number;
|
|
9
|
+
/** Every third diagonal cell is drawn at the pending opacity so the matrix reads as a heatmap. */
|
|
10
|
+
export declare function chartMatrixMuted(row: number, column: number): boolean;
|
|
11
|
+
/** Donut ring diameter as a share of the skeleton height; data-state.css repeats it as 80% and 80cqh. */
|
|
12
|
+
export declare const chartDonutRatio = 0.8;
|
|
13
|
+
/** Inner diameter of the donut ring. */
|
|
14
|
+
export declare function chartDonutHole(height: number, thickness: number): number;
|
|
15
|
+
/** Kinds removed in 0.8.0 (line, bar, candle, grid) or any other value draw, and are named, frame. */
|
|
16
|
+
export declare function chartSkeletonKind(kind: unknown): KjunChartSkeletonKind;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kjun-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://ui.kjun.dev",
|
|
6
6
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@kjun-ui/tokens": "0.
|
|
44
|
+
"@kjun-ui/tokens": "0.8.1",
|
|
45
45
|
"react-aria-components": "1.21.1",
|
|
46
|
-
"@kjun-ui/icons": "0.
|
|
46
|
+
"@kjun-ui/icons": "0.8.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^19.2.3",
|