@kjun-ui/react 0.13.0 → 0.14.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 +514 -401
- package/dist/index.js +414 -300
- package/dist/styles.css +72 -0
- package/dist/types/packages/react/src/card.d.cts +8 -2
- package/dist/types/packages/react/src/card.d.ts +8 -2
- package/dist/types/packages/react/src/display.d.cts +2 -1
- package/dist/types/packages/react/src/display.d.ts +2 -1
- package/dist/types/packages/react/src/feedback.d.cts +5 -2
- package/dist/types/packages/react/src/feedback.d.ts +5 -2
- package/dist/types/packages/react/src/layout-primitives.d.cts +1 -1
- package/dist/types/packages/react/src/layout-primitives.d.ts +1 -1
- package/dist/types/packages/react/src/list.d.cts +13 -2
- package/dist/types/packages/react/src/list.d.ts +13 -2
- package/dist/types/packages/react/src/media.d.cts +4 -2
- package/dist/types/packages/react/src/media.d.ts +4 -2
- package/dist/types/shared/package-runtime/layout-primitives.d.cts +1 -1
- package/dist/types/shared/package-runtime/layout-primitives.d.ts +1 -1
- package/dist/types/shared/package-runtime/progress-circle.d.cts +11 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +11 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,7 @@ __export(index_exports, {
|
|
|
74
74
|
KjunInput: () => KjunInput,
|
|
75
75
|
KjunKpiHero: () => KjunKpiHero,
|
|
76
76
|
KjunKpiRow: () => KjunKpiRow,
|
|
77
|
+
KjunListItem: () => KjunListItem,
|
|
77
78
|
KjunListRow: () => KjunListRow,
|
|
78
79
|
KjunListSection: () => KjunListSection,
|
|
79
80
|
KjunListSkeleton: () => KjunListSkeleton,
|
|
@@ -113,6 +114,7 @@ __export(index_exports, {
|
|
|
113
114
|
KjunTimePicker: () => KjunTimePicker,
|
|
114
115
|
KjunTooltip: () => KjunTooltip,
|
|
115
116
|
KjunTopNavigation: () => KjunTopNavigation,
|
|
117
|
+
createKjunFeedback: () => import_tokens16.createKjunFeedback,
|
|
116
118
|
groupKeydown: () => groupKeydown,
|
|
117
119
|
kjunMessagesEn: () => kjunMessagesEn,
|
|
118
120
|
kjunMessagesKo: () => kjunMessagesKo,
|
|
@@ -1670,11 +1672,39 @@ function alertRole(tone, live) {
|
|
|
1670
1672
|
}
|
|
1671
1673
|
|
|
1672
1674
|
// packages/react/src/display.tsx
|
|
1675
|
+
var import_tokens11 = require("@kjun-ui/tokens");
|
|
1676
|
+
|
|
1677
|
+
// shared/package-runtime/progress-circle.ts
|
|
1673
1678
|
var import_tokens10 = require("@kjun-ui/tokens");
|
|
1674
|
-
|
|
1679
|
+
function progressCircle(size, percentage) {
|
|
1680
|
+
const { size: diameter, stroke } = import_tokens10.tokens.extensions.progress.circle[size];
|
|
1681
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1682
|
+
return {
|
|
1683
|
+
diameter,
|
|
1684
|
+
stroke,
|
|
1685
|
+
radius,
|
|
1686
|
+
centre: diameter / 2,
|
|
1687
|
+
circumference,
|
|
1688
|
+
offset: circumference * (1 - percentage / 100),
|
|
1689
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
1690
|
+
showsPercentage: size !== "sm"
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// packages/react/src/display.tsx
|
|
1695
|
+
var import_react16 = require("react");
|
|
1675
1696
|
|
|
1676
1697
|
// packages/react/src/card.tsx
|
|
1698
|
+
var import_react15 = require("react");
|
|
1677
1699
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1700
|
+
var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
1701
|
+
function developmentMode3() {
|
|
1702
|
+
try {
|
|
1703
|
+
return true;
|
|
1704
|
+
} catch (e) {
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1678
1708
|
function KjunCard({
|
|
1679
1709
|
title,
|
|
1680
1710
|
subtitle,
|
|
@@ -1689,17 +1719,46 @@ function KjunCard({
|
|
|
1689
1719
|
elevation = "flat",
|
|
1690
1720
|
border = false,
|
|
1691
1721
|
dividers = false,
|
|
1722
|
+
pressable = false,
|
|
1723
|
+
disabled = false,
|
|
1724
|
+
ariaLabel,
|
|
1692
1725
|
children,
|
|
1693
1726
|
style,
|
|
1694
1727
|
className = "",
|
|
1728
|
+
onClick,
|
|
1729
|
+
onKeyDown,
|
|
1695
1730
|
...props
|
|
1696
1731
|
}) {
|
|
1732
|
+
const root = (0, import_react15.useRef)(null);
|
|
1733
|
+
(0, import_react15.useEffect)(() => {
|
|
1734
|
+
var _a;
|
|
1735
|
+
if (pressable && developmentMode3() && ((_a = root.current) == null ? void 0 : _a.querySelector(interactive)))
|
|
1736
|
+
console.warn("KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
|
|
1737
|
+
}, [pressable]);
|
|
1738
|
+
const press = pressable ? {
|
|
1739
|
+
role: "button",
|
|
1740
|
+
tabIndex: disabled ? -1 : 0,
|
|
1741
|
+
"aria-disabled": disabled || void 0,
|
|
1742
|
+
"aria-label": ariaLabel != null ? ariaLabel : title,
|
|
1743
|
+
"data-pressable": "",
|
|
1744
|
+
onClick: (event) => {
|
|
1745
|
+
if (!disabled) onClick == null ? void 0 : onClick(event);
|
|
1746
|
+
},
|
|
1747
|
+
onKeyDown: (event) => {
|
|
1748
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
1749
|
+
if (event.defaultPrevented || disabled || event.key !== "Enter" && event.key !== " ") return;
|
|
1750
|
+
event.preventDefault();
|
|
1751
|
+
event.currentTarget.click();
|
|
1752
|
+
}
|
|
1753
|
+
} : { onClick, onKeyDown };
|
|
1697
1754
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
1698
1755
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
1699
1756
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1700
1757
|
"div",
|
|
1701
1758
|
{
|
|
1702
1759
|
...props,
|
|
1760
|
+
...press,
|
|
1761
|
+
ref: root,
|
|
1703
1762
|
className: ["kjun-card", className].filter(Boolean).join(" "),
|
|
1704
1763
|
"data-surface": surface,
|
|
1705
1764
|
"data-padding": padding,
|
|
@@ -1711,7 +1770,8 @@ function KjunCard({
|
|
|
1711
1770
|
"--_kjun-card-padding": `var(--_kjun-geometry-card-padding-${padding})`,
|
|
1712
1771
|
"--_kjun-card-body-padding": `var(--_kjun-geometry-card-padding-${bodyPadding})`,
|
|
1713
1772
|
borderRadius: `var(--_kjun-geometry-card-radii-${radius})`,
|
|
1714
|
-
|
|
1773
|
+
// A pressable card's shadow comes from CSS so its hover lift can replace it.
|
|
1774
|
+
[pressable ? "--_kjun-card-shadow" : "boxShadow"]: `var(--_kjun-card-elevation-${elevation})`,
|
|
1715
1775
|
...style
|
|
1716
1776
|
},
|
|
1717
1777
|
children: [
|
|
@@ -1741,7 +1801,7 @@ function KjunBadge({
|
|
|
1741
1801
|
style,
|
|
1742
1802
|
...props
|
|
1743
1803
|
}) {
|
|
1744
|
-
const { x, y } =
|
|
1804
|
+
const { x, y } = import_tokens11.tokens.extensions.badge.padding[size];
|
|
1745
1805
|
const neutral = variant === "default" || variant === "secondary";
|
|
1746
1806
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1747
1807
|
"span",
|
|
@@ -1776,7 +1836,7 @@ function KjunEmpty({
|
|
|
1776
1836
|
const m = useKjunMessages();
|
|
1777
1837
|
text != null ? text : text = m.noData;
|
|
1778
1838
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-empty", children: [
|
|
1779
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size:
|
|
1839
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size: import_tokens11.tokens.extensions.empty.iconSize }),
|
|
1780
1840
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: text }),
|
|
1781
1841
|
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: description }),
|
|
1782
1842
|
children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children })
|
|
@@ -1784,14 +1844,14 @@ function KjunEmpty({
|
|
|
1784
1844
|
}
|
|
1785
1845
|
function KjunSpinner({ size = "md", text }) {
|
|
1786
1846
|
const m = useKjunMessages();
|
|
1787
|
-
const stroke =
|
|
1847
|
+
const stroke = import_tokens11.tokens.extensions.spinner.strokeWidths[size] * 24 / import_tokens11.tokens.extensions.spinner.sizes[size];
|
|
1788
1848
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1789
1849
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1790
1850
|
"svg",
|
|
1791
1851
|
{
|
|
1792
1852
|
className: "kjun-spin",
|
|
1793
|
-
width:
|
|
1794
|
-
height:
|
|
1853
|
+
width: import_tokens11.tokens.extensions.spinner.sizes[size],
|
|
1854
|
+
height: import_tokens11.tokens.extensions.spinner.sizes[size],
|
|
1795
1855
|
viewBox: "0 0 24 24",
|
|
1796
1856
|
fill: "none",
|
|
1797
1857
|
"aria-hidden": "true",
|
|
@@ -1833,7 +1893,7 @@ function KjunAlert({
|
|
|
1833
1893
|
onClose
|
|
1834
1894
|
}) {
|
|
1835
1895
|
const m = useKjunMessages();
|
|
1836
|
-
const [visible, setVisible] = (0,
|
|
1896
|
+
const [visible, setVisible] = (0, import_react16.useState)(true);
|
|
1837
1897
|
if (!visible) return null;
|
|
1838
1898
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
1839
1899
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -1857,7 +1917,7 @@ function KjunAlert({
|
|
|
1857
1917
|
warning: "alert-triangle",
|
|
1858
1918
|
danger: "alert-circle"
|
|
1859
1919
|
}[tone],
|
|
1860
|
-
size:
|
|
1920
|
+
size: import_tokens11.tokens.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1861
1921
|
}
|
|
1862
1922
|
) }),
|
|
1863
1923
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-alert-content", children: [
|
|
@@ -1875,7 +1935,7 @@ function KjunAlert({
|
|
|
1875
1935
|
setVisible(false);
|
|
1876
1936
|
onClose == null ? void 0 : onClose();
|
|
1877
1937
|
},
|
|
1878
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size:
|
|
1938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size: import_tokens11.tokens.extensions.alert.closeIconSize })
|
|
1879
1939
|
}
|
|
1880
1940
|
)
|
|
1881
1941
|
]
|
|
@@ -1889,10 +1949,55 @@ function KjunProgress({
|
|
|
1889
1949
|
variant = "primary",
|
|
1890
1950
|
showLabel = false,
|
|
1891
1951
|
label,
|
|
1892
|
-
subLabel
|
|
1952
|
+
subLabel,
|
|
1953
|
+
shape = "bar"
|
|
1893
1954
|
}) {
|
|
1894
1955
|
const m = useKjunMessages();
|
|
1895
1956
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1957
|
+
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
1958
|
+
if (shape === "circle") {
|
|
1959
|
+
const c = progressCircle(size, percentage);
|
|
1960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1962
|
+
"div",
|
|
1963
|
+
{
|
|
1964
|
+
role: "progressbar",
|
|
1965
|
+
"aria-label": name,
|
|
1966
|
+
"aria-valuemin": 0,
|
|
1967
|
+
"aria-valuemax": 100,
|
|
1968
|
+
"aria-valuenow": percentage,
|
|
1969
|
+
className: "kjun-progress-circle",
|
|
1970
|
+
style: { width: c.diameter, height: c.diameter },
|
|
1971
|
+
children: [
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
1974
|
+
percentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1975
|
+
"circle",
|
|
1976
|
+
{
|
|
1977
|
+
className: "kjun-progress-circle-value",
|
|
1978
|
+
cx: c.centre,
|
|
1979
|
+
cy: c.centre,
|
|
1980
|
+
r: c.radius,
|
|
1981
|
+
strokeWidth: c.stroke,
|
|
1982
|
+
stroke: color,
|
|
1983
|
+
strokeLinecap: "round",
|
|
1984
|
+
strokeDasharray: c.circumference,
|
|
1985
|
+
strokeDashoffset: c.offset,
|
|
1986
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
1987
|
+
}
|
|
1988
|
+
)
|
|
1989
|
+
] }),
|
|
1990
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "kjun-progress-circle-percent", children: [
|
|
1991
|
+
percentage,
|
|
1992
|
+
"%"
|
|
1993
|
+
] })
|
|
1994
|
+
]
|
|
1995
|
+
}
|
|
1996
|
+
),
|
|
1997
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-circle-label", children: label }),
|
|
1998
|
+
subLabel && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1999
|
+
] });
|
|
2000
|
+
}
|
|
1896
2001
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", children: [
|
|
1897
2002
|
(label || showLabel) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress-label", children: [
|
|
1898
2003
|
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }),
|
|
@@ -1905,18 +2010,18 @@ function KjunProgress({
|
|
|
1905
2010
|
"div",
|
|
1906
2011
|
{
|
|
1907
2012
|
role: "progressbar",
|
|
1908
|
-
"aria-label":
|
|
2013
|
+
"aria-label": name,
|
|
1909
2014
|
"aria-valuemin": 0,
|
|
1910
2015
|
"aria-valuemax": 100,
|
|
1911
2016
|
"aria-valuenow": percentage,
|
|
1912
2017
|
className: "kjun-progress-track",
|
|
1913
|
-
style: { height:
|
|
2018
|
+
style: { height: import_tokens11.tokens.extensions.progress.heights[size] },
|
|
1914
2019
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1915
2020
|
"div",
|
|
1916
2021
|
{
|
|
1917
2022
|
style: {
|
|
1918
2023
|
width: percentage + "%",
|
|
1919
|
-
background:
|
|
2024
|
+
background: color
|
|
1920
2025
|
}
|
|
1921
2026
|
}
|
|
1922
2027
|
)
|
|
@@ -1947,9 +2052,9 @@ function KjunSkeleton({
|
|
|
1947
2052
|
{
|
|
1948
2053
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
1949
2054
|
style: sm ? void 0 : {
|
|
1950
|
-
width: width ||
|
|
1951
|
-
height: height ||
|
|
1952
|
-
borderRadius: rounded ? "50%" :
|
|
2055
|
+
width: width || import_tokens11.tokens.extensions.skeleton.avatarSize,
|
|
2056
|
+
height: height || import_tokens11.tokens.extensions.skeleton.avatarSize,
|
|
2057
|
+
borderRadius: rounded ? "50%" : import_tokens11.tokens.radius.radius8
|
|
1953
2058
|
}
|
|
1954
2059
|
}
|
|
1955
2060
|
);
|
|
@@ -1973,7 +2078,7 @@ function KjunSkeleton({
|
|
|
1973
2078
|
avatar(true),
|
|
1974
2079
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
1975
2080
|
line("60%"),
|
|
1976
|
-
line("40%", void 0,
|
|
2081
|
+
line("40%", void 0, import_tokens11.tokens.extensions.skeleton.lineHeights.sm)
|
|
1977
2082
|
] })
|
|
1978
2083
|
] }),
|
|
1979
2084
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -1996,9 +2101,9 @@ function KjunSkeleton({
|
|
|
1996
2101
|
)) }),
|
|
1997
2102
|
type === "stat" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat", children: [
|
|
1998
2103
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat-content", children: [
|
|
1999
|
-
line("40%", 0,
|
|
2000
|
-
line("60%", 1,
|
|
2001
|
-
line("30%", 2,
|
|
2104
|
+
line("40%", 0, import_tokens11.tokens.extensions.skeleton.lineHeights.sm),
|
|
2105
|
+
line("60%", 1, import_tokens11.tokens.extensions.skeleton.lineHeights.lg),
|
|
2106
|
+
line("30%", 2, import_tokens11.tokens.extensions.skeleton.lineHeights.sm)
|
|
2002
2107
|
] }),
|
|
2003
2108
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-sparkline" }) })
|
|
2004
2109
|
] }),
|
|
@@ -2006,7 +2111,7 @@ function KjunSkeleton({
|
|
|
2006
2111
|
"div",
|
|
2007
2112
|
{
|
|
2008
2113
|
className: "kjun-skeleton-block",
|
|
2009
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2114
|
+
style: { width: width || "100%", height: height != null ? height : import_tokens11.tokens.extensions.skeleton.blockHeight }
|
|
2010
2115
|
}
|
|
2011
2116
|
)
|
|
2012
2117
|
]
|
|
@@ -2015,7 +2120,7 @@ function KjunSkeleton({
|
|
|
2015
2120
|
}
|
|
2016
2121
|
|
|
2017
2122
|
// packages/react/src/layout-primitives.tsx
|
|
2018
|
-
var
|
|
2123
|
+
var import_react17 = require("react");
|
|
2019
2124
|
|
|
2020
2125
|
// shared/package-runtime/layout-primitives.ts
|
|
2021
2126
|
var numeric = /^(number|display)/;
|
|
@@ -2027,7 +2132,7 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
|
2027
2132
|
var join = (...names) => names.filter(Boolean).join(" ");
|
|
2028
2133
|
function KjunText({ variant = "body", tone = "default", as, align, maxLines, className, style, children, ...rest }) {
|
|
2029
2134
|
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
2030
|
-
return (0,
|
|
2135
|
+
return (0, import_react17.createElement)(as != null ? as : defaultTextTag(variant), {
|
|
2031
2136
|
...rest,
|
|
2032
2137
|
className: join("kjun-text", textTypeClass(variant), className),
|
|
2033
2138
|
// 안에 넣은 링크·강조 같은 앱 요소는 KJUN 리셋을 받지 않는다.
|
|
@@ -2039,7 +2144,7 @@ function KjunText({ variant = "body", tone = "default", as, align, maxLines, cla
|
|
|
2039
2144
|
}, children);
|
|
2040
2145
|
}
|
|
2041
2146
|
function KjunStack({ gap = "md", align = "stretch", as = "div", className, style, children, ...rest }) {
|
|
2042
|
-
return (0,
|
|
2147
|
+
return (0, import_react17.createElement)(as, {
|
|
2043
2148
|
...rest,
|
|
2044
2149
|
className: className || void 0,
|
|
2045
2150
|
style,
|
|
@@ -2066,13 +2171,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
2066
2171
|
}
|
|
2067
2172
|
|
|
2068
2173
|
// shared/package-runtime/feedback-dialog.ts
|
|
2069
|
-
var
|
|
2174
|
+
var import_react18 = require("react");
|
|
2070
2175
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
2071
2176
|
const options = request.options;
|
|
2072
|
-
const [value, setValue] = (0,
|
|
2073
|
-
const [error, setError] = (0,
|
|
2074
|
-
const [busy, setBusy] = (0,
|
|
2075
|
-
const working = (0,
|
|
2177
|
+
const [value, setValue] = (0, import_react18.useState)(options.initialValue || "");
|
|
2178
|
+
const [error, setError] = (0, import_react18.useState)("");
|
|
2179
|
+
const [busy, setBusy] = (0, import_react18.useState)(false);
|
|
2180
|
+
const working = (0, import_react18.useRef)(false);
|
|
2076
2181
|
const active = () => {
|
|
2077
2182
|
var _a;
|
|
2078
2183
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -2114,12 +2219,12 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2114
2219
|
}
|
|
2115
2220
|
|
|
2116
2221
|
// shared/package-runtime/feedback-motion.ts
|
|
2117
|
-
var
|
|
2118
|
-
var
|
|
2222
|
+
var import_tokens12 = require("@kjun-ui/tokens");
|
|
2223
|
+
var import_react19 = require("react");
|
|
2119
2224
|
function usePresentedToasts(toasts, reduced) {
|
|
2120
|
-
const [items, setItems] = (0,
|
|
2121
|
-
const removals = (0,
|
|
2122
|
-
(0,
|
|
2225
|
+
const [items, setItems] = (0, import_react19.useState)([]);
|
|
2226
|
+
const removals = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
|
|
2227
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
2123
2228
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
2124
2229
|
setItems((previous) => {
|
|
2125
2230
|
const old = new Map(previous.map((item) => [item.toast.id, item]));
|
|
@@ -2132,7 +2237,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2132
2237
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2133
2238
|
removals.current.delete(item.toast.id);
|
|
2134
2239
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2135
|
-
},
|
|
2240
|
+
}, import_tokens12.tokens.motion.toastExit));
|
|
2136
2241
|
}
|
|
2137
2242
|
return next;
|
|
2138
2243
|
});
|
|
@@ -2141,38 +2246,38 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2141
2246
|
removals.current.clear();
|
|
2142
2247
|
}
|
|
2143
2248
|
}, [toasts, reduced]);
|
|
2144
|
-
(0,
|
|
2249
|
+
(0, import_react19.useLayoutEffect)(() => () => {
|
|
2145
2250
|
for (const timer of removals.current.values()) clearTimeout(timer);
|
|
2146
2251
|
removals.current.clear();
|
|
2147
2252
|
}, []);
|
|
2148
2253
|
return items;
|
|
2149
2254
|
}
|
|
2150
2255
|
function usePresentedRequest(current, reduced) {
|
|
2151
|
-
const [request, setRequest] = (0,
|
|
2152
|
-
(0,
|
|
2256
|
+
const [request, setRequest] = (0, import_react19.useState)(current);
|
|
2257
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
2153
2258
|
if (!request || request.id === (current == null ? void 0 : current.id) || reduced) {
|
|
2154
2259
|
setRequest(current);
|
|
2155
2260
|
return;
|
|
2156
2261
|
}
|
|
2157
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2262
|
+
const timer = setTimeout(() => setRequest(current), import_tokens12.tokens.motion.layerExit);
|
|
2158
2263
|
return () => clearTimeout(timer);
|
|
2159
2264
|
}, [current, request, reduced]);
|
|
2160
2265
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
2161
2266
|
}
|
|
2162
2267
|
|
|
2163
2268
|
// packages/react/src/feedback-context.ts
|
|
2164
|
-
var
|
|
2165
|
-
var KjunFeedbackContext = (0,
|
|
2269
|
+
var import_react20 = require("react");
|
|
2270
|
+
var KjunFeedbackContext = (0, import_react20.createContext)(null);
|
|
2166
2271
|
function useOptionalKjunFeedback() {
|
|
2167
|
-
return (0,
|
|
2272
|
+
return (0, import_react20.useContext)(KjunFeedbackContext);
|
|
2168
2273
|
}
|
|
2169
2274
|
|
|
2170
2275
|
// packages/react/src/toast-stack.tsx
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2276
|
+
var import_tokens14 = require("@kjun-ui/tokens");
|
|
2277
|
+
var import_react22 = require("react");
|
|
2173
2278
|
|
|
2174
2279
|
// shared/package-runtime/toast-layout.ts
|
|
2175
|
-
var
|
|
2280
|
+
var import_tokens13 = require("@kjun-ui/tokens");
|
|
2176
2281
|
function createToastLayout() {
|
|
2177
2282
|
let root = null;
|
|
2178
2283
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2215,7 +2320,7 @@ function createToastLayout() {
|
|
|
2215
2320
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2216
2321
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2217
2322
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
2218
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
2323
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: import_tokens13.tokens.motion.toastMove, easing: import_tokens13.tokens.motion.easeOut });
|
|
2219
2324
|
animations.set(node, animation);
|
|
2220
2325
|
}
|
|
2221
2326
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2231,16 +2336,16 @@ function createToastLayout() {
|
|
|
2231
2336
|
}
|
|
2232
2337
|
|
|
2233
2338
|
// packages/react/src/toast.tsx
|
|
2234
|
-
var
|
|
2339
|
+
var import_react21 = require("react");
|
|
2235
2340
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2236
2341
|
function ToastView({
|
|
2237
2342
|
toast,
|
|
2238
2343
|
controller
|
|
2239
2344
|
}) {
|
|
2240
2345
|
const m = useKjunMessages();
|
|
2241
|
-
const previous = (0,
|
|
2242
|
-
const reasons = (0,
|
|
2243
|
-
(0,
|
|
2346
|
+
const previous = (0, import_react21.useRef)(null);
|
|
2347
|
+
const reasons = (0, import_react21.useRef)({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
2348
|
+
(0, import_react21.useEffect)(() => {
|
|
2244
2349
|
previous.current = document.activeElement;
|
|
2245
2350
|
return () => {
|
|
2246
2351
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -2335,10 +2440,10 @@ function ToastView({
|
|
|
2335
2440
|
// packages/react/src/toast-stack.tsx
|
|
2336
2441
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2337
2442
|
function ToastSurface({ item, controller }) {
|
|
2338
|
-
const ref = (0,
|
|
2339
|
-
const current = (0,
|
|
2340
|
-
const entryFinished = (0,
|
|
2341
|
-
(0,
|
|
2443
|
+
const ref = (0, import_react22.useRef)(null), reduced = useReducedMotion();
|
|
2444
|
+
const current = (0, import_react22.useRef)(null);
|
|
2445
|
+
const entryFinished = (0, import_react22.useRef)(false);
|
|
2446
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
2342
2447
|
var _a, _b;
|
|
2343
2448
|
const el = ref.current;
|
|
2344
2449
|
if (!el) return;
|
|
@@ -2347,15 +2452,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2347
2452
|
return;
|
|
2348
2453
|
}
|
|
2349
2454
|
const elapsed = Date.now() - item.born;
|
|
2350
|
-
if (!item.exiting && (elapsed >=
|
|
2351
|
-
const hidden = `translateY(${-
|
|
2455
|
+
if (!item.exiting && (elapsed >= import_tokens14.tokens.motion.toastEnter || entryFinished.current)) return;
|
|
2456
|
+
const hidden = `translateY(${-import_tokens14.tokens.motionDistance.toast}px)`, from = current.current;
|
|
2352
2457
|
const animations = item.exiting ? [
|
|
2353
|
-
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration:
|
|
2354
|
-
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration:
|
|
2458
|
+
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration: import_tokens14.tokens.motion.fadeExit, easing: import_tokens14.tokens.motion.easeLinear, fill: "both" }),
|
|
2459
|
+
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration: import_tokens14.tokens.motion.toastExit, easing: import_tokens14.tokens.motion.easeIn, fill: "both" })
|
|
2355
2460
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2356
|
-
duration:
|
|
2461
|
+
duration: import_tokens14.tokens.motion.toastEnter,
|
|
2357
2462
|
delay: -elapsed,
|
|
2358
|
-
easing:
|
|
2463
|
+
easing: import_tokens14.tokens.motion.easeOut,
|
|
2359
2464
|
fill: "both"
|
|
2360
2465
|
})];
|
|
2361
2466
|
animations[0].onfinish = () => {
|
|
@@ -2372,12 +2477,12 @@ function ToastSurface({ item, controller }) {
|
|
|
2372
2477
|
function ToastStack({ items, controller }) {
|
|
2373
2478
|
var _a;
|
|
2374
2479
|
const layers = useLayerState();
|
|
2375
|
-
const root = (0,
|
|
2480
|
+
const root = (0, import_react22.useRef)(null), layout = (0, import_react22.useRef)(createToastLayout());
|
|
2376
2481
|
const reduced = useReducedMotion();
|
|
2377
|
-
(0,
|
|
2482
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
2378
2483
|
if (root.current) layout.current.update(root.current, reduced);
|
|
2379
2484
|
});
|
|
2380
|
-
(0,
|
|
2485
|
+
(0, import_react22.useLayoutEffect)(() => () => layout.current.destroy(), []);
|
|
2381
2486
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: root, className: "kjun-toast-stack", style: { zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast") }, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2382
2487
|
"div",
|
|
2383
2488
|
{
|
|
@@ -2391,8 +2496,9 @@ function ToastStack({ items, controller }) {
|
|
|
2391
2496
|
}
|
|
2392
2497
|
|
|
2393
2498
|
// packages/react/src/feedback.tsx
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2499
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2500
|
+
var import_react23 = require("react");
|
|
2501
|
+
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2396
2502
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2397
2503
|
function useKjunFeedback() {
|
|
2398
2504
|
const value = useOptionalKjunFeedback();
|
|
@@ -2441,11 +2547,13 @@ function FeedbackDialog({
|
|
|
2441
2547
|
}
|
|
2442
2548
|
);
|
|
2443
2549
|
}
|
|
2444
|
-
function KjunFeedbackProvider({ children }) {
|
|
2550
|
+
function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
2445
2551
|
var _a;
|
|
2446
|
-
const [
|
|
2447
|
-
const
|
|
2448
|
-
|
|
2552
|
+
const [owned] = (0, import_react23.useState)(() => controllerProp ? void 0 : (0, import_tokens15.createFeedbackController)());
|
|
2553
|
+
const controller = controllerProp ? (0, import_tokens15.feedbackControllerOf)(controllerProp) : owned;
|
|
2554
|
+
(0, import_react23.useEffect)(() => controller.attach(), [controller]);
|
|
2555
|
+
const life = (0, import_react23.useRef)(0);
|
|
2556
|
+
const snapshot = (0, import_react23.useSyncExternalStore)(
|
|
2449
2557
|
controller.subscribe,
|
|
2450
2558
|
controller.getSnapshot,
|
|
2451
2559
|
controller.getSnapshot
|
|
@@ -2453,16 +2561,16 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2453
2561
|
const reduced = useReducedMotion();
|
|
2454
2562
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2455
2563
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2456
|
-
(0,
|
|
2564
|
+
(0, import_react23.useEffect)(() => {
|
|
2457
2565
|
const version = ++life.current;
|
|
2458
2566
|
return () => {
|
|
2459
2567
|
queueMicrotask(() => {
|
|
2460
|
-
if (life.current === version) controller.dispose();
|
|
2568
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
2461
2569
|
});
|
|
2462
2570
|
};
|
|
2463
2571
|
}, [controller]);
|
|
2464
|
-
const [layers, setLayers] = (0,
|
|
2465
|
-
const register = (0,
|
|
2572
|
+
const [layers, setLayers] = (0, import_react23.useState)([]);
|
|
2573
|
+
const register = (0, import_react23.useCallback)((id, order) => {
|
|
2466
2574
|
setLayers((current) => [...current, { id, order }]);
|
|
2467
2575
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2468
2576
|
}, []);
|
|
@@ -2490,15 +2598,15 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2490
2598
|
}
|
|
2491
2599
|
|
|
2492
2600
|
// packages/react/src/controls.tsx
|
|
2493
|
-
var
|
|
2494
|
-
var
|
|
2601
|
+
var import_tokens18 = require("@kjun-ui/tokens");
|
|
2602
|
+
var import_react25 = require("react");
|
|
2495
2603
|
var import_react_aria_components3 = require("react-aria-components");
|
|
2496
2604
|
|
|
2497
2605
|
// packages/react/src/use-selection-indicator.ts
|
|
2498
|
-
var
|
|
2606
|
+
var import_react24 = require("react");
|
|
2499
2607
|
|
|
2500
2608
|
// shared/package-runtime/selection-indicator.ts
|
|
2501
|
-
var
|
|
2609
|
+
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2502
2610
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2503
2611
|
var _a;
|
|
2504
2612
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2538,7 +2646,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2538
2646
|
const style = getComputedStyle(next);
|
|
2539
2647
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2540
2648
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2541
|
-
const height = underline ?
|
|
2649
|
+
const height = underline ? import_tokens17.tokens.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2542
2650
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2543
2651
|
if (key !== bounds) {
|
|
2544
2652
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2567,11 +2675,11 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2567
2675
|
|
|
2568
2676
|
// packages/react/src/use-selection-indicator.ts
|
|
2569
2677
|
function useSelectionIndicator(tabs = false) {
|
|
2570
|
-
const group = (0,
|
|
2571
|
-
const indicator = (0,
|
|
2572
|
-
const sync = (0,
|
|
2678
|
+
const group = (0, import_react24.useRef)(null);
|
|
2679
|
+
const indicator = (0, import_react24.useRef)(null);
|
|
2680
|
+
const sync = (0, import_react24.useRef)(() => {
|
|
2573
2681
|
});
|
|
2574
|
-
(0,
|
|
2682
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
2575
2683
|
const root = group.current, marker = indicator.current;
|
|
2576
2684
|
if (!root || !marker) return;
|
|
2577
2685
|
const handle = selectionIndicator(root, marker, tabs);
|
|
@@ -2582,7 +2690,7 @@ function useSelectionIndicator(tabs = false) {
|
|
|
2582
2690
|
};
|
|
2583
2691
|
};
|
|
2584
2692
|
}, [tabs]);
|
|
2585
|
-
(0,
|
|
2693
|
+
(0, import_react24.useLayoutEffect)(() => sync.current());
|
|
2586
2694
|
return { group, indicator };
|
|
2587
2695
|
}
|
|
2588
2696
|
|
|
@@ -2636,7 +2744,7 @@ function KjunCheckbox({
|
|
|
2636
2744
|
"span",
|
|
2637
2745
|
{
|
|
2638
2746
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2639
|
-
children: checked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: "check", size:
|
|
2747
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: "check", size: import_tokens18.tokens.extensions.checkbox.iconSizes[size] })
|
|
2640
2748
|
}
|
|
2641
2749
|
),
|
|
2642
2750
|
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2656,9 +2764,9 @@ function KjunSwitch({
|
|
|
2656
2764
|
onChange
|
|
2657
2765
|
}) {
|
|
2658
2766
|
const field = useKjunField();
|
|
2659
|
-
const descriptionId = "kjun-" + (0,
|
|
2767
|
+
const descriptionId = "kjun-" + (0, import_react25.useId)().replace(/:/g, "") + "-description";
|
|
2660
2768
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2661
|
-
const markInput = (0,
|
|
2769
|
+
const markInput = (0, import_react25.useCallback)((input) => {
|
|
2662
2770
|
if (!input) return;
|
|
2663
2771
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2664
2772
|
else input.removeAttribute("aria-invalid");
|
|
@@ -2694,7 +2802,7 @@ function KjunSwitch({
|
|
|
2694
2802
|
}
|
|
2695
2803
|
);
|
|
2696
2804
|
}
|
|
2697
|
-
var RadioContext = (0,
|
|
2805
|
+
var RadioContext = (0, import_react25.createContext)(null);
|
|
2698
2806
|
function KjunRadio({
|
|
2699
2807
|
value,
|
|
2700
2808
|
val,
|
|
@@ -2706,7 +2814,7 @@ function KjunRadio({
|
|
|
2706
2814
|
onValueChange,
|
|
2707
2815
|
onChange
|
|
2708
2816
|
}) {
|
|
2709
|
-
const group = (0,
|
|
2817
|
+
const group = (0, import_react25.useContext)(RadioContext), selected = (group ? group.value : value) === val;
|
|
2710
2818
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""), children: [
|
|
2711
2819
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2712
2820
|
"input",
|
|
@@ -2745,7 +2853,7 @@ function KjunRadioGroup({
|
|
|
2745
2853
|
onValueChange,
|
|
2746
2854
|
onChange
|
|
2747
2855
|
}) {
|
|
2748
|
-
const name = "kjun-" + (0,
|
|
2856
|
+
const name = "kjun-" + (0, import_react25.useId)();
|
|
2749
2857
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2750
2858
|
RadioContext.Provider,
|
|
2751
2859
|
{
|
|
@@ -2767,7 +2875,7 @@ function KjunRadioGroup({
|
|
|
2767
2875
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2768
2876
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2769
2877
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2770
|
-
gap: direction === "vertical" ?
|
|
2878
|
+
gap: direction === "vertical" ? import_tokens18.tokens.dimension.value8 : import_tokens18.tokens.dimension.value16
|
|
2771
2879
|
},
|
|
2772
2880
|
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2773
2881
|
KjunRadio,
|
|
@@ -2783,7 +2891,7 @@ function KjunRadioGroup({
|
|
|
2783
2891
|
}
|
|
2784
2892
|
);
|
|
2785
2893
|
}
|
|
2786
|
-
var KjunTextarea = (0,
|
|
2894
|
+
var KjunTextarea = (0, import_react25.forwardRef)(
|
|
2787
2895
|
function KjunTextarea2({
|
|
2788
2896
|
value,
|
|
2789
2897
|
size = "md",
|
|
@@ -2799,7 +2907,7 @@ var KjunTextarea = (0, import_react24.forwardRef)(
|
|
|
2799
2907
|
}, ref) {
|
|
2800
2908
|
var _a;
|
|
2801
2909
|
const field = useKjunField();
|
|
2802
|
-
const spec =
|
|
2910
|
+
const spec = import_tokens18.tokens.input[size];
|
|
2803
2911
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2804
2912
|
"textarea",
|
|
2805
2913
|
{
|
|
@@ -2817,8 +2925,8 @@ var KjunTextarea = (0, import_react24.forwardRef)(
|
|
|
2817
2925
|
style: {
|
|
2818
2926
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2819
2927
|
lineHeight: spec.lineHeight / 16 + "rem",
|
|
2820
|
-
padding: `${spec.textareaPaddingY}px ${spec.padding -
|
|
2821
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
2928
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - import_tokens18.tokens.border.controlWidth}px`,
|
|
2929
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * import_tokens18.tokens.border.controlWidth),
|
|
2822
2930
|
borderRadius: spec.radius,
|
|
2823
2931
|
resize,
|
|
2824
2932
|
...style
|
|
@@ -2851,9 +2959,9 @@ function KjunButtonGroup({
|
|
|
2851
2959
|
className: "kjun-button-group",
|
|
2852
2960
|
onKeyDown: groupKeydown,
|
|
2853
2961
|
style: {
|
|
2854
|
-
height:
|
|
2855
|
-
padding:
|
|
2856
|
-
borderRadius:
|
|
2962
|
+
height: import_tokens18.tokens.buttonGroup.heights[size],
|
|
2963
|
+
padding: import_tokens18.tokens.buttonGroup.padding[size],
|
|
2964
|
+
borderRadius: import_tokens18.tokens.buttonGroup.radii[size],
|
|
2857
2965
|
width: fullWidth ? "100%" : "fit-content"
|
|
2858
2966
|
},
|
|
2859
2967
|
children: [
|
|
@@ -2864,7 +2972,7 @@ function KjunButtonGroup({
|
|
|
2864
2972
|
className: "kjun-button-group-indicator",
|
|
2865
2973
|
"aria-hidden": "true",
|
|
2866
2974
|
hidden: true,
|
|
2867
|
-
style: { borderRadius:
|
|
2975
|
+
style: { borderRadius: import_tokens18.tokens.buttonGroup.itemRadii[size] }
|
|
2868
2976
|
}
|
|
2869
2977
|
),
|
|
2870
2978
|
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -2875,8 +2983,8 @@ function KjunButtonGroup({
|
|
|
2875
2983
|
disabled: disabled || option.disabled,
|
|
2876
2984
|
style: {
|
|
2877
2985
|
flex: fullWidth ? 1 : void 0,
|
|
2878
|
-
paddingInline:
|
|
2879
|
-
borderRadius:
|
|
2986
|
+
paddingInline: import_tokens18.tokens.buttonGroup.itemPaddingX[size],
|
|
2987
|
+
borderRadius: import_tokens18.tokens.buttonGroup.itemRadii[size],
|
|
2880
2988
|
...selectionTypeStyle(size, value === option.value)
|
|
2881
2989
|
},
|
|
2882
2990
|
onClick: () => {
|
|
@@ -2884,9 +2992,9 @@ function KjunButtonGroup({
|
|
|
2884
2992
|
onChange == null ? void 0 : onChange(option.value);
|
|
2885
2993
|
},
|
|
2886
2994
|
children: [
|
|
2887
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
2995
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens18.tokens.extensions.selection.iconSize }),
|
|
2888
2996
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-button-group-label", children: [
|
|
2889
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
2997
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens18.tokens.button.typography[size]), children: option.label }),
|
|
2890
2998
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
2891
2999
|
] })
|
|
2892
3000
|
]
|
|
@@ -2922,7 +3030,7 @@ function KjunFilterGroup({
|
|
|
2922
3030
|
{
|
|
2923
3031
|
type: "button",
|
|
2924
3032
|
className: "kjun-filter-chip",
|
|
2925
|
-
style: { borderRadius:
|
|
3033
|
+
style: { borderRadius: import_tokens18.tokens.button.radii[size] },
|
|
2926
3034
|
"aria-pressed": selected(option.value),
|
|
2927
3035
|
disabled: disabled || option.disabled,
|
|
2928
3036
|
onClick: () => {
|
|
@@ -2934,15 +3042,15 @@ function KjunFilterGroup({
|
|
|
2934
3042
|
"span",
|
|
2935
3043
|
{
|
|
2936
3044
|
style: {
|
|
2937
|
-
height:
|
|
2938
|
-
paddingInline: { xs:
|
|
3045
|
+
height: import_tokens18.tokens.button.heights[size],
|
|
3046
|
+
paddingInline: { xs: import_tokens18.tokens.dimension.value8, sm: import_tokens18.tokens.dimension.value12, md: import_tokens18.tokens.dimension.value12, lg: import_tokens18.tokens.dimension.value14, xl: import_tokens18.tokens.dimension.value16 }[size],
|
|
2939
3047
|
...selectionTypeStyle(size, selected(option.value))
|
|
2940
3048
|
},
|
|
2941
3049
|
children: [
|
|
2942
3050
|
option.dot && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { style: { background: option.dot } }),
|
|
2943
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
3051
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens18.tokens.extensions.selection.iconSize }),
|
|
2944
3052
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-filter-label", children: [
|
|
2945
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens18.tokens.button.typography[size]), children: option.label }),
|
|
2946
3054
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
2947
3055
|
] })
|
|
2948
3056
|
]
|
|
@@ -2956,8 +3064,8 @@ function KjunFilterGroup({
|
|
|
2956
3064
|
}
|
|
2957
3065
|
|
|
2958
3066
|
// packages/react/src/floating-panel.tsx
|
|
2959
|
-
var
|
|
2960
|
-
var
|
|
3067
|
+
var import_tokens19 = require("@kjun-ui/tokens");
|
|
3068
|
+
var import_react26 = require("react");
|
|
2961
3069
|
var import_react_aria_components4 = require("react-aria-components");
|
|
2962
3070
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2963
3071
|
function FloatingPanel({
|
|
@@ -2975,18 +3083,18 @@ function FloatingPanel({
|
|
|
2975
3083
|
ownsDismiss = false,
|
|
2976
3084
|
returnFocus
|
|
2977
3085
|
}) {
|
|
2978
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3086
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens19.tokens.motion.popupExit);
|
|
2979
3087
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2980
3088
|
const container = useKjunPortalContainer();
|
|
2981
|
-
const panel = (0,
|
|
2982
|
-
(0,
|
|
3089
|
+
const panel = (0, import_react26.useRef)(null);
|
|
3090
|
+
(0, import_react26.useEffect)(() => {
|
|
2983
3091
|
var _a;
|
|
2984
3092
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2985
3093
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
2986
3094
|
const dismissBeforeFocus = (event) => {
|
|
2987
3095
|
var _a2, _b;
|
|
2988
3096
|
const popup = panel.current, focused = document2.activeElement;
|
|
2989
|
-
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0,
|
|
3097
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0, import_tokens19.isComposingKey)(event) || !popup || popup.closest('[inert], [aria-hidden="true"]')) return;
|
|
2990
3098
|
if (focused !== document2.body && focused !== document2.documentElement && !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(focused))) return;
|
|
2991
3099
|
event.preventDefault();
|
|
2992
3100
|
event.stopPropagation();
|
|
@@ -3011,9 +3119,9 @@ function FloatingPanel({
|
|
|
3011
3119
|
UNSTABLE_portalContainer: container,
|
|
3012
3120
|
placement: placement.replace("-", " "),
|
|
3013
3121
|
shouldFlip: flip,
|
|
3014
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3015
|
-
offset: field ?
|
|
3016
|
-
containerPadding:
|
|
3122
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? import_tokens19.tokens.extensions.menu.listMaxHeight : import_tokens19.tokens.extensions.floating.maxHeight : void 0,
|
|
3123
|
+
offset: field ? import_tokens19.tokens.extensions.floating.fieldGap : import_tokens19.tokens.extensions.floating.anchorGap,
|
|
3124
|
+
containerPadding: import_tokens19.tokens.extensions.floating.viewportInset,
|
|
3017
3125
|
className: "kjun-scope kjun-floating " + className,
|
|
3018
3126
|
"data-motion": "popup",
|
|
3019
3127
|
"data-motion-open": String(motion.active),
|
|
@@ -3028,8 +3136,8 @@ function FloatingPanel({
|
|
|
3028
3136
|
}
|
|
3029
3137
|
|
|
3030
3138
|
// packages/react/src/popover.tsx
|
|
3031
|
-
var
|
|
3032
|
-
var
|
|
3139
|
+
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3140
|
+
var import_react27 = require("react");
|
|
3033
3141
|
var import_react_aria_components5 = require("react-aria-components");
|
|
3034
3142
|
|
|
3035
3143
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -3111,11 +3219,11 @@ function KjunPopover({
|
|
|
3111
3219
|
children
|
|
3112
3220
|
}) {
|
|
3113
3221
|
const m = useKjunMessages();
|
|
3114
|
-
const [internal, setInternal] = (0,
|
|
3222
|
+
const [internal, setInternal] = (0, import_react27.useState)(false), open = controlled != null ? controlled : internal, ref = (0, import_react27.useRef)(null), id = "kjun-" + (0, import_react27.useId)();
|
|
3115
3223
|
const expanded = usePopupExpanded(open, ref);
|
|
3116
|
-
const focusOnMount = (0,
|
|
3224
|
+
const focusOnMount = (0, import_react27.useRef)(focusOnOpen);
|
|
3117
3225
|
focusOnMount.current = focusOnOpen;
|
|
3118
|
-
const focusContent = (0,
|
|
3226
|
+
const focusContent = (0, import_react27.useCallback)((node) => {
|
|
3119
3227
|
if (node && focusOnMount.current) node.focus();
|
|
3120
3228
|
}, []);
|
|
3121
3229
|
const resolveReturn = returnFocus === void 0 ? void 0 : () => typeof returnFocus === "function" ? returnFocus() : returnFocus instanceof HTMLElement ? returnFocus : returnFocus.current;
|
|
@@ -3123,8 +3231,8 @@ function KjunPopover({
|
|
|
3123
3231
|
setInternal(v);
|
|
3124
3232
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3125
3233
|
};
|
|
3126
|
-
const skipReturn = (0,
|
|
3127
|
-
(0,
|
|
3234
|
+
const skipReturn = (0, import_react27.useRef)(false);
|
|
3235
|
+
(0, import_react27.useEffect)(() => {
|
|
3128
3236
|
if (!open || modal) return;
|
|
3129
3237
|
skipReturn.current = false;
|
|
3130
3238
|
return installNonModalPopover({
|
|
@@ -3181,7 +3289,7 @@ function KjunPopover({
|
|
|
3181
3289
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3182
3290
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3183
3291
|
className: "kjun-popover-dialog",
|
|
3184
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3292
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens20.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3185
3293
|
};
|
|
3186
3294
|
const body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3187
3295
|
header != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3203,7 +3311,7 @@ function KjunTooltip({
|
|
|
3203
3311
|
children
|
|
3204
3312
|
}) {
|
|
3205
3313
|
const container = useKjunPortalContainer();
|
|
3206
|
-
const [internal, setInternal] = (0,
|
|
3314
|
+
const [internal, setInternal] = (0, import_react27.useState)(false), open = controlled != null ? controlled : internal;
|
|
3207
3315
|
const setOpen = (value) => {
|
|
3208
3316
|
setInternal(value);
|
|
3209
3317
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
@@ -3217,10 +3325,10 @@ function KjunTooltip({
|
|
|
3217
3325
|
style: { zIndex: layer.zIndex },
|
|
3218
3326
|
UNSTABLE_portalContainer: container,
|
|
3219
3327
|
placement,
|
|
3220
|
-
offset:
|
|
3328
|
+
offset: import_tokens20.tokens.extensions.floating.anchorGap,
|
|
3221
3329
|
className: "kjun-scope kjun-tooltip",
|
|
3222
3330
|
children: [
|
|
3223
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width:
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: import_tokens20.tokens.extensions.tooltip.arrowSize, height: import_tokens20.tokens.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
3224
3332
|
content
|
|
3225
3333
|
]
|
|
3226
3334
|
}
|
|
@@ -3229,11 +3337,11 @@ function KjunTooltip({
|
|
|
3229
3337
|
}
|
|
3230
3338
|
|
|
3231
3339
|
// packages/react/src/dropdown.tsx
|
|
3232
|
-
var
|
|
3233
|
-
var
|
|
3340
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3341
|
+
var import_react28 = require("react");
|
|
3234
3342
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3235
3343
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3236
|
-
var DropdownContext = (0,
|
|
3344
|
+
var DropdownContext = (0, import_react28.createContext)(null);
|
|
3237
3345
|
function KjunDropdown({
|
|
3238
3346
|
disabled = false,
|
|
3239
3347
|
placement = "bottom-start",
|
|
@@ -3245,10 +3353,10 @@ function KjunDropdown({
|
|
|
3245
3353
|
onOpen,
|
|
3246
3354
|
onClose
|
|
3247
3355
|
}) {
|
|
3248
|
-
const [open, setOpen] = (0,
|
|
3249
|
-
const menuFocusCleanup = (0,
|
|
3356
|
+
const [open, setOpen] = (0, import_react28.useState)(false), currentOpen = (0, import_react28.useRef)(false), ref = (0, import_react28.useRef)(null), id = "kjun-" + (0, import_react28.useId)();
|
|
3357
|
+
const menuFocusCleanup = (0, import_react28.useRef)(() => {
|
|
3250
3358
|
});
|
|
3251
|
-
const bindMenu = (0,
|
|
3359
|
+
const bindMenu = (0, import_react28.useCallback)((menu) => {
|
|
3252
3360
|
menuFocusCleanup.current();
|
|
3253
3361
|
menuFocusCleanup.current = () => {
|
|
3254
3362
|
};
|
|
@@ -3270,19 +3378,19 @@ function KjunDropdown({
|
|
|
3270
3378
|
};
|
|
3271
3379
|
}, []);
|
|
3272
3380
|
let control = trigger;
|
|
3273
|
-
while ((0,
|
|
3381
|
+
while ((0, import_react28.isValidElement)(control) && control.type === KjunTooltip)
|
|
3274
3382
|
control = control.props.children;
|
|
3275
|
-
const unavailable = disabled || (0,
|
|
3276
|
-
const controlId = triggerId || (0,
|
|
3383
|
+
const unavailable = disabled || (0, import_react28.isValidElement)(control) && !!(control.props.disabled || control.props.loading);
|
|
3384
|
+
const controlId = triggerId || (0, import_react28.isValidElement)(control) && control.props.id || id;
|
|
3277
3385
|
const popupId = menuId || id + "-menu";
|
|
3278
3386
|
const bindTrigger = (node) => {
|
|
3279
|
-
if (!(0,
|
|
3387
|
+
if (!(0, import_react28.isValidElement)(node)) return node;
|
|
3280
3388
|
if (node.type === KjunTooltip) {
|
|
3281
3389
|
const tooltip = node;
|
|
3282
|
-
return (0,
|
|
3390
|
+
return (0, import_react28.cloneElement)(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
3283
3391
|
}
|
|
3284
3392
|
const button = node;
|
|
3285
|
-
return (0,
|
|
3393
|
+
return (0, import_react28.cloneElement)(button, {
|
|
3286
3394
|
id: controlId,
|
|
3287
3395
|
"aria-haspopup": "menu",
|
|
3288
3396
|
"aria-expanded": open,
|
|
@@ -3299,7 +3407,7 @@ function KjunDropdown({
|
|
|
3299
3407
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
3300
3408
|
else onClose == null ? void 0 : onClose();
|
|
3301
3409
|
};
|
|
3302
|
-
(0,
|
|
3410
|
+
(0, import_react28.useEffect)(() => {
|
|
3303
3411
|
if (unavailable) change(false);
|
|
3304
3412
|
}, [unavailable]);
|
|
3305
3413
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -3352,8 +3460,8 @@ function KjunDropdownItem({
|
|
|
3352
3460
|
children,
|
|
3353
3461
|
onClick
|
|
3354
3462
|
}) {
|
|
3355
|
-
const close = (0,
|
|
3356
|
-
const node = (0,
|
|
3463
|
+
const close = (0, import_react28.useContext)(DropdownContext);
|
|
3464
|
+
const node = (0, import_react28.useCallback)((element) => {
|
|
3357
3465
|
if (!element) return;
|
|
3358
3466
|
if (selected === null) {
|
|
3359
3467
|
element.setAttribute("role", "menuitem");
|
|
@@ -3378,14 +3486,14 @@ function KjunDropdownItem({
|
|
|
3378
3486
|
close == null ? void 0 : close();
|
|
3379
3487
|
},
|
|
3380
3488
|
children: [
|
|
3381
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3489
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size: import_tokens21.tokens.extensions.menu.iconSize }),
|
|
3382
3490
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children }),
|
|
3383
3491
|
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3384
3492
|
KjunIcon,
|
|
3385
3493
|
{
|
|
3386
3494
|
name: "check",
|
|
3387
3495
|
className: "kjun-menu-check",
|
|
3388
|
-
size:
|
|
3496
|
+
size: import_tokens21.tokens.extensions.menu.iconSize,
|
|
3389
3497
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3390
3498
|
}
|
|
3391
3499
|
)
|
|
@@ -3411,7 +3519,7 @@ function KjunMenuButton({
|
|
|
3411
3519
|
...props
|
|
3412
3520
|
}) {
|
|
3413
3521
|
const m = useKjunMessages();
|
|
3414
|
-
const [open, setOpen] = (0,
|
|
3522
|
+
const [open, setOpen] = (0, import_react28.useState)(false);
|
|
3415
3523
|
const button = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3416
3524
|
KjunButton,
|
|
3417
3525
|
{
|
|
@@ -3452,7 +3560,7 @@ function KjunMenuButton({
|
|
|
3452
3560
|
}
|
|
3453
3561
|
|
|
3454
3562
|
// packages/react/src/drawer.tsx
|
|
3455
|
-
var
|
|
3563
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3456
3564
|
|
|
3457
3565
|
// shared/package-runtime/drawer-geometry.ts
|
|
3458
3566
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3471,7 +3579,7 @@ function KjunDrawer({
|
|
|
3471
3579
|
onOpenChange,
|
|
3472
3580
|
title,
|
|
3473
3581
|
position = "right",
|
|
3474
|
-
width =
|
|
3582
|
+
width = import_tokens22.tokens.extensions.drawer.width,
|
|
3475
3583
|
closable = true,
|
|
3476
3584
|
closeOnOverlay = true,
|
|
3477
3585
|
closeOnEsc = true,
|
|
@@ -3486,7 +3594,7 @@ function KjunDrawer({
|
|
|
3486
3594
|
maxHeight
|
|
3487
3595
|
}) {
|
|
3488
3596
|
const m = useKjunMessages();
|
|
3489
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3597
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens22.tokens.motion.layerExit);
|
|
3490
3598
|
const container = useKjunPortalContainer();
|
|
3491
3599
|
const close = () => {
|
|
3492
3600
|
if (!open) return;
|
|
@@ -3541,8 +3649,8 @@ function KjunDrawer({
|
|
|
3541
3649
|
variant: "ghost",
|
|
3542
3650
|
ariaLabel: m.close,
|
|
3543
3651
|
onClick: close,
|
|
3544
|
-
style: { borderRadius:
|
|
3545
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size:
|
|
3652
|
+
style: { borderRadius: import_tokens22.tokens.extensions.drawer.closeRadius, width: import_tokens22.tokens.extensions.drawer.closeSize, height: import_tokens22.tokens.extensions.drawer.closeSize, padding: 0 },
|
|
3653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size: import_tokens22.tokens.extensions.drawer.closeIconSize })
|
|
3546
3654
|
}
|
|
3547
3655
|
)
|
|
3548
3656
|
] }),
|
|
@@ -3550,7 +3658,7 @@ function KjunDrawer({
|
|
|
3550
3658
|
"div",
|
|
3551
3659
|
{
|
|
3552
3660
|
className: "kjun-drawer-body",
|
|
3553
|
-
style: { padding: noPadding ? 0 :
|
|
3661
|
+
style: { padding: noPadding ? 0 : import_tokens22.tokens.extensions.drawer.bodyPadding },
|
|
3554
3662
|
children
|
|
3555
3663
|
}
|
|
3556
3664
|
),
|
|
@@ -3566,7 +3674,7 @@ function KjunDrawer({
|
|
|
3566
3674
|
}
|
|
3567
3675
|
|
|
3568
3676
|
// shared/package-runtime/combobox.ts
|
|
3569
|
-
var
|
|
3677
|
+
var import_react29 = require("react");
|
|
3570
3678
|
|
|
3571
3679
|
// shared/package-runtime/options.ts
|
|
3572
3680
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3644,10 +3752,10 @@ function useComboboxModel({
|
|
|
3644
3752
|
}) {
|
|
3645
3753
|
const selected = options.find((option) => optionValue(option, valueKey) === value);
|
|
3646
3754
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3647
|
-
const [query2, setQuery] = (0,
|
|
3648
|
-
const [open, setOpen] = (0,
|
|
3649
|
-
(0,
|
|
3650
|
-
(0,
|
|
3755
|
+
const [query2, setQuery] = (0, import_react29.useState)(selectedLabel);
|
|
3756
|
+
const [open, setOpen] = (0, import_react29.useState)(false);
|
|
3757
|
+
(0, import_react29.useEffect)(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3758
|
+
(0, import_react29.useEffect)(() => {
|
|
3651
3759
|
if (disabled) setOpen(false);
|
|
3652
3760
|
}, [disabled]);
|
|
3653
3761
|
const change = (next) => {
|
|
@@ -3680,7 +3788,7 @@ function useComboboxModel({
|
|
|
3680
3788
|
}
|
|
3681
3789
|
|
|
3682
3790
|
// packages/react/src/combobox.tsx
|
|
3683
|
-
var
|
|
3791
|
+
var import_react30 = require("react");
|
|
3684
3792
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3685
3793
|
function KjunCombobox({
|
|
3686
3794
|
value,
|
|
@@ -3764,12 +3872,12 @@ function SearchField({
|
|
|
3764
3872
|
}) {
|
|
3765
3873
|
const m = useKjunMessages();
|
|
3766
3874
|
const composition = useCompositionGuard();
|
|
3767
|
-
const clearing = (0,
|
|
3768
|
-
const ref = (0,
|
|
3875
|
+
const clearing = (0, import_react30.useRef)(false);
|
|
3876
|
+
const ref = (0, import_react30.useRef)(null), [highlighted, setActive] = (0, import_react30.useState)(-1), id = "kjun-" + (0, import_react30.useId)();
|
|
3769
3877
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3770
3878
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3771
|
-
(0,
|
|
3772
|
-
(0,
|
|
3879
|
+
(0, import_react30.useEffect)(() => setActive(-1), [value, options.length]);
|
|
3880
|
+
(0, import_react30.useEffect)(() => {
|
|
3773
3881
|
if (!open) return;
|
|
3774
3882
|
const leaveField = (event) => {
|
|
3775
3883
|
var _a, _b, _c;
|
|
@@ -3779,7 +3887,7 @@ function SearchField({
|
|
|
3779
3887
|
document.addEventListener("focusin", leaveField);
|
|
3780
3888
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3781
3889
|
}, [open, onOpenChange, id]);
|
|
3782
|
-
(0,
|
|
3890
|
+
(0, import_react30.useEffect)(() => {
|
|
3783
3891
|
if (highlighted !== active) setActive(-1);
|
|
3784
3892
|
}, [highlighted, active]);
|
|
3785
3893
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3911,8 +4019,8 @@ function SearchField({
|
|
|
3911
4019
|
}
|
|
3912
4020
|
|
|
3913
4021
|
// packages/react/src/date-picker.tsx
|
|
3914
|
-
var
|
|
3915
|
-
var
|
|
4022
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
4023
|
+
var import_react31 = require("react");
|
|
3916
4024
|
var import_jsx_runtime20 = (
|
|
3917
4025
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3918
4026
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
@@ -3932,12 +4040,12 @@ function KjunDatePicker({
|
|
|
3932
4040
|
}) {
|
|
3933
4041
|
const scope = useKjunMessageScope();
|
|
3934
4042
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
3935
|
-
const [focus, setFocus] = (0,
|
|
4043
|
+
const [focus, setFocus] = (0, import_react31.useState)(false);
|
|
3936
4044
|
const clear = clearable && !!value && !props.disabled && !props.readOnly;
|
|
3937
4045
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
3938
4046
|
position: "relative",
|
|
3939
|
-
["--_kjun-date-icon-inset"]:
|
|
3940
|
-
["--_kjun-date-icon-size"]:
|
|
4047
|
+
["--_kjun-date-icon-inset"]: import_tokens23.tokens.input[size].padding + "px",
|
|
4048
|
+
["--_kjun-date-icon-size"]: import_tokens23.tokens.input[size].iconSize + "px"
|
|
3941
4049
|
}, children: [
|
|
3942
4050
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3943
4051
|
KjunInput,
|
|
@@ -3967,8 +4075,8 @@ function KjunDatePicker({
|
|
|
3967
4075
|
"aria-hidden": "true",
|
|
3968
4076
|
className: "kjun-date-overlay",
|
|
3969
4077
|
style: {
|
|
3970
|
-
left:
|
|
3971
|
-
right:
|
|
4078
|
+
left: import_tokens23.tokens.input[size].padding,
|
|
4079
|
+
right: import_tokens23.tokens.input[size].padding + import_tokens23.tokens.input[size].iconSize + import_tokens23.tokens.input[size].affixGap + (clear ? import_tokens23.tokens.input[size].clearSize + import_tokens23.tokens.input[size].affixGap : 0),
|
|
3972
4080
|
...inputTypeStyle(size),
|
|
3973
4081
|
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)"
|
|
3974
4082
|
},
|
|
@@ -3984,24 +4092,24 @@ function KjunDatePicker({
|
|
|
3984
4092
|
className: "kjun-select-clear",
|
|
3985
4093
|
style: {
|
|
3986
4094
|
padding: 0,
|
|
3987
|
-
right:
|
|
3988
|
-
width:
|
|
3989
|
-
height:
|
|
3990
|
-
minHeight:
|
|
4095
|
+
right: import_tokens23.tokens.input[size].padding + import_tokens23.tokens.input[size].iconSize + import_tokens23.tokens.input[size].affixGap,
|
|
4096
|
+
width: import_tokens23.tokens.input[size].clearSize,
|
|
4097
|
+
height: import_tokens23.tokens.input[size].clearSize,
|
|
4098
|
+
minHeight: import_tokens23.tokens.input[size].clearSize,
|
|
3991
4099
|
borderRadius: "50%"
|
|
3992
4100
|
},
|
|
3993
4101
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
3994
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size:
|
|
4102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size: import_tokens23.tokens.input[size].iconSize })
|
|
3995
4103
|
}
|
|
3996
4104
|
)
|
|
3997
4105
|
] });
|
|
3998
4106
|
}
|
|
3999
4107
|
|
|
4000
4108
|
// packages/react/src/search-input.tsx
|
|
4001
|
-
var
|
|
4109
|
+
var import_react33 = require("react");
|
|
4002
4110
|
|
|
4003
4111
|
// shared/package-runtime/search-input.ts
|
|
4004
|
-
var
|
|
4112
|
+
var import_react32 = require("react");
|
|
4005
4113
|
function useSearchInputModel({
|
|
4006
4114
|
value,
|
|
4007
4115
|
disabled = false,
|
|
@@ -4011,20 +4119,20 @@ function useSearchInputModel({
|
|
|
4011
4119
|
onValueChange,
|
|
4012
4120
|
onSearchError
|
|
4013
4121
|
}, open) {
|
|
4014
|
-
const [query2, setQuery] = (0,
|
|
4122
|
+
const [query2, setQuery] = (0, import_react32.useState)(value), [options, setOptions] = (0, import_react32.useState)([]), [loading, setLoading] = (0, import_react32.useState)(false), [failed, setFailed] = (0, import_react32.useState)(false), version = (0, import_react32.useRef)(0), notify = (0, import_react32.useRef)(onSearchError);
|
|
4015
4123
|
notify.current = onSearchError;
|
|
4016
|
-
const timer = (0,
|
|
4017
|
-
const notifyValue = (0,
|
|
4124
|
+
const timer = (0, import_react32.useRef)(void 0);
|
|
4125
|
+
const notifyValue = (0, import_react32.useRef)(onValueChange);
|
|
4018
4126
|
notifyValue.current = onValueChange;
|
|
4019
|
-
(0,
|
|
4127
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
4020
4128
|
clearTimeout(timer.current);
|
|
4021
4129
|
setQuery(value);
|
|
4022
4130
|
}, [value]);
|
|
4023
|
-
(0,
|
|
4131
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
4024
4132
|
clearTimeout(timer.current);
|
|
4025
4133
|
return () => clearTimeout(timer.current);
|
|
4026
4134
|
}, [disabled, debounce, !!loadOptions]);
|
|
4027
|
-
(0,
|
|
4135
|
+
(0, import_react32.useEffect)(() => {
|
|
4028
4136
|
const current = ++version.current, abort = new AbortController();
|
|
4029
4137
|
setFailed(false);
|
|
4030
4138
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -4115,7 +4223,7 @@ function KjunSearchInput({
|
|
|
4115
4223
|
placeholder != null ? placeholder : placeholder = m.search;
|
|
4116
4224
|
emptyText != null ? emptyText : emptyText = m.noResults;
|
|
4117
4225
|
errorText != null ? errorText : errorText = m.searchFailed;
|
|
4118
|
-
const [open, setOpen] = (0,
|
|
4226
|
+
const [open, setOpen] = (0, import_react33.useState)(false);
|
|
4119
4227
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
4120
4228
|
const { query: query2, options, loading, failed } = model;
|
|
4121
4229
|
const update = (value2) => {
|
|
@@ -4177,21 +4285,21 @@ function KjunSearchInput({
|
|
|
4177
4285
|
}
|
|
4178
4286
|
|
|
4179
4287
|
// packages/react/src/select-control.tsx
|
|
4180
|
-
var
|
|
4181
|
-
var
|
|
4288
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
4289
|
+
var import_react36 = require("react");
|
|
4182
4290
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4183
4291
|
|
|
4184
4292
|
// shared/package-runtime/select.ts
|
|
4185
|
-
var
|
|
4293
|
+
var import_react34 = require("react");
|
|
4186
4294
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4187
|
-
const [internal, setInternal] = (0,
|
|
4188
|
-
const [query2, setQuery] = (0,
|
|
4189
|
-
const [limit, setLimit] = (0,
|
|
4190
|
-
const [session, setSession] = (0,
|
|
4295
|
+
const [internal, setInternal] = (0, import_react34.useState)(false);
|
|
4296
|
+
const [query2, setQuery] = (0, import_react34.useState)("");
|
|
4297
|
+
const [limit, setLimit] = (0, import_react34.useState)(pageSize);
|
|
4298
|
+
const [session, setSession] = (0, import_react34.useState)(0);
|
|
4191
4299
|
const isControlled = typeof controlled === "boolean";
|
|
4192
4300
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4193
|
-
const previousOpen = (0,
|
|
4194
|
-
(0,
|
|
4301
|
+
const previousOpen = (0, import_react34.useRef)(open);
|
|
4302
|
+
(0, import_react34.useEffect)(() => {
|
|
4195
4303
|
if (disabled && !isControlled) setInternal(false);
|
|
4196
4304
|
if (previousOpen.current && !open) {
|
|
4197
4305
|
setQuery("");
|
|
@@ -4200,7 +4308,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4200
4308
|
}
|
|
4201
4309
|
previousOpen.current = open;
|
|
4202
4310
|
}, [open, disabled, isControlled, pageSize]);
|
|
4203
|
-
(0,
|
|
4311
|
+
(0, import_react34.useEffect)(() => {
|
|
4204
4312
|
setLimit(pageSize);
|
|
4205
4313
|
}, [pageSize]);
|
|
4206
4314
|
const changeOpen = (next) => {
|
|
@@ -4216,8 +4324,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4216
4324
|
}
|
|
4217
4325
|
|
|
4218
4326
|
// packages/react/src/compound-control.ts
|
|
4219
|
-
var
|
|
4220
|
-
var CompoundControlContext = (0,
|
|
4327
|
+
var import_react35 = require("react");
|
|
4328
|
+
var CompoundControlContext = (0, import_react35.createContext)(null);
|
|
4221
4329
|
|
|
4222
4330
|
// packages/react/src/select-control.tsx
|
|
4223
4331
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -4256,17 +4364,17 @@ function KjunSelect({
|
|
|
4256
4364
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4257
4365
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4258
4366
|
const composition = useCompositionGuard();
|
|
4259
|
-
const ref = (0,
|
|
4260
|
-
const segment = (0,
|
|
4261
|
-
const spec =
|
|
4367
|
+
const ref = (0, import_react36.useRef)(null), menu = (0, import_react36.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react36.useId)();
|
|
4368
|
+
const segment = (0, import_react36.useContext)(CompoundControlContext) !== null;
|
|
4369
|
+
const spec = import_tokens24.tokens.input[size];
|
|
4262
4370
|
const expanded = usePopupExpanded(open, ref);
|
|
4263
4371
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4264
|
-
(0,
|
|
4372
|
+
(0, import_react36.useEffect)(() => {
|
|
4265
4373
|
if (!registerControl || !triggerId) return;
|
|
4266
4374
|
registerControl(triggerId);
|
|
4267
4375
|
return () => registerControl(void 0);
|
|
4268
4376
|
}, [registerControl, triggerId]);
|
|
4269
|
-
(0,
|
|
4377
|
+
(0, import_react36.useEffect)(() => {
|
|
4270
4378
|
var _a, _b;
|
|
4271
4379
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
4272
4380
|
if (!open) composition.onCompositionEnd();
|
|
@@ -4312,7 +4420,7 @@ function KjunSelect({
|
|
|
4312
4420
|
borderRadius: spec.radius,
|
|
4313
4421
|
...inputTypeStyle(size),
|
|
4314
4422
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4315
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4423
|
+
...segment ? {} : { paddingInline: spec.padding - import_tokens24.tokens.border.controlWidth }
|
|
4316
4424
|
},
|
|
4317
4425
|
onClick: () => changeOpen(!open),
|
|
4318
4426
|
onKeyDown: (e) => {
|
|
@@ -4323,7 +4431,7 @@ function KjunSelect({
|
|
|
4323
4431
|
},
|
|
4324
4432
|
children: [
|
|
4325
4433
|
/* @__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 }),
|
|
4326
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ?
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? import_tokens24.tokens.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
4327
4435
|
]
|
|
4328
4436
|
}
|
|
4329
4437
|
),
|
|
@@ -4427,7 +4535,7 @@ function KjunSelect({
|
|
|
4427
4535
|
className: "kjun-option",
|
|
4428
4536
|
children: [
|
|
4429
4537
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4430
|
-
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size:
|
|
4538
|
+
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size: import_tokens24.tokens.extensions.menu.iconSize })
|
|
4431
4539
|
]
|
|
4432
4540
|
},
|
|
4433
4541
|
key
|
|
@@ -4453,21 +4561,21 @@ function KjunSelect({
|
|
|
4453
4561
|
}
|
|
4454
4562
|
|
|
4455
4563
|
// packages/react/src/navigation.tsx
|
|
4456
|
-
var
|
|
4564
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4457
4565
|
|
|
4458
4566
|
// packages/react/src/collapse.tsx
|
|
4459
|
-
var
|
|
4460
|
-
var
|
|
4567
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4568
|
+
var import_react37 = require("react");
|
|
4461
4569
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4462
4570
|
function Collapse({ open, children }) {
|
|
4463
4571
|
const reduced = useReducedMotion();
|
|
4464
|
-
const [retained, setRetained] = (0,
|
|
4465
|
-
const root = (0,
|
|
4466
|
-
const animation = (0,
|
|
4467
|
-
const previous = (0,
|
|
4468
|
-
const interrupted = (0,
|
|
4572
|
+
const [retained, setRetained] = (0, import_react37.useState)(open);
|
|
4573
|
+
const root = (0, import_react37.useRef)(null), body = (0, import_react37.useRef)(null);
|
|
4574
|
+
const animation = (0, import_react37.useRef)(null);
|
|
4575
|
+
const previous = (0, import_react37.useRef)(open);
|
|
4576
|
+
const interrupted = (0, import_react37.useRef)(null);
|
|
4469
4577
|
const present = open || retained;
|
|
4470
|
-
(0,
|
|
4578
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4471
4579
|
const el = root.current, inner = body.current;
|
|
4472
4580
|
if (!el || !inner) return;
|
|
4473
4581
|
let disposed = false;
|
|
@@ -4492,8 +4600,8 @@ function Collapse({ open, children }) {
|
|
|
4492
4600
|
}
|
|
4493
4601
|
el.style.height = end + "px";
|
|
4494
4602
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4495
|
-
duration:
|
|
4496
|
-
easing:
|
|
4603
|
+
duration: import_tokens25.tokens.motion.collapse,
|
|
4604
|
+
easing: import_tokens25.tokens.motion.easeOut
|
|
4497
4605
|
});
|
|
4498
4606
|
animation.current = transition;
|
|
4499
4607
|
transition.onfinish = finish;
|
|
@@ -4522,10 +4630,10 @@ function Collapse({ open, children }) {
|
|
|
4522
4630
|
}
|
|
4523
4631
|
|
|
4524
4632
|
// shared/package-runtime/navigation.ts
|
|
4525
|
-
var
|
|
4633
|
+
var import_react38 = require("react");
|
|
4526
4634
|
function useInitialTab(value, candidate, change) {
|
|
4527
|
-
const requested = (0,
|
|
4528
|
-
(0,
|
|
4635
|
+
const requested = (0, import_react38.useRef)(/* @__PURE__ */ new Set());
|
|
4636
|
+
(0, import_react38.useEffect)(() => {
|
|
4529
4637
|
if (value !== "") {
|
|
4530
4638
|
requested.current.clear();
|
|
4531
4639
|
return;
|
|
@@ -4536,8 +4644,8 @@ function useInitialTab(value, candidate, change) {
|
|
|
4536
4644
|
}, [value, candidate, change]);
|
|
4537
4645
|
}
|
|
4538
4646
|
function useAccordionState(multiple) {
|
|
4539
|
-
const [opened, setOpened] = (0,
|
|
4540
|
-
(0,
|
|
4647
|
+
const [opened, setOpened] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
|
|
4648
|
+
(0, import_react38.useEffect)(() => {
|
|
4541
4649
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4542
4650
|
}, [multiple]);
|
|
4543
4651
|
return {
|
|
@@ -4621,7 +4729,7 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4621
4729
|
}
|
|
4622
4730
|
|
|
4623
4731
|
// packages/react/src/navigation.tsx
|
|
4624
|
-
var
|
|
4732
|
+
var import_react39 = require("react");
|
|
4625
4733
|
var import_react_aria_components9 = require("react-aria-components");
|
|
4626
4734
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4627
4735
|
function KjunTabs({
|
|
@@ -4640,33 +4748,33 @@ function KjunTabs({
|
|
|
4640
4748
|
const m = useKjunMessages();
|
|
4641
4749
|
ariaLabel != null ? ariaLabel : ariaLabel = m.tabs;
|
|
4642
4750
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4643
|
-
const panes =
|
|
4644
|
-
|
|
4751
|
+
const panes = import_react39.Children.toArray(children).filter(
|
|
4752
|
+
import_react39.isValidElement
|
|
4645
4753
|
);
|
|
4646
4754
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4647
|
-
(0,
|
|
4755
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
4648
4756
|
var _a2;
|
|
4649
4757
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4650
4758
|
if (list) return manageTabList(list, () => {
|
|
4651
4759
|
}, false);
|
|
4652
4760
|
}, [group]);
|
|
4653
|
-
(0,
|
|
4761
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
4654
4762
|
var _a2;
|
|
4655
4763
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4656
4764
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4657
4765
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4658
4766
|
}
|
|
4659
4767
|
});
|
|
4660
|
-
const timer = (0,
|
|
4661
|
-
const menuState = (0,
|
|
4768
|
+
const timer = (0, import_react39.useRef)(void 0), press = (0, import_react39.useRef)(null);
|
|
4769
|
+
const menuState = (0, import_react39.useRef)({ tabs, onTabMenu });
|
|
4662
4770
|
menuState.current = { tabs, onTabMenu };
|
|
4663
4771
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4664
4772
|
const clear = () => {
|
|
4665
4773
|
clearTimeout(timer.current);
|
|
4666
4774
|
press.current = null;
|
|
4667
4775
|
};
|
|
4668
|
-
(0,
|
|
4669
|
-
(0,
|
|
4776
|
+
(0, import_react39.useEffect)(() => clear, []);
|
|
4777
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
4670
4778
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4671
4779
|
}, [tabs, onTabMenu]);
|
|
4672
4780
|
const change = (name) => {
|
|
@@ -4725,7 +4833,7 @@ function KjunTabs({
|
|
|
4725
4833
|
onTouchEnd: clear,
|
|
4726
4834
|
onTouchCancel: clear,
|
|
4727
4835
|
children: [
|
|
4728
|
-
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: tab.icon, size:
|
|
4836
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: tab.icon, size: import_tokens26.tokens.extensions.tabs.iconSize }),
|
|
4729
4837
|
" ",
|
|
4730
4838
|
/* @__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 }) }),
|
|
4731
4839
|
tab.badge != null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4763,7 +4871,7 @@ function KjunTabPane({ name, children }) {
|
|
|
4763
4871
|
}
|
|
4764
4872
|
);
|
|
4765
4873
|
}
|
|
4766
|
-
var AccordionContext = (0,
|
|
4874
|
+
var AccordionContext = (0, import_react39.createContext)(null);
|
|
4767
4875
|
function KjunAccordion({
|
|
4768
4876
|
multiple = false,
|
|
4769
4877
|
tone = "card",
|
|
@@ -4785,8 +4893,8 @@ function KjunAccordionItem({
|
|
|
4785
4893
|
header,
|
|
4786
4894
|
children
|
|
4787
4895
|
}) {
|
|
4788
|
-
const group = (0,
|
|
4789
|
-
(0,
|
|
4896
|
+
const group = (0, import_react39.useContext)(AccordionContext), id = "kjun-" + (0, import_react39.useId)(), [own, setOwn] = (0, import_react39.useState)(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
4897
|
+
(0, import_react39.useEffect)(() => {
|
|
4790
4898
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4791
4899
|
}, []);
|
|
4792
4900
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-accordion-item", children: [
|
|
@@ -4807,7 +4915,7 @@ function KjunAccordionItem({
|
|
|
4807
4915
|
{
|
|
4808
4916
|
name: "chevron-down",
|
|
4809
4917
|
className: "kjun-accordion-chevron",
|
|
4810
|
-
size:
|
|
4918
|
+
size: import_tokens26.tokens.extensions.accordion.iconSize,
|
|
4811
4919
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4812
4920
|
}
|
|
4813
4921
|
)
|
|
@@ -4835,12 +4943,12 @@ function KjunBreadcrumb({
|
|
|
4835
4943
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4836
4944
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4837
4945
|
const label = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4838
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size:
|
|
4946
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size: import_tokens26.tokens.extensions.breadcrumb.iconSize }),
|
|
4839
4947
|
" ",
|
|
4840
4948
|
item.label
|
|
4841
4949
|
] });
|
|
4842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4843
|
-
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size:
|
|
4950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react39.Fragment, { children: [
|
|
4951
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens26.tokens.extensions.breadcrumb.separatorSize }),
|
|
4844
4952
|
" ",
|
|
4845
4953
|
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 })
|
|
4846
4954
|
] }, i);
|
|
@@ -4887,7 +4995,7 @@ function KjunPagination({
|
|
|
4887
4995
|
"aria-label": label,
|
|
4888
4996
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4889
4997
|
onClick: () => change(target),
|
|
4890
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size:
|
|
4998
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size: import_tokens26.tokens.extensions.pagination.iconSize })
|
|
4891
4999
|
}
|
|
4892
5000
|
);
|
|
4893
5001
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -4940,8 +5048,8 @@ function KjunPagination({
|
|
|
4940
5048
|
}
|
|
4941
5049
|
|
|
4942
5050
|
// packages/react/src/actions.tsx
|
|
4943
|
-
var
|
|
4944
|
-
var
|
|
5051
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
5052
|
+
var import_react40 = require("react");
|
|
4945
5053
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4946
5054
|
function KjunIconToggle({
|
|
4947
5055
|
active = false,
|
|
@@ -4961,7 +5069,7 @@ function KjunIconToggle({
|
|
|
4961
5069
|
onToggle
|
|
4962
5070
|
}) {
|
|
4963
5071
|
var _a;
|
|
4964
|
-
const navigation = (0,
|
|
5072
|
+
const navigation = (0, import_react40.useContext)(TopNavigationContext);
|
|
4965
5073
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4966
5074
|
"button",
|
|
4967
5075
|
{
|
|
@@ -4982,7 +5090,7 @@ function KjunIconToggle({
|
|
|
4982
5090
|
{
|
|
4983
5091
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
4984
5092
|
filled: active,
|
|
4985
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5093
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens27.tokens.button.iconSizes[size],
|
|
4986
5094
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4987
5095
|
className: active ? activeColorClass : inactiveColorClass,
|
|
4988
5096
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5023,8 +5131,8 @@ function KjunCopyButton({
|
|
|
5023
5131
|
const m = useKjunMessages();
|
|
5024
5132
|
successText != null ? successText : successText = m.copied;
|
|
5025
5133
|
const feedback = useOptionalKjunFeedback();
|
|
5026
|
-
const [copied, setCopied] = (0,
|
|
5027
|
-
(0,
|
|
5134
|
+
const [copied, setCopied] = (0, import_react40.useState)(false), [failed, setFailed] = (0, import_react40.useState)(false), busy = (0, import_react40.useRef)(false), timer = (0, import_react40.useRef)(void 0), mounted = (0, import_react40.useRef)(true);
|
|
5135
|
+
(0, import_react40.useEffect)(() => {
|
|
5028
5136
|
mounted.current = true;
|
|
5029
5137
|
return () => {
|
|
5030
5138
|
mounted.current = false;
|
|
@@ -5042,9 +5150,9 @@ function KjunCopyButton({
|
|
|
5042
5150
|
"data-inline": inline,
|
|
5043
5151
|
style: {
|
|
5044
5152
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5045
|
-
minHeight:
|
|
5153
|
+
minHeight: import_tokens27.tokens.button.heights[size],
|
|
5046
5154
|
paddingBlock: 0,
|
|
5047
|
-
paddingInline: { xs:
|
|
5155
|
+
paddingInline: { xs: import_tokens27.tokens.dimension.value4, sm: import_tokens27.tokens.dimension.value8, md: import_tokens27.tokens.dimension.value12 }[size]
|
|
5048
5156
|
},
|
|
5049
5157
|
onClick: async (event) => {
|
|
5050
5158
|
event.stopPropagation();
|
|
@@ -5074,7 +5182,7 @@ function KjunCopyButton({
|
|
|
5074
5182
|
KjunIcon,
|
|
5075
5183
|
{
|
|
5076
5184
|
name: copied ? "check" : "copy",
|
|
5077
|
-
size:
|
|
5185
|
+
size: import_tokens27.tokens.button.iconSizes[size],
|
|
5078
5186
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5079
5187
|
}
|
|
5080
5188
|
),
|
|
@@ -5148,14 +5256,14 @@ function KjunExternalLink({
|
|
|
5148
5256
|
onClick: (e) => e.stopPropagation(),
|
|
5149
5257
|
children: [
|
|
5150
5258
|
body,
|
|
5151
|
-
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size:
|
|
5259
|
+
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size: import_tokens27.tokens.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5152
5260
|
!name && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5153
5261
|
]
|
|
5154
5262
|
}
|
|
5155
5263
|
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": name, children: body });
|
|
5156
5264
|
}
|
|
5157
5265
|
function KjunScrollFade({ children }) {
|
|
5158
|
-
const ref = (0,
|
|
5266
|
+
const ref = (0, import_react40.useRef)(null), [edges, setEdges] = (0, import_react40.useState)({ left: false, right: false });
|
|
5159
5267
|
const update = () => {
|
|
5160
5268
|
const el = ref.current;
|
|
5161
5269
|
if (el)
|
|
@@ -5167,7 +5275,7 @@ function KjunScrollFade({ children }) {
|
|
|
5167
5275
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
5168
5276
|
});
|
|
5169
5277
|
};
|
|
5170
|
-
(0,
|
|
5278
|
+
(0, import_react40.useEffect)(() => {
|
|
5171
5279
|
update();
|
|
5172
5280
|
const observer = new ResizeObserver(update);
|
|
5173
5281
|
if (ref.current) {
|
|
@@ -5176,7 +5284,7 @@ function KjunScrollFade({ children }) {
|
|
|
5176
5284
|
}
|
|
5177
5285
|
return () => observer.disconnect();
|
|
5178
5286
|
}, [children]);
|
|
5179
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5287
|
+
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${import_tokens27.tokens.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${import_tokens27.tokens.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
5180
5288
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5181
5289
|
"div",
|
|
5182
5290
|
{
|
|
@@ -5190,14 +5298,14 @@ function KjunScrollFade({ children }) {
|
|
|
5190
5298
|
}
|
|
5191
5299
|
|
|
5192
5300
|
// packages/react/src/data-state.tsx
|
|
5193
|
-
var
|
|
5194
|
-
var
|
|
5301
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
5302
|
+
var import_react42 = require("react");
|
|
5195
5303
|
|
|
5196
5304
|
// shared/package-runtime/use-loading-reveal.ts
|
|
5197
|
-
var
|
|
5305
|
+
var import_react41 = require("react");
|
|
5198
5306
|
function useLoadingReveal(active, delay = 0) {
|
|
5199
|
-
const [revealed, setRevealed] = (0,
|
|
5200
|
-
(0,
|
|
5307
|
+
const [revealed, setRevealed] = (0, import_react41.useState)(false);
|
|
5308
|
+
(0, import_react41.useEffect)(() => {
|
|
5201
5309
|
setRevealed(false);
|
|
5202
5310
|
if (!active || delay <= 0) return;
|
|
5203
5311
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -5210,13 +5318,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
5210
5318
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5211
5319
|
function useQueryDisplay(props) {
|
|
5212
5320
|
var _a;
|
|
5213
|
-
const [state, setState] = (0,
|
|
5321
|
+
const [state, setState] = (0, import_react42.useState)(() => (0, import_tokens28.initialQueryDisplay)(props));
|
|
5214
5322
|
let next = state;
|
|
5215
5323
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
5216
|
-
next = (0,
|
|
5324
|
+
next = (0, import_tokens28.advanceQueryDisplay)(state, props);
|
|
5217
5325
|
setState(next);
|
|
5218
5326
|
}
|
|
5219
|
-
return (0,
|
|
5327
|
+
return (0, import_tokens28.queryDisplayStatus)(next, props);
|
|
5220
5328
|
}
|
|
5221
5329
|
function KjunDataState({
|
|
5222
5330
|
preserveContent = false,
|
|
@@ -5248,7 +5356,7 @@ function KjunDataState({
|
|
|
5248
5356
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5249
5357
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5250
5358
|
retryText != null ? retryText : retryText = m.retry;
|
|
5251
|
-
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 =
|
|
5359
|
+
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_tokens28.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5252
5360
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5253
5361
|
/* @__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: [
|
|
5254
5362
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "xs" }),
|
|
@@ -5262,7 +5370,7 @@ function KjunDataState({
|
|
|
5262
5370
|
"aria-label": revealed ? loadingText : void 0,
|
|
5263
5371
|
"aria-hidden": revealed ? void 0 : true,
|
|
5264
5372
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5265
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap:
|
|
5373
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap: import_tokens28.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: [
|
|
5266
5374
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "md" }),
|
|
5267
5375
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: loadingText })
|
|
5268
5376
|
] }))
|
|
@@ -5275,7 +5383,7 @@ function KjunDataState({
|
|
|
5275
5383
|
"aria-hidden": concealed || void 0,
|
|
5276
5384
|
inert: concealed || void 0,
|
|
5277
5385
|
style: {
|
|
5278
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5386
|
+
opacity: query2.loading && !state.usesQueryState ? import_tokens28.tokens.states.opacity.pending : void 0
|
|
5279
5387
|
},
|
|
5280
5388
|
children
|
|
5281
5389
|
},
|
|
@@ -5284,7 +5392,7 @@ function KjunDataState({
|
|
|
5284
5392
|
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "kjun-data-warning kjun-state-actions", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) })
|
|
5285
5393
|
] });
|
|
5286
5394
|
}
|
|
5287
|
-
var KjunErrorBoundary = class extends
|
|
5395
|
+
var KjunErrorBoundary = class extends import_react42.Component {
|
|
5288
5396
|
constructor() {
|
|
5289
5397
|
super(...arguments);
|
|
5290
5398
|
this.state = { error: false };
|
|
@@ -5317,7 +5425,7 @@ var KjunErrorBoundary = class extends import_react41.Component {
|
|
|
5317
5425
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5318
5426
|
|
|
5319
5427
|
// packages/react/src/skeletons.tsx
|
|
5320
|
-
var
|
|
5428
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5321
5429
|
|
|
5322
5430
|
// shared/package-runtime/chart-skeleton.ts
|
|
5323
5431
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5334,11 +5442,11 @@ function chartSkeletonKind(kind) {
|
|
|
5334
5442
|
}
|
|
5335
5443
|
|
|
5336
5444
|
// packages/react/src/market-skeleton.tsx
|
|
5337
|
-
var
|
|
5445
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
5338
5446
|
|
|
5339
5447
|
// shared/package-runtime/market-layout.ts
|
|
5340
|
-
var
|
|
5341
|
-
var marketGeometry =
|
|
5448
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
5449
|
+
var marketGeometry = import_tokens29.tokens.extensions.marketTable;
|
|
5342
5450
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5343
5451
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5344
5452
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5379,15 +5487,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5379
5487
|
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: [
|
|
5380
5488
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5381
5489
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5382
|
-
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:
|
|
5490
|
+
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_tokens30.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens30.tokens.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5383
5491
|
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))
|
|
5384
5492
|
] }) }),
|
|
5385
5493
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5386
|
-
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:
|
|
5494
|
+
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_tokens30.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens30.tokens.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5387
5495
|
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: [
|
|
5388
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5389
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5390
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens30.tokens.extensions.skeleton.lineHeights.md }),
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens30.tokens.extensions.skeleton.lineHeights.sm })
|
|
5498
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens30.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens30.tokens.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
5391
5499
|
] }, row)) })
|
|
5392
5500
|
] }) });
|
|
5393
5501
|
}
|
|
@@ -5398,7 +5506,7 @@ function KjunListSkeleton({
|
|
|
5398
5506
|
rows = 8,
|
|
5399
5507
|
variant = "market",
|
|
5400
5508
|
avatar = true,
|
|
5401
|
-
avatarSize =
|
|
5509
|
+
avatarSize = import_tokens31.tokens.extensions.skeleton.listAvatarSize,
|
|
5402
5510
|
quote = true
|
|
5403
5511
|
}) {
|
|
5404
5512
|
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: [
|
|
@@ -5408,15 +5516,15 @@ function KjunListSkeleton({
|
|
|
5408
5516
|
KjunSkeleton,
|
|
5409
5517
|
{
|
|
5410
5518
|
type: "block",
|
|
5411
|
-
height:
|
|
5519
|
+
height: import_tokens31.tokens.extensions.skeleton.lineHeights.md,
|
|
5412
5520
|
width: i % 2 ? "80%" : "65%"
|
|
5413
5521
|
}
|
|
5414
5522
|
),
|
|
5415
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5416
5524
|
] }),
|
|
5417
5525
|
quote && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5418
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5419
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5526
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.quoteHeight, width: import_tokens31.tokens.extensions.skeleton.quoteWidth }),
|
|
5527
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens31.tokens.extensions.skeleton.detailWidth })
|
|
5420
5528
|
] })
|
|
5421
5529
|
] }, i)) });
|
|
5422
5530
|
}
|
|
@@ -5432,17 +5540,17 @@ function KjunFormSkeleton({
|
|
|
5432
5540
|
"aria-hidden": "true",
|
|
5433
5541
|
className: "kjun-form-skeleton",
|
|
5434
5542
|
"data-columns": columns,
|
|
5435
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5543
|
+
style: { "--_kjun-form-skeleton-radius": `${import_tokens31.tokens.input[size].radius}px` },
|
|
5436
5544
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5437
5545
|
field ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5438
5546
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5439
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5547
|
+
/* @__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_tokens31.tokens.extensions.skeleton.formLabelHeight, width: import_tokens31.tokens.extensions.skeleton.formLabelWidth }) })
|
|
5440
5548
|
),
|
|
5441
5549
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5442
5550
|
KjunSkeleton,
|
|
5443
5551
|
{
|
|
5444
5552
|
type: "block",
|
|
5445
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5553
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? import_tokens31.tokens.input[size].lineHeight * 3 + import_tokens31.tokens.input[size].textareaPaddingY * 2 + 2 * import_tokens31.tokens.border.controlWidth : import_tokens31.tokens.input[size].height
|
|
5446
5554
|
}
|
|
5447
5555
|
)
|
|
5448
5556
|
] }, i))
|
|
@@ -5451,7 +5559,7 @@ function KjunFormSkeleton({
|
|
|
5451
5559
|
}
|
|
5452
5560
|
function KjunChartSkeleton({
|
|
5453
5561
|
kind: requestedKind = "frame",
|
|
5454
|
-
height =
|
|
5562
|
+
height = import_tokens31.tokens.extensions.chartSkeleton.height,
|
|
5455
5563
|
loadingText,
|
|
5456
5564
|
skeleton = true,
|
|
5457
5565
|
loadingDelay = 0,
|
|
@@ -5507,7 +5615,7 @@ function KjunChartSkeleton({
|
|
|
5507
5615
|
d: chartFramePath,
|
|
5508
5616
|
fill: "none",
|
|
5509
5617
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5510
|
-
strokeWidth:
|
|
5618
|
+
strokeWidth: import_tokens31.tokens.border.defaultWidth,
|
|
5511
5619
|
vectorEffect: "non-scaling-stroke"
|
|
5512
5620
|
}
|
|
5513
5621
|
)
|
|
@@ -5520,17 +5628,17 @@ function KjunChartSkeleton({
|
|
|
5520
5628
|
}
|
|
5521
5629
|
|
|
5522
5630
|
// packages/react/src/financial-display.tsx
|
|
5523
|
-
var
|
|
5524
|
-
var
|
|
5631
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5632
|
+
var import_react44 = require("react");
|
|
5525
5633
|
|
|
5526
5634
|
// packages/react/src/number-display.tsx
|
|
5527
|
-
var
|
|
5635
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5528
5636
|
|
|
5529
5637
|
// shared/package-runtime/use-number-motion.ts
|
|
5530
|
-
var
|
|
5638
|
+
var import_react43 = require("react");
|
|
5531
5639
|
|
|
5532
5640
|
// shared/package-runtime/number-motion.ts
|
|
5533
|
-
var
|
|
5641
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5534
5642
|
function createNumberMotion(apply) {
|
|
5535
5643
|
let frame = 0, revision = 0, current = 0;
|
|
5536
5644
|
let previous;
|
|
@@ -5561,7 +5669,7 @@ function createNumberMotion(apply) {
|
|
|
5561
5669
|
if (from === target) return;
|
|
5562
5670
|
const tick = (now) => {
|
|
5563
5671
|
if (version !== revision) return;
|
|
5564
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5672
|
+
const progress = Math.min(1, Math.max(0, (now - started) / import_tokens32.tokens.motion.number));
|
|
5565
5673
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5566
5674
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5567
5675
|
};
|
|
@@ -5573,14 +5681,14 @@ function createNumberMotion(apply) {
|
|
|
5573
5681
|
|
|
5574
5682
|
// shared/package-runtime/use-number-motion.ts
|
|
5575
5683
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5576
|
-
const [display, setDisplay] = (0,
|
|
5577
|
-
const motion = (0,
|
|
5684
|
+
const [display, setDisplay] = (0, import_react43.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5685
|
+
const motion = (0, import_react43.useRef)(null);
|
|
5578
5686
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5579
|
-
(0,
|
|
5687
|
+
(0, import_react43.useLayoutEffect)(() => {
|
|
5580
5688
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5581
5689
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5582
5690
|
}, [value, animated, fromPrevious, reduced]);
|
|
5583
|
-
(0,
|
|
5691
|
+
(0, import_react43.useLayoutEffect)(() => () => {
|
|
5584
5692
|
var _a;
|
|
5585
5693
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5586
5694
|
motion.current = null;
|
|
@@ -5640,7 +5748,7 @@ function KjunPriceCell({
|
|
|
5640
5748
|
flashClass = "",
|
|
5641
5749
|
fromPrevious = true
|
|
5642
5750
|
}) {
|
|
5643
|
-
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height:
|
|
5751
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height: import_tokens33.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens33.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5644
5752
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5645
5753
|
"span",
|
|
5646
5754
|
{
|
|
@@ -5688,7 +5796,7 @@ function KjunSignedValue({
|
|
|
5688
5796
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5689
5797
|
},
|
|
5690
5798
|
children: [
|
|
5691
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width:
|
|
5799
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width: import_tokens33.tokens.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5692
5800
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunFreshness, { stale: true })
|
|
5693
5801
|
]
|
|
5694
5802
|
}
|
|
@@ -5697,7 +5805,7 @@ function KjunSignedValue({
|
|
|
5697
5805
|
|
|
5698
5806
|
// packages/react/src/financial-display.tsx
|
|
5699
5807
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5700
|
-
var deviationFill = { neutral: 1, low:
|
|
5808
|
+
var deviationFill = { neutral: 1, low: import_tokens34.tokens.states.opacity.deviationLow, medium: import_tokens34.tokens.states.opacity.deviationMedium, strong: import_tokens34.tokens.states.opacity.deviationStrong };
|
|
5701
5809
|
function KjunDeviation({
|
|
5702
5810
|
value,
|
|
5703
5811
|
variant = "pill",
|
|
@@ -5709,7 +5817,7 @@ function KjunDeviation({
|
|
|
5709
5817
|
const n = finiteNumber(value);
|
|
5710
5818
|
if (n === null)
|
|
5711
5819
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5712
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0,
|
|
5820
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens34.deviationLevel)(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
5713
5821
|
if (variant === "badge")
|
|
5714
5822
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5715
5823
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -5729,7 +5837,7 @@ function KjunDeviation({
|
|
|
5729
5837
|
KjunIcon,
|
|
5730
5838
|
{
|
|
5731
5839
|
name: "alert-triangle",
|
|
5732
|
-
size:
|
|
5840
|
+
size: import_tokens34.tokens.extensions.financial.warningIconSize,
|
|
5733
5841
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5734
5842
|
}
|
|
5735
5843
|
) })
|
|
@@ -5742,7 +5850,7 @@ function KjunDeviation({
|
|
|
5742
5850
|
className: "kjun-deviation",
|
|
5743
5851
|
ref: domainColorRef(!neutral),
|
|
5744
5852
|
"data-variant": variant,
|
|
5745
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
5853
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens34.tokens.typography.numberLg.fontWeight : import_tokens34.tokens.typography.control.fontWeight },
|
|
5746
5854
|
children: [
|
|
5747
5855
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5748
5856
|
"span",
|
|
@@ -5770,7 +5878,7 @@ function KjunHeatmapCell({
|
|
|
5770
5878
|
}) {
|
|
5771
5879
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5772
5880
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5773
|
-
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } =
|
|
5881
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = import_tokens34.tokens.states.opacity;
|
|
5774
5882
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5775
5883
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5776
5884
|
"span",
|
|
@@ -5789,7 +5897,7 @@ function KjunProgressCell({
|
|
|
5789
5897
|
showLabel = true,
|
|
5790
5898
|
color = "auto",
|
|
5791
5899
|
customColor,
|
|
5792
|
-
height =
|
|
5900
|
+
height = import_tokens34.tokens.extensions.financial.progressHeight
|
|
5793
5901
|
}) {
|
|
5794
5902
|
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;
|
|
5795
5903
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5813,7 +5921,7 @@ function KjunCollectionMark({
|
|
|
5813
5921
|
active = false,
|
|
5814
5922
|
size = "md"
|
|
5815
5923
|
}) {
|
|
5816
|
-
const box =
|
|
5924
|
+
const box = import_tokens34.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens34.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5817
5925
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5818
5926
|
KjunIcon,
|
|
5819
5927
|
{
|
|
@@ -5849,8 +5957,8 @@ function KjunExecutionStatusBadge({
|
|
|
5849
5957
|
}
|
|
5850
5958
|
function KjunSparkline({
|
|
5851
5959
|
data = [],
|
|
5852
|
-
width =
|
|
5853
|
-
height =
|
|
5960
|
+
width = import_tokens34.tokens.extensions.financial.sparklineWidth,
|
|
5961
|
+
height = import_tokens34.tokens.extensions.financial.sparklineHeight,
|
|
5854
5962
|
color,
|
|
5855
5963
|
semantic = "price",
|
|
5856
5964
|
fill = true,
|
|
@@ -5858,7 +5966,7 @@ function KjunSparkline({
|
|
|
5858
5966
|
stretch = false,
|
|
5859
5967
|
ariaLabel
|
|
5860
5968
|
}) {
|
|
5861
|
-
const id = "kjun-" + (0,
|
|
5969
|
+
const id = "kjun-" + (0, import_react44.useId)().replace(/:/g, ""), values = data.filter(Number.isFinite), min = Math.min(...values), max = Math.max(...values), range = max - min || 1, points = values.map(
|
|
5862
5970
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5863
5971
|
).join(" "), change = values.length > 1 ? values[values.length - 1] - values[0] : 0, line = color || `var(--_kjun-color-${change === 0 ? "text-tertiary" : semantic === "status" ? change > 0 ? "success" : "danger" : change > 0 ? "price-up" : "price-down"})`;
|
|
5864
5972
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
@@ -5905,8 +6013,8 @@ function KjunSparkline({
|
|
|
5905
6013
|
}
|
|
5906
6014
|
|
|
5907
6015
|
// shared/package-runtime/table.ts
|
|
5908
|
-
var
|
|
5909
|
-
var
|
|
6016
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
6017
|
+
var import_react45 = require("react");
|
|
5910
6018
|
|
|
5911
6019
|
// shared/package-runtime/table-model.ts
|
|
5912
6020
|
function getValue(row, key) {
|
|
@@ -5950,11 +6058,11 @@ function useTableModel(props) {
|
|
|
5950
6058
|
expandSingle = false,
|
|
5951
6059
|
onExpandedRowsChange
|
|
5952
6060
|
} = props;
|
|
5953
|
-
const [internalSort, setSort] = (0,
|
|
6061
|
+
const [internalSort, setSort] = (0, import_react45.useState)({
|
|
5954
6062
|
key: "",
|
|
5955
6063
|
order: "asc"
|
|
5956
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5957
|
-
(0,
|
|
6064
|
+
}), [internalExpanded, setExpanded] = (0, import_react45.useState)([]), [search, setSearch] = (0, import_react45.useState)(""), timer = (0, import_react45.useRef)(void 0);
|
|
6065
|
+
(0, import_react45.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5958
6066
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5959
6067
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5960
6068
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5979,7 +6087,7 @@ function useTableModel(props) {
|
|
|
5979
6087
|
sortColumn: (col) => {
|
|
5980
6088
|
var _a2;
|
|
5981
6089
|
if (!sortable || !col.sortable) return;
|
|
5982
|
-
const next = (0,
|
|
6090
|
+
const next = (0, import_tokens35.nextTableSort)(sort, col.key);
|
|
5983
6091
|
if (props.sort === void 0) setSort(next);
|
|
5984
6092
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
5985
6093
|
},
|
|
@@ -6043,7 +6151,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6043
6151
|
}
|
|
6044
6152
|
|
|
6045
6153
|
// packages/react/src/table-toolbar.tsx
|
|
6046
|
-
var
|
|
6154
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6047
6155
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6048
6156
|
function TableToolbar({
|
|
6049
6157
|
selectable,
|
|
@@ -6086,7 +6194,7 @@ function TableToolbar({
|
|
|
6086
6194
|
KjunInput,
|
|
6087
6195
|
{
|
|
6088
6196
|
size: "sm",
|
|
6089
|
-
style: { width:
|
|
6197
|
+
style: { width: import_tokens36.tokens.table.searchWidth, maxWidth: "100%" },
|
|
6090
6198
|
value: search,
|
|
6091
6199
|
ariaLabel: m.searchTable,
|
|
6092
6200
|
placeholder: searchPlaceholder,
|
|
@@ -6102,22 +6210,22 @@ function TableToolbar({
|
|
|
6102
6210
|
}
|
|
6103
6211
|
|
|
6104
6212
|
// packages/react/src/table-grid.tsx
|
|
6105
|
-
var
|
|
6106
|
-
var
|
|
6213
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6214
|
+
var import_react47 = require("react");
|
|
6107
6215
|
|
|
6108
6216
|
// packages/react/src/table-check.tsx
|
|
6109
|
-
var
|
|
6217
|
+
var import_react46 = require("react");
|
|
6110
6218
|
|
|
6111
6219
|
// shared/package-runtime/component-icons.ts
|
|
6112
6220
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
6113
6221
|
var componentIcons = { minus: import_minus.default };
|
|
6114
6222
|
|
|
6115
6223
|
// packages/react/src/table-check.tsx
|
|
6116
|
-
var
|
|
6224
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6117
6225
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6118
|
-
var TableCheck = (0,
|
|
6226
|
+
var TableCheck = (0, import_react46.forwardRef)(
|
|
6119
6227
|
function TableCheck2(props, ref) {
|
|
6120
|
-
const size =
|
|
6228
|
+
const size = import_tokens37.tokens.extensions.checkbox.iconSizes.sm;
|
|
6121
6229
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "kjun-table-check", children: [
|
|
6122
6230
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
6123
6231
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6174,7 +6282,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6174
6282
|
KjunIcon,
|
|
6175
6283
|
{
|
|
6176
6284
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6177
|
-
size:
|
|
6285
|
+
size: import_tokens38.tokens.table.sortIconSize
|
|
6178
6286
|
}
|
|
6179
6287
|
)
|
|
6180
6288
|
]
|
|
@@ -6187,14 +6295,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6187
6295
|
}
|
|
6188
6296
|
),
|
|
6189
6297
|
/* @__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: [
|
|
6190
|
-
selectable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "block", height:
|
|
6298
|
+
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_tokens38.tokens.table.selectionSize, width: import_tokens38.tokens.table.selectionSize }) }),
|
|
6191
6299
|
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
6192
6300
|
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6193
6301
|
KjunSkeleton,
|
|
6194
6302
|
{
|
|
6195
6303
|
type: "block",
|
|
6196
|
-
height:
|
|
6197
|
-
width: col.key === "actions" ?
|
|
6304
|
+
height: import_tokens38.tokens.table.skeletonHeight,
|
|
6305
|
+
width: col.key === "actions" ? import_tokens38.tokens.table.actionColumnWidth : "75%"
|
|
6198
6306
|
}
|
|
6199
6307
|
) }, col.key))
|
|
6200
6308
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6204,7 +6312,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6204
6312
|
className: "kjun-table-empty",
|
|
6205
6313
|
children: emptyContent || emptyText
|
|
6206
6314
|
}
|
|
6207
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6315
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react47.Fragment, { children: [
|
|
6208
6316
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6209
6317
|
"tr",
|
|
6210
6318
|
{
|
|
@@ -6348,8 +6456,8 @@ function TableCards({
|
|
|
6348
6456
|
}
|
|
6349
6457
|
|
|
6350
6458
|
// packages/react/src/table-view.tsx
|
|
6351
|
-
var
|
|
6352
|
-
var
|
|
6459
|
+
var import_react48 = require("react");
|
|
6460
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6353
6461
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6354
6462
|
function KjunTable(props) {
|
|
6355
6463
|
const m = useKjunMessages();
|
|
@@ -6379,9 +6487,9 @@ function KjunTable(props) {
|
|
|
6379
6487
|
onRowClick,
|
|
6380
6488
|
onRetry
|
|
6381
6489
|
} = props;
|
|
6382
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
6383
|
-
(0,
|
|
6384
|
-
const media = matchMedia(`(width < ${
|
|
6490
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react48.useState)(false);
|
|
6491
|
+
(0, import_react48.useEffect)(() => {
|
|
6492
|
+
const media = matchMedia(`(width < ${import_tokens39.tokens.table.mobileBreakpoint}px)`);
|
|
6385
6493
|
const update = () => setMobile(media.matches);
|
|
6386
6494
|
update();
|
|
6387
6495
|
media.addEventListener("change", update);
|
|
@@ -6401,7 +6509,7 @@ function KjunTable(props) {
|
|
|
6401
6509
|
};
|
|
6402
6510
|
const customClass = (row, i) => typeof rowClass === "function" ? rowClass(row, i) : rowClass || "";
|
|
6403
6511
|
const rowKeyDown = (event, row, index) => {
|
|
6404
|
-
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0,
|
|
6512
|
+
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0, import_tokens39.isComposingKey)(event)) return;
|
|
6405
6513
|
if (event.key === "Enter" || event.key === " ") {
|
|
6406
6514
|
event.preventDefault();
|
|
6407
6515
|
onRowClick(row, index);
|
|
@@ -6485,7 +6593,7 @@ function KjunTable(props) {
|
|
|
6485
6593
|
}
|
|
6486
6594
|
|
|
6487
6595
|
// packages/react/src/kpi.tsx
|
|
6488
|
-
var
|
|
6596
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6489
6597
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6490
6598
|
var kpiFormat = (item, value = item.value) => {
|
|
6491
6599
|
var _a, _b;
|
|
@@ -6553,7 +6661,7 @@ function KjunKpiHero(props) {
|
|
|
6553
6661
|
] }) }),
|
|
6554
6662
|
showDelta && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6555
6663
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6556
|
-
/* @__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:
|
|
6664
|
+
/* @__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_tokens40.tokens.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6557
6665
|
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6558
6666
|
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6559
6667
|
"span",
|
|
@@ -6685,7 +6793,7 @@ function KjunKpiRow({
|
|
|
6685
6793
|
},
|
|
6686
6794
|
children: [
|
|
6687
6795
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6688
|
-
/* @__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:
|
|
6796
|
+
/* @__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_tokens40.tokens.extensions.kpiRow.labelSkeletonWidth, height: import_tokens40.tokens.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6689
6797
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6690
6798
|
] }),
|
|
6691
6799
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6743,10 +6851,10 @@ function KjunKpiRow({
|
|
|
6743
6851
|
}
|
|
6744
6852
|
|
|
6745
6853
|
// packages/react/src/market-cards.tsx
|
|
6746
|
-
var
|
|
6854
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6747
6855
|
|
|
6748
6856
|
// shared/package-runtime/market-cards.ts
|
|
6749
|
-
var
|
|
6857
|
+
var import_react49 = require("react");
|
|
6750
6858
|
function useMarketCardsModel(props, persistence) {
|
|
6751
6859
|
const {
|
|
6752
6860
|
columns,
|
|
@@ -6762,8 +6870,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6762
6870
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6763
6871
|
isDefaultSort: c.defaultSort
|
|
6764
6872
|
}));
|
|
6765
|
-
const [key, setKey] = (0,
|
|
6766
|
-
const mounted = (0,
|
|
6873
|
+
const [key, setKey] = (0, import_react49.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6874
|
+
const mounted = (0, import_react49.useRef)("");
|
|
6767
6875
|
const save = (key2) => {
|
|
6768
6876
|
var _a;
|
|
6769
6877
|
try {
|
|
@@ -6771,7 +6879,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6771
6879
|
} catch (e) {
|
|
6772
6880
|
}
|
|
6773
6881
|
};
|
|
6774
|
-
(0,
|
|
6882
|
+
(0, import_react49.useEffect)(() => {
|
|
6775
6883
|
var _a, _b;
|
|
6776
6884
|
if (mounted.current === restoreSignature) return;
|
|
6777
6885
|
mounted.current = restoreSignature;
|
|
@@ -6951,10 +7059,10 @@ function KjunMarketCards(props) {
|
|
|
6951
7059
|
KjunSparkline,
|
|
6952
7060
|
{
|
|
6953
7061
|
data: getValue(row, state.key) || [],
|
|
6954
|
-
width:
|
|
6955
|
-
height:
|
|
7062
|
+
width: import_tokens41.tokens.extensions.marketTable.sparklineWidth,
|
|
7063
|
+
height: import_tokens41.tokens.extensions.marketTable.sparklineHeight
|
|
6956
7064
|
}
|
|
6957
|
-
) : 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:
|
|
7065
|
+
) : 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_tokens41.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens41.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6958
7066
|
KjunSignedValue,
|
|
6959
7067
|
{
|
|
6960
7068
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6962,7 +7070,7 @@ function KjunMarketCards(props) {
|
|
|
6962
7070
|
stale: !!getValue(row, "stale"),
|
|
6963
7071
|
tone: "pill"
|
|
6964
7072
|
}
|
|
6965
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height:
|
|
7073
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens41.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens41.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-metric", children: [
|
|
6966
7074
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6967
7075
|
props,
|
|
6968
7076
|
row,
|
|
@@ -6985,7 +7093,7 @@ function KjunMarketCards(props) {
|
|
|
6985
7093
|
}
|
|
6986
7094
|
|
|
6987
7095
|
// packages/react/src/market-list.tsx
|
|
6988
|
-
var
|
|
7096
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
6989
7097
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6990
7098
|
function KjunMarketSimpleList(props) {
|
|
6991
7099
|
const m = useKjunMessages();
|
|
@@ -7052,7 +7160,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7052
7160
|
fetchedAt
|
|
7053
7161
|
}
|
|
7054
7162
|
)),
|
|
7055
|
-
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height:
|
|
7163
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height: import_tokens42.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens42.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7056
7164
|
KjunSignedValue,
|
|
7057
7165
|
{
|
|
7058
7166
|
value: change,
|
|
@@ -7076,7 +7184,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7076
7184
|
}
|
|
7077
7185
|
|
|
7078
7186
|
// packages/react/src/market-panel.tsx
|
|
7079
|
-
var
|
|
7187
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
7080
7188
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7081
7189
|
function KjunMarketListPanel({
|
|
7082
7190
|
controls,
|
|
@@ -7084,12 +7192,12 @@ function KjunMarketListPanel({
|
|
|
7084
7192
|
}) {
|
|
7085
7193
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(KjunCard, { children: [
|
|
7086
7194
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: controls }),
|
|
7087
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop:
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop: import_tokens43.tokens.dimension.value16, borderTop: `${import_tokens43.tokens.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7088
7196
|
] });
|
|
7089
7197
|
}
|
|
7090
7198
|
|
|
7091
7199
|
// packages/react/src/market-table.tsx
|
|
7092
|
-
var
|
|
7200
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7093
7201
|
|
|
7094
7202
|
// shared/package-runtime/trailing-overflow.ts
|
|
7095
7203
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7106,7 +7214,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7106
7214
|
}
|
|
7107
7215
|
|
|
7108
7216
|
// packages/react/src/market-table.tsx
|
|
7109
|
-
var
|
|
7217
|
+
var import_react50 = require("react");
|
|
7110
7218
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7111
7219
|
function KjunMarketTable(props) {
|
|
7112
7220
|
const m = useKjunMessages();
|
|
@@ -7128,12 +7236,12 @@ function KjunMarketTable(props) {
|
|
|
7128
7236
|
formatMetric,
|
|
7129
7237
|
renderCell
|
|
7130
7238
|
} = props;
|
|
7131
|
-
const scroller = (0,
|
|
7132
|
-
(0,
|
|
7239
|
+
const scroller = (0, import_react50.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react50.useState)(false);
|
|
7240
|
+
(0, import_react50.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7133
7241
|
const render = (row, col) => {
|
|
7134
7242
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7135
7243
|
if (cellLoading(row, col))
|
|
7136
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height:
|
|
7244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens44.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
7137
7245
|
if (renderCell) return renderCell(row, col);
|
|
7138
7246
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7139
7247
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarketIdentity, { row, props });
|
|
@@ -7142,8 +7250,8 @@ function KjunMarketTable(props) {
|
|
|
7142
7250
|
KjunSparkline,
|
|
7143
7251
|
{
|
|
7144
7252
|
data: Array.isArray(value) ? value : [],
|
|
7145
|
-
width:
|
|
7146
|
-
height:
|
|
7253
|
+
width: import_tokens44.tokens.extensions.marketTable.sparklineWidth,
|
|
7254
|
+
height: import_tokens44.tokens.extensions.marketTable.sparklineHeight
|
|
7147
7255
|
}
|
|
7148
7256
|
);
|
|
7149
7257
|
if (col.type === "price")
|
|
@@ -7225,7 +7333,7 @@ function KjunMarketTable(props) {
|
|
|
7225
7333
|
KjunIcon,
|
|
7226
7334
|
{
|
|
7227
7335
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7228
|
-
size:
|
|
7336
|
+
size: import_tokens44.tokens.extensions.marketTable.sortIconSize
|
|
7229
7337
|
}
|
|
7230
7338
|
)
|
|
7231
7339
|
]
|
|
@@ -7285,7 +7393,7 @@ function KjunMarketTable(props) {
|
|
|
7285
7393
|
{
|
|
7286
7394
|
style: {
|
|
7287
7395
|
textAlign: col.align,
|
|
7288
|
-
fontWeight: col.weight === "bold" ?
|
|
7396
|
+
fontWeight: col.weight === "bold" ? import_tokens44.tokens.typography.control.fontWeight : void 0
|
|
7289
7397
|
},
|
|
7290
7398
|
children: [
|
|
7291
7399
|
render(row, col),
|
|
@@ -7318,26 +7426,28 @@ function KjunMarketTable(props) {
|
|
|
7318
7426
|
}
|
|
7319
7427
|
|
|
7320
7428
|
// packages/react/src/list.tsx
|
|
7321
|
-
var
|
|
7429
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7430
|
+
var import_react51 = require("react");
|
|
7322
7431
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7323
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
7432
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick }) {
|
|
7324
7433
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
7325
7434
|
leading && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-leading", children: leading }),
|
|
7326
7435
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-list-body", children: [
|
|
7327
7436
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
7328
7437
|
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-description", children: description })
|
|
7329
7438
|
] }),
|
|
7330
|
-
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing })
|
|
7439
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7440
|
+
chevron && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: import_tokens45.tokens.iconSizes.default })
|
|
7331
7441
|
] });
|
|
7332
7442
|
const main = href ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "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", disabled, onClick, children: contents }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-main", children: contents });
|
|
7333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", children: [
|
|
7443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7334
7444
|
main,
|
|
7335
7445
|
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7336
7446
|
] });
|
|
7337
7447
|
}
|
|
7338
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
7339
|
-
const id = "kjun-" + (0,
|
|
7340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7448
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7449
|
+
const id = "kjun-" + (0, import_react51.useId)();
|
|
7450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "kjun-list-section", "data-surface": surface ? void 0 : "false", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7341
7451
|
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
7342
7452
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
7343
7453
|
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { id, children: title }),
|
|
@@ -7348,12 +7458,15 @@ function KjunListSection({ title, description, actions, children, ariaLabel, div
|
|
|
7348
7458
|
/* @__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 })
|
|
7349
7459
|
] });
|
|
7350
7460
|
}
|
|
7461
|
+
function KjunListItem({ children }) {
|
|
7462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { className: "kjun-list-item", children });
|
|
7463
|
+
}
|
|
7351
7464
|
|
|
7352
7465
|
// packages/react/src/app-navigation.tsx
|
|
7353
|
-
var
|
|
7466
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7354
7467
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7355
7468
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value:
|
|
7469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value: import_tokens46.tokens.extensions.topNavigation, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("header", { className: "kjun-top-navigation", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-content", children: [
|
|
7357
7470
|
leading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7358
7471
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
7359
7472
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: title }),
|
|
@@ -7374,7 +7487,7 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7374
7487
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7375
7488
|
}, children: [
|
|
7376
7489
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
7377
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size:
|
|
7490
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size: import_tokens46.tokens.extensions.bottomNavigation.iconSize }),
|
|
7378
7491
|
badge
|
|
7379
7492
|
] }),
|
|
7380
7493
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7386,21 +7499,21 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7386
7499
|
}
|
|
7387
7500
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7388
7501
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom: import_tokens46.tokens.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-bottom-action-content", children: [
|
|
7390
7503
|
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { children: description }),
|
|
7391
7504
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
7392
7505
|
] }) });
|
|
7393
7506
|
}
|
|
7394
7507
|
|
|
7395
7508
|
// packages/react/src/media.tsx
|
|
7396
|
-
var
|
|
7397
|
-
var
|
|
7509
|
+
var import_react52 = require("react");
|
|
7510
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7398
7511
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7399
7512
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7400
|
-
const current = (0,
|
|
7513
|
+
const current = (0, import_react52.useRef)({ src, version: 0 });
|
|
7401
7514
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7402
7515
|
const version = current.current.version;
|
|
7403
|
-
const [result, setResult] = (0,
|
|
7516
|
+
const [result, setResult] = (0, import_react52.useState)({ version, state: "loading" });
|
|
7404
7517
|
const state = result.version === version ? result.state : "loading";
|
|
7405
7518
|
const failed = !src || state === "error";
|
|
7406
7519
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -7413,28 +7526,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7413
7526
|
setResult({ version, state: "error" });
|
|
7414
7527
|
onError == null ? void 0 : onError();
|
|
7415
7528
|
} }, version),
|
|
7416
|
-
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:
|
|
7529
|
+
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_tokens47.tokens.extensions.image.fallbackIconSize }) })
|
|
7417
7530
|
] });
|
|
7418
7531
|
}
|
|
7419
|
-
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
7532
|
+
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7420
7533
|
const m = useKjunMessages();
|
|
7421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: import_tokens47.tokens.extensions.avatar[size], height: import_tokens47.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_tokens47.tokens.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7422
7535
|
}
|
|
7423
7536
|
|
|
7424
7537
|
// packages/react/src/chip.tsx
|
|
7425
|
-
var
|
|
7538
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7426
7539
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7427
7540
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7428
7541
|
const m = useKjunMessages();
|
|
7429
7542
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7430
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size:
|
|
7543
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size: import_tokens48.tokens.extensions.chip.iconSizes[size] }),
|
|
7431
7544
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: label }),
|
|
7432
|
-
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:
|
|
7545
|
+
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_tokens48.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
7433
7546
|
] });
|
|
7434
7547
|
}
|
|
7435
7548
|
|
|
7436
7549
|
// packages/react/src/fab.tsx
|
|
7437
|
-
var
|
|
7550
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
7438
7551
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7439
7552
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7440
7553
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
@@ -7445,27 +7558,27 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7445
7558
|
"aria-label": ariaLabel,
|
|
7446
7559
|
disabled,
|
|
7447
7560
|
onClick,
|
|
7448
|
-
style: { bottom:
|
|
7449
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size:
|
|
7561
|
+
style: { bottom: import_tokens49.tokens.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size: import_tokens49.tokens.extensions.fab.iconSize })
|
|
7450
7563
|
}
|
|
7451
7564
|
);
|
|
7452
7565
|
}
|
|
7453
7566
|
|
|
7454
7567
|
// packages/react/src/range-input.tsx
|
|
7455
|
-
var
|
|
7568
|
+
var import_react53 = require("react");
|
|
7456
7569
|
var import_react_aria_components10 = require("react-aria-components");
|
|
7457
|
-
var
|
|
7570
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
7458
7571
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7459
7572
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
7460
7573
|
const m = useKjunMessages();
|
|
7461
7574
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7462
|
-
const domain = (0,
|
|
7575
|
+
const domain = (0, import_tokens50.createSliderDomain)(min, max, step);
|
|
7463
7576
|
const list = Array.isArray(value) ? value : [value];
|
|
7464
7577
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7465
|
-
const latest = (0,
|
|
7578
|
+
const latest = (0, import_react53.useRef)(value);
|
|
7466
7579
|
latest.current = value;
|
|
7467
|
-
const active = (0,
|
|
7468
|
-
(0,
|
|
7580
|
+
const active = (0, import_react53.useRef)(false);
|
|
7581
|
+
(0, import_react53.useEffect)(() => {
|
|
7469
7582
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7470
7583
|
}, [valid]);
|
|
7471
7584
|
const change = (next) => {
|
|
@@ -7502,24 +7615,24 @@ function KjunRangeSlider(props) {
|
|
|
7502
7615
|
}
|
|
7503
7616
|
|
|
7504
7617
|
// packages/react/src/quantity-stepper.tsx
|
|
7505
|
-
var
|
|
7506
|
-
var
|
|
7618
|
+
var import_react54 = require("react");
|
|
7619
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
7507
7620
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7508
7621
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7509
7622
|
const m = useKjunMessages();
|
|
7510
|
-
const geometry =
|
|
7511
|
-
const buttonStyle = { width:
|
|
7512
|
-
const domain = (0,
|
|
7623
|
+
const geometry = import_tokens51.tokens.extensions.compound;
|
|
7624
|
+
const buttonStyle = { width: import_tokens51.tokens.input[size].height, padding: 0 };
|
|
7625
|
+
const domain = (0, import_tokens51.createNumberDomain)({ min, max, step, precision });
|
|
7513
7626
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7514
|
-
const [draft, setDraft] = (0,
|
|
7627
|
+
const [draft, setDraft] = (0, import_react54.useState)(String(value));
|
|
7515
7628
|
const field = useKjunField();
|
|
7516
|
-
const composing = (0,
|
|
7517
|
-
(0,
|
|
7629
|
+
const composing = (0, import_react54.useRef)(false), dirty = (0, import_react54.useRef)(false), accepted = (0, import_react54.useRef)(value);
|
|
7630
|
+
(0, import_react54.useEffect)(() => {
|
|
7518
7631
|
setDraft(String(value));
|
|
7519
7632
|
accepted.current = value;
|
|
7520
7633
|
dirty.current = false;
|
|
7521
7634
|
}, [value, precision, min, max, step]);
|
|
7522
|
-
(0,
|
|
7635
|
+
(0, import_react54.useEffect)(() => {
|
|
7523
7636
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7524
7637
|
}, [valid]);
|
|
7525
7638
|
const emit = (next) => {
|
|
@@ -7543,7 +7656,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7543
7656
|
};
|
|
7544
7657
|
const key = (event) => {
|
|
7545
7658
|
if (blocked) return;
|
|
7546
|
-
const action = (0,
|
|
7659
|
+
const action = (0, import_tokens51.quantityKeyAction)(event, composing.current, dirty.current);
|
|
7547
7660
|
if (!action) return;
|
|
7548
7661
|
event.preventDefault();
|
|
7549
7662
|
if (action === "cancel") {
|
|
@@ -7594,18 +7707,18 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7594
7707
|
}
|
|
7595
7708
|
|
|
7596
7709
|
// packages/react/src/time-picker.tsx
|
|
7597
|
-
var
|
|
7598
|
-
var
|
|
7710
|
+
var import_react55 = require("react");
|
|
7711
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
7599
7712
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7600
7713
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7601
7714
|
const m = useKjunMessages();
|
|
7602
7715
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7603
|
-
const root = (0,
|
|
7604
|
-
const field = useKjunField(), uid = (0,
|
|
7716
|
+
const root = (0, import_react55.useRef)(null);
|
|
7717
|
+
const field = useKjunField(), uid = (0, import_react55.useId)();
|
|
7605
7718
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7606
|
-
const domain = (0,
|
|
7719
|
+
const domain = (0, import_react55.useMemo)(() => (0, import_tokens52.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7607
7720
|
const valid = domain.valid && domain.accepts(value);
|
|
7608
|
-
(0,
|
|
7721
|
+
(0, import_react55.useEffect)(() => {
|
|
7609
7722
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7610
7723
|
}, [valid]);
|
|
7611
7724
|
const change = (next) => {
|
|
@@ -7619,7 +7732,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7619
7732
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "kjun-time-segments", children: [m.hour, m.minute, m.second].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
7620
7733
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7621
7734
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
7735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react55.Fragment, { children: [
|
|
7623
7736
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7624
7737
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "kjun-time-segment", children: [
|
|
7625
7738
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|