@kjun-ui/react 0.15.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 +524 -408
- package/dist/index.js +644 -527
- package/dist/styles.css +99 -32
- 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/floating-panel.d.cts +5 -1
- package/dist/types/packages/react/src/floating-panel.d.ts +5 -1
- 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 +7 -2
- package/dist/types/packages/react/src/list.d.ts +7 -2
- 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/popover.d.cts +12 -3
- package/dist/types/packages/react/src/popover.d.ts +12 -3
- 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/anchor-rect.d.cts +17 -0
- package/dist/types/shared/package-runtime/anchor-rect.d.ts +17 -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");
|
|
@@ -3106,9 +3115,11 @@ function FloatingPanel({
|
|
|
3106
3115
|
flip = true,
|
|
3107
3116
|
nonModal = false,
|
|
3108
3117
|
ownsDismiss = false,
|
|
3109
|
-
returnFocus
|
|
3118
|
+
returnFocus,
|
|
3119
|
+
repositionKey = 0,
|
|
3120
|
+
inside
|
|
3110
3121
|
}) {
|
|
3111
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3122
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens20.tokens.motion.popupExit);
|
|
3112
3123
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
3113
3124
|
const container = useKjunPortalContainer();
|
|
3114
3125
|
const panel = (0, import_react27.useRef)(null);
|
|
@@ -3119,7 +3130,7 @@ function FloatingPanel({
|
|
|
3119
3130
|
const dismissBeforeFocus = (event) => {
|
|
3120
3131
|
var _a2, _b;
|
|
3121
3132
|
const popup = panel.current, focused = document2.activeElement;
|
|
3122
|
-
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;
|
|
3123
3134
|
if (focused !== document2.body && focused !== document2.documentElement && !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(focused))) return;
|
|
3124
3135
|
event.preventDefault();
|
|
3125
3136
|
event.stopPropagation();
|
|
@@ -3141,12 +3152,17 @@ function FloatingPanel({
|
|
|
3141
3152
|
if (next) onOpenChange(next);
|
|
3142
3153
|
} : onOpenChange,
|
|
3143
3154
|
triggerRef,
|
|
3155
|
+
shouldCloseOnInteractOutside: inside ? (element) => {
|
|
3156
|
+
var _a;
|
|
3157
|
+
return !((_a = inside.current) == null ? void 0 : _a.contains(element));
|
|
3158
|
+
} : void 0,
|
|
3144
3159
|
UNSTABLE_portalContainer: container,
|
|
3145
3160
|
placement: placement.replace("-", " "),
|
|
3146
3161
|
shouldFlip: flip,
|
|
3147
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3148
|
-
offset: field ?
|
|
3149
|
-
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,
|
|
3165
|
+
crossOffset: repositionKey % 2 ? 1e-3 : 0,
|
|
3150
3166
|
className: "kjun-scope kjun-floating " + className,
|
|
3151
3167
|
"data-motion": "popup",
|
|
3152
3168
|
"data-motion-open": String(motion.active),
|
|
@@ -3161,8 +3177,33 @@ function FloatingPanel({
|
|
|
3161
3177
|
}
|
|
3162
3178
|
var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
|
|
3163
3179
|
|
|
3180
|
+
// shared/package-runtime/anchor-rect.ts
|
|
3181
|
+
function place(element, rect) {
|
|
3182
|
+
var _a, _b;
|
|
3183
|
+
const next = [rect.x, rect.y, (_a = rect.width) != null ? _a : 0, (_b = rect.height) != null ? _b : 0].map((value) => value + "px");
|
|
3184
|
+
const style = element.style;
|
|
3185
|
+
if (style.left === next[0] && style.top === next[1] && style.width === next[2] && style.height === next[3]) return false;
|
|
3186
|
+
[style.left, style.top, style.width, style.height] = next;
|
|
3187
|
+
return true;
|
|
3188
|
+
}
|
|
3189
|
+
function followAnchor(element, source, moved) {
|
|
3190
|
+
let frame = 0, stopped = false;
|
|
3191
|
+
const step = () => {
|
|
3192
|
+
const current = source();
|
|
3193
|
+
const rect = typeof current === "function" ? current() : current;
|
|
3194
|
+
if (rect && place(element, rect)) moved();
|
|
3195
|
+
if (!stopped && typeof current === "function") frame = requestAnimationFrame(step);
|
|
3196
|
+
};
|
|
3197
|
+
step();
|
|
3198
|
+
return () => {
|
|
3199
|
+
stopped = true;
|
|
3200
|
+
cancelAnimationFrame(frame);
|
|
3201
|
+
};
|
|
3202
|
+
}
|
|
3203
|
+
var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidden" };
|
|
3204
|
+
|
|
3164
3205
|
// packages/react/src/popover.tsx
|
|
3165
|
-
var
|
|
3206
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3166
3207
|
var import_react28 = require("react");
|
|
3167
3208
|
var import_react_aria_components5 = require("react-aria-components");
|
|
3168
3209
|
|
|
@@ -3227,6 +3268,15 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
3227
3268
|
|
|
3228
3269
|
// packages/react/src/popover.tsx
|
|
3229
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
|
+
}
|
|
3230
3280
|
function KjunPopover({
|
|
3231
3281
|
noPadding = false,
|
|
3232
3282
|
open: controlled,
|
|
@@ -3241,6 +3291,7 @@ function KjunPopover({
|
|
|
3241
3291
|
returnFocus,
|
|
3242
3292
|
header,
|
|
3243
3293
|
modal = true,
|
|
3294
|
+
anchorRect,
|
|
3244
3295
|
trigger,
|
|
3245
3296
|
children
|
|
3246
3297
|
}) {
|
|
@@ -3253,6 +3304,17 @@ function KjunPopover({
|
|
|
3253
3304
|
if (node && focusOnMount.current) node.focus();
|
|
3254
3305
|
}, []);
|
|
3255
3306
|
const resolveReturn = resolveFocusReturn(returnFocus);
|
|
3307
|
+
const anchor = (0, import_react28.useRef)(null), anchorSource = (0, import_react28.useRef)(anchorRect), opener = (0, import_react28.useRef)(null);
|
|
3308
|
+
anchorSource.current = anchorRect;
|
|
3309
|
+
const [reposition, setReposition] = (0, import_react28.useState)(0);
|
|
3310
|
+
const anchored = anchorRect !== void 0;
|
|
3311
|
+
const wasOpen = (0, import_react28.useRef)(false);
|
|
3312
|
+
if (open && !wasOpen.current && typeof document !== "undefined") opener.current = document.activeElement;
|
|
3313
|
+
wasOpen.current = open;
|
|
3314
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
3315
|
+
if (!open || !anchored || !anchor.current) return;
|
|
3316
|
+
return followAnchor(anchor.current, () => anchorSource.current, () => setReposition((n) => n + 1));
|
|
3317
|
+
}, [open, anchored, typeof anchorRect === "function" ? anchorRect : anchorRect && `${anchorRect.x},${anchorRect.y},${anchorRect.width},${anchorRect.height}`]);
|
|
3256
3318
|
const change = (v) => {
|
|
3257
3319
|
setInternal(v);
|
|
3258
3320
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
@@ -3275,12 +3337,14 @@ function KjunPopover({
|
|
|
3275
3337
|
});
|
|
3276
3338
|
const content = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
3277
3339
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3278
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3340
|
+
anchored && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: anchor, "aria-hidden": "true", style: anchorStyle }),
|
|
3341
|
+
(!anchored || trigger != null) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3279
3342
|
"div",
|
|
3280
3343
|
{
|
|
3281
3344
|
ref,
|
|
3282
3345
|
className: "kjun-layer-trigger",
|
|
3283
|
-
onClickCapture: () => {
|
|
3346
|
+
onClickCapture: (event) => {
|
|
3347
|
+
if (event.target.closest('button:disabled, [aria-disabled="true"]')) return;
|
|
3284
3348
|
if (!manualTrigger) change(!open);
|
|
3285
3349
|
},
|
|
3286
3350
|
onKeyDown: (event) => {
|
|
@@ -3289,10 +3353,11 @@ function KjunPopover({
|
|
|
3289
3353
|
change(!open);
|
|
3290
3354
|
}
|
|
3291
3355
|
},
|
|
3292
|
-
"
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
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
|
+
})
|
|
3296
3361
|
}
|
|
3297
3362
|
),
|
|
3298
3363
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -3300,13 +3365,18 @@ function KjunPopover({
|
|
|
3300
3365
|
{
|
|
3301
3366
|
open,
|
|
3302
3367
|
onOpenChange: change,
|
|
3303
|
-
triggerRef: ref,
|
|
3368
|
+
triggerRef: anchored ? anchor : ref,
|
|
3369
|
+
inside: anchored ? ref : void 0,
|
|
3370
|
+
repositionKey: reposition,
|
|
3304
3371
|
className: "kjun-content-popover" + (header != null ? " kjun-popover-has-header" : ""),
|
|
3305
3372
|
placement,
|
|
3306
3373
|
matchTriggerWidth,
|
|
3307
3374
|
maxHeight,
|
|
3308
3375
|
flip,
|
|
3309
|
-
returnFocus: () =>
|
|
3376
|
+
returnFocus: () => {
|
|
3377
|
+
var _a;
|
|
3378
|
+
return skipReturn.current ? false : (_a = resolveReturn == null ? void 0 : resolveReturn()) != null ? _a : anchored && trigger == null ? opener.current : void 0;
|
|
3379
|
+
},
|
|
3310
3380
|
nonModal: !modal,
|
|
3311
3381
|
ownsDismiss: !modal,
|
|
3312
3382
|
children: (() => {
|
|
@@ -3315,7 +3385,7 @@ function KjunPopover({
|
|
|
3315
3385
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3316
3386
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3317
3387
|
className: "kjun-popover-dialog",
|
|
3318
|
-
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" }
|
|
3319
3389
|
};
|
|
3320
3390
|
const body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3321
3391
|
header != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3328,8 +3398,16 @@ function KjunPopover({
|
|
|
3328
3398
|
)
|
|
3329
3399
|
] });
|
|
3330
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
|
+
}
|
|
3331
3406
|
function KjunTooltip({
|
|
3332
3407
|
content = "",
|
|
3408
|
+
title,
|
|
3409
|
+
align,
|
|
3410
|
+
width,
|
|
3333
3411
|
placement = "top",
|
|
3334
3412
|
delay = 0,
|
|
3335
3413
|
open: controlled,
|
|
@@ -3337,25 +3415,33 @@ function KjunTooltip({
|
|
|
3337
3415
|
children
|
|
3338
3416
|
}) {
|
|
3339
3417
|
const container = useKjunPortalContainer();
|
|
3340
|
-
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]);
|
|
3341
3423
|
const setOpen = (value) => {
|
|
3342
3424
|
setInternal(value);
|
|
3343
3425
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
3344
3426
|
};
|
|
3345
3427
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
3346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_aria_components5.TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !
|
|
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: [
|
|
3347
3429
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.Focusable, { children }),
|
|
3348
|
-
container !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3349
|
-
|
|
3430
|
+
container !== null && hasContent2 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3431
|
+
TooltipPanel,
|
|
3350
3432
|
{
|
|
3351
|
-
style: { zIndex: layer.zIndex },
|
|
3433
|
+
style: { zIndex: layer.zIndex, ...width ? { maxWidth: `var(--_kjun-extension-tooltip-max-widths-${width})` } : {} },
|
|
3434
|
+
"data-align": align,
|
|
3352
3435
|
UNSTABLE_portalContainer: container,
|
|
3353
3436
|
placement,
|
|
3354
|
-
offset:
|
|
3437
|
+
offset: import_tokens21.tokens.extensions.floating.anchorGap,
|
|
3355
3438
|
className: "kjun-scope kjun-tooltip",
|
|
3356
3439
|
children: [
|
|
3357
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width:
|
|
3358
|
-
|
|
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" }) }) }),
|
|
3441
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "kjun-tooltip-title", children: title }),
|
|
3443
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "kjun-tooltip-body", children: content })
|
|
3444
|
+
] }) : content
|
|
3359
3445
|
]
|
|
3360
3446
|
}
|
|
3361
3447
|
)
|
|
@@ -3363,7 +3449,7 @@ function KjunTooltip({
|
|
|
3363
3449
|
}
|
|
3364
3450
|
|
|
3365
3451
|
// packages/react/src/dropdown.tsx
|
|
3366
|
-
var
|
|
3452
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3367
3453
|
var import_react29 = require("react");
|
|
3368
3454
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3369
3455
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -3514,14 +3600,14 @@ function KjunDropdownItem({
|
|
|
3514
3600
|
close == null ? void 0 : close();
|
|
3515
3601
|
},
|
|
3516
3602
|
children: [
|
|
3517
|
-
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 }),
|
|
3518
3604
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children }),
|
|
3519
3605
|
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3520
3606
|
KjunIcon,
|
|
3521
3607
|
{
|
|
3522
3608
|
name: "check",
|
|
3523
3609
|
className: "kjun-menu-check",
|
|
3524
|
-
size:
|
|
3610
|
+
size: import_tokens22.tokens.extensions.menu.iconSize,
|
|
3525
3611
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3526
3612
|
}
|
|
3527
3613
|
)
|
|
@@ -3588,7 +3674,7 @@ function KjunMenuButton({
|
|
|
3588
3674
|
}
|
|
3589
3675
|
|
|
3590
3676
|
// packages/react/src/drawer.tsx
|
|
3591
|
-
var
|
|
3677
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
3592
3678
|
|
|
3593
3679
|
// shared/package-runtime/drawer-geometry.ts
|
|
3594
3680
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3607,7 +3693,7 @@ function KjunDrawer({
|
|
|
3607
3693
|
onOpenChange,
|
|
3608
3694
|
title,
|
|
3609
3695
|
position = "right",
|
|
3610
|
-
width =
|
|
3696
|
+
width = import_tokens23.tokens.extensions.drawer.width,
|
|
3611
3697
|
closable = true,
|
|
3612
3698
|
closeOnOverlay = true,
|
|
3613
3699
|
closeOnEsc = true,
|
|
@@ -3623,7 +3709,7 @@ function KjunDrawer({
|
|
|
3623
3709
|
maxHeight
|
|
3624
3710
|
}) {
|
|
3625
3711
|
const m = useKjunMessages();
|
|
3626
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3712
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens23.tokens.motion.layerExit);
|
|
3627
3713
|
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3628
3714
|
const container = useKjunPortalContainer();
|
|
3629
3715
|
const close = () => {
|
|
@@ -3680,8 +3766,8 @@ function KjunDrawer({
|
|
|
3680
3766
|
variant: "ghost",
|
|
3681
3767
|
ariaLabel: m.close,
|
|
3682
3768
|
onClick: close,
|
|
3683
|
-
style: { borderRadius:
|
|
3684
|
-
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 })
|
|
3685
3771
|
}
|
|
3686
3772
|
)
|
|
3687
3773
|
] }),
|
|
@@ -3689,7 +3775,7 @@ function KjunDrawer({
|
|
|
3689
3775
|
"div",
|
|
3690
3776
|
{
|
|
3691
3777
|
className: "kjun-drawer-body",
|
|
3692
|
-
style: { padding: noPadding ? 0 :
|
|
3778
|
+
style: { padding: noPadding ? 0 : import_tokens23.tokens.extensions.drawer.bodyPadding },
|
|
3693
3779
|
children
|
|
3694
3780
|
}
|
|
3695
3781
|
),
|
|
@@ -4054,7 +4140,7 @@ function SearchField({
|
|
|
4054
4140
|
}
|
|
4055
4141
|
|
|
4056
4142
|
// packages/react/src/date-picker.tsx
|
|
4057
|
-
var
|
|
4143
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
4058
4144
|
var import_react32 = require("react");
|
|
4059
4145
|
var import_jsx_runtime20 = (
|
|
4060
4146
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
@@ -4079,8 +4165,8 @@ function KjunDatePicker({
|
|
|
4079
4165
|
const clear = clearable && !!value && !props.disabled && !props.readOnly;
|
|
4080
4166
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
4081
4167
|
position: "relative",
|
|
4082
|
-
["--_kjun-date-icon-inset"]:
|
|
4083
|
-
["--_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"
|
|
4084
4170
|
}, children: [
|
|
4085
4171
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4086
4172
|
KjunInput,
|
|
@@ -4110,8 +4196,8 @@ function KjunDatePicker({
|
|
|
4110
4196
|
"aria-hidden": "true",
|
|
4111
4197
|
className: "kjun-date-overlay",
|
|
4112
4198
|
style: {
|
|
4113
|
-
left:
|
|
4114
|
-
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),
|
|
4115
4201
|
...inputTypeStyle(size),
|
|
4116
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)"
|
|
4117
4203
|
},
|
|
@@ -4127,14 +4213,14 @@ function KjunDatePicker({
|
|
|
4127
4213
|
className: "kjun-select-clear",
|
|
4128
4214
|
style: {
|
|
4129
4215
|
padding: 0,
|
|
4130
|
-
right:
|
|
4131
|
-
width:
|
|
4132
|
-
height:
|
|
4133
|
-
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,
|
|
4134
4220
|
borderRadius: "50%"
|
|
4135
4221
|
},
|
|
4136
4222
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
4137
|
-
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 })
|
|
4138
4224
|
}
|
|
4139
4225
|
)
|
|
4140
4226
|
] });
|
|
@@ -4320,7 +4406,7 @@ function KjunSearchInput({
|
|
|
4320
4406
|
}
|
|
4321
4407
|
|
|
4322
4408
|
// packages/react/src/select-control.tsx
|
|
4323
|
-
var
|
|
4409
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4324
4410
|
var import_react37 = require("react");
|
|
4325
4411
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4326
4412
|
|
|
@@ -4402,7 +4488,7 @@ function KjunSelect({
|
|
|
4402
4488
|
const composition = useCompositionGuard();
|
|
4403
4489
|
const ref = (0, import_react37.useRef)(null), menu = (0, import_react37.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react37.useId)();
|
|
4404
4490
|
const segment = (0, import_react37.useContext)(CompoundControlContext) !== null;
|
|
4405
|
-
const spec =
|
|
4491
|
+
const spec = import_tokens25.tokens.input[size];
|
|
4406
4492
|
const expanded = usePopupExpanded(open, ref);
|
|
4407
4493
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4408
4494
|
(0, import_react37.useEffect)(() => {
|
|
@@ -4456,7 +4542,7 @@ function KjunSelect({
|
|
|
4456
4542
|
borderRadius: spec.radius,
|
|
4457
4543
|
...inputTypeStyle(size),
|
|
4458
4544
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4459
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4545
|
+
...segment ? {} : { paddingInline: spec.padding - import_tokens25.tokens.border.controlWidth }
|
|
4460
4546
|
},
|
|
4461
4547
|
onClick: () => changeOpen(!open),
|
|
4462
4548
|
onKeyDown: (e) => {
|
|
@@ -4467,7 +4553,7 @@ function KjunSelect({
|
|
|
4467
4553
|
},
|
|
4468
4554
|
children: [
|
|
4469
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 }),
|
|
4470
|
-
/* @__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)" } })
|
|
4471
4557
|
]
|
|
4472
4558
|
}
|
|
4473
4559
|
),
|
|
@@ -4572,7 +4658,7 @@ function KjunSelect({
|
|
|
4572
4658
|
className: "kjun-option",
|
|
4573
4659
|
children: [
|
|
4574
4660
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4575
|
-
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 })
|
|
4576
4662
|
]
|
|
4577
4663
|
},
|
|
4578
4664
|
key
|
|
@@ -4598,10 +4684,10 @@ function KjunSelect({
|
|
|
4598
4684
|
}
|
|
4599
4685
|
|
|
4600
4686
|
// packages/react/src/navigation.tsx
|
|
4601
|
-
var
|
|
4687
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
4602
4688
|
|
|
4603
4689
|
// packages/react/src/collapse.tsx
|
|
4604
|
-
var
|
|
4690
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4605
4691
|
var import_react38 = require("react");
|
|
4606
4692
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4607
4693
|
function Collapse({ open, keepMounted = false, children }) {
|
|
@@ -4639,8 +4725,8 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4639
4725
|
}
|
|
4640
4726
|
el.style.height = end + "px";
|
|
4641
4727
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4642
|
-
duration:
|
|
4643
|
-
easing:
|
|
4728
|
+
duration: import_tokens26.tokens.motion.collapse,
|
|
4729
|
+
easing: import_tokens26.tokens.motion.easeOut
|
|
4644
4730
|
});
|
|
4645
4731
|
animation.current = transition;
|
|
4646
4732
|
transition.onfinish = finish;
|
|
@@ -4771,6 +4857,9 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4771
4857
|
var import_react40 = require("react");
|
|
4772
4858
|
var import_react_aria_components9 = require("react-aria-components");
|
|
4773
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
|
+
}
|
|
4774
4863
|
function KjunTabs({
|
|
4775
4864
|
value,
|
|
4776
4865
|
items = [],
|
|
@@ -4778,6 +4867,8 @@ function KjunTabs({
|
|
|
4778
4867
|
variant = "underline",
|
|
4779
4868
|
actions,
|
|
4780
4869
|
children,
|
|
4870
|
+
stickyHeader = false,
|
|
4871
|
+
stickyOffset = 0,
|
|
4781
4872
|
ariaLabel,
|
|
4782
4873
|
onValueChange,
|
|
4783
4874
|
onChange,
|
|
@@ -4821,7 +4912,7 @@ function KjunTabs({
|
|
|
4821
4912
|
onChange == null ? void 0 : onChange(name);
|
|
4822
4913
|
};
|
|
4823
4914
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4824
|
-
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)(
|
|
4825
4916
|
import_react_aria_components9.Tabs,
|
|
4826
4917
|
{
|
|
4827
4918
|
selectedKey: value,
|
|
@@ -4830,73 +4921,81 @@ function KjunTabs({
|
|
|
4830
4921
|
"data-variant": variant,
|
|
4831
4922
|
"data-density": density,
|
|
4832
4923
|
children: [
|
|
4833
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
className: "kjun-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
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
|
+
),
|
|
4896
4995
|
children && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "kjun-tab-content", children })
|
|
4897
4996
|
]
|
|
4898
4997
|
}
|
|
4899
|
-
);
|
|
4998
|
+
) });
|
|
4900
4999
|
}
|
|
4901
5000
|
function KjunTabPane({ name, children }) {
|
|
4902
5001
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4975,7 +5074,7 @@ function KjunAccordionItem({
|
|
|
4975
5074
|
{
|
|
4976
5075
|
name: "chevron-down",
|
|
4977
5076
|
className: "kjun-accordion-chevron",
|
|
4978
|
-
size:
|
|
5077
|
+
size: import_tokens27.tokens.extensions.accordion.iconSize,
|
|
4979
5078
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4980
5079
|
}
|
|
4981
5080
|
)
|
|
@@ -5003,12 +5102,12 @@ function KjunBreadcrumb({
|
|
|
5003
5102
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
5004
5103
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
5005
5104
|
const label = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
5006
|
-
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 }),
|
|
5007
5106
|
" ",
|
|
5008
5107
|
item.label
|
|
5009
5108
|
] });
|
|
5010
5109
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react40.Fragment, { children: [
|
|
5011
|
-
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 }),
|
|
5012
5111
|
" ",
|
|
5013
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 })
|
|
5014
5113
|
] }, i);
|
|
@@ -5055,7 +5154,7 @@ function KjunPagination({
|
|
|
5055
5154
|
"aria-label": label,
|
|
5056
5155
|
disabled: target < 1 || target > totalPages || target === current,
|
|
5057
5156
|
onClick: () => change(target),
|
|
5058
|
-
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 })
|
|
5059
5158
|
}
|
|
5060
5159
|
);
|
|
5061
5160
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -5108,7 +5207,7 @@ function KjunPagination({
|
|
|
5108
5207
|
}
|
|
5109
5208
|
|
|
5110
5209
|
// packages/react/src/actions.tsx
|
|
5111
|
-
var
|
|
5210
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
5112
5211
|
var import_react41 = require("react");
|
|
5113
5212
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5114
5213
|
function KjunIconToggle({
|
|
@@ -5150,7 +5249,7 @@ function KjunIconToggle({
|
|
|
5150
5249
|
{
|
|
5151
5250
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
5152
5251
|
filled: active,
|
|
5153
|
-
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],
|
|
5154
5253
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
5155
5254
|
className: active ? activeColorClass : inactiveColorClass,
|
|
5156
5255
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5210,9 +5309,9 @@ function KjunCopyButton({
|
|
|
5210
5309
|
"data-inline": inline,
|
|
5211
5310
|
style: {
|
|
5212
5311
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5213
|
-
minHeight:
|
|
5312
|
+
minHeight: import_tokens28.tokens.button.heights[size],
|
|
5214
5313
|
paddingBlock: 0,
|
|
5215
|
-
paddingInline: { xs:
|
|
5314
|
+
paddingInline: { xs: import_tokens28.tokens.dimension.value4, sm: import_tokens28.tokens.dimension.value8, md: import_tokens28.tokens.dimension.value12 }[size]
|
|
5216
5315
|
},
|
|
5217
5316
|
onClick: async (event) => {
|
|
5218
5317
|
event.stopPropagation();
|
|
@@ -5242,7 +5341,7 @@ function KjunCopyButton({
|
|
|
5242
5341
|
KjunIcon,
|
|
5243
5342
|
{
|
|
5244
5343
|
name: copied ? "check" : "copy",
|
|
5245
|
-
size:
|
|
5344
|
+
size: import_tokens28.tokens.button.iconSizes[size],
|
|
5246
5345
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5247
5346
|
}
|
|
5248
5347
|
),
|
|
@@ -5316,7 +5415,7 @@ function KjunExternalLink({
|
|
|
5316
5415
|
onClick: (e) => e.stopPropagation(),
|
|
5317
5416
|
children: [
|
|
5318
5417
|
body,
|
|
5319
|
-
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" }),
|
|
5320
5419
|
!name && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5321
5420
|
]
|
|
5322
5421
|
}
|
|
@@ -5344,7 +5443,7 @@ function KjunScrollFade({ children }) {
|
|
|
5344
5443
|
}
|
|
5345
5444
|
return () => observer.disconnect();
|
|
5346
5445
|
}, [children]);
|
|
5347
|
-
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;
|
|
5348
5447
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5349
5448
|
"div",
|
|
5350
5449
|
{
|
|
@@ -5358,7 +5457,7 @@ function KjunScrollFade({ children }) {
|
|
|
5358
5457
|
}
|
|
5359
5458
|
|
|
5360
5459
|
// packages/react/src/data-state.tsx
|
|
5361
|
-
var
|
|
5460
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
5362
5461
|
var import_react43 = require("react");
|
|
5363
5462
|
|
|
5364
5463
|
// shared/package-runtime/use-loading-reveal.ts
|
|
@@ -5378,13 +5477,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
5378
5477
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5379
5478
|
function useQueryDisplay(props) {
|
|
5380
5479
|
var _a;
|
|
5381
|
-
const [state, setState] = (0, import_react43.useState)(() => (0,
|
|
5480
|
+
const [state, setState] = (0, import_react43.useState)(() => (0, import_tokens29.initialQueryDisplay)(props));
|
|
5382
5481
|
let next = state;
|
|
5383
5482
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
5384
|
-
next = (0,
|
|
5483
|
+
next = (0, import_tokens29.advanceQueryDisplay)(state, props);
|
|
5385
5484
|
setState(next);
|
|
5386
5485
|
}
|
|
5387
|
-
return (0,
|
|
5486
|
+
return (0, import_tokens29.queryDisplayStatus)(next, props);
|
|
5388
5487
|
}
|
|
5389
5488
|
function KjunDataState({
|
|
5390
5489
|
preserveContent = false,
|
|
@@ -5416,7 +5515,7 @@ function KjunDataState({
|
|
|
5416
5515
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5417
5516
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5418
5517
|
retryText != null ? retryText : retryText = m.retry;
|
|
5419
|
-
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);
|
|
5420
5519
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5421
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: [
|
|
5422
5521
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "xs" }),
|
|
@@ -5430,7 +5529,7 @@ function KjunDataState({
|
|
|
5430
5529
|
"aria-label": revealed ? loadingText : void 0,
|
|
5431
5530
|
"aria-hidden": revealed ? void 0 : true,
|
|
5432
5531
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5433
|
-
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: [
|
|
5434
5533
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "md" }),
|
|
5435
5534
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: loadingText })
|
|
5436
5535
|
] }))
|
|
@@ -5443,7 +5542,7 @@ function KjunDataState({
|
|
|
5443
5542
|
"aria-hidden": concealed || void 0,
|
|
5444
5543
|
inert: concealed || void 0,
|
|
5445
5544
|
style: {
|
|
5446
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5545
|
+
opacity: query2.loading && !state.usesQueryState ? import_tokens29.tokens.states.opacity.pending : void 0
|
|
5447
5546
|
},
|
|
5448
5547
|
children
|
|
5449
5548
|
},
|
|
@@ -5485,7 +5584,7 @@ var KjunErrorBoundary = class extends import_react43.Component {
|
|
|
5485
5584
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5486
5585
|
|
|
5487
5586
|
// packages/react/src/skeletons.tsx
|
|
5488
|
-
var
|
|
5587
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5489
5588
|
|
|
5490
5589
|
// shared/package-runtime/chart-skeleton.ts
|
|
5491
5590
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5502,11 +5601,11 @@ function chartSkeletonKind(kind) {
|
|
|
5502
5601
|
}
|
|
5503
5602
|
|
|
5504
5603
|
// packages/react/src/market-skeleton.tsx
|
|
5505
|
-
var
|
|
5604
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5506
5605
|
|
|
5507
5606
|
// shared/package-runtime/market-layout.ts
|
|
5508
|
-
var
|
|
5509
|
-
var marketGeometry =
|
|
5607
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
5608
|
+
var marketGeometry = import_tokens30.tokens.extensions.marketTable;
|
|
5510
5609
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5511
5610
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5512
5611
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5547,15 +5646,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5547
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: [
|
|
5548
5647
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5549
5648
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5550
|
-
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 }) }) }),
|
|
5551
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))
|
|
5552
5651
|
] }) }),
|
|
5553
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: [
|
|
5554
|
-
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 }) }) }),
|
|
5555
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: [
|
|
5556
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5557
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5558
|
-
] }) : /* @__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))
|
|
5559
5658
|
] }, row)) })
|
|
5560
5659
|
] }) });
|
|
5561
5660
|
}
|
|
@@ -5566,7 +5665,7 @@ function KjunListSkeleton({
|
|
|
5566
5665
|
rows = 8,
|
|
5567
5666
|
variant = "market",
|
|
5568
5667
|
avatar = true,
|
|
5569
|
-
avatarSize =
|
|
5668
|
+
avatarSize = import_tokens32.tokens.extensions.skeleton.listAvatarSize,
|
|
5570
5669
|
quote = true
|
|
5571
5670
|
}) {
|
|
5572
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: [
|
|
@@ -5576,15 +5675,15 @@ function KjunListSkeleton({
|
|
|
5576
5675
|
KjunSkeleton,
|
|
5577
5676
|
{
|
|
5578
5677
|
type: "block",
|
|
5579
|
-
height:
|
|
5678
|
+
height: import_tokens32.tokens.extensions.skeleton.lineHeights.md,
|
|
5580
5679
|
width: i % 2 ? "80%" : "65%"
|
|
5581
5680
|
}
|
|
5582
5681
|
),
|
|
5583
|
-
/* @__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%" })
|
|
5584
5683
|
] }),
|
|
5585
5684
|
quote && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5586
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5587
|
-
/* @__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 })
|
|
5588
5687
|
] })
|
|
5589
5688
|
] }, i)) });
|
|
5590
5689
|
}
|
|
@@ -5600,17 +5699,17 @@ function KjunFormSkeleton({
|
|
|
5600
5699
|
"aria-hidden": "true",
|
|
5601
5700
|
className: "kjun-form-skeleton",
|
|
5602
5701
|
"data-columns": columns,
|
|
5603
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5702
|
+
style: { "--_kjun-form-skeleton-radius": `${import_tokens32.tokens.input[size].radius}px` },
|
|
5604
5703
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5605
5704
|
field ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5606
5705
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5607
|
-
/* @__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 }) })
|
|
5608
5707
|
),
|
|
5609
5708
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5610
5709
|
KjunSkeleton,
|
|
5611
5710
|
{
|
|
5612
5711
|
type: "block",
|
|
5613
|
-
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
|
|
5614
5713
|
}
|
|
5615
5714
|
)
|
|
5616
5715
|
] }, i))
|
|
@@ -5619,7 +5718,7 @@ function KjunFormSkeleton({
|
|
|
5619
5718
|
}
|
|
5620
5719
|
function KjunChartSkeleton({
|
|
5621
5720
|
kind: requestedKind = "frame",
|
|
5622
|
-
height =
|
|
5721
|
+
height = import_tokens32.tokens.extensions.chartSkeleton.height,
|
|
5623
5722
|
loadingText,
|
|
5624
5723
|
skeleton = true,
|
|
5625
5724
|
loadingDelay = 0,
|
|
@@ -5675,7 +5774,7 @@ function KjunChartSkeleton({
|
|
|
5675
5774
|
d: chartFramePath,
|
|
5676
5775
|
fill: "none",
|
|
5677
5776
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5678
|
-
strokeWidth:
|
|
5777
|
+
strokeWidth: import_tokens32.tokens.border.defaultWidth,
|
|
5679
5778
|
vectorEffect: "non-scaling-stroke"
|
|
5680
5779
|
}
|
|
5681
5780
|
)
|
|
@@ -5688,17 +5787,17 @@ function KjunChartSkeleton({
|
|
|
5688
5787
|
}
|
|
5689
5788
|
|
|
5690
5789
|
// packages/react/src/financial-display.tsx
|
|
5691
|
-
var
|
|
5790
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5692
5791
|
var import_react45 = require("react");
|
|
5693
5792
|
|
|
5694
5793
|
// packages/react/src/number-display.tsx
|
|
5695
|
-
var
|
|
5794
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5696
5795
|
|
|
5697
5796
|
// shared/package-runtime/use-number-motion.ts
|
|
5698
5797
|
var import_react44 = require("react");
|
|
5699
5798
|
|
|
5700
5799
|
// shared/package-runtime/number-motion.ts
|
|
5701
|
-
var
|
|
5800
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5702
5801
|
function createNumberMotion(apply) {
|
|
5703
5802
|
let frame = 0, revision = 0, current = 0;
|
|
5704
5803
|
let previous;
|
|
@@ -5729,7 +5828,7 @@ function createNumberMotion(apply) {
|
|
|
5729
5828
|
if (from === target) return;
|
|
5730
5829
|
const tick = (now) => {
|
|
5731
5830
|
if (version !== revision) return;
|
|
5732
|
-
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));
|
|
5733
5832
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5734
5833
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5735
5834
|
};
|
|
@@ -5808,7 +5907,7 @@ function KjunPriceCell({
|
|
|
5808
5907
|
flashClass = "",
|
|
5809
5908
|
fromPrevious = true
|
|
5810
5909
|
}) {
|
|
5811
|
-
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: [
|
|
5812
5911
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5813
5912
|
"span",
|
|
5814
5913
|
{
|
|
@@ -5856,7 +5955,7 @@ function KjunSignedValue({
|
|
|
5856
5955
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5857
5956
|
},
|
|
5858
5957
|
children: [
|
|
5859
|
-
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,
|
|
5860
5959
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunFreshness, { stale: true })
|
|
5861
5960
|
]
|
|
5862
5961
|
}
|
|
@@ -5865,7 +5964,7 @@ function KjunSignedValue({
|
|
|
5865
5964
|
|
|
5866
5965
|
// packages/react/src/financial-display.tsx
|
|
5867
5966
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5868
|
-
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 };
|
|
5869
5968
|
function KjunDeviation({
|
|
5870
5969
|
value,
|
|
5871
5970
|
variant = "pill",
|
|
@@ -5877,7 +5976,7 @@ function KjunDeviation({
|
|
|
5877
5976
|
const n = finiteNumber(value);
|
|
5878
5977
|
if (n === null)
|
|
5879
5978
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5880
|
-
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) + "%";
|
|
5881
5980
|
if (variant === "badge")
|
|
5882
5981
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5883
5982
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -5897,7 +5996,7 @@ function KjunDeviation({
|
|
|
5897
5996
|
KjunIcon,
|
|
5898
5997
|
{
|
|
5899
5998
|
name: "alert-triangle",
|
|
5900
|
-
size:
|
|
5999
|
+
size: import_tokens35.tokens.extensions.financial.warningIconSize,
|
|
5901
6000
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5902
6001
|
}
|
|
5903
6002
|
) })
|
|
@@ -5910,7 +6009,7 @@ function KjunDeviation({
|
|
|
5910
6009
|
className: "kjun-deviation",
|
|
5911
6010
|
ref: domainColorRef(!neutral),
|
|
5912
6011
|
"data-variant": variant,
|
|
5913
|
-
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 },
|
|
5914
6013
|
children: [
|
|
5915
6014
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5916
6015
|
"span",
|
|
@@ -5938,7 +6037,7 @@ function KjunHeatmapCell({
|
|
|
5938
6037
|
}) {
|
|
5939
6038
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5940
6039
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5941
|
-
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;
|
|
5942
6041
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5943
6042
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5944
6043
|
"span",
|
|
@@ -5957,7 +6056,7 @@ function KjunProgressCell({
|
|
|
5957
6056
|
showLabel = true,
|
|
5958
6057
|
color = "auto",
|
|
5959
6058
|
customColor,
|
|
5960
|
-
height =
|
|
6059
|
+
height = import_tokens35.tokens.extensions.financial.progressHeight
|
|
5961
6060
|
}) {
|
|
5962
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;
|
|
5963
6062
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5981,7 +6080,7 @@ function KjunCollectionMark({
|
|
|
5981
6080
|
active = false,
|
|
5982
6081
|
size = "md"
|
|
5983
6082
|
}) {
|
|
5984
|
-
const box =
|
|
6083
|
+
const box = import_tokens35.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens35.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5985
6084
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5986
6085
|
KjunIcon,
|
|
5987
6086
|
{
|
|
@@ -6017,8 +6116,8 @@ function KjunExecutionStatusBadge({
|
|
|
6017
6116
|
}
|
|
6018
6117
|
function KjunSparkline({
|
|
6019
6118
|
data = [],
|
|
6020
|
-
width =
|
|
6021
|
-
height =
|
|
6119
|
+
width = import_tokens35.tokens.extensions.financial.sparklineWidth,
|
|
6120
|
+
height = import_tokens35.tokens.extensions.financial.sparklineHeight,
|
|
6022
6121
|
color,
|
|
6023
6122
|
semantic = "price",
|
|
6024
6123
|
fill = true,
|
|
@@ -6073,7 +6172,7 @@ function KjunSparkline({
|
|
|
6073
6172
|
}
|
|
6074
6173
|
|
|
6075
6174
|
// shared/package-runtime/table.ts
|
|
6076
|
-
var
|
|
6175
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6077
6176
|
var import_react46 = require("react");
|
|
6078
6177
|
|
|
6079
6178
|
// shared/package-runtime/table-model.ts
|
|
@@ -6147,7 +6246,7 @@ function useTableModel(props) {
|
|
|
6147
6246
|
sortColumn: (col) => {
|
|
6148
6247
|
var _a2;
|
|
6149
6248
|
if (!sortable || !col.sortable) return;
|
|
6150
|
-
const next = (0,
|
|
6249
|
+
const next = (0, import_tokens36.nextTableSort)(sort, col.key);
|
|
6151
6250
|
if (props.sort === void 0) setSort(next);
|
|
6152
6251
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
6153
6252
|
},
|
|
@@ -6211,7 +6310,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6211
6310
|
}
|
|
6212
6311
|
|
|
6213
6312
|
// packages/react/src/table-toolbar.tsx
|
|
6214
|
-
var
|
|
6313
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6215
6314
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6216
6315
|
function TableToolbar({
|
|
6217
6316
|
selectable,
|
|
@@ -6254,7 +6353,7 @@ function TableToolbar({
|
|
|
6254
6353
|
KjunInput,
|
|
6255
6354
|
{
|
|
6256
6355
|
size: "sm",
|
|
6257
|
-
style: { width:
|
|
6356
|
+
style: { width: import_tokens37.tokens.table.searchWidth, maxWidth: "100%" },
|
|
6258
6357
|
value: search,
|
|
6259
6358
|
ariaLabel: m.searchTable,
|
|
6260
6359
|
placeholder: searchPlaceholder,
|
|
@@ -6270,22 +6369,16 @@ function TableToolbar({
|
|
|
6270
6369
|
}
|
|
6271
6370
|
|
|
6272
6371
|
// packages/react/src/table-grid.tsx
|
|
6273
|
-
var
|
|
6372
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6274
6373
|
var import_react48 = require("react");
|
|
6275
6374
|
|
|
6276
6375
|
// packages/react/src/table-check.tsx
|
|
6277
6376
|
var import_react47 = require("react");
|
|
6278
|
-
|
|
6279
|
-
// shared/package-runtime/component-icons.ts
|
|
6280
|
-
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
6281
|
-
var componentIcons = { minus: import_minus.default };
|
|
6282
|
-
|
|
6283
|
-
// packages/react/src/table-check.tsx
|
|
6284
|
-
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6377
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6285
6378
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6286
6379
|
var TableCheck = (0, import_react47.forwardRef)(
|
|
6287
6380
|
function TableCheck2(props, ref) {
|
|
6288
|
-
const size =
|
|
6381
|
+
const size = import_tokens38.tokens.extensions.checkbox.iconSizes.sm;
|
|
6289
6382
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "kjun-table-check", children: [
|
|
6290
6383
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
6291
6384
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6342,7 +6435,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6342
6435
|
KjunIcon,
|
|
6343
6436
|
{
|
|
6344
6437
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6345
|
-
size:
|
|
6438
|
+
size: import_tokens39.tokens.table.sortIconSize
|
|
6346
6439
|
}
|
|
6347
6440
|
)
|
|
6348
6441
|
]
|
|
@@ -6355,14 +6448,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6355
6448
|
}
|
|
6356
6449
|
),
|
|
6357
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: [
|
|
6358
|
-
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 }) }),
|
|
6359
6452
|
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
6360
6453
|
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6361
6454
|
KjunSkeleton,
|
|
6362
6455
|
{
|
|
6363
6456
|
type: "block",
|
|
6364
|
-
height:
|
|
6365
|
-
width: col.key === "actions" ?
|
|
6457
|
+
height: import_tokens39.tokens.table.skeletonHeight,
|
|
6458
|
+
width: col.key === "actions" ? import_tokens39.tokens.table.actionColumnWidth : "75%"
|
|
6366
6459
|
}
|
|
6367
6460
|
) }, col.key))
|
|
6368
6461
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6517,7 +6610,7 @@ function TableCards({
|
|
|
6517
6610
|
|
|
6518
6611
|
// packages/react/src/table-view.tsx
|
|
6519
6612
|
var import_react49 = require("react");
|
|
6520
|
-
var
|
|
6613
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6521
6614
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6522
6615
|
function KjunTable(props) {
|
|
6523
6616
|
const m = useKjunMessages();
|
|
@@ -6549,7 +6642,7 @@ function KjunTable(props) {
|
|
|
6549
6642
|
} = props;
|
|
6550
6643
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react49.useState)(false);
|
|
6551
6644
|
(0, import_react49.useEffect)(() => {
|
|
6552
|
-
const media = matchMedia(`(width < ${
|
|
6645
|
+
const media = matchMedia(`(width < ${import_tokens40.tokens.table.mobileBreakpoint}px)`);
|
|
6553
6646
|
const update = () => setMobile(media.matches);
|
|
6554
6647
|
update();
|
|
6555
6648
|
media.addEventListener("change", update);
|
|
@@ -6569,7 +6662,7 @@ function KjunTable(props) {
|
|
|
6569
6662
|
};
|
|
6570
6663
|
const customClass = (row, i) => typeof rowClass === "function" ? rowClass(row, i) : rowClass || "";
|
|
6571
6664
|
const rowKeyDown = (event, row, index) => {
|
|
6572
|
-
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0,
|
|
6665
|
+
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0, import_tokens40.isComposingKey)(event)) return;
|
|
6573
6666
|
if (event.key === "Enter" || event.key === " ") {
|
|
6574
6667
|
event.preventDefault();
|
|
6575
6668
|
onRowClick(row, index);
|
|
@@ -6653,7 +6746,7 @@ function KjunTable(props) {
|
|
|
6653
6746
|
}
|
|
6654
6747
|
|
|
6655
6748
|
// packages/react/src/kpi.tsx
|
|
6656
|
-
var
|
|
6749
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6657
6750
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6658
6751
|
var kpiFormat = (item, value = item.value) => {
|
|
6659
6752
|
var _a, _b;
|
|
@@ -6662,7 +6755,7 @@ var kpiFormat = (item, value = item.value) => {
|
|
|
6662
6755
|
maximumFractionDigits: (_b = item.decimals) != null ? _b : 0
|
|
6663
6756
|
}).format(item.semantic === "price" ? Math.abs(value) : value);
|
|
6664
6757
|
};
|
|
6665
|
-
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})`;
|
|
6666
6759
|
function KjunKpiHero(props) {
|
|
6667
6760
|
const {
|
|
6668
6761
|
loading = false,
|
|
@@ -6721,7 +6814,7 @@ function KjunKpiHero(props) {
|
|
|
6721
6814
|
] }) }),
|
|
6722
6815
|
showDelta && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6723
6816
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6724
|
-
/* @__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 }) })
|
|
6725
6818
|
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6726
6819
|
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6727
6820
|
"span",
|
|
@@ -6830,11 +6923,11 @@ function KjunKpiRow({
|
|
|
6830
6923
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
6831
6924
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
6832
6925
|
var _a2, _b;
|
|
6833
|
-
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-")));
|
|
6834
6927
|
})),
|
|
6835
6928
|
children: items.map((item, i) => {
|
|
6836
|
-
var _a2;
|
|
6837
|
-
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 = () => {
|
|
6838
6931
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6839
6932
|
};
|
|
6840
6933
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
@@ -6842,6 +6935,7 @@ function KjunKpiRow({
|
|
|
6842
6935
|
{
|
|
6843
6936
|
role: item.clickable ? "button" : void 0,
|
|
6844
6937
|
tabIndex: item.clickable && !busy ? 0 : void 0,
|
|
6938
|
+
"data-state": busy ? "loading" : present || item.valueSegments ? "ready" : "missing",
|
|
6845
6939
|
"aria-disabled": item.clickable && busy || void 0,
|
|
6846
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" : ""),
|
|
6847
6941
|
onClick: click,
|
|
@@ -6853,7 +6947,7 @@ function KjunKpiRow({
|
|
|
6853
6947
|
},
|
|
6854
6948
|
children: [
|
|
6855
6949
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6856
|
-
/* @__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 }),
|
|
6857
6951
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6858
6952
|
] }),
|
|
6859
6953
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6861,9 +6955,9 @@ function KjunKpiRow({
|
|
|
6861
6955
|
"div",
|
|
6862
6956
|
{
|
|
6863
6957
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
6864
|
-
title: item.valueKind === "text" ? String(
|
|
6958
|
+
title: item.valueKind === "text" && present ? String(value) : void 0,
|
|
6865
6959
|
style: {
|
|
6866
|
-
color: item.valueClass ? void 0 : kpiColor(
|
|
6960
|
+
color: item.valueClass ? void 0 : kpiColor(value, item.semantic)
|
|
6867
6961
|
},
|
|
6868
6962
|
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6869
6963
|
"span",
|
|
@@ -6875,18 +6969,18 @@ function KjunKpiRow({
|
|
|
6875
6969
|
]
|
|
6876
6970
|
},
|
|
6877
6971
|
j
|
|
6878
|
-
)) : 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: [
|
|
6879
6973
|
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6880
|
-
item.animated && typeof
|
|
6974
|
+
item.animated && typeof value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6881
6975
|
KjunAnimatedNumber,
|
|
6882
6976
|
{
|
|
6883
6977
|
fromPrevious: true,
|
|
6884
|
-
value
|
|
6885
|
-
formatter:
|
|
6978
|
+
value,
|
|
6979
|
+
formatter: format2
|
|
6886
6980
|
}
|
|
6887
|
-
) :
|
|
6981
|
+
) : format2(value),
|
|
6888
6982
|
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6889
|
-
] })
|
|
6983
|
+
] }) : (_b = item.missingText) != null ? _b : "\u2014")
|
|
6890
6984
|
}
|
|
6891
6985
|
),
|
|
6892
6986
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
@@ -6896,7 +6990,7 @@ function KjunKpiRow({
|
|
|
6896
6990
|
{
|
|
6897
6991
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6898
6992
|
style: {
|
|
6899
|
-
color: item.descClass ? void 0 : kpiColor(
|
|
6993
|
+
color: item.descClass ? void 0 : kpiColor(value, item.semantic, "text-secondary")
|
|
6900
6994
|
},
|
|
6901
6995
|
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6902
6996
|
}
|
|
@@ -6911,7 +7005,7 @@ function KjunKpiRow({
|
|
|
6911
7005
|
}
|
|
6912
7006
|
|
|
6913
7007
|
// packages/react/src/market-cards.tsx
|
|
6914
|
-
var
|
|
7008
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
6915
7009
|
|
|
6916
7010
|
// shared/package-runtime/market-cards.ts
|
|
6917
7011
|
var import_react50 = require("react");
|
|
@@ -7119,10 +7213,10 @@ function KjunMarketCards(props) {
|
|
|
7119
7213
|
KjunSparkline,
|
|
7120
7214
|
{
|
|
7121
7215
|
data: getValue(row, state.key) || [],
|
|
7122
|
-
width:
|
|
7123
|
-
height:
|
|
7216
|
+
width: import_tokens42.tokens.extensions.marketTable.sparklineWidth,
|
|
7217
|
+
height: import_tokens42.tokens.extensions.marketTable.sparklineHeight
|
|
7124
7218
|
}
|
|
7125
|
-
) : 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)(
|
|
7126
7220
|
KjunSignedValue,
|
|
7127
7221
|
{
|
|
7128
7222
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -7130,7 +7224,7 @@ function KjunMarketCards(props) {
|
|
|
7130
7224
|
stale: !!getValue(row, "stale"),
|
|
7131
7225
|
tone: "pill"
|
|
7132
7226
|
}
|
|
7133
|
-
) : 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: [
|
|
7134
7228
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
7135
7229
|
props,
|
|
7136
7230
|
row,
|
|
@@ -7153,7 +7247,7 @@ function KjunMarketCards(props) {
|
|
|
7153
7247
|
}
|
|
7154
7248
|
|
|
7155
7249
|
// packages/react/src/market-list.tsx
|
|
7156
|
-
var
|
|
7250
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
7157
7251
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
7158
7252
|
function KjunMarketSimpleList(props) {
|
|
7159
7253
|
const m = useKjunMessages();
|
|
@@ -7220,7 +7314,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7220
7314
|
fetchedAt
|
|
7221
7315
|
}
|
|
7222
7316
|
)),
|
|
7223
|
-
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)(
|
|
7224
7318
|
KjunSignedValue,
|
|
7225
7319
|
{
|
|
7226
7320
|
value: change,
|
|
@@ -7244,7 +7338,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7244
7338
|
}
|
|
7245
7339
|
|
|
7246
7340
|
// packages/react/src/market-panel.tsx
|
|
7247
|
-
var
|
|
7341
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7248
7342
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7249
7343
|
function KjunMarketListPanel({
|
|
7250
7344
|
controls,
|
|
@@ -7252,12 +7346,12 @@ function KjunMarketListPanel({
|
|
|
7252
7346
|
}) {
|
|
7253
7347
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(KjunCard, { children: [
|
|
7254
7348
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: controls }),
|
|
7255
|
-
/* @__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 })
|
|
7256
7350
|
] });
|
|
7257
7351
|
}
|
|
7258
7352
|
|
|
7259
7353
|
// packages/react/src/market-table.tsx
|
|
7260
|
-
var
|
|
7354
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7261
7355
|
|
|
7262
7356
|
// shared/package-runtime/trailing-overflow.ts
|
|
7263
7357
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7301,7 +7395,7 @@ function KjunMarketTable(props) {
|
|
|
7301
7395
|
const render = (row, col) => {
|
|
7302
7396
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7303
7397
|
if (cellLoading(row, col))
|
|
7304
|
-
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 });
|
|
7305
7399
|
if (renderCell) return renderCell(row, col);
|
|
7306
7400
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7307
7401
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarketIdentity, { row, props });
|
|
@@ -7310,8 +7404,8 @@ function KjunMarketTable(props) {
|
|
|
7310
7404
|
KjunSparkline,
|
|
7311
7405
|
{
|
|
7312
7406
|
data: Array.isArray(value) ? value : [],
|
|
7313
|
-
width:
|
|
7314
|
-
height:
|
|
7407
|
+
width: import_tokens45.tokens.extensions.marketTable.sparklineWidth,
|
|
7408
|
+
height: import_tokens45.tokens.extensions.marketTable.sparklineHeight
|
|
7315
7409
|
}
|
|
7316
7410
|
);
|
|
7317
7411
|
if (col.type === "price")
|
|
@@ -7393,7 +7487,7 @@ function KjunMarketTable(props) {
|
|
|
7393
7487
|
KjunIcon,
|
|
7394
7488
|
{
|
|
7395
7489
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7396
|
-
size:
|
|
7490
|
+
size: import_tokens45.tokens.extensions.marketTable.sortIconSize
|
|
7397
7491
|
}
|
|
7398
7492
|
)
|
|
7399
7493
|
]
|
|
@@ -7453,7 +7547,7 @@ function KjunMarketTable(props) {
|
|
|
7453
7547
|
{
|
|
7454
7548
|
style: {
|
|
7455
7549
|
textAlign: col.align,
|
|
7456
|
-
fontWeight: col.weight === "bold" ?
|
|
7550
|
+
fontWeight: col.weight === "bold" ? import_tokens45.tokens.typography.control.fontWeight : void 0
|
|
7457
7551
|
},
|
|
7458
7552
|
children: [
|
|
7459
7553
|
render(row, col),
|
|
@@ -7486,52 +7580,64 @@ function KjunMarketTable(props) {
|
|
|
7486
7580
|
}
|
|
7487
7581
|
|
|
7488
7582
|
// packages/react/src/list.tsx
|
|
7489
|
-
var
|
|
7583
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7490
7584
|
var import_react52 = require("react");
|
|
7491
7585
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7492
|
-
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 }) {
|
|
7493
7587
|
const content = (0, import_react52.useRef)(null), pressable = !!(href || onClick);
|
|
7494
7588
|
(0, import_react52.useEffect)(() => {
|
|
7495
7589
|
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7496
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);
|
|
7497
7592
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
7498
|
-
|
|
7593
|
+
front && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-leading", children: front }),
|
|
7499
7594
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-list-body", children: [
|
|
7500
7595
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
7501
7596
|
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-description", children: description }),
|
|
7502
7597
|
hasContent(children) && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { ref: content, className: "kjun-list-content", children })
|
|
7503
7598
|
] }),
|
|
7504
7599
|
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7505
|
-
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 })
|
|
7506
7601
|
] });
|
|
7507
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 });
|
|
7508
|
-
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: [
|
|
7509
7604
|
main,
|
|
7510
7605
|
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7511
7606
|
] });
|
|
7512
7607
|
}
|
|
7513
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7608
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default", radius = "none" }) {
|
|
7514
7609
|
const id = "kjun-" + (0, import_react52.useId)();
|
|
7515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7611
|
+
"section",
|
|
7612
|
+
{
|
|
7613
|
+
className: "kjun-list-section",
|
|
7614
|
+
"data-surface": surface ? void 0 : "false",
|
|
7615
|
+
"data-radius": radius === "none" ? void 0 : radius,
|
|
7616
|
+
style: radius === "none" ? void 0 : { borderRadius: `var(--_kjun-geometry-card-radii-${radius})` },
|
|
7617
|
+
"aria-labelledby": title ? id : void 0,
|
|
7618
|
+
"aria-label": title ? void 0 : ariaLabel,
|
|
7619
|
+
children: [
|
|
7620
|
+
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-list-heading", "data-bare": title && !description ? "" : void 0, children: [
|
|
7621
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
7622
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { id, children: title }),
|
|
7623
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description })
|
|
7624
|
+
] }),
|
|
7625
|
+
actions
|
|
7626
|
+
] }),
|
|
7627
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
|
|
7628
|
+
]
|
|
7629
|
+
}
|
|
7630
|
+
);
|
|
7525
7631
|
}
|
|
7526
7632
|
function KjunListItem({ children }) {
|
|
7527
7633
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { className: "kjun-list-item", children });
|
|
7528
7634
|
}
|
|
7529
7635
|
|
|
7530
7636
|
// packages/react/src/app-navigation.tsx
|
|
7531
|
-
var
|
|
7637
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7532
7638
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7533
|
-
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7534
|
-
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: [
|
|
7535
7641
|
leading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7536
7642
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
7537
7643
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: title }),
|
|
@@ -7540,19 +7646,19 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
7540
7646
|
actions && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children: actions })
|
|
7541
7647
|
] }) }) });
|
|
7542
7648
|
}
|
|
7543
|
-
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 }) {
|
|
7544
7650
|
const m = useKjunMessages();
|
|
7545
7651
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
7546
7652
|
const hasIcons = items.some((item) => item.icon);
|
|
7547
7653
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7548
|
-
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) => {
|
|
7549
7655
|
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
7550
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) => {
|
|
7551
7657
|
if (item.disabled) event.preventDefault();
|
|
7552
7658
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7553
7659
|
}, children: [
|
|
7554
7660
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
7555
|
-
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 }),
|
|
7556
7662
|
badge
|
|
7557
7663
|
] }),
|
|
7558
7664
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7562,9 +7668,9 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7562
7668
|
] }, item.key);
|
|
7563
7669
|
}) });
|
|
7564
7670
|
}
|
|
7565
|
-
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7671
|
+
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false, surface = true }) {
|
|
7566
7672
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7567
|
-
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: [
|
|
7568
7674
|
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { children: description }),
|
|
7569
7675
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
7570
7676
|
] }) });
|
|
@@ -7572,7 +7678,7 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
7572
7678
|
|
|
7573
7679
|
// packages/react/src/media.tsx
|
|
7574
7680
|
var import_react53 = require("react");
|
|
7575
|
-
var
|
|
7681
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7576
7682
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7577
7683
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7578
7684
|
const current = (0, import_react53.useRef)({ src, version: 0 });
|
|
@@ -7591,28 +7697,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7591
7697
|
setResult({ version, state: "error" });
|
|
7592
7698
|
onError == null ? void 0 : onError();
|
|
7593
7699
|
} }, version),
|
|
7594
|
-
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 }) })
|
|
7595
7701
|
] });
|
|
7596
7702
|
}
|
|
7597
7703
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7598
7704
|
const m = useKjunMessages();
|
|
7599
|
-
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 }) });
|
|
7600
7706
|
}
|
|
7601
7707
|
|
|
7602
7708
|
// packages/react/src/chip.tsx
|
|
7603
|
-
var
|
|
7709
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
7604
7710
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7605
7711
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7606
7712
|
const m = useKjunMessages();
|
|
7607
7713
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7608
|
-
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] }),
|
|
7609
7715
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: label }),
|
|
7610
|
-
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] }) })
|
|
7611
7717
|
] });
|
|
7612
7718
|
}
|
|
7613
7719
|
|
|
7614
7720
|
// packages/react/src/fab.tsx
|
|
7615
|
-
var
|
|
7721
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
7616
7722
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7617
7723
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7618
7724
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
@@ -7623,8 +7729,8 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7623
7729
|
"aria-label": ariaLabel,
|
|
7624
7730
|
disabled,
|
|
7625
7731
|
onClick,
|
|
7626
|
-
style: { bottom:
|
|
7627
|
-
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 })
|
|
7628
7734
|
}
|
|
7629
7735
|
);
|
|
7630
7736
|
}
|
|
@@ -7632,12 +7738,22 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7632
7738
|
// packages/react/src/range-input.tsx
|
|
7633
7739
|
var import_react54 = require("react");
|
|
7634
7740
|
var import_react_aria_components10 = require("react-aria-components");
|
|
7635
|
-
var
|
|
7741
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
7636
7742
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7637
|
-
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 }) {
|
|
7638
7754
|
const m = useKjunMessages();
|
|
7639
7755
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7640
|
-
const domain = (0,
|
|
7756
|
+
const domain = (0, import_tokens51.createSliderDomain)(min, max, step);
|
|
7641
7757
|
const list = Array.isArray(value) ? value : [value];
|
|
7642
7758
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7643
7759
|
const latest = (0, import_react54.useRef)(value);
|
|
@@ -7661,14 +7777,14 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7661
7777
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7662
7778
|
}
|
|
7663
7779
|
}, children: [
|
|
7664
|
-
/* @__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: [
|
|
7665
7781
|
label && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components10.Label, { className: "kjun-slider-label", children: label }),
|
|
7666
|
-
/* @__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 ") })
|
|
7667
7783
|
] }),
|
|
7668
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: [
|
|
7669
7785
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "kjun-slider-rail" }),
|
|
7670
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 + "%" } }),
|
|
7671
|
-
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))
|
|
7672
7788
|
] }) })
|
|
7673
7789
|
] });
|
|
7674
7790
|
}
|
|
@@ -7681,13 +7797,13 @@ function KjunRangeSlider(props) {
|
|
|
7681
7797
|
|
|
7682
7798
|
// packages/react/src/quantity-stepper.tsx
|
|
7683
7799
|
var import_react55 = require("react");
|
|
7684
|
-
var
|
|
7800
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
7685
7801
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7686
7802
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7687
7803
|
const m = useKjunMessages();
|
|
7688
|
-
const geometry =
|
|
7689
|
-
const buttonStyle = { width:
|
|
7690
|
-
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 });
|
|
7691
7807
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7692
7808
|
const [draft, setDraft] = (0, import_react55.useState)(String(value));
|
|
7693
7809
|
const field = useKjunField();
|
|
@@ -7721,7 +7837,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7721
7837
|
};
|
|
7722
7838
|
const key = (event) => {
|
|
7723
7839
|
if (blocked) return;
|
|
7724
|
-
const action = (0,
|
|
7840
|
+
const action = (0, import_tokens52.quantityKeyAction)(event, composing.current, dirty.current);
|
|
7725
7841
|
if (!action) return;
|
|
7726
7842
|
event.preventDefault();
|
|
7727
7843
|
if (action === "cancel") {
|
|
@@ -7773,7 +7889,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7773
7889
|
|
|
7774
7890
|
// packages/react/src/time-picker.tsx
|
|
7775
7891
|
var import_react56 = require("react");
|
|
7776
|
-
var
|
|
7892
|
+
var import_tokens53 = require("@kjun-ui/tokens");
|
|
7777
7893
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7778
7894
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7779
7895
|
const m = useKjunMessages();
|
|
@@ -7781,7 +7897,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7781
7897
|
const root = (0, import_react56.useRef)(null);
|
|
7782
7898
|
const field = useKjunField(), uid = (0, import_react56.useId)();
|
|
7783
7899
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7784
|
-
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]);
|
|
7785
7901
|
const valid = domain.valid && domain.accepts(value);
|
|
7786
7902
|
(0, import_react56.useEffect)(() => {
|
|
7787
7903
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|