@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.cjs
CHANGED
|
@@ -4329,7 +4329,8 @@ function KjunIconToggle({
|
|
|
4329
4329
|
filled: active,
|
|
4330
4330
|
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens25.tokens.button.iconSizes[size],
|
|
4331
4331
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4332
|
-
className: active ? activeColorClass : inactiveColorClass
|
|
4332
|
+
className: active ? activeColorClass : inactiveColorClass,
|
|
4333
|
+
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
4333
4334
|
}
|
|
4334
4335
|
)
|
|
4335
4336
|
}
|
|
@@ -4530,11 +4531,26 @@ function KjunScrollFade({ children }) {
|
|
|
4530
4531
|
|
|
4531
4532
|
// packages/react/src/data-state.tsx
|
|
4532
4533
|
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4534
|
+
var import_react39 = require("react");
|
|
4535
|
+
|
|
4536
|
+
// shared/package-runtime/use-loading-reveal.ts
|
|
4533
4537
|
var import_react38 = require("react");
|
|
4538
|
+
function useLoadingReveal(active, delay = 0) {
|
|
4539
|
+
const [revealed, setRevealed] = (0, import_react38.useState)(false);
|
|
4540
|
+
(0, import_react38.useEffect)(() => {
|
|
4541
|
+
setRevealed(false);
|
|
4542
|
+
if (!active || delay <= 0) return;
|
|
4543
|
+
const timer = setTimeout(() => setRevealed(true), delay);
|
|
4544
|
+
return () => clearTimeout(timer);
|
|
4545
|
+
}, [active, delay]);
|
|
4546
|
+
return delay <= 0 || revealed;
|
|
4547
|
+
}
|
|
4548
|
+
|
|
4549
|
+
// packages/react/src/data-state.tsx
|
|
4534
4550
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4535
4551
|
function useQueryDisplay(props) {
|
|
4536
4552
|
var _a;
|
|
4537
|
-
const [state, setState] = (0,
|
|
4553
|
+
const [state, setState] = (0, import_react39.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
|
|
4538
4554
|
let next = state;
|
|
4539
4555
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4540
4556
|
next = (0, import_tokens26.advanceQueryDisplay)(state, props);
|
|
@@ -4553,6 +4569,7 @@ function KjunDataState({
|
|
|
4553
4569
|
emptyIcon,
|
|
4554
4570
|
emptyActionText,
|
|
4555
4571
|
loadingText = "\uB85C\uB529 \uC911...",
|
|
4572
|
+
loadingDelay = 0,
|
|
4556
4573
|
retryText = "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
4557
4574
|
size = "md",
|
|
4558
4575
|
skeleton = false,
|
|
@@ -4566,7 +4583,7 @@ function KjunDataState({
|
|
|
4566
4583
|
onEmptyAction,
|
|
4567
4584
|
...query2
|
|
4568
4585
|
}) {
|
|
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];
|
|
4586
|
+
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
4587
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4571
4588
|
/* @__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
4589
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSpinner, { size: "xs" }),
|
|
@@ -4575,9 +4592,10 @@ function KjunDataState({
|
|
|
4575
4592
|
state.initialLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4576
4593
|
"div",
|
|
4577
4594
|
{
|
|
4578
|
-
role: "status",
|
|
4579
|
-
"aria-label": loadingText,
|
|
4580
|
-
|
|
4595
|
+
role: revealed ? "status" : void 0,
|
|
4596
|
+
"aria-label": revealed ? loadingText : void 0,
|
|
4597
|
+
"aria-hidden": revealed ? void 0 : true,
|
|
4598
|
+
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4581
4599
|
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
4600
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSpinner, { size: "md" }),
|
|
4583
4601
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: loadingText })
|
|
@@ -4603,7 +4621,7 @@ function KjunDataState({
|
|
|
4603
4621
|
] }) })
|
|
4604
4622
|
] });
|
|
4605
4623
|
}
|
|
4606
|
-
var KjunErrorBoundary = class extends
|
|
4624
|
+
var KjunErrorBoundary = class extends import_react39.Component {
|
|
4607
4625
|
constructor() {
|
|
4608
4626
|
super(...arguments);
|
|
4609
4627
|
this.state = { error: false };
|
|
@@ -4636,7 +4654,7 @@ var KjunErrorBoundary = class extends import_react38.Component {
|
|
|
4636
4654
|
|
|
4637
4655
|
// packages/react/src/skeletons.tsx
|
|
4638
4656
|
var import_tokens29 = require("@kjun-ui/tokens");
|
|
4639
|
-
var
|
|
4657
|
+
var import_react40 = require("react");
|
|
4640
4658
|
|
|
4641
4659
|
// packages/react/src/market-skeleton.tsx
|
|
4642
4660
|
var import_tokens28 = require("@kjun-ui/tokens");
|
|
@@ -4790,7 +4808,7 @@ function KjunChartSkeleton({
|
|
|
4790
4808
|
opacity: (row + col + 2) % 3 === 0 ? 0.55 : 1
|
|
4791
4809
|
},
|
|
4792
4810
|
col
|
|
4793
|
-
)) }, row)) : (kind === "bar" || kind === "candle") && [60, 100, 85, 140, 110, 165, 180].map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4811
|
+
)) }, row)) : (kind === "bar" || kind === "candle") && [60, 100, 85, 140, 110, 165, 180].map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react40.Fragment, { children: [
|
|
4794
4812
|
kind === "candle" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4795
4813
|
"path",
|
|
4796
4814
|
{
|
|
@@ -4820,13 +4838,13 @@ function KjunChartSkeleton({
|
|
|
4820
4838
|
|
|
4821
4839
|
// packages/react/src/financial-display.tsx
|
|
4822
4840
|
var import_tokens32 = require("@kjun-ui/tokens");
|
|
4823
|
-
var
|
|
4841
|
+
var import_react42 = require("react");
|
|
4824
4842
|
|
|
4825
4843
|
// packages/react/src/number-display.tsx
|
|
4826
4844
|
var import_tokens31 = require("@kjun-ui/tokens");
|
|
4827
4845
|
|
|
4828
4846
|
// shared/package-runtime/use-number-motion.ts
|
|
4829
|
-
var
|
|
4847
|
+
var import_react41 = require("react");
|
|
4830
4848
|
|
|
4831
4849
|
// shared/package-runtime/number-motion.ts
|
|
4832
4850
|
var import_tokens30 = require("@kjun-ui/tokens");
|
|
@@ -4872,14 +4890,14 @@ function createNumberMotion(apply) {
|
|
|
4872
4890
|
|
|
4873
4891
|
// shared/package-runtime/use-number-motion.ts
|
|
4874
4892
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
4875
|
-
const [display, setDisplay] = (0,
|
|
4876
|
-
const motion = (0,
|
|
4893
|
+
const [display, setDisplay] = (0, import_react41.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
4894
|
+
const motion = (0, import_react41.useRef)(null);
|
|
4877
4895
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4878
|
-
(0,
|
|
4896
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
4879
4897
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
4880
4898
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
4881
4899
|
}, [value, animated, fromPrevious, reduced]);
|
|
4882
|
-
(0,
|
|
4900
|
+
(0, import_react41.useLayoutEffect)(() => () => {
|
|
4883
4901
|
var _a;
|
|
4884
4902
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
4885
4903
|
motion.current = null;
|
|
@@ -5016,6 +5034,7 @@ function KjunSignedValue({
|
|
|
5016
5034
|
|
|
5017
5035
|
// packages/react/src/financial-display.tsx
|
|
5018
5036
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5037
|
+
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
5038
|
function KjunDeviation({
|
|
5020
5039
|
value,
|
|
5021
5040
|
variant = "pill",
|
|
@@ -5026,7 +5045,7 @@ function KjunDeviation({
|
|
|
5026
5045
|
const n = finiteNumber(value);
|
|
5027
5046
|
if (n === null)
|
|
5028
5047
|
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 =
|
|
5048
|
+
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
5049
|
if (variant === "badge")
|
|
5031
5050
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5032
5051
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -5059,7 +5078,7 @@ function KjunDeviation({
|
|
|
5059
5078
|
className: "kjun-deviation",
|
|
5060
5079
|
ref: domainColorRef(!neutral),
|
|
5061
5080
|
"data-variant": variant,
|
|
5062
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight:
|
|
5081
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
|
|
5063
5082
|
children: [
|
|
5064
5083
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5065
5084
|
"span",
|
|
@@ -5068,7 +5087,7 @@ function KjunDeviation({
|
|
|
5068
5087
|
className: "kjun-heat-layer",
|
|
5069
5088
|
style: {
|
|
5070
5089
|
background: neutral ? "var(--_kjun-color-secondary)" : `var(--_kjun-color-${role2})`,
|
|
5071
|
-
opacity:
|
|
5090
|
+
opacity: deviationFill[level]
|
|
5072
5091
|
}
|
|
5073
5092
|
}
|
|
5074
5093
|
),
|
|
@@ -5174,7 +5193,7 @@ function KjunSparkline({
|
|
|
5174
5193
|
stretch = false,
|
|
5175
5194
|
ariaLabel
|
|
5176
5195
|
}) {
|
|
5177
|
-
const id = "kjun-" + (0,
|
|
5196
|
+
const id = "kjun-" + (0, import_react42.useId)().replace(/:/g, ""), values = data.filter(Number.isFinite), min = Math.min(...values), max = Math.max(...values), range = max - min || 1, points = values.map(
|
|
5178
5197
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5179
5198
|
).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"})`;
|
|
5180
5199
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
@@ -5222,7 +5241,7 @@ function KjunSparkline({
|
|
|
5222
5241
|
|
|
5223
5242
|
// shared/package-runtime/table.ts
|
|
5224
5243
|
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5225
|
-
var
|
|
5244
|
+
var import_react43 = require("react");
|
|
5226
5245
|
|
|
5227
5246
|
// shared/package-runtime/table-model.ts
|
|
5228
5247
|
function getValue(row, key) {
|
|
@@ -5266,11 +5285,11 @@ function useTableModel(props) {
|
|
|
5266
5285
|
expandSingle = false,
|
|
5267
5286
|
onExpandedRowsChange
|
|
5268
5287
|
} = props;
|
|
5269
|
-
const [internalSort, setSort] = (0,
|
|
5288
|
+
const [internalSort, setSort] = (0, import_react43.useState)({
|
|
5270
5289
|
key: "",
|
|
5271
5290
|
order: "asc"
|
|
5272
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5273
|
-
(0,
|
|
5291
|
+
}), [internalExpanded, setExpanded] = (0, import_react43.useState)([]), [search, setSearch] = (0, import_react43.useState)(""), timer = (0, import_react43.useRef)(void 0);
|
|
5292
|
+
(0, import_react43.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5274
5293
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5275
5294
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5276
5295
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5412,10 +5431,10 @@ function TableToolbar({
|
|
|
5412
5431
|
|
|
5413
5432
|
// packages/react/src/table-grid.tsx
|
|
5414
5433
|
var import_tokens36 = require("@kjun-ui/tokens");
|
|
5415
|
-
var
|
|
5434
|
+
var import_react45 = require("react");
|
|
5416
5435
|
|
|
5417
5436
|
// packages/react/src/table-check.tsx
|
|
5418
|
-
var
|
|
5437
|
+
var import_react44 = require("react");
|
|
5419
5438
|
|
|
5420
5439
|
// shared/package-runtime/component-icons.ts
|
|
5421
5440
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -5424,7 +5443,7 @@ var componentIcons = { minus: import_minus.default };
|
|
|
5424
5443
|
// packages/react/src/table-check.tsx
|
|
5425
5444
|
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5426
5445
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5427
|
-
var TableCheck = (0,
|
|
5446
|
+
var TableCheck = (0, import_react44.forwardRef)(
|
|
5428
5447
|
function TableCheck2(props, ref) {
|
|
5429
5448
|
const size = import_tokens35.tokens.extensions.checkbox.iconSizes.sm;
|
|
5430
5449
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-table-check", children: [
|
|
@@ -5437,8 +5456,8 @@ var TableCheck = (0, import_react43.forwardRef)(
|
|
|
5437
5456
|
|
|
5438
5457
|
// packages/react/src/table-grid.tsx
|
|
5439
5458
|
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)(
|
|
5459
|
+
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 }) {
|
|
5460
|
+
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
5461
|
"table",
|
|
5443
5462
|
{
|
|
5444
5463
|
className: "kjun-table",
|
|
@@ -5512,7 +5531,7 @@ function TableGrid({ initialLoading, skeletonRows, state, onRowClick, selectable
|
|
|
5512
5531
|
className: "kjun-table-empty",
|
|
5513
5532
|
children: emptyContent || emptyText
|
|
5514
5533
|
}
|
|
5515
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5534
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react45.Fragment, { children: [
|
|
5516
5535
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5517
5536
|
"tr",
|
|
5518
5537
|
{
|
|
@@ -5555,6 +5574,7 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
|
5555
5574
|
function TableCards({
|
|
5556
5575
|
initialLoading,
|
|
5557
5576
|
skeletonRows,
|
|
5577
|
+
skeletonHidden,
|
|
5558
5578
|
state,
|
|
5559
5579
|
onRowClick,
|
|
5560
5580
|
selectable,
|
|
@@ -5571,86 +5591,99 @@ function TableCards({
|
|
|
5571
5591
|
rowKeyDown
|
|
5572
5592
|
}) {
|
|
5573
5593
|
const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
|
|
5574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
children:
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
{
|
|
5593
|
-
className: "kjun-table-card-header-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5595
|
+
"div",
|
|
5596
|
+
{
|
|
5597
|
+
className: "kjun-table-cards",
|
|
5598
|
+
role: "list",
|
|
5599
|
+
"aria-label": ariaLabel,
|
|
5600
|
+
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5601
|
+
"aria-hidden": skeletonHidden || void 0,
|
|
5602
|
+
children: [
|
|
5603
|
+
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)(
|
|
5604
|
+
"div",
|
|
5605
|
+
{
|
|
5606
|
+
role: "listitem",
|
|
5607
|
+
className: "kjun-table-card kjun-table-row-action " + customClass(row, i),
|
|
5608
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
5609
|
+
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5610
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5611
|
+
children: [
|
|
5612
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header", children: [
|
|
5613
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "kjun-table-card-header-left", children: [
|
|
5614
|
+
selectable && checkbox(row, i),
|
|
5615
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5616
|
+
] }),
|
|
5617
|
+
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,
|
|
5618
|
+
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5619
|
+
"div",
|
|
5620
|
+
{
|
|
5621
|
+
className: "kjun-table-card-header-actions",
|
|
5622
|
+
onClick: (e) => e.stopPropagation(),
|
|
5623
|
+
children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: cell(col, row, i) }, col.key))
|
|
5624
|
+
}
|
|
5625
|
+
)
|
|
5626
|
+
] }),
|
|
5627
|
+
sections.map((section, index) => {
|
|
5628
|
+
const cols = columnsForSection(row, section);
|
|
5629
|
+
return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5630
|
+
"section",
|
|
5631
|
+
{
|
|
5632
|
+
className: "kjun-table-card-section",
|
|
5633
|
+
children: [
|
|
5634
|
+
section.label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5612
5636
|
"div",
|
|
5613
5637
|
{
|
|
5614
|
-
className: "kjun-table-card-
|
|
5615
|
-
children:
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
className: "kjun-table-card-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5638
|
+
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5639
|
+
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5640
|
+
"div",
|
|
5641
|
+
{
|
|
5642
|
+
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5643
|
+
children: [
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-label", children: col.label }),
|
|
5645
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5646
|
+
]
|
|
5647
|
+
},
|
|
5648
|
+
col.key
|
|
5649
|
+
))
|
|
5650
|
+
}
|
|
5651
|
+
)
|
|
5652
|
+
]
|
|
5653
|
+
},
|
|
5654
|
+
section.key || index
|
|
5655
|
+
) : null;
|
|
5656
|
+
}),
|
|
5657
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
5658
|
+
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) }),
|
|
5659
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5660
|
+
"div",
|
|
5661
|
+
{
|
|
5662
|
+
className: "kjun-table-card-actions",
|
|
5663
|
+
onClick: (e) => e.stopPropagation(),
|
|
5664
|
+
children: cell(actions, row, i)
|
|
5665
|
+
}
|
|
5666
|
+
)
|
|
5667
|
+
]
|
|
5668
|
+
},
|
|
5669
|
+
state.key(row, i)
|
|
5670
|
+
)),
|
|
5671
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5672
|
+
]
|
|
5673
|
+
}
|
|
5674
|
+
);
|
|
5645
5675
|
}
|
|
5646
5676
|
|
|
5647
5677
|
// packages/react/src/table-view.tsx
|
|
5648
|
-
var
|
|
5678
|
+
var import_react46 = require("react");
|
|
5649
5679
|
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5650
5680
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5651
5681
|
function KjunTable(props) {
|
|
5652
5682
|
const {
|
|
5653
5683
|
skeletonRows = 8,
|
|
5684
|
+
skeleton = true,
|
|
5685
|
+
loadingText = "\uB85C\uB529 \uC911...",
|
|
5686
|
+
loadingDelay = 0,
|
|
5654
5687
|
emptyText = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
5655
5688
|
hoverable = true,
|
|
5656
5689
|
searchable = false,
|
|
@@ -5672,8 +5705,8 @@ function KjunTable(props) {
|
|
|
5672
5705
|
onRowClick,
|
|
5673
5706
|
onRetry
|
|
5674
5707
|
} = props;
|
|
5675
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), [mobile, setMobile] = (0,
|
|
5676
|
-
(0,
|
|
5708
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react46.useState)(false);
|
|
5709
|
+
(0, import_react46.useEffect)(() => {
|
|
5677
5710
|
const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
|
|
5678
5711
|
const update = () => setMobile(media.matches);
|
|
5679
5712
|
update();
|
|
@@ -5751,8 +5784,11 @@ function KjunTable(props) {
|
|
|
5751
5784
|
refreshing: query2.queryRefreshing,
|
|
5752
5785
|
loadingPadding: "none",
|
|
5753
5786
|
onRetry,
|
|
5787
|
+
loading: skeleton ? void 0 : props.loading,
|
|
5788
|
+
loadingText,
|
|
5789
|
+
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
5754
5790
|
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 }),
|
|
5791
|
+
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
5792
|
pagination && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5757
5793
|
KjunPagination,
|
|
5758
5794
|
{
|
|
@@ -5799,6 +5835,7 @@ function KjunKpiHero(props) {
|
|
|
5799
5835
|
secondary = [],
|
|
5800
5836
|
animated = true,
|
|
5801
5837
|
size = "md",
|
|
5838
|
+
surface = "card",
|
|
5802
5839
|
aside,
|
|
5803
5840
|
formatter,
|
|
5804
5841
|
deltaFormatter,
|
|
@@ -5820,6 +5857,7 @@ function KjunKpiHero(props) {
|
|
|
5820
5857
|
"div",
|
|
5821
5858
|
{
|
|
5822
5859
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
5860
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5823
5861
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
5824
5862
|
"aria-busy": loading,
|
|
5825
5863
|
children: [
|
|
@@ -5903,6 +5941,7 @@ function KjunKpiRow({
|
|
|
5903
5941
|
loading = false,
|
|
5904
5942
|
items,
|
|
5905
5943
|
size = "md",
|
|
5944
|
+
surface = "card",
|
|
5906
5945
|
mobileSummary = true,
|
|
5907
5946
|
onItemClick,
|
|
5908
5947
|
renderValue
|
|
@@ -5945,6 +5984,7 @@ function KjunKpiRow({
|
|
|
5945
5984
|
"div",
|
|
5946
5985
|
{
|
|
5947
5986
|
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" : ""),
|
|
5987
|
+
"data-surface": surface === "none" ? "none" : void 0,
|
|
5948
5988
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
5949
5989
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
5950
5990
|
var _a2, _b;
|
|
@@ -6032,7 +6072,7 @@ function KjunKpiRow({
|
|
|
6032
6072
|
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6033
6073
|
|
|
6034
6074
|
// shared/package-runtime/market-cards.ts
|
|
6035
|
-
var
|
|
6075
|
+
var import_react47 = require("react");
|
|
6036
6076
|
function useMarketCardsModel(props, persistence) {
|
|
6037
6077
|
const {
|
|
6038
6078
|
columns,
|
|
@@ -6048,8 +6088,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6048
6088
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6049
6089
|
isDefaultSort: c.defaultSort
|
|
6050
6090
|
}));
|
|
6051
|
-
const [key, setKey] = (0,
|
|
6052
|
-
const mounted = (0,
|
|
6091
|
+
const [key, setKey] = (0, import_react47.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6092
|
+
const mounted = (0, import_react47.useRef)("");
|
|
6053
6093
|
const save = (key2) => {
|
|
6054
6094
|
var _a;
|
|
6055
6095
|
try {
|
|
@@ -6057,7 +6097,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6057
6097
|
} catch (e) {
|
|
6058
6098
|
}
|
|
6059
6099
|
};
|
|
6060
|
-
(0,
|
|
6100
|
+
(0, import_react47.useEffect)(() => {
|
|
6061
6101
|
var _a, _b;
|
|
6062
6102
|
if (mounted.current === restoreSignature) return;
|
|
6063
6103
|
mounted.current = restoreSignature;
|
|
@@ -6210,7 +6250,7 @@ function KjunMarketCards(props) {
|
|
|
6210
6250
|
...props,
|
|
6211
6251
|
loadingPadding: "none",
|
|
6212
6252
|
empty: !rows.length,
|
|
6213
|
-
loadingContent: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
6253
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
6214
6254
|
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6215
6255
|
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
|
|
6216
6256
|
state.pill && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
@@ -6295,7 +6335,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6295
6335
|
loadingPadding: "none",
|
|
6296
6336
|
empty: !rows.length,
|
|
6297
6337
|
emptyText: emptyMessage,
|
|
6298
|
-
loadingContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, {}),
|
|
6338
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, {}),
|
|
6299
6339
|
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6300
6340
|
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: rows.map((row, i) => {
|
|
6301
6341
|
var _a, _b;
|
|
@@ -6393,7 +6433,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6393
6433
|
}
|
|
6394
6434
|
|
|
6395
6435
|
// packages/react/src/market-table.tsx
|
|
6396
|
-
var
|
|
6436
|
+
var import_react48 = require("react");
|
|
6397
6437
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6398
6438
|
function KjunMarketTable(props) {
|
|
6399
6439
|
const {
|
|
@@ -6414,8 +6454,8 @@ function KjunMarketTable(props) {
|
|
|
6414
6454
|
formatMetric,
|
|
6415
6455
|
renderCell
|
|
6416
6456
|
} = props;
|
|
6417
|
-
const scroller = (0,
|
|
6418
|
-
(0,
|
|
6457
|
+
const scroller = (0, import_react48.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react48.useState)(false);
|
|
6458
|
+
(0, import_react48.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6419
6459
|
const render = (row, col) => {
|
|
6420
6460
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6421
6461
|
if (cellLoading(row, col))
|
|
@@ -6483,7 +6523,7 @@ function KjunMarketTable(props) {
|
|
|
6483
6523
|
loadingPadding: "none",
|
|
6484
6524
|
empty: !rows.length,
|
|
6485
6525
|
emptyText: emptyMessage,
|
|
6486
|
-
loadingContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6526
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6487
6527
|
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6488
6528
|
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
6529
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MarketColumns, { columns, showActions }),
|
|
@@ -6612,7 +6652,7 @@ function KjunMarketTable(props) {
|
|
|
6612
6652
|
}
|
|
6613
6653
|
|
|
6614
6654
|
// packages/react/src/list.tsx
|
|
6615
|
-
var
|
|
6655
|
+
var import_react49 = require("react");
|
|
6616
6656
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6617
6657
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
6618
6658
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
@@ -6630,7 +6670,7 @@ function KjunListRow({ title, description, leading, trailing, actions, href, dis
|
|
|
6630
6670
|
] });
|
|
6631
6671
|
}
|
|
6632
6672
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
6633
|
-
const id = "kjun-" + (0,
|
|
6673
|
+
const id = "kjun-" + (0, import_react49.useId)();
|
|
6634
6674
|
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: [
|
|
6635
6675
|
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
6636
6676
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
@@ -6685,14 +6725,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
6685
6725
|
}
|
|
6686
6726
|
|
|
6687
6727
|
// packages/react/src/media.tsx
|
|
6688
|
-
var
|
|
6728
|
+
var import_react50 = require("react");
|
|
6689
6729
|
var import_tokens44 = require("@kjun-ui/tokens");
|
|
6690
6730
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6691
6731
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6692
|
-
const current = (0,
|
|
6732
|
+
const current = (0, import_react50.useRef)({ src, version: 0 });
|
|
6693
6733
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6694
6734
|
const version = current.current.version;
|
|
6695
|
-
const [result, setResult] = (0,
|
|
6735
|
+
const [result, setResult] = (0, import_react50.useState)({ version, state: "loading" });
|
|
6696
6736
|
const state = result.version === version ? result.state : "loading";
|
|
6697
6737
|
const failed = !src || state === "error";
|
|
6698
6738
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -6724,7 +6764,7 @@ function KjunChip({ label, icon, removable = false, disabled = false, size = "md
|
|
|
6724
6764
|
}
|
|
6725
6765
|
|
|
6726
6766
|
// packages/react/src/range-input.tsx
|
|
6727
|
-
var
|
|
6767
|
+
var import_react51 = require("react");
|
|
6728
6768
|
var import_react_aria_components9 = require("react-aria-components");
|
|
6729
6769
|
var import_tokens46 = require("@kjun-ui/tokens");
|
|
6730
6770
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
@@ -6733,10 +6773,10 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
6733
6773
|
const domain = (0, import_tokens46.createSliderDomain)(min, max, step);
|
|
6734
6774
|
const list = Array.isArray(value) ? value : [value];
|
|
6735
6775
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
6736
|
-
const latest = (0,
|
|
6776
|
+
const latest = (0, import_react51.useRef)(value);
|
|
6737
6777
|
latest.current = value;
|
|
6738
|
-
const active = (0,
|
|
6739
|
-
(0,
|
|
6778
|
+
const active = (0, import_react51.useRef)(false);
|
|
6779
|
+
(0, import_react51.useEffect)(() => {
|
|
6740
6780
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6741
6781
|
}, [valid]);
|
|
6742
6782
|
const change = (next) => {
|
|
@@ -6773,7 +6813,7 @@ function KjunRangeSlider(props) {
|
|
|
6773
6813
|
}
|
|
6774
6814
|
|
|
6775
6815
|
// packages/react/src/quantity-stepper.tsx
|
|
6776
|
-
var
|
|
6816
|
+
var import_react52 = require("react");
|
|
6777
6817
|
var import_tokens47 = require("@kjun-ui/tokens");
|
|
6778
6818
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6779
6819
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
@@ -6781,15 +6821,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6781
6821
|
const buttonStyle = { width: import_tokens47.tokens.input[size].height, padding: 0 };
|
|
6782
6822
|
const domain = (0, import_tokens47.createNumberDomain)({ min, max, step, precision });
|
|
6783
6823
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
6784
|
-
const [draft, setDraft] = (0,
|
|
6824
|
+
const [draft, setDraft] = (0, import_react52.useState)(String(value));
|
|
6785
6825
|
const field = useKjunField();
|
|
6786
|
-
const composing = (0,
|
|
6787
|
-
(0,
|
|
6826
|
+
const composing = (0, import_react52.useRef)(false), dirty = (0, import_react52.useRef)(false), accepted = (0, import_react52.useRef)(value);
|
|
6827
|
+
(0, import_react52.useEffect)(() => {
|
|
6788
6828
|
setDraft(String(value));
|
|
6789
6829
|
accepted.current = value;
|
|
6790
6830
|
dirty.current = false;
|
|
6791
6831
|
}, [value, precision, min, max, step]);
|
|
6792
|
-
(0,
|
|
6832
|
+
(0, import_react52.useEffect)(() => {
|
|
6793
6833
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6794
6834
|
}, [valid]);
|
|
6795
6835
|
const emit = (next) => {
|
|
@@ -6864,16 +6904,16 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6864
6904
|
}
|
|
6865
6905
|
|
|
6866
6906
|
// packages/react/src/time-picker.tsx
|
|
6867
|
-
var
|
|
6907
|
+
var import_react53 = require("react");
|
|
6868
6908
|
var import_tokens48 = require("@kjun-ui/tokens");
|
|
6869
6909
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
6870
6910
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel = "\uC2DC\uAC04", onValueChange, onChangeCommit }) {
|
|
6871
|
-
const root = (0,
|
|
6872
|
-
const field = useKjunField(), uid = (0,
|
|
6911
|
+
const root = (0, import_react53.useRef)(null);
|
|
6912
|
+
const field = useKjunField(), uid = (0, import_react53.useId)();
|
|
6873
6913
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
6874
|
-
const domain = (0,
|
|
6914
|
+
const domain = (0, import_react53.useMemo)(() => (0, import_tokens48.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
6875
6915
|
const valid = domain.valid && domain.accepts(value);
|
|
6876
|
-
(0,
|
|
6916
|
+
(0, import_react53.useEffect)(() => {
|
|
6877
6917
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6878
6918
|
}, [valid]);
|
|
6879
6919
|
const change = (next) => {
|
|
@@ -6887,7 +6927,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
6887
6927
|
/* @__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) => {
|
|
6888
6928
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
6889
6929
|
const labelId = `${fieldId}-segment-${index}`;
|
|
6890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
6930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react53.Fragment, { children: [
|
|
6891
6931
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
6892
6932
|
/* @__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: [
|
|
6893
6933
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|