@kjun-ui/react 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +524 -408
- package/dist/index.js +644 -527
- package/dist/styles.css +99 -32
- package/dist/types/packages/react/src/app-navigation.d.cts +9 -3
- package/dist/types/packages/react/src/app-navigation.d.ts +9 -3
- package/dist/types/packages/react/src/controls.d.cts +3 -1
- package/dist/types/packages/react/src/controls.d.ts +3 -1
- package/dist/types/packages/react/src/display.d.cts +5 -2
- package/dist/types/packages/react/src/display.d.ts +5 -2
- package/dist/types/packages/react/src/floating-panel.d.cts +5 -1
- package/dist/types/packages/react/src/floating-panel.d.ts +5 -1
- package/dist/types/packages/react/src/kpi.d.cts +6 -2
- package/dist/types/packages/react/src/kpi.d.ts +6 -2
- package/dist/types/packages/react/src/list.d.cts +7 -2
- package/dist/types/packages/react/src/list.d.ts +7 -2
- package/dist/types/packages/react/src/media.d.cts +1 -1
- package/dist/types/packages/react/src/media.d.ts +1 -1
- package/dist/types/packages/react/src/navigation.d.cts +5 -1
- package/dist/types/packages/react/src/navigation.d.ts +5 -1
- package/dist/types/packages/react/src/popover.d.cts +12 -3
- package/dist/types/packages/react/src/popover.d.ts +12 -3
- package/dist/types/packages/react/src/range-input.d.cts +4 -0
- package/dist/types/packages/react/src/range-input.d.ts +4 -0
- package/dist/types/shared/package-runtime/alert-exit.d.cts +5 -0
- package/dist/types/shared/package-runtime/alert-exit.d.ts +5 -0
- package/dist/types/shared/package-runtime/alert-tone.d.cts +11 -0
- package/dist/types/shared/package-runtime/alert-tone.d.ts +11 -0
- package/dist/types/shared/package-runtime/anchor-rect.d.cts +17 -0
- package/dist/types/shared/package-runtime/anchor-rect.d.ts +17 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +10 -4
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +10 -4
- package/dist/types/shared/package-runtime/progress-circle.d.cts +5 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.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({
|
|
@@ -3031,12 +3041,14 @@ function FloatingPanel({
|
|
|
3031
3041
|
flip = true,
|
|
3032
3042
|
nonModal = false,
|
|
3033
3043
|
ownsDismiss = false,
|
|
3034
|
-
returnFocus
|
|
3044
|
+
returnFocus,
|
|
3045
|
+
repositionKey = 0,
|
|
3046
|
+
inside
|
|
3035
3047
|
}) {
|
|
3036
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3048
|
+
const motion = usePresence(open, useReducedMotion(), tokens15.motion.popupExit);
|
|
3037
3049
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
3038
3050
|
const container = useKjunPortalContainer();
|
|
3039
|
-
const panel =
|
|
3051
|
+
const panel = useRef16(null);
|
|
3040
3052
|
useEffect7(() => {
|
|
3041
3053
|
var _a;
|
|
3042
3054
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
@@ -3066,12 +3078,17 @@ function FloatingPanel({
|
|
|
3066
3078
|
if (next) onOpenChange(next);
|
|
3067
3079
|
} : onOpenChange,
|
|
3068
3080
|
triggerRef,
|
|
3081
|
+
shouldCloseOnInteractOutside: inside ? (element) => {
|
|
3082
|
+
var _a;
|
|
3083
|
+
return !((_a = inside.current) == null ? void 0 : _a.contains(element));
|
|
3084
|
+
} : void 0,
|
|
3069
3085
|
UNSTABLE_portalContainer: container,
|
|
3070
3086
|
placement: placement.replace("-", " "),
|
|
3071
3087
|
shouldFlip: flip,
|
|
3072
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3073
|
-
offset: field ?
|
|
3074
|
-
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,
|
|
3091
|
+
crossOffset: repositionKey % 2 ? 1e-3 : 0,
|
|
3075
3092
|
className: "kjun-scope kjun-floating " + className,
|
|
3076
3093
|
"data-motion": "popup",
|
|
3077
3094
|
"data-motion-open": String(motion.active),
|
|
@@ -3086,10 +3103,35 @@ function FloatingPanel({
|
|
|
3086
3103
|
}
|
|
3087
3104
|
var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
|
|
3088
3105
|
|
|
3106
|
+
// shared/package-runtime/anchor-rect.ts
|
|
3107
|
+
function place(element, rect) {
|
|
3108
|
+
var _a, _b;
|
|
3109
|
+
const next = [rect.x, rect.y, (_a = rect.width) != null ? _a : 0, (_b = rect.height) != null ? _b : 0].map((value) => value + "px");
|
|
3110
|
+
const style = element.style;
|
|
3111
|
+
if (style.left === next[0] && style.top === next[1] && style.width === next[2] && style.height === next[3]) return false;
|
|
3112
|
+
[style.left, style.top, style.width, style.height] = next;
|
|
3113
|
+
return true;
|
|
3114
|
+
}
|
|
3115
|
+
function followAnchor(element, source, moved) {
|
|
3116
|
+
let frame = 0, stopped = false;
|
|
3117
|
+
const step = () => {
|
|
3118
|
+
const current = source();
|
|
3119
|
+
const rect = typeof current === "function" ? current() : current;
|
|
3120
|
+
if (rect && place(element, rect)) moved();
|
|
3121
|
+
if (!stopped && typeof current === "function") frame = requestAnimationFrame(step);
|
|
3122
|
+
};
|
|
3123
|
+
step();
|
|
3124
|
+
return () => {
|
|
3125
|
+
stopped = true;
|
|
3126
|
+
cancelAnimationFrame(frame);
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidden" };
|
|
3130
|
+
|
|
3089
3131
|
// packages/react/src/popover.tsx
|
|
3090
|
-
import { tokens as
|
|
3091
|
-
import { useCallback as useCallback4, useEffect as useEffect8, useId as useId6, useRef as
|
|
3092
|
-
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";
|
|
3093
3135
|
|
|
3094
3136
|
// shared/package-runtime/popover-nonmodal.ts
|
|
3095
3137
|
var tabbableSelector = 'button,input,select,textarea,[href],[tabindex]:not([tabindex="-1"])';
|
|
@@ -3151,7 +3193,16 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
3151
3193
|
}
|
|
3152
3194
|
|
|
3153
3195
|
// packages/react/src/popover.tsx
|
|
3154
|
-
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
|
+
}
|
|
3155
3206
|
function KjunPopover({
|
|
3156
3207
|
noPadding = false,
|
|
3157
3208
|
open: controlled,
|
|
@@ -3166,23 +3217,35 @@ function KjunPopover({
|
|
|
3166
3217
|
returnFocus,
|
|
3167
3218
|
header,
|
|
3168
3219
|
modal = true,
|
|
3220
|
+
anchorRect,
|
|
3169
3221
|
trigger,
|
|
3170
3222
|
children
|
|
3171
3223
|
}) {
|
|
3172
3224
|
const m = useKjunMessages();
|
|
3173
|
-
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();
|
|
3174
3226
|
const expanded = usePopupExpanded(open, ref);
|
|
3175
|
-
const focusOnMount =
|
|
3227
|
+
const focusOnMount = useRef17(focusOnOpen);
|
|
3176
3228
|
focusOnMount.current = focusOnOpen;
|
|
3177
3229
|
const focusContent = useCallback4((node) => {
|
|
3178
3230
|
if (node && focusOnMount.current) node.focus();
|
|
3179
3231
|
}, []);
|
|
3180
3232
|
const resolveReturn = resolveFocusReturn(returnFocus);
|
|
3233
|
+
const anchor = useRef17(null), anchorSource = useRef17(anchorRect), opener = useRef17(null);
|
|
3234
|
+
anchorSource.current = anchorRect;
|
|
3235
|
+
const [reposition, setReposition] = useState10(0);
|
|
3236
|
+
const anchored = anchorRect !== void 0;
|
|
3237
|
+
const wasOpen = useRef17(false);
|
|
3238
|
+
if (open && !wasOpen.current && typeof document !== "undefined") opener.current = document.activeElement;
|
|
3239
|
+
wasOpen.current = open;
|
|
3240
|
+
useLayoutEffect10(() => {
|
|
3241
|
+
if (!open || !anchored || !anchor.current) return;
|
|
3242
|
+
return followAnchor(anchor.current, () => anchorSource.current, () => setReposition((n) => n + 1));
|
|
3243
|
+
}, [open, anchored, typeof anchorRect === "function" ? anchorRect : anchorRect && `${anchorRect.x},${anchorRect.y},${anchorRect.width},${anchorRect.height}`]);
|
|
3181
3244
|
const change = (v) => {
|
|
3182
3245
|
setInternal(v);
|
|
3183
3246
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3184
3247
|
};
|
|
3185
|
-
const skipReturn =
|
|
3248
|
+
const skipReturn = useRef17(false);
|
|
3186
3249
|
useEffect8(() => {
|
|
3187
3250
|
if (!open || modal) return;
|
|
3188
3251
|
skipReturn.current = false;
|
|
@@ -3199,13 +3262,15 @@ function KjunPopover({
|
|
|
3199
3262
|
});
|
|
3200
3263
|
});
|
|
3201
3264
|
const content = /* @__PURE__ */ jsx16("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
3202
|
-
return /* @__PURE__ */ jsxs10(
|
|
3203
|
-
/* @__PURE__ */ jsx16(
|
|
3265
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3266
|
+
anchored && /* @__PURE__ */ jsx16("div", { ref: anchor, "aria-hidden": "true", style: anchorStyle }),
|
|
3267
|
+
(!anchored || trigger != null) && /* @__PURE__ */ jsx16(
|
|
3204
3268
|
"div",
|
|
3205
3269
|
{
|
|
3206
3270
|
ref,
|
|
3207
3271
|
className: "kjun-layer-trigger",
|
|
3208
|
-
onClickCapture: () => {
|
|
3272
|
+
onClickCapture: (event) => {
|
|
3273
|
+
if (event.target.closest('button:disabled, [aria-disabled="true"]')) return;
|
|
3209
3274
|
if (!manualTrigger) change(!open);
|
|
3210
3275
|
},
|
|
3211
3276
|
onKeyDown: (event) => {
|
|
@@ -3214,10 +3279,11 @@ function KjunPopover({
|
|
|
3214
3279
|
change(!open);
|
|
3215
3280
|
}
|
|
3216
3281
|
},
|
|
3217
|
-
"
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
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
|
+
})
|
|
3221
3287
|
}
|
|
3222
3288
|
),
|
|
3223
3289
|
/* @__PURE__ */ jsx16(
|
|
@@ -3225,13 +3291,18 @@ function KjunPopover({
|
|
|
3225
3291
|
{
|
|
3226
3292
|
open,
|
|
3227
3293
|
onOpenChange: change,
|
|
3228
|
-
triggerRef: ref,
|
|
3294
|
+
triggerRef: anchored ? anchor : ref,
|
|
3295
|
+
inside: anchored ? ref : void 0,
|
|
3296
|
+
repositionKey: reposition,
|
|
3229
3297
|
className: "kjun-content-popover" + (header != null ? " kjun-popover-has-header" : ""),
|
|
3230
3298
|
placement,
|
|
3231
3299
|
matchTriggerWidth,
|
|
3232
3300
|
maxHeight,
|
|
3233
3301
|
flip,
|
|
3234
|
-
returnFocus: () =>
|
|
3302
|
+
returnFocus: () => {
|
|
3303
|
+
var _a;
|
|
3304
|
+
return skipReturn.current ? false : (_a = resolveReturn == null ? void 0 : resolveReturn()) != null ? _a : anchored && trigger == null ? opener.current : void 0;
|
|
3305
|
+
},
|
|
3235
3306
|
nonModal: !modal,
|
|
3236
3307
|
ownsDismiss: !modal,
|
|
3237
3308
|
children: (() => {
|
|
@@ -3240,9 +3311,9 @@ function KjunPopover({
|
|
|
3240
3311
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3241
3312
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3242
3313
|
className: "kjun-popover-dialog",
|
|
3243
|
-
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" }
|
|
3244
3315
|
};
|
|
3245
|
-
const body = /* @__PURE__ */ jsxs10(
|
|
3316
|
+
const body = /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3246
3317
|
header != null && /* @__PURE__ */ jsx16("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
3247
3318
|
header != null ? /* @__PURE__ */ jsx16("div", { className: "kjun-popover-body", children: content }) : content,
|
|
3248
3319
|
/* @__PURE__ */ jsx16(FeedbackLayerOutlet, {})
|
|
@@ -3253,8 +3324,16 @@ function KjunPopover({
|
|
|
3253
3324
|
)
|
|
3254
3325
|
] });
|
|
3255
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
|
+
}
|
|
3256
3332
|
function KjunTooltip({
|
|
3257
3333
|
content = "",
|
|
3334
|
+
title,
|
|
3335
|
+
align,
|
|
3336
|
+
width,
|
|
3258
3337
|
placement = "top",
|
|
3259
3338
|
delay = 0,
|
|
3260
3339
|
open: controlled,
|
|
@@ -3262,25 +3341,33 @@ function KjunTooltip({
|
|
|
3262
3341
|
children
|
|
3263
3342
|
}) {
|
|
3264
3343
|
const container = useKjunPortalContainer();
|
|
3265
|
-
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]);
|
|
3266
3349
|
const setOpen = (value) => {
|
|
3267
3350
|
setInternal(value);
|
|
3268
3351
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
3269
3352
|
};
|
|
3270
3353
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
3271
|
-
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !
|
|
3354
|
+
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !hasContent2 || !layer.scopeActive, children: [
|
|
3272
3355
|
/* @__PURE__ */ jsx16(Focusable, { children }),
|
|
3273
|
-
container !== null && /* @__PURE__ */ jsxs10(
|
|
3274
|
-
|
|
3356
|
+
container !== null && hasContent2 && /* @__PURE__ */ jsxs10(
|
|
3357
|
+
TooltipPanel,
|
|
3275
3358
|
{
|
|
3276
|
-
style: { zIndex: layer.zIndex },
|
|
3359
|
+
style: { zIndex: layer.zIndex, ...width ? { maxWidth: `var(--_kjun-extension-tooltip-max-widths-${width})` } : {} },
|
|
3360
|
+
"data-align": align,
|
|
3277
3361
|
UNSTABLE_portalContainer: container,
|
|
3278
3362
|
placement,
|
|
3279
|
-
offset:
|
|
3363
|
+
offset: tokens16.extensions.floating.anchorGap,
|
|
3280
3364
|
className: "kjun-scope kjun-tooltip",
|
|
3281
3365
|
children: [
|
|
3282
|
-
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width:
|
|
3283
|
-
|
|
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: [
|
|
3368
|
+
/* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-title", children: title }),
|
|
3369
|
+
content && /* @__PURE__ */ jsx16("span", { className: "kjun-tooltip-body", children: content })
|
|
3370
|
+
] }) : content
|
|
3284
3371
|
]
|
|
3285
3372
|
}
|
|
3286
3373
|
)
|
|
@@ -3288,8 +3375,8 @@ function KjunTooltip({
|
|
|
3288
3375
|
}
|
|
3289
3376
|
|
|
3290
3377
|
// packages/react/src/dropdown.tsx
|
|
3291
|
-
import { tokens as
|
|
3292
|
-
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";
|
|
3293
3380
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
3294
3381
|
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3295
3382
|
var DropdownContext = createContext11(null);
|
|
@@ -3305,8 +3392,8 @@ function KjunDropdown({
|
|
|
3305
3392
|
onClose,
|
|
3306
3393
|
returnFocus
|
|
3307
3394
|
}) {
|
|
3308
|
-
const [open, setOpen] = useState11(false), currentOpen =
|
|
3309
|
-
const menuFocusCleanup =
|
|
3395
|
+
const [open, setOpen] = useState11(false), currentOpen = useRef18(false), ref = useRef18(null), id = "kjun-" + useId7();
|
|
3396
|
+
const menuFocusCleanup = useRef18(() => {
|
|
3310
3397
|
});
|
|
3311
3398
|
const bindMenu = useCallback5((menu) => {
|
|
3312
3399
|
menuFocusCleanup.current();
|
|
@@ -3330,19 +3417,19 @@ function KjunDropdown({
|
|
|
3330
3417
|
};
|
|
3331
3418
|
}, []);
|
|
3332
3419
|
let control = trigger;
|
|
3333
|
-
while (
|
|
3420
|
+
while (isValidElement3(control) && control.type === KjunTooltip)
|
|
3334
3421
|
control = control.props.children;
|
|
3335
|
-
const unavailable = disabled ||
|
|
3336
|
-
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;
|
|
3337
3424
|
const popupId = menuId || id + "-menu";
|
|
3338
3425
|
const bindTrigger = (node) => {
|
|
3339
|
-
if (!
|
|
3426
|
+
if (!isValidElement3(node)) return node;
|
|
3340
3427
|
if (node.type === KjunTooltip) {
|
|
3341
3428
|
const tooltip = node;
|
|
3342
|
-
return
|
|
3429
|
+
return cloneElement2(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
3343
3430
|
}
|
|
3344
3431
|
const button = node;
|
|
3345
|
-
return
|
|
3432
|
+
return cloneElement2(button, {
|
|
3346
3433
|
id: controlId,
|
|
3347
3434
|
"aria-haspopup": "menu",
|
|
3348
3435
|
"aria-expanded": open,
|
|
@@ -3413,7 +3500,7 @@ function KjunDropdownItem({
|
|
|
3413
3500
|
children,
|
|
3414
3501
|
onClick
|
|
3415
3502
|
}) {
|
|
3416
|
-
const close =
|
|
3503
|
+
const close = useContext12(DropdownContext);
|
|
3417
3504
|
const node = useCallback5((element) => {
|
|
3418
3505
|
if (!element) return;
|
|
3419
3506
|
if (selected === null) {
|
|
@@ -3439,14 +3526,14 @@ function KjunDropdownItem({
|
|
|
3439
3526
|
close == null ? void 0 : close();
|
|
3440
3527
|
},
|
|
3441
3528
|
children: [
|
|
3442
|
-
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 }),
|
|
3443
3530
|
/* @__PURE__ */ jsx17("span", { children }),
|
|
3444
3531
|
selected !== null && /* @__PURE__ */ jsx17(
|
|
3445
3532
|
KjunIcon,
|
|
3446
3533
|
{
|
|
3447
3534
|
name: "check",
|
|
3448
3535
|
className: "kjun-menu-check",
|
|
3449
|
-
size:
|
|
3536
|
+
size: tokens17.extensions.menu.iconSize,
|
|
3450
3537
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3451
3538
|
}
|
|
3452
3539
|
)
|
|
@@ -3513,7 +3600,7 @@ function KjunMenuButton({
|
|
|
3513
3600
|
}
|
|
3514
3601
|
|
|
3515
3602
|
// packages/react/src/drawer.tsx
|
|
3516
|
-
import { tokens as
|
|
3603
|
+
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3517
3604
|
|
|
3518
3605
|
// shared/package-runtime/drawer-geometry.ts
|
|
3519
3606
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3532,7 +3619,7 @@ function KjunDrawer({
|
|
|
3532
3619
|
onOpenChange,
|
|
3533
3620
|
title,
|
|
3534
3621
|
position = "right",
|
|
3535
|
-
width =
|
|
3622
|
+
width = tokens18.extensions.drawer.width,
|
|
3536
3623
|
closable = true,
|
|
3537
3624
|
closeOnOverlay = true,
|
|
3538
3625
|
closeOnEsc = true,
|
|
@@ -3548,7 +3635,7 @@ function KjunDrawer({
|
|
|
3548
3635
|
maxHeight
|
|
3549
3636
|
}) {
|
|
3550
3637
|
const m = useKjunMessages();
|
|
3551
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3638
|
+
const motion = usePresence(open, useReducedMotion(), tokens18.motion.layerExit);
|
|
3552
3639
|
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3553
3640
|
const container = useKjunPortalContainer();
|
|
3554
3641
|
const close = () => {
|
|
@@ -3605,8 +3692,8 @@ function KjunDrawer({
|
|
|
3605
3692
|
variant: "ghost",
|
|
3606
3693
|
ariaLabel: m.close,
|
|
3607
3694
|
onClick: close,
|
|
3608
|
-
style: { borderRadius:
|
|
3609
|
-
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 })
|
|
3610
3697
|
}
|
|
3611
3698
|
)
|
|
3612
3699
|
] }),
|
|
@@ -3614,7 +3701,7 @@ function KjunDrawer({
|
|
|
3614
3701
|
"div",
|
|
3615
3702
|
{
|
|
3616
3703
|
className: "kjun-drawer-body",
|
|
3617
|
-
style: { padding: noPadding ? 0 :
|
|
3704
|
+
style: { padding: noPadding ? 0 : tokens18.extensions.drawer.bodyPadding },
|
|
3618
3705
|
children
|
|
3619
3706
|
}
|
|
3620
3707
|
),
|
|
@@ -3747,10 +3834,10 @@ function useComboboxModel({
|
|
|
3747
3834
|
import {
|
|
3748
3835
|
useEffect as useEffect11,
|
|
3749
3836
|
useId as useId8,
|
|
3750
|
-
useRef as
|
|
3837
|
+
useRef as useRef19,
|
|
3751
3838
|
useState as useState13
|
|
3752
3839
|
} from "react";
|
|
3753
|
-
import { Fragment as
|
|
3840
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3754
3841
|
function KjunCombobox({
|
|
3755
3842
|
value,
|
|
3756
3843
|
options = [],
|
|
@@ -3836,8 +3923,8 @@ function SearchField({
|
|
|
3836
3923
|
}) {
|
|
3837
3924
|
const m = useKjunMessages();
|
|
3838
3925
|
const composition = useCompositionGuard();
|
|
3839
|
-
const clearing =
|
|
3840
|
-
const ref =
|
|
3926
|
+
const clearing = useRef19(false);
|
|
3927
|
+
const ref = useRef19(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
3841
3928
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3842
3929
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3843
3930
|
useEffect11(() => setActive(-1), [value, options.length]);
|
|
@@ -3862,7 +3949,7 @@ function SearchField({
|
|
|
3862
3949
|
onOpenChange(false);
|
|
3863
3950
|
(_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
|
|
3864
3951
|
};
|
|
3865
|
-
return /* @__PURE__ */ jsxs13(
|
|
3952
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
3866
3953
|
/* @__PURE__ */ jsx19(
|
|
3867
3954
|
KjunInput,
|
|
3868
3955
|
{
|
|
@@ -3984,7 +4071,7 @@ function SearchField({
|
|
|
3984
4071
|
}
|
|
3985
4072
|
|
|
3986
4073
|
// packages/react/src/date-picker.tsx
|
|
3987
|
-
import { tokens as
|
|
4074
|
+
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
3988
4075
|
import {
|
|
3989
4076
|
useState as useState14
|
|
3990
4077
|
} from "react";
|
|
@@ -4010,8 +4097,8 @@ function KjunDatePicker({
|
|
|
4010
4097
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
4011
4098
|
/* @__PURE__ */ jsxs14("div", { className: "kjun-date-picker", style: {
|
|
4012
4099
|
position: "relative",
|
|
4013
|
-
["--_kjun-date-icon-inset"]:
|
|
4014
|
-
["--_kjun-date-icon-size"]:
|
|
4100
|
+
["--_kjun-date-icon-inset"]: tokens19.input[size].padding + "px",
|
|
4101
|
+
["--_kjun-date-icon-size"]: tokens19.input[size].iconSize + "px"
|
|
4015
4102
|
}, children: [
|
|
4016
4103
|
/* @__PURE__ */ jsx20(
|
|
4017
4104
|
KjunInput,
|
|
@@ -4041,8 +4128,8 @@ function KjunDatePicker({
|
|
|
4041
4128
|
"aria-hidden": "true",
|
|
4042
4129
|
className: "kjun-date-overlay",
|
|
4043
4130
|
style: {
|
|
4044
|
-
left:
|
|
4045
|
-
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),
|
|
4046
4133
|
...inputTypeStyle(size),
|
|
4047
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)"
|
|
4048
4135
|
},
|
|
@@ -4058,14 +4145,14 @@ function KjunDatePicker({
|
|
|
4058
4145
|
className: "kjun-select-clear",
|
|
4059
4146
|
style: {
|
|
4060
4147
|
padding: 0,
|
|
4061
|
-
right:
|
|
4062
|
-
width:
|
|
4063
|
-
height:
|
|
4064
|
-
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,
|
|
4065
4152
|
borderRadius: "50%"
|
|
4066
4153
|
},
|
|
4067
4154
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
4068
|
-
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size:
|
|
4155
|
+
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size: tokens19.input[size].iconSize })
|
|
4069
4156
|
}
|
|
4070
4157
|
)
|
|
4071
4158
|
] })
|
|
@@ -4076,7 +4163,7 @@ function KjunDatePicker({
|
|
|
4076
4163
|
import { useState as useState16 } from "react";
|
|
4077
4164
|
|
|
4078
4165
|
// shared/package-runtime/search-input.ts
|
|
4079
|
-
import { useEffect as useEffect12, useLayoutEffect as
|
|
4166
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect11, useRef as useRef20, useState as useState15 } from "react";
|
|
4080
4167
|
function useSearchInputModel({
|
|
4081
4168
|
value,
|
|
4082
4169
|
disabled = false,
|
|
@@ -4086,16 +4173,16 @@ function useSearchInputModel({
|
|
|
4086
4173
|
onValueChange,
|
|
4087
4174
|
onSearchError
|
|
4088
4175
|
}, open) {
|
|
4089
|
-
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);
|
|
4090
4177
|
notify.current = onSearchError;
|
|
4091
|
-
const timer =
|
|
4092
|
-
const notifyValue =
|
|
4178
|
+
const timer = useRef20(void 0);
|
|
4179
|
+
const notifyValue = useRef20(onValueChange);
|
|
4093
4180
|
notifyValue.current = onValueChange;
|
|
4094
|
-
|
|
4181
|
+
useLayoutEffect11(() => {
|
|
4095
4182
|
clearTimeout(timer.current);
|
|
4096
4183
|
setQuery(value);
|
|
4097
4184
|
}, [value]);
|
|
4098
|
-
|
|
4185
|
+
useLayoutEffect11(() => {
|
|
4099
4186
|
clearTimeout(timer.current);
|
|
4100
4187
|
return () => clearTimeout(timer.current);
|
|
4101
4188
|
}, [disabled, debounce, !!loadOptions]);
|
|
@@ -4252,17 +4339,17 @@ function KjunSearchInput({
|
|
|
4252
4339
|
}
|
|
4253
4340
|
|
|
4254
4341
|
// packages/react/src/select-control.tsx
|
|
4255
|
-
import { tokens as
|
|
4342
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
4256
4343
|
import {
|
|
4257
4344
|
useId as useId9,
|
|
4258
|
-
useContext as
|
|
4259
|
-
useRef as
|
|
4345
|
+
useContext as useContext13,
|
|
4346
|
+
useRef as useRef22,
|
|
4260
4347
|
useEffect as useEffect14
|
|
4261
4348
|
} from "react";
|
|
4262
4349
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
4263
4350
|
|
|
4264
4351
|
// shared/package-runtime/select.ts
|
|
4265
|
-
import { useEffect as useEffect13, useRef as
|
|
4352
|
+
import { useEffect as useEffect13, useRef as useRef21, useState as useState17 } from "react";
|
|
4266
4353
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4267
4354
|
const [internal, setInternal] = useState17(false);
|
|
4268
4355
|
const [query2, setQuery] = useState17("");
|
|
@@ -4270,7 +4357,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4270
4357
|
const [session, setSession] = useState17(0);
|
|
4271
4358
|
const isControlled = typeof controlled === "boolean";
|
|
4272
4359
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4273
|
-
const previousOpen =
|
|
4360
|
+
const previousOpen = useRef21(open);
|
|
4274
4361
|
useEffect13(() => {
|
|
4275
4362
|
if (disabled && !isControlled) setInternal(false);
|
|
4276
4363
|
if (previousOpen.current && !open) {
|
|
@@ -4300,7 +4387,7 @@ import { createContext as createContext12 } from "react";
|
|
|
4300
4387
|
var CompoundControlContext = createContext12(null);
|
|
4301
4388
|
|
|
4302
4389
|
// packages/react/src/select-control.tsx
|
|
4303
|
-
import { Fragment as
|
|
4390
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4304
4391
|
function KjunSelect({
|
|
4305
4392
|
value,
|
|
4306
4393
|
options = [],
|
|
@@ -4337,9 +4424,9 @@ function KjunSelect({
|
|
|
4337
4424
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4338
4425
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4339
4426
|
const composition = useCompositionGuard();
|
|
4340
|
-
const ref =
|
|
4341
|
-
const segment =
|
|
4342
|
-
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];
|
|
4343
4430
|
const expanded = usePopupExpanded(open, ref);
|
|
4344
4431
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4345
4432
|
useEffect14(() => {
|
|
@@ -4370,7 +4457,7 @@ function KjunSelect({
|
|
|
4370
4457
|
searchKeys,
|
|
4371
4458
|
selectedCount: m.selectedCount
|
|
4372
4459
|
});
|
|
4373
|
-
return /* @__PURE__ */ jsxs15(
|
|
4460
|
+
return /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
4374
4461
|
/* @__PURE__ */ jsxs15("div", { className: "kjun-select-shell", children: [
|
|
4375
4462
|
/* @__PURE__ */ jsxs15(
|
|
4376
4463
|
"button",
|
|
@@ -4393,7 +4480,7 @@ function KjunSelect({
|
|
|
4393
4480
|
borderRadius: spec.radius,
|
|
4394
4481
|
...inputTypeStyle(size),
|
|
4395
4482
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4396
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4483
|
+
...segment ? {} : { paddingInline: spec.padding - tokens20.border.controlWidth }
|
|
4397
4484
|
},
|
|
4398
4485
|
onClick: () => changeOpen(!open),
|
|
4399
4486
|
onKeyDown: (e) => {
|
|
@@ -4404,7 +4491,7 @@ function KjunSelect({
|
|
|
4404
4491
|
},
|
|
4405
4492
|
children: [
|
|
4406
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 }),
|
|
4407
|
-
/* @__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)" } })
|
|
4408
4495
|
]
|
|
4409
4496
|
}
|
|
4410
4497
|
),
|
|
@@ -4509,7 +4596,7 @@ function KjunSelect({
|
|
|
4509
4596
|
className: "kjun-option",
|
|
4510
4597
|
children: [
|
|
4511
4598
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ jsx22("span", { children: optionLabel(o, labelKey) }),
|
|
4512
|
-
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size:
|
|
4599
|
+
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size: tokens20.extensions.menu.iconSize })
|
|
4513
4600
|
]
|
|
4514
4601
|
},
|
|
4515
4602
|
key
|
|
@@ -4535,23 +4622,23 @@ function KjunSelect({
|
|
|
4535
4622
|
}
|
|
4536
4623
|
|
|
4537
4624
|
// packages/react/src/navigation.tsx
|
|
4538
|
-
import { tokens as
|
|
4625
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
4539
4626
|
|
|
4540
4627
|
// packages/react/src/collapse.tsx
|
|
4541
|
-
import { tokens as
|
|
4542
|
-
import { useLayoutEffect as
|
|
4628
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4629
|
+
import { useLayoutEffect as useLayoutEffect12, useRef as useRef23, useState as useState18 } from "react";
|
|
4543
4630
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4544
4631
|
function Collapse({ open, keepMounted = false, children }) {
|
|
4545
4632
|
const reduced = useReducedMotion();
|
|
4546
4633
|
const [retained, setRetained] = useState18(open);
|
|
4547
|
-
const root =
|
|
4548
|
-
const animation =
|
|
4549
|
-
const previous =
|
|
4550
|
-
const interrupted =
|
|
4551
|
-
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);
|
|
4552
4639
|
if (open) opened.current = true;
|
|
4553
4640
|
const present = open || retained || keepMounted && opened.current;
|
|
4554
|
-
|
|
4641
|
+
useLayoutEffect12(() => {
|
|
4555
4642
|
const el = root.current, inner = body.current;
|
|
4556
4643
|
if (!el || !inner) return;
|
|
4557
4644
|
let disposed = false;
|
|
@@ -4576,8 +4663,8 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4576
4663
|
}
|
|
4577
4664
|
el.style.height = end + "px";
|
|
4578
4665
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4579
|
-
duration:
|
|
4580
|
-
easing:
|
|
4666
|
+
duration: tokens21.motion.collapse,
|
|
4667
|
+
easing: tokens21.motion.easeOut
|
|
4581
4668
|
});
|
|
4582
4669
|
animation.current = transition;
|
|
4583
4670
|
transition.onfinish = finish;
|
|
@@ -4606,9 +4693,9 @@ function Collapse({ open, keepMounted = false, children }) {
|
|
|
4606
4693
|
}
|
|
4607
4694
|
|
|
4608
4695
|
// shared/package-runtime/navigation.ts
|
|
4609
|
-
import { useEffect as useEffect15, useRef as
|
|
4696
|
+
import { useEffect as useEffect15, useRef as useRef24, useState as useState19 } from "react";
|
|
4610
4697
|
function useInitialTab(value, candidate, change) {
|
|
4611
|
-
const requested =
|
|
4698
|
+
const requested = useRef24(/* @__PURE__ */ new Set());
|
|
4612
4699
|
useEffect15(() => {
|
|
4613
4700
|
if (value !== "") {
|
|
4614
4701
|
requested.current.clear();
|
|
@@ -4706,19 +4793,22 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4706
4793
|
|
|
4707
4794
|
// packages/react/src/navigation.tsx
|
|
4708
4795
|
import {
|
|
4709
|
-
Children,
|
|
4796
|
+
Children as Children2,
|
|
4710
4797
|
createContext as createContext13,
|
|
4711
|
-
Fragment as
|
|
4712
|
-
isValidElement as
|
|
4713
|
-
useContext as
|
|
4798
|
+
Fragment as Fragment8,
|
|
4799
|
+
isValidElement as isValidElement4,
|
|
4800
|
+
useContext as useContext14,
|
|
4714
4801
|
useEffect as useEffect16,
|
|
4715
|
-
useLayoutEffect as
|
|
4802
|
+
useLayoutEffect as useLayoutEffect13,
|
|
4716
4803
|
useId as useId10,
|
|
4717
|
-
useRef as
|
|
4804
|
+
useRef as useRef25,
|
|
4718
4805
|
useState as useState20
|
|
4719
4806
|
} from "react";
|
|
4720
|
-
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
4721
|
-
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
|
+
}
|
|
4722
4812
|
function KjunTabs({
|
|
4723
4813
|
value,
|
|
4724
4814
|
items = [],
|
|
@@ -4726,6 +4816,8 @@ function KjunTabs({
|
|
|
4726
4816
|
variant = "underline",
|
|
4727
4817
|
actions,
|
|
4728
4818
|
children,
|
|
4819
|
+
stickyHeader = false,
|
|
4820
|
+
stickyOffset = 0,
|
|
4729
4821
|
ariaLabel,
|
|
4730
4822
|
onValueChange,
|
|
4731
4823
|
onChange,
|
|
@@ -4735,25 +4827,25 @@ function KjunTabs({
|
|
|
4735
4827
|
const m = useKjunMessages();
|
|
4736
4828
|
ariaLabel != null ? ariaLabel : ariaLabel = m.tabs;
|
|
4737
4829
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4738
|
-
const panes =
|
|
4739
|
-
|
|
4830
|
+
const panes = Children2.toArray(children).filter(
|
|
4831
|
+
isValidElement4
|
|
4740
4832
|
);
|
|
4741
4833
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4742
|
-
|
|
4834
|
+
useLayoutEffect13(() => {
|
|
4743
4835
|
var _a2;
|
|
4744
4836
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4745
4837
|
if (list) return manageTabList(list, () => {
|
|
4746
4838
|
}, false);
|
|
4747
4839
|
}, [group]);
|
|
4748
|
-
|
|
4840
|
+
useLayoutEffect13(() => {
|
|
4749
4841
|
var _a2;
|
|
4750
4842
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4751
4843
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4752
4844
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4753
4845
|
}
|
|
4754
4846
|
});
|
|
4755
|
-
const timer =
|
|
4756
|
-
const menuState =
|
|
4847
|
+
const timer = useRef25(void 0), press = useRef25(null);
|
|
4848
|
+
const menuState = useRef25({ tabs, onTabMenu });
|
|
4757
4849
|
menuState.current = { tabs, onTabMenu };
|
|
4758
4850
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4759
4851
|
const clear = () => {
|
|
@@ -4761,7 +4853,7 @@ function KjunTabs({
|
|
|
4761
4853
|
press.current = null;
|
|
4762
4854
|
};
|
|
4763
4855
|
useEffect16(() => clear, []);
|
|
4764
|
-
|
|
4856
|
+
useLayoutEffect13(() => {
|
|
4765
4857
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4766
4858
|
}, [tabs, onTabMenu]);
|
|
4767
4859
|
const change = (name) => {
|
|
@@ -4769,7 +4861,7 @@ function KjunTabs({
|
|
|
4769
4861
|
onChange == null ? void 0 : onChange(name);
|
|
4770
4862
|
};
|
|
4771
4863
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4772
|
-
return /* @__PURE__ */ jsxs16(
|
|
4864
|
+
return /* @__PURE__ */ jsx24(TabListStateContext.Provider, { value: null, children: /* @__PURE__ */ jsxs16(
|
|
4773
4865
|
Tabs,
|
|
4774
4866
|
{
|
|
4775
4867
|
selectedKey: value,
|
|
@@ -4778,73 +4870,81 @@ function KjunTabs({
|
|
|
4778
4870
|
"data-variant": variant,
|
|
4779
4871
|
"data-density": density,
|
|
4780
4872
|
children: [
|
|
4781
|
-
/* @__PURE__ */ jsxs16(
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
className: "kjun-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
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
|
+
),
|
|
4844
4944
|
children && /* @__PURE__ */ jsx24("div", { className: "kjun-tab-content", children })
|
|
4845
4945
|
]
|
|
4846
4946
|
}
|
|
4847
|
-
);
|
|
4947
|
+
) });
|
|
4848
4948
|
}
|
|
4849
4949
|
function KjunTabPane({ name, children }) {
|
|
4850
4950
|
return /* @__PURE__ */ jsx24(
|
|
@@ -4883,11 +4983,11 @@ function KjunAccordionItem({
|
|
|
4883
4983
|
keepMounted = false,
|
|
4884
4984
|
children
|
|
4885
4985
|
}) {
|
|
4886
|
-
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;
|
|
4887
4987
|
useEffect16(() => {
|
|
4888
4988
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4889
4989
|
}, []);
|
|
4890
|
-
const reported =
|
|
4990
|
+
const reported = useRef25(open), notify = useRef25(onOpenChange), registering = useRef25(!!group && defaultOpen);
|
|
4891
4991
|
notify.current = onOpenChange;
|
|
4892
4992
|
useEffect16(() => {
|
|
4893
4993
|
var _a;
|
|
@@ -4923,7 +5023,7 @@ function KjunAccordionItem({
|
|
|
4923
5023
|
{
|
|
4924
5024
|
name: "chevron-down",
|
|
4925
5025
|
className: "kjun-accordion-chevron",
|
|
4926
|
-
size:
|
|
5026
|
+
size: tokens22.extensions.accordion.iconSize,
|
|
4927
5027
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4928
5028
|
}
|
|
4929
5029
|
)
|
|
@@ -4950,13 +5050,13 @@ function KjunBreadcrumb({
|
|
|
4950
5050
|
const m = useKjunMessages();
|
|
4951
5051
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4952
5052
|
return /* @__PURE__ */ jsx24("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4953
|
-
const label = /* @__PURE__ */ jsxs16(
|
|
4954
|
-
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 }),
|
|
4955
5055
|
" ",
|
|
4956
5056
|
item.label
|
|
4957
5057
|
] });
|
|
4958
|
-
return /* @__PURE__ */ jsxs16(
|
|
4959
|
-
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 }),
|
|
4960
5060
|
" ",
|
|
4961
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 })
|
|
4962
5062
|
] }, i);
|
|
@@ -5003,7 +5103,7 @@ function KjunPagination({
|
|
|
5003
5103
|
"aria-label": label,
|
|
5004
5104
|
disabled: target < 1 || target > totalPages || target === current,
|
|
5005
5105
|
onClick: () => change(target),
|
|
5006
|
-
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size:
|
|
5106
|
+
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size: tokens22.extensions.pagination.iconSize })
|
|
5007
5107
|
}
|
|
5008
5108
|
);
|
|
5009
5109
|
return /* @__PURE__ */ jsxs16("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -5056,14 +5156,14 @@ function KjunPagination({
|
|
|
5056
5156
|
}
|
|
5057
5157
|
|
|
5058
5158
|
// packages/react/src/actions.tsx
|
|
5059
|
-
import { tokens as
|
|
5159
|
+
import { tokens as tokens23 } from "@kjun-ui/tokens";
|
|
5060
5160
|
import {
|
|
5061
|
-
useContext as
|
|
5161
|
+
useContext as useContext15,
|
|
5062
5162
|
useEffect as useEffect17,
|
|
5063
|
-
useRef as
|
|
5163
|
+
useRef as useRef26,
|
|
5064
5164
|
useState as useState21
|
|
5065
5165
|
} from "react";
|
|
5066
|
-
import { Fragment as
|
|
5166
|
+
import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5067
5167
|
function KjunIconToggle({
|
|
5068
5168
|
active = false,
|
|
5069
5169
|
activeIcon,
|
|
@@ -5082,7 +5182,7 @@ function KjunIconToggle({
|
|
|
5082
5182
|
onToggle
|
|
5083
5183
|
}) {
|
|
5084
5184
|
var _a;
|
|
5085
|
-
const navigation =
|
|
5185
|
+
const navigation = useContext15(TopNavigationContext);
|
|
5086
5186
|
return /* @__PURE__ */ jsx25(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx25(
|
|
5087
5187
|
"button",
|
|
5088
5188
|
{
|
|
@@ -5103,7 +5203,7 @@ function KjunIconToggle({
|
|
|
5103
5203
|
{
|
|
5104
5204
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
5105
5205
|
filled: active,
|
|
5106
|
-
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],
|
|
5107
5207
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
5108
5208
|
className: active ? activeColorClass : inactiveColorClass,
|
|
5109
5209
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5144,7 +5244,7 @@ function KjunCopyButton({
|
|
|
5144
5244
|
const m = useKjunMessages();
|
|
5145
5245
|
successText != null ? successText : successText = m.copied;
|
|
5146
5246
|
const feedback = useOptionalKjunFeedback();
|
|
5147
|
-
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);
|
|
5148
5248
|
useEffect17(() => {
|
|
5149
5249
|
mounted.current = true;
|
|
5150
5250
|
return () => {
|
|
@@ -5152,7 +5252,7 @@ function KjunCopyButton({
|
|
|
5152
5252
|
clearTimeout(timer.current);
|
|
5153
5253
|
};
|
|
5154
5254
|
}, []);
|
|
5155
|
-
return /* @__PURE__ */ jsxs17(
|
|
5255
|
+
return /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
5156
5256
|
/* @__PURE__ */ jsxs17(
|
|
5157
5257
|
"button",
|
|
5158
5258
|
{
|
|
@@ -5163,9 +5263,9 @@ function KjunCopyButton({
|
|
|
5163
5263
|
"data-inline": inline,
|
|
5164
5264
|
style: {
|
|
5165
5265
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5166
|
-
minHeight:
|
|
5266
|
+
minHeight: tokens23.button.heights[size],
|
|
5167
5267
|
paddingBlock: 0,
|
|
5168
|
-
paddingInline: { xs:
|
|
5268
|
+
paddingInline: { xs: tokens23.dimension.value4, sm: tokens23.dimension.value8, md: tokens23.dimension.value12 }[size]
|
|
5169
5269
|
},
|
|
5170
5270
|
onClick: async (event) => {
|
|
5171
5271
|
event.stopPropagation();
|
|
@@ -5195,7 +5295,7 @@ function KjunCopyButton({
|
|
|
5195
5295
|
KjunIcon,
|
|
5196
5296
|
{
|
|
5197
5297
|
name: copied ? "check" : "copy",
|
|
5198
|
-
size:
|
|
5298
|
+
size: tokens23.button.iconSizes[size],
|
|
5199
5299
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5200
5300
|
}
|
|
5201
5301
|
),
|
|
@@ -5269,14 +5369,14 @@ function KjunExternalLink({
|
|
|
5269
5369
|
onClick: (e) => e.stopPropagation(),
|
|
5270
5370
|
children: [
|
|
5271
5371
|
body,
|
|
5272
|
-
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" }),
|
|
5273
5373
|
!name && /* @__PURE__ */ jsx25("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5274
5374
|
]
|
|
5275
5375
|
}
|
|
5276
5376
|
) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
|
|
5277
5377
|
}
|
|
5278
5378
|
function KjunScrollFade({ children }) {
|
|
5279
|
-
const ref =
|
|
5379
|
+
const ref = useRef26(null), [edges, setEdges] = useState21({ left: false, right: false });
|
|
5280
5380
|
const update = () => {
|
|
5281
5381
|
const el = ref.current;
|
|
5282
5382
|
if (el)
|
|
@@ -5297,7 +5397,7 @@ function KjunScrollFade({ children }) {
|
|
|
5297
5397
|
}
|
|
5298
5398
|
return () => observer.disconnect();
|
|
5299
5399
|
}, [children]);
|
|
5300
|
-
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;
|
|
5301
5401
|
return /* @__PURE__ */ jsx25(
|
|
5302
5402
|
"div",
|
|
5303
5403
|
{
|
|
@@ -5312,7 +5412,7 @@ function KjunScrollFade({ children }) {
|
|
|
5312
5412
|
|
|
5313
5413
|
// packages/react/src/data-state.tsx
|
|
5314
5414
|
import {
|
|
5315
|
-
tokens as
|
|
5415
|
+
tokens as tokens24,
|
|
5316
5416
|
advanceQueryDisplay,
|
|
5317
5417
|
initialQueryDisplay,
|
|
5318
5418
|
queryDisplayStatus
|
|
@@ -5374,7 +5474,7 @@ function KjunDataState({
|
|
|
5374
5474
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5375
5475
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5376
5476
|
retryText != null ? retryText : retryText = m.retry;
|
|
5377
|
-
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);
|
|
5378
5478
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5379
5479
|
/* @__PURE__ */ jsx26("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
5380
5480
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "xs" }),
|
|
@@ -5388,7 +5488,7 @@ function KjunDataState({
|
|
|
5388
5488
|
"aria-label": revealed ? loadingText : void 0,
|
|
5389
5489
|
"aria-hidden": revealed ? void 0 : true,
|
|
5390
5490
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5391
|
-
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: [
|
|
5392
5492
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "md" }),
|
|
5393
5493
|
/* @__PURE__ */ jsx26("p", { children: loadingText })
|
|
5394
5494
|
] }))
|
|
@@ -5401,7 +5501,7 @@ function KjunDataState({
|
|
|
5401
5501
|
"aria-hidden": concealed || void 0,
|
|
5402
5502
|
inert: concealed || void 0,
|
|
5403
5503
|
style: {
|
|
5404
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5504
|
+
opacity: query2.loading && !state.usesQueryState ? tokens24.states.opacity.pending : void 0
|
|
5405
5505
|
},
|
|
5406
5506
|
children
|
|
5407
5507
|
},
|
|
@@ -5443,7 +5543,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
5443
5543
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5444
5544
|
|
|
5445
5545
|
// packages/react/src/skeletons.tsx
|
|
5446
|
-
import { tokens as
|
|
5546
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
5447
5547
|
|
|
5448
5548
|
// shared/package-runtime/chart-skeleton.ts
|
|
5449
5549
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5460,11 +5560,11 @@ function chartSkeletonKind(kind) {
|
|
|
5460
5560
|
}
|
|
5461
5561
|
|
|
5462
5562
|
// packages/react/src/market-skeleton.tsx
|
|
5463
|
-
import { tokens as
|
|
5563
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
5464
5564
|
|
|
5465
5565
|
// shared/package-runtime/market-layout.ts
|
|
5466
|
-
import { tokens as
|
|
5467
|
-
var marketGeometry =
|
|
5566
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
5567
|
+
var marketGeometry = tokens25.extensions.marketTable;
|
|
5468
5568
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5469
5569
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5470
5570
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5505,26 +5605,26 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5505
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: [
|
|
5506
5606
|
/* @__PURE__ */ jsx28(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5507
5607
|
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5508
|
-
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 }) }) }),
|
|
5509
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))
|
|
5510
5610
|
] }) }),
|
|
5511
5611
|
/* @__PURE__ */ jsx28("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5512
|
-
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 }) }) }),
|
|
5513
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: [
|
|
5514
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5515
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5516
|
-
] }) : /* @__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))
|
|
5517
5617
|
] }, row)) })
|
|
5518
5618
|
] }) });
|
|
5519
5619
|
}
|
|
5520
5620
|
|
|
5521
5621
|
// packages/react/src/skeletons.tsx
|
|
5522
|
-
import { Fragment as
|
|
5622
|
+
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5523
5623
|
function KjunListSkeleton({
|
|
5524
5624
|
rows = 8,
|
|
5525
5625
|
variant = "market",
|
|
5526
5626
|
avatar = true,
|
|
5527
|
-
avatarSize =
|
|
5627
|
+
avatarSize = tokens27.extensions.skeleton.listAvatarSize,
|
|
5528
5628
|
quote = true
|
|
5529
5629
|
}) {
|
|
5530
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: [
|
|
@@ -5534,15 +5634,15 @@ function KjunListSkeleton({
|
|
|
5534
5634
|
KjunSkeleton,
|
|
5535
5635
|
{
|
|
5536
5636
|
type: "block",
|
|
5537
|
-
height:
|
|
5637
|
+
height: tokens27.extensions.skeleton.lineHeights.md,
|
|
5538
5638
|
width: i % 2 ? "80%" : "65%"
|
|
5539
5639
|
}
|
|
5540
5640
|
),
|
|
5541
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5641
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens27.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5542
5642
|
] }),
|
|
5543
5643
|
quote && /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5544
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5545
|
-
/* @__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 })
|
|
5546
5646
|
] })
|
|
5547
5647
|
] }, i)) });
|
|
5548
5648
|
}
|
|
@@ -5558,17 +5658,17 @@ function KjunFormSkeleton({
|
|
|
5558
5658
|
"aria-hidden": "true",
|
|
5559
5659
|
className: "kjun-form-skeleton",
|
|
5560
5660
|
"data-columns": columns,
|
|
5561
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5661
|
+
style: { "--_kjun-form-skeleton-radius": `${tokens27.input[size].radius}px` },
|
|
5562
5662
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
5563
5663
|
field ? /* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5564
5664
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5565
|
-
/* @__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 }) })
|
|
5566
5666
|
),
|
|
5567
5667
|
/* @__PURE__ */ jsx29(
|
|
5568
5668
|
KjunSkeleton,
|
|
5569
5669
|
{
|
|
5570
5670
|
type: "block",
|
|
5571
|
-
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
|
|
5572
5672
|
}
|
|
5573
5673
|
)
|
|
5574
5674
|
] }, i))
|
|
@@ -5577,7 +5677,7 @@ function KjunFormSkeleton({
|
|
|
5577
5677
|
}
|
|
5578
5678
|
function KjunChartSkeleton({
|
|
5579
5679
|
kind: requestedKind = "frame",
|
|
5580
|
-
height =
|
|
5680
|
+
height = tokens27.extensions.chartSkeleton.height,
|
|
5581
5681
|
loadingText,
|
|
5582
5682
|
skeleton = true,
|
|
5583
5683
|
loadingDelay = 0,
|
|
@@ -5598,7 +5698,7 @@ function KjunChartSkeleton({
|
|
|
5598
5698
|
children: !skeleton ? /* @__PURE__ */ jsxs21("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
5599
5699
|
/* @__PURE__ */ jsx29("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx29(KjunSpinner, { size: "md" }) }),
|
|
5600
5700
|
loadingText && /* @__PURE__ */ jsx29("p", { children: loadingText })
|
|
5601
|
-
] }) : /* @__PURE__ */ jsxs21(
|
|
5701
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
5602
5702
|
kind === "donut" ? /* @__PURE__ */ jsx29("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ jsx29(
|
|
5603
5703
|
"div",
|
|
5604
5704
|
{
|
|
@@ -5633,7 +5733,7 @@ function KjunChartSkeleton({
|
|
|
5633
5733
|
d: chartFramePath,
|
|
5634
5734
|
fill: "none",
|
|
5635
5735
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5636
|
-
strokeWidth:
|
|
5736
|
+
strokeWidth: tokens27.border.defaultWidth,
|
|
5637
5737
|
vectorEffect: "non-scaling-stroke"
|
|
5638
5738
|
}
|
|
5639
5739
|
)
|
|
@@ -5646,19 +5746,19 @@ function KjunChartSkeleton({
|
|
|
5646
5746
|
}
|
|
5647
5747
|
|
|
5648
5748
|
// packages/react/src/financial-display.tsx
|
|
5649
|
-
import { deviationLevel, tokens as
|
|
5749
|
+
import { deviationLevel, tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5650
5750
|
import {
|
|
5651
5751
|
useId as useId11
|
|
5652
5752
|
} from "react";
|
|
5653
5753
|
|
|
5654
5754
|
// packages/react/src/number-display.tsx
|
|
5655
|
-
import { tokens as
|
|
5755
|
+
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5656
5756
|
|
|
5657
5757
|
// shared/package-runtime/use-number-motion.ts
|
|
5658
|
-
import { useLayoutEffect as
|
|
5758
|
+
import { useLayoutEffect as useLayoutEffect14, useRef as useRef27, useState as useState24 } from "react";
|
|
5659
5759
|
|
|
5660
5760
|
// shared/package-runtime/number-motion.ts
|
|
5661
|
-
import { tokens as
|
|
5761
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5662
5762
|
function createNumberMotion(apply) {
|
|
5663
5763
|
let frame = 0, revision = 0, current = 0;
|
|
5664
5764
|
let previous;
|
|
@@ -5689,7 +5789,7 @@ function createNumberMotion(apply) {
|
|
|
5689
5789
|
if (from === target) return;
|
|
5690
5790
|
const tick = (now) => {
|
|
5691
5791
|
if (version !== revision) return;
|
|
5692
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5792
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens28.motion.number));
|
|
5693
5793
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5694
5794
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5695
5795
|
};
|
|
@@ -5702,13 +5802,13 @@ function createNumberMotion(apply) {
|
|
|
5702
5802
|
// shared/package-runtime/use-number-motion.ts
|
|
5703
5803
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5704
5804
|
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5705
|
-
const motion =
|
|
5805
|
+
const motion = useRef27(null);
|
|
5706
5806
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5707
|
-
|
|
5807
|
+
useLayoutEffect14(() => {
|
|
5708
5808
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5709
5809
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5710
5810
|
}, [value, animated, fromPrevious, reduced]);
|
|
5711
|
-
|
|
5811
|
+
useLayoutEffect14(() => () => {
|
|
5712
5812
|
var _a;
|
|
5713
5813
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5714
5814
|
motion.current = null;
|
|
@@ -5717,7 +5817,7 @@ function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
|
5717
5817
|
}
|
|
5718
5818
|
|
|
5719
5819
|
// packages/react/src/number-display.tsx
|
|
5720
|
-
import { Fragment as
|
|
5820
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5721
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;
|
|
5722
5822
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5723
5823
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5768,7 +5868,7 @@ function KjunPriceCell({
|
|
|
5768
5868
|
flashClass = "",
|
|
5769
5869
|
fromPrevious = true
|
|
5770
5870
|
}) {
|
|
5771
|
-
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: [
|
|
5772
5872
|
/* @__PURE__ */ jsx30(
|
|
5773
5873
|
"span",
|
|
5774
5874
|
{
|
|
@@ -5816,7 +5916,7 @@ function KjunSignedValue({
|
|
|
5816
5916
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5817
5917
|
},
|
|
5818
5918
|
children: [
|
|
5819
|
-
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width:
|
|
5919
|
+
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width: tokens29.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5820
5920
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ jsx30(KjunFreshness, { stale: true })
|
|
5821
5921
|
]
|
|
5822
5922
|
}
|
|
@@ -5824,8 +5924,8 @@ function KjunSignedValue({
|
|
|
5824
5924
|
}
|
|
5825
5925
|
|
|
5826
5926
|
// packages/react/src/financial-display.tsx
|
|
5827
|
-
import { Fragment as
|
|
5828
|
-
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 };
|
|
5829
5929
|
function KjunDeviation({
|
|
5830
5930
|
value,
|
|
5831
5931
|
variant = "pill",
|
|
@@ -5857,7 +5957,7 @@ function KjunDeviation({
|
|
|
5857
5957
|
KjunIcon,
|
|
5858
5958
|
{
|
|
5859
5959
|
name: "alert-triangle",
|
|
5860
|
-
size:
|
|
5960
|
+
size: tokens30.extensions.financial.warningIconSize,
|
|
5861
5961
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5862
5962
|
}
|
|
5863
5963
|
) })
|
|
@@ -5870,7 +5970,7 @@ function KjunDeviation({
|
|
|
5870
5970
|
className: "kjun-deviation",
|
|
5871
5971
|
ref: domainColorRef(!neutral),
|
|
5872
5972
|
"data-variant": variant,
|
|
5873
|
-
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 },
|
|
5874
5974
|
children: [
|
|
5875
5975
|
variant === "pill" && /* @__PURE__ */ jsx31(
|
|
5876
5976
|
"span",
|
|
@@ -5898,7 +5998,7 @@ function KjunHeatmapCell({
|
|
|
5898
5998
|
}) {
|
|
5899
5999
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5900
6000
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5901
|
-
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;
|
|
5902
6002
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5903
6003
|
/* @__PURE__ */ jsx31(
|
|
5904
6004
|
"span",
|
|
@@ -5917,7 +6017,7 @@ function KjunProgressCell({
|
|
|
5917
6017
|
showLabel = true,
|
|
5918
6018
|
color = "auto",
|
|
5919
6019
|
customColor,
|
|
5920
|
-
height =
|
|
6020
|
+
height = tokens30.extensions.financial.progressHeight
|
|
5921
6021
|
}) {
|
|
5922
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;
|
|
5923
6023
|
return /* @__PURE__ */ jsxs23("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5941,7 +6041,7 @@ function KjunCollectionMark({
|
|
|
5941
6041
|
active = false,
|
|
5942
6042
|
size = "md"
|
|
5943
6043
|
}) {
|
|
5944
|
-
const box =
|
|
6044
|
+
const box = tokens30.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens30.extensions.financial.heartMarkSizes[size] : box;
|
|
5945
6045
|
return /* @__PURE__ */ jsx31(
|
|
5946
6046
|
KjunIcon,
|
|
5947
6047
|
{
|
|
@@ -5977,8 +6077,8 @@ function KjunExecutionStatusBadge({
|
|
|
5977
6077
|
}
|
|
5978
6078
|
function KjunSparkline({
|
|
5979
6079
|
data = [],
|
|
5980
|
-
width =
|
|
5981
|
-
height =
|
|
6080
|
+
width = tokens30.extensions.financial.sparklineWidth,
|
|
6081
|
+
height = tokens30.extensions.financial.sparklineHeight,
|
|
5982
6082
|
color,
|
|
5983
6083
|
semantic = "price",
|
|
5984
6084
|
fill = true,
|
|
@@ -6002,7 +6102,7 @@ function KjunSparkline({
|
|
|
6002
6102
|
"aria-hidden": !ariaLabel || void 0,
|
|
6003
6103
|
className: "kjun-sparkline",
|
|
6004
6104
|
children: [
|
|
6005
|
-
fill && values.length > 1 && /* @__PURE__ */ jsxs23(
|
|
6105
|
+
fill && values.length > 1 && /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
6006
6106
|
/* @__PURE__ */ jsx31("defs", { children: /* @__PURE__ */ jsxs23("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6007
6107
|
/* @__PURE__ */ jsx31("stop", { offset: "0%", stopColor: line, stopOpacity: 0.3 }),
|
|
6008
6108
|
/* @__PURE__ */ jsx31("stop", { offset: "100%", stopColor: line, stopOpacity: 0.05 })
|
|
@@ -6034,7 +6134,7 @@ function KjunSparkline({
|
|
|
6034
6134
|
|
|
6035
6135
|
// shared/package-runtime/table.ts
|
|
6036
6136
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
6037
|
-
import { useEffect as useEffect19, useRef as
|
|
6137
|
+
import { useEffect as useEffect19, useRef as useRef28, useState as useState25 } from "react";
|
|
6038
6138
|
|
|
6039
6139
|
// shared/package-runtime/table-model.ts
|
|
6040
6140
|
function getValue(row, key) {
|
|
@@ -6081,7 +6181,7 @@ function useTableModel(props) {
|
|
|
6081
6181
|
const [internalSort, setSort] = useState25({
|
|
6082
6182
|
key: "",
|
|
6083
6183
|
order: "asc"
|
|
6084
|
-
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer =
|
|
6184
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef28(void 0);
|
|
6085
6185
|
useEffect19(() => () => clearTimeout(timer.current), []);
|
|
6086
6186
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
6087
6187
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
@@ -6171,8 +6271,8 @@ function tableCellValue(props, column, row, index) {
|
|
|
6171
6271
|
}
|
|
6172
6272
|
|
|
6173
6273
|
// packages/react/src/table-toolbar.tsx
|
|
6174
|
-
import { tokens as
|
|
6175
|
-
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";
|
|
6176
6276
|
function TableToolbar({
|
|
6177
6277
|
selectable,
|
|
6178
6278
|
selected,
|
|
@@ -6186,7 +6286,7 @@ function TableToolbar({
|
|
|
6186
6286
|
toolbar
|
|
6187
6287
|
}) {
|
|
6188
6288
|
const m = useKjunMessages();
|
|
6189
|
-
return /* @__PURE__ */ jsxs24(
|
|
6289
|
+
return /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
6190
6290
|
selectable && selected.length > 0 && /* @__PURE__ */ jsxs24(
|
|
6191
6291
|
"div",
|
|
6192
6292
|
{
|
|
@@ -6214,7 +6314,7 @@ function TableToolbar({
|
|
|
6214
6314
|
KjunInput,
|
|
6215
6315
|
{
|
|
6216
6316
|
size: "sm",
|
|
6217
|
-
style: { width:
|
|
6317
|
+
style: { width: tokens31.table.searchWidth, maxWidth: "100%" },
|
|
6218
6318
|
value: search,
|
|
6219
6319
|
ariaLabel: m.searchTable,
|
|
6220
6320
|
placeholder: searchPlaceholder,
|
|
@@ -6230,22 +6330,16 @@ function TableToolbar({
|
|
|
6230
6330
|
}
|
|
6231
6331
|
|
|
6232
6332
|
// packages/react/src/table-grid.tsx
|
|
6233
|
-
import { tokens as
|
|
6234
|
-
import { Fragment as
|
|
6333
|
+
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6334
|
+
import { Fragment as Fragment15 } from "react";
|
|
6235
6335
|
|
|
6236
6336
|
// packages/react/src/table-check.tsx
|
|
6237
6337
|
import { forwardRef as forwardRef4 } from "react";
|
|
6238
|
-
|
|
6239
|
-
// shared/package-runtime/component-icons.ts
|
|
6240
|
-
import minus from "@kjun-ui/icons/icons/minus";
|
|
6241
|
-
var componentIcons = { minus };
|
|
6242
|
-
|
|
6243
|
-
// packages/react/src/table-check.tsx
|
|
6244
|
-
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
6338
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
6245
6339
|
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6246
6340
|
var TableCheck = forwardRef4(
|
|
6247
6341
|
function TableCheck2(props, ref) {
|
|
6248
|
-
const size =
|
|
6342
|
+
const size = tokens32.extensions.checkbox.iconSizes.sm;
|
|
6249
6343
|
return /* @__PURE__ */ jsx33(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs25("span", { className: "kjun-table-check", children: [
|
|
6250
6344
|
/* @__PURE__ */ jsx33("input", { ...props, ref, type: "checkbox" }),
|
|
6251
6345
|
/* @__PURE__ */ jsx33(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6302,7 +6396,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6302
6396
|
KjunIcon,
|
|
6303
6397
|
{
|
|
6304
6398
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6305
|
-
size:
|
|
6399
|
+
size: tokens33.table.sortIconSize
|
|
6306
6400
|
}
|
|
6307
6401
|
)
|
|
6308
6402
|
]
|
|
@@ -6315,14 +6409,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6315
6409
|
}
|
|
6316
6410
|
),
|
|
6317
6411
|
/* @__PURE__ */ jsx34("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsxs26("tr", { "aria-hidden": "true", children: [
|
|
6318
|
-
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 }) }),
|
|
6319
6413
|
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell" }),
|
|
6320
6414
|
visible.map((col) => /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(
|
|
6321
6415
|
KjunSkeleton,
|
|
6322
6416
|
{
|
|
6323
6417
|
type: "block",
|
|
6324
|
-
height:
|
|
6325
|
-
width: col.key === "actions" ?
|
|
6418
|
+
height: tokens33.table.skeletonHeight,
|
|
6419
|
+
width: col.key === "actions" ? tokens33.table.actionColumnWidth : "75%"
|
|
6326
6420
|
}
|
|
6327
6421
|
) }, col.key))
|
|
6328
6422
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
@@ -6332,7 +6426,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6332
6426
|
className: "kjun-table-empty",
|
|
6333
6427
|
children: emptyContent || emptyText
|
|
6334
6428
|
}
|
|
6335
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(
|
|
6429
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ jsxs26(Fragment15, { children: [
|
|
6336
6430
|
/* @__PURE__ */ jsxs26(
|
|
6337
6431
|
"tr",
|
|
6338
6432
|
{
|
|
@@ -6477,7 +6571,7 @@ function TableCards({
|
|
|
6477
6571
|
|
|
6478
6572
|
// packages/react/src/table-view.tsx
|
|
6479
6573
|
import { useEffect as useEffect20, useState as useState26 } from "react";
|
|
6480
|
-
import { isComposingKey as isComposingKey4, tokens as
|
|
6574
|
+
import { isComposingKey as isComposingKey4, tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6481
6575
|
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6482
6576
|
function KjunTable(props) {
|
|
6483
6577
|
const m = useKjunMessages();
|
|
@@ -6509,7 +6603,7 @@ function KjunTable(props) {
|
|
|
6509
6603
|
} = props;
|
|
6510
6604
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
6511
6605
|
useEffect20(() => {
|
|
6512
|
-
const media = matchMedia(`(width < ${
|
|
6606
|
+
const media = matchMedia(`(width < ${tokens34.table.mobileBreakpoint}px)`);
|
|
6513
6607
|
const update = () => setMobile(media.matches);
|
|
6514
6608
|
update();
|
|
6515
6609
|
media.addEventListener("change", update);
|
|
@@ -6613,8 +6707,8 @@ function KjunTable(props) {
|
|
|
6613
6707
|
}
|
|
6614
6708
|
|
|
6615
6709
|
// packages/react/src/kpi.tsx
|
|
6616
|
-
import { tokens as
|
|
6617
|
-
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";
|
|
6618
6712
|
var kpiFormat = (item, value = item.value) => {
|
|
6619
6713
|
var _a, _b;
|
|
6620
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, {
|
|
@@ -6622,7 +6716,7 @@ var kpiFormat = (item, value = item.value) => {
|
|
|
6622
6716
|
maximumFractionDigits: (_b = item.decimals) != null ? _b : 0
|
|
6623
6717
|
}).format(item.semantic === "price" ? Math.abs(value) : value);
|
|
6624
6718
|
};
|
|
6625
|
-
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})`;
|
|
6626
6720
|
function KjunKpiHero(props) {
|
|
6627
6721
|
const {
|
|
6628
6722
|
loading = false,
|
|
@@ -6646,7 +6740,7 @@ function KjunKpiHero(props) {
|
|
|
6646
6740
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6647
6741
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6648
6742
|
);
|
|
6649
|
-
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(
|
|
6743
|
+
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs29(Fragment16, { children: [
|
|
6650
6744
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6651
6745
|
kind === "absolute" && prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
6652
6746
|
new Intl.NumberFormat(void 0, {
|
|
@@ -6666,7 +6760,7 @@ function KjunKpiHero(props) {
|
|
|
6666
6760
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__layout", children: [
|
|
6667
6761
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-hero__main", children: [
|
|
6668
6762
|
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__label", children: label }),
|
|
6669
|
-
/* @__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: [
|
|
6670
6764
|
prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
6671
6765
|
/* @__PURE__ */ jsx37(
|
|
6672
6766
|
KjunAnimatedNumber,
|
|
@@ -6681,8 +6775,8 @@ function KjunKpiHero(props) {
|
|
|
6681
6775
|
] }) }),
|
|
6682
6776
|
showDelta && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6683
6777
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6684
|
-
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width:
|
|
6685
|
-
) : /* @__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: [
|
|
6686
6780
|
deltaAbsolute !== null && /* @__PURE__ */ jsx37(
|
|
6687
6781
|
"span",
|
|
6688
6782
|
{
|
|
@@ -6719,7 +6813,7 @@ function KjunKpiHero(props) {
|
|
|
6719
6813
|
{
|
|
6720
6814
|
className: "kjun-kpi-hero__sec-value",
|
|
6721
6815
|
style: { color: kpiColor(item.value, item.semantic) },
|
|
6722
|
-
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: [
|
|
6723
6817
|
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
6724
6818
|
/* @__PURE__ */ jsx37("span", { children: kpiFormat(item) }),
|
|
6725
6819
|
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
@@ -6790,11 +6884,11 @@ function KjunKpiRow({
|
|
|
6790
6884
|
"aria-busy": loading || items.some((item) => item.loading),
|
|
6791
6885
|
ref: domainColorRef(!loading && items.some((item) => {
|
|
6792
6886
|
var _a2, _b;
|
|
6793
|
-
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-")));
|
|
6794
6888
|
})),
|
|
6795
6889
|
children: items.map((item, i) => {
|
|
6796
|
-
var _a2;
|
|
6797
|
-
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 = () => {
|
|
6798
6892
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6799
6893
|
};
|
|
6800
6894
|
return /* @__PURE__ */ jsxs29(
|
|
@@ -6802,6 +6896,7 @@ function KjunKpiRow({
|
|
|
6802
6896
|
{
|
|
6803
6897
|
role: item.clickable ? "button" : void 0,
|
|
6804
6898
|
tabIndex: item.clickable && !busy ? 0 : void 0,
|
|
6899
|
+
"data-state": busy ? "loading" : present || item.valueSegments ? "ready" : "missing",
|
|
6805
6900
|
"aria-disabled": item.clickable && busy || void 0,
|
|
6806
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" : ""),
|
|
6807
6902
|
onClick: click,
|
|
@@ -6813,7 +6908,7 @@ function KjunKpiRow({
|
|
|
6813
6908
|
},
|
|
6814
6909
|
children: [
|
|
6815
6910
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6816
|
-
/* @__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 }),
|
|
6817
6912
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6818
6913
|
] }),
|
|
6819
6914
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6821,9 +6916,9 @@ function KjunKpiRow({
|
|
|
6821
6916
|
"div",
|
|
6822
6917
|
{
|
|
6823
6918
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
6824
|
-
title: item.valueKind === "text" ? String(
|
|
6919
|
+
title: item.valueKind === "text" && present ? String(value) : void 0,
|
|
6825
6920
|
style: {
|
|
6826
|
-
color: item.valueClass ? void 0 : kpiColor(
|
|
6921
|
+
color: item.valueClass ? void 0 : kpiColor(value, item.semantic)
|
|
6827
6922
|
},
|
|
6828
6923
|
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ jsxs29(
|
|
6829
6924
|
"span",
|
|
@@ -6835,18 +6930,18 @@ function KjunKpiRow({
|
|
|
6835
6930
|
]
|
|
6836
6931
|
},
|
|
6837
6932
|
j
|
|
6838
|
-
)) : 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: [
|
|
6839
6934
|
item.prefix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6840
|
-
item.animated && typeof
|
|
6935
|
+
item.animated && typeof value === "number" ? /* @__PURE__ */ jsx37(
|
|
6841
6936
|
KjunAnimatedNumber,
|
|
6842
6937
|
{
|
|
6843
6938
|
fromPrevious: true,
|
|
6844
|
-
value
|
|
6845
|
-
formatter:
|
|
6939
|
+
value,
|
|
6940
|
+
formatter: format2
|
|
6846
6941
|
}
|
|
6847
|
-
) :
|
|
6942
|
+
) : format2(value),
|
|
6848
6943
|
item.suffix && /* @__PURE__ */ jsx37("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6849
|
-
] })
|
|
6944
|
+
] }) : (_b = item.missingText) != null ? _b : "\u2014")
|
|
6850
6945
|
}
|
|
6851
6946
|
),
|
|
6852
6947
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
@@ -6856,7 +6951,7 @@ function KjunKpiRow({
|
|
|
6856
6951
|
{
|
|
6857
6952
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6858
6953
|
style: {
|
|
6859
|
-
color: item.descClass ? void 0 : kpiColor(
|
|
6954
|
+
color: item.descClass ? void 0 : kpiColor(value, item.semantic, "text-secondary")
|
|
6860
6955
|
},
|
|
6861
6956
|
children: busy ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6862
6957
|
}
|
|
@@ -6871,10 +6966,10 @@ function KjunKpiRow({
|
|
|
6871
6966
|
}
|
|
6872
6967
|
|
|
6873
6968
|
// packages/react/src/market-cards.tsx
|
|
6874
|
-
import { tokens as
|
|
6969
|
+
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6875
6970
|
|
|
6876
6971
|
// shared/package-runtime/market-cards.ts
|
|
6877
|
-
import { useEffect as useEffect21, useRef as
|
|
6972
|
+
import { useEffect as useEffect21, useRef as useRef29, useState as useState27 } from "react";
|
|
6878
6973
|
function useMarketCardsModel(props, persistence) {
|
|
6879
6974
|
const {
|
|
6880
6975
|
columns,
|
|
@@ -6891,7 +6986,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6891
6986
|
isDefaultSort: c.defaultSort
|
|
6892
6987
|
}));
|
|
6893
6988
|
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6894
|
-
const mounted =
|
|
6989
|
+
const mounted = useRef29("");
|
|
6895
6990
|
const save = (key2) => {
|
|
6896
6991
|
var _a;
|
|
6897
6992
|
try {
|
|
@@ -6936,14 +7031,14 @@ function useMarketCards(props) {
|
|
|
6936
7031
|
}
|
|
6937
7032
|
|
|
6938
7033
|
// packages/react/src/market-parts.tsx
|
|
6939
|
-
import { Fragment as
|
|
7034
|
+
import { Fragment as Fragment17, jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6940
7035
|
function MarketIdentity({
|
|
6941
7036
|
row,
|
|
6942
7037
|
props
|
|
6943
7038
|
}) {
|
|
6944
7039
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6945
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");
|
|
6946
|
-
const body = /* @__PURE__ */ jsxs30(
|
|
7041
|
+
const body = /* @__PURE__ */ jsxs30(Fragment17, { children: [
|
|
6947
7042
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
6948
7043
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-identity-text", children: [
|
|
6949
7044
|
/* @__PURE__ */ jsxs30("div", { className: "kjun-market-name", children: [
|
|
@@ -6971,7 +7066,7 @@ function MarketFooter({
|
|
|
6971
7066
|
totalCount = 0,
|
|
6972
7067
|
unitLabel = m.unitLabel
|
|
6973
7068
|
} = props;
|
|
6974
|
-
return /* @__PURE__ */ jsxs30(
|
|
7069
|
+
return /* @__PURE__ */ jsxs30(Fragment17, { children: [
|
|
6975
7070
|
pagination && /* @__PURE__ */ jsx38(
|
|
6976
7071
|
KjunPagination,
|
|
6977
7072
|
{
|
|
@@ -6992,7 +7087,7 @@ function MarketFooter({
|
|
|
6992
7087
|
}
|
|
6993
7088
|
|
|
6994
7089
|
// packages/react/src/market-cards.tsx
|
|
6995
|
-
import { Fragment as
|
|
7090
|
+
import { Fragment as Fragment18, jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6996
7091
|
function KjunMarketCards(props) {
|
|
6997
7092
|
const m = useKjunMessages();
|
|
6998
7093
|
const {
|
|
@@ -7043,7 +7138,7 @@ function KjunMarketCards(props) {
|
|
|
7043
7138
|
selectedKey: state.key,
|
|
7044
7139
|
selectedPill: state.pill,
|
|
7045
7140
|
metricDisplay: display
|
|
7046
|
-
}) : /* @__PURE__ */ jsxs31(
|
|
7141
|
+
}) : /* @__PURE__ */ jsxs31(Fragment18, { children: [
|
|
7047
7142
|
/* @__PURE__ */ jsx39(
|
|
7048
7143
|
KjunDataState,
|
|
7049
7144
|
{
|
|
@@ -7079,10 +7174,10 @@ function KjunMarketCards(props) {
|
|
|
7079
7174
|
KjunSparkline,
|
|
7080
7175
|
{
|
|
7081
7176
|
data: getValue(row, state.key) || [],
|
|
7082
|
-
width:
|
|
7083
|
-
height:
|
|
7177
|
+
width: tokens36.extensions.marketTable.sparklineWidth,
|
|
7178
|
+
height: tokens36.extensions.marketTable.sparklineHeight
|
|
7084
7179
|
}
|
|
7085
|
-
) : 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(
|
|
7086
7181
|
KjunSignedValue,
|
|
7087
7182
|
{
|
|
7088
7183
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -7090,7 +7185,7 @@ function KjunMarketCards(props) {
|
|
|
7090
7185
|
stale: !!getValue(row, "stale"),
|
|
7091
7186
|
tone: "pill"
|
|
7092
7187
|
}
|
|
7093
|
-
) : 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: [
|
|
7094
7189
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
7095
7190
|
props,
|
|
7096
7191
|
row,
|
|
@@ -7113,7 +7208,7 @@ function KjunMarketCards(props) {
|
|
|
7113
7208
|
}
|
|
7114
7209
|
|
|
7115
7210
|
// packages/react/src/market-list.tsx
|
|
7116
|
-
import { tokens as
|
|
7211
|
+
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
7117
7212
|
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7118
7213
|
function KjunMarketSimpleList(props) {
|
|
7119
7214
|
const m = useKjunMessages();
|
|
@@ -7180,7 +7275,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7180
7275
|
fetchedAt
|
|
7181
7276
|
}
|
|
7182
7277
|
)),
|
|
7183
|
-
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(
|
|
7184
7279
|
KjunSignedValue,
|
|
7185
7280
|
{
|
|
7186
7281
|
value: change,
|
|
@@ -7204,7 +7299,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7204
7299
|
}
|
|
7205
7300
|
|
|
7206
7301
|
// packages/react/src/market-panel.tsx
|
|
7207
|
-
import { tokens as
|
|
7302
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7208
7303
|
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7209
7304
|
function KjunMarketListPanel({
|
|
7210
7305
|
controls,
|
|
@@ -7212,12 +7307,12 @@ function KjunMarketListPanel({
|
|
|
7212
7307
|
}) {
|
|
7213
7308
|
return /* @__PURE__ */ jsxs33(KjunCard, { children: [
|
|
7214
7309
|
/* @__PURE__ */ jsx41("div", { children: controls }),
|
|
7215
|
-
/* @__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 })
|
|
7216
7311
|
] });
|
|
7217
7312
|
}
|
|
7218
7313
|
|
|
7219
7314
|
// packages/react/src/market-table.tsx
|
|
7220
|
-
import { tokens as
|
|
7315
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7221
7316
|
|
|
7222
7317
|
// shared/package-runtime/trailing-overflow.ts
|
|
7223
7318
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7234,7 +7329,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7234
7329
|
}
|
|
7235
7330
|
|
|
7236
7331
|
// packages/react/src/market-table.tsx
|
|
7237
|
-
import { useEffect as useEffect22, useRef as
|
|
7332
|
+
import { useEffect as useEffect22, useRef as useRef30, useState as useState28 } from "react";
|
|
7238
7333
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7239
7334
|
function KjunMarketTable(props) {
|
|
7240
7335
|
const m = useKjunMessages();
|
|
@@ -7256,12 +7351,12 @@ function KjunMarketTable(props) {
|
|
|
7256
7351
|
formatMetric,
|
|
7257
7352
|
renderCell
|
|
7258
7353
|
} = props;
|
|
7259
|
-
const scroller =
|
|
7354
|
+
const scroller = useRef30(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
7260
7355
|
useEffect22(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7261
7356
|
const render = (row, col) => {
|
|
7262
7357
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7263
7358
|
if (cellLoading(row, col))
|
|
7264
|
-
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7359
|
+
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens39.extensions.marketTable.valueSkeletonHeight, width: tokens39.extensions.marketTable.valueSkeletonWidth });
|
|
7265
7360
|
if (renderCell) return renderCell(row, col);
|
|
7266
7361
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7267
7362
|
return /* @__PURE__ */ jsx42(MarketIdentity, { row, props });
|
|
@@ -7270,8 +7365,8 @@ function KjunMarketTable(props) {
|
|
|
7270
7365
|
KjunSparkline,
|
|
7271
7366
|
{
|
|
7272
7367
|
data: Array.isArray(value) ? value : [],
|
|
7273
|
-
width:
|
|
7274
|
-
height:
|
|
7368
|
+
width: tokens39.extensions.marketTable.sparklineWidth,
|
|
7369
|
+
height: tokens39.extensions.marketTable.sparklineHeight
|
|
7275
7370
|
}
|
|
7276
7371
|
);
|
|
7277
7372
|
if (col.type === "price")
|
|
@@ -7353,7 +7448,7 @@ function KjunMarketTable(props) {
|
|
|
7353
7448
|
KjunIcon,
|
|
7354
7449
|
{
|
|
7355
7450
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7356
|
-
size:
|
|
7451
|
+
size: tokens39.extensions.marketTable.sortIconSize
|
|
7357
7452
|
}
|
|
7358
7453
|
)
|
|
7359
7454
|
]
|
|
@@ -7413,7 +7508,7 @@ function KjunMarketTable(props) {
|
|
|
7413
7508
|
{
|
|
7414
7509
|
style: {
|
|
7415
7510
|
textAlign: col.align,
|
|
7416
|
-
fontWeight: col.weight === "bold" ?
|
|
7511
|
+
fontWeight: col.weight === "bold" ? tokens39.typography.control.fontWeight : void 0
|
|
7417
7512
|
},
|
|
7418
7513
|
children: [
|
|
7419
7514
|
render(row, col),
|
|
@@ -7446,52 +7541,64 @@ function KjunMarketTable(props) {
|
|
|
7446
7541
|
}
|
|
7447
7542
|
|
|
7448
7543
|
// packages/react/src/list.tsx
|
|
7449
|
-
import { tokens as
|
|
7450
|
-
import { useEffect as useEffect23, useId as useId12, useRef as
|
|
7451
|
-
import { Fragment as
|
|
7452
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7453
|
-
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);
|
|
7454
7549
|
useEffect23(() => {
|
|
7455
7550
|
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7456
7551
|
}, [pressable]);
|
|
7457
|
-
const
|
|
7458
|
-
|
|
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 }),
|
|
7459
7555
|
/* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
|
|
7460
7556
|
/* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
|
|
7461
7557
|
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description }),
|
|
7462
7558
|
hasContent(children) && /* @__PURE__ */ jsx43("span", { ref: content, className: "kjun-list-content", children })
|
|
7463
7559
|
] }),
|
|
7464
7560
|
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7465
|
-
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 })
|
|
7466
7562
|
] });
|
|
7467
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 });
|
|
7468
|
-
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: [
|
|
7469
7565
|
main,
|
|
7470
7566
|
actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7471
7567
|
] });
|
|
7472
7568
|
}
|
|
7473
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7569
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default", radius = "none" }) {
|
|
7474
7570
|
const id = "kjun-" + useId12();
|
|
7475
|
-
return /* @__PURE__ */ jsxs35(
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7571
|
+
return /* @__PURE__ */ jsxs35(
|
|
7572
|
+
"section",
|
|
7573
|
+
{
|
|
7574
|
+
className: "kjun-list-section",
|
|
7575
|
+
"data-surface": surface ? void 0 : "false",
|
|
7576
|
+
"data-radius": radius === "none" ? void 0 : radius,
|
|
7577
|
+
style: radius === "none" ? void 0 : { borderRadius: `var(--_kjun-geometry-card-radii-${radius})` },
|
|
7578
|
+
"aria-labelledby": title ? id : void 0,
|
|
7579
|
+
"aria-label": title ? void 0 : ariaLabel,
|
|
7580
|
+
children: [
|
|
7581
|
+
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", "data-bare": title && !description ? "" : void 0, children: [
|
|
7582
|
+
/* @__PURE__ */ jsxs35("div", { children: [
|
|
7583
|
+
title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
|
|
7584
|
+
description && /* @__PURE__ */ jsx43("p", { children: description })
|
|
7585
|
+
] }),
|
|
7586
|
+
actions
|
|
7587
|
+
] }),
|
|
7588
|
+
/* @__PURE__ */ jsx43("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
|
|
7589
|
+
]
|
|
7590
|
+
}
|
|
7591
|
+
);
|
|
7485
7592
|
}
|
|
7486
7593
|
function KjunListItem({ children }) {
|
|
7487
7594
|
return /* @__PURE__ */ jsx43("li", { className: "kjun-list-item", children });
|
|
7488
7595
|
}
|
|
7489
7596
|
|
|
7490
7597
|
// packages/react/src/app-navigation.tsx
|
|
7491
|
-
import { tokens as
|
|
7598
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7492
7599
|
import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7493
|
-
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7494
|
-
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: [
|
|
7495
7602
|
leading && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7496
7603
|
/* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-title", children: [
|
|
7497
7604
|
/* @__PURE__ */ jsx44("strong", { children: title }),
|
|
@@ -7500,19 +7607,19 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
7500
7607
|
actions && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children: actions })
|
|
7501
7608
|
] }) }) });
|
|
7502
7609
|
}
|
|
7503
|
-
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 }) {
|
|
7504
7611
|
const m = useKjunMessages();
|
|
7505
7612
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
7506
7613
|
const hasIcons = items.some((item) => item.icon);
|
|
7507
7614
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7508
|
-
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) => {
|
|
7509
7616
|
const badge = item.badge != null && /* @__PURE__ */ jsx44("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
7510
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) => {
|
|
7511
7618
|
if (item.disabled) event.preventDefault();
|
|
7512
7619
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7513
7620
|
}, children: [
|
|
7514
7621
|
hasIcons && /* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-icon", children: [
|
|
7515
|
-
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size:
|
|
7622
|
+
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size: tokens41.extensions.bottomNavigation.iconSize }),
|
|
7516
7623
|
badge
|
|
7517
7624
|
] }),
|
|
7518
7625
|
/* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7522,20 +7629,20 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7522
7629
|
] }, item.key);
|
|
7523
7630
|
}) });
|
|
7524
7631
|
}
|
|
7525
|
-
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7632
|
+
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false, surface = true }) {
|
|
7526
7633
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7527
|
-
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: [
|
|
7528
7635
|
description && /* @__PURE__ */ jsx44("p", { children: description }),
|
|
7529
7636
|
/* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children })
|
|
7530
7637
|
] }) });
|
|
7531
7638
|
}
|
|
7532
7639
|
|
|
7533
7640
|
// packages/react/src/media.tsx
|
|
7534
|
-
import { useRef as
|
|
7535
|
-
import { tokens as
|
|
7641
|
+
import { useRef as useRef32, useState as useState29 } from "react";
|
|
7642
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7536
7643
|
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7537
7644
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7538
|
-
const current =
|
|
7645
|
+
const current = useRef32({ src, version: 0 });
|
|
7539
7646
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7540
7647
|
const version = current.current.version;
|
|
7541
7648
|
const [result, setResult] = useState29({ version, state: "loading" });
|
|
@@ -7551,28 +7658,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7551
7658
|
setResult({ version, state: "error" });
|
|
7552
7659
|
onError == null ? void 0 : onError();
|
|
7553
7660
|
} }, version),
|
|
7554
|
-
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 }) })
|
|
7555
7662
|
] });
|
|
7556
7663
|
}
|
|
7557
7664
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7558
7665
|
const m = useKjunMessages();
|
|
7559
|
-
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 }) });
|
|
7560
7667
|
}
|
|
7561
7668
|
|
|
7562
7669
|
// packages/react/src/chip.tsx
|
|
7563
|
-
import { tokens as
|
|
7670
|
+
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7564
7671
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7565
7672
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7566
7673
|
const m = useKjunMessages();
|
|
7567
7674
|
return /* @__PURE__ */ jsxs38("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7568
|
-
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size:
|
|
7675
|
+
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size: tokens43.extensions.chip.iconSizes[size] }),
|
|
7569
7676
|
/* @__PURE__ */ jsx46("span", { children: label }),
|
|
7570
|
-
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] }) })
|
|
7571
7678
|
] });
|
|
7572
7679
|
}
|
|
7573
7680
|
|
|
7574
7681
|
// packages/react/src/fab.tsx
|
|
7575
|
-
import { tokens as
|
|
7682
|
+
import { tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7576
7683
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7577
7684
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7578
7685
|
return /* @__PURE__ */ jsx47(
|
|
@@ -7583,26 +7690,36 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7583
7690
|
"aria-label": ariaLabel,
|
|
7584
7691
|
disabled,
|
|
7585
7692
|
onClick,
|
|
7586
|
-
style: { bottom:
|
|
7587
|
-
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 })
|
|
7588
7695
|
}
|
|
7589
7696
|
);
|
|
7590
7697
|
}
|
|
7591
7698
|
|
|
7592
7699
|
// packages/react/src/range-input.tsx
|
|
7593
|
-
import { useEffect as useEffect24, useRef as
|
|
7594
|
-
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";
|
|
7595
7702
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
7596
|
-
import { Fragment as
|
|
7597
|
-
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 }) {
|
|
7598
7715
|
const m = useKjunMessages();
|
|
7599
7716
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7600
7717
|
const domain = createSliderDomain(min, max, step);
|
|
7601
7718
|
const list = Array.isArray(value) ? value : [value];
|
|
7602
7719
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7603
|
-
const latest =
|
|
7720
|
+
const latest = useRef33(value);
|
|
7604
7721
|
latest.current = value;
|
|
7605
|
-
const active =
|
|
7722
|
+
const active = useRef33(false);
|
|
7606
7723
|
useEffect24(() => {
|
|
7607
7724
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7608
7725
|
}, [valid]);
|
|
@@ -7621,14 +7738,14 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7621
7738
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7622
7739
|
}
|
|
7623
7740
|
}, children: [
|
|
7624
|
-
/* @__PURE__ */ jsxs39("div", { className: "kjun-slider-caption", children: [
|
|
7741
|
+
(label || showValue) && /* @__PURE__ */ jsxs39("div", { className: "kjun-slider-caption", children: [
|
|
7625
7742
|
label && /* @__PURE__ */ jsx48(Label, { className: "kjun-slider-label", children: label }),
|
|
7626
|
-
/* @__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 ") })
|
|
7627
7744
|
] }),
|
|
7628
|
-
/* @__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: [
|
|
7629
7746
|
/* @__PURE__ */ jsx48("div", { className: "kjun-slider-rail" }),
|
|
7630
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 + "%" } }),
|
|
7631
|
-
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))
|
|
7632
7749
|
] }) })
|
|
7633
7750
|
] });
|
|
7634
7751
|
}
|
|
@@ -7640,18 +7757,18 @@ function KjunRangeSlider(props) {
|
|
|
7640
7757
|
}
|
|
7641
7758
|
|
|
7642
7759
|
// packages/react/src/quantity-stepper.tsx
|
|
7643
|
-
import { useEffect as useEffect25, useRef as
|
|
7644
|
-
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";
|
|
7645
7762
|
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7646
7763
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7647
7764
|
const m = useKjunMessages();
|
|
7648
|
-
const geometry =
|
|
7649
|
-
const buttonStyle = { width:
|
|
7765
|
+
const geometry = tokens45.extensions.compound;
|
|
7766
|
+
const buttonStyle = { width: tokens45.input[size].height, padding: 0 };
|
|
7650
7767
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
7651
7768
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7652
7769
|
const [draft, setDraft] = useState30(String(value));
|
|
7653
7770
|
const field = useKjunField();
|
|
7654
|
-
const composing =
|
|
7771
|
+
const composing = useRef34(false), dirty = useRef34(false), accepted = useRef34(value);
|
|
7655
7772
|
useEffect25(() => {
|
|
7656
7773
|
setDraft(String(value));
|
|
7657
7774
|
accepted.current = value;
|
|
@@ -7732,13 +7849,13 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7732
7849
|
}
|
|
7733
7850
|
|
|
7734
7851
|
// packages/react/src/time-picker.tsx
|
|
7735
|
-
import { Fragment as
|
|
7852
|
+
import { Fragment as Fragment21, useEffect as useEffect26, useId as useId13, useMemo as useMemo3, useRef as useRef35 } from "react";
|
|
7736
7853
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
7737
7854
|
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7738
7855
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7739
7856
|
const m = useKjunMessages();
|
|
7740
7857
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7741
|
-
const root =
|
|
7858
|
+
const root = useRef35(null);
|
|
7742
7859
|
const field = useKjunField(), uid = useId13();
|
|
7743
7860
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7744
7861
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
@@ -7757,7 +7874,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7757
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) => {
|
|
7758
7875
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7759
7876
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7760
|
-
return /* @__PURE__ */ jsxs41(
|
|
7877
|
+
return /* @__PURE__ */ jsxs41(Fragment21, { children: [
|
|
7761
7878
|
index > 0 && /* @__PURE__ */ jsx50("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7762
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: [
|
|
7763
7880
|
/* @__PURE__ */ jsx50("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|