@kjun-ui/react 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +440 -392
- package/dist/index.js +554 -505
- package/dist/styles.css +74 -30
- package/dist/types/packages/react/src/app-navigation.d.cts +9 -3
- package/dist/types/packages/react/src/app-navigation.d.ts +9 -3
- package/dist/types/packages/react/src/controls.d.cts +3 -1
- package/dist/types/packages/react/src/controls.d.ts +3 -1
- package/dist/types/packages/react/src/display.d.cts +5 -2
- package/dist/types/packages/react/src/display.d.ts +5 -2
- package/dist/types/packages/react/src/kpi.d.cts +6 -2
- package/dist/types/packages/react/src/kpi.d.ts +6 -2
- package/dist/types/packages/react/src/list.d.cts +3 -1
- package/dist/types/packages/react/src/list.d.ts +3 -1
- package/dist/types/packages/react/src/media.d.cts +1 -1
- package/dist/types/packages/react/src/media.d.ts +1 -1
- package/dist/types/packages/react/src/navigation.d.cts +5 -1
- package/dist/types/packages/react/src/navigation.d.ts +5 -1
- package/dist/types/packages/react/src/range-input.d.cts +4 -0
- package/dist/types/packages/react/src/range-input.d.ts +4 -0
- package/dist/types/shared/package-runtime/alert-exit.d.cts +5 -0
- package/dist/types/shared/package-runtime/alert-exit.d.ts +5 -0
- package/dist/types/shared/package-runtime/alert-tone.d.cts +11 -0
- package/dist/types/shared/package-runtime/alert-tone.d.ts +11 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +10 -4
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +10 -4
- package/dist/types/shared/package-runtime/progress-circle.d.cts +5 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -114,7 +114,7 @@ __export(index_exports, {
|
|
|
114
114
|
KjunTimePicker: () => KjunTimePicker,
|
|
115
115
|
KjunTooltip: () => KjunTooltip,
|
|
116
116
|
KjunTopNavigation: () => KjunTopNavigation,
|
|
117
|
-
createKjunFeedback: () =>
|
|
117
|
+
createKjunFeedback: () => import_tokens17.createKjunFeedback,
|
|
118
118
|
groupKeydown: () => groupKeydown,
|
|
119
119
|
kjunMessagesEn: () => kjunMessagesEn,
|
|
120
120
|
kjunMessagesKo: () => kjunMessagesKo,
|
|
@@ -1693,13 +1693,45 @@ function alertRole(tone, live) {
|
|
|
1693
1693
|
return tone === "danger" ? "alert" : "status";
|
|
1694
1694
|
}
|
|
1695
1695
|
|
|
1696
|
+
// shared/package-runtime/alert-tone.ts
|
|
1697
|
+
function alertToneRoles(tone) {
|
|
1698
|
+
if (tone === "primary") return { bg: "brand-subtle-bg", icon: "brand" };
|
|
1699
|
+
if (tone === "info") return { bg: null, icon: "text" };
|
|
1700
|
+
return { bg: tone + "-bg", icon: tone + "-accent" };
|
|
1701
|
+
}
|
|
1702
|
+
var alertIcons = {
|
|
1703
|
+
info: "info-circle",
|
|
1704
|
+
primary: "info-circle",
|
|
1705
|
+
success: "circle-check",
|
|
1706
|
+
warning: "alert-triangle",
|
|
1707
|
+
danger: "alert-circle"
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
// shared/package-runtime/alert-exit.ts
|
|
1711
|
+
var import_tokens10 = require("@kjun-ui/tokens");
|
|
1712
|
+
function collapseAlert(el, reduced, done) {
|
|
1713
|
+
if (reduced || !el || typeof el.animate !== "function") {
|
|
1714
|
+
done();
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
const style = getComputedStyle(el);
|
|
1718
|
+
el.inert = true;
|
|
1719
|
+
el.style.overflow = "hidden";
|
|
1720
|
+
el.style.boxSizing = "border-box";
|
|
1721
|
+
const exit = el.animate([
|
|
1722
|
+
{ height: el.getBoundingClientRect().height + "px", paddingTop: style.paddingTop, paddingBottom: style.paddingBottom, opacity: 1 },
|
|
1723
|
+
{ height: "0px", paddingTop: "0px", paddingBottom: "0px", opacity: 0 }
|
|
1724
|
+
], { duration: import_tokens10.tokens.motion.collapse, easing: import_tokens10.tokens.motion.easeOut, fill: "forwards" });
|
|
1725
|
+
exit.onfinish = done;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1696
1728
|
// packages/react/src/display.tsx
|
|
1697
|
-
var
|
|
1729
|
+
var import_tokens12 = require("@kjun-ui/tokens");
|
|
1698
1730
|
|
|
1699
1731
|
// shared/package-runtime/progress-circle.ts
|
|
1700
|
-
var
|
|
1732
|
+
var import_tokens11 = require("@kjun-ui/tokens");
|
|
1701
1733
|
function progressCircle(size, percentage) {
|
|
1702
|
-
const { size: diameter, stroke } =
|
|
1734
|
+
const { size: diameter, stroke } = import_tokens11.tokens.extensions.progress.circle[size];
|
|
1703
1735
|
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1704
1736
|
return {
|
|
1705
1737
|
diameter,
|
|
@@ -1712,6 +1744,10 @@ function progressCircle(size, percentage) {
|
|
|
1712
1744
|
showsPercentage: size !== "sm"
|
|
1713
1745
|
};
|
|
1714
1746
|
}
|
|
1747
|
+
function progressState(value, max, indeterminate) {
|
|
1748
|
+
if (indeterminate) return "indeterminate";
|
|
1749
|
+
return value === null || !Number.isFinite(value) || !Number.isFinite(max) || max <= 0 ? "missing" : "determinate";
|
|
1750
|
+
}
|
|
1715
1751
|
|
|
1716
1752
|
// packages/react/src/display.tsx
|
|
1717
1753
|
var import_react17 = require("react");
|
|
@@ -1826,7 +1862,7 @@ function KjunBadge({
|
|
|
1826
1862
|
style,
|
|
1827
1863
|
...props
|
|
1828
1864
|
}) {
|
|
1829
|
-
const { x, y } =
|
|
1865
|
+
const { x, y } = import_tokens12.tokens.extensions.badge.padding[size];
|
|
1830
1866
|
const neutral = variant === "default" || variant === "secondary";
|
|
1831
1867
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1832
1868
|
"span",
|
|
@@ -1861,7 +1897,7 @@ function KjunEmpty({
|
|
|
1861
1897
|
const m = useKjunMessages();
|
|
1862
1898
|
text != null ? text : text = m.noData;
|
|
1863
1899
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-empty", children: [
|
|
1864
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size:
|
|
1900
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size: import_tokens12.tokens.extensions.empty.iconSize }),
|
|
1865
1901
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: text }),
|
|
1866
1902
|
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: description }),
|
|
1867
1903
|
children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children })
|
|
@@ -1869,14 +1905,14 @@ function KjunEmpty({
|
|
|
1869
1905
|
}
|
|
1870
1906
|
function KjunSpinner({ size = "md", text }) {
|
|
1871
1907
|
const m = useKjunMessages();
|
|
1872
|
-
const stroke =
|
|
1908
|
+
const stroke = import_tokens12.tokens.extensions.spinner.strokeWidths[size] * 24 / import_tokens12.tokens.extensions.spinner.sizes[size];
|
|
1873
1909
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1874
1910
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1875
1911
|
"svg",
|
|
1876
1912
|
{
|
|
1877
1913
|
className: "kjun-spin",
|
|
1878
|
-
width:
|
|
1879
|
-
height:
|
|
1914
|
+
width: import_tokens12.tokens.extensions.spinner.sizes[size],
|
|
1915
|
+
height: import_tokens12.tokens.extensions.spinner.sizes[size],
|
|
1880
1916
|
viewBox: "0 0 24 24",
|
|
1881
1917
|
fill: "none",
|
|
1882
1918
|
"aria-hidden": "true",
|
|
@@ -1919,32 +1955,21 @@ function KjunAlert({
|
|
|
1919
1955
|
}) {
|
|
1920
1956
|
const m = useKjunMessages();
|
|
1921
1957
|
const [visible, setVisible] = (0, import_react17.useState)(true);
|
|
1958
|
+
const root = (0, import_react17.useRef)(null), closing = (0, import_react17.useRef)(false);
|
|
1959
|
+
const reduced = useReducedMotion();
|
|
1922
1960
|
if (!visible) return null;
|
|
1923
|
-
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
1961
|
+
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm", paint = alertToneRoles(tone);
|
|
1924
1962
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1925
1963
|
"div",
|
|
1926
1964
|
{
|
|
1965
|
+
ref: root,
|
|
1927
1966
|
role: alertRole(tone, live),
|
|
1928
1967
|
className: "kjun-alert",
|
|
1929
1968
|
"data-size": small ? "sm" : "md",
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
borderColor: role(tone === "primary" ? "brand-light" : tone + "-light")
|
|
1933
|
-
},
|
|
1969
|
+
"data-tone": tone,
|
|
1970
|
+
style: paint.bg ? { background: role(paint.bg) } : void 0,
|
|
1934
1971
|
children: [
|
|
1935
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "kjun-alert-icon", style: { color: role(
|
|
1936
|
-
KjunIcon,
|
|
1937
|
-
{
|
|
1938
|
-
name: {
|
|
1939
|
-
info: "info-circle",
|
|
1940
|
-
primary: "info-circle",
|
|
1941
|
-
success: "circle-check",
|
|
1942
|
-
warning: "alert-triangle",
|
|
1943
|
-
danger: "alert-circle"
|
|
1944
|
-
}[tone],
|
|
1945
|
-
size: import_tokens11.tokens.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1946
|
-
}
|
|
1947
|
-
) }),
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "kjun-alert-icon", style: { color: role(paint.icon) }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: alertIcons[tone], filled: true, size: import_tokens12.tokens.extensions.alert.iconSizes[small ? "sm" : "md"] }) }),
|
|
1948
1973
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-alert-content", children: [
|
|
1949
1974
|
hasContent(title) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-alert-title", children: title }),
|
|
1950
1975
|
hasContent(children) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-alert-description", children }),
|
|
@@ -1957,10 +1982,14 @@ function KjunAlert({
|
|
|
1957
1982
|
type: "button",
|
|
1958
1983
|
"aria-label": m.close,
|
|
1959
1984
|
onClick: () => {
|
|
1960
|
-
|
|
1961
|
-
|
|
1985
|
+
if (closing.current) return;
|
|
1986
|
+
closing.current = true;
|
|
1987
|
+
collapseAlert(root.current, reduced, () => {
|
|
1988
|
+
setVisible(false);
|
|
1989
|
+
onClose == null ? void 0 : onClose();
|
|
1990
|
+
});
|
|
1962
1991
|
},
|
|
1963
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size:
|
|
1992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size: import_tokens12.tokens.extensions.alert.closeIconSize })
|
|
1964
1993
|
}
|
|
1965
1994
|
)
|
|
1966
1995
|
]
|
|
@@ -1969,6 +1998,7 @@ function KjunAlert({
|
|
|
1969
1998
|
}
|
|
1970
1999
|
function KjunProgress({
|
|
1971
2000
|
value = 0,
|
|
2001
|
+
indeterminate = false,
|
|
1972
2002
|
max = 100,
|
|
1973
2003
|
size = "md",
|
|
1974
2004
|
variant = "primary",
|
|
@@ -1978,80 +2008,53 @@ function KjunProgress({
|
|
|
1978
2008
|
shape = "bar"
|
|
1979
2009
|
}) {
|
|
1980
2010
|
const m = useKjunMessages();
|
|
1981
|
-
const
|
|
2011
|
+
const state = progressState(value, max, indeterminate);
|
|
2012
|
+
const percentage = state === "determinate" ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2013
|
+
const text = state === "indeterminate" ? m.loadingEllipsis : state === "missing" ? "\u2014" : `${percentage}%`;
|
|
1982
2014
|
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
2015
|
+
const accessibility = {
|
|
2016
|
+
role: state === "missing" ? "img" : "progressbar",
|
|
2017
|
+
"aria-label": state === "missing" ? `${name}: ${m.noData}` : name,
|
|
2018
|
+
"aria-valuemin": state === "missing" ? void 0 : 0,
|
|
2019
|
+
"aria-valuemax": state === "missing" ? void 0 : 100,
|
|
2020
|
+
"aria-valuenow": state === "determinate" ? percentage : void 0,
|
|
2021
|
+
"aria-valuetext": state === "indeterminate" ? m.loadingEllipsis : void 0,
|
|
2022
|
+
"aria-busy": state === "indeterminate" || void 0
|
|
2023
|
+
};
|
|
1983
2024
|
if (shape === "circle") {
|
|
1984
|
-
const c = progressCircle(size, percentage);
|
|
1985
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1986
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1987
|
-
"
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
stroke: color,
|
|
2008
|
-
strokeLinecap: "round",
|
|
2009
|
-
strokeDasharray: c.circumference,
|
|
2010
|
-
strokeDashoffset: c.offset,
|
|
2011
|
-
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
2012
|
-
}
|
|
2013
|
-
)
|
|
2014
|
-
] }),
|
|
2015
|
-
showLabel && c.showsPercentage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "kjun-progress-circle-percent", children: [
|
|
2016
|
-
percentage,
|
|
2017
|
-
"%"
|
|
2018
|
-
] })
|
|
2019
|
-
]
|
|
2020
|
-
}
|
|
2021
|
-
),
|
|
2025
|
+
const c = progressCircle(size, state === "indeterminate" ? 25 : percentage);
|
|
2026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, "data-state": state, children: [
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ...accessibility, className: "kjun-progress-circle", style: { width: c.diameter, height: c.diameter }, children: [
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { className: state === "indeterminate" ? "kjun-spin" : void 0, width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
2030
|
+
(percentage > 0 || state === "indeterminate") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2031
|
+
"circle",
|
|
2032
|
+
{
|
|
2033
|
+
className: "kjun-progress-circle-value",
|
|
2034
|
+
cx: c.centre,
|
|
2035
|
+
cy: c.centre,
|
|
2036
|
+
r: c.radius,
|
|
2037
|
+
strokeWidth: c.stroke,
|
|
2038
|
+
stroke: color,
|
|
2039
|
+
strokeLinecap: "round",
|
|
2040
|
+
strokeDasharray: c.circumference,
|
|
2041
|
+
strokeDashoffset: c.offset,
|
|
2042
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
2043
|
+
}
|
|
2044
|
+
)
|
|
2045
|
+
] }),
|
|
2046
|
+
showLabel && c.showsPercentage && state !== "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "kjun-progress-circle-percent", children: text })
|
|
2047
|
+
] }),
|
|
2022
2048
|
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-circle-label", children: label }),
|
|
2023
2049
|
subLabel && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-sub", children: subLabel })
|
|
2024
2050
|
] });
|
|
2025
2051
|
}
|
|
2026
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", children: [
|
|
2052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", "data-state": state, children: [
|
|
2027
2053
|
(label || showLabel) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress-label", children: [
|
|
2028
2054
|
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }),
|
|
2029
|
-
showLabel && /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2030
|
-
percentage,
|
|
2031
|
-
"%"
|
|
2032
|
-
] })
|
|
2055
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: text })
|
|
2033
2056
|
] }),
|
|
2034
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2035
|
-
"div",
|
|
2036
|
-
{
|
|
2037
|
-
role: "progressbar",
|
|
2038
|
-
"aria-label": name,
|
|
2039
|
-
"aria-valuemin": 0,
|
|
2040
|
-
"aria-valuemax": 100,
|
|
2041
|
-
"aria-valuenow": percentage,
|
|
2042
|
-
className: "kjun-progress-track",
|
|
2043
|
-
style: { height: import_tokens11.tokens.extensions.progress.heights[size] },
|
|
2044
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2045
|
-
"div",
|
|
2046
|
-
{
|
|
2047
|
-
style: {
|
|
2048
|
-
width: percentage + "%",
|
|
2049
|
-
background: color
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
)
|
|
2053
|
-
}
|
|
2054
|
-
),
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ...accessibility, className: "kjun-progress-track", style: { height: import_tokens12.tokens.extensions.progress.heights[size] }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { width: (state === "indeterminate" ? 30 : percentage) + "%", background: color } }) }),
|
|
2055
2058
|
subLabel && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-sub", children: subLabel })
|
|
2056
2059
|
] });
|
|
2057
2060
|
}
|
|
@@ -2077,9 +2080,9 @@ function KjunSkeleton({
|
|
|
2077
2080
|
{
|
|
2078
2081
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
2079
2082
|
style: sm ? void 0 : {
|
|
2080
|
-
width: width ||
|
|
2081
|
-
height: height ||
|
|
2082
|
-
borderRadius: rounded ? "50%" :
|
|
2083
|
+
width: width || import_tokens12.tokens.extensions.skeleton.avatarSize,
|
|
2084
|
+
height: height || import_tokens12.tokens.extensions.skeleton.avatarSize,
|
|
2085
|
+
borderRadius: rounded ? "50%" : import_tokens12.tokens.radius.radius8
|
|
2083
2086
|
}
|
|
2084
2087
|
}
|
|
2085
2088
|
);
|
|
@@ -2103,7 +2106,7 @@ function KjunSkeleton({
|
|
|
2103
2106
|
avatar(true),
|
|
2104
2107
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
2105
2108
|
line("60%"),
|
|
2106
|
-
line("40%", void 0,
|
|
2109
|
+
line("40%", void 0, import_tokens12.tokens.extensions.skeleton.lineHeights.sm)
|
|
2107
2110
|
] })
|
|
2108
2111
|
] }),
|
|
2109
2112
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -2126,9 +2129,9 @@ function KjunSkeleton({
|
|
|
2126
2129
|
)) }),
|
|
2127
2130
|
type === "stat" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat", children: [
|
|
2128
2131
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat-content", children: [
|
|
2129
|
-
line("40%", 0,
|
|
2130
|
-
line("60%", 1,
|
|
2131
|
-
line("30%", 2,
|
|
2132
|
+
line("40%", 0, import_tokens12.tokens.extensions.skeleton.lineHeights.sm),
|
|
2133
|
+
line("60%", 1, import_tokens12.tokens.extensions.skeleton.lineHeights.lg),
|
|
2134
|
+
line("30%", 2, import_tokens12.tokens.extensions.skeleton.lineHeights.sm)
|
|
2132
2135
|
] }),
|
|
2133
2136
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-sparkline" }) })
|
|
2134
2137
|
] }),
|
|
@@ -2136,7 +2139,7 @@ function KjunSkeleton({
|
|
|
2136
2139
|
"div",
|
|
2137
2140
|
{
|
|
2138
2141
|
className: "kjun-skeleton-block",
|
|
2139
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2142
|
+
style: { width: width || "100%", height: height != null ? height : import_tokens12.tokens.extensions.skeleton.blockHeight }
|
|
2140
2143
|
}
|
|
2141
2144
|
)
|
|
2142
2145
|
]
|
|
@@ -2244,7 +2247,7 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2244
2247
|
}
|
|
2245
2248
|
|
|
2246
2249
|
// shared/package-runtime/feedback-motion.ts
|
|
2247
|
-
var
|
|
2250
|
+
var import_tokens13 = require("@kjun-ui/tokens");
|
|
2248
2251
|
var import_react20 = require("react");
|
|
2249
2252
|
function usePresentedToasts(toasts, reduced) {
|
|
2250
2253
|
const [items, setItems] = (0, import_react20.useState)([]);
|
|
@@ -2262,7 +2265,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2262
2265
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2263
2266
|
removals.current.delete(item.toast.id);
|
|
2264
2267
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2265
|
-
},
|
|
2268
|
+
}, import_tokens13.tokens.motion.toastExit));
|
|
2266
2269
|
}
|
|
2267
2270
|
return next;
|
|
2268
2271
|
});
|
|
@@ -2284,7 +2287,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
2284
2287
|
setRequest(current);
|
|
2285
2288
|
return;
|
|
2286
2289
|
}
|
|
2287
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2290
|
+
const timer = setTimeout(() => setRequest(current), import_tokens13.tokens.motion.layerExit);
|
|
2288
2291
|
return () => clearTimeout(timer);
|
|
2289
2292
|
}, [current, request, reduced]);
|
|
2290
2293
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -2298,11 +2301,11 @@ function useOptionalKjunFeedback() {
|
|
|
2298
2301
|
}
|
|
2299
2302
|
|
|
2300
2303
|
// packages/react/src/toast-stack.tsx
|
|
2301
|
-
var
|
|
2304
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2302
2305
|
var import_react23 = require("react");
|
|
2303
2306
|
|
|
2304
2307
|
// shared/package-runtime/toast-layout.ts
|
|
2305
|
-
var
|
|
2308
|
+
var import_tokens14 = require("@kjun-ui/tokens");
|
|
2306
2309
|
function createToastLayout() {
|
|
2307
2310
|
let root = null;
|
|
2308
2311
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2345,7 +2348,7 @@ function createToastLayout() {
|
|
|
2345
2348
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2346
2349
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2347
2350
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
2348
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
2351
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: import_tokens14.tokens.motion.toastMove, easing: import_tokens14.tokens.motion.easeOut });
|
|
2349
2352
|
animations.set(node, animation);
|
|
2350
2353
|
}
|
|
2351
2354
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2477,15 +2480,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2477
2480
|
return;
|
|
2478
2481
|
}
|
|
2479
2482
|
const elapsed = Date.now() - item.born;
|
|
2480
|
-
if (!item.exiting && (elapsed >=
|
|
2481
|
-
const hidden = `translateY(${-
|
|
2483
|
+
if (!item.exiting && (elapsed >= import_tokens15.tokens.motion.toastEnter || entryFinished.current)) return;
|
|
2484
|
+
const hidden = `translateY(${-import_tokens15.tokens.motionDistance.toast}px)`, from = current.current;
|
|
2482
2485
|
const animations = item.exiting ? [
|
|
2483
|
-
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration:
|
|
2484
|
-
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration:
|
|
2486
|
+
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration: import_tokens15.tokens.motion.fadeExit, easing: import_tokens15.tokens.motion.easeLinear, fill: "both" }),
|
|
2487
|
+
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration: import_tokens15.tokens.motion.toastExit, easing: import_tokens15.tokens.motion.easeIn, fill: "both" })
|
|
2485
2488
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2486
|
-
duration:
|
|
2489
|
+
duration: import_tokens15.tokens.motion.toastEnter,
|
|
2487
2490
|
delay: -elapsed,
|
|
2488
|
-
easing:
|
|
2491
|
+
easing: import_tokens15.tokens.motion.easeOut,
|
|
2489
2492
|
fill: "both"
|
|
2490
2493
|
})];
|
|
2491
2494
|
animations[0].onfinish = () => {
|
|
@@ -2521,9 +2524,9 @@ function ToastStack({ items, controller }) {
|
|
|
2521
2524
|
}
|
|
2522
2525
|
|
|
2523
2526
|
// packages/react/src/feedback.tsx
|
|
2524
|
-
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2525
|
-
var import_react24 = require("react");
|
|
2526
2527
|
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2528
|
+
var import_react24 = require("react");
|
|
2529
|
+
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2527
2530
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2528
2531
|
function useKjunFeedback() {
|
|
2529
2532
|
const value = useOptionalKjunFeedback();
|
|
@@ -2574,8 +2577,8 @@ function FeedbackDialog({
|
|
|
2574
2577
|
}
|
|
2575
2578
|
function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
2576
2579
|
var _a;
|
|
2577
|
-
const [owned] = (0, import_react24.useState)(() => controllerProp ? void 0 : (0,
|
|
2578
|
-
const controller = controllerProp ? (0,
|
|
2580
|
+
const [owned] = (0, import_react24.useState)(() => controllerProp ? void 0 : (0, import_tokens16.createFeedbackController)());
|
|
2581
|
+
const controller = controllerProp ? (0, import_tokens16.feedbackControllerOf)(controllerProp) : owned;
|
|
2579
2582
|
(0, import_react24.useEffect)(() => controller.attach(), [controller]);
|
|
2580
2583
|
const life = (0, import_react24.useRef)(0);
|
|
2581
2584
|
const snapshot = (0, import_react24.useSyncExternalStore)(
|
|
@@ -2623,7 +2626,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
|
2623
2626
|
}
|
|
2624
2627
|
|
|
2625
2628
|
// packages/react/src/controls.tsx
|
|
2626
|
-
var
|
|
2629
|
+
var import_tokens19 = require("@kjun-ui/tokens");
|
|
2627
2630
|
var import_react26 = require("react");
|
|
2628
2631
|
var import_react_aria_components3 = require("react-aria-components");
|
|
2629
2632
|
|
|
@@ -2631,7 +2634,7 @@ var import_react_aria_components3 = require("react-aria-components");
|
|
|
2631
2634
|
var import_react25 = require("react");
|
|
2632
2635
|
|
|
2633
2636
|
// shared/package-runtime/selection-indicator.ts
|
|
2634
|
-
var
|
|
2637
|
+
var import_tokens18 = require("@kjun-ui/tokens");
|
|
2635
2638
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2636
2639
|
var _a;
|
|
2637
2640
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2671,7 +2674,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2671
2674
|
const style = getComputedStyle(next);
|
|
2672
2675
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2673
2676
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2674
|
-
const height = underline ?
|
|
2677
|
+
const height = underline ? import_tokens18.tokens.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2675
2678
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2676
2679
|
if (key !== bounds) {
|
|
2677
2680
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2733,10 +2736,15 @@ function groupKeydown(event) {
|
|
|
2733
2736
|
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2734
2737
|
}
|
|
2735
2738
|
|
|
2739
|
+
// shared/package-runtime/component-icons.ts
|
|
2740
|
+
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
2741
|
+
var componentIcons = { minus: import_minus.default };
|
|
2742
|
+
|
|
2736
2743
|
// packages/react/src/controls.tsx
|
|
2737
2744
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2738
2745
|
function KjunCheckbox({
|
|
2739
2746
|
value,
|
|
2747
|
+
indeterminate = false,
|
|
2740
2748
|
val,
|
|
2741
2749
|
label,
|
|
2742
2750
|
ariaLabel,
|
|
@@ -2752,6 +2760,7 @@ function KjunCheckbox({
|
|
|
2752
2760
|
import_react_aria_components3.Checkbox,
|
|
2753
2761
|
{
|
|
2754
2762
|
isSelected: checked,
|
|
2763
|
+
isIndeterminate: indeterminate,
|
|
2755
2764
|
isDisabled: disabled,
|
|
2756
2765
|
"aria-label": ariaLabel,
|
|
2757
2766
|
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
@@ -2768,8 +2777,8 @@ function KjunCheckbox({
|
|
|
2768
2777
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2769
2778
|
"span",
|
|
2770
2779
|
{
|
|
2771
|
-
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2772
|
-
children: checked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: "check", size:
|
|
2780
|
+
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked || indeterminate ? " kjun-checkbox--checked" : ""}`,
|
|
2781
|
+
children: (checked || indeterminate) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: indeterminate ? "minus" : "check", size: import_tokens19.tokens.extensions.checkbox.iconSizes[size] }) })
|
|
2773
2782
|
}
|
|
2774
2783
|
),
|
|
2775
2784
|
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2900,7 +2909,7 @@ function KjunRadioGroup({
|
|
|
2900
2909
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2901
2910
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2902
2911
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2903
|
-
gap: direction === "vertical" ?
|
|
2912
|
+
gap: direction === "vertical" ? import_tokens19.tokens.dimension.value8 : import_tokens19.tokens.dimension.value16
|
|
2904
2913
|
},
|
|
2905
2914
|
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2906
2915
|
KjunRadio,
|
|
@@ -2932,7 +2941,7 @@ var KjunTextarea = (0, import_react26.forwardRef)(
|
|
|
2932
2941
|
}, ref) {
|
|
2933
2942
|
var _a;
|
|
2934
2943
|
const field = useKjunField();
|
|
2935
|
-
const spec =
|
|
2944
|
+
const spec = import_tokens19.tokens.input[size];
|
|
2936
2945
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2937
2946
|
"textarea",
|
|
2938
2947
|
{
|
|
@@ -2950,8 +2959,8 @@ var KjunTextarea = (0, import_react26.forwardRef)(
|
|
|
2950
2959
|
style: {
|
|
2951
2960
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2952
2961
|
lineHeight: spec.lineHeight / 16 + "rem",
|
|
2953
|
-
padding: `${spec.textareaPaddingY}px ${spec.padding -
|
|
2954
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
2962
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - import_tokens19.tokens.border.controlWidth}px`,
|
|
2963
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * import_tokens19.tokens.border.controlWidth),
|
|
2955
2964
|
borderRadius: spec.radius,
|
|
2956
2965
|
resize,
|
|
2957
2966
|
...style
|
|
@@ -2984,9 +2993,9 @@ function KjunButtonGroup({
|
|
|
2984
2993
|
className: "kjun-button-group",
|
|
2985
2994
|
onKeyDown: groupKeydown,
|
|
2986
2995
|
style: {
|
|
2987
|
-
height:
|
|
2988
|
-
padding:
|
|
2989
|
-
borderRadius:
|
|
2996
|
+
height: import_tokens19.tokens.buttonGroup.heights[size],
|
|
2997
|
+
padding: import_tokens19.tokens.buttonGroup.padding[size],
|
|
2998
|
+
borderRadius: import_tokens19.tokens.buttonGroup.radii[size],
|
|
2990
2999
|
width: fullWidth ? "100%" : "fit-content"
|
|
2991
3000
|
},
|
|
2992
3001
|
children: [
|
|
@@ -2997,7 +3006,7 @@ function KjunButtonGroup({
|
|
|
2997
3006
|
className: "kjun-button-group-indicator",
|
|
2998
3007
|
"aria-hidden": "true",
|
|
2999
3008
|
hidden: true,
|
|
3000
|
-
style: { borderRadius:
|
|
3009
|
+
style: { borderRadius: import_tokens19.tokens.buttonGroup.itemRadii[size] }
|
|
3001
3010
|
}
|
|
3002
3011
|
),
|
|
3003
3012
|
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -3008,8 +3017,8 @@ function KjunButtonGroup({
|
|
|
3008
3017
|
disabled: disabled || option.disabled,
|
|
3009
3018
|
style: {
|
|
3010
3019
|
flex: fullWidth ? 1 : void 0,
|
|
3011
|
-
paddingInline:
|
|
3012
|
-
borderRadius:
|
|
3020
|
+
paddingInline: import_tokens19.tokens.buttonGroup.itemPaddingX[size],
|
|
3021
|
+
borderRadius: import_tokens19.tokens.buttonGroup.itemRadii[size],
|
|
3013
3022
|
...selectionTypeStyle(size, value === option.value)
|
|
3014
3023
|
},
|
|
3015
3024
|
onClick: () => {
|
|
@@ -3017,9 +3026,9 @@ function KjunButtonGroup({
|
|
|
3017
3026
|
onChange == null ? void 0 : onChange(option.value);
|
|
3018
3027
|
},
|
|
3019
3028
|
children: [
|
|
3020
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
3029
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens19.tokens.extensions.selection.iconSize }),
|
|
3021
3030
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-button-group-label", children: [
|
|
3022
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens19.tokens.button.typography[size]), children: option.label }),
|
|
3023
3032
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
3024
3033
|
] })
|
|
3025
3034
|
]
|
|
@@ -3055,7 +3064,7 @@ function KjunFilterGroup({
|
|
|
3055
3064
|
{
|
|
3056
3065
|
type: "button",
|
|
3057
3066
|
className: "kjun-filter-chip",
|
|
3058
|
-
style: { borderRadius:
|
|
3067
|
+
style: { borderRadius: import_tokens19.tokens.button.radii[size] },
|
|
3059
3068
|
"aria-pressed": selected(option.value),
|
|
3060
3069
|
disabled: disabled || option.disabled,
|
|
3061
3070
|
onClick: () => {
|
|
@@ -3067,15 +3076,15 @@ function KjunFilterGroup({
|
|
|
3067
3076
|
"span",
|
|
3068
3077
|
{
|
|
3069
3078
|
style: {
|
|
3070
|
-
height:
|
|
3071
|
-
paddingInline: { xs:
|
|
3079
|
+
height: import_tokens19.tokens.button.heights[size],
|
|
3080
|
+
paddingInline: { xs: import_tokens19.tokens.dimension.value8, sm: import_tokens19.tokens.dimension.value12, md: import_tokens19.tokens.dimension.value12, lg: import_tokens19.tokens.dimension.value14, xl: import_tokens19.tokens.dimension.value16 }[size],
|
|
3072
3081
|
...selectionTypeStyle(size, selected(option.value))
|
|
3073
3082
|
},
|
|
3074
3083
|
children: [
|
|
3075
3084
|
option.dot && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { style: { background: option.dot } }),
|
|
3076
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
3085
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens19.tokens.extensions.selection.iconSize }),
|
|
3077
3086
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-filter-label", children: [
|
|
3078
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
3087
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens19.tokens.button.typography[size]), children: option.label }),
|
|
3079
3088
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
3080
3089
|
] })
|
|
3081
3090
|
]
|
|
@@ -3089,7 +3098,7 @@ function KjunFilterGroup({
|
|
|
3089
3098
|
}
|
|
3090
3099
|
|
|
3091
3100
|
// packages/react/src/floating-panel.tsx
|
|
3092
|
-
var
|
|
3101
|
+
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3093
3102
|
var import_react27 = require("react");
|
|
3094
3103
|
var import_react_aria_components4 = require("react-aria-components");
|
|
3095
3104
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
@@ -3110,7 +3119,7 @@ function FloatingPanel({
|
|
|
3110
3119
|
repositionKey = 0,
|
|
3111
3120
|
inside
|
|
3112
3121
|
}) {
|
|
3113
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3122
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens20.tokens.motion.popupExit);
|
|
3114
3123
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
3115
3124
|
const container = useKjunPortalContainer();
|
|
3116
3125
|
const panel = (0, import_react27.useRef)(null);
|
|
@@ -3121,7 +3130,7 @@ function FloatingPanel({
|
|
|
3121
3130
|
const dismissBeforeFocus = (event) => {
|
|
3122
3131
|
var _a2, _b;
|
|
3123
3132
|
const popup = panel.current, focused = document2.activeElement;
|
|
3124
|
-
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0,
|
|
3133
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0, import_tokens20.isComposingKey)(event) || !popup || popup.closest('[inert], [aria-hidden="true"]')) return;
|
|
3125
3134
|
if (focused !== document2.body && focused !== document2.documentElement && !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(focused))) return;
|
|
3126
3135
|
event.preventDefault();
|
|
3127
3136
|
event.stopPropagation();
|
|
@@ -3150,9 +3159,9 @@ function FloatingPanel({
|
|
|
3150
3159
|
UNSTABLE_portalContainer: container,
|
|
3151
3160
|
placement: placement.replace("-", " "),
|
|
3152
3161
|
shouldFlip: flip,
|
|
3153
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3154
|
-
offset: field ?
|
|
3155
|
-
containerPadding:
|
|
3162
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? import_tokens20.tokens.extensions.menu.listMaxHeight : import_tokens20.tokens.extensions.floating.maxHeight : void 0,
|
|
3163
|
+
offset: field ? import_tokens20.tokens.extensions.floating.fieldGap : import_tokens20.tokens.extensions.floating.anchorGap,
|
|
3164
|
+
containerPadding: import_tokens20.tokens.extensions.floating.viewportInset,
|
|
3156
3165
|
crossOffset: repositionKey % 2 ? 1e-3 : 0,
|
|
3157
3166
|
className: "kjun-scope kjun-floating " + className,
|
|
3158
3167
|
"data-motion": "popup",
|
|
@@ -3194,7 +3203,7 @@ function followAnchor(element, source, moved) {
|
|
|
3194
3203
|
var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidden" };
|
|
3195
3204
|
|
|
3196
3205
|
// packages/react/src/popover.tsx
|
|
3197
|
-
var
|
|
3206
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3198
3207
|
var import_react28 = require("react");
|
|
3199
3208
|
var import_react_aria_components5 = require("react-aria-components");
|
|
3200
3209
|
|
|
@@ -3259,6 +3268,15 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
3259
3268
|
|
|
3260
3269
|
// packages/react/src/popover.tsx
|
|
3261
3270
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3271
|
+
function bindPopoverTrigger(node, props) {
|
|
3272
|
+
if (!(0, import_react28.isValidElement)(node)) return node;
|
|
3273
|
+
if (node.type === KjunTooltip)
|
|
3274
|
+
return (0, import_react28.cloneElement)(node, {}, bindPopoverTrigger(node.props.children, props));
|
|
3275
|
+
if (node.type === import_react28.Fragment || typeof node.type === "string" && !["button", "a", "input", "summary"].includes(node.type) && node.props.role !== "button" && node.props.tabIndex == null) {
|
|
3276
|
+
return (0, import_react28.cloneElement)(node, {}, import_react28.Children.map(node.props.children, (child) => bindPopoverTrigger(child, props)));
|
|
3277
|
+
}
|
|
3278
|
+
return (0, import_react28.cloneElement)(node, props);
|
|
3279
|
+
}
|
|
3262
3280
|
function KjunPopover({
|
|
3263
3281
|
noPadding = false,
|
|
3264
3282
|
open: controlled,
|
|
@@ -3325,7 +3343,8 @@ function KjunPopover({
|
|
|
3325
3343
|
{
|
|
3326
3344
|
ref,
|
|
3327
3345
|
className: "kjun-layer-trigger",
|
|
3328
|
-
onClickCapture: () => {
|
|
3346
|
+
onClickCapture: (event) => {
|
|
3347
|
+
if (event.target.closest('button:disabled, [aria-disabled="true"]')) return;
|
|
3329
3348
|
if (!manualTrigger) change(!open);
|
|
3330
3349
|
},
|
|
3331
3350
|
onKeyDown: (event) => {
|
|
@@ -3334,10 +3353,11 @@ function KjunPopover({
|
|
|
3334
3353
|
change(!open);
|
|
3335
3354
|
}
|
|
3336
3355
|
},
|
|
3337
|
-
"
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3356
|
+
children: bindPopoverTrigger(typeof trigger === "function" ? trigger(open) : trigger, {
|
|
3357
|
+
"aria-haspopup": "dialog",
|
|
3358
|
+
"aria-expanded": expanded,
|
|
3359
|
+
"aria-controls": expanded ? id : void 0
|
|
3360
|
+
})
|
|
3341
3361
|
}
|
|
3342
3362
|
),
|
|
3343
3363
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -3365,7 +3385,7 @@ function KjunPopover({
|
|
|
3365
3385
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3366
3386
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3367
3387
|
className: "kjun-popover-dialog",
|
|
3368
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3388
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens21.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3369
3389
|
};
|
|
3370
3390
|
const body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3371
3391
|
header != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3378,6 +3398,11 @@ function KjunPopover({
|
|
|
3378
3398
|
)
|
|
3379
3399
|
] });
|
|
3380
3400
|
}
|
|
3401
|
+
function TooltipPanel(props) {
|
|
3402
|
+
const state = (0, import_react28.useContext)(import_react_aria_components5.TooltipTriggerStateContext);
|
|
3403
|
+
if (state && !state.isOpen && state.shouldSkipAnimation) return null;
|
|
3404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.Tooltip, { ...props });
|
|
3405
|
+
}
|
|
3381
3406
|
function KjunTooltip({
|
|
3382
3407
|
content = "",
|
|
3383
3408
|
title,
|
|
@@ -3390,25 +3415,29 @@ function KjunTooltip({
|
|
|
3390
3415
|
children
|
|
3391
3416
|
}) {
|
|
3392
3417
|
const container = useKjunPortalContainer();
|
|
3393
|
-
const
|
|
3418
|
+
const hasContent2 = !!(content || title);
|
|
3419
|
+
const [internal, setInternal] = (0, import_react28.useState)(false), open = (controlled != null ? controlled : internal) && hasContent2;
|
|
3420
|
+
(0, import_react28.useEffect)(() => {
|
|
3421
|
+
if (!hasContent2) setInternal(false);
|
|
3422
|
+
}, [hasContent2]);
|
|
3394
3423
|
const setOpen = (value) => {
|
|
3395
3424
|
setInternal(value);
|
|
3396
3425
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
3397
3426
|
};
|
|
3398
3427
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
3399
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_aria_components5.TooltipTrigger, { isOpen: open && !layer.blocked
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_aria_components5.TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !hasContent2 || !layer.scopeActive, children: [
|
|
3400
3429
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.Focusable, { children }),
|
|
3401
|
-
container !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3402
|
-
|
|
3430
|
+
container !== null && hasContent2 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3431
|
+
TooltipPanel,
|
|
3403
3432
|
{
|
|
3404
3433
|
style: { zIndex: layer.zIndex, ...width ? { maxWidth: `var(--_kjun-extension-tooltip-max-widths-${width})` } : {} },
|
|
3405
3434
|
"data-align": align,
|
|
3406
3435
|
UNSTABLE_portalContainer: container,
|
|
3407
3436
|
placement,
|
|
3408
|
-
offset:
|
|
3437
|
+
offset: import_tokens21.tokens.extensions.floating.anchorGap,
|
|
3409
3438
|
className: "kjun-scope kjun-tooltip",
|
|
3410
3439
|
children: [
|
|
3411
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width:
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: import_tokens21.tokens.extensions.tooltip.arrowSize, height: import_tokens21.tokens.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
3412
3441
|
title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3413
3442
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "kjun-tooltip-title", children: title }),
|
|
3414
3443
|
content && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "kjun-tooltip-body", children: content })
|
|
@@ -3420,7 +3449,7 @@ function KjunTooltip({
|
|
|
3420
3449
|
}
|
|
3421
3450
|
|
|
3422
3451
|
// packages/react/src/dropdown.tsx
|
|
3423
|
-
var
|
|
3452
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3424
3453
|
var import_react29 = require("react");
|
|
3425
3454
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3426
3455
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -3571,14 +3600,14 @@ function KjunDropdownItem({
|
|
|
3571
3600
|
close == null ? void 0 : close();
|
|
3572
3601
|
},
|
|
3573
3602
|
children: [
|
|
3574
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3603
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size: import_tokens22.tokens.extensions.menu.iconSize }),
|
|
3575
3604
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children }),
|
|
3576
3605
|
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3577
3606
|
KjunIcon,
|
|
3578
3607
|
{
|
|
3579
3608
|
name: "check",
|
|
3580
3609
|
className: "kjun-menu-check",
|
|
3581
|
-
size:
|
|
3610
|
+
size: import_tokens22.tokens.extensions.menu.iconSize,
|
|
3582
3611
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3583
3612
|
}
|
|
3584
3613
|
)
|
|
@@ -3645,7 +3674,7 @@ function KjunMenuButton({
|
|
|
3645
3674
|
}
|
|
3646
3675
|
|
|
3647
3676
|
// packages/react/src/drawer.tsx
|
|
3648
|
-
var
|
|
3677
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
3649
3678
|
|
|
3650
3679
|
// shared/package-runtime/drawer-geometry.ts
|
|
3651
3680
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3664,7 +3693,7 @@ function KjunDrawer({
|
|
|
3664
3693
|
onOpenChange,
|
|
3665
3694
|
title,
|
|
3666
3695
|
position = "right",
|
|
3667
|
-
width =
|
|
3696
|
+
width = import_tokens23.tokens.extensions.drawer.width,
|
|
3668
3697
|
closable = true,
|
|
3669
3698
|
closeOnOverlay = true,
|
|
3670
3699
|
closeOnEsc = true,
|
|
@@ -3680,7 +3709,7 @@ function KjunDrawer({
|
|
|
3680
3709
|
maxHeight
|
|
3681
3710
|
}) {
|
|
3682
3711
|
const m = useKjunMessages();
|
|
3683
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3712
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens23.tokens.motion.layerExit);
|
|
3684
3713
|
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3685
3714
|
const container = useKjunPortalContainer();
|
|
3686
3715
|
const close = () => {
|
|
@@ -3737,8 +3766,8 @@ function KjunDrawer({
|
|
|
3737
3766
|
variant: "ghost",
|
|
3738
3767
|
ariaLabel: m.close,
|
|
3739
3768
|
onClick: close,
|
|
3740
|
-
style: { borderRadius:
|
|
3741
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size:
|
|
3769
|
+
style: { borderRadius: import_tokens23.tokens.extensions.drawer.closeRadius, width: import_tokens23.tokens.extensions.drawer.closeSize, height: import_tokens23.tokens.extensions.drawer.closeSize, padding: 0 },
|
|
3770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size: import_tokens23.tokens.extensions.drawer.closeIconSize })
|
|
3742
3771
|
}
|
|
3743
3772
|
)
|
|
3744
3773
|
] }),
|
|
@@ -3746,7 +3775,7 @@ function KjunDrawer({
|
|
|
3746
3775
|
"div",
|
|
3747
3776
|
{
|
|
3748
3777
|
className: "kjun-drawer-body",
|
|
3749
|
-
style: { padding: noPadding ? 0 :
|
|
3778
|
+
style: { padding: noPadding ? 0 : import_tokens23.tokens.extensions.drawer.bodyPadding },
|
|
3750
3779
|
children
|
|
3751
3780
|
}
|
|
3752
3781
|
),
|
|
@@ -4111,7 +4140,7 @@ function SearchField({
|
|
|
4111
4140
|
}
|
|
4112
4141
|
|
|
4113
4142
|
// packages/react/src/date-picker.tsx
|
|
4114
|
-
var
|
|
4143
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
4115
4144
|
var import_react32 = require("react");
|
|
4116
4145
|
var import_jsx_runtime20 = (
|
|
4117
4146
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
@@ -4136,8 +4165,8 @@ function KjunDatePicker({
|
|
|
4136
4165
|
const clear = clearable && !!value && !props.disabled && !props.readOnly;
|
|
4137
4166
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
4138
4167
|
position: "relative",
|
|
4139
|
-
["--_kjun-date-icon-inset"]:
|
|
4140
|
-
["--_kjun-date-icon-size"]:
|
|
4168
|
+
["--_kjun-date-icon-inset"]: import_tokens24.tokens.input[size].padding + "px",
|
|
4169
|
+
["--_kjun-date-icon-size"]: import_tokens24.tokens.input[size].iconSize + "px"
|
|
4141
4170
|
}, children: [
|
|
4142
4171
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4143
4172
|
KjunInput,
|
|
@@ -4167,8 +4196,8 @@ function KjunDatePicker({
|
|
|
4167
4196
|
"aria-hidden": "true",
|
|
4168
4197
|
className: "kjun-date-overlay",
|
|
4169
4198
|
style: {
|
|
4170
|
-
left:
|
|
4171
|
-
right:
|
|
4199
|
+
left: import_tokens24.tokens.input[size].padding,
|
|
4200
|
+
right: import_tokens24.tokens.input[size].padding + import_tokens24.tokens.input[size].iconSize + import_tokens24.tokens.input[size].affixGap + (clear ? import_tokens24.tokens.input[size].clearSize + import_tokens24.tokens.input[size].affixGap : 0),
|
|
4172
4201
|
...inputTypeStyle(size),
|
|
4173
4202
|
color: props.disabled ? "var(--_kjun-color-text-disabled)" : props.readOnly ? "var(--_kjun-color-text-secondary)" : value ? "var(--_kjun-color-text)" : "var(--_kjun-color-input-placeholder)"
|
|
4174
4203
|
},
|
|
@@ -4184,14 +4213,14 @@ function KjunDatePicker({
|
|
|
4184
4213
|
className: "kjun-select-clear",
|
|
4185
4214
|
style: {
|
|
4186
4215
|
padding: 0,
|
|
4187
|
-
right:
|
|
4188
|
-
width:
|
|
4189
|
-
height:
|
|
4190
|
-
minHeight:
|
|
4216
|
+
right: import_tokens24.tokens.input[size].padding + import_tokens24.tokens.input[size].iconSize + import_tokens24.tokens.input[size].affixGap,
|
|
4217
|
+
width: import_tokens24.tokens.input[size].clearSize,
|
|
4218
|
+
height: import_tokens24.tokens.input[size].clearSize,
|
|
4219
|
+
minHeight: import_tokens24.tokens.input[size].clearSize,
|
|
4191
4220
|
borderRadius: "50%"
|
|
4192
4221
|
},
|
|
4193
4222
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
4194
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size:
|
|
4223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size: import_tokens24.tokens.input[size].iconSize })
|
|
4195
4224
|
}
|
|
4196
4225
|
)
|
|
4197
4226
|
] });
|
|
@@ -4377,7 +4406,7 @@ function KjunSearchInput({
|
|
|
4377
4406
|
}
|
|
4378
4407
|
|
|
4379
4408
|
// packages/react/src/select-control.tsx
|
|
4380
|
-
var
|
|
4409
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4381
4410
|
var import_react37 = require("react");
|
|
4382
4411
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4383
4412
|
|
|
@@ -4459,7 +4488,7 @@ function KjunSelect({
|
|
|
4459
4488
|
const composition = useCompositionGuard();
|
|
4460
4489
|
const ref = (0, import_react37.useRef)(null), menu = (0, import_react37.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react37.useId)();
|
|
4461
4490
|
const segment = (0, import_react37.useContext)(CompoundControlContext) !== null;
|
|
4462
|
-
const spec =
|
|
4491
|
+
const spec = import_tokens25.tokens.input[size];
|
|
4463
4492
|
const expanded = usePopupExpanded(open, ref);
|
|
4464
4493
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4465
4494
|
(0, import_react37.useEffect)(() => {
|
|
@@ -4513,7 +4542,7 @@ function KjunSelect({
|
|
|
4513
4542
|
borderRadius: spec.radius,
|
|
4514
4543
|
...inputTypeStyle(size),
|
|
4515
4544
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4516
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4545
|
+
...segment ? {} : { paddingInline: spec.padding - import_tokens25.tokens.border.controlWidth }
|
|
4517
4546
|
},
|
|
4518
4547
|
onClick: () => changeOpen(!open),
|
|
4519
4548
|
onKeyDown: (e) => {
|
|
@@ -4524,7 +4553,7 @@ function KjunSelect({
|
|
|
4524
4553
|
},
|
|
4525
4554
|
children: [
|
|
4526
4555
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: !label ? "kjun-placeholder" : void 0, style: { flex: 1, paddingRight: clearable && label ? spec.clearSize + spec.affixGap : void 0 }, children: (renderSelected == null ? void 0 : renderSelected(selectedOption)) || label || placeholder }),
|
|
4527
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ?
|
|
4556
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? import_tokens25.tokens.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
4528
4557
|
]
|
|
4529
4558
|
}
|
|
4530
4559
|
),
|
|
@@ -4629,7 +4658,7 @@ function KjunSelect({
|
|
|
4629
4658
|
className: "kjun-option",
|
|
4630
4659
|
children: [
|
|
4631
4660
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4632
|
-
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size:
|
|
4661
|
+
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size: import_tokens25.tokens.extensions.menu.iconSize })
|
|
4633
4662
|
]
|
|
4634
4663
|
},
|
|
4635
4664
|
key
|
|
@@ -4655,10 +4684,10 @@ function KjunSelect({
|
|
|
4655
4684
|
}
|
|
4656
4685
|
|
|
4657
4686
|
// packages/react/src/navigation.tsx
|
|
4658
|
-
var
|
|
4687
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
4659
4688
|
|
|
4660
4689
|
// packages/react/src/collapse.tsx
|
|
4661
|
-
var
|
|
4690
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4662
4691
|
var import_react38 = require("react");
|
|
4663
4692
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4664
4693
|
function Collapse({ open, keepMounted = false, children }) {
|
|
@@ -4696,8 +4725,8 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4696
4725
|
}
|
|
4697
4726
|
el.style.height = end + "px";
|
|
4698
4727
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4699
|
-
duration:
|
|
4700
|
-
easing:
|
|
4728
|
+
duration: import_tokens26.tokens.motion.collapse,
|
|
4729
|
+
easing: import_tokens26.tokens.motion.easeOut
|
|
4701
4730
|
});
|
|
4702
4731
|
animation.current = transition;
|
|
4703
4732
|
transition.onfinish = finish;
|
|
@@ -4828,6 +4857,9 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4828
4857
|
var import_react40 = require("react");
|
|
4829
4858
|
var import_react_aria_components9 = require("react-aria-components");
|
|
4830
4859
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4860
|
+
function TabActions({ children }) {
|
|
4861
|
+
return (0, import_react40.useContext)(import_react_aria_components9.TabListStateContext) ? children : null;
|
|
4862
|
+
}
|
|
4831
4863
|
function KjunTabs({
|
|
4832
4864
|
value,
|
|
4833
4865
|
items = [],
|
|
@@ -4835,6 +4867,8 @@ function KjunTabs({
|
|
|
4835
4867
|
variant = "underline",
|
|
4836
4868
|
actions,
|
|
4837
4869
|
children,
|
|
4870
|
+
stickyHeader = false,
|
|
4871
|
+
stickyOffset = 0,
|
|
4838
4872
|
ariaLabel,
|
|
4839
4873
|
onValueChange,
|
|
4840
4874
|
onChange,
|
|
@@ -4878,7 +4912,7 @@ function KjunTabs({
|
|
|
4878
4912
|
onChange == null ? void 0 : onChange(name);
|
|
4879
4913
|
};
|
|
4880
4914
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4881
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components9.TabListStateContext.Provider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4882
4916
|
import_react_aria_components9.Tabs,
|
|
4883
4917
|
{
|
|
4884
4918
|
selectedKey: value,
|
|
@@ -4887,73 +4921,81 @@ function KjunTabs({
|
|
|
4887
4921
|
"data-variant": variant,
|
|
4888
4922
|
"data-density": density,
|
|
4889
4923
|
children: [
|
|
4890
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
className: "kjun-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4924
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4925
|
+
"div",
|
|
4926
|
+
{
|
|
4927
|
+
className: "kjun-tabs-header",
|
|
4928
|
+
"data-sticky": stickyHeader || void 0,
|
|
4929
|
+
style: stickyHeader ? { position: "sticky", top: stickyOffset, zIndex: import_tokens27.tokens.layers.page.sticky, background: "var(--_kjun-color-surface)" } : void 0,
|
|
4930
|
+
children: [
|
|
4931
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-tabs-track", ref: group, tabIndex: -1, children: [
|
|
4932
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components9.TabList, { "aria-label": ariaLabel, className: "kjun-tabs-list", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4933
|
+
import_react_aria_components9.Tab,
|
|
4934
|
+
{
|
|
4935
|
+
id: tab.name,
|
|
4936
|
+
"data-tab-name": tab.name,
|
|
4937
|
+
isDisabled: tab.disabled,
|
|
4938
|
+
className: "kjun-tab",
|
|
4939
|
+
onContextMenu: (event) => {
|
|
4940
|
+
if (onTabMenu && !tab.disabled) {
|
|
4941
|
+
event.preventDefault();
|
|
4942
|
+
onTabMenu({
|
|
4943
|
+
name: tab.name,
|
|
4944
|
+
x: event.clientX,
|
|
4945
|
+
y: event.clientY,
|
|
4946
|
+
pointer: "mouse"
|
|
4947
|
+
});
|
|
4948
|
+
}
|
|
4949
|
+
},
|
|
4950
|
+
onTouchStart: (event) => {
|
|
4951
|
+
clear();
|
|
4952
|
+
if (!canOpenMenu(tab.name)) return;
|
|
4953
|
+
const touch = event.touches[0];
|
|
4954
|
+
if (!touch) return;
|
|
4955
|
+
press.current = { name: tab.name, x: touch.clientX, y: touch.clientY };
|
|
4956
|
+
timer.current = setTimeout(() => {
|
|
4957
|
+
var _a2, _b;
|
|
4958
|
+
const pending = press.current;
|
|
4959
|
+
clear();
|
|
4960
|
+
if (pending && canOpenMenu(pending.name))
|
|
4961
|
+
(_b = (_a2 = menuState.current).onTabMenu) == null ? void 0 : _b.call(_a2, { ...pending, pointer: "touch" });
|
|
4962
|
+
}, 500);
|
|
4963
|
+
},
|
|
4964
|
+
onTouchMove: (event) => {
|
|
4965
|
+
const touch = event.touches[0];
|
|
4966
|
+
if (press.current && touch && (Math.abs(touch.clientX - press.current.x) > 10 || Math.abs(touch.clientY - press.current.y) > 10))
|
|
4967
|
+
clear();
|
|
4968
|
+
},
|
|
4969
|
+
onTouchEnd: clear,
|
|
4970
|
+
onTouchCancel: clear,
|
|
4971
|
+
children: [
|
|
4972
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: tab.icon, size: import_tokens27.tokens.extensions.tabs.iconSize }),
|
|
4973
|
+
" ",
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: tab.label }) }),
|
|
4975
|
+
tab.badge != null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4976
|
+
"span",
|
|
4977
|
+
{
|
|
4978
|
+
className: "kjun-tab-badge",
|
|
4979
|
+
style: {
|
|
4980
|
+
color: tab.badgeVariant ? `var(--_kjun-color-${tab.badgeVariant})` : void 0
|
|
4981
|
+
},
|
|
4982
|
+
children: tab.badge
|
|
4983
|
+
}
|
|
4984
|
+
)
|
|
4985
|
+
]
|
|
4986
|
+
},
|
|
4987
|
+
tab.name
|
|
4988
|
+
)) }),
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4990
|
+
] }),
|
|
4991
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TabActions, { children: actions })
|
|
4992
|
+
]
|
|
4993
|
+
}
|
|
4994
|
+
),
|
|
4953
4995
|
children && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "kjun-tab-content", children })
|
|
4954
4996
|
]
|
|
4955
4997
|
}
|
|
4956
|
-
);
|
|
4998
|
+
) });
|
|
4957
4999
|
}
|
|
4958
5000
|
function KjunTabPane({ name, children }) {
|
|
4959
5001
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -5032,7 +5074,7 @@ function KjunAccordionItem({
|
|
|
5032
5074
|
{
|
|
5033
5075
|
name: "chevron-down",
|
|
5034
5076
|
className: "kjun-accordion-chevron",
|
|
5035
|
-
size:
|
|
5077
|
+
size: import_tokens27.tokens.extensions.accordion.iconSize,
|
|
5036
5078
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
5037
5079
|
}
|
|
5038
5080
|
)
|
|
@@ -5060,12 +5102,12 @@ function KjunBreadcrumb({
|
|
|
5060
5102
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
5061
5103
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
5062
5104
|
const label = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
5063
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size:
|
|
5105
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size: import_tokens27.tokens.extensions.breadcrumb.iconSize }),
|
|
5064
5106
|
" ",
|
|
5065
5107
|
item.label
|
|
5066
5108
|
] });
|
|
5067
5109
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react40.Fragment, { children: [
|
|
5068
|
-
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size:
|
|
5110
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens27.tokens.extensions.breadcrumb.separatorSize }),
|
|
5069
5111
|
" ",
|
|
5070
5112
|
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { href: item.to, children: label }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-current": i === items.length - 1 ? "page" : void 0, children: label })
|
|
5071
5113
|
] }, i);
|
|
@@ -5112,7 +5154,7 @@ function KjunPagination({
|
|
|
5112
5154
|
"aria-label": label,
|
|
5113
5155
|
disabled: target < 1 || target > totalPages || target === current,
|
|
5114
5156
|
onClick: () => change(target),
|
|
5115
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size:
|
|
5157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size: import_tokens27.tokens.extensions.pagination.iconSize })
|
|
5116
5158
|
}
|
|
5117
5159
|
);
|
|
5118
5160
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -5165,7 +5207,7 @@ function KjunPagination({
|
|
|
5165
5207
|
}
|
|
5166
5208
|
|
|
5167
5209
|
// packages/react/src/actions.tsx
|
|
5168
|
-
var
|
|
5210
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
5169
5211
|
var import_react41 = require("react");
|
|
5170
5212
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5171
5213
|
function KjunIconToggle({
|
|
@@ -5207,7 +5249,7 @@ function KjunIconToggle({
|
|
|
5207
5249
|
{
|
|
5208
5250
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
5209
5251
|
filled: active,
|
|
5210
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5252
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens28.tokens.button.iconSizes[size],
|
|
5211
5253
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
5212
5254
|
className: active ? activeColorClass : inactiveColorClass,
|
|
5213
5255
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5267,9 +5309,9 @@ function KjunCopyButton({
|
|
|
5267
5309
|
"data-inline": inline,
|
|
5268
5310
|
style: {
|
|
5269
5311
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5270
|
-
minHeight:
|
|
5312
|
+
minHeight: import_tokens28.tokens.button.heights[size],
|
|
5271
5313
|
paddingBlock: 0,
|
|
5272
|
-
paddingInline: { xs:
|
|
5314
|
+
paddingInline: { xs: import_tokens28.tokens.dimension.value4, sm: import_tokens28.tokens.dimension.value8, md: import_tokens28.tokens.dimension.value12 }[size]
|
|
5273
5315
|
},
|
|
5274
5316
|
onClick: async (event) => {
|
|
5275
5317
|
event.stopPropagation();
|
|
@@ -5299,7 +5341,7 @@ function KjunCopyButton({
|
|
|
5299
5341
|
KjunIcon,
|
|
5300
5342
|
{
|
|
5301
5343
|
name: copied ? "check" : "copy",
|
|
5302
|
-
size:
|
|
5344
|
+
size: import_tokens28.tokens.button.iconSizes[size],
|
|
5303
5345
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5304
5346
|
}
|
|
5305
5347
|
),
|
|
@@ -5373,7 +5415,7 @@ function KjunExternalLink({
|
|
|
5373
5415
|
onClick: (e) => e.stopPropagation(),
|
|
5374
5416
|
children: [
|
|
5375
5417
|
body,
|
|
5376
|
-
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size:
|
|
5418
|
+
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size: import_tokens28.tokens.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5377
5419
|
!name && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5378
5420
|
]
|
|
5379
5421
|
}
|
|
@@ -5401,7 +5443,7 @@ function KjunScrollFade({ children }) {
|
|
|
5401
5443
|
}
|
|
5402
5444
|
return () => observer.disconnect();
|
|
5403
5445
|
}, [children]);
|
|
5404
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5446
|
+
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${import_tokens28.tokens.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${import_tokens28.tokens.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
5405
5447
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5406
5448
|
"div",
|
|
5407
5449
|
{
|
|
@@ -5415,7 +5457,7 @@ function KjunScrollFade({ children }) {
|
|
|
5415
5457
|
}
|
|
5416
5458
|
|
|
5417
5459
|
// packages/react/src/data-state.tsx
|
|
5418
|
-
var
|
|
5460
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
5419
5461
|
var import_react43 = require("react");
|
|
5420
5462
|
|
|
5421
5463
|
// shared/package-runtime/use-loading-reveal.ts
|
|
@@ -5435,13 +5477,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
5435
5477
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5436
5478
|
function useQueryDisplay(props) {
|
|
5437
5479
|
var _a;
|
|
5438
|
-
const [state, setState] = (0, import_react43.useState)(() => (0,
|
|
5480
|
+
const [state, setState] = (0, import_react43.useState)(() => (0, import_tokens29.initialQueryDisplay)(props));
|
|
5439
5481
|
let next = state;
|
|
5440
5482
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
5441
|
-
next = (0,
|
|
5483
|
+
next = (0, import_tokens29.advanceQueryDisplay)(state, props);
|
|
5442
5484
|
setState(next);
|
|
5443
5485
|
}
|
|
5444
|
-
return (0,
|
|
5486
|
+
return (0, import_tokens29.queryDisplayStatus)(next, props);
|
|
5445
5487
|
}
|
|
5446
5488
|
function KjunDataState({
|
|
5447
5489
|
preserveContent = false,
|
|
@@ -5473,7 +5515,7 @@ function KjunDataState({
|
|
|
5473
5515
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5474
5516
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5475
5517
|
retryText != null ? retryText : retryText = m.retry;
|
|
5476
|
-
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 =
|
|
5518
|
+
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_tokens29.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5477
5519
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5478
5520
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-status", role: "status", children: [
|
|
5479
5521
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "xs" }),
|
|
@@ -5487,7 +5529,7 @@ function KjunDataState({
|
|
|
5487
5529
|
"aria-label": revealed ? loadingText : void 0,
|
|
5488
5530
|
"aria-hidden": revealed ? void 0 : true,
|
|
5489
5531
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5490
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap:
|
|
5532
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap: import_tokens29.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-loading", children: [
|
|
5491
5533
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "md" }),
|
|
5492
5534
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: loadingText })
|
|
5493
5535
|
] }))
|
|
@@ -5500,7 +5542,7 @@ function KjunDataState({
|
|
|
5500
5542
|
"aria-hidden": concealed || void 0,
|
|
5501
5543
|
inert: concealed || void 0,
|
|
5502
5544
|
style: {
|
|
5503
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5545
|
+
opacity: query2.loading && !state.usesQueryState ? import_tokens29.tokens.states.opacity.pending : void 0
|
|
5504
5546
|
},
|
|
5505
5547
|
children
|
|
5506
5548
|
},
|
|
@@ -5542,7 +5584,7 @@ var KjunErrorBoundary = class extends import_react43.Component {
|
|
|
5542
5584
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5543
5585
|
|
|
5544
5586
|
// packages/react/src/skeletons.tsx
|
|
5545
|
-
var
|
|
5587
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5546
5588
|
|
|
5547
5589
|
// shared/package-runtime/chart-skeleton.ts
|
|
5548
5590
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5559,11 +5601,11 @@ function chartSkeletonKind(kind) {
|
|
|
5559
5601
|
}
|
|
5560
5602
|
|
|
5561
5603
|
// packages/react/src/market-skeleton.tsx
|
|
5562
|
-
var
|
|
5604
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5563
5605
|
|
|
5564
5606
|
// shared/package-runtime/market-layout.ts
|
|
5565
|
-
var
|
|
5566
|
-
var marketGeometry =
|
|
5607
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
5608
|
+
var marketGeometry = import_tokens30.tokens.extensions.marketTable;
|
|
5567
5609
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5568
5610
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5569
5611
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5604,15 +5646,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5604
5646
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-hidden": "true", className: "kjun-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("table", { className: "kjun-market-table-grid", style: webMarketLayout(cols, showActions, widthClass).tableStyle, children: [
|
|
5605
5647
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5606
5648
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5607
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5649
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens31.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens31.tokens.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5608
5650
|
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: col.label }, col.key || i))
|
|
5609
5651
|
] }) }),
|
|
5610
5652
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5611
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5653
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens31.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens31.tokens.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5612
5654
|
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-market-skeleton-identity", children: [
|
|
5613
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5614
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5615
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens31.tokens.extensions.skeleton.lineHeights.md }),
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens31.tokens.extensions.skeleton.lineHeights.sm })
|
|
5657
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens31.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens31.tokens.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
5616
5658
|
] }, row)) })
|
|
5617
5659
|
] }) });
|
|
5618
5660
|
}
|
|
@@ -5623,7 +5665,7 @@ function KjunListSkeleton({
|
|
|
5623
5665
|
rows = 8,
|
|
5624
5666
|
variant = "market",
|
|
5625
5667
|
avatar = true,
|
|
5626
|
-
avatarSize =
|
|
5668
|
+
avatarSize = import_tokens32.tokens.extensions.skeleton.listAvatarSize,
|
|
5627
5669
|
quote = true
|
|
5628
5670
|
}) {
|
|
5629
5671
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-row", "data-variant": variant, children: [
|
|
@@ -5633,15 +5675,15 @@ function KjunListSkeleton({
|
|
|
5633
5675
|
KjunSkeleton,
|
|
5634
5676
|
{
|
|
5635
5677
|
type: "block",
|
|
5636
|
-
height:
|
|
5678
|
+
height: import_tokens32.tokens.extensions.skeleton.lineHeights.md,
|
|
5637
5679
|
width: i % 2 ? "80%" : "65%"
|
|
5638
5680
|
}
|
|
5639
5681
|
),
|
|
5640
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5682
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens32.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5641
5683
|
] }),
|
|
5642
5684
|
quote && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5643
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5644
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens32.tokens.extensions.skeleton.quoteHeight, width: import_tokens32.tokens.extensions.skeleton.quoteWidth }),
|
|
5686
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens32.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens32.tokens.extensions.skeleton.detailWidth })
|
|
5645
5687
|
] })
|
|
5646
5688
|
] }, i)) });
|
|
5647
5689
|
}
|
|
@@ -5657,17 +5699,17 @@ function KjunFormSkeleton({
|
|
|
5657
5699
|
"aria-hidden": "true",
|
|
5658
5700
|
className: "kjun-form-skeleton",
|
|
5659
5701
|
"data-columns": columns,
|
|
5660
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5702
|
+
style: { "--_kjun-form-skeleton-radius": `${import_tokens32.tokens.input[size].radius}px` },
|
|
5661
5703
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5662
5704
|
field ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5663
5705
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5664
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5706
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens32.tokens.extensions.skeleton.formLabelHeight, width: import_tokens32.tokens.extensions.skeleton.formLabelWidth }) })
|
|
5665
5707
|
),
|
|
5666
5708
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5667
5709
|
KjunSkeleton,
|
|
5668
5710
|
{
|
|
5669
5711
|
type: "block",
|
|
5670
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5712
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? import_tokens32.tokens.input[size].lineHeight * 3 + import_tokens32.tokens.input[size].textareaPaddingY * 2 + 2 * import_tokens32.tokens.border.controlWidth : import_tokens32.tokens.input[size].height
|
|
5671
5713
|
}
|
|
5672
5714
|
)
|
|
5673
5715
|
] }, i))
|
|
@@ -5676,7 +5718,7 @@ function KjunFormSkeleton({
|
|
|
5676
5718
|
}
|
|
5677
5719
|
function KjunChartSkeleton({
|
|
5678
5720
|
kind: requestedKind = "frame",
|
|
5679
|
-
height =
|
|
5721
|
+
height = import_tokens32.tokens.extensions.chartSkeleton.height,
|
|
5680
5722
|
loadingText,
|
|
5681
5723
|
skeleton = true,
|
|
5682
5724
|
loadingDelay = 0,
|
|
@@ -5732,7 +5774,7 @@ function KjunChartSkeleton({
|
|
|
5732
5774
|
d: chartFramePath,
|
|
5733
5775
|
fill: "none",
|
|
5734
5776
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5735
|
-
strokeWidth:
|
|
5777
|
+
strokeWidth: import_tokens32.tokens.border.defaultWidth,
|
|
5736
5778
|
vectorEffect: "non-scaling-stroke"
|
|
5737
5779
|
}
|
|
5738
5780
|
)
|
|
@@ -5745,17 +5787,17 @@ function KjunChartSkeleton({
|
|
|
5745
5787
|
}
|
|
5746
5788
|
|
|
5747
5789
|
// packages/react/src/financial-display.tsx
|
|
5748
|
-
var
|
|
5790
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5749
5791
|
var import_react45 = require("react");
|
|
5750
5792
|
|
|
5751
5793
|
// packages/react/src/number-display.tsx
|
|
5752
|
-
var
|
|
5794
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5753
5795
|
|
|
5754
5796
|
// shared/package-runtime/use-number-motion.ts
|
|
5755
5797
|
var import_react44 = require("react");
|
|
5756
5798
|
|
|
5757
5799
|
// shared/package-runtime/number-motion.ts
|
|
5758
|
-
var
|
|
5800
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5759
5801
|
function createNumberMotion(apply) {
|
|
5760
5802
|
let frame = 0, revision = 0, current = 0;
|
|
5761
5803
|
let previous;
|
|
@@ -5786,7 +5828,7 @@ function createNumberMotion(apply) {
|
|
|
5786
5828
|
if (from === target) return;
|
|
5787
5829
|
const tick = (now) => {
|
|
5788
5830
|
if (version !== revision) return;
|
|
5789
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5831
|
+
const progress = Math.min(1, Math.max(0, (now - started) / import_tokens33.tokens.motion.number));
|
|
5790
5832
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5791
5833
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5792
5834
|
};
|
|
@@ -5865,7 +5907,7 @@ function KjunPriceCell({
|
|
|
5865
5907
|
flashClass = "",
|
|
5866
5908
|
fromPrevious = true
|
|
5867
5909
|
}) {
|
|
5868
|
-
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height:
|
|
5910
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height: import_tokens34.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens34.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5869
5911
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5870
5912
|
"span",
|
|
5871
5913
|
{
|
|
@@ -5913,7 +5955,7 @@ function KjunSignedValue({
|
|
|
5913
5955
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5914
5956
|
},
|
|
5915
5957
|
children: [
|
|
5916
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width:
|
|
5958
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width: import_tokens34.tokens.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5917
5959
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunFreshness, { stale: true })
|
|
5918
5960
|
]
|
|
5919
5961
|
}
|
|
@@ -5922,7 +5964,7 @@ function KjunSignedValue({
|
|
|
5922
5964
|
|
|
5923
5965
|
// packages/react/src/financial-display.tsx
|
|
5924
5966
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5925
|
-
var deviationFill = { neutral: 1, low:
|
|
5967
|
+
var deviationFill = { neutral: 1, low: import_tokens35.tokens.states.opacity.deviationLow, medium: import_tokens35.tokens.states.opacity.deviationMedium, strong: import_tokens35.tokens.states.opacity.deviationStrong };
|
|
5926
5968
|
function KjunDeviation({
|
|
5927
5969
|
value,
|
|
5928
5970
|
variant = "pill",
|
|
@@ -5934,7 +5976,7 @@ function KjunDeviation({
|
|
|
5934
5976
|
const n = finiteNumber(value);
|
|
5935
5977
|
if (n === null)
|
|
5936
5978
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5937
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0,
|
|
5979
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens35.deviationLevel)(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
5938
5980
|
if (variant === "badge")
|
|
5939
5981
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5940
5982
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -5954,7 +5996,7 @@ function KjunDeviation({
|
|
|
5954
5996
|
KjunIcon,
|
|
5955
5997
|
{
|
|
5956
5998
|
name: "alert-triangle",
|
|
5957
|
-
size:
|
|
5999
|
+
size: import_tokens35.tokens.extensions.financial.warningIconSize,
|
|
5958
6000
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5959
6001
|
}
|
|
5960
6002
|
) })
|
|
@@ -5967,7 +6009,7 @@ function KjunDeviation({
|
|
|
5967
6009
|
className: "kjun-deviation",
|
|
5968
6010
|
ref: domainColorRef(!neutral),
|
|
5969
6011
|
"data-variant": variant,
|
|
5970
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
6012
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens35.tokens.typography.numberLg.fontWeight : import_tokens35.tokens.typography.control.fontWeight },
|
|
5971
6013
|
children: [
|
|
5972
6014
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5973
6015
|
"span",
|
|
@@ -5995,7 +6037,7 @@ function KjunHeatmapCell({
|
|
|
5995
6037
|
}) {
|
|
5996
6038
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5997
6039
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5998
|
-
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } =
|
|
6040
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = import_tokens35.tokens.states.opacity;
|
|
5999
6041
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
6000
6042
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6001
6043
|
"span",
|
|
@@ -6014,7 +6056,7 @@ function KjunProgressCell({
|
|
|
6014
6056
|
showLabel = true,
|
|
6015
6057
|
color = "auto",
|
|
6016
6058
|
customColor,
|
|
6017
|
-
height =
|
|
6059
|
+
height = import_tokens35.tokens.extensions.financial.progressHeight
|
|
6018
6060
|
}) {
|
|
6019
6061
|
const percent = max > 0 && Number.isFinite(value) ? Math.min(100, Math.max(0, value / max * 100)) : 0, role2 = color === "auto" ? percent < 30 ? "danger" : percent < 70 ? "warning" : "success" : color;
|
|
6020
6062
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
@@ -6038,7 +6080,7 @@ function KjunCollectionMark({
|
|
|
6038
6080
|
active = false,
|
|
6039
6081
|
size = "md"
|
|
6040
6082
|
}) {
|
|
6041
|
-
const box =
|
|
6083
|
+
const box = import_tokens35.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens35.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
6042
6084
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6043
6085
|
KjunIcon,
|
|
6044
6086
|
{
|
|
@@ -6074,8 +6116,8 @@ function KjunExecutionStatusBadge({
|
|
|
6074
6116
|
}
|
|
6075
6117
|
function KjunSparkline({
|
|
6076
6118
|
data = [],
|
|
6077
|
-
width =
|
|
6078
|
-
height =
|
|
6119
|
+
width = import_tokens35.tokens.extensions.financial.sparklineWidth,
|
|
6120
|
+
height = import_tokens35.tokens.extensions.financial.sparklineHeight,
|
|
6079
6121
|
color,
|
|
6080
6122
|
semantic = "price",
|
|
6081
6123
|
fill = true,
|
|
@@ -6130,7 +6172,7 @@ function KjunSparkline({
|
|
|
6130
6172
|
}
|
|
6131
6173
|
|
|
6132
6174
|
// shared/package-runtime/table.ts
|
|
6133
|
-
var
|
|
6175
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6134
6176
|
var import_react46 = require("react");
|
|
6135
6177
|
|
|
6136
6178
|
// shared/package-runtime/table-model.ts
|
|
@@ -6204,7 +6246,7 @@ function useTableModel(props) {
|
|
|
6204
6246
|
sortColumn: (col) => {
|
|
6205
6247
|
var _a2;
|
|
6206
6248
|
if (!sortable || !col.sortable) return;
|
|
6207
|
-
const next = (0,
|
|
6249
|
+
const next = (0, import_tokens36.nextTableSort)(sort, col.key);
|
|
6208
6250
|
if (props.sort === void 0) setSort(next);
|
|
6209
6251
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
6210
6252
|
},
|
|
@@ -6268,7 +6310,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6268
6310
|
}
|
|
6269
6311
|
|
|
6270
6312
|
// packages/react/src/table-toolbar.tsx
|
|
6271
|
-
var
|
|
6313
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6272
6314
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6273
6315
|
function TableToolbar({
|
|
6274
6316
|
selectable,
|
|
@@ -6311,7 +6353,7 @@ function TableToolbar({
|
|
|
6311
6353
|
KjunInput,
|
|
6312
6354
|
{
|
|
6313
6355
|
size: "sm",
|
|
6314
|
-
style: { width:
|
|
6356
|
+
style: { width: import_tokens37.tokens.table.searchWidth, maxWidth: "100%" },
|
|
6315
6357
|
value: search,
|
|
6316
6358
|
ariaLabel: m.searchTable,
|
|
6317
6359
|
placeholder: searchPlaceholder,
|
|
@@ -6327,22 +6369,16 @@ function TableToolbar({
|
|
|
6327
6369
|
}
|
|
6328
6370
|
|
|
6329
6371
|
// packages/react/src/table-grid.tsx
|
|
6330
|
-
var
|
|
6372
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6331
6373
|
var import_react48 = require("react");
|
|
6332
6374
|
|
|
6333
6375
|
// packages/react/src/table-check.tsx
|
|
6334
6376
|
var import_react47 = require("react");
|
|
6335
|
-
|
|
6336
|
-
// shared/package-runtime/component-icons.ts
|
|
6337
|
-
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
6338
|
-
var componentIcons = { minus: import_minus.default };
|
|
6339
|
-
|
|
6340
|
-
// packages/react/src/table-check.tsx
|
|
6341
|
-
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6377
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6342
6378
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6343
6379
|
var TableCheck = (0, import_react47.forwardRef)(
|
|
6344
6380
|
function TableCheck2(props, ref) {
|
|
6345
|
-
const size =
|
|
6381
|
+
const size = import_tokens38.tokens.extensions.checkbox.iconSizes.sm;
|
|
6346
6382
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "kjun-table-check", children: [
|
|
6347
6383
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
6348
6384
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6399,7 +6435,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6399
6435
|
KjunIcon,
|
|
6400
6436
|
{
|
|
6401
6437
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6402
|
-
size:
|
|
6438
|
+
size: import_tokens39.tokens.table.sortIconSize
|
|
6403
6439
|
}
|
|
6404
6440
|
)
|
|
6405
6441
|
]
|
|
@@ -6412,14 +6448,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6412
6448
|
}
|
|
6413
6449
|
),
|
|
6414
6450
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tr", { "aria-hidden": "true", children: [
|
|
6415
|
-
selectable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "block", height:
|
|
6451
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "block", height: import_tokens39.tokens.table.selectionSize, width: import_tokens39.tokens.table.selectionSize }) }),
|
|
6416
6452
|
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
6417
6453
|
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6418
6454
|
KjunSkeleton,
|
|
6419
6455
|
{
|
|
6420
6456
|
type: "block",
|
|
6421
|
-
height:
|
|
6422
|
-
width: col.key === "actions" ?
|
|
6457
|
+
height: import_tokens39.tokens.table.skeletonHeight,
|
|
6458
|
+
width: col.key === "actions" ? import_tokens39.tokens.table.actionColumnWidth : "75%"
|
|
6423
6459
|
}
|
|
6424
6460
|
) }, col.key))
|
|
6425
6461
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6574,7 +6610,7 @@ function TableCards({
|
|
|
6574
6610
|
|
|
6575
6611
|
// packages/react/src/table-view.tsx
|
|
6576
6612
|
var import_react49 = require("react");
|
|
6577
|
-
var
|
|
6613
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6578
6614
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6579
6615
|
function KjunTable(props) {
|
|
6580
6616
|
const m = useKjunMessages();
|
|
@@ -6606,7 +6642,7 @@ function KjunTable(props) {
|
|
|
6606
6642
|
} = props;
|
|
6607
6643
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react49.useState)(false);
|
|
6608
6644
|
(0, import_react49.useEffect)(() => {
|
|
6609
|
-
const media = matchMedia(`(width < ${
|
|
6645
|
+
const media = matchMedia(`(width < ${import_tokens40.tokens.table.mobileBreakpoint}px)`);
|
|
6610
6646
|
const update = () => setMobile(media.matches);
|
|
6611
6647
|
update();
|
|
6612
6648
|
media.addEventListener("change", update);
|
|
@@ -6626,7 +6662,7 @@ function KjunTable(props) {
|
|
|
6626
6662
|
};
|
|
6627
6663
|
const customClass = (row, i) => typeof rowClass === "function" ? rowClass(row, i) : rowClass || "";
|
|
6628
6664
|
const rowKeyDown = (event, row, index) => {
|
|
6629
|
-
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0,
|
|
6665
|
+
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0, import_tokens40.isComposingKey)(event)) return;
|
|
6630
6666
|
if (event.key === "Enter" || event.key === " ") {
|
|
6631
6667
|
event.preventDefault();
|
|
6632
6668
|
onRowClick(row, index);
|
|
@@ -6710,7 +6746,7 @@ function KjunTable(props) {
|
|
|
6710
6746
|
}
|
|
6711
6747
|
|
|
6712
6748
|
// packages/react/src/kpi.tsx
|
|
6713
|
-
var
|
|
6749
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6714
6750
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6715
6751
|
var kpiFormat = (item, value = item.value) => {
|
|
6716
6752
|
var _a, _b;
|
|
@@ -6719,7 +6755,7 @@ var kpiFormat = (item, value = item.value) => {
|
|
|
6719
6755
|
maximumFractionDigits: (_b = item.decimals) != null ? _b : 0
|
|
6720
6756
|
}).format(item.semantic === "price" ? Math.abs(value) : value);
|
|
6721
6757
|
};
|
|
6722
|
-
var kpiColor = (value, semantic, neutral = "text") => semantic === "price" && Number(value) !== 0 ? `var(--_kjun-color-price-${Number(value) > 0 ? "up" : "down"})` : `var(--_kjun-color-${neutral})`;
|
|
6758
|
+
var kpiColor = (value, semantic, neutral = "text") => semantic === "price" && Number.isFinite(Number(value)) && Number(value) !== 0 ? `var(--_kjun-color-price-${Number(value) > 0 ? "up" : "down"})` : `var(--_kjun-color-${neutral})`;
|
|
6723
6759
|
function KjunKpiHero(props) {
|
|
6724
6760
|
const {
|
|
6725
6761
|
loading = false,
|
|
@@ -6778,7 +6814,7 @@ function KjunKpiHero(props) {
|
|
|
6778
6814
|
] }) }),
|
|
6779
6815
|
showDelta && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6780
6816
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6781
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width:
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: import_tokens41.tokens.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6782
6818
|
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6783
6819
|
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6784
6820
|
"span",
|
|
@@ -6887,11 +6923,11 @@ function KjunKpiRow({
|
|
|
6887
6923
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
6888
6924
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
6889
6925
|
var _a2, _b;
|
|
6890
|
-
return !item.loading && (item.semantic === "price" && Number(item.value) !== 0 || ((_b = (_a2 = item.badge) == null ? void 0 : _a2.variant) == null ? void 0 : _b.startsWith("price-")));
|
|
6926
|
+
return !item.loading && (item.semantic === "price" && Number.isFinite(Number(item.value)) && Number(item.value) !== 0 || ((_b = (_a2 = item.badge) == null ? void 0 : _a2.variant) == null ? void 0 : _b.startsWith("price-")));
|
|
6891
6927
|
})),
|
|
6892
6928
|
children: items.map((item, i) => {
|
|
6893
|
-
var _a2;
|
|
6894
|
-
const busy = loading || !!item.loading, click = () => {
|
|
6929
|
+
var _a2, _b;
|
|
6930
|
+
const busy = loading || !!item.loading, value = item.value, present = value != null && (typeof value !== "number" || Number.isFinite(value)), format2 = (number) => kpiFormat({ ...item, value: number }), click = () => {
|
|
6895
6931
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6896
6932
|
};
|
|
6897
6933
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
@@ -6899,6 +6935,7 @@ function KjunKpiRow({
|
|
|
6899
6935
|
{
|
|
6900
6936
|
role: item.clickable ? "button" : void 0,
|
|
6901
6937
|
tabIndex: item.clickable && !busy ? 0 : void 0,
|
|
6938
|
+
"data-state": busy ? "loading" : present || item.valueSegments ? "ready" : "missing",
|
|
6902
6939
|
"aria-disabled": item.clickable && busy || void 0,
|
|
6903
6940
|
className: "kjun-kpi-row__item" + (item.clickable ? " kjun-kpi-row__item--clickable" : "") + (item.mobileFull ? " kjun-kpi-row__item--full" : "") + (mobileSummary && i === lastFull ? " kjun-kpi-row__item--summary-full" : "") + (secondary[i] ? " kjun-kpi-row__item--secondary" : "") + (((_a2 = item.valueSegments) == null ? void 0 : _a2.some((s) => s.label)) ? " kjun-kpi-row__item--labeled-segments" : ""),
|
|
6904
6941
|
onClick: click,
|
|
@@ -6910,7 +6947,7 @@ function KjunKpiRow({
|
|
|
6910
6947
|
},
|
|
6911
6948
|
children: [
|
|
6912
6949
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6913
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", width:
|
|
6950
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", width: import_tokens41.tokens.extensions.kpiRow.labelSkeletonWidth, height: import_tokens41.tokens.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6914
6951
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6915
6952
|
] }),
|
|
6916
6953
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6918,9 +6955,9 @@ function KjunKpiRow({
|
|
|
6918
6955
|
"div",
|
|
6919
6956
|
{
|
|
6920
6957
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
6921
|
-
title: item.valueKind === "text" ? String(
|
|
6958
|
+
title: item.valueKind === "text" && present ? String(value) : void 0,
|
|
6922
6959
|
style: {
|
|
6923
|
-
color: item.valueClass ? void 0 : kpiColor(
|
|
6960
|
+
color: item.valueClass ? void 0 : kpiColor(value, item.semantic)
|
|
6924
6961
|
},
|
|
6925
6962
|
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6926
6963
|
"span",
|
|
@@ -6932,18 +6969,18 @@ function KjunKpiRow({
|
|
|
6932
6969
|
]
|
|
6933
6970
|
},
|
|
6934
6971
|
j
|
|
6935
|
-
)) : busy ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6972
|
+
)) : busy ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || (present ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6936
6973
|
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6937
|
-
item.animated && typeof
|
|
6974
|
+
item.animated && typeof value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6938
6975
|
KjunAnimatedNumber,
|
|
6939
6976
|
{
|
|
6940
6977
|
fromPrevious: true,
|
|
6941
|
-
value
|
|
6942
|
-
formatter:
|
|
6978
|
+
value,
|
|
6979
|
+
formatter: format2
|
|
6943
6980
|
}
|
|
6944
|
-
) :
|
|
6981
|
+
) : format2(value),
|
|
6945
6982
|
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6946
|
-
] })
|
|
6983
|
+
] }) : (_b = item.missingText) != null ? _b : "\u2014")
|
|
6947
6984
|
}
|
|
6948
6985
|
),
|
|
6949
6986
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
@@ -6953,7 +6990,7 @@ function KjunKpiRow({
|
|
|
6953
6990
|
{
|
|
6954
6991
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6955
6992
|
style: {
|
|
6956
|
-
color: item.descClass ? void 0 : kpiColor(
|
|
6993
|
+
color: item.descClass ? void 0 : kpiColor(value, item.semantic, "text-secondary")
|
|
6957
6994
|
},
|
|
6958
6995
|
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6959
6996
|
}
|
|
@@ -6968,7 +7005,7 @@ function KjunKpiRow({
|
|
|
6968
7005
|
}
|
|
6969
7006
|
|
|
6970
7007
|
// packages/react/src/market-cards.tsx
|
|
6971
|
-
var
|
|
7008
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
6972
7009
|
|
|
6973
7010
|
// shared/package-runtime/market-cards.ts
|
|
6974
7011
|
var import_react50 = require("react");
|
|
@@ -7176,10 +7213,10 @@ function KjunMarketCards(props) {
|
|
|
7176
7213
|
KjunSparkline,
|
|
7177
7214
|
{
|
|
7178
7215
|
data: getValue(row, state.key) || [],
|
|
7179
|
-
width:
|
|
7180
|
-
height:
|
|
7216
|
+
width: import_tokens42.tokens.extensions.marketTable.sparklineWidth,
|
|
7217
|
+
height: import_tokens42.tokens.extensions.marketTable.sparklineHeight
|
|
7181
7218
|
}
|
|
7182
|
-
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height:
|
|
7219
|
+
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens42.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens42.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7183
7220
|
KjunSignedValue,
|
|
7184
7221
|
{
|
|
7185
7222
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -7187,7 +7224,7 @@ function KjunMarketCards(props) {
|
|
|
7187
7224
|
stale: !!getValue(row, "stale"),
|
|
7188
7225
|
tone: "pill"
|
|
7189
7226
|
}
|
|
7190
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height:
|
|
7227
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens42.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens42.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-metric", children: [
|
|
7191
7228
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
7192
7229
|
props,
|
|
7193
7230
|
row,
|
|
@@ -7210,7 +7247,7 @@ function KjunMarketCards(props) {
|
|
|
7210
7247
|
}
|
|
7211
7248
|
|
|
7212
7249
|
// packages/react/src/market-list.tsx
|
|
7213
|
-
var
|
|
7250
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
7214
7251
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
7215
7252
|
function KjunMarketSimpleList(props) {
|
|
7216
7253
|
const m = useKjunMessages();
|
|
@@ -7277,7 +7314,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7277
7314
|
fetchedAt
|
|
7278
7315
|
}
|
|
7279
7316
|
)),
|
|
7280
|
-
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height:
|
|
7317
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height: import_tokens43.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens43.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7281
7318
|
KjunSignedValue,
|
|
7282
7319
|
{
|
|
7283
7320
|
value: change,
|
|
@@ -7301,7 +7338,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7301
7338
|
}
|
|
7302
7339
|
|
|
7303
7340
|
// packages/react/src/market-panel.tsx
|
|
7304
|
-
var
|
|
7341
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7305
7342
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7306
7343
|
function KjunMarketListPanel({
|
|
7307
7344
|
controls,
|
|
@@ -7309,12 +7346,12 @@ function KjunMarketListPanel({
|
|
|
7309
7346
|
}) {
|
|
7310
7347
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(KjunCard, { children: [
|
|
7311
7348
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: controls }),
|
|
7312
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop:
|
|
7349
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop: import_tokens44.tokens.dimension.value16, borderTop: `${import_tokens44.tokens.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7313
7350
|
] });
|
|
7314
7351
|
}
|
|
7315
7352
|
|
|
7316
7353
|
// packages/react/src/market-table.tsx
|
|
7317
|
-
var
|
|
7354
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7318
7355
|
|
|
7319
7356
|
// shared/package-runtime/trailing-overflow.ts
|
|
7320
7357
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7358,7 +7395,7 @@ function KjunMarketTable(props) {
|
|
|
7358
7395
|
const render = (row, col) => {
|
|
7359
7396
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7360
7397
|
if (cellLoading(row, col))
|
|
7361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height:
|
|
7398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height: import_tokens45.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens45.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
7362
7399
|
if (renderCell) return renderCell(row, col);
|
|
7363
7400
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7364
7401
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarketIdentity, { row, props });
|
|
@@ -7367,8 +7404,8 @@ function KjunMarketTable(props) {
|
|
|
7367
7404
|
KjunSparkline,
|
|
7368
7405
|
{
|
|
7369
7406
|
data: Array.isArray(value) ? value : [],
|
|
7370
|
-
width:
|
|
7371
|
-
height:
|
|
7407
|
+
width: import_tokens45.tokens.extensions.marketTable.sparklineWidth,
|
|
7408
|
+
height: import_tokens45.tokens.extensions.marketTable.sparklineHeight
|
|
7372
7409
|
}
|
|
7373
7410
|
);
|
|
7374
7411
|
if (col.type === "price")
|
|
@@ -7450,7 +7487,7 @@ function KjunMarketTable(props) {
|
|
|
7450
7487
|
KjunIcon,
|
|
7451
7488
|
{
|
|
7452
7489
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7453
|
-
size:
|
|
7490
|
+
size: import_tokens45.tokens.extensions.marketTable.sortIconSize
|
|
7454
7491
|
}
|
|
7455
7492
|
)
|
|
7456
7493
|
]
|
|
@@ -7510,7 +7547,7 @@ function KjunMarketTable(props) {
|
|
|
7510
7547
|
{
|
|
7511
7548
|
style: {
|
|
7512
7549
|
textAlign: col.align,
|
|
7513
|
-
fontWeight: col.weight === "bold" ?
|
|
7550
|
+
fontWeight: col.weight === "bold" ? import_tokens45.tokens.typography.control.fontWeight : void 0
|
|
7514
7551
|
},
|
|
7515
7552
|
children: [
|
|
7516
7553
|
render(row, col),
|
|
@@ -7543,26 +7580,27 @@ function KjunMarketTable(props) {
|
|
|
7543
7580
|
}
|
|
7544
7581
|
|
|
7545
7582
|
// packages/react/src/list.tsx
|
|
7546
|
-
var
|
|
7583
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7547
7584
|
var import_react52 = require("react");
|
|
7548
7585
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7549
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7586
|
+
function KjunListRow({ title, description, icon, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7550
7587
|
const content = (0, import_react52.useRef)(null), pressable = !!(href || onClick);
|
|
7551
7588
|
(0, import_react52.useEffect)(() => {
|
|
7552
7589
|
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7553
7590
|
}, [pressable]);
|
|
7591
|
+
const front = leading || (icon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: icon, className: "kjun-list-icon", size: import_tokens46.tokens.extensions.list.iconSize }) : null);
|
|
7554
7592
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
7555
|
-
|
|
7593
|
+
front && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-leading", children: front }),
|
|
7556
7594
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-list-body", children: [
|
|
7557
7595
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
7558
7596
|
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-description", children: description }),
|
|
7559
7597
|
hasContent(children) && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { ref: content, className: "kjun-list-content", children })
|
|
7560
7598
|
] }),
|
|
7561
7599
|
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7562
|
-
chevron && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size:
|
|
7600
|
+
chevron && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: import_tokens46.tokens.iconSizes.default })
|
|
7563
7601
|
] });
|
|
7564
7602
|
const main = href ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-label": ariaLabel, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-main", children: contents });
|
|
7565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", "data-leading": front ? "" : void 0, "data-destructive": destructive || void 0, children: [
|
|
7566
7604
|
main,
|
|
7567
7605
|
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7568
7606
|
] });
|
|
@@ -7579,7 +7617,7 @@ function KjunListSection({ title, description, actions, children, ariaLabel, sur
|
|
|
7579
7617
|
"aria-labelledby": title ? id : void 0,
|
|
7580
7618
|
"aria-label": title ? void 0 : ariaLabel,
|
|
7581
7619
|
children: [
|
|
7582
|
-
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
7620
|
+
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-list-heading", "data-bare": title && !description ? "" : void 0, children: [
|
|
7583
7621
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
7584
7622
|
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { id, children: title }),
|
|
7585
7623
|
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description })
|
|
@@ -7596,10 +7634,10 @@ function KjunListItem({ children }) {
|
|
|
7596
7634
|
}
|
|
7597
7635
|
|
|
7598
7636
|
// packages/react/src/app-navigation.tsx
|
|
7599
|
-
var
|
|
7637
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7600
7638
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7601
|
-
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7602
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value:
|
|
7639
|
+
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0, surface = true }) {
|
|
7640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value: import_tokens47.tokens.extensions.topNavigation, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("header", { className: "kjun-top-navigation", "data-surface": surface ? void 0 : "false", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-content", children: [
|
|
7603
7641
|
leading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7604
7642
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
7605
7643
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: title }),
|
|
@@ -7608,19 +7646,19 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
7608
7646
|
actions && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children: actions })
|
|
7609
7647
|
] }) }) });
|
|
7610
7648
|
}
|
|
7611
|
-
function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
7649
|
+
function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate, surface = true }) {
|
|
7612
7650
|
const m = useKjunMessages();
|
|
7613
7651
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
7614
7652
|
const hasIcons = items.some((item) => item.icon);
|
|
7615
7653
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7616
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
7654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "data-surface": surface ? void 0 : "false", "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
7617
7655
|
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
7618
7656
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("a", { href: item.disabled ? void 0 : item.href, "aria-label": item.label + (item.badge != null ? ", " + item.badge : ""), "aria-disabled": item.disabled || void 0, "aria-current": value === item.key ? "page" : void 0, onClick: (event) => {
|
|
7619
7657
|
if (item.disabled) event.preventDefault();
|
|
7620
7658
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7621
7659
|
}, children: [
|
|
7622
7660
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
7623
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size:
|
|
7661
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size: import_tokens47.tokens.extensions.bottomNavigation.iconSize }),
|
|
7624
7662
|
badge
|
|
7625
7663
|
] }),
|
|
7626
7664
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7630,9 +7668,9 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7630
7668
|
] }, item.key);
|
|
7631
7669
|
}) });
|
|
7632
7670
|
}
|
|
7633
|
-
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7671
|
+
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false, surface = true }) {
|
|
7634
7672
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", "data-surface": surface ? void 0 : "false", style: { paddingBottom: import_tokens47.tokens.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-bottom-action-content", children: [
|
|
7636
7674
|
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { children: description }),
|
|
7637
7675
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
7638
7676
|
] }) });
|
|
@@ -7640,7 +7678,7 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
7640
7678
|
|
|
7641
7679
|
// packages/react/src/media.tsx
|
|
7642
7680
|
var import_react53 = require("react");
|
|
7643
|
-
var
|
|
7681
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7644
7682
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7645
7683
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7646
7684
|
const current = (0, import_react53.useRef)({ src, version: 0 });
|
|
@@ -7659,28 +7697,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7659
7697
|
setResult({ version, state: "error" });
|
|
7660
7698
|
onError == null ? void 0 : onError();
|
|
7661
7699
|
} }, version),
|
|
7662
|
-
failed && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "image", size:
|
|
7700
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "image", size: import_tokens48.tokens.extensions.image.fallbackIconSize }) })
|
|
7663
7701
|
] });
|
|
7664
7702
|
}
|
|
7665
7703
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7666
7704
|
const m = useKjunMessages();
|
|
7667
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: import_tokens48.tokens.extensions.avatar[size], height: import_tokens48.tokens.extensions.avatar[size], ["--_kjun-avatar-color"]: color, ["--_kjun-avatar-text-color"]: textColor }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunImage, { src, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "user", size: import_tokens48.tokens.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7668
7706
|
}
|
|
7669
7707
|
|
|
7670
7708
|
// packages/react/src/chip.tsx
|
|
7671
|
-
var
|
|
7709
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
7672
7710
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7673
7711
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7674
7712
|
const m = useKjunMessages();
|
|
7675
7713
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7676
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size:
|
|
7714
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size: import_tokens49.tokens.extensions.chip.iconSizes[size] }),
|
|
7677
7715
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: label }),
|
|
7678
|
-
removable && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: "x", size:
|
|
7716
|
+
removable && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: "x", size: import_tokens49.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
7679
7717
|
] });
|
|
7680
7718
|
}
|
|
7681
7719
|
|
|
7682
7720
|
// packages/react/src/fab.tsx
|
|
7683
|
-
var
|
|
7721
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
7684
7722
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7685
7723
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7686
7724
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
@@ -7691,8 +7729,8 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7691
7729
|
"aria-label": ariaLabel,
|
|
7692
7730
|
disabled,
|
|
7693
7731
|
onClick,
|
|
7694
|
-
style: { bottom:
|
|
7695
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size:
|
|
7732
|
+
style: { bottom: import_tokens50.tokens.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size: import_tokens50.tokens.extensions.fab.iconSize })
|
|
7696
7734
|
}
|
|
7697
7735
|
);
|
|
7698
7736
|
}
|
|
@@ -7700,12 +7738,22 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7700
7738
|
// packages/react/src/range-input.tsx
|
|
7701
7739
|
var import_react54 = require("react");
|
|
7702
7740
|
var import_react_aria_components10 = require("react-aria-components");
|
|
7703
|
-
var
|
|
7741
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
7704
7742
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7705
|
-
function
|
|
7743
|
+
function RangeThumb({ index, label, formatValue }) {
|
|
7744
|
+
const state = (0, import_react54.useContext)(import_react_aria_components10.SliderStateContext);
|
|
7745
|
+
const input = (0, import_react54.useRef)(null);
|
|
7746
|
+
const text = formatValue ? formatValue(state.values[index]) : state.getThumbValueLabel(index);
|
|
7747
|
+
(0, import_react54.useLayoutEffect)(() => {
|
|
7748
|
+
var _a;
|
|
7749
|
+
(_a = input.current) == null ? void 0 : _a.setAttribute("aria-valuetext", text);
|
|
7750
|
+
});
|
|
7751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.SliderThumb, { index, inputRef: input, className: "kjun-slider-thumb", "aria-label": label });
|
|
7752
|
+
}
|
|
7753
|
+
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, showValue = true, formatValue, onValueChange, onChangeCommit, ...rest }) {
|
|
7706
7754
|
const m = useKjunMessages();
|
|
7707
7755
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7708
|
-
const domain = (0,
|
|
7756
|
+
const domain = (0, import_tokens51.createSliderDomain)(min, max, step);
|
|
7709
7757
|
const list = Array.isArray(value) ? value : [value];
|
|
7710
7758
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7711
7759
|
const latest = (0, import_react54.useRef)(value);
|
|
@@ -7729,14 +7777,14 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7729
7777
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7730
7778
|
}
|
|
7731
7779
|
}, children: [
|
|
7732
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "kjun-slider-caption", children: [
|
|
7780
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "kjun-slider-caption", children: [
|
|
7733
7781
|
label && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.Label, { className: "kjun-slider-label", children: label }),
|
|
7734
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.join(" \u2013 ") })
|
|
7782
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.map(formatValue != null ? formatValue : String).join(" \u2013 ") })
|
|
7735
7783
|
] }),
|
|
7736
7784
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
7737
7785
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "kjun-slider-rail" }),
|
|
7738
7786
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "kjun-slider-fill", style: { left: (list.length === 2 ? state.getThumbPercent(0) * 100 : 0) + "%", width: (state.getThumbPercent(list.length - 1) - (list.length === 2 ? state.getThumbPercent(0) : 0)) * 100 + "%" } }),
|
|
7739
|
-
list.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7787
|
+
list.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RangeThumb, { index: i, formatValue, label: list.length === 2 ? thumbLabels[i] : ariaLabel || label || m.value }, i))
|
|
7740
7788
|
] }) })
|
|
7741
7789
|
] });
|
|
7742
7790
|
}
|
|
@@ -7749,13 +7797,13 @@ function KjunRangeSlider(props) {
|
|
|
7749
7797
|
|
|
7750
7798
|
// packages/react/src/quantity-stepper.tsx
|
|
7751
7799
|
var import_react55 = require("react");
|
|
7752
|
-
var
|
|
7800
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
7753
7801
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7754
7802
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7755
7803
|
const m = useKjunMessages();
|
|
7756
|
-
const geometry =
|
|
7757
|
-
const buttonStyle = { width:
|
|
7758
|
-
const domain = (0,
|
|
7804
|
+
const geometry = import_tokens52.tokens.extensions.compound;
|
|
7805
|
+
const buttonStyle = { width: import_tokens52.tokens.input[size].height, padding: 0 };
|
|
7806
|
+
const domain = (0, import_tokens52.createNumberDomain)({ min, max, step, precision });
|
|
7759
7807
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7760
7808
|
const [draft, setDraft] = (0, import_react55.useState)(String(value));
|
|
7761
7809
|
const field = useKjunField();
|
|
@@ -7789,7 +7837,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7789
7837
|
};
|
|
7790
7838
|
const key = (event) => {
|
|
7791
7839
|
if (blocked) return;
|
|
7792
|
-
const action = (0,
|
|
7840
|
+
const action = (0, import_tokens52.quantityKeyAction)(event, composing.current, dirty.current);
|
|
7793
7841
|
if (!action) return;
|
|
7794
7842
|
event.preventDefault();
|
|
7795
7843
|
if (action === "cancel") {
|
|
@@ -7841,7 +7889,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7841
7889
|
|
|
7842
7890
|
// packages/react/src/time-picker.tsx
|
|
7843
7891
|
var import_react56 = require("react");
|
|
7844
|
-
var
|
|
7892
|
+
var import_tokens53 = require("@kjun-ui/tokens");
|
|
7845
7893
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7846
7894
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7847
7895
|
const m = useKjunMessages();
|
|
@@ -7849,7 +7897,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7849
7897
|
const root = (0, import_react56.useRef)(null);
|
|
7850
7898
|
const field = useKjunField(), uid = (0, import_react56.useId)();
|
|
7851
7899
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7852
|
-
const domain = (0, import_react56.useMemo)(() => (0,
|
|
7900
|
+
const domain = (0, import_react56.useMemo)(() => (0, import_tokens53.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7853
7901
|
const valid = domain.valid && domain.accepts(value);
|
|
7854
7902
|
(0, import_react56.useEffect)(() => {
|
|
7855
7903
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|