@kjun-ui/react 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +440 -392
- package/dist/index.js +554 -505
- package/dist/styles.css +74 -30
- package/dist/types/packages/react/src/app-navigation.d.cts +9 -3
- package/dist/types/packages/react/src/app-navigation.d.ts +9 -3
- package/dist/types/packages/react/src/controls.d.cts +3 -1
- package/dist/types/packages/react/src/controls.d.ts +3 -1
- package/dist/types/packages/react/src/display.d.cts +5 -2
- package/dist/types/packages/react/src/display.d.ts +5 -2
- package/dist/types/packages/react/src/kpi.d.cts +6 -2
- package/dist/types/packages/react/src/kpi.d.ts +6 -2
- package/dist/types/packages/react/src/list.d.cts +3 -1
- package/dist/types/packages/react/src/list.d.ts +3 -1
- package/dist/types/packages/react/src/media.d.cts +1 -1
- package/dist/types/packages/react/src/media.d.ts +1 -1
- package/dist/types/packages/react/src/navigation.d.cts +5 -1
- package/dist/types/packages/react/src/navigation.d.ts +5 -1
- package/dist/types/packages/react/src/range-input.d.cts +4 -0
- package/dist/types/packages/react/src/range-input.d.ts +4 -0
- package/dist/types/shared/package-runtime/alert-exit.d.cts +5 -0
- package/dist/types/shared/package-runtime/alert-exit.d.ts +5 -0
- package/dist/types/shared/package-runtime/alert-tone.d.cts +11 -0
- package/dist/types/shared/package-runtime/alert-tone.d.ts +11 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +10 -4
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +10 -4
- package/dist/types/shared/package-runtime/progress-circle.d.cts +5 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1598,13 +1598,45 @@ function alertRole(tone, live) {
|
|
|
1598
1598
|
return tone === "danger" ? "alert" : "status";
|
|
1599
1599
|
}
|
|
1600
1600
|
|
|
1601
|
+
// shared/package-runtime/alert-tone.ts
|
|
1602
|
+
function alertToneRoles(tone) {
|
|
1603
|
+
if (tone === "primary") return { bg: "brand-subtle-bg", icon: "brand" };
|
|
1604
|
+
if (tone === "info") return { bg: null, icon: "text" };
|
|
1605
|
+
return { bg: tone + "-bg", icon: tone + "-accent" };
|
|
1606
|
+
}
|
|
1607
|
+
var alertIcons = {
|
|
1608
|
+
info: "info-circle",
|
|
1609
|
+
primary: "info-circle",
|
|
1610
|
+
success: "circle-check",
|
|
1611
|
+
warning: "alert-triangle",
|
|
1612
|
+
danger: "alert-circle"
|
|
1613
|
+
};
|
|
1614
|
+
|
|
1615
|
+
// shared/package-runtime/alert-exit.ts
|
|
1616
|
+
import { tokens as tokens7 } from "@kjun-ui/tokens";
|
|
1617
|
+
function collapseAlert(el, reduced, done) {
|
|
1618
|
+
if (reduced || !el || typeof el.animate !== "function") {
|
|
1619
|
+
done();
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
const style = getComputedStyle(el);
|
|
1623
|
+
el.inert = true;
|
|
1624
|
+
el.style.overflow = "hidden";
|
|
1625
|
+
el.style.boxSizing = "border-box";
|
|
1626
|
+
const exit = el.animate([
|
|
1627
|
+
{ height: el.getBoundingClientRect().height + "px", paddingTop: style.paddingTop, paddingBottom: style.paddingBottom, opacity: 1 },
|
|
1628
|
+
{ height: "0px", paddingTop: "0px", paddingBottom: "0px", opacity: 0 }
|
|
1629
|
+
], { duration: tokens7.motion.collapse, easing: tokens7.motion.easeOut, fill: "forwards" });
|
|
1630
|
+
exit.onfinish = done;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1601
1633
|
// packages/react/src/display.tsx
|
|
1602
|
-
import { tokens as
|
|
1634
|
+
import { tokens as tokens9 } from "@kjun-ui/tokens";
|
|
1603
1635
|
|
|
1604
1636
|
// shared/package-runtime/progress-circle.ts
|
|
1605
|
-
import { tokens as
|
|
1637
|
+
import { tokens as tokens8 } from "@kjun-ui/tokens";
|
|
1606
1638
|
function progressCircle(size, percentage) {
|
|
1607
|
-
const { size: diameter, stroke } =
|
|
1639
|
+
const { size: diameter, stroke } = tokens8.extensions.progress.circle[size];
|
|
1608
1640
|
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1609
1641
|
return {
|
|
1610
1642
|
diameter,
|
|
@@ -1617,9 +1649,14 @@ function progressCircle(size, percentage) {
|
|
|
1617
1649
|
showsPercentage: size !== "sm"
|
|
1618
1650
|
};
|
|
1619
1651
|
}
|
|
1652
|
+
function progressState(value, max, indeterminate) {
|
|
1653
|
+
if (indeterminate) return "indeterminate";
|
|
1654
|
+
return value === null || !Number.isFinite(value) || !Number.isFinite(max) || max <= 0 ? "missing" : "determinate";
|
|
1655
|
+
}
|
|
1620
1656
|
|
|
1621
1657
|
// packages/react/src/display.tsx
|
|
1622
1658
|
import {
|
|
1659
|
+
useRef as useRef9,
|
|
1623
1660
|
useState as useState6
|
|
1624
1661
|
} from "react";
|
|
1625
1662
|
|
|
@@ -1733,7 +1770,7 @@ function KjunBadge({
|
|
|
1733
1770
|
style,
|
|
1734
1771
|
...props
|
|
1735
1772
|
}) {
|
|
1736
|
-
const { x, y } =
|
|
1773
|
+
const { x, y } = tokens9.extensions.badge.padding[size];
|
|
1737
1774
|
const neutral = variant === "default" || variant === "secondary";
|
|
1738
1775
|
return /* @__PURE__ */ jsxs6(
|
|
1739
1776
|
"span",
|
|
@@ -1768,7 +1805,7 @@ function KjunEmpty({
|
|
|
1768
1805
|
const m = useKjunMessages();
|
|
1769
1806
|
text != null ? text : text = m.noData;
|
|
1770
1807
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-empty", children: [
|
|
1771
|
-
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size:
|
|
1808
|
+
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size: tokens9.extensions.empty.iconSize }),
|
|
1772
1809
|
/* @__PURE__ */ jsx9("p", { children: text }),
|
|
1773
1810
|
description && /* @__PURE__ */ jsx9("small", { children: description }),
|
|
1774
1811
|
children && /* @__PURE__ */ jsx9("div", { children })
|
|
@@ -1776,14 +1813,14 @@ function KjunEmpty({
|
|
|
1776
1813
|
}
|
|
1777
1814
|
function KjunSpinner({ size = "md", text }) {
|
|
1778
1815
|
const m = useKjunMessages();
|
|
1779
|
-
const stroke =
|
|
1816
|
+
const stroke = tokens9.extensions.spinner.strokeWidths[size] * 24 / tokens9.extensions.spinner.sizes[size];
|
|
1780
1817
|
return /* @__PURE__ */ jsxs6("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1781
1818
|
/* @__PURE__ */ jsxs6(
|
|
1782
1819
|
"svg",
|
|
1783
1820
|
{
|
|
1784
1821
|
className: "kjun-spin",
|
|
1785
|
-
width:
|
|
1786
|
-
height:
|
|
1822
|
+
width: tokens9.extensions.spinner.sizes[size],
|
|
1823
|
+
height: tokens9.extensions.spinner.sizes[size],
|
|
1787
1824
|
viewBox: "0 0 24 24",
|
|
1788
1825
|
fill: "none",
|
|
1789
1826
|
"aria-hidden": "true",
|
|
@@ -1826,32 +1863,21 @@ function KjunAlert({
|
|
|
1826
1863
|
}) {
|
|
1827
1864
|
const m = useKjunMessages();
|
|
1828
1865
|
const [visible, setVisible] = useState6(true);
|
|
1866
|
+
const root = useRef9(null), closing = useRef9(false);
|
|
1867
|
+
const reduced = useReducedMotion();
|
|
1829
1868
|
if (!visible) return null;
|
|
1830
|
-
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
1869
|
+
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm", paint = alertToneRoles(tone);
|
|
1831
1870
|
return /* @__PURE__ */ jsxs6(
|
|
1832
1871
|
"div",
|
|
1833
1872
|
{
|
|
1873
|
+
ref: root,
|
|
1834
1874
|
role: alertRole(tone, live),
|
|
1835
1875
|
className: "kjun-alert",
|
|
1836
1876
|
"data-size": small ? "sm" : "md",
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
borderColor: role(tone === "primary" ? "brand-light" : tone + "-light")
|
|
1840
|
-
},
|
|
1877
|
+
"data-tone": tone,
|
|
1878
|
+
style: paint.bg ? { background: role(paint.bg) } : void 0,
|
|
1841
1879
|
children: [
|
|
1842
|
-
/* @__PURE__ */ jsx9("span", { className: "kjun-alert-icon", style: { color: role(tone
|
|
1843
|
-
KjunIcon,
|
|
1844
|
-
{
|
|
1845
|
-
name: {
|
|
1846
|
-
info: "info-circle",
|
|
1847
|
-
primary: "info-circle",
|
|
1848
|
-
success: "circle-check",
|
|
1849
|
-
warning: "alert-triangle",
|
|
1850
|
-
danger: "alert-circle"
|
|
1851
|
-
}[tone],
|
|
1852
|
-
size: tokens8.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1853
|
-
}
|
|
1854
|
-
) }),
|
|
1880
|
+
/* @__PURE__ */ jsx9("span", { className: "kjun-alert-icon", style: { color: role(paint.icon) }, children: /* @__PURE__ */ jsx9(KjunIcon, { name: alertIcons[tone], filled: true, size: tokens9.extensions.alert.iconSizes[small ? "sm" : "md"] }) }),
|
|
1855
1881
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-alert-content", children: [
|
|
1856
1882
|
hasContent(title) && /* @__PURE__ */ jsx9("div", { className: "kjun-alert-title", children: title }),
|
|
1857
1883
|
hasContent(children) && /* @__PURE__ */ jsx9("div", { className: "kjun-alert-description", children }),
|
|
@@ -1864,10 +1890,14 @@ function KjunAlert({
|
|
|
1864
1890
|
type: "button",
|
|
1865
1891
|
"aria-label": m.close,
|
|
1866
1892
|
onClick: () => {
|
|
1867
|
-
|
|
1868
|
-
|
|
1893
|
+
if (closing.current) return;
|
|
1894
|
+
closing.current = true;
|
|
1895
|
+
collapseAlert(root.current, reduced, () => {
|
|
1896
|
+
setVisible(false);
|
|
1897
|
+
onClose == null ? void 0 : onClose();
|
|
1898
|
+
});
|
|
1869
1899
|
},
|
|
1870
|
-
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size:
|
|
1900
|
+
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size: tokens9.extensions.alert.closeIconSize })
|
|
1871
1901
|
}
|
|
1872
1902
|
)
|
|
1873
1903
|
]
|
|
@@ -1876,6 +1906,7 @@ function KjunAlert({
|
|
|
1876
1906
|
}
|
|
1877
1907
|
function KjunProgress({
|
|
1878
1908
|
value = 0,
|
|
1909
|
+
indeterminate = false,
|
|
1879
1910
|
max = 100,
|
|
1880
1911
|
size = "md",
|
|
1881
1912
|
variant = "primary",
|
|
@@ -1885,80 +1916,53 @@ function KjunProgress({
|
|
|
1885
1916
|
shape = "bar"
|
|
1886
1917
|
}) {
|
|
1887
1918
|
const m = useKjunMessages();
|
|
1888
|
-
const
|
|
1919
|
+
const state = progressState(value, max, indeterminate);
|
|
1920
|
+
const percentage = state === "determinate" ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1921
|
+
const text = state === "indeterminate" ? m.loadingEllipsis : state === "missing" ? "\u2014" : `${percentage}%`;
|
|
1889
1922
|
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
1923
|
+
const accessibility = {
|
|
1924
|
+
role: state === "missing" ? "img" : "progressbar",
|
|
1925
|
+
"aria-label": state === "missing" ? `${name}: ${m.noData}` : name,
|
|
1926
|
+
"aria-valuemin": state === "missing" ? void 0 : 0,
|
|
1927
|
+
"aria-valuemax": state === "missing" ? void 0 : 100,
|
|
1928
|
+
"aria-valuenow": state === "determinate" ? percentage : void 0,
|
|
1929
|
+
"aria-valuetext": state === "indeterminate" ? m.loadingEllipsis : void 0,
|
|
1930
|
+
"aria-busy": state === "indeterminate" || void 0
|
|
1931
|
+
};
|
|
1890
1932
|
if (shape === "circle") {
|
|
1891
|
-
const c = progressCircle(size, percentage);
|
|
1892
|
-
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1893
|
-
/* @__PURE__ */ jsxs6(
|
|
1894
|
-
"
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
stroke: color,
|
|
1915
|
-
strokeLinecap: "round",
|
|
1916
|
-
strokeDasharray: c.circumference,
|
|
1917
|
-
strokeDashoffset: c.offset,
|
|
1918
|
-
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
1919
|
-
}
|
|
1920
|
-
)
|
|
1921
|
-
] }),
|
|
1922
|
-
showLabel && c.showsPercentage && /* @__PURE__ */ jsxs6("span", { className: "kjun-progress-circle-percent", children: [
|
|
1923
|
-
percentage,
|
|
1924
|
-
"%"
|
|
1925
|
-
] })
|
|
1926
|
-
]
|
|
1927
|
-
}
|
|
1928
|
-
),
|
|
1933
|
+
const c = progressCircle(size, state === "indeterminate" ? 25 : percentage);
|
|
1934
|
+
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, "data-state": state, children: [
|
|
1935
|
+
/* @__PURE__ */ jsxs6("div", { ...accessibility, className: "kjun-progress-circle", style: { width: c.diameter, height: c.diameter }, children: [
|
|
1936
|
+
/* @__PURE__ */ jsxs6("svg", { className: state === "indeterminate" ? "kjun-spin" : void 0, width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
1937
|
+
/* @__PURE__ */ jsx9("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
1938
|
+
(percentage > 0 || state === "indeterminate") && /* @__PURE__ */ jsx9(
|
|
1939
|
+
"circle",
|
|
1940
|
+
{
|
|
1941
|
+
className: "kjun-progress-circle-value",
|
|
1942
|
+
cx: c.centre,
|
|
1943
|
+
cy: c.centre,
|
|
1944
|
+
r: c.radius,
|
|
1945
|
+
strokeWidth: c.stroke,
|
|
1946
|
+
stroke: color,
|
|
1947
|
+
strokeLinecap: "round",
|
|
1948
|
+
strokeDasharray: c.circumference,
|
|
1949
|
+
strokeDashoffset: c.offset,
|
|
1950
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
1951
|
+
}
|
|
1952
|
+
)
|
|
1953
|
+
] }),
|
|
1954
|
+
showLabel && c.showsPercentage && state !== "indeterminate" && /* @__PURE__ */ jsx9("span", { className: "kjun-progress-circle-percent", children: text })
|
|
1955
|
+
] }),
|
|
1929
1956
|
label && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-circle-label", children: label }),
|
|
1930
1957
|
subLabel && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1931
1958
|
] });
|
|
1932
1959
|
}
|
|
1933
|
-
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", children: [
|
|
1960
|
+
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", "data-state": state, children: [
|
|
1934
1961
|
(label || showLabel) && /* @__PURE__ */ jsxs6("div", { className: "kjun-progress-label", children: [
|
|
1935
1962
|
label && /* @__PURE__ */ jsx9("span", { children: label }),
|
|
1936
|
-
showLabel && /* @__PURE__ */
|
|
1937
|
-
percentage,
|
|
1938
|
-
"%"
|
|
1939
|
-
] })
|
|
1963
|
+
showLabel && /* @__PURE__ */ jsx9("span", { children: text })
|
|
1940
1964
|
] }),
|
|
1941
|
-
/* @__PURE__ */ jsx9(
|
|
1942
|
-
"div",
|
|
1943
|
-
{
|
|
1944
|
-
role: "progressbar",
|
|
1945
|
-
"aria-label": name,
|
|
1946
|
-
"aria-valuemin": 0,
|
|
1947
|
-
"aria-valuemax": 100,
|
|
1948
|
-
"aria-valuenow": percentage,
|
|
1949
|
-
className: "kjun-progress-track",
|
|
1950
|
-
style: { height: tokens8.extensions.progress.heights[size] },
|
|
1951
|
-
children: /* @__PURE__ */ jsx9(
|
|
1952
|
-
"div",
|
|
1953
|
-
{
|
|
1954
|
-
style: {
|
|
1955
|
-
width: percentage + "%",
|
|
1956
|
-
background: color
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
)
|
|
1960
|
-
}
|
|
1961
|
-
),
|
|
1965
|
+
/* @__PURE__ */ jsx9("div", { ...accessibility, className: "kjun-progress-track", style: { height: tokens9.extensions.progress.heights[size] }, children: /* @__PURE__ */ jsx9("div", { style: { width: (state === "indeterminate" ? 30 : percentage) + "%", background: color } }) }),
|
|
1962
1966
|
subLabel && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1963
1967
|
] });
|
|
1964
1968
|
}
|
|
@@ -1984,9 +1988,9 @@ function KjunSkeleton({
|
|
|
1984
1988
|
{
|
|
1985
1989
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
1986
1990
|
style: sm ? void 0 : {
|
|
1987
|
-
width: width ||
|
|
1988
|
-
height: height ||
|
|
1989
|
-
borderRadius: rounded ? "50%" :
|
|
1991
|
+
width: width || tokens9.extensions.skeleton.avatarSize,
|
|
1992
|
+
height: height || tokens9.extensions.skeleton.avatarSize,
|
|
1993
|
+
borderRadius: rounded ? "50%" : tokens9.radius.radius8
|
|
1990
1994
|
}
|
|
1991
1995
|
}
|
|
1992
1996
|
);
|
|
@@ -2010,7 +2014,7 @@ function KjunSkeleton({
|
|
|
2010
2014
|
avatar(true),
|
|
2011
2015
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
2012
2016
|
line("60%"),
|
|
2013
|
-
line("40%", void 0,
|
|
2017
|
+
line("40%", void 0, tokens9.extensions.skeleton.lineHeights.sm)
|
|
2014
2018
|
] })
|
|
2015
2019
|
] }),
|
|
2016
2020
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -2033,9 +2037,9 @@ function KjunSkeleton({
|
|
|
2033
2037
|
)) }),
|
|
2034
2038
|
type === "stat" && /* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat", children: [
|
|
2035
2039
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat-content", children: [
|
|
2036
|
-
line("40%", 0,
|
|
2037
|
-
line("60%", 1,
|
|
2038
|
-
line("30%", 2,
|
|
2040
|
+
line("40%", 0, tokens9.extensions.skeleton.lineHeights.sm),
|
|
2041
|
+
line("60%", 1, tokens9.extensions.skeleton.lineHeights.lg),
|
|
2042
|
+
line("30%", 2, tokens9.extensions.skeleton.lineHeights.sm)
|
|
2039
2043
|
] }),
|
|
2040
2044
|
/* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-sparkline" }) })
|
|
2041
2045
|
] }),
|
|
@@ -2043,7 +2047,7 @@ function KjunSkeleton({
|
|
|
2043
2047
|
"div",
|
|
2044
2048
|
{
|
|
2045
2049
|
className: "kjun-skeleton-block",
|
|
2046
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2050
|
+
style: { width: width || "100%", height: height != null ? height : tokens9.extensions.skeleton.blockHeight }
|
|
2047
2051
|
}
|
|
2048
2052
|
)
|
|
2049
2053
|
]
|
|
@@ -2103,13 +2107,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
2103
2107
|
}
|
|
2104
2108
|
|
|
2105
2109
|
// shared/package-runtime/feedback-dialog.ts
|
|
2106
|
-
import { useRef as
|
|
2110
|
+
import { useRef as useRef10, useState as useState7 } from "react";
|
|
2107
2111
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
2108
2112
|
const options = request.options;
|
|
2109
2113
|
const [value, setValue] = useState7(options.initialValue || "");
|
|
2110
2114
|
const [error, setError] = useState7("");
|
|
2111
2115
|
const [busy, setBusy] = useState7(false);
|
|
2112
|
-
const working =
|
|
2116
|
+
const working = useRef10(false);
|
|
2113
2117
|
const active = () => {
|
|
2114
2118
|
var _a;
|
|
2115
2119
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -2151,11 +2155,11 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2151
2155
|
}
|
|
2152
2156
|
|
|
2153
2157
|
// shared/package-runtime/feedback-motion.ts
|
|
2154
|
-
import { tokens as
|
|
2155
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
2158
|
+
import { tokens as tokens10 } from "@kjun-ui/tokens";
|
|
2159
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef11, useState as useState8 } from "react";
|
|
2156
2160
|
function usePresentedToasts(toasts, reduced) {
|
|
2157
2161
|
const [items, setItems] = useState8([]);
|
|
2158
|
-
const removals =
|
|
2162
|
+
const removals = useRef11(/* @__PURE__ */ new Map());
|
|
2159
2163
|
useLayoutEffect7(() => {
|
|
2160
2164
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
2161
2165
|
setItems((previous) => {
|
|
@@ -2169,7 +2173,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2169
2173
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2170
2174
|
removals.current.delete(item.toast.id);
|
|
2171
2175
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2172
|
-
},
|
|
2176
|
+
}, tokens10.motion.toastExit));
|
|
2173
2177
|
}
|
|
2174
2178
|
return next;
|
|
2175
2179
|
});
|
|
@@ -2191,7 +2195,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
2191
2195
|
setRequest(current);
|
|
2192
2196
|
return;
|
|
2193
2197
|
}
|
|
2194
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2198
|
+
const timer = setTimeout(() => setRequest(current), tokens10.motion.layerExit);
|
|
2195
2199
|
return () => clearTimeout(timer);
|
|
2196
2200
|
}, [current, request, reduced]);
|
|
2197
2201
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -2205,11 +2209,11 @@ function useOptionalKjunFeedback() {
|
|
|
2205
2209
|
}
|
|
2206
2210
|
|
|
2207
2211
|
// packages/react/src/toast-stack.tsx
|
|
2208
|
-
import { tokens as
|
|
2209
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
2212
|
+
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2213
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef13 } from "react";
|
|
2210
2214
|
|
|
2211
2215
|
// shared/package-runtime/toast-layout.ts
|
|
2212
|
-
import { tokens as
|
|
2216
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
2213
2217
|
function createToastLayout() {
|
|
2214
2218
|
let root = null;
|
|
2215
2219
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2252,7 +2256,7 @@ function createToastLayout() {
|
|
|
2252
2256
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2253
2257
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2254
2258
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
2255
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
2259
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: tokens11.motion.toastMove, easing: tokens11.motion.easeOut });
|
|
2256
2260
|
animations.set(node, animation);
|
|
2257
2261
|
}
|
|
2258
2262
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2268,15 +2272,15 @@ function createToastLayout() {
|
|
|
2268
2272
|
}
|
|
2269
2273
|
|
|
2270
2274
|
// packages/react/src/toast.tsx
|
|
2271
|
-
import { useEffect as useEffect5, useRef as
|
|
2275
|
+
import { useEffect as useEffect5, useRef as useRef12 } from "react";
|
|
2272
2276
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2273
2277
|
function ToastView({
|
|
2274
2278
|
toast,
|
|
2275
2279
|
controller
|
|
2276
2280
|
}) {
|
|
2277
2281
|
const m = useKjunMessages();
|
|
2278
|
-
const previous =
|
|
2279
|
-
const reasons =
|
|
2282
|
+
const previous = useRef12(null);
|
|
2283
|
+
const reasons = useRef12({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
2280
2284
|
useEffect5(() => {
|
|
2281
2285
|
previous.current = document.activeElement;
|
|
2282
2286
|
return () => {
|
|
@@ -2372,9 +2376,9 @@ function ToastView({
|
|
|
2372
2376
|
// packages/react/src/toast-stack.tsx
|
|
2373
2377
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2374
2378
|
function ToastSurface({ item, controller }) {
|
|
2375
|
-
const ref =
|
|
2376
|
-
const current =
|
|
2377
|
-
const entryFinished =
|
|
2379
|
+
const ref = useRef13(null), reduced = useReducedMotion();
|
|
2380
|
+
const current = useRef13(null);
|
|
2381
|
+
const entryFinished = useRef13(false);
|
|
2378
2382
|
useLayoutEffect8(() => {
|
|
2379
2383
|
var _a, _b;
|
|
2380
2384
|
const el = ref.current;
|
|
@@ -2384,15 +2388,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2384
2388
|
return;
|
|
2385
2389
|
}
|
|
2386
2390
|
const elapsed = Date.now() - item.born;
|
|
2387
|
-
if (!item.exiting && (elapsed >=
|
|
2388
|
-
const hidden = `translateY(${-
|
|
2391
|
+
if (!item.exiting && (elapsed >= tokens12.motion.toastEnter || entryFinished.current)) return;
|
|
2392
|
+
const hidden = `translateY(${-tokens12.motionDistance.toast}px)`, from = current.current;
|
|
2389
2393
|
const animations = item.exiting ? [
|
|
2390
|
-
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration:
|
|
2391
|
-
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration:
|
|
2394
|
+
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration: tokens12.motion.fadeExit, easing: tokens12.motion.easeLinear, fill: "both" }),
|
|
2395
|
+
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration: tokens12.motion.toastExit, easing: tokens12.motion.easeIn, fill: "both" })
|
|
2392
2396
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2393
|
-
duration:
|
|
2397
|
+
duration: tokens12.motion.toastEnter,
|
|
2394
2398
|
delay: -elapsed,
|
|
2395
|
-
easing:
|
|
2399
|
+
easing: tokens12.motion.easeOut,
|
|
2396
2400
|
fill: "both"
|
|
2397
2401
|
})];
|
|
2398
2402
|
animations[0].onfinish = () => {
|
|
@@ -2409,7 +2413,7 @@ function ToastSurface({ item, controller }) {
|
|
|
2409
2413
|
function ToastStack({ items, controller }) {
|
|
2410
2414
|
var _a;
|
|
2411
2415
|
const layers = useLayerState();
|
|
2412
|
-
const root =
|
|
2416
|
+
const root = useRef13(null), layout = useRef13(createToastLayout());
|
|
2413
2417
|
const reduced = useReducedMotion();
|
|
2414
2418
|
useLayoutEffect8(() => {
|
|
2415
2419
|
if (root.current) layout.current.update(root.current, reduced);
|
|
@@ -2435,7 +2439,7 @@ import {
|
|
|
2435
2439
|
import {
|
|
2436
2440
|
useCallback as useCallback2,
|
|
2437
2441
|
useEffect as useEffect6,
|
|
2438
|
-
useRef as
|
|
2442
|
+
useRef as useRef14,
|
|
2439
2443
|
useState as useState9,
|
|
2440
2444
|
useSyncExternalStore as useSyncExternalStore3
|
|
2441
2445
|
} from "react";
|
|
@@ -2493,7 +2497,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
|
2493
2497
|
const [owned] = useState9(() => controllerProp ? void 0 : createFeedbackController());
|
|
2494
2498
|
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
2495
2499
|
useEffect6(() => controller.attach(), [controller]);
|
|
2496
|
-
const life =
|
|
2500
|
+
const life = useRef14(0);
|
|
2497
2501
|
const snapshot = useSyncExternalStore3(
|
|
2498
2502
|
controller.subscribe,
|
|
2499
2503
|
controller.getSnapshot,
|
|
@@ -2539,7 +2543,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
|
2539
2543
|
}
|
|
2540
2544
|
|
|
2541
2545
|
// packages/react/src/controls.tsx
|
|
2542
|
-
import { tokens as
|
|
2546
|
+
import { tokens as tokens14 } from "@kjun-ui/tokens";
|
|
2543
2547
|
import {
|
|
2544
2548
|
createContext as createContext10,
|
|
2545
2549
|
forwardRef as forwardRef3,
|
|
@@ -2553,10 +2557,10 @@ import {
|
|
|
2553
2557
|
} from "react-aria-components";
|
|
2554
2558
|
|
|
2555
2559
|
// packages/react/src/use-selection-indicator.ts
|
|
2556
|
-
import { useLayoutEffect as useLayoutEffect9, useRef as
|
|
2560
|
+
import { useLayoutEffect as useLayoutEffect9, useRef as useRef15 } from "react";
|
|
2557
2561
|
|
|
2558
2562
|
// shared/package-runtime/selection-indicator.ts
|
|
2559
|
-
import { tokens as
|
|
2563
|
+
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2560
2564
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2561
2565
|
var _a;
|
|
2562
2566
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2596,7 +2600,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2596
2600
|
const style = getComputedStyle(next);
|
|
2597
2601
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2598
2602
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2599
|
-
const height = underline ?
|
|
2603
|
+
const height = underline ? tokens13.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2600
2604
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2601
2605
|
if (key !== bounds) {
|
|
2602
2606
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2625,9 +2629,9 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2625
2629
|
|
|
2626
2630
|
// packages/react/src/use-selection-indicator.ts
|
|
2627
2631
|
function useSelectionIndicator(tabs = false) {
|
|
2628
|
-
const group =
|
|
2629
|
-
const indicator =
|
|
2630
|
-
const sync =
|
|
2632
|
+
const group = useRef15(null);
|
|
2633
|
+
const indicator = useRef15(null);
|
|
2634
|
+
const sync = useRef15(() => {
|
|
2631
2635
|
});
|
|
2632
2636
|
useLayoutEffect9(() => {
|
|
2633
2637
|
const root = group.current, marker = indicator.current;
|
|
@@ -2658,10 +2662,15 @@ function groupKeydown(event) {
|
|
|
2658
2662
|
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2659
2663
|
}
|
|
2660
2664
|
|
|
2665
|
+
// shared/package-runtime/component-icons.ts
|
|
2666
|
+
import minus from "@kjun-ui/icons/icons/minus";
|
|
2667
|
+
var componentIcons = { minus };
|
|
2668
|
+
|
|
2661
2669
|
// packages/react/src/controls.tsx
|
|
2662
2670
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2663
2671
|
function KjunCheckbox({
|
|
2664
2672
|
value,
|
|
2673
|
+
indeterminate = false,
|
|
2665
2674
|
val,
|
|
2666
2675
|
label,
|
|
2667
2676
|
ariaLabel,
|
|
@@ -2677,6 +2686,7 @@ function KjunCheckbox({
|
|
|
2677
2686
|
AriaCheckbox,
|
|
2678
2687
|
{
|
|
2679
2688
|
isSelected: checked,
|
|
2689
|
+
isIndeterminate: indeterminate,
|
|
2680
2690
|
isDisabled: disabled,
|
|
2681
2691
|
"aria-label": ariaLabel,
|
|
2682
2692
|
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
@@ -2693,8 +2703,8 @@ function KjunCheckbox({
|
|
|
2693
2703
|
/* @__PURE__ */ jsx14(
|
|
2694
2704
|
"span",
|
|
2695
2705
|
{
|
|
2696
|
-
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2697
|
-
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size:
|
|
2706
|
+
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked || indeterminate ? " kjun-checkbox--checked" : ""}`,
|
|
2707
|
+
children: (checked || indeterminate) && /* @__PURE__ */ jsx14(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsx14(KjunIcon, { name: indeterminate ? "minus" : "check", size: tokens14.extensions.checkbox.iconSizes[size] }) })
|
|
2698
2708
|
}
|
|
2699
2709
|
),
|
|
2700
2710
|
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2825,7 +2835,7 @@ function KjunRadioGroup({
|
|
|
2825
2835
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2826
2836
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2827
2837
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2828
|
-
gap: direction === "vertical" ?
|
|
2838
|
+
gap: direction === "vertical" ? tokens14.dimension.value8 : tokens14.dimension.value16
|
|
2829
2839
|
},
|
|
2830
2840
|
children: children || options.map((option) => /* @__PURE__ */ jsx14(
|
|
2831
2841
|
KjunRadio,
|
|
@@ -2857,7 +2867,7 @@ var KjunTextarea = forwardRef3(
|
|
|
2857
2867
|
}, ref) {
|
|
2858
2868
|
var _a;
|
|
2859
2869
|
const field = useKjunField();
|
|
2860
|
-
const spec =
|
|
2870
|
+
const spec = tokens14.input[size];
|
|
2861
2871
|
return /* @__PURE__ */ jsx14(
|
|
2862
2872
|
"textarea",
|
|
2863
2873
|
{
|
|
@@ -2875,8 +2885,8 @@ var KjunTextarea = forwardRef3(
|
|
|
2875
2885
|
style: {
|
|
2876
2886
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2877
2887
|
lineHeight: spec.lineHeight / 16 + "rem",
|
|
2878
|
-
padding: `${spec.textareaPaddingY}px ${spec.padding -
|
|
2879
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
2888
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - tokens14.border.controlWidth}px`,
|
|
2889
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * tokens14.border.controlWidth),
|
|
2880
2890
|
borderRadius: spec.radius,
|
|
2881
2891
|
resize,
|
|
2882
2892
|
...style
|
|
@@ -2909,9 +2919,9 @@ function KjunButtonGroup({
|
|
|
2909
2919
|
className: "kjun-button-group",
|
|
2910
2920
|
onKeyDown: groupKeydown,
|
|
2911
2921
|
style: {
|
|
2912
|
-
height:
|
|
2913
|
-
padding:
|
|
2914
|
-
borderRadius:
|
|
2922
|
+
height: tokens14.buttonGroup.heights[size],
|
|
2923
|
+
padding: tokens14.buttonGroup.padding[size],
|
|
2924
|
+
borderRadius: tokens14.buttonGroup.radii[size],
|
|
2915
2925
|
width: fullWidth ? "100%" : "fit-content"
|
|
2916
2926
|
},
|
|
2917
2927
|
children: [
|
|
@@ -2922,7 +2932,7 @@ function KjunButtonGroup({
|
|
|
2922
2932
|
className: "kjun-button-group-indicator",
|
|
2923
2933
|
"aria-hidden": "true",
|
|
2924
2934
|
hidden: true,
|
|
2925
|
-
style: { borderRadius:
|
|
2935
|
+
style: { borderRadius: tokens14.buttonGroup.itemRadii[size] }
|
|
2926
2936
|
}
|
|
2927
2937
|
),
|
|
2928
2938
|
options.map((option) => /* @__PURE__ */ jsxs9(
|
|
@@ -2933,8 +2943,8 @@ function KjunButtonGroup({
|
|
|
2933
2943
|
disabled: disabled || option.disabled,
|
|
2934
2944
|
style: {
|
|
2935
2945
|
flex: fullWidth ? 1 : void 0,
|
|
2936
|
-
paddingInline:
|
|
2937
|
-
borderRadius:
|
|
2946
|
+
paddingInline: tokens14.buttonGroup.itemPaddingX[size],
|
|
2947
|
+
borderRadius: tokens14.buttonGroup.itemRadii[size],
|
|
2938
2948
|
...selectionTypeStyle(size, value === option.value)
|
|
2939
2949
|
},
|
|
2940
2950
|
onClick: () => {
|
|
@@ -2942,9 +2952,9 @@ function KjunButtonGroup({
|
|
|
2942
2952
|
onChange == null ? void 0 : onChange(option.value);
|
|
2943
2953
|
},
|
|
2944
2954
|
children: [
|
|
2945
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
2955
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens14.extensions.selection.iconSize }),
|
|
2946
2956
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-button-group-label", children: [
|
|
2947
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
2957
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens14.button.typography[size]), children: option.label }),
|
|
2948
2958
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2949
2959
|
] })
|
|
2950
2960
|
]
|
|
@@ -2980,7 +2990,7 @@ function KjunFilterGroup({
|
|
|
2980
2990
|
{
|
|
2981
2991
|
type: "button",
|
|
2982
2992
|
className: "kjun-filter-chip",
|
|
2983
|
-
style: { borderRadius:
|
|
2993
|
+
style: { borderRadius: tokens14.button.radii[size] },
|
|
2984
2994
|
"aria-pressed": selected(option.value),
|
|
2985
2995
|
disabled: disabled || option.disabled,
|
|
2986
2996
|
onClick: () => {
|
|
@@ -2992,15 +3002,15 @@ function KjunFilterGroup({
|
|
|
2992
3002
|
"span",
|
|
2993
3003
|
{
|
|
2994
3004
|
style: {
|
|
2995
|
-
height:
|
|
2996
|
-
paddingInline: { xs:
|
|
3005
|
+
height: tokens14.button.heights[size],
|
|
3006
|
+
paddingInline: { xs: tokens14.dimension.value8, sm: tokens14.dimension.value12, md: tokens14.dimension.value12, lg: tokens14.dimension.value14, xl: tokens14.dimension.value16 }[size],
|
|
2997
3007
|
...selectionTypeStyle(size, selected(option.value))
|
|
2998
3008
|
},
|
|
2999
3009
|
children: [
|
|
3000
3010
|
option.dot && /* @__PURE__ */ jsx14("i", { style: { background: option.dot } }),
|
|
3001
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
3011
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens14.extensions.selection.iconSize }),
|
|
3002
3012
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-filter-label", children: [
|
|
3003
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
3013
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens14.button.typography[size]), children: option.label }),
|
|
3004
3014
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
3005
3015
|
] })
|
|
3006
3016
|
]
|
|
@@ -3014,8 +3024,8 @@ function KjunFilterGroup({
|
|
|
3014
3024
|
}
|
|
3015
3025
|
|
|
3016
3026
|
// packages/react/src/floating-panel.tsx
|
|
3017
|
-
import { isComposingKey as isComposingKey3, tokens as
|
|
3018
|
-
import { useEffect as useEffect7, useRef as
|
|
3027
|
+
import { isComposingKey as isComposingKey3, tokens as tokens15 } from "@kjun-ui/tokens";
|
|
3028
|
+
import { useEffect as useEffect7, useRef as useRef16 } from "react";
|
|
3019
3029
|
import { Popover as AriaPopover } from "react-aria-components";
|
|
3020
3030
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
3021
3031
|
function FloatingPanel({
|
|
@@ -3035,10 +3045,10 @@ function FloatingPanel({
|
|
|
3035
3045
|
repositionKey = 0,
|
|
3036
3046
|
inside
|
|
3037
3047
|
}) {
|
|
3038
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3048
|
+
const motion = usePresence(open, useReducedMotion(), tokens15.motion.popupExit);
|
|
3039
3049
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
3040
3050
|
const container = useKjunPortalContainer();
|
|
3041
|
-
const panel =
|
|
3051
|
+
const panel = useRef16(null);
|
|
3042
3052
|
useEffect7(() => {
|
|
3043
3053
|
var _a;
|
|
3044
3054
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
@@ -3075,9 +3085,9 @@ function FloatingPanel({
|
|
|
3075
3085
|
UNSTABLE_portalContainer: container,
|
|
3076
3086
|
placement: placement.replace("-", " "),
|
|
3077
3087
|
shouldFlip: flip,
|
|
3078
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3079
|
-
offset: field ?
|
|
3080
|
-
containerPadding:
|
|
3088
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? tokens15.extensions.menu.listMaxHeight : tokens15.extensions.floating.maxHeight : void 0,
|
|
3089
|
+
offset: field ? tokens15.extensions.floating.fieldGap : tokens15.extensions.floating.anchorGap,
|
|
3090
|
+
containerPadding: tokens15.extensions.floating.viewportInset,
|
|
3081
3091
|
crossOffset: repositionKey % 2 ? 1e-3 : 0,
|
|
3082
3092
|
className: "kjun-scope kjun-floating " + className,
|
|
3083
3093
|
"data-motion": "popup",
|
|
@@ -3119,9 +3129,9 @@ function followAnchor(element, source, moved) {
|
|
|
3119
3129
|
var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidden" };
|
|
3120
3130
|
|
|
3121
3131
|
// packages/react/src/popover.tsx
|
|
3122
|
-
import { tokens as
|
|
3123
|
-
import { useCallback as useCallback4, useEffect as useEffect8, useId as useId6, useLayoutEffect as useLayoutEffect10, useRef as
|
|
3124
|
-
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger } from "react-aria-components";
|
|
3132
|
+
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
3133
|
+
import { Children, Fragment as Fragment4, cloneElement, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext11, useEffect as useEffect8, useId as useId6, useLayoutEffect as useLayoutEffect10, useRef as useRef17, useState as useState10 } from "react";
|
|
3134
|
+
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger, TooltipTriggerStateContext } from "react-aria-components";
|
|
3125
3135
|
|
|
3126
3136
|
// shared/package-runtime/popover-nonmodal.ts
|
|
3127
3137
|
var tabbableSelector = 'button,input,select,textarea,[href],[tabindex]:not([tabindex="-1"])';
|
|
@@ -3183,7 +3193,16 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
3183
3193
|
}
|
|
3184
3194
|
|
|
3185
3195
|
// packages/react/src/popover.tsx
|
|
3186
|
-
import { Fragment as
|
|
3196
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3197
|
+
function bindPopoverTrigger(node, props) {
|
|
3198
|
+
if (!isValidElement2(node)) return node;
|
|
3199
|
+
if (node.type === KjunTooltip)
|
|
3200
|
+
return cloneElement(node, {}, bindPopoverTrigger(node.props.children, props));
|
|
3201
|
+
if (node.type === Fragment4 || typeof node.type === "string" && !["button", "a", "input", "summary"].includes(node.type) && node.props.role !== "button" && node.props.tabIndex == null) {
|
|
3202
|
+
return cloneElement(node, {}, Children.map(node.props.children, (child) => bindPopoverTrigger(child, props)));
|
|
3203
|
+
}
|
|
3204
|
+
return cloneElement(node, props);
|
|
3205
|
+
}
|
|
3187
3206
|
function KjunPopover({
|
|
3188
3207
|
noPadding = false,
|
|
3189
3208
|
open: controlled,
|
|
@@ -3203,19 +3222,19 @@ function KjunPopover({
|
|
|
3203
3222
|
children
|
|
3204
3223
|
}) {
|
|
3205
3224
|
const m = useKjunMessages();
|
|
3206
|
-
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref =
|
|
3225
|
+
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef17(null), id = "kjun-" + useId6();
|
|
3207
3226
|
const expanded = usePopupExpanded(open, ref);
|
|
3208
|
-
const focusOnMount =
|
|
3227
|
+
const focusOnMount = useRef17(focusOnOpen);
|
|
3209
3228
|
focusOnMount.current = focusOnOpen;
|
|
3210
3229
|
const focusContent = useCallback4((node) => {
|
|
3211
3230
|
if (node && focusOnMount.current) node.focus();
|
|
3212
3231
|
}, []);
|
|
3213
3232
|
const resolveReturn = resolveFocusReturn(returnFocus);
|
|
3214
|
-
const anchor =
|
|
3233
|
+
const anchor = useRef17(null), anchorSource = useRef17(anchorRect), opener = useRef17(null);
|
|
3215
3234
|
anchorSource.current = anchorRect;
|
|
3216
3235
|
const [reposition, setReposition] = useState10(0);
|
|
3217
3236
|
const anchored = anchorRect !== void 0;
|
|
3218
|
-
const wasOpen =
|
|
3237
|
+
const wasOpen = useRef17(false);
|
|
3219
3238
|
if (open && !wasOpen.current && typeof document !== "undefined") opener.current = document.activeElement;
|
|
3220
3239
|
wasOpen.current = open;
|
|
3221
3240
|
useLayoutEffect10(() => {
|
|
@@ -3226,7 +3245,7 @@ function KjunPopover({
|
|
|
3226
3245
|
setInternal(v);
|
|
3227
3246
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3228
3247
|
};
|
|
3229
|
-
const skipReturn =
|
|
3248
|
+
const skipReturn = useRef17(false);
|
|
3230
3249
|
useEffect8(() => {
|
|
3231
3250
|
if (!open || modal) return;
|
|
3232
3251
|
skipReturn.current = false;
|
|
@@ -3243,14 +3262,15 @@ function KjunPopover({
|
|
|
3243
3262
|
});
|
|
3244
3263
|
});
|
|
3245
3264
|
const content = /* @__PURE__ */ jsx16("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
3246
|
-
return /* @__PURE__ */ jsxs10(
|
|
3265
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3247
3266
|
anchored && /* @__PURE__ */ jsx16("div", { ref: anchor, "aria-hidden": "true", style: anchorStyle }),
|
|
3248
3267
|
(!anchored || trigger != null) && /* @__PURE__ */ jsx16(
|
|
3249
3268
|
"div",
|
|
3250
3269
|
{
|
|
3251
3270
|
ref,
|
|
3252
3271
|
className: "kjun-layer-trigger",
|
|
3253
|
-
onClickCapture: () => {
|
|
3272
|
+
onClickCapture: (event) => {
|
|
3273
|
+
if (event.target.closest('button:disabled, [aria-disabled="true"]')) return;
|
|
3254
3274
|
if (!manualTrigger) change(!open);
|
|
3255
3275
|
},
|
|
3256
3276
|
onKeyDown: (event) => {
|
|
@@ -3259,10 +3279,11 @@ function KjunPopover({
|
|
|
3259
3279
|
change(!open);
|
|
3260
3280
|
}
|
|
3261
3281
|
},
|
|
3262
|
-
"
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3282
|
+
children: bindPopoverTrigger(typeof trigger === "function" ? trigger(open) : trigger, {
|
|
3283
|
+
"aria-haspopup": "dialog",
|
|
3284
|
+
"aria-expanded": expanded,
|
|
3285
|
+
"aria-controls": expanded ? id : void 0
|
|
3286
|
+
})
|
|
3266
3287
|
}
|
|
3267
3288
|
),
|
|
3268
3289
|
/* @__PURE__ */ jsx16(
|
|
@@ -3290,9 +3311,9 @@ function KjunPopover({
|
|
|
3290
3311
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3291
3312
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3292
3313
|
className: "kjun-popover-dialog",
|
|
3293
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3314
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens16.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3294
3315
|
};
|
|
3295
|
-
const body = /* @__PURE__ */ jsxs10(
|
|
3316
|
+
const body = /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3296
3317
|
header != null && /* @__PURE__ */ jsx16("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
3297
3318
|
header != null ? /* @__PURE__ */ jsx16("div", { className: "kjun-popover-body", children: content }) : content,
|
|
3298
3319
|
/* @__PURE__ */ jsx16(FeedbackLayerOutlet, {})
|
|
@@ -3303,6 +3324,11 @@ function KjunPopover({
|
|
|
3303
3324
|
)
|
|
3304
3325
|
] });
|
|
3305
3326
|
}
|
|
3327
|
+
function TooltipPanel(props) {
|
|
3328
|
+
const state = useContext11(TooltipTriggerStateContext);
|
|
3329
|
+
if (state && !state.isOpen && state.shouldSkipAnimation) return null;
|
|
3330
|
+
return /* @__PURE__ */ jsx16(Tooltip, { ...props });
|
|
3331
|
+
}
|
|
3306
3332
|
function KjunTooltip({
|
|
3307
3333
|
content = "",
|
|
3308
3334
|
title,
|
|
@@ -3315,26 +3341,30 @@ function KjunTooltip({
|
|
|
3315
3341
|
children
|
|
3316
3342
|
}) {
|
|
3317
3343
|
const container = useKjunPortalContainer();
|
|
3318
|
-
const
|
|
3344
|
+
const hasContent2 = !!(content || title);
|
|
3345
|
+
const [internal, setInternal] = useState10(false), open = (controlled != null ? controlled : internal) && hasContent2;
|
|
3346
|
+
useEffect8(() => {
|
|
3347
|
+
if (!hasContent2) setInternal(false);
|
|
3348
|
+
}, [hasContent2]);
|
|
3319
3349
|
const setOpen = (value) => {
|
|
3320
3350
|
setInternal(value);
|
|
3321
3351
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
3322
3352
|
};
|
|
3323
3353
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
3324
|
-
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked
|
|
3354
|
+
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !hasContent2 || !layer.scopeActive, children: [
|
|
3325
3355
|
/* @__PURE__ */ jsx16(Focusable, { children }),
|
|
3326
|
-
container !== null && /* @__PURE__ */ jsxs10(
|
|
3327
|
-
|
|
3356
|
+
container !== null && hasContent2 && /* @__PURE__ */ jsxs10(
|
|
3357
|
+
TooltipPanel,
|
|
3328
3358
|
{
|
|
3329
3359
|
style: { zIndex: layer.zIndex, ...width ? { maxWidth: `var(--_kjun-extension-tooltip-max-widths-${width})` } : {} },
|
|
3330
3360
|
"data-align": align,
|
|
3331
3361
|
UNSTABLE_portalContainer: container,
|
|
3332
3362
|
placement,
|
|
3333
|
-
offset:
|
|
3363
|
+
offset: tokens16.extensions.floating.anchorGap,
|
|
3334
3364
|
className: "kjun-scope kjun-tooltip",
|
|
3335
3365
|
children: [
|
|
3336
|
-
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width:
|
|
3337
|
-
title ? /* @__PURE__ */ jsxs10(
|
|
3366
|
+
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width: tokens16.extensions.tooltip.arrowSize, height: tokens16.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx16("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
3367
|
+
title ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3338
3368
|
/* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-title", children: title }),
|
|
3339
3369
|
content && /* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-body", children: content })
|
|
3340
3370
|
] }) : content
|
|
@@ -3345,8 +3375,8 @@ function KjunTooltip({
|
|
|
3345
3375
|
}
|
|
3346
3376
|
|
|
3347
3377
|
// packages/react/src/dropdown.tsx
|
|
3348
|
-
import { tokens as
|
|
3349
|
-
import { cloneElement, createContext as createContext11, isValidElement as
|
|
3378
|
+
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
3379
|
+
import { cloneElement as cloneElement2, createContext as createContext11, isValidElement as isValidElement3, useCallback as useCallback5, useContext as useContext12, useEffect as useEffect9, useId as useId7, useRef as useRef18, useState as useState11 } from "react";
|
|
3350
3380
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
3351
3381
|
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3352
3382
|
var DropdownContext = createContext11(null);
|
|
@@ -3362,8 +3392,8 @@ function KjunDropdown({
|
|
|
3362
3392
|
onClose,
|
|
3363
3393
|
returnFocus
|
|
3364
3394
|
}) {
|
|
3365
|
-
const [open, setOpen] = useState11(false), currentOpen =
|
|
3366
|
-
const menuFocusCleanup =
|
|
3395
|
+
const [open, setOpen] = useState11(false), currentOpen = useRef18(false), ref = useRef18(null), id = "kjun-" + useId7();
|
|
3396
|
+
const menuFocusCleanup = useRef18(() => {
|
|
3367
3397
|
});
|
|
3368
3398
|
const bindMenu = useCallback5((menu) => {
|
|
3369
3399
|
menuFocusCleanup.current();
|
|
@@ -3387,19 +3417,19 @@ function KjunDropdown({
|
|
|
3387
3417
|
};
|
|
3388
3418
|
}, []);
|
|
3389
3419
|
let control = trigger;
|
|
3390
|
-
while (
|
|
3420
|
+
while (isValidElement3(control) && control.type === KjunTooltip)
|
|
3391
3421
|
control = control.props.children;
|
|
3392
|
-
const unavailable = disabled ||
|
|
3393
|
-
const controlId = triggerId ||
|
|
3422
|
+
const unavailable = disabled || isValidElement3(control) && !!(control.props.disabled || control.props.loading);
|
|
3423
|
+
const controlId = triggerId || isValidElement3(control) && control.props.id || id;
|
|
3394
3424
|
const popupId = menuId || id + "-menu";
|
|
3395
3425
|
const bindTrigger = (node) => {
|
|
3396
|
-
if (!
|
|
3426
|
+
if (!isValidElement3(node)) return node;
|
|
3397
3427
|
if (node.type === KjunTooltip) {
|
|
3398
3428
|
const tooltip = node;
|
|
3399
|
-
return
|
|
3429
|
+
return cloneElement2(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
3400
3430
|
}
|
|
3401
3431
|
const button = node;
|
|
3402
|
-
return
|
|
3432
|
+
return cloneElement2(button, {
|
|
3403
3433
|
id: controlId,
|
|
3404
3434
|
"aria-haspopup": "menu",
|
|
3405
3435
|
"aria-expanded": open,
|
|
@@ -3470,7 +3500,7 @@ function KjunDropdownItem({
|
|
|
3470
3500
|
children,
|
|
3471
3501
|
onClick
|
|
3472
3502
|
}) {
|
|
3473
|
-
const close =
|
|
3503
|
+
const close = useContext12(DropdownContext);
|
|
3474
3504
|
const node = useCallback5((element) => {
|
|
3475
3505
|
if (!element) return;
|
|
3476
3506
|
if (selected === null) {
|
|
@@ -3496,14 +3526,14 @@ function KjunDropdownItem({
|
|
|
3496
3526
|
close == null ? void 0 : close();
|
|
3497
3527
|
},
|
|
3498
3528
|
children: [
|
|
3499
|
-
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3529
|
+
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size: tokens17.extensions.menu.iconSize }),
|
|
3500
3530
|
/* @__PURE__ */ jsx17("span", { children }),
|
|
3501
3531
|
selected !== null && /* @__PURE__ */ jsx17(
|
|
3502
3532
|
KjunIcon,
|
|
3503
3533
|
{
|
|
3504
3534
|
name: "check",
|
|
3505
3535
|
className: "kjun-menu-check",
|
|
3506
|
-
size:
|
|
3536
|
+
size: tokens17.extensions.menu.iconSize,
|
|
3507
3537
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3508
3538
|
}
|
|
3509
3539
|
)
|
|
@@ -3570,7 +3600,7 @@ function KjunMenuButton({
|
|
|
3570
3600
|
}
|
|
3571
3601
|
|
|
3572
3602
|
// packages/react/src/drawer.tsx
|
|
3573
|
-
import { tokens as
|
|
3603
|
+
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3574
3604
|
|
|
3575
3605
|
// shared/package-runtime/drawer-geometry.ts
|
|
3576
3606
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3589,7 +3619,7 @@ function KjunDrawer({
|
|
|
3589
3619
|
onOpenChange,
|
|
3590
3620
|
title,
|
|
3591
3621
|
position = "right",
|
|
3592
|
-
width =
|
|
3622
|
+
width = tokens18.extensions.drawer.width,
|
|
3593
3623
|
closable = true,
|
|
3594
3624
|
closeOnOverlay = true,
|
|
3595
3625
|
closeOnEsc = true,
|
|
@@ -3605,7 +3635,7 @@ function KjunDrawer({
|
|
|
3605
3635
|
maxHeight
|
|
3606
3636
|
}) {
|
|
3607
3637
|
const m = useKjunMessages();
|
|
3608
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3638
|
+
const motion = usePresence(open, useReducedMotion(), tokens18.motion.layerExit);
|
|
3609
3639
|
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3610
3640
|
const container = useKjunPortalContainer();
|
|
3611
3641
|
const close = () => {
|
|
@@ -3662,8 +3692,8 @@ function KjunDrawer({
|
|
|
3662
3692
|
variant: "ghost",
|
|
3663
3693
|
ariaLabel: m.close,
|
|
3664
3694
|
onClick: close,
|
|
3665
|
-
style: { borderRadius:
|
|
3666
|
-
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size:
|
|
3695
|
+
style: { borderRadius: tokens18.extensions.drawer.closeRadius, width: tokens18.extensions.drawer.closeSize, height: tokens18.extensions.drawer.closeSize, padding: 0 },
|
|
3696
|
+
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size: tokens18.extensions.drawer.closeIconSize })
|
|
3667
3697
|
}
|
|
3668
3698
|
)
|
|
3669
3699
|
] }),
|
|
@@ -3671,7 +3701,7 @@ function KjunDrawer({
|
|
|
3671
3701
|
"div",
|
|
3672
3702
|
{
|
|
3673
3703
|
className: "kjun-drawer-body",
|
|
3674
|
-
style: { padding: noPadding ? 0 :
|
|
3704
|
+
style: { padding: noPadding ? 0 : tokens18.extensions.drawer.bodyPadding },
|
|
3675
3705
|
children
|
|
3676
3706
|
}
|
|
3677
3707
|
),
|
|
@@ -3804,10 +3834,10 @@ function useComboboxModel({
|
|
|
3804
3834
|
import {
|
|
3805
3835
|
useEffect as useEffect11,
|
|
3806
3836
|
useId as useId8,
|
|
3807
|
-
useRef as
|
|
3837
|
+
useRef as useRef19,
|
|
3808
3838
|
useState as useState13
|
|
3809
3839
|
} from "react";
|
|
3810
|
-
import { Fragment as
|
|
3840
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3811
3841
|
function KjunCombobox({
|
|
3812
3842
|
value,
|
|
3813
3843
|
options = [],
|
|
@@ -3893,8 +3923,8 @@ function SearchField({
|
|
|
3893
3923
|
}) {
|
|
3894
3924
|
const m = useKjunMessages();
|
|
3895
3925
|
const composition = useCompositionGuard();
|
|
3896
|
-
const clearing =
|
|
3897
|
-
const ref =
|
|
3926
|
+
const clearing = useRef19(false);
|
|
3927
|
+
const ref = useRef19(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
3898
3928
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3899
3929
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3900
3930
|
useEffect11(() => setActive(-1), [value, options.length]);
|
|
@@ -3919,7 +3949,7 @@ function SearchField({
|
|
|
3919
3949
|
onOpenChange(false);
|
|
3920
3950
|
(_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
|
|
3921
3951
|
};
|
|
3922
|
-
return /* @__PURE__ */ jsxs13(
|
|
3952
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
3923
3953
|
/* @__PURE__ */ jsx19(
|
|
3924
3954
|
KjunInput,
|
|
3925
3955
|
{
|
|
@@ -4041,7 +4071,7 @@ function SearchField({
|
|
|
4041
4071
|
}
|
|
4042
4072
|
|
|
4043
4073
|
// packages/react/src/date-picker.tsx
|
|
4044
|
-
import { tokens as
|
|
4074
|
+
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
4045
4075
|
import {
|
|
4046
4076
|
useState as useState14
|
|
4047
4077
|
} from "react";
|
|
@@ -4067,8 +4097,8 @@ function KjunDatePicker({
|
|
|
4067
4097
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
4068
4098
|
/* @__PURE__ */ jsxs14("div", { className: "kjun-date-picker", style: {
|
|
4069
4099
|
position: "relative",
|
|
4070
|
-
["--_kjun-date-icon-inset"]:
|
|
4071
|
-
["--_kjun-date-icon-size"]:
|
|
4100
|
+
["--_kjun-date-icon-inset"]: tokens19.input[size].padding + "px",
|
|
4101
|
+
["--_kjun-date-icon-size"]: tokens19.input[size].iconSize + "px"
|
|
4072
4102
|
}, children: [
|
|
4073
4103
|
/* @__PURE__ */ jsx20(
|
|
4074
4104
|
KjunInput,
|
|
@@ -4098,8 +4128,8 @@ function KjunDatePicker({
|
|
|
4098
4128
|
"aria-hidden": "true",
|
|
4099
4129
|
className: "kjun-date-overlay",
|
|
4100
4130
|
style: {
|
|
4101
|
-
left:
|
|
4102
|
-
right:
|
|
4131
|
+
left: tokens19.input[size].padding,
|
|
4132
|
+
right: tokens19.input[size].padding + tokens19.input[size].iconSize + tokens19.input[size].affixGap + (clear ? tokens19.input[size].clearSize + tokens19.input[size].affixGap : 0),
|
|
4103
4133
|
...inputTypeStyle(size),
|
|
4104
4134
|
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)"
|
|
4105
4135
|
},
|
|
@@ -4115,14 +4145,14 @@ function KjunDatePicker({
|
|
|
4115
4145
|
className: "kjun-select-clear",
|
|
4116
4146
|
style: {
|
|
4117
4147
|
padding: 0,
|
|
4118
|
-
right:
|
|
4119
|
-
width:
|
|
4120
|
-
height:
|
|
4121
|
-
minHeight:
|
|
4148
|
+
right: tokens19.input[size].padding + tokens19.input[size].iconSize + tokens19.input[size].affixGap,
|
|
4149
|
+
width: tokens19.input[size].clearSize,
|
|
4150
|
+
height: tokens19.input[size].clearSize,
|
|
4151
|
+
minHeight: tokens19.input[size].clearSize,
|
|
4122
4152
|
borderRadius: "50%"
|
|
4123
4153
|
},
|
|
4124
4154
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
4125
|
-
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size:
|
|
4155
|
+
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size: tokens19.input[size].iconSize })
|
|
4126
4156
|
}
|
|
4127
4157
|
)
|
|
4128
4158
|
] })
|
|
@@ -4133,7 +4163,7 @@ function KjunDatePicker({
|
|
|
4133
4163
|
import { useState as useState16 } from "react";
|
|
4134
4164
|
|
|
4135
4165
|
// shared/package-runtime/search-input.ts
|
|
4136
|
-
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect11, useRef as
|
|
4166
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect11, useRef as useRef20, useState as useState15 } from "react";
|
|
4137
4167
|
function useSearchInputModel({
|
|
4138
4168
|
value,
|
|
4139
4169
|
disabled = false,
|
|
@@ -4143,10 +4173,10 @@ function useSearchInputModel({
|
|
|
4143
4173
|
onValueChange,
|
|
4144
4174
|
onSearchError
|
|
4145
4175
|
}, open) {
|
|
4146
|
-
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version =
|
|
4176
|
+
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version = useRef20(0), notify = useRef20(onSearchError);
|
|
4147
4177
|
notify.current = onSearchError;
|
|
4148
|
-
const timer =
|
|
4149
|
-
const notifyValue =
|
|
4178
|
+
const timer = useRef20(void 0);
|
|
4179
|
+
const notifyValue = useRef20(onValueChange);
|
|
4150
4180
|
notifyValue.current = onValueChange;
|
|
4151
4181
|
useLayoutEffect11(() => {
|
|
4152
4182
|
clearTimeout(timer.current);
|
|
@@ -4309,17 +4339,17 @@ function KjunSearchInput({
|
|
|
4309
4339
|
}
|
|
4310
4340
|
|
|
4311
4341
|
// packages/react/src/select-control.tsx
|
|
4312
|
-
import { tokens as
|
|
4342
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
4313
4343
|
import {
|
|
4314
4344
|
useId as useId9,
|
|
4315
|
-
useContext as
|
|
4316
|
-
useRef as
|
|
4345
|
+
useContext as useContext13,
|
|
4346
|
+
useRef as useRef22,
|
|
4317
4347
|
useEffect as useEffect14
|
|
4318
4348
|
} from "react";
|
|
4319
4349
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
4320
4350
|
|
|
4321
4351
|
// shared/package-runtime/select.ts
|
|
4322
|
-
import { useEffect as useEffect13, useRef as
|
|
4352
|
+
import { useEffect as useEffect13, useRef as useRef21, useState as useState17 } from "react";
|
|
4323
4353
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4324
4354
|
const [internal, setInternal] = useState17(false);
|
|
4325
4355
|
const [query2, setQuery] = useState17("");
|
|
@@ -4327,7 +4357,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4327
4357
|
const [session, setSession] = useState17(0);
|
|
4328
4358
|
const isControlled = typeof controlled === "boolean";
|
|
4329
4359
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4330
|
-
const previousOpen =
|
|
4360
|
+
const previousOpen = useRef21(open);
|
|
4331
4361
|
useEffect13(() => {
|
|
4332
4362
|
if (disabled && !isControlled) setInternal(false);
|
|
4333
4363
|
if (previousOpen.current && !open) {
|
|
@@ -4357,7 +4387,7 @@ import { createContext as createContext12 } from "react";
|
|
|
4357
4387
|
var CompoundControlContext = createContext12(null);
|
|
4358
4388
|
|
|
4359
4389
|
// packages/react/src/select-control.tsx
|
|
4360
|
-
import { Fragment as
|
|
4390
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4361
4391
|
function KjunSelect({
|
|
4362
4392
|
value,
|
|
4363
4393
|
options = [],
|
|
@@ -4394,9 +4424,9 @@ function KjunSelect({
|
|
|
4394
4424
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4395
4425
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4396
4426
|
const composition = useCompositionGuard();
|
|
4397
|
-
const ref =
|
|
4398
|
-
const segment =
|
|
4399
|
-
const spec =
|
|
4427
|
+
const ref = useRef22(null), menu = useRef22(null), field = useKjunField(), id = "kjun-" + useId9();
|
|
4428
|
+
const segment = useContext13(CompoundControlContext) !== null;
|
|
4429
|
+
const spec = tokens20.input[size];
|
|
4400
4430
|
const expanded = usePopupExpanded(open, ref);
|
|
4401
4431
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4402
4432
|
useEffect14(() => {
|
|
@@ -4427,7 +4457,7 @@ function KjunSelect({
|
|
|
4427
4457
|
searchKeys,
|
|
4428
4458
|
selectedCount: m.selectedCount
|
|
4429
4459
|
});
|
|
4430
|
-
return /* @__PURE__ */ jsxs15(
|
|
4460
|
+
return /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
4431
4461
|
/* @__PURE__ */ jsxs15("div", { className: "kjun-select-shell", children: [
|
|
4432
4462
|
/* @__PURE__ */ jsxs15(
|
|
4433
4463
|
"button",
|
|
@@ -4450,7 +4480,7 @@ function KjunSelect({
|
|
|
4450
4480
|
borderRadius: spec.radius,
|
|
4451
4481
|
...inputTypeStyle(size),
|
|
4452
4482
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4453
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4483
|
+
...segment ? {} : { paddingInline: spec.padding - tokens20.border.controlWidth }
|
|
4454
4484
|
},
|
|
4455
4485
|
onClick: () => changeOpen(!open),
|
|
4456
4486
|
onKeyDown: (e) => {
|
|
@@ -4461,7 +4491,7 @@ function KjunSelect({
|
|
|
4461
4491
|
},
|
|
4462
4492
|
children: [
|
|
4463
4493
|
/* @__PURE__ */ jsx22("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 }),
|
|
4464
|
-
/* @__PURE__ */ jsx22(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ?
|
|
4494
|
+
/* @__PURE__ */ jsx22(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? tokens20.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
4465
4495
|
]
|
|
4466
4496
|
}
|
|
4467
4497
|
),
|
|
@@ -4566,7 +4596,7 @@ function KjunSelect({
|
|
|
4566
4596
|
className: "kjun-option",
|
|
4567
4597
|
children: [
|
|
4568
4598
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ jsx22("span", { children: optionLabel(o, labelKey) }),
|
|
4569
|
-
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size:
|
|
4599
|
+
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size: tokens20.extensions.menu.iconSize })
|
|
4570
4600
|
]
|
|
4571
4601
|
},
|
|
4572
4602
|
key
|
|
@@ -4592,20 +4622,20 @@ function KjunSelect({
|
|
|
4592
4622
|
}
|
|
4593
4623
|
|
|
4594
4624
|
// packages/react/src/navigation.tsx
|
|
4595
|
-
import { tokens as
|
|
4625
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
4596
4626
|
|
|
4597
4627
|
// packages/react/src/collapse.tsx
|
|
4598
|
-
import { tokens as
|
|
4599
|
-
import { useLayoutEffect as useLayoutEffect12, useRef as
|
|
4628
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4629
|
+
import { useLayoutEffect as useLayoutEffect12, useRef as useRef23, useState as useState18 } from "react";
|
|
4600
4630
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4601
4631
|
function Collapse({ open, keepMounted = false, children }) {
|
|
4602
4632
|
const reduced = useReducedMotion();
|
|
4603
4633
|
const [retained, setRetained] = useState18(open);
|
|
4604
|
-
const root =
|
|
4605
|
-
const animation =
|
|
4606
|
-
const previous =
|
|
4607
|
-
const interrupted =
|
|
4608
|
-
const opened =
|
|
4634
|
+
const root = useRef23(null), body = useRef23(null);
|
|
4635
|
+
const animation = useRef23(null);
|
|
4636
|
+
const previous = useRef23(open);
|
|
4637
|
+
const interrupted = useRef23(null);
|
|
4638
|
+
const opened = useRef23(open);
|
|
4609
4639
|
if (open) opened.current = true;
|
|
4610
4640
|
const present = open || retained || keepMounted && opened.current;
|
|
4611
4641
|
useLayoutEffect12(() => {
|
|
@@ -4633,8 +4663,8 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4633
4663
|
}
|
|
4634
4664
|
el.style.height = end + "px";
|
|
4635
4665
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4636
|
-
duration:
|
|
4637
|
-
easing:
|
|
4666
|
+
duration: tokens21.motion.collapse,
|
|
4667
|
+
easing: tokens21.motion.easeOut
|
|
4638
4668
|
});
|
|
4639
4669
|
animation.current = transition;
|
|
4640
4670
|
transition.onfinish = finish;
|
|
@@ -4663,9 +4693,9 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4663
4693
|
}
|
|
4664
4694
|
|
|
4665
4695
|
// shared/package-runtime/navigation.ts
|
|
4666
|
-
import { useEffect as useEffect15, useRef as
|
|
4696
|
+
import { useEffect as useEffect15, useRef as useRef24, useState as useState19 } from "react";
|
|
4667
4697
|
function useInitialTab(value, candidate, change) {
|
|
4668
|
-
const requested =
|
|
4698
|
+
const requested = useRef24(/* @__PURE__ */ new Set());
|
|
4669
4699
|
useEffect15(() => {
|
|
4670
4700
|
if (value !== "") {
|
|
4671
4701
|
requested.current.clear();
|
|
@@ -4763,19 +4793,22 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4763
4793
|
|
|
4764
4794
|
// packages/react/src/navigation.tsx
|
|
4765
4795
|
import {
|
|
4766
|
-
Children,
|
|
4796
|
+
Children as Children2,
|
|
4767
4797
|
createContext as createContext13,
|
|
4768
|
-
Fragment as
|
|
4769
|
-
isValidElement as
|
|
4770
|
-
useContext as
|
|
4798
|
+
Fragment as Fragment8,
|
|
4799
|
+
isValidElement as isValidElement4,
|
|
4800
|
+
useContext as useContext14,
|
|
4771
4801
|
useEffect as useEffect16,
|
|
4772
4802
|
useLayoutEffect as useLayoutEffect13,
|
|
4773
4803
|
useId as useId10,
|
|
4774
|
-
useRef as
|
|
4804
|
+
useRef as useRef25,
|
|
4775
4805
|
useState as useState20
|
|
4776
4806
|
} from "react";
|
|
4777
|
-
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
4778
|
-
import { Fragment as
|
|
4807
|
+
import { Tab, TabList, TabPanel, Tabs, TabListStateContext } from "react-aria-components";
|
|
4808
|
+
import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4809
|
+
function TabActions({ children }) {
|
|
4810
|
+
return useContext14(TabListStateContext) ? children : null;
|
|
4811
|
+
}
|
|
4779
4812
|
function KjunTabs({
|
|
4780
4813
|
value,
|
|
4781
4814
|
items = [],
|
|
@@ -4783,6 +4816,8 @@ function KjunTabs({
|
|
|
4783
4816
|
variant = "underline",
|
|
4784
4817
|
actions,
|
|
4785
4818
|
children,
|
|
4819
|
+
stickyHeader = false,
|
|
4820
|
+
stickyOffset = 0,
|
|
4786
4821
|
ariaLabel,
|
|
4787
4822
|
onValueChange,
|
|
4788
4823
|
onChange,
|
|
@@ -4792,8 +4827,8 @@ function KjunTabs({
|
|
|
4792
4827
|
const m = useKjunMessages();
|
|
4793
4828
|
ariaLabel != null ? ariaLabel : ariaLabel = m.tabs;
|
|
4794
4829
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4795
|
-
const panes =
|
|
4796
|
-
|
|
4830
|
+
const panes = Children2.toArray(children).filter(
|
|
4831
|
+
isValidElement4
|
|
4797
4832
|
);
|
|
4798
4833
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4799
4834
|
useLayoutEffect13(() => {
|
|
@@ -4809,8 +4844,8 @@ function KjunTabs({
|
|
|
4809
4844
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4810
4845
|
}
|
|
4811
4846
|
});
|
|
4812
|
-
const timer =
|
|
4813
|
-
const menuState =
|
|
4847
|
+
const timer = useRef25(void 0), press = useRef25(null);
|
|
4848
|
+
const menuState = useRef25({ tabs, onTabMenu });
|
|
4814
4849
|
menuState.current = { tabs, onTabMenu };
|
|
4815
4850
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4816
4851
|
const clear = () => {
|
|
@@ -4826,7 +4861,7 @@ function KjunTabs({
|
|
|
4826
4861
|
onChange == null ? void 0 : onChange(name);
|
|
4827
4862
|
};
|
|
4828
4863
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4829
|
-
return /* @__PURE__ */ jsxs16(
|
|
4864
|
+
return /* @__PURE__ */ jsx24(TabListStateContext.Provider, { value: null, children: /* @__PURE__ */ jsxs16(
|
|
4830
4865
|
Tabs,
|
|
4831
4866
|
{
|
|
4832
4867
|
selectedKey: value,
|
|
@@ -4835,73 +4870,81 @@ function KjunTabs({
|
|
|
4835
4870
|
"data-variant": variant,
|
|
4836
4871
|
"data-density": density,
|
|
4837
4872
|
children: [
|
|
4838
|
-
/* @__PURE__ */ jsxs16(
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
className: "kjun-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4873
|
+
/* @__PURE__ */ jsxs16(
|
|
4874
|
+
"div",
|
|
4875
|
+
{
|
|
4876
|
+
className: "kjun-tabs-header",
|
|
4877
|
+
"data-sticky": stickyHeader || void 0,
|
|
4878
|
+
style: stickyHeader ? { position: "sticky", top: stickyOffset, zIndex: tokens22.layers.page.sticky, background: "var(--_kjun-color-surface)" } : void 0,
|
|
4879
|
+
children: [
|
|
4880
|
+
/* @__PURE__ */ jsxs16("div", { className: "kjun-tabs-track", ref: group, tabIndex: -1, children: [
|
|
4881
|
+
/* @__PURE__ */ jsx24(TabList, { "aria-label": ariaLabel, className: "kjun-tabs-list", children: tabs.map((tab) => /* @__PURE__ */ jsxs16(
|
|
4882
|
+
Tab,
|
|
4883
|
+
{
|
|
4884
|
+
id: tab.name,
|
|
4885
|
+
"data-tab-name": tab.name,
|
|
4886
|
+
isDisabled: tab.disabled,
|
|
4887
|
+
className: "kjun-tab",
|
|
4888
|
+
onContextMenu: (event) => {
|
|
4889
|
+
if (onTabMenu && !tab.disabled) {
|
|
4890
|
+
event.preventDefault();
|
|
4891
|
+
onTabMenu({
|
|
4892
|
+
name: tab.name,
|
|
4893
|
+
x: event.clientX,
|
|
4894
|
+
y: event.clientY,
|
|
4895
|
+
pointer: "mouse"
|
|
4896
|
+
});
|
|
4897
|
+
}
|
|
4898
|
+
},
|
|
4899
|
+
onTouchStart: (event) => {
|
|
4900
|
+
clear();
|
|
4901
|
+
if (!canOpenMenu(tab.name)) return;
|
|
4902
|
+
const touch = event.touches[0];
|
|
4903
|
+
if (!touch) return;
|
|
4904
|
+
press.current = { name: tab.name, x: touch.clientX, y: touch.clientY };
|
|
4905
|
+
timer.current = setTimeout(() => {
|
|
4906
|
+
var _a2, _b;
|
|
4907
|
+
const pending = press.current;
|
|
4908
|
+
clear();
|
|
4909
|
+
if (pending && canOpenMenu(pending.name))
|
|
4910
|
+
(_b = (_a2 = menuState.current).onTabMenu) == null ? void 0 : _b.call(_a2, { ...pending, pointer: "touch" });
|
|
4911
|
+
}, 500);
|
|
4912
|
+
},
|
|
4913
|
+
onTouchMove: (event) => {
|
|
4914
|
+
const touch = event.touches[0];
|
|
4915
|
+
if (press.current && touch && (Math.abs(touch.clientX - press.current.x) > 10 || Math.abs(touch.clientY - press.current.y) > 10))
|
|
4916
|
+
clear();
|
|
4917
|
+
},
|
|
4918
|
+
onTouchEnd: clear,
|
|
4919
|
+
onTouchCancel: clear,
|
|
4920
|
+
children: [
|
|
4921
|
+
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size: tokens22.extensions.tabs.iconSize }),
|
|
4922
|
+
" ",
|
|
4923
|
+
/* @__PURE__ */ jsx24("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ jsx24("span", { children: tab.label }) }),
|
|
4924
|
+
tab.badge != null && /* @__PURE__ */ jsx24(
|
|
4925
|
+
"span",
|
|
4926
|
+
{
|
|
4927
|
+
className: "kjun-tab-badge",
|
|
4928
|
+
style: {
|
|
4929
|
+
color: tab.badgeVariant ? `var(--_kjun-color-${tab.badgeVariant})` : void 0
|
|
4930
|
+
},
|
|
4931
|
+
children: tab.badge
|
|
4932
|
+
}
|
|
4933
|
+
)
|
|
4934
|
+
]
|
|
4935
|
+
},
|
|
4936
|
+
tab.name
|
|
4937
|
+
)) }),
|
|
4938
|
+
/* @__PURE__ */ jsx24("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4939
|
+
] }),
|
|
4940
|
+
/* @__PURE__ */ jsx24(TabActions, { children: actions })
|
|
4941
|
+
]
|
|
4942
|
+
}
|
|
4943
|
+
),
|
|
4901
4944
|
children && /* @__PURE__ */ jsx24("div", { className: "kjun-tab-content", children })
|
|
4902
4945
|
]
|
|
4903
4946
|
}
|
|
4904
|
-
);
|
|
4947
|
+
) });
|
|
4905
4948
|
}
|
|
4906
4949
|
function KjunTabPane({ name, children }) {
|
|
4907
4950
|
return /* @__PURE__ */ jsx24(
|
|
@@ -4940,11 +4983,11 @@ function KjunAccordionItem({
|
|
|
4940
4983
|
keepMounted = false,
|
|
4941
4984
|
children
|
|
4942
4985
|
}) {
|
|
4943
|
-
const controlled = openProp !== void 0, context =
|
|
4986
|
+
const controlled = openProp !== void 0, context = useContext14(AccordionContext), group = controlled ? null : context, id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = controlled ? openProp : group ? group.opened.has(id) : own;
|
|
4944
4987
|
useEffect16(() => {
|
|
4945
4988
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4946
4989
|
}, []);
|
|
4947
|
-
const reported =
|
|
4990
|
+
const reported = useRef25(open), notify = useRef25(onOpenChange), registering = useRef25(!!group && defaultOpen);
|
|
4948
4991
|
notify.current = onOpenChange;
|
|
4949
4992
|
useEffect16(() => {
|
|
4950
4993
|
var _a;
|
|
@@ -4980,7 +5023,7 @@ function KjunAccordionItem({
|
|
|
4980
5023
|
{
|
|
4981
5024
|
name: "chevron-down",
|
|
4982
5025
|
className: "kjun-accordion-chevron",
|
|
4983
|
-
size:
|
|
5026
|
+
size: tokens22.extensions.accordion.iconSize,
|
|
4984
5027
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4985
5028
|
}
|
|
4986
5029
|
)
|
|
@@ -5007,13 +5050,13 @@ function KjunBreadcrumb({
|
|
|
5007
5050
|
const m = useKjunMessages();
|
|
5008
5051
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
5009
5052
|
return /* @__PURE__ */ jsx24("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
5010
|
-
const label = /* @__PURE__ */ jsxs16(
|
|
5011
|
-
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size:
|
|
5053
|
+
const label = /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
5054
|
+
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size: tokens22.extensions.breadcrumb.iconSize }),
|
|
5012
5055
|
" ",
|
|
5013
5056
|
item.label
|
|
5014
5057
|
] });
|
|
5015
|
-
return /* @__PURE__ */ jsxs16(
|
|
5016
|
-
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size:
|
|
5058
|
+
return /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
5059
|
+
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size: tokens22.extensions.breadcrumb.separatorSize }),
|
|
5017
5060
|
" ",
|
|
5018
5061
|
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ jsx24("a", { href: item.to, children: label }) : /* @__PURE__ */ jsx24("span", { "aria-current": i === items.length - 1 ? "page" : void 0, children: label })
|
|
5019
5062
|
] }, i);
|
|
@@ -5060,7 +5103,7 @@ function KjunPagination({
|
|
|
5060
5103
|
"aria-label": label,
|
|
5061
5104
|
disabled: target < 1 || target > totalPages || target === current,
|
|
5062
5105
|
onClick: () => change(target),
|
|
5063
|
-
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size:
|
|
5106
|
+
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size: tokens22.extensions.pagination.iconSize })
|
|
5064
5107
|
}
|
|
5065
5108
|
);
|
|
5066
5109
|
return /* @__PURE__ */ jsxs16("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -5113,14 +5156,14 @@ function KjunPagination({
|
|
|
5113
5156
|
}
|
|
5114
5157
|
|
|
5115
5158
|
// packages/react/src/actions.tsx
|
|
5116
|
-
import { tokens as
|
|
5159
|
+
import { tokens as tokens23 } from "@kjun-ui/tokens";
|
|
5117
5160
|
import {
|
|
5118
|
-
useContext as
|
|
5161
|
+
useContext as useContext15,
|
|
5119
5162
|
useEffect as useEffect17,
|
|
5120
|
-
useRef as
|
|
5163
|
+
useRef as useRef26,
|
|
5121
5164
|
useState as useState21
|
|
5122
5165
|
} from "react";
|
|
5123
|
-
import { Fragment as
|
|
5166
|
+
import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5124
5167
|
function KjunIconToggle({
|
|
5125
5168
|
active = false,
|
|
5126
5169
|
activeIcon,
|
|
@@ -5139,7 +5182,7 @@ function KjunIconToggle({
|
|
|
5139
5182
|
onToggle
|
|
5140
5183
|
}) {
|
|
5141
5184
|
var _a;
|
|
5142
|
-
const navigation =
|
|
5185
|
+
const navigation = useContext15(TopNavigationContext);
|
|
5143
5186
|
return /* @__PURE__ */ jsx25(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx25(
|
|
5144
5187
|
"button",
|
|
5145
5188
|
{
|
|
@@ -5160,7 +5203,7 @@ function KjunIconToggle({
|
|
|
5160
5203
|
{
|
|
5161
5204
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
5162
5205
|
filled: active,
|
|
5163
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5206
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens23.button.iconSizes[size],
|
|
5164
5207
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
5165
5208
|
className: active ? activeColorClass : inactiveColorClass,
|
|
5166
5209
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5201,7 +5244,7 @@ function KjunCopyButton({
|
|
|
5201
5244
|
const m = useKjunMessages();
|
|
5202
5245
|
successText != null ? successText : successText = m.copied;
|
|
5203
5246
|
const feedback = useOptionalKjunFeedback();
|
|
5204
|
-
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy =
|
|
5247
|
+
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef26(false), timer = useRef26(void 0), mounted = useRef26(true);
|
|
5205
5248
|
useEffect17(() => {
|
|
5206
5249
|
mounted.current = true;
|
|
5207
5250
|
return () => {
|
|
@@ -5209,7 +5252,7 @@ function KjunCopyButton({
|
|
|
5209
5252
|
clearTimeout(timer.current);
|
|
5210
5253
|
};
|
|
5211
5254
|
}, []);
|
|
5212
|
-
return /* @__PURE__ */ jsxs17(
|
|
5255
|
+
return /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
5213
5256
|
/* @__PURE__ */ jsxs17(
|
|
5214
5257
|
"button",
|
|
5215
5258
|
{
|
|
@@ -5220,9 +5263,9 @@ function KjunCopyButton({
|
|
|
5220
5263
|
"data-inline": inline,
|
|
5221
5264
|
style: {
|
|
5222
5265
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5223
|
-
minHeight:
|
|
5266
|
+
minHeight: tokens23.button.heights[size],
|
|
5224
5267
|
paddingBlock: 0,
|
|
5225
|
-
paddingInline: { xs:
|
|
5268
|
+
paddingInline: { xs: tokens23.dimension.value4, sm: tokens23.dimension.value8, md: tokens23.dimension.value12 }[size]
|
|
5226
5269
|
},
|
|
5227
5270
|
onClick: async (event) => {
|
|
5228
5271
|
event.stopPropagation();
|
|
@@ -5252,7 +5295,7 @@ function KjunCopyButton({
|
|
|
5252
5295
|
KjunIcon,
|
|
5253
5296
|
{
|
|
5254
5297
|
name: copied ? "check" : "copy",
|
|
5255
|
-
size:
|
|
5298
|
+
size: tokens23.button.iconSizes[size],
|
|
5256
5299
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5257
5300
|
}
|
|
5258
5301
|
),
|
|
@@ -5326,14 +5369,14 @@ function KjunExternalLink({
|
|
|
5326
5369
|
onClick: (e) => e.stopPropagation(),
|
|
5327
5370
|
children: [
|
|
5328
5371
|
body,
|
|
5329
|
-
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size:
|
|
5372
|
+
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size: tokens23.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5330
5373
|
!name && /* @__PURE__ */ jsx25("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5331
5374
|
]
|
|
5332
5375
|
}
|
|
5333
5376
|
) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
|
|
5334
5377
|
}
|
|
5335
5378
|
function KjunScrollFade({ children }) {
|
|
5336
|
-
const ref =
|
|
5379
|
+
const ref = useRef26(null), [edges, setEdges] = useState21({ left: false, right: false });
|
|
5337
5380
|
const update = () => {
|
|
5338
5381
|
const el = ref.current;
|
|
5339
5382
|
if (el)
|
|
@@ -5354,7 +5397,7 @@ function KjunScrollFade({ children }) {
|
|
|
5354
5397
|
}
|
|
5355
5398
|
return () => observer.disconnect();
|
|
5356
5399
|
}, [children]);
|
|
5357
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5400
|
+
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${tokens23.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${tokens23.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
5358
5401
|
return /* @__PURE__ */ jsx25(
|
|
5359
5402
|
"div",
|
|
5360
5403
|
{
|
|
@@ -5369,7 +5412,7 @@ function KjunScrollFade({ children }) {
|
|
|
5369
5412
|
|
|
5370
5413
|
// packages/react/src/data-state.tsx
|
|
5371
5414
|
import {
|
|
5372
|
-
tokens as
|
|
5415
|
+
tokens as tokens24,
|
|
5373
5416
|
advanceQueryDisplay,
|
|
5374
5417
|
initialQueryDisplay,
|
|
5375
5418
|
queryDisplayStatus
|
|
@@ -5431,7 +5474,7 @@ function KjunDataState({
|
|
|
5431
5474
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5432
5475
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5433
5476
|
retryText != null ? retryText : retryText = m.retry;
|
|
5434
|
-
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 =
|
|
5477
|
+
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 = tokens24.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5435
5478
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5436
5479
|
/* @__PURE__ */ jsx26("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
5437
5480
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "xs" }),
|
|
@@ -5445,7 +5488,7 @@ function KjunDataState({
|
|
|
5445
5488
|
"aria-label": revealed ? loadingText : void 0,
|
|
5446
5489
|
"aria-hidden": revealed ? void 0 : true,
|
|
5447
5490
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5448
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap:
|
|
5491
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap: tokens24.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx26(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs18("div", { className: "kjun-data-loading", children: [
|
|
5449
5492
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "md" }),
|
|
5450
5493
|
/* @__PURE__ */ jsx26("p", { children: loadingText })
|
|
5451
5494
|
] }))
|
|
@@ -5458,7 +5501,7 @@ function KjunDataState({
|
|
|
5458
5501
|
"aria-hidden": concealed || void 0,
|
|
5459
5502
|
inert: concealed || void 0,
|
|
5460
5503
|
style: {
|
|
5461
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5504
|
+
opacity: query2.loading && !state.usesQueryState ? tokens24.states.opacity.pending : void 0
|
|
5462
5505
|
},
|
|
5463
5506
|
children
|
|
5464
5507
|
},
|
|
@@ -5500,7 +5543,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
5500
5543
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5501
5544
|
|
|
5502
5545
|
// packages/react/src/skeletons.tsx
|
|
5503
|
-
import { tokens as
|
|
5546
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
5504
5547
|
|
|
5505
5548
|
// shared/package-runtime/chart-skeleton.ts
|
|
5506
5549
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5517,11 +5560,11 @@ function chartSkeletonKind(kind) {
|
|
|
5517
5560
|
}
|
|
5518
5561
|
|
|
5519
5562
|
// packages/react/src/market-skeleton.tsx
|
|
5520
|
-
import { tokens as
|
|
5563
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
5521
5564
|
|
|
5522
5565
|
// shared/package-runtime/market-layout.ts
|
|
5523
|
-
import { tokens as
|
|
5524
|
-
var marketGeometry =
|
|
5566
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
5567
|
+
var marketGeometry = tokens25.extensions.marketTable;
|
|
5525
5568
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5526
5569
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5527
5570
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5562,26 +5605,26 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5562
5605
|
return /* @__PURE__ */ jsx28("div", { "aria-hidden": "true", className: "kjun-table-scroll", children: /* @__PURE__ */ jsxs20("table", { className: "kjun-market-table-grid", style: webMarketLayout(cols, showActions, widthClass).tableStyle, children: [
|
|
5563
5606
|
/* @__PURE__ */ jsx28(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5564
5607
|
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5565
|
-
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5608
|
+
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens26.extensions.marketTable.actionSkeletonWidth, height: tokens26.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5566
5609
|
cols.map((col, i) => /* @__PURE__ */ jsx28("th", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: col.label }, col.key || i))
|
|
5567
5610
|
] }) }),
|
|
5568
5611
|
/* @__PURE__ */ jsx28("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5569
|
-
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5612
|
+
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens26.extensions.marketTable.actionSkeletonWidth, height: tokens26.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5570
5613
|
cols.map((col, i) => /* @__PURE__ */ jsx28("td", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ jsxs20("div", { className: "kjun-market-skeleton-identity", children: [
|
|
5571
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5572
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5573
|
-
] }) : /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5614
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height: tokens26.extensions.skeleton.lineHeights.md }),
|
|
5615
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height: tokens26.extensions.skeleton.lineHeights.sm })
|
|
5616
|
+
] }) : /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens26.extensions.financial.priceSkeletonWidth, height: tokens26.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
5574
5617
|
] }, row)) })
|
|
5575
5618
|
] }) });
|
|
5576
5619
|
}
|
|
5577
5620
|
|
|
5578
5621
|
// packages/react/src/skeletons.tsx
|
|
5579
|
-
import { Fragment as
|
|
5622
|
+
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5580
5623
|
function KjunListSkeleton({
|
|
5581
5624
|
rows = 8,
|
|
5582
5625
|
variant = "market",
|
|
5583
5626
|
avatar = true,
|
|
5584
|
-
avatarSize =
|
|
5627
|
+
avatarSize = tokens27.extensions.skeleton.listAvatarSize,
|
|
5585
5628
|
quote = true
|
|
5586
5629
|
}) {
|
|
5587
5630
|
return /* @__PURE__ */ jsx29("div", { "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-row", "data-variant": variant, children: [
|
|
@@ -5591,15 +5634,15 @@ function KjunListSkeleton({
|
|
|
5591
5634
|
KjunSkeleton,
|
|
5592
5635
|
{
|
|
5593
5636
|
type: "block",
|
|
5594
|
-
height:
|
|
5637
|
+
height: tokens27.extensions.skeleton.lineHeights.md,
|
|
5595
5638
|
width: i % 2 ? "80%" : "65%"
|
|
5596
5639
|
}
|
|
5597
5640
|
),
|
|
5598
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5641
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens27.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5599
5642
|
] }),
|
|
5600
5643
|
quote && /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5601
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5602
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5644
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens27.extensions.skeleton.quoteHeight, width: tokens27.extensions.skeleton.quoteWidth }),
|
|
5645
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens27.extensions.skeleton.lineHeights.sm, width: tokens27.extensions.skeleton.detailWidth })
|
|
5603
5646
|
] })
|
|
5604
5647
|
] }, i)) });
|
|
5605
5648
|
}
|
|
@@ -5615,17 +5658,17 @@ function KjunFormSkeleton({
|
|
|
5615
5658
|
"aria-hidden": "true",
|
|
5616
5659
|
className: "kjun-form-skeleton",
|
|
5617
5660
|
"data-columns": columns,
|
|
5618
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5661
|
+
style: { "--_kjun-form-skeleton-radius": `${tokens27.input[size].radius}px` },
|
|
5619
5662
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
5620
5663
|
field ? /* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5621
5664
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5622
|
-
/* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5665
|
+
/* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens27.extensions.skeleton.formLabelHeight, width: tokens27.extensions.skeleton.formLabelWidth }) })
|
|
5623
5666
|
),
|
|
5624
5667
|
/* @__PURE__ */ jsx29(
|
|
5625
5668
|
KjunSkeleton,
|
|
5626
5669
|
{
|
|
5627
5670
|
type: "block",
|
|
5628
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5671
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? tokens27.input[size].lineHeight * 3 + tokens27.input[size].textareaPaddingY * 2 + 2 * tokens27.border.controlWidth : tokens27.input[size].height
|
|
5629
5672
|
}
|
|
5630
5673
|
)
|
|
5631
5674
|
] }, i))
|
|
@@ -5634,7 +5677,7 @@ function KjunFormSkeleton({
|
|
|
5634
5677
|
}
|
|
5635
5678
|
function KjunChartSkeleton({
|
|
5636
5679
|
kind: requestedKind = "frame",
|
|
5637
|
-
height =
|
|
5680
|
+
height = tokens27.extensions.chartSkeleton.height,
|
|
5638
5681
|
loadingText,
|
|
5639
5682
|
skeleton = true,
|
|
5640
5683
|
loadingDelay = 0,
|
|
@@ -5655,7 +5698,7 @@ function KjunChartSkeleton({
|
|
|
5655
5698
|
children: !skeleton ? /* @__PURE__ */ jsxs21("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
5656
5699
|
/* @__PURE__ */ jsx29("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29(KjunSpinner, { size: "md" }) }),
|
|
5657
5700
|
loadingText && /* @__PURE__ */ jsx29("p", { children: loadingText })
|
|
5658
|
-
] }) : /* @__PURE__ */ jsxs21(
|
|
5701
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
5659
5702
|
kind === "donut" ? /* @__PURE__ */ jsx29("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ jsx29(
|
|
5660
5703
|
"div",
|
|
5661
5704
|
{
|
|
@@ -5690,7 +5733,7 @@ function KjunChartSkeleton({
|
|
|
5690
5733
|
d: chartFramePath,
|
|
5691
5734
|
fill: "none",
|
|
5692
5735
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5693
|
-
strokeWidth:
|
|
5736
|
+
strokeWidth: tokens27.border.defaultWidth,
|
|
5694
5737
|
vectorEffect: "non-scaling-stroke"
|
|
5695
5738
|
}
|
|
5696
5739
|
)
|
|
@@ -5703,19 +5746,19 @@ function KjunChartSkeleton({
|
|
|
5703
5746
|
}
|
|
5704
5747
|
|
|
5705
5748
|
// packages/react/src/financial-display.tsx
|
|
5706
|
-
import { deviationLevel, tokens as
|
|
5749
|
+
import { deviationLevel, tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5707
5750
|
import {
|
|
5708
5751
|
useId as useId11
|
|
5709
5752
|
} from "react";
|
|
5710
5753
|
|
|
5711
5754
|
// packages/react/src/number-display.tsx
|
|
5712
|
-
import { tokens as
|
|
5755
|
+
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5713
5756
|
|
|
5714
5757
|
// shared/package-runtime/use-number-motion.ts
|
|
5715
|
-
import { useLayoutEffect as useLayoutEffect14, useRef as
|
|
5758
|
+
import { useLayoutEffect as useLayoutEffect14, useRef as useRef27, useState as useState24 } from "react";
|
|
5716
5759
|
|
|
5717
5760
|
// shared/package-runtime/number-motion.ts
|
|
5718
|
-
import { tokens as
|
|
5761
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5719
5762
|
function createNumberMotion(apply) {
|
|
5720
5763
|
let frame = 0, revision = 0, current = 0;
|
|
5721
5764
|
let previous;
|
|
@@ -5746,7 +5789,7 @@ function createNumberMotion(apply) {
|
|
|
5746
5789
|
if (from === target) return;
|
|
5747
5790
|
const tick = (now) => {
|
|
5748
5791
|
if (version !== revision) return;
|
|
5749
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5792
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens28.motion.number));
|
|
5750
5793
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5751
5794
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5752
5795
|
};
|
|
@@ -5759,7 +5802,7 @@ function createNumberMotion(apply) {
|
|
|
5759
5802
|
// shared/package-runtime/use-number-motion.ts
|
|
5760
5803
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5761
5804
|
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5762
|
-
const motion =
|
|
5805
|
+
const motion = useRef27(null);
|
|
5763
5806
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5764
5807
|
useLayoutEffect14(() => {
|
|
5765
5808
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
@@ -5774,7 +5817,7 @@ function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
|
5774
5817
|
}
|
|
5775
5818
|
|
|
5776
5819
|
// packages/react/src/number-display.tsx
|
|
5777
|
-
import { Fragment as
|
|
5820
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5778
5821
|
var finiteNumber = (value) => value == null || typeof value === "boolean" || typeof value === "string" && !value.trim() || !["number", "string"].includes(typeof value) || !Number.isFinite(Number(value)) ? null : Number(value) || 0;
|
|
5779
5822
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5780
5823
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5825,7 +5868,7 @@ function KjunPriceCell({
|
|
|
5825
5868
|
flashClass = "",
|
|
5826
5869
|
fromPrevious = true
|
|
5827
5870
|
}) {
|
|
5828
|
-
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height:
|
|
5871
|
+
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height: tokens29.extensions.financial.priceSkeletonHeight, width: tokens29.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs22(Fragment12, { children: [
|
|
5829
5872
|
/* @__PURE__ */ jsx30(
|
|
5830
5873
|
"span",
|
|
5831
5874
|
{
|
|
@@ -5873,7 +5916,7 @@ function KjunSignedValue({
|
|
|
5873
5916
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5874
5917
|
},
|
|
5875
5918
|
children: [
|
|
5876
|
-
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width:
|
|
5919
|
+
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width: tokens29.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5877
5920
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ jsx30(KjunFreshness, { stale: true })
|
|
5878
5921
|
]
|
|
5879
5922
|
}
|
|
@@ -5881,8 +5924,8 @@ function KjunSignedValue({
|
|
|
5881
5924
|
}
|
|
5882
5925
|
|
|
5883
5926
|
// packages/react/src/financial-display.tsx
|
|
5884
|
-
import { Fragment as
|
|
5885
|
-
var deviationFill = { neutral: 1, low:
|
|
5927
|
+
import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5928
|
+
var deviationFill = { neutral: 1, low: tokens30.states.opacity.deviationLow, medium: tokens30.states.opacity.deviationMedium, strong: tokens30.states.opacity.deviationStrong };
|
|
5886
5929
|
function KjunDeviation({
|
|
5887
5930
|
value,
|
|
5888
5931
|
variant = "pill",
|
|
@@ -5914,7 +5957,7 @@ function KjunDeviation({
|
|
|
5914
5957
|
KjunIcon,
|
|
5915
5958
|
{
|
|
5916
5959
|
name: "alert-triangle",
|
|
5917
|
-
size:
|
|
5960
|
+
size: tokens30.extensions.financial.warningIconSize,
|
|
5918
5961
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5919
5962
|
}
|
|
5920
5963
|
) })
|
|
@@ -5927,7 +5970,7 @@ function KjunDeviation({
|
|
|
5927
5970
|
className: "kjun-deviation",
|
|
5928
5971
|
ref: domainColorRef(!neutral),
|
|
5929
5972
|
"data-variant": variant,
|
|
5930
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
5973
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens30.typography.numberLg.fontWeight : tokens30.typography.control.fontWeight },
|
|
5931
5974
|
children: [
|
|
5932
5975
|
variant === "pill" && /* @__PURE__ */ jsx31(
|
|
5933
5976
|
"span",
|
|
@@ -5955,7 +5998,7 @@ function KjunHeatmapCell({
|
|
|
5955
5998
|
}) {
|
|
5956
5999
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5957
6000
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5958
|
-
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } =
|
|
6001
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = tokens30.states.opacity;
|
|
5959
6002
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5960
6003
|
/* @__PURE__ */ jsx31(
|
|
5961
6004
|
"span",
|
|
@@ -5974,7 +6017,7 @@ function KjunProgressCell({
|
|
|
5974
6017
|
showLabel = true,
|
|
5975
6018
|
color = "auto",
|
|
5976
6019
|
customColor,
|
|
5977
|
-
height =
|
|
6020
|
+
height = tokens30.extensions.financial.progressHeight
|
|
5978
6021
|
}) {
|
|
5979
6022
|
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;
|
|
5980
6023
|
return /* @__PURE__ */ jsxs23("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5998,7 +6041,7 @@ function KjunCollectionMark({
|
|
|
5998
6041
|
active = false,
|
|
5999
6042
|
size = "md"
|
|
6000
6043
|
}) {
|
|
6001
|
-
const box =
|
|
6044
|
+
const box = tokens30.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens30.extensions.financial.heartMarkSizes[size] : box;
|
|
6002
6045
|
return /* @__PURE__ */ jsx31(
|
|
6003
6046
|
KjunIcon,
|
|
6004
6047
|
{
|
|
@@ -6034,8 +6077,8 @@ function KjunExecutionStatusBadge({
|
|
|
6034
6077
|
}
|
|
6035
6078
|
function KjunSparkline({
|
|
6036
6079
|
data = [],
|
|
6037
|
-
width =
|
|
6038
|
-
height =
|
|
6080
|
+
width = tokens30.extensions.financial.sparklineWidth,
|
|
6081
|
+
height = tokens30.extensions.financial.sparklineHeight,
|
|
6039
6082
|
color,
|
|
6040
6083
|
semantic = "price",
|
|
6041
6084
|
fill = true,
|
|
@@ -6059,7 +6102,7 @@ function KjunSparkline({
|
|
|
6059
6102
|
"aria-hidden": !ariaLabel || void 0,
|
|
6060
6103
|
className: "kjun-sparkline",
|
|
6061
6104
|
children: [
|
|
6062
|
-
fill && values.length > 1 && /* @__PURE__ */ jsxs23(
|
|
6105
|
+
fill && values.length > 1 && /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
6063
6106
|
/* @__PURE__ */ jsx31("defs", { children: /* @__PURE__ */ jsxs23("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6064
6107
|
/* @__PURE__ */ jsx31("stop", { offset: "0%", stopColor: line, stopOpacity: 0.3 }),
|
|
6065
6108
|
/* @__PURE__ */ jsx31("stop", { offset: "100%", stopColor: line, stopOpacity: 0.05 })
|
|
@@ -6091,7 +6134,7 @@ function KjunSparkline({
|
|
|
6091
6134
|
|
|
6092
6135
|
// shared/package-runtime/table.ts
|
|
6093
6136
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
6094
|
-
import { useEffect as useEffect19, useRef as
|
|
6137
|
+
import { useEffect as useEffect19, useRef as useRef28, useState as useState25 } from "react";
|
|
6095
6138
|
|
|
6096
6139
|
// shared/package-runtime/table-model.ts
|
|
6097
6140
|
function getValue(row, key) {
|
|
@@ -6138,7 +6181,7 @@ function useTableModel(props) {
|
|
|
6138
6181
|
const [internalSort, setSort] = useState25({
|
|
6139
6182
|
key: "",
|
|
6140
6183
|
order: "asc"
|
|
6141
|
-
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer =
|
|
6184
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef28(void 0);
|
|
6142
6185
|
useEffect19(() => () => clearTimeout(timer.current), []);
|
|
6143
6186
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
6144
6187
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
@@ -6228,8 +6271,8 @@ function tableCellValue(props, column, row, index) {
|
|
|
6228
6271
|
}
|
|
6229
6272
|
|
|
6230
6273
|
// packages/react/src/table-toolbar.tsx
|
|
6231
|
-
import { tokens as
|
|
6232
|
-
import { Fragment as
|
|
6274
|
+
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
6275
|
+
import { Fragment as Fragment14, jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6233
6276
|
function TableToolbar({
|
|
6234
6277
|
selectable,
|
|
6235
6278
|
selected,
|
|
@@ -6243,7 +6286,7 @@ function TableToolbar({
|
|
|
6243
6286
|
toolbar
|
|
6244
6287
|
}) {
|
|
6245
6288
|
const m = useKjunMessages();
|
|
6246
|
-
return /* @__PURE__ */ jsxs24(
|
|
6289
|
+
return /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
6247
6290
|
selectable && selected.length > 0 && /* @__PURE__ */ jsxs24(
|
|
6248
6291
|
"div",
|
|
6249
6292
|
{
|
|
@@ -6271,7 +6314,7 @@ function TableToolbar({
|
|
|
6271
6314
|
KjunInput,
|
|
6272
6315
|
{
|
|
6273
6316
|
size: "sm",
|
|
6274
|
-
style: { width:
|
|
6317
|
+
style: { width: tokens31.table.searchWidth, maxWidth: "100%" },
|
|
6275
6318
|
value: search,
|
|
6276
6319
|
ariaLabel: m.searchTable,
|
|
6277
6320
|
placeholder: searchPlaceholder,
|
|
@@ -6287,22 +6330,16 @@ function TableToolbar({
|
|
|
6287
6330
|
}
|
|
6288
6331
|
|
|
6289
6332
|
// packages/react/src/table-grid.tsx
|
|
6290
|
-
import { tokens as
|
|
6291
|
-
import { Fragment as
|
|
6333
|
+
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6334
|
+
import { Fragment as Fragment15 } from "react";
|
|
6292
6335
|
|
|
6293
6336
|
// packages/react/src/table-check.tsx
|
|
6294
6337
|
import { forwardRef as forwardRef4 } from "react";
|
|
6295
|
-
|
|
6296
|
-
// shared/package-runtime/component-icons.ts
|
|
6297
|
-
import minus from "@kjun-ui/icons/icons/minus";
|
|
6298
|
-
var componentIcons = { minus };
|
|
6299
|
-
|
|
6300
|
-
// packages/react/src/table-check.tsx
|
|
6301
|
-
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
6338
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
6302
6339
|
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6303
6340
|
var TableCheck = forwardRef4(
|
|
6304
6341
|
function TableCheck2(props, ref) {
|
|
6305
|
-
const size =
|
|
6342
|
+
const size = tokens32.extensions.checkbox.iconSizes.sm;
|
|
6306
6343
|
return /* @__PURE__ */ jsx33(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs25("span", { className: "kjun-table-check", children: [
|
|
6307
6344
|
/* @__PURE__ */ jsx33("input", { ...props, ref, type: "checkbox" }),
|
|
6308
6345
|
/* @__PURE__ */ jsx33(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6359,7 +6396,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6359
6396
|
KjunIcon,
|
|
6360
6397
|
{
|
|
6361
6398
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6362
|
-
size:
|
|
6399
|
+
size: tokens33.table.sortIconSize
|
|
6363
6400
|
}
|
|
6364
6401
|
)
|
|
6365
6402
|
]
|
|
@@ -6372,14 +6409,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6372
6409
|
}
|
|
6373
6410
|
),
|
|
6374
6411
|
/* @__PURE__ */ jsx34("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsxs26("tr", { "aria-hidden": "true", children: [
|
|
6375
|
-
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height:
|
|
6412
|
+
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height: tokens33.table.selectionSize, width: tokens33.table.selectionSize }) }),
|
|
6376
6413
|
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell" }),
|
|
6377
6414
|
visible.map((col) => /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(
|
|
6378
6415
|
KjunSkeleton,
|
|
6379
6416
|
{
|
|
6380
6417
|
type: "block",
|
|
6381
|
-
height:
|
|
6382
|
-
width: col.key === "actions" ?
|
|
6418
|
+
height: tokens33.table.skeletonHeight,
|
|
6419
|
+
width: col.key === "actions" ? tokens33.table.actionColumnWidth : "75%"
|
|
6383
6420
|
}
|
|
6384
6421
|
) }, col.key))
|
|
6385
6422
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
@@ -6389,7 +6426,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6389
6426
|
className: "kjun-table-empty",
|
|
6390
6427
|
children: emptyContent || emptyText
|
|
6391
6428
|
}
|
|
6392
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(
|
|
6429
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(Fragment15, { children: [
|
|
6393
6430
|
/* @__PURE__ */ jsxs26(
|
|
6394
6431
|
"tr",
|
|
6395
6432
|
{
|
|
@@ -6534,7 +6571,7 @@ function TableCards({
|
|
|
6534
6571
|
|
|
6535
6572
|
// packages/react/src/table-view.tsx
|
|
6536
6573
|
import { useEffect as useEffect20, useState as useState26 } from "react";
|
|
6537
|
-
import { isComposingKey as isComposingKey4, tokens as
|
|
6574
|
+
import { isComposingKey as isComposingKey4, tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6538
6575
|
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6539
6576
|
function KjunTable(props) {
|
|
6540
6577
|
const m = useKjunMessages();
|
|
@@ -6566,7 +6603,7 @@ function KjunTable(props) {
|
|
|
6566
6603
|
} = props;
|
|
6567
6604
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
6568
6605
|
useEffect20(() => {
|
|
6569
|
-
const media = matchMedia(`(width < ${
|
|
6606
|
+
const media = matchMedia(`(width < ${tokens34.table.mobileBreakpoint}px)`);
|
|
6570
6607
|
const update = () => setMobile(media.matches);
|
|
6571
6608
|
update();
|
|
6572
6609
|
media.addEventListener("change", update);
|
|
@@ -6670,8 +6707,8 @@ function KjunTable(props) {
|
|
|
6670
6707
|
}
|
|
6671
6708
|
|
|
6672
6709
|
// packages/react/src/kpi.tsx
|
|
6673
|
-
import { tokens as
|
|
6674
|
-
import { Fragment as
|
|
6710
|
+
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6711
|
+
import { Fragment as Fragment16, jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6675
6712
|
var kpiFormat = (item, value = item.value) => {
|
|
6676
6713
|
var _a, _b;
|
|
6677
6714
|
return typeof value === "string" ? value : item.formatter ? item.formatter(value) : (item.showSign && value > 0 ? "+" : item.semantic === "price" && value < 0 ? "\u2212" : "") + new Intl.NumberFormat(void 0, {
|
|
@@ -6679,7 +6716,7 @@ var kpiFormat = (item, value = item.value) => {
|
|
|
6679
6716
|
maximumFractionDigits: (_b = item.decimals) != null ? _b : 0
|
|
6680
6717
|
}).format(item.semantic === "price" ? Math.abs(value) : value);
|
|
6681
6718
|
};
|
|
6682
|
-
var kpiColor = (value, semantic, neutral = "text") => semantic === "price" && Number(value) !== 0 ? `var(--_kjun-color-price-${Number(value) > 0 ? "up" : "down"})` : `var(--_kjun-color-${neutral})`;
|
|
6719
|
+
var kpiColor = (value, semantic, neutral = "text") => semantic === "price" && Number.isFinite(Number(value)) && Number(value) !== 0 ? `var(--_kjun-color-price-${Number(value) > 0 ? "up" : "down"})` : `var(--_kjun-color-${neutral})`;
|
|
6683
6720
|
function KjunKpiHero(props) {
|
|
6684
6721
|
const {
|
|
6685
6722
|
loading = false,
|
|
@@ -6703,7 +6740,7 @@ function KjunKpiHero(props) {
|
|
|
6703
6740
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6704
6741
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6705
6742
|
);
|
|
6706
|
-
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(
|
|
6743
|
+
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6707
6744
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6708
6745
|
kind === "absolute" && prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
6709
6746
|
new Intl.NumberFormat(void 0, {
|
|
@@ -6723,7 +6760,7 @@ function KjunKpiHero(props) {
|
|
|
6723
6760
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__layout", children: [
|
|
6724
6761
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__main", children: [
|
|
6725
6762
|
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__label", children: label }),
|
|
6726
|
-
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : /* @__PURE__ */ jsxs29(
|
|
6763
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6727
6764
|
prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
6728
6765
|
/* @__PURE__ */ jsx37(
|
|
6729
6766
|
KjunAnimatedNumber,
|
|
@@ -6738,8 +6775,8 @@ function KjunKpiHero(props) {
|
|
|
6738
6775
|
] }) }),
|
|
6739
6776
|
showDelta && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6740
6777
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6741
|
-
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width:
|
|
6742
|
-
) : /* @__PURE__ */ jsxs29(
|
|
6778
|
+
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: tokens35.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6779
|
+
) : /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6743
6780
|
deltaAbsolute !== null && /* @__PURE__ */ jsx37(
|
|
6744
6781
|
"span",
|
|
6745
6782
|
{
|
|
@@ -6776,7 +6813,7 @@ function KjunKpiHero(props) {
|
|
|
6776
6813
|
{
|
|
6777
6814
|
className: "kjun-kpi-hero__sec-value",
|
|
6778
6815
|
style: { color: kpiColor(item.value, item.semantic) },
|
|
6779
|
-
children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderSecondary == null ? void 0 : renderSecondary(item, i)) || /* @__PURE__ */ jsxs29(
|
|
6816
|
+
children: loading ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderSecondary == null ? void 0 : renderSecondary(item, i)) || /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6780
6817
|
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
6781
6818
|
/* @__PURE__ */ jsx37("span", { children: kpiFormat(item) }),
|
|
6782
6819
|
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
@@ -6847,11 +6884,11 @@ function KjunKpiRow({
|
|
|
6847
6884
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
6848
6885
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
6849
6886
|
var _a2, _b;
|
|
6850
|
-
return !item.loading && (item.semantic === "price" && Number(item.value) !== 0 || ((_b = (_a2 = item.badge) == null ? void 0 : _a2.variant) == null ? void 0 : _b.startsWith("price-")));
|
|
6887
|
+
return !item.loading && (item.semantic === "price" && Number.isFinite(Number(item.value)) && Number(item.value) !== 0 || ((_b = (_a2 = item.badge) == null ? void 0 : _a2.variant) == null ? void 0 : _b.startsWith("price-")));
|
|
6851
6888
|
})),
|
|
6852
6889
|
children: items.map((item, i) => {
|
|
6853
|
-
var _a2;
|
|
6854
|
-
const busy = loading || !!item.loading, click = () => {
|
|
6890
|
+
var _a2, _b;
|
|
6891
|
+
const busy = loading || !!item.loading, value = item.value, present = value != null && (typeof value !== "number" || Number.isFinite(value)), format2 = (number) => kpiFormat({ ...item, value: number }), click = () => {
|
|
6855
6892
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6856
6893
|
};
|
|
6857
6894
|
return /* @__PURE__ */ jsxs29(
|
|
@@ -6859,6 +6896,7 @@ function KjunKpiRow({
|
|
|
6859
6896
|
{
|
|
6860
6897
|
role: item.clickable ? "button" : void 0,
|
|
6861
6898
|
tabIndex: item.clickable && !busy ? 0 : void 0,
|
|
6899
|
+
"data-state": busy ? "loading" : present || item.valueSegments ? "ready" : "missing",
|
|
6862
6900
|
"aria-disabled": item.clickable && busy || void 0,
|
|
6863
6901
|
className: "kjun-kpi-row__item" + (item.clickable ? " kjun-kpi-row__item--clickable" : "") + (item.mobileFull ? " kjun-kpi-row__item--full" : "") + (mobileSummary && i === lastFull ? " kjun-kpi-row__item--summary-full" : "") + (secondary[i] ? " kjun-kpi-row__item--secondary" : "") + (((_a2 = item.valueSegments) == null ? void 0 : _a2.some((s) => s.label)) ? " kjun-kpi-row__item--labeled-segments" : ""),
|
|
6864
6902
|
onClick: click,
|
|
@@ -6870,7 +6908,7 @@ function KjunKpiRow({
|
|
|
6870
6908
|
},
|
|
6871
6909
|
children: [
|
|
6872
6910
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6873
|
-
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width:
|
|
6911
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width: tokens35.extensions.kpiRow.labelSkeletonWidth, height: tokens35.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6874
6912
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6875
6913
|
] }),
|
|
6876
6914
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6878,9 +6916,9 @@ function KjunKpiRow({
|
|
|
6878
6916
|
"div",
|
|
6879
6917
|
{
|
|
6880
6918
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
6881
|
-
title: item.valueKind === "text" ? String(
|
|
6919
|
+
title: item.valueKind === "text" && present ? String(value) : void 0,
|
|
6882
6920
|
style: {
|
|
6883
|
-
color: item.valueClass ? void 0 : kpiColor(
|
|
6921
|
+
color: item.valueClass ? void 0 : kpiColor(value, item.semantic)
|
|
6884
6922
|
},
|
|
6885
6923
|
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ jsxs29(
|
|
6886
6924
|
"span",
|
|
@@ -6892,18 +6930,18 @@ function KjunKpiRow({
|
|
|
6892
6930
|
]
|
|
6893
6931
|
},
|
|
6894
6932
|
j
|
|
6895
|
-
)) : busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || /* @__PURE__ */ jsxs29(
|
|
6933
|
+
)) : busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || (present ? /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6896
6934
|
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6897
|
-
item.animated && typeof
|
|
6935
|
+
item.animated && typeof value === "number" ? /* @__PURE__ */ jsx37(
|
|
6898
6936
|
KjunAnimatedNumber,
|
|
6899
6937
|
{
|
|
6900
6938
|
fromPrevious: true,
|
|
6901
|
-
value
|
|
6902
|
-
formatter:
|
|
6939
|
+
value,
|
|
6940
|
+
formatter: format2
|
|
6903
6941
|
}
|
|
6904
|
-
) :
|
|
6942
|
+
) : format2(value),
|
|
6905
6943
|
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6906
|
-
] })
|
|
6944
|
+
] }) : (_b = item.missingText) != null ? _b : "\u2014")
|
|
6907
6945
|
}
|
|
6908
6946
|
),
|
|
6909
6947
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
@@ -6913,7 +6951,7 @@ function KjunKpiRow({
|
|
|
6913
6951
|
{
|
|
6914
6952
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6915
6953
|
style: {
|
|
6916
|
-
color: item.descClass ? void 0 : kpiColor(
|
|
6954
|
+
color: item.descClass ? void 0 : kpiColor(value, item.semantic, "text-secondary")
|
|
6917
6955
|
},
|
|
6918
6956
|
children: busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6919
6957
|
}
|
|
@@ -6928,10 +6966,10 @@ function KjunKpiRow({
|
|
|
6928
6966
|
}
|
|
6929
6967
|
|
|
6930
6968
|
// packages/react/src/market-cards.tsx
|
|
6931
|
-
import { tokens as
|
|
6969
|
+
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6932
6970
|
|
|
6933
6971
|
// shared/package-runtime/market-cards.ts
|
|
6934
|
-
import { useEffect as useEffect21, useRef as
|
|
6972
|
+
import { useEffect as useEffect21, useRef as useRef29, useState as useState27 } from "react";
|
|
6935
6973
|
function useMarketCardsModel(props, persistence) {
|
|
6936
6974
|
const {
|
|
6937
6975
|
columns,
|
|
@@ -6948,7 +6986,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6948
6986
|
isDefaultSort: c.defaultSort
|
|
6949
6987
|
}));
|
|
6950
6988
|
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6951
|
-
const mounted =
|
|
6989
|
+
const mounted = useRef29("");
|
|
6952
6990
|
const save = (key2) => {
|
|
6953
6991
|
var _a;
|
|
6954
6992
|
try {
|
|
@@ -6993,14 +7031,14 @@ function useMarketCards(props) {
|
|
|
6993
7031
|
}
|
|
6994
7032
|
|
|
6995
7033
|
// packages/react/src/market-parts.tsx
|
|
6996
|
-
import { Fragment as
|
|
7034
|
+
import { Fragment as Fragment17, jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6997
7035
|
function MarketIdentity({
|
|
6998
7036
|
row,
|
|
6999
7037
|
props
|
|
7000
7038
|
}) {
|
|
7001
7039
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7002
7040
|
const label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
7003
|
-
const body = /* @__PURE__ */ jsxs30(
|
|
7041
|
+
const body = /* @__PURE__ */ jsxs30(Fragment17, { children: [
|
|
7004
7042
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
7005
7043
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-identity-text", children: [
|
|
7006
7044
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-name", children: [
|
|
@@ -7028,7 +7066,7 @@ function MarketFooter({
|
|
|
7028
7066
|
totalCount = 0,
|
|
7029
7067
|
unitLabel = m.unitLabel
|
|
7030
7068
|
} = props;
|
|
7031
|
-
return /* @__PURE__ */ jsxs30(
|
|
7069
|
+
return /* @__PURE__ */ jsxs30(Fragment17, { children: [
|
|
7032
7070
|
pagination && /* @__PURE__ */ jsx38(
|
|
7033
7071
|
KjunPagination,
|
|
7034
7072
|
{
|
|
@@ -7049,7 +7087,7 @@ function MarketFooter({
|
|
|
7049
7087
|
}
|
|
7050
7088
|
|
|
7051
7089
|
// packages/react/src/market-cards.tsx
|
|
7052
|
-
import { Fragment as
|
|
7090
|
+
import { Fragment as Fragment18, jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7053
7091
|
function KjunMarketCards(props) {
|
|
7054
7092
|
const m = useKjunMessages();
|
|
7055
7093
|
const {
|
|
@@ -7100,7 +7138,7 @@ function KjunMarketCards(props) {
|
|
|
7100
7138
|
selectedKey: state.key,
|
|
7101
7139
|
selectedPill: state.pill,
|
|
7102
7140
|
metricDisplay: display
|
|
7103
|
-
}) : /* @__PURE__ */ jsxs31(
|
|
7141
|
+
}) : /* @__PURE__ */ jsxs31(Fragment18, { children: [
|
|
7104
7142
|
/* @__PURE__ */ jsx39(
|
|
7105
7143
|
KjunDataState,
|
|
7106
7144
|
{
|
|
@@ -7136,10 +7174,10 @@ function KjunMarketCards(props) {
|
|
|
7136
7174
|
KjunSparkline,
|
|
7137
7175
|
{
|
|
7138
7176
|
data: getValue(row, state.key) || [],
|
|
7139
|
-
width:
|
|
7140
|
-
height:
|
|
7177
|
+
width: tokens36.extensions.marketTable.sparklineWidth,
|
|
7178
|
+
height: tokens36.extensions.marketTable.sparklineHeight
|
|
7141
7179
|
}
|
|
7142
|
-
) : state.pill ? /* @__PURE__ */ jsx39(
|
|
7180
|
+
) : state.pill ? /* @__PURE__ */ jsx39(Fragment18, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens36.extensions.marketTable.valueSkeletonHeight, width: tokens36.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx39(
|
|
7143
7181
|
KjunSignedValue,
|
|
7144
7182
|
{
|
|
7145
7183
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -7147,7 +7185,7 @@ function KjunMarketCards(props) {
|
|
|
7147
7185
|
stale: !!getValue(row, "stale"),
|
|
7148
7186
|
tone: "pill"
|
|
7149
7187
|
}
|
|
7150
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height:
|
|
7188
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens36.extensions.financial.priceSkeletonHeight, width: tokens36.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs31("div", { className: "kjun-market-metric", children: [
|
|
7151
7189
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
7152
7190
|
props,
|
|
7153
7191
|
row,
|
|
@@ -7170,7 +7208,7 @@ function KjunMarketCards(props) {
|
|
|
7170
7208
|
}
|
|
7171
7209
|
|
|
7172
7210
|
// packages/react/src/market-list.tsx
|
|
7173
|
-
import { tokens as
|
|
7211
|
+
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
7174
7212
|
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7175
7213
|
function KjunMarketSimpleList(props) {
|
|
7176
7214
|
const m = useKjunMessages();
|
|
@@ -7237,7 +7275,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7237
7275
|
fetchedAt
|
|
7238
7276
|
}
|
|
7239
7277
|
)),
|
|
7240
|
-
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height:
|
|
7278
|
+
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height: tokens37.extensions.marketList.changeSkeletonHeight, width: tokens37.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx40(
|
|
7241
7279
|
KjunSignedValue,
|
|
7242
7280
|
{
|
|
7243
7281
|
value: change,
|
|
@@ -7261,7 +7299,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7261
7299
|
}
|
|
7262
7300
|
|
|
7263
7301
|
// packages/react/src/market-panel.tsx
|
|
7264
|
-
import { tokens as
|
|
7302
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7265
7303
|
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7266
7304
|
function KjunMarketListPanel({
|
|
7267
7305
|
controls,
|
|
@@ -7269,12 +7307,12 @@ function KjunMarketListPanel({
|
|
|
7269
7307
|
}) {
|
|
7270
7308
|
return /* @__PURE__ */ jsxs33(KjunCard, { children: [
|
|
7271
7309
|
/* @__PURE__ */ jsx41("div", { children: controls }),
|
|
7272
|
-
/* @__PURE__ */ jsx41("div", { style: { marginTop:
|
|
7310
|
+
/* @__PURE__ */ jsx41("div", { style: { marginTop: tokens38.dimension.value16, borderTop: `${tokens38.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7273
7311
|
] });
|
|
7274
7312
|
}
|
|
7275
7313
|
|
|
7276
7314
|
// packages/react/src/market-table.tsx
|
|
7277
|
-
import { tokens as
|
|
7315
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7278
7316
|
|
|
7279
7317
|
// shared/package-runtime/trailing-overflow.ts
|
|
7280
7318
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7291,7 +7329,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7291
7329
|
}
|
|
7292
7330
|
|
|
7293
7331
|
// packages/react/src/market-table.tsx
|
|
7294
|
-
import { useEffect as useEffect22, useRef as
|
|
7332
|
+
import { useEffect as useEffect22, useRef as useRef30, useState as useState28 } from "react";
|
|
7295
7333
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7296
7334
|
function KjunMarketTable(props) {
|
|
7297
7335
|
const m = useKjunMessages();
|
|
@@ -7313,12 +7351,12 @@ function KjunMarketTable(props) {
|
|
|
7313
7351
|
formatMetric,
|
|
7314
7352
|
renderCell
|
|
7315
7353
|
} = props;
|
|
7316
|
-
const scroller =
|
|
7354
|
+
const scroller = useRef30(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
7317
7355
|
useEffect22(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7318
7356
|
const render = (row, col) => {
|
|
7319
7357
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7320
7358
|
if (cellLoading(row, col))
|
|
7321
|
-
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7359
|
+
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens39.extensions.marketTable.valueSkeletonHeight, width: tokens39.extensions.marketTable.valueSkeletonWidth });
|
|
7322
7360
|
if (renderCell) return renderCell(row, col);
|
|
7323
7361
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7324
7362
|
return /* @__PURE__ */ jsx42(MarketIdentity, { row, props });
|
|
@@ -7327,8 +7365,8 @@ function KjunMarketTable(props) {
|
|
|
7327
7365
|
KjunSparkline,
|
|
7328
7366
|
{
|
|
7329
7367
|
data: Array.isArray(value) ? value : [],
|
|
7330
|
-
width:
|
|
7331
|
-
height:
|
|
7368
|
+
width: tokens39.extensions.marketTable.sparklineWidth,
|
|
7369
|
+
height: tokens39.extensions.marketTable.sparklineHeight
|
|
7332
7370
|
}
|
|
7333
7371
|
);
|
|
7334
7372
|
if (col.type === "price")
|
|
@@ -7410,7 +7448,7 @@ function KjunMarketTable(props) {
|
|
|
7410
7448
|
KjunIcon,
|
|
7411
7449
|
{
|
|
7412
7450
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7413
|
-
size:
|
|
7451
|
+
size: tokens39.extensions.marketTable.sortIconSize
|
|
7414
7452
|
}
|
|
7415
7453
|
)
|
|
7416
7454
|
]
|
|
@@ -7470,7 +7508,7 @@ function KjunMarketTable(props) {
|
|
|
7470
7508
|
{
|
|
7471
7509
|
style: {
|
|
7472
7510
|
textAlign: col.align,
|
|
7473
|
-
fontWeight: col.weight === "bold" ?
|
|
7511
|
+
fontWeight: col.weight === "bold" ? tokens39.typography.control.fontWeight : void 0
|
|
7474
7512
|
},
|
|
7475
7513
|
children: [
|
|
7476
7514
|
render(row, col),
|
|
@@ -7503,26 +7541,27 @@ function KjunMarketTable(props) {
|
|
|
7503
7541
|
}
|
|
7504
7542
|
|
|
7505
7543
|
// packages/react/src/list.tsx
|
|
7506
|
-
import { tokens as
|
|
7507
|
-
import { useEffect as useEffect23, useId as useId12, useRef as
|
|
7508
|
-
import { Fragment as
|
|
7509
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7510
|
-
const content =
|
|
7544
|
+
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
7545
|
+
import { useEffect as useEffect23, useId as useId12, useRef as useRef31 } from "react";
|
|
7546
|
+
import { Fragment as Fragment19, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7547
|
+
function KjunListRow({ title, description, icon, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7548
|
+
const content = useRef31(null), pressable = !!(href || onClick);
|
|
7511
7549
|
useEffect23(() => {
|
|
7512
7550
|
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7513
7551
|
}, [pressable]);
|
|
7514
|
-
const
|
|
7515
|
-
|
|
7552
|
+
const front = leading || (icon ? /* @__PURE__ */ jsx43(KjunIcon, { name: icon, className: "kjun-list-icon", size: tokens40.extensions.list.iconSize }) : null);
|
|
7553
|
+
const contents = /* @__PURE__ */ jsxs35(Fragment19, { children: [
|
|
7554
|
+
front && /* @__PURE__ */ jsx43("span", { className: "kjun-list-leading", children: front }),
|
|
7516
7555
|
/* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
|
|
7517
7556
|
/* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
|
|
7518
7557
|
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description }),
|
|
7519
7558
|
hasContent(children) && /* @__PURE__ */ jsx43("span", { ref: content, className: "kjun-list-content", children })
|
|
7520
7559
|
] }),
|
|
7521
7560
|
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7522
|
-
chevron && /* @__PURE__ */ jsx43(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size:
|
|
7561
|
+
chevron && /* @__PURE__ */ jsx43(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: tokens40.iconSizes.default })
|
|
7523
7562
|
] });
|
|
7524
7563
|
const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-label": ariaLabel, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
|
|
7525
|
-
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7564
|
+
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", "data-leading": front ? "" : void 0, "data-destructive": destructive || void 0, children: [
|
|
7526
7565
|
main,
|
|
7527
7566
|
actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7528
7567
|
] });
|
|
@@ -7539,7 +7578,7 @@ function KjunListSection({ title, description, actions, children, ariaLabel, sur
|
|
|
7539
7578
|
"aria-labelledby": title ? id : void 0,
|
|
7540
7579
|
"aria-label": title ? void 0 : ariaLabel,
|
|
7541
7580
|
children: [
|
|
7542
|
-
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
|
|
7581
|
+
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", "data-bare": title && !description ? "" : void 0, children: [
|
|
7543
7582
|
/* @__PURE__ */ jsxs35("div", { children: [
|
|
7544
7583
|
title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
|
|
7545
7584
|
description && /* @__PURE__ */ jsx43("p", { children: description })
|
|
@@ -7556,10 +7595,10 @@ function KjunListItem({ children }) {
|
|
|
7556
7595
|
}
|
|
7557
7596
|
|
|
7558
7597
|
// packages/react/src/app-navigation.tsx
|
|
7559
|
-
import { tokens as
|
|
7598
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7560
7599
|
import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7561
|
-
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7562
|
-
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value:
|
|
7600
|
+
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0, surface = true }) {
|
|
7601
|
+
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value: tokens41.extensions.topNavigation, children: /* @__PURE__ */ jsx44("header", { className: "kjun-top-navigation", "data-surface": surface ? void 0 : "false", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-content", children: [
|
|
7563
7602
|
leading && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7564
7603
|
/* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-title", children: [
|
|
7565
7604
|
/* @__PURE__ */ jsx44("strong", { children: title }),
|
|
@@ -7568,19 +7607,19 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
7568
7607
|
actions && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children: actions })
|
|
7569
7608
|
] }) }) });
|
|
7570
7609
|
}
|
|
7571
|
-
function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
7610
|
+
function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate, surface = true }) {
|
|
7572
7611
|
const m = useKjunMessages();
|
|
7573
7612
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
7574
7613
|
const hasIcons = items.some((item) => item.icon);
|
|
7575
7614
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7576
|
-
return /* @__PURE__ */ jsx44("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
7615
|
+
return /* @__PURE__ */ jsx44("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "data-surface": surface ? void 0 : "false", "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
7577
7616
|
const badge = item.badge != null && /* @__PURE__ */ jsx44("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
7578
7617
|
return /* @__PURE__ */ jsxs36("a", { href: item.disabled ? void 0 : item.href, "aria-label": item.label + (item.badge != null ? ", " + item.badge : ""), "aria-disabled": item.disabled || void 0, "aria-current": value === item.key ? "page" : void 0, onClick: (event) => {
|
|
7579
7618
|
if (item.disabled) event.preventDefault();
|
|
7580
7619
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7581
7620
|
}, children: [
|
|
7582
7621
|
hasIcons && /* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-icon", children: [
|
|
7583
|
-
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size:
|
|
7622
|
+
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size: tokens41.extensions.bottomNavigation.iconSize }),
|
|
7584
7623
|
badge
|
|
7585
7624
|
] }),
|
|
7586
7625
|
/* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7590,20 +7629,20 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7590
7629
|
] }, item.key);
|
|
7591
7630
|
}) });
|
|
7592
7631
|
}
|
|
7593
|
-
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7632
|
+
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false, surface = true }) {
|
|
7594
7633
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7595
|
-
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7634
|
+
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", "data-surface": surface ? void 0 : "false", style: { paddingBottom: tokens41.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-bottom-action-content", children: [
|
|
7596
7635
|
description && /* @__PURE__ */ jsx44("p", { children: description }),
|
|
7597
7636
|
/* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children })
|
|
7598
7637
|
] }) });
|
|
7599
7638
|
}
|
|
7600
7639
|
|
|
7601
7640
|
// packages/react/src/media.tsx
|
|
7602
|
-
import { useRef as
|
|
7603
|
-
import { tokens as
|
|
7641
|
+
import { useRef as useRef32, useState as useState29 } from "react";
|
|
7642
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7604
7643
|
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7605
7644
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7606
|
-
const current =
|
|
7645
|
+
const current = useRef32({ src, version: 0 });
|
|
7607
7646
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7608
7647
|
const version = current.current.version;
|
|
7609
7648
|
const [result, setResult] = useState29({ version, state: "loading" });
|
|
@@ -7619,28 +7658,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7619
7658
|
setResult({ version, state: "error" });
|
|
7620
7659
|
onError == null ? void 0 : onError();
|
|
7621
7660
|
} }, version),
|
|
7622
|
-
failed && /* @__PURE__ */ jsx45("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__ */ jsx45(KjunIcon, { name: "image", size:
|
|
7661
|
+
failed && /* @__PURE__ */ jsx45("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__ */ jsx45(KjunIcon, { name: "image", size: tokens42.extensions.image.fallbackIconSize }) })
|
|
7623
7662
|
] });
|
|
7624
7663
|
}
|
|
7625
7664
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7626
7665
|
const m = useKjunMessages();
|
|
7627
|
-
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7666
|
+
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: tokens42.extensions.avatar[size], height: tokens42.extensions.avatar[size], ["--_kjun-avatar-color"]: color, ["--_kjun-avatar-text-color"]: textColor }, children: /* @__PURE__ */ jsx45(KjunImage, { src, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ jsx45(KjunIcon, { name: "user", size: tokens42.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7628
7667
|
}
|
|
7629
7668
|
|
|
7630
7669
|
// packages/react/src/chip.tsx
|
|
7631
|
-
import { tokens as
|
|
7670
|
+
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7632
7671
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7633
7672
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7634
7673
|
const m = useKjunMessages();
|
|
7635
7674
|
return /* @__PURE__ */ jsxs38("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7636
|
-
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size:
|
|
7675
|
+
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size: tokens43.extensions.chip.iconSizes[size] }),
|
|
7637
7676
|
/* @__PURE__ */ jsx46("span", { children: label }),
|
|
7638
|
-
removable && /* @__PURE__ */ jsx46("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(KjunIcon, { name: "x", size:
|
|
7677
|
+
removable && /* @__PURE__ */ jsx46("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(KjunIcon, { name: "x", size: tokens43.extensions.chip.removeIconSizes[size] }) })
|
|
7639
7678
|
] });
|
|
7640
7679
|
}
|
|
7641
7680
|
|
|
7642
7681
|
// packages/react/src/fab.tsx
|
|
7643
|
-
import { tokens as
|
|
7682
|
+
import { tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7644
7683
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7645
7684
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7646
7685
|
return /* @__PURE__ */ jsx47(
|
|
@@ -7651,26 +7690,36 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7651
7690
|
"aria-label": ariaLabel,
|
|
7652
7691
|
disabled,
|
|
7653
7692
|
onClick,
|
|
7654
|
-
style: { bottom:
|
|
7655
|
-
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size:
|
|
7693
|
+
style: { bottom: tokens44.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7694
|
+
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size: tokens44.extensions.fab.iconSize })
|
|
7656
7695
|
}
|
|
7657
7696
|
);
|
|
7658
7697
|
}
|
|
7659
7698
|
|
|
7660
7699
|
// packages/react/src/range-input.tsx
|
|
7661
|
-
import { useEffect as useEffect24, useRef as
|
|
7662
|
-
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
7700
|
+
import { useContext as useContext16, useEffect as useEffect24, useLayoutEffect as useLayoutEffect15, useRef as useRef33 } from "react";
|
|
7701
|
+
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput, SliderStateContext } from "react-aria-components";
|
|
7663
7702
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
7664
|
-
import { Fragment as
|
|
7665
|
-
function
|
|
7703
|
+
import { Fragment as Fragment20, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7704
|
+
function RangeThumb({ index, label, formatValue }) {
|
|
7705
|
+
const state = useContext16(SliderStateContext);
|
|
7706
|
+
const input = useRef33(null);
|
|
7707
|
+
const text = formatValue ? formatValue(state.values[index]) : state.getThumbValueLabel(index);
|
|
7708
|
+
useLayoutEffect15(() => {
|
|
7709
|
+
var _a;
|
|
7710
|
+
(_a = input.current) == null ? void 0 : _a.setAttribute("aria-valuetext", text);
|
|
7711
|
+
});
|
|
7712
|
+
return /* @__PURE__ */ jsx48(SliderThumb, { index, inputRef: input, className: "kjun-slider-thumb", "aria-label": label });
|
|
7713
|
+
}
|
|
7714
|
+
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, showValue = true, formatValue, onValueChange, onChangeCommit, ...rest }) {
|
|
7666
7715
|
const m = useKjunMessages();
|
|
7667
7716
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7668
7717
|
const domain = createSliderDomain(min, max, step);
|
|
7669
7718
|
const list = Array.isArray(value) ? value : [value];
|
|
7670
7719
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7671
|
-
const latest =
|
|
7720
|
+
const latest = useRef33(value);
|
|
7672
7721
|
latest.current = value;
|
|
7673
|
-
const active =
|
|
7722
|
+
const active = useRef33(false);
|
|
7674
7723
|
useEffect24(() => {
|
|
7675
7724
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7676
7725
|
}, [valid]);
|
|
@@ -7689,14 +7738,14 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7689
7738
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7690
7739
|
}
|
|
7691
7740
|
}, children: [
|
|
7692
|
-
/* @__PURE__ */ jsxs39("div", { className: "kjun-slider-caption", children: [
|
|
7741
|
+
(label || showValue) && /* @__PURE__ */ jsxs39("div", { className: "kjun-slider-caption", children: [
|
|
7693
7742
|
label && /* @__PURE__ */ jsx48(Label, { className: "kjun-slider-label", children: label }),
|
|
7694
|
-
/* @__PURE__ */ jsx48(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.join(" \u2013 ") })
|
|
7743
|
+
showValue && /* @__PURE__ */ jsx48(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.map(formatValue != null ? formatValue : String).join(" \u2013 ") })
|
|
7695
7744
|
] }),
|
|
7696
|
-
/* @__PURE__ */ jsx48(SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ jsxs39(
|
|
7745
|
+
/* @__PURE__ */ jsx48(SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ jsxs39(Fragment20, { children: [
|
|
7697
7746
|
/* @__PURE__ */ jsx48("div", { className: "kjun-slider-rail" }),
|
|
7698
7747
|
/* @__PURE__ */ jsx48("div", { className: "kjun-slider-fill", style: { left: (list.length === 2 ? state.getThumbPercent(0) * 100 : 0) + "%", width: (state.getThumbPercent(list.length - 1) - (list.length === 2 ? state.getThumbPercent(0) : 0)) * 100 + "%" } }),
|
|
7699
|
-
list.map((_, i) => /* @__PURE__ */ jsx48(
|
|
7748
|
+
list.map((_, i) => /* @__PURE__ */ jsx48(RangeThumb, { index: i, formatValue, label: list.length === 2 ? thumbLabels[i] : ariaLabel || label || m.value }, i))
|
|
7700
7749
|
] }) })
|
|
7701
7750
|
] });
|
|
7702
7751
|
}
|
|
@@ -7708,18 +7757,18 @@ function KjunRangeSlider(props) {
|
|
|
7708
7757
|
}
|
|
7709
7758
|
|
|
7710
7759
|
// packages/react/src/quantity-stepper.tsx
|
|
7711
|
-
import { useEffect as useEffect25, useRef as
|
|
7712
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
7760
|
+
import { useEffect as useEffect25, useRef as useRef34, useState as useState30 } from "react";
|
|
7761
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens45 } from "@kjun-ui/tokens";
|
|
7713
7762
|
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7714
7763
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7715
7764
|
const m = useKjunMessages();
|
|
7716
|
-
const geometry =
|
|
7717
|
-
const buttonStyle = { width:
|
|
7765
|
+
const geometry = tokens45.extensions.compound;
|
|
7766
|
+
const buttonStyle = { width: tokens45.input[size].height, padding: 0 };
|
|
7718
7767
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
7719
7768
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7720
7769
|
const [draft, setDraft] = useState30(String(value));
|
|
7721
7770
|
const field = useKjunField();
|
|
7722
|
-
const composing =
|
|
7771
|
+
const composing = useRef34(false), dirty = useRef34(false), accepted = useRef34(value);
|
|
7723
7772
|
useEffect25(() => {
|
|
7724
7773
|
setDraft(String(value));
|
|
7725
7774
|
accepted.current = value;
|
|
@@ -7800,13 +7849,13 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7800
7849
|
}
|
|
7801
7850
|
|
|
7802
7851
|
// packages/react/src/time-picker.tsx
|
|
7803
|
-
import { Fragment as
|
|
7852
|
+
import { Fragment as Fragment21, useEffect as useEffect26, useId as useId13, useMemo as useMemo3, useRef as useRef35 } from "react";
|
|
7804
7853
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
7805
7854
|
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7806
7855
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7807
7856
|
const m = useKjunMessages();
|
|
7808
7857
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7809
|
-
const root =
|
|
7858
|
+
const root = useRef35(null);
|
|
7810
7859
|
const field = useKjunField(), uid = useId13();
|
|
7811
7860
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7812
7861
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
@@ -7825,7 +7874,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7825
7874
|
/* @__PURE__ */ jsx50(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ jsx50("div", { className: "kjun-time-segments", children: [m.hour, m.minute, m.second].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
7826
7875
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7827
7876
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7828
|
-
return /* @__PURE__ */ jsxs41(
|
|
7877
|
+
return /* @__PURE__ */ jsxs41(Fragment21, { children: [
|
|
7829
7878
|
index > 0 && /* @__PURE__ */ jsx50("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7830
7879
|
/* @__PURE__ */ jsx50(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ jsxs41("div", { className: "kjun-time-segment", children: [
|
|
7831
7880
|
/* @__PURE__ */ jsx50("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|