@kjun-ui/react 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +514 -401
- package/dist/index.js +414 -300
- package/dist/styles.css +72 -0
- package/dist/types/packages/react/src/card.d.cts +8 -2
- package/dist/types/packages/react/src/card.d.ts +8 -2
- package/dist/types/packages/react/src/display.d.cts +2 -1
- package/dist/types/packages/react/src/display.d.ts +2 -1
- package/dist/types/packages/react/src/feedback.d.cts +5 -2
- package/dist/types/packages/react/src/feedback.d.ts +5 -2
- package/dist/types/packages/react/src/layout-primitives.d.cts +1 -1
- package/dist/types/packages/react/src/layout-primitives.d.ts +1 -1
- package/dist/types/packages/react/src/list.d.cts +13 -2
- package/dist/types/packages/react/src/list.d.ts +13 -2
- package/dist/types/packages/react/src/media.d.cts +4 -2
- package/dist/types/packages/react/src/media.d.ts +4 -2
- package/dist/types/shared/package-runtime/layout-primitives.d.cts +1 -1
- package/dist/types/shared/package-runtime/layout-primitives.d.ts +1 -1
- package/dist/types/shared/package-runtime/progress-circle.d.cts +11 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +11 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1577,13 +1577,41 @@ function alertRole(tone, live) {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
|
|
1579
1579
|
// packages/react/src/display.tsx
|
|
1580
|
+
import { tokens as tokens8 } from "@kjun-ui/tokens";
|
|
1581
|
+
|
|
1582
|
+
// shared/package-runtime/progress-circle.ts
|
|
1580
1583
|
import { tokens as tokens7 } from "@kjun-ui/tokens";
|
|
1584
|
+
function progressCircle(size, percentage) {
|
|
1585
|
+
const { size: diameter, stroke } = tokens7.extensions.progress.circle[size];
|
|
1586
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1587
|
+
return {
|
|
1588
|
+
diameter,
|
|
1589
|
+
stroke,
|
|
1590
|
+
radius,
|
|
1591
|
+
centre: diameter / 2,
|
|
1592
|
+
circumference,
|
|
1593
|
+
offset: circumference * (1 - percentage / 100),
|
|
1594
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
1595
|
+
showsPercentage: size !== "sm"
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
// packages/react/src/display.tsx
|
|
1581
1600
|
import {
|
|
1582
1601
|
useState as useState6
|
|
1583
1602
|
} from "react";
|
|
1584
1603
|
|
|
1585
1604
|
// packages/react/src/card.tsx
|
|
1605
|
+
import { useEffect as useEffect3, useRef as useRef7 } from "react";
|
|
1586
1606
|
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1607
|
+
var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
1608
|
+
function developmentMode3() {
|
|
1609
|
+
try {
|
|
1610
|
+
return true;
|
|
1611
|
+
} catch (e) {
|
|
1612
|
+
return false;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1587
1615
|
function KjunCard({
|
|
1588
1616
|
title,
|
|
1589
1617
|
subtitle,
|
|
@@ -1598,17 +1626,46 @@ function KjunCard({
|
|
|
1598
1626
|
elevation = "flat",
|
|
1599
1627
|
border = false,
|
|
1600
1628
|
dividers = false,
|
|
1629
|
+
pressable = false,
|
|
1630
|
+
disabled = false,
|
|
1631
|
+
ariaLabel,
|
|
1601
1632
|
children,
|
|
1602
1633
|
style,
|
|
1603
1634
|
className = "",
|
|
1635
|
+
onClick,
|
|
1636
|
+
onKeyDown,
|
|
1604
1637
|
...props
|
|
1605
1638
|
}) {
|
|
1639
|
+
const root = useRef7(null);
|
|
1640
|
+
useEffect3(() => {
|
|
1641
|
+
var _a;
|
|
1642
|
+
if (pressable && developmentMode3() && ((_a = root.current) == null ? void 0 : _a.querySelector(interactive)))
|
|
1643
|
+
console.warn("KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
|
|
1644
|
+
}, [pressable]);
|
|
1645
|
+
const press = pressable ? {
|
|
1646
|
+
role: "button",
|
|
1647
|
+
tabIndex: disabled ? -1 : 0,
|
|
1648
|
+
"aria-disabled": disabled || void 0,
|
|
1649
|
+
"aria-label": ariaLabel != null ? ariaLabel : title,
|
|
1650
|
+
"data-pressable": "",
|
|
1651
|
+
onClick: (event) => {
|
|
1652
|
+
if (!disabled) onClick == null ? void 0 : onClick(event);
|
|
1653
|
+
},
|
|
1654
|
+
onKeyDown: (event) => {
|
|
1655
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
1656
|
+
if (event.defaultPrevented || disabled || event.key !== "Enter" && event.key !== " ") return;
|
|
1657
|
+
event.preventDefault();
|
|
1658
|
+
event.currentTarget.click();
|
|
1659
|
+
}
|
|
1660
|
+
} : { onClick, onKeyDown };
|
|
1606
1661
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
1607
1662
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
1608
1663
|
return /* @__PURE__ */ jsxs5(
|
|
1609
1664
|
"div",
|
|
1610
1665
|
{
|
|
1611
1666
|
...props,
|
|
1667
|
+
...press,
|
|
1668
|
+
ref: root,
|
|
1612
1669
|
className: ["kjun-card", className].filter(Boolean).join(" "),
|
|
1613
1670
|
"data-surface": surface,
|
|
1614
1671
|
"data-padding": padding,
|
|
@@ -1620,7 +1677,8 @@ function KjunCard({
|
|
|
1620
1677
|
"--_kjun-card-padding": `var(--_kjun-geometry-card-padding-${padding})`,
|
|
1621
1678
|
"--_kjun-card-body-padding": `var(--_kjun-geometry-card-padding-${bodyPadding})`,
|
|
1622
1679
|
borderRadius: `var(--_kjun-geometry-card-radii-${radius})`,
|
|
1623
|
-
|
|
1680
|
+
// A pressable card's shadow comes from CSS so its hover lift can replace it.
|
|
1681
|
+
[pressable ? "--_kjun-card-shadow" : "boxShadow"]: `var(--_kjun-card-elevation-${elevation})`,
|
|
1624
1682
|
...style
|
|
1625
1683
|
},
|
|
1626
1684
|
children: [
|
|
@@ -1650,7 +1708,7 @@ function KjunBadge({
|
|
|
1650
1708
|
style,
|
|
1651
1709
|
...props
|
|
1652
1710
|
}) {
|
|
1653
|
-
const { x, y } =
|
|
1711
|
+
const { x, y } = tokens8.extensions.badge.padding[size];
|
|
1654
1712
|
const neutral = variant === "default" || variant === "secondary";
|
|
1655
1713
|
return /* @__PURE__ */ jsxs6(
|
|
1656
1714
|
"span",
|
|
@@ -1685,7 +1743,7 @@ function KjunEmpty({
|
|
|
1685
1743
|
const m = useKjunMessages();
|
|
1686
1744
|
text != null ? text : text = m.noData;
|
|
1687
1745
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-empty", children: [
|
|
1688
|
-
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size:
|
|
1746
|
+
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size: tokens8.extensions.empty.iconSize }),
|
|
1689
1747
|
/* @__PURE__ */ jsx9("p", { children: text }),
|
|
1690
1748
|
description && /* @__PURE__ */ jsx9("small", { children: description }),
|
|
1691
1749
|
children && /* @__PURE__ */ jsx9("div", { children })
|
|
@@ -1693,14 +1751,14 @@ function KjunEmpty({
|
|
|
1693
1751
|
}
|
|
1694
1752
|
function KjunSpinner({ size = "md", text }) {
|
|
1695
1753
|
const m = useKjunMessages();
|
|
1696
|
-
const stroke =
|
|
1754
|
+
const stroke = tokens8.extensions.spinner.strokeWidths[size] * 24 / tokens8.extensions.spinner.sizes[size];
|
|
1697
1755
|
return /* @__PURE__ */ jsxs6("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1698
1756
|
/* @__PURE__ */ jsxs6(
|
|
1699
1757
|
"svg",
|
|
1700
1758
|
{
|
|
1701
1759
|
className: "kjun-spin",
|
|
1702
|
-
width:
|
|
1703
|
-
height:
|
|
1760
|
+
width: tokens8.extensions.spinner.sizes[size],
|
|
1761
|
+
height: tokens8.extensions.spinner.sizes[size],
|
|
1704
1762
|
viewBox: "0 0 24 24",
|
|
1705
1763
|
fill: "none",
|
|
1706
1764
|
"aria-hidden": "true",
|
|
@@ -1766,7 +1824,7 @@ function KjunAlert({
|
|
|
1766
1824
|
warning: "alert-triangle",
|
|
1767
1825
|
danger: "alert-circle"
|
|
1768
1826
|
}[tone],
|
|
1769
|
-
size:
|
|
1827
|
+
size: tokens8.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1770
1828
|
}
|
|
1771
1829
|
) }),
|
|
1772
1830
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-alert-content", children: [
|
|
@@ -1784,7 +1842,7 @@ function KjunAlert({
|
|
|
1784
1842
|
setVisible(false);
|
|
1785
1843
|
onClose == null ? void 0 : onClose();
|
|
1786
1844
|
},
|
|
1787
|
-
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size:
|
|
1845
|
+
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size: tokens8.extensions.alert.closeIconSize })
|
|
1788
1846
|
}
|
|
1789
1847
|
)
|
|
1790
1848
|
]
|
|
@@ -1798,10 +1856,55 @@ function KjunProgress({
|
|
|
1798
1856
|
variant = "primary",
|
|
1799
1857
|
showLabel = false,
|
|
1800
1858
|
label,
|
|
1801
|
-
subLabel
|
|
1859
|
+
subLabel,
|
|
1860
|
+
shape = "bar"
|
|
1802
1861
|
}) {
|
|
1803
1862
|
const m = useKjunMessages();
|
|
1804
1863
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1864
|
+
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
1865
|
+
if (shape === "circle") {
|
|
1866
|
+
const c = progressCircle(size, percentage);
|
|
1867
|
+
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1868
|
+
/* @__PURE__ */ jsxs6(
|
|
1869
|
+
"div",
|
|
1870
|
+
{
|
|
1871
|
+
role: "progressbar",
|
|
1872
|
+
"aria-label": name,
|
|
1873
|
+
"aria-valuemin": 0,
|
|
1874
|
+
"aria-valuemax": 100,
|
|
1875
|
+
"aria-valuenow": percentage,
|
|
1876
|
+
className: "kjun-progress-circle",
|
|
1877
|
+
style: { width: c.diameter, height: c.diameter },
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ jsxs6("svg", { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
1880
|
+
/* @__PURE__ */ jsx9("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
1881
|
+
percentage > 0 && /* @__PURE__ */ jsx9(
|
|
1882
|
+
"circle",
|
|
1883
|
+
{
|
|
1884
|
+
className: "kjun-progress-circle-value",
|
|
1885
|
+
cx: c.centre,
|
|
1886
|
+
cy: c.centre,
|
|
1887
|
+
r: c.radius,
|
|
1888
|
+
strokeWidth: c.stroke,
|
|
1889
|
+
stroke: color,
|
|
1890
|
+
strokeLinecap: "round",
|
|
1891
|
+
strokeDasharray: c.circumference,
|
|
1892
|
+
strokeDashoffset: c.offset,
|
|
1893
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
1894
|
+
}
|
|
1895
|
+
)
|
|
1896
|
+
] }),
|
|
1897
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ jsxs6("span", { className: "kjun-progress-circle-percent", children: [
|
|
1898
|
+
percentage,
|
|
1899
|
+
"%"
|
|
1900
|
+
] })
|
|
1901
|
+
]
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
label && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-circle-label", children: label }),
|
|
1905
|
+
subLabel && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1906
|
+
] });
|
|
1907
|
+
}
|
|
1805
1908
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", children: [
|
|
1806
1909
|
(label || showLabel) && /* @__PURE__ */ jsxs6("div", { className: "kjun-progress-label", children: [
|
|
1807
1910
|
label && /* @__PURE__ */ jsx9("span", { children: label }),
|
|
@@ -1814,18 +1917,18 @@ function KjunProgress({
|
|
|
1814
1917
|
"div",
|
|
1815
1918
|
{
|
|
1816
1919
|
role: "progressbar",
|
|
1817
|
-
"aria-label":
|
|
1920
|
+
"aria-label": name,
|
|
1818
1921
|
"aria-valuemin": 0,
|
|
1819
1922
|
"aria-valuemax": 100,
|
|
1820
1923
|
"aria-valuenow": percentage,
|
|
1821
1924
|
className: "kjun-progress-track",
|
|
1822
|
-
style: { height:
|
|
1925
|
+
style: { height: tokens8.extensions.progress.heights[size] },
|
|
1823
1926
|
children: /* @__PURE__ */ jsx9(
|
|
1824
1927
|
"div",
|
|
1825
1928
|
{
|
|
1826
1929
|
style: {
|
|
1827
1930
|
width: percentage + "%",
|
|
1828
|
-
background:
|
|
1931
|
+
background: color
|
|
1829
1932
|
}
|
|
1830
1933
|
}
|
|
1831
1934
|
)
|
|
@@ -1856,9 +1959,9 @@ function KjunSkeleton({
|
|
|
1856
1959
|
{
|
|
1857
1960
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
1858
1961
|
style: sm ? void 0 : {
|
|
1859
|
-
width: width ||
|
|
1860
|
-
height: height ||
|
|
1861
|
-
borderRadius: rounded ? "50%" :
|
|
1962
|
+
width: width || tokens8.extensions.skeleton.avatarSize,
|
|
1963
|
+
height: height || tokens8.extensions.skeleton.avatarSize,
|
|
1964
|
+
borderRadius: rounded ? "50%" : tokens8.radius.radius8
|
|
1862
1965
|
}
|
|
1863
1966
|
}
|
|
1864
1967
|
);
|
|
@@ -1882,7 +1985,7 @@ function KjunSkeleton({
|
|
|
1882
1985
|
avatar(true),
|
|
1883
1986
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
1884
1987
|
line("60%"),
|
|
1885
|
-
line("40%", void 0,
|
|
1988
|
+
line("40%", void 0, tokens8.extensions.skeleton.lineHeights.sm)
|
|
1886
1989
|
] })
|
|
1887
1990
|
] }),
|
|
1888
1991
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -1905,9 +2008,9 @@ function KjunSkeleton({
|
|
|
1905
2008
|
)) }),
|
|
1906
2009
|
type === "stat" && /* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat", children: [
|
|
1907
2010
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat-content", children: [
|
|
1908
|
-
line("40%", 0,
|
|
1909
|
-
line("60%", 1,
|
|
1910
|
-
line("30%", 2,
|
|
2011
|
+
line("40%", 0, tokens8.extensions.skeleton.lineHeights.sm),
|
|
2012
|
+
line("60%", 1, tokens8.extensions.skeleton.lineHeights.lg),
|
|
2013
|
+
line("30%", 2, tokens8.extensions.skeleton.lineHeights.sm)
|
|
1911
2014
|
] }),
|
|
1912
2015
|
/* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-sparkline" }) })
|
|
1913
2016
|
] }),
|
|
@@ -1915,7 +2018,7 @@ function KjunSkeleton({
|
|
|
1915
2018
|
"div",
|
|
1916
2019
|
{
|
|
1917
2020
|
className: "kjun-skeleton-block",
|
|
1918
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2021
|
+
style: { width: width || "100%", height: height != null ? height : tokens8.extensions.skeleton.blockHeight }
|
|
1919
2022
|
}
|
|
1920
2023
|
)
|
|
1921
2024
|
]
|
|
@@ -1975,13 +2078,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
1975
2078
|
}
|
|
1976
2079
|
|
|
1977
2080
|
// shared/package-runtime/feedback-dialog.ts
|
|
1978
|
-
import { useRef as
|
|
2081
|
+
import { useRef as useRef8, useState as useState7 } from "react";
|
|
1979
2082
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
1980
2083
|
const options = request.options;
|
|
1981
2084
|
const [value, setValue] = useState7(options.initialValue || "");
|
|
1982
2085
|
const [error, setError] = useState7("");
|
|
1983
2086
|
const [busy, setBusy] = useState7(false);
|
|
1984
|
-
const working =
|
|
2087
|
+
const working = useRef8(false);
|
|
1985
2088
|
const active = () => {
|
|
1986
2089
|
var _a;
|
|
1987
2090
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -2023,11 +2126,11 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2023
2126
|
}
|
|
2024
2127
|
|
|
2025
2128
|
// shared/package-runtime/feedback-motion.ts
|
|
2026
|
-
import { tokens as
|
|
2027
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
2129
|
+
import { tokens as tokens9 } from "@kjun-ui/tokens";
|
|
2130
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState8 } from "react";
|
|
2028
2131
|
function usePresentedToasts(toasts, reduced) {
|
|
2029
2132
|
const [items, setItems] = useState8([]);
|
|
2030
|
-
const removals =
|
|
2133
|
+
const removals = useRef9(/* @__PURE__ */ new Map());
|
|
2031
2134
|
useLayoutEffect7(() => {
|
|
2032
2135
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
2033
2136
|
setItems((previous) => {
|
|
@@ -2041,7 +2144,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2041
2144
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2042
2145
|
removals.current.delete(item.toast.id);
|
|
2043
2146
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2044
|
-
},
|
|
2147
|
+
}, tokens9.motion.toastExit));
|
|
2045
2148
|
}
|
|
2046
2149
|
return next;
|
|
2047
2150
|
});
|
|
@@ -2063,7 +2166,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
2063
2166
|
setRequest(current);
|
|
2064
2167
|
return;
|
|
2065
2168
|
}
|
|
2066
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2169
|
+
const timer = setTimeout(() => setRequest(current), tokens9.motion.layerExit);
|
|
2067
2170
|
return () => clearTimeout(timer);
|
|
2068
2171
|
}, [current, request, reduced]);
|
|
2069
2172
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -2077,11 +2180,11 @@ function useOptionalKjunFeedback() {
|
|
|
2077
2180
|
}
|
|
2078
2181
|
|
|
2079
2182
|
// packages/react/src/toast-stack.tsx
|
|
2080
|
-
import { tokens as
|
|
2081
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
2183
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
2184
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef11 } from "react";
|
|
2082
2185
|
|
|
2083
2186
|
// shared/package-runtime/toast-layout.ts
|
|
2084
|
-
import { tokens as
|
|
2187
|
+
import { tokens as tokens10 } from "@kjun-ui/tokens";
|
|
2085
2188
|
function createToastLayout() {
|
|
2086
2189
|
let root = null;
|
|
2087
2190
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2124,7 +2227,7 @@ function createToastLayout() {
|
|
|
2124
2227
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2125
2228
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2126
2229
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
2127
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
2230
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: tokens10.motion.toastMove, easing: tokens10.motion.easeOut });
|
|
2128
2231
|
animations.set(node, animation);
|
|
2129
2232
|
}
|
|
2130
2233
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2140,16 +2243,16 @@ function createToastLayout() {
|
|
|
2140
2243
|
}
|
|
2141
2244
|
|
|
2142
2245
|
// packages/react/src/toast.tsx
|
|
2143
|
-
import { useEffect as
|
|
2246
|
+
import { useEffect as useEffect4, useRef as useRef10 } from "react";
|
|
2144
2247
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2145
2248
|
function ToastView({
|
|
2146
2249
|
toast,
|
|
2147
2250
|
controller
|
|
2148
2251
|
}) {
|
|
2149
2252
|
const m = useKjunMessages();
|
|
2150
|
-
const previous =
|
|
2151
|
-
const reasons =
|
|
2152
|
-
|
|
2253
|
+
const previous = useRef10(null);
|
|
2254
|
+
const reasons = useRef10({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
2255
|
+
useEffect4(() => {
|
|
2153
2256
|
previous.current = document.activeElement;
|
|
2154
2257
|
return () => {
|
|
2155
2258
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -2244,9 +2347,9 @@ function ToastView({
|
|
|
2244
2347
|
// packages/react/src/toast-stack.tsx
|
|
2245
2348
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2246
2349
|
function ToastSurface({ item, controller }) {
|
|
2247
|
-
const ref =
|
|
2248
|
-
const current =
|
|
2249
|
-
const entryFinished =
|
|
2350
|
+
const ref = useRef11(null), reduced = useReducedMotion();
|
|
2351
|
+
const current = useRef11(null);
|
|
2352
|
+
const entryFinished = useRef11(false);
|
|
2250
2353
|
useLayoutEffect8(() => {
|
|
2251
2354
|
var _a, _b;
|
|
2252
2355
|
const el = ref.current;
|
|
@@ -2256,15 +2359,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2256
2359
|
return;
|
|
2257
2360
|
}
|
|
2258
2361
|
const elapsed = Date.now() - item.born;
|
|
2259
|
-
if (!item.exiting && (elapsed >=
|
|
2260
|
-
const hidden = `translateY(${-
|
|
2362
|
+
if (!item.exiting && (elapsed >= tokens11.motion.toastEnter || entryFinished.current)) return;
|
|
2363
|
+
const hidden = `translateY(${-tokens11.motionDistance.toast}px)`, from = current.current;
|
|
2261
2364
|
const animations = item.exiting ? [
|
|
2262
|
-
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration:
|
|
2263
|
-
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration:
|
|
2365
|
+
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration: tokens11.motion.fadeExit, easing: tokens11.motion.easeLinear, fill: "both" }),
|
|
2366
|
+
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration: tokens11.motion.toastExit, easing: tokens11.motion.easeIn, fill: "both" })
|
|
2264
2367
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2265
|
-
duration:
|
|
2368
|
+
duration: tokens11.motion.toastEnter,
|
|
2266
2369
|
delay: -elapsed,
|
|
2267
|
-
easing:
|
|
2370
|
+
easing: tokens11.motion.easeOut,
|
|
2268
2371
|
fill: "both"
|
|
2269
2372
|
})];
|
|
2270
2373
|
animations[0].onfinish = () => {
|
|
@@ -2281,7 +2384,7 @@ function ToastSurface({ item, controller }) {
|
|
|
2281
2384
|
function ToastStack({ items, controller }) {
|
|
2282
2385
|
var _a;
|
|
2283
2386
|
const layers = useLayerState();
|
|
2284
|
-
const root =
|
|
2387
|
+
const root = useRef11(null), layout = useRef11(createToastLayout());
|
|
2285
2388
|
const reduced = useReducedMotion();
|
|
2286
2389
|
useLayoutEffect8(() => {
|
|
2287
2390
|
if (root.current) layout.current.update(root.current, reduced);
|
|
@@ -2301,15 +2404,17 @@ function ToastStack({ items, controller }) {
|
|
|
2301
2404
|
|
|
2302
2405
|
// packages/react/src/feedback.tsx
|
|
2303
2406
|
import {
|
|
2304
|
-
createFeedbackController
|
|
2407
|
+
createFeedbackController,
|
|
2408
|
+
feedbackControllerOf
|
|
2305
2409
|
} from "@kjun-ui/tokens";
|
|
2306
2410
|
import {
|
|
2307
2411
|
useCallback,
|
|
2308
|
-
useEffect as
|
|
2309
|
-
useRef as
|
|
2412
|
+
useEffect as useEffect5,
|
|
2413
|
+
useRef as useRef12,
|
|
2310
2414
|
useState as useState9,
|
|
2311
2415
|
useSyncExternalStore as useSyncExternalStore3
|
|
2312
2416
|
} from "react";
|
|
2417
|
+
import { createKjunFeedback } from "@kjun-ui/tokens";
|
|
2313
2418
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2314
2419
|
function useKjunFeedback() {
|
|
2315
2420
|
const value = useOptionalKjunFeedback();
|
|
@@ -2358,10 +2463,12 @@ function FeedbackDialog({
|
|
|
2358
2463
|
}
|
|
2359
2464
|
);
|
|
2360
2465
|
}
|
|
2361
|
-
function KjunFeedbackProvider({ children }) {
|
|
2466
|
+
function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
2362
2467
|
var _a;
|
|
2363
|
-
const [
|
|
2364
|
-
const
|
|
2468
|
+
const [owned] = useState9(() => controllerProp ? void 0 : createFeedbackController());
|
|
2469
|
+
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
2470
|
+
useEffect5(() => controller.attach(), [controller]);
|
|
2471
|
+
const life = useRef12(0);
|
|
2365
2472
|
const snapshot = useSyncExternalStore3(
|
|
2366
2473
|
controller.subscribe,
|
|
2367
2474
|
controller.getSnapshot,
|
|
@@ -2370,11 +2477,11 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2370
2477
|
const reduced = useReducedMotion();
|
|
2371
2478
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2372
2479
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2373
|
-
|
|
2480
|
+
useEffect5(() => {
|
|
2374
2481
|
const version = ++life.current;
|
|
2375
2482
|
return () => {
|
|
2376
2483
|
queueMicrotask(() => {
|
|
2377
|
-
if (life.current === version) controller.dispose();
|
|
2484
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
2378
2485
|
});
|
|
2379
2486
|
};
|
|
2380
2487
|
}, [controller]);
|
|
@@ -2407,7 +2514,7 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2407
2514
|
}
|
|
2408
2515
|
|
|
2409
2516
|
// packages/react/src/controls.tsx
|
|
2410
|
-
import { tokens as
|
|
2517
|
+
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2411
2518
|
import {
|
|
2412
2519
|
createContext as createContext10,
|
|
2413
2520
|
forwardRef as forwardRef3,
|
|
@@ -2421,10 +2528,10 @@ import {
|
|
|
2421
2528
|
} from "react-aria-components";
|
|
2422
2529
|
|
|
2423
2530
|
// packages/react/src/use-selection-indicator.ts
|
|
2424
|
-
import { useLayoutEffect as useLayoutEffect9, useRef as
|
|
2531
|
+
import { useLayoutEffect as useLayoutEffect9, useRef as useRef13 } from "react";
|
|
2425
2532
|
|
|
2426
2533
|
// shared/package-runtime/selection-indicator.ts
|
|
2427
|
-
import { tokens as
|
|
2534
|
+
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2428
2535
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2429
2536
|
var _a;
|
|
2430
2537
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2464,7 +2571,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2464
2571
|
const style = getComputedStyle(next);
|
|
2465
2572
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2466
2573
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2467
|
-
const height = underline ?
|
|
2574
|
+
const height = underline ? tokens12.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2468
2575
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2469
2576
|
if (key !== bounds) {
|
|
2470
2577
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2493,9 +2600,9 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2493
2600
|
|
|
2494
2601
|
// packages/react/src/use-selection-indicator.ts
|
|
2495
2602
|
function useSelectionIndicator(tabs = false) {
|
|
2496
|
-
const group =
|
|
2497
|
-
const indicator =
|
|
2498
|
-
const sync =
|
|
2603
|
+
const group = useRef13(null);
|
|
2604
|
+
const indicator = useRef13(null);
|
|
2605
|
+
const sync = useRef13(() => {
|
|
2499
2606
|
});
|
|
2500
2607
|
useLayoutEffect9(() => {
|
|
2501
2608
|
const root = group.current, marker = indicator.current;
|
|
@@ -2562,7 +2669,7 @@ function KjunCheckbox({
|
|
|
2562
2669
|
"span",
|
|
2563
2670
|
{
|
|
2564
2671
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2565
|
-
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size:
|
|
2672
|
+
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size: tokens13.extensions.checkbox.iconSizes[size] })
|
|
2566
2673
|
}
|
|
2567
2674
|
),
|
|
2568
2675
|
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2693,7 +2800,7 @@ function KjunRadioGroup({
|
|
|
2693
2800
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2694
2801
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2695
2802
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2696
|
-
gap: direction === "vertical" ?
|
|
2803
|
+
gap: direction === "vertical" ? tokens13.dimension.value8 : tokens13.dimension.value16
|
|
2697
2804
|
},
|
|
2698
2805
|
children: children || options.map((option) => /* @__PURE__ */ jsx14(
|
|
2699
2806
|
KjunRadio,
|
|
@@ -2725,7 +2832,7 @@ var KjunTextarea = forwardRef3(
|
|
|
2725
2832
|
}, ref) {
|
|
2726
2833
|
var _a;
|
|
2727
2834
|
const field = useKjunField();
|
|
2728
|
-
const spec =
|
|
2835
|
+
const spec = tokens13.input[size];
|
|
2729
2836
|
return /* @__PURE__ */ jsx14(
|
|
2730
2837
|
"textarea",
|
|
2731
2838
|
{
|
|
@@ -2743,8 +2850,8 @@ var KjunTextarea = forwardRef3(
|
|
|
2743
2850
|
style: {
|
|
2744
2851
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2745
2852
|
lineHeight: spec.lineHeight / 16 + "rem",
|
|
2746
|
-
padding: `${spec.textareaPaddingY}px ${spec.padding -
|
|
2747
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
2853
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - tokens13.border.controlWidth}px`,
|
|
2854
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * tokens13.border.controlWidth),
|
|
2748
2855
|
borderRadius: spec.radius,
|
|
2749
2856
|
resize,
|
|
2750
2857
|
...style
|
|
@@ -2777,9 +2884,9 @@ function KjunButtonGroup({
|
|
|
2777
2884
|
className: "kjun-button-group",
|
|
2778
2885
|
onKeyDown: groupKeydown,
|
|
2779
2886
|
style: {
|
|
2780
|
-
height:
|
|
2781
|
-
padding:
|
|
2782
|
-
borderRadius:
|
|
2887
|
+
height: tokens13.buttonGroup.heights[size],
|
|
2888
|
+
padding: tokens13.buttonGroup.padding[size],
|
|
2889
|
+
borderRadius: tokens13.buttonGroup.radii[size],
|
|
2783
2890
|
width: fullWidth ? "100%" : "fit-content"
|
|
2784
2891
|
},
|
|
2785
2892
|
children: [
|
|
@@ -2790,7 +2897,7 @@ function KjunButtonGroup({
|
|
|
2790
2897
|
className: "kjun-button-group-indicator",
|
|
2791
2898
|
"aria-hidden": "true",
|
|
2792
2899
|
hidden: true,
|
|
2793
|
-
style: { borderRadius:
|
|
2900
|
+
style: { borderRadius: tokens13.buttonGroup.itemRadii[size] }
|
|
2794
2901
|
}
|
|
2795
2902
|
),
|
|
2796
2903
|
options.map((option) => /* @__PURE__ */ jsxs9(
|
|
@@ -2801,8 +2908,8 @@ function KjunButtonGroup({
|
|
|
2801
2908
|
disabled: disabled || option.disabled,
|
|
2802
2909
|
style: {
|
|
2803
2910
|
flex: fullWidth ? 1 : void 0,
|
|
2804
|
-
paddingInline:
|
|
2805
|
-
borderRadius:
|
|
2911
|
+
paddingInline: tokens13.buttonGroup.itemPaddingX[size],
|
|
2912
|
+
borderRadius: tokens13.buttonGroup.itemRadii[size],
|
|
2806
2913
|
...selectionTypeStyle(size, value === option.value)
|
|
2807
2914
|
},
|
|
2808
2915
|
onClick: () => {
|
|
@@ -2810,9 +2917,9 @@ function KjunButtonGroup({
|
|
|
2810
2917
|
onChange == null ? void 0 : onChange(option.value);
|
|
2811
2918
|
},
|
|
2812
2919
|
children: [
|
|
2813
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
2920
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens13.extensions.selection.iconSize }),
|
|
2814
2921
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-button-group-label", children: [
|
|
2815
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
2922
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens13.button.typography[size]), children: option.label }),
|
|
2816
2923
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2817
2924
|
] })
|
|
2818
2925
|
]
|
|
@@ -2848,7 +2955,7 @@ function KjunFilterGroup({
|
|
|
2848
2955
|
{
|
|
2849
2956
|
type: "button",
|
|
2850
2957
|
className: "kjun-filter-chip",
|
|
2851
|
-
style: { borderRadius:
|
|
2958
|
+
style: { borderRadius: tokens13.button.radii[size] },
|
|
2852
2959
|
"aria-pressed": selected(option.value),
|
|
2853
2960
|
disabled: disabled || option.disabled,
|
|
2854
2961
|
onClick: () => {
|
|
@@ -2860,15 +2967,15 @@ function KjunFilterGroup({
|
|
|
2860
2967
|
"span",
|
|
2861
2968
|
{
|
|
2862
2969
|
style: {
|
|
2863
|
-
height:
|
|
2864
|
-
paddingInline: { xs:
|
|
2970
|
+
height: tokens13.button.heights[size],
|
|
2971
|
+
paddingInline: { xs: tokens13.dimension.value8, sm: tokens13.dimension.value12, md: tokens13.dimension.value12, lg: tokens13.dimension.value14, xl: tokens13.dimension.value16 }[size],
|
|
2865
2972
|
...selectionTypeStyle(size, selected(option.value))
|
|
2866
2973
|
},
|
|
2867
2974
|
children: [
|
|
2868
2975
|
option.dot && /* @__PURE__ */ jsx14("i", { style: { background: option.dot } }),
|
|
2869
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
2976
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens13.extensions.selection.iconSize }),
|
|
2870
2977
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-filter-label", children: [
|
|
2871
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
2978
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens13.button.typography[size]), children: option.label }),
|
|
2872
2979
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2873
2980
|
] })
|
|
2874
2981
|
]
|
|
@@ -2882,8 +2989,8 @@ function KjunFilterGroup({
|
|
|
2882
2989
|
}
|
|
2883
2990
|
|
|
2884
2991
|
// packages/react/src/floating-panel.tsx
|
|
2885
|
-
import { isComposingKey as isComposingKey3, tokens as
|
|
2886
|
-
import { useEffect as
|
|
2992
|
+
import { isComposingKey as isComposingKey3, tokens as tokens14 } from "@kjun-ui/tokens";
|
|
2993
|
+
import { useEffect as useEffect6, useRef as useRef14 } from "react";
|
|
2887
2994
|
import { Popover as AriaPopover } from "react-aria-components";
|
|
2888
2995
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2889
2996
|
function FloatingPanel({
|
|
@@ -2901,11 +3008,11 @@ function FloatingPanel({
|
|
|
2901
3008
|
ownsDismiss = false,
|
|
2902
3009
|
returnFocus
|
|
2903
3010
|
}) {
|
|
2904
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3011
|
+
const motion = usePresence(open, useReducedMotion(), tokens14.motion.popupExit);
|
|
2905
3012
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2906
3013
|
const container = useKjunPortalContainer();
|
|
2907
|
-
const panel =
|
|
2908
|
-
|
|
3014
|
+
const panel = useRef14(null);
|
|
3015
|
+
useEffect6(() => {
|
|
2909
3016
|
var _a;
|
|
2910
3017
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2911
3018
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
@@ -2937,9 +3044,9 @@ function FloatingPanel({
|
|
|
2937
3044
|
UNSTABLE_portalContainer: container,
|
|
2938
3045
|
placement: placement.replace("-", " "),
|
|
2939
3046
|
shouldFlip: flip,
|
|
2940
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
2941
|
-
offset: field ?
|
|
2942
|
-
containerPadding:
|
|
3047
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? tokens14.extensions.menu.listMaxHeight : tokens14.extensions.floating.maxHeight : void 0,
|
|
3048
|
+
offset: field ? tokens14.extensions.floating.fieldGap : tokens14.extensions.floating.anchorGap,
|
|
3049
|
+
containerPadding: tokens14.extensions.floating.viewportInset,
|
|
2943
3050
|
className: "kjun-scope kjun-floating " + className,
|
|
2944
3051
|
"data-motion": "popup",
|
|
2945
3052
|
"data-motion-open": String(motion.active),
|
|
@@ -2954,8 +3061,8 @@ function FloatingPanel({
|
|
|
2954
3061
|
}
|
|
2955
3062
|
|
|
2956
3063
|
// packages/react/src/popover.tsx
|
|
2957
|
-
import { tokens as
|
|
2958
|
-
import { useCallback as useCallback3, useEffect as
|
|
3064
|
+
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
3065
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useId as useId6, useRef as useRef15, useState as useState10 } from "react";
|
|
2959
3066
|
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger } from "react-aria-components";
|
|
2960
3067
|
|
|
2961
3068
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -3037,9 +3144,9 @@ function KjunPopover({
|
|
|
3037
3144
|
children
|
|
3038
3145
|
}) {
|
|
3039
3146
|
const m = useKjunMessages();
|
|
3040
|
-
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref =
|
|
3147
|
+
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef15(null), id = "kjun-" + useId6();
|
|
3041
3148
|
const expanded = usePopupExpanded(open, ref);
|
|
3042
|
-
const focusOnMount =
|
|
3149
|
+
const focusOnMount = useRef15(focusOnOpen);
|
|
3043
3150
|
focusOnMount.current = focusOnOpen;
|
|
3044
3151
|
const focusContent = useCallback3((node) => {
|
|
3045
3152
|
if (node && focusOnMount.current) node.focus();
|
|
@@ -3049,8 +3156,8 @@ function KjunPopover({
|
|
|
3049
3156
|
setInternal(v);
|
|
3050
3157
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3051
3158
|
};
|
|
3052
|
-
const skipReturn =
|
|
3053
|
-
|
|
3159
|
+
const skipReturn = useRef15(false);
|
|
3160
|
+
useEffect7(() => {
|
|
3054
3161
|
if (!open || modal) return;
|
|
3055
3162
|
skipReturn.current = false;
|
|
3056
3163
|
return installNonModalPopover({
|
|
@@ -3107,7 +3214,7 @@ function KjunPopover({
|
|
|
3107
3214
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3108
3215
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3109
3216
|
className: "kjun-popover-dialog",
|
|
3110
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3217
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens15.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3111
3218
|
};
|
|
3112
3219
|
const body = /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
3113
3220
|
header != null && /* @__PURE__ */ jsx16("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3143,10 +3250,10 @@ function KjunTooltip({
|
|
|
3143
3250
|
style: { zIndex: layer.zIndex },
|
|
3144
3251
|
UNSTABLE_portalContainer: container,
|
|
3145
3252
|
placement,
|
|
3146
|
-
offset:
|
|
3253
|
+
offset: tokens15.extensions.floating.anchorGap,
|
|
3147
3254
|
className: "kjun-scope kjun-tooltip",
|
|
3148
3255
|
children: [
|
|
3149
|
-
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width:
|
|
3256
|
+
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width: tokens15.extensions.tooltip.arrowSize, height: tokens15.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx16("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
3150
3257
|
content
|
|
3151
3258
|
]
|
|
3152
3259
|
}
|
|
@@ -3155,8 +3262,8 @@ function KjunTooltip({
|
|
|
3155
3262
|
}
|
|
3156
3263
|
|
|
3157
3264
|
// packages/react/src/dropdown.tsx
|
|
3158
|
-
import { tokens as
|
|
3159
|
-
import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext11, useEffect as
|
|
3265
|
+
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
3266
|
+
import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext11, useEffect as useEffect8, useId as useId7, useRef as useRef16, useState as useState11 } from "react";
|
|
3160
3267
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
3161
3268
|
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3162
3269
|
var DropdownContext = createContext11(null);
|
|
@@ -3171,8 +3278,8 @@ function KjunDropdown({
|
|
|
3171
3278
|
onOpen,
|
|
3172
3279
|
onClose
|
|
3173
3280
|
}) {
|
|
3174
|
-
const [open, setOpen] = useState11(false), currentOpen =
|
|
3175
|
-
const menuFocusCleanup =
|
|
3281
|
+
const [open, setOpen] = useState11(false), currentOpen = useRef16(false), ref = useRef16(null), id = "kjun-" + useId7();
|
|
3282
|
+
const menuFocusCleanup = useRef16(() => {
|
|
3176
3283
|
});
|
|
3177
3284
|
const bindMenu = useCallback4((menu) => {
|
|
3178
3285
|
menuFocusCleanup.current();
|
|
@@ -3225,7 +3332,7 @@ function KjunDropdown({
|
|
|
3225
3332
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
3226
3333
|
else onClose == null ? void 0 : onClose();
|
|
3227
3334
|
};
|
|
3228
|
-
|
|
3335
|
+
useEffect8(() => {
|
|
3229
3336
|
if (unavailable) change(false);
|
|
3230
3337
|
}, [unavailable]);
|
|
3231
3338
|
return /* @__PURE__ */ jsxs11(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -3304,14 +3411,14 @@ function KjunDropdownItem({
|
|
|
3304
3411
|
close == null ? void 0 : close();
|
|
3305
3412
|
},
|
|
3306
3413
|
children: [
|
|
3307
|
-
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3414
|
+
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size: tokens16.extensions.menu.iconSize }),
|
|
3308
3415
|
/* @__PURE__ */ jsx17("span", { children }),
|
|
3309
3416
|
selected !== null && /* @__PURE__ */ jsx17(
|
|
3310
3417
|
KjunIcon,
|
|
3311
3418
|
{
|
|
3312
3419
|
name: "check",
|
|
3313
3420
|
className: "kjun-menu-check",
|
|
3314
|
-
size:
|
|
3421
|
+
size: tokens16.extensions.menu.iconSize,
|
|
3315
3422
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3316
3423
|
}
|
|
3317
3424
|
)
|
|
@@ -3378,7 +3485,7 @@ function KjunMenuButton({
|
|
|
3378
3485
|
}
|
|
3379
3486
|
|
|
3380
3487
|
// packages/react/src/drawer.tsx
|
|
3381
|
-
import { tokens as
|
|
3488
|
+
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
3382
3489
|
|
|
3383
3490
|
// shared/package-runtime/drawer-geometry.ts
|
|
3384
3491
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3397,7 +3504,7 @@ function KjunDrawer({
|
|
|
3397
3504
|
onOpenChange,
|
|
3398
3505
|
title,
|
|
3399
3506
|
position = "right",
|
|
3400
|
-
width =
|
|
3507
|
+
width = tokens17.extensions.drawer.width,
|
|
3401
3508
|
closable = true,
|
|
3402
3509
|
closeOnOverlay = true,
|
|
3403
3510
|
closeOnEsc = true,
|
|
@@ -3412,7 +3519,7 @@ function KjunDrawer({
|
|
|
3412
3519
|
maxHeight
|
|
3413
3520
|
}) {
|
|
3414
3521
|
const m = useKjunMessages();
|
|
3415
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3522
|
+
const motion = usePresence(open, useReducedMotion(), tokens17.motion.layerExit);
|
|
3416
3523
|
const container = useKjunPortalContainer();
|
|
3417
3524
|
const close = () => {
|
|
3418
3525
|
if (!open) return;
|
|
@@ -3467,8 +3574,8 @@ function KjunDrawer({
|
|
|
3467
3574
|
variant: "ghost",
|
|
3468
3575
|
ariaLabel: m.close,
|
|
3469
3576
|
onClick: close,
|
|
3470
|
-
style: { borderRadius:
|
|
3471
|
-
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size:
|
|
3577
|
+
style: { borderRadius: tokens17.extensions.drawer.closeRadius, width: tokens17.extensions.drawer.closeSize, height: tokens17.extensions.drawer.closeSize, padding: 0 },
|
|
3578
|
+
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size: tokens17.extensions.drawer.closeIconSize })
|
|
3472
3579
|
}
|
|
3473
3580
|
)
|
|
3474
3581
|
] }),
|
|
@@ -3476,7 +3583,7 @@ function KjunDrawer({
|
|
|
3476
3583
|
"div",
|
|
3477
3584
|
{
|
|
3478
3585
|
className: "kjun-drawer-body",
|
|
3479
|
-
style: { padding: noPadding ? 0 :
|
|
3586
|
+
style: { padding: noPadding ? 0 : tokens17.extensions.drawer.bodyPadding },
|
|
3480
3587
|
children
|
|
3481
3588
|
}
|
|
3482
3589
|
),
|
|
@@ -3492,7 +3599,7 @@ function KjunDrawer({
|
|
|
3492
3599
|
}
|
|
3493
3600
|
|
|
3494
3601
|
// shared/package-runtime/combobox.ts
|
|
3495
|
-
import { useEffect as
|
|
3602
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
3496
3603
|
|
|
3497
3604
|
// shared/package-runtime/options.ts
|
|
3498
3605
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3572,8 +3679,8 @@ function useComboboxModel({
|
|
|
3572
3679
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3573
3680
|
const [query2, setQuery] = useState12(selectedLabel);
|
|
3574
3681
|
const [open, setOpen] = useState12(false);
|
|
3575
|
-
|
|
3576
|
-
|
|
3682
|
+
useEffect9(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3683
|
+
useEffect9(() => {
|
|
3577
3684
|
if (disabled) setOpen(false);
|
|
3578
3685
|
}, [disabled]);
|
|
3579
3686
|
const change = (next) => {
|
|
@@ -3607,9 +3714,9 @@ function useComboboxModel({
|
|
|
3607
3714
|
|
|
3608
3715
|
// packages/react/src/combobox.tsx
|
|
3609
3716
|
import {
|
|
3610
|
-
useEffect as
|
|
3717
|
+
useEffect as useEffect10,
|
|
3611
3718
|
useId as useId8,
|
|
3612
|
-
useRef as
|
|
3719
|
+
useRef as useRef17,
|
|
3613
3720
|
useState as useState13
|
|
3614
3721
|
} from "react";
|
|
3615
3722
|
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
@@ -3695,12 +3802,12 @@ function SearchField({
|
|
|
3695
3802
|
}) {
|
|
3696
3803
|
const m = useKjunMessages();
|
|
3697
3804
|
const composition = useCompositionGuard();
|
|
3698
|
-
const clearing =
|
|
3699
|
-
const ref =
|
|
3805
|
+
const clearing = useRef17(false);
|
|
3806
|
+
const ref = useRef17(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
3700
3807
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3701
3808
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3702
|
-
|
|
3703
|
-
|
|
3809
|
+
useEffect10(() => setActive(-1), [value, options.length]);
|
|
3810
|
+
useEffect10(() => {
|
|
3704
3811
|
if (!open) return;
|
|
3705
3812
|
const leaveField = (event) => {
|
|
3706
3813
|
var _a, _b, _c;
|
|
@@ -3710,7 +3817,7 @@ function SearchField({
|
|
|
3710
3817
|
document.addEventListener("focusin", leaveField);
|
|
3711
3818
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3712
3819
|
}, [open, onOpenChange, id]);
|
|
3713
|
-
|
|
3820
|
+
useEffect10(() => {
|
|
3714
3821
|
if (highlighted !== active) setActive(-1);
|
|
3715
3822
|
}, [highlighted, active]);
|
|
3716
3823
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3842,7 +3949,7 @@ function SearchField({
|
|
|
3842
3949
|
}
|
|
3843
3950
|
|
|
3844
3951
|
// packages/react/src/date-picker.tsx
|
|
3845
|
-
import { tokens as
|
|
3952
|
+
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3846
3953
|
import {
|
|
3847
3954
|
useState as useState14
|
|
3848
3955
|
} from "react";
|
|
@@ -3868,8 +3975,8 @@ function KjunDatePicker({
|
|
|
3868
3975
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
3869
3976
|
/* @__PURE__ */ jsxs14("div", { className: "kjun-date-picker", style: {
|
|
3870
3977
|
position: "relative",
|
|
3871
|
-
["--_kjun-date-icon-inset"]:
|
|
3872
|
-
["--_kjun-date-icon-size"]:
|
|
3978
|
+
["--_kjun-date-icon-inset"]: tokens18.input[size].padding + "px",
|
|
3979
|
+
["--_kjun-date-icon-size"]: tokens18.input[size].iconSize + "px"
|
|
3873
3980
|
}, children: [
|
|
3874
3981
|
/* @__PURE__ */ jsx20(
|
|
3875
3982
|
KjunInput,
|
|
@@ -3899,8 +4006,8 @@ function KjunDatePicker({
|
|
|
3899
4006
|
"aria-hidden": "true",
|
|
3900
4007
|
className: "kjun-date-overlay",
|
|
3901
4008
|
style: {
|
|
3902
|
-
left:
|
|
3903
|
-
right:
|
|
4009
|
+
left: tokens18.input[size].padding,
|
|
4010
|
+
right: tokens18.input[size].padding + tokens18.input[size].iconSize + tokens18.input[size].affixGap + (clear ? tokens18.input[size].clearSize + tokens18.input[size].affixGap : 0),
|
|
3904
4011
|
...inputTypeStyle(size),
|
|
3905
4012
|
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)"
|
|
3906
4013
|
},
|
|
@@ -3916,14 +4023,14 @@ function KjunDatePicker({
|
|
|
3916
4023
|
className: "kjun-select-clear",
|
|
3917
4024
|
style: {
|
|
3918
4025
|
padding: 0,
|
|
3919
|
-
right:
|
|
3920
|
-
width:
|
|
3921
|
-
height:
|
|
3922
|
-
minHeight:
|
|
4026
|
+
right: tokens18.input[size].padding + tokens18.input[size].iconSize + tokens18.input[size].affixGap,
|
|
4027
|
+
width: tokens18.input[size].clearSize,
|
|
4028
|
+
height: tokens18.input[size].clearSize,
|
|
4029
|
+
minHeight: tokens18.input[size].clearSize,
|
|
3923
4030
|
borderRadius: "50%"
|
|
3924
4031
|
},
|
|
3925
4032
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
3926
|
-
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size:
|
|
4033
|
+
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size: tokens18.input[size].iconSize })
|
|
3927
4034
|
}
|
|
3928
4035
|
)
|
|
3929
4036
|
] })
|
|
@@ -3934,7 +4041,7 @@ function KjunDatePicker({
|
|
|
3934
4041
|
import { useState as useState16 } from "react";
|
|
3935
4042
|
|
|
3936
4043
|
// shared/package-runtime/search-input.ts
|
|
3937
|
-
import { useEffect as
|
|
4044
|
+
import { useEffect as useEffect11, useLayoutEffect as useLayoutEffect10, useRef as useRef18, useState as useState15 } from "react";
|
|
3938
4045
|
function useSearchInputModel({
|
|
3939
4046
|
value,
|
|
3940
4047
|
disabled = false,
|
|
@@ -3944,10 +4051,10 @@ function useSearchInputModel({
|
|
|
3944
4051
|
onValueChange,
|
|
3945
4052
|
onSearchError
|
|
3946
4053
|
}, open) {
|
|
3947
|
-
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version =
|
|
4054
|
+
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version = useRef18(0), notify = useRef18(onSearchError);
|
|
3948
4055
|
notify.current = onSearchError;
|
|
3949
|
-
const timer =
|
|
3950
|
-
const notifyValue =
|
|
4056
|
+
const timer = useRef18(void 0);
|
|
4057
|
+
const notifyValue = useRef18(onValueChange);
|
|
3951
4058
|
notifyValue.current = onValueChange;
|
|
3952
4059
|
useLayoutEffect10(() => {
|
|
3953
4060
|
clearTimeout(timer.current);
|
|
@@ -3957,7 +4064,7 @@ function useSearchInputModel({
|
|
|
3957
4064
|
clearTimeout(timer.current);
|
|
3958
4065
|
return () => clearTimeout(timer.current);
|
|
3959
4066
|
}, [disabled, debounce, !!loadOptions]);
|
|
3960
|
-
|
|
4067
|
+
useEffect11(() => {
|
|
3961
4068
|
const current = ++version.current, abort = new AbortController();
|
|
3962
4069
|
setFailed(false);
|
|
3963
4070
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -4110,17 +4217,17 @@ function KjunSearchInput({
|
|
|
4110
4217
|
}
|
|
4111
4218
|
|
|
4112
4219
|
// packages/react/src/select-control.tsx
|
|
4113
|
-
import { tokens as
|
|
4220
|
+
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
4114
4221
|
import {
|
|
4115
4222
|
useId as useId9,
|
|
4116
4223
|
useContext as useContext12,
|
|
4117
|
-
useRef as
|
|
4118
|
-
useEffect as
|
|
4224
|
+
useRef as useRef20,
|
|
4225
|
+
useEffect as useEffect13
|
|
4119
4226
|
} from "react";
|
|
4120
4227
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
4121
4228
|
|
|
4122
4229
|
// shared/package-runtime/select.ts
|
|
4123
|
-
import { useEffect as
|
|
4230
|
+
import { useEffect as useEffect12, useRef as useRef19, useState as useState17 } from "react";
|
|
4124
4231
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4125
4232
|
const [internal, setInternal] = useState17(false);
|
|
4126
4233
|
const [query2, setQuery] = useState17("");
|
|
@@ -4128,8 +4235,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4128
4235
|
const [session, setSession] = useState17(0);
|
|
4129
4236
|
const isControlled = typeof controlled === "boolean";
|
|
4130
4237
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4131
|
-
const previousOpen =
|
|
4132
|
-
|
|
4238
|
+
const previousOpen = useRef19(open);
|
|
4239
|
+
useEffect12(() => {
|
|
4133
4240
|
if (disabled && !isControlled) setInternal(false);
|
|
4134
4241
|
if (previousOpen.current && !open) {
|
|
4135
4242
|
setQuery("");
|
|
@@ -4138,7 +4245,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4138
4245
|
}
|
|
4139
4246
|
previousOpen.current = open;
|
|
4140
4247
|
}, [open, disabled, isControlled, pageSize]);
|
|
4141
|
-
|
|
4248
|
+
useEffect12(() => {
|
|
4142
4249
|
setLimit(pageSize);
|
|
4143
4250
|
}, [pageSize]);
|
|
4144
4251
|
const changeOpen = (next) => {
|
|
@@ -4194,17 +4301,17 @@ function KjunSelect({
|
|
|
4194
4301
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4195
4302
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4196
4303
|
const composition = useCompositionGuard();
|
|
4197
|
-
const ref =
|
|
4304
|
+
const ref = useRef20(null), menu = useRef20(null), field = useKjunField(), id = "kjun-" + useId9();
|
|
4198
4305
|
const segment = useContext12(CompoundControlContext) !== null;
|
|
4199
|
-
const spec =
|
|
4306
|
+
const spec = tokens19.input[size];
|
|
4200
4307
|
const expanded = usePopupExpanded(open, ref);
|
|
4201
4308
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4202
|
-
|
|
4309
|
+
useEffect13(() => {
|
|
4203
4310
|
if (!registerControl || !triggerId) return;
|
|
4204
4311
|
registerControl(triggerId);
|
|
4205
4312
|
return () => registerControl(void 0);
|
|
4206
4313
|
}, [registerControl, triggerId]);
|
|
4207
|
-
|
|
4314
|
+
useEffect13(() => {
|
|
4208
4315
|
var _a, _b;
|
|
4209
4316
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
4210
4317
|
if (!open) composition.onCompositionEnd();
|
|
@@ -4250,7 +4357,7 @@ function KjunSelect({
|
|
|
4250
4357
|
borderRadius: spec.radius,
|
|
4251
4358
|
...inputTypeStyle(size),
|
|
4252
4359
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4253
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4360
|
+
...segment ? {} : { paddingInline: spec.padding - tokens19.border.controlWidth }
|
|
4254
4361
|
},
|
|
4255
4362
|
onClick: () => changeOpen(!open),
|
|
4256
4363
|
onKeyDown: (e) => {
|
|
@@ -4261,7 +4368,7 @@ function KjunSelect({
|
|
|
4261
4368
|
},
|
|
4262
4369
|
children: [
|
|
4263
4370
|
/* @__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 }),
|
|
4264
|
-
/* @__PURE__ */ jsx22(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ?
|
|
4371
|
+
/* @__PURE__ */ jsx22(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? tokens19.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
4265
4372
|
]
|
|
4266
4373
|
}
|
|
4267
4374
|
),
|
|
@@ -4365,7 +4472,7 @@ function KjunSelect({
|
|
|
4365
4472
|
className: "kjun-option",
|
|
4366
4473
|
children: [
|
|
4367
4474
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ jsx22("span", { children: optionLabel(o, labelKey) }),
|
|
4368
|
-
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size:
|
|
4475
|
+
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size: tokens19.extensions.menu.iconSize })
|
|
4369
4476
|
]
|
|
4370
4477
|
},
|
|
4371
4478
|
key
|
|
@@ -4391,19 +4498,19 @@ function KjunSelect({
|
|
|
4391
4498
|
}
|
|
4392
4499
|
|
|
4393
4500
|
// packages/react/src/navigation.tsx
|
|
4394
|
-
import { tokens as
|
|
4501
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4395
4502
|
|
|
4396
4503
|
// packages/react/src/collapse.tsx
|
|
4397
|
-
import { tokens as
|
|
4398
|
-
import { useLayoutEffect as useLayoutEffect11, useRef as
|
|
4504
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
4505
|
+
import { useLayoutEffect as useLayoutEffect11, useRef as useRef21, useState as useState18 } from "react";
|
|
4399
4506
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4400
4507
|
function Collapse({ open, children }) {
|
|
4401
4508
|
const reduced = useReducedMotion();
|
|
4402
4509
|
const [retained, setRetained] = useState18(open);
|
|
4403
|
-
const root =
|
|
4404
|
-
const animation =
|
|
4405
|
-
const previous =
|
|
4406
|
-
const interrupted =
|
|
4510
|
+
const root = useRef21(null), body = useRef21(null);
|
|
4511
|
+
const animation = useRef21(null);
|
|
4512
|
+
const previous = useRef21(open);
|
|
4513
|
+
const interrupted = useRef21(null);
|
|
4407
4514
|
const present = open || retained;
|
|
4408
4515
|
useLayoutEffect11(() => {
|
|
4409
4516
|
const el = root.current, inner = body.current;
|
|
@@ -4430,8 +4537,8 @@ function Collapse({ open, children }) {
|
|
|
4430
4537
|
}
|
|
4431
4538
|
el.style.height = end + "px";
|
|
4432
4539
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4433
|
-
duration:
|
|
4434
|
-
easing:
|
|
4540
|
+
duration: tokens20.motion.collapse,
|
|
4541
|
+
easing: tokens20.motion.easeOut
|
|
4435
4542
|
});
|
|
4436
4543
|
animation.current = transition;
|
|
4437
4544
|
transition.onfinish = finish;
|
|
@@ -4460,10 +4567,10 @@ function Collapse({ open, children }) {
|
|
|
4460
4567
|
}
|
|
4461
4568
|
|
|
4462
4569
|
// shared/package-runtime/navigation.ts
|
|
4463
|
-
import { useEffect as
|
|
4570
|
+
import { useEffect as useEffect14, useRef as useRef22, useState as useState19 } from "react";
|
|
4464
4571
|
function useInitialTab(value, candidate, change) {
|
|
4465
|
-
const requested =
|
|
4466
|
-
|
|
4572
|
+
const requested = useRef22(/* @__PURE__ */ new Set());
|
|
4573
|
+
useEffect14(() => {
|
|
4467
4574
|
if (value !== "") {
|
|
4468
4575
|
requested.current.clear();
|
|
4469
4576
|
return;
|
|
@@ -4475,7 +4582,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
4475
4582
|
}
|
|
4476
4583
|
function useAccordionState(multiple) {
|
|
4477
4584
|
const [opened, setOpened] = useState19(/* @__PURE__ */ new Set());
|
|
4478
|
-
|
|
4585
|
+
useEffect14(() => {
|
|
4479
4586
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4480
4587
|
}, [multiple]);
|
|
4481
4588
|
return {
|
|
@@ -4565,10 +4672,10 @@ import {
|
|
|
4565
4672
|
Fragment as Fragment7,
|
|
4566
4673
|
isValidElement as isValidElement3,
|
|
4567
4674
|
useContext as useContext13,
|
|
4568
|
-
useEffect as
|
|
4675
|
+
useEffect as useEffect15,
|
|
4569
4676
|
useLayoutEffect as useLayoutEffect12,
|
|
4570
4677
|
useId as useId10,
|
|
4571
|
-
useRef as
|
|
4678
|
+
useRef as useRef23,
|
|
4572
4679
|
useState as useState20
|
|
4573
4680
|
} from "react";
|
|
4574
4681
|
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
@@ -4606,15 +4713,15 @@ function KjunTabs({
|
|
|
4606
4713
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4607
4714
|
}
|
|
4608
4715
|
});
|
|
4609
|
-
const timer =
|
|
4610
|
-
const menuState =
|
|
4716
|
+
const timer = useRef23(void 0), press = useRef23(null);
|
|
4717
|
+
const menuState = useRef23({ tabs, onTabMenu });
|
|
4611
4718
|
menuState.current = { tabs, onTabMenu };
|
|
4612
4719
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4613
4720
|
const clear = () => {
|
|
4614
4721
|
clearTimeout(timer.current);
|
|
4615
4722
|
press.current = null;
|
|
4616
4723
|
};
|
|
4617
|
-
|
|
4724
|
+
useEffect15(() => clear, []);
|
|
4618
4725
|
useLayoutEffect12(() => {
|
|
4619
4726
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4620
4727
|
}, [tabs, onTabMenu]);
|
|
@@ -4674,7 +4781,7 @@ function KjunTabs({
|
|
|
4674
4781
|
onTouchEnd: clear,
|
|
4675
4782
|
onTouchCancel: clear,
|
|
4676
4783
|
children: [
|
|
4677
|
-
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size:
|
|
4784
|
+
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size: tokens21.extensions.tabs.iconSize }),
|
|
4678
4785
|
" ",
|
|
4679
4786
|
/* @__PURE__ */ jsx24("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ jsx24("span", { children: tab.label }) }),
|
|
4680
4787
|
tab.badge != null && /* @__PURE__ */ jsx24(
|
|
@@ -4735,7 +4842,7 @@ function KjunAccordionItem({
|
|
|
4735
4842
|
children
|
|
4736
4843
|
}) {
|
|
4737
4844
|
const group = useContext13(AccordionContext), id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
4738
|
-
|
|
4845
|
+
useEffect15(() => {
|
|
4739
4846
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4740
4847
|
}, []);
|
|
4741
4848
|
return /* @__PURE__ */ jsxs16("div", { className: "kjun-accordion-item", children: [
|
|
@@ -4756,7 +4863,7 @@ function KjunAccordionItem({
|
|
|
4756
4863
|
{
|
|
4757
4864
|
name: "chevron-down",
|
|
4758
4865
|
className: "kjun-accordion-chevron",
|
|
4759
|
-
size:
|
|
4866
|
+
size: tokens21.extensions.accordion.iconSize,
|
|
4760
4867
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4761
4868
|
}
|
|
4762
4869
|
)
|
|
@@ -4784,12 +4891,12 @@ function KjunBreadcrumb({
|
|
|
4784
4891
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4785
4892
|
return /* @__PURE__ */ jsx24("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4786
4893
|
const label = /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
4787
|
-
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size:
|
|
4894
|
+
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size: tokens21.extensions.breadcrumb.iconSize }),
|
|
4788
4895
|
" ",
|
|
4789
4896
|
item.label
|
|
4790
4897
|
] });
|
|
4791
4898
|
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
4792
|
-
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size:
|
|
4899
|
+
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size: tokens21.extensions.breadcrumb.separatorSize }),
|
|
4793
4900
|
" ",
|
|
4794
4901
|
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 })
|
|
4795
4902
|
] }, i);
|
|
@@ -4836,7 +4943,7 @@ function KjunPagination({
|
|
|
4836
4943
|
"aria-label": label,
|
|
4837
4944
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4838
4945
|
onClick: () => change(target),
|
|
4839
|
-
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size:
|
|
4946
|
+
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size: tokens21.extensions.pagination.iconSize })
|
|
4840
4947
|
}
|
|
4841
4948
|
);
|
|
4842
4949
|
return /* @__PURE__ */ jsxs16("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -4889,11 +4996,11 @@ function KjunPagination({
|
|
|
4889
4996
|
}
|
|
4890
4997
|
|
|
4891
4998
|
// packages/react/src/actions.tsx
|
|
4892
|
-
import { tokens as
|
|
4999
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
4893
5000
|
import {
|
|
4894
5001
|
useContext as useContext14,
|
|
4895
|
-
useEffect as
|
|
4896
|
-
useRef as
|
|
5002
|
+
useEffect as useEffect16,
|
|
5003
|
+
useRef as useRef24,
|
|
4897
5004
|
useState as useState21
|
|
4898
5005
|
} from "react";
|
|
4899
5006
|
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -4936,7 +5043,7 @@ function KjunIconToggle({
|
|
|
4936
5043
|
{
|
|
4937
5044
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
4938
5045
|
filled: active,
|
|
4939
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5046
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens22.button.iconSizes[size],
|
|
4940
5047
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4941
5048
|
className: active ? activeColorClass : inactiveColorClass,
|
|
4942
5049
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -4977,8 +5084,8 @@ function KjunCopyButton({
|
|
|
4977
5084
|
const m = useKjunMessages();
|
|
4978
5085
|
successText != null ? successText : successText = m.copied;
|
|
4979
5086
|
const feedback = useOptionalKjunFeedback();
|
|
4980
|
-
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy =
|
|
4981
|
-
|
|
5087
|
+
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef24(false), timer = useRef24(void 0), mounted = useRef24(true);
|
|
5088
|
+
useEffect16(() => {
|
|
4982
5089
|
mounted.current = true;
|
|
4983
5090
|
return () => {
|
|
4984
5091
|
mounted.current = false;
|
|
@@ -4996,9 +5103,9 @@ function KjunCopyButton({
|
|
|
4996
5103
|
"data-inline": inline,
|
|
4997
5104
|
style: {
|
|
4998
5105
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
4999
|
-
minHeight:
|
|
5106
|
+
minHeight: tokens22.button.heights[size],
|
|
5000
5107
|
paddingBlock: 0,
|
|
5001
|
-
paddingInline: { xs:
|
|
5108
|
+
paddingInline: { xs: tokens22.dimension.value4, sm: tokens22.dimension.value8, md: tokens22.dimension.value12 }[size]
|
|
5002
5109
|
},
|
|
5003
5110
|
onClick: async (event) => {
|
|
5004
5111
|
event.stopPropagation();
|
|
@@ -5028,7 +5135,7 @@ function KjunCopyButton({
|
|
|
5028
5135
|
KjunIcon,
|
|
5029
5136
|
{
|
|
5030
5137
|
name: copied ? "check" : "copy",
|
|
5031
|
-
size:
|
|
5138
|
+
size: tokens22.button.iconSizes[size],
|
|
5032
5139
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5033
5140
|
}
|
|
5034
5141
|
),
|
|
@@ -5102,14 +5209,14 @@ function KjunExternalLink({
|
|
|
5102
5209
|
onClick: (e) => e.stopPropagation(),
|
|
5103
5210
|
children: [
|
|
5104
5211
|
body,
|
|
5105
|
-
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size:
|
|
5212
|
+
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size: tokens22.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5106
5213
|
!name && /* @__PURE__ */ jsx25("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5107
5214
|
]
|
|
5108
5215
|
}
|
|
5109
5216
|
) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
|
|
5110
5217
|
}
|
|
5111
5218
|
function KjunScrollFade({ children }) {
|
|
5112
|
-
const ref =
|
|
5219
|
+
const ref = useRef24(null), [edges, setEdges] = useState21({ left: false, right: false });
|
|
5113
5220
|
const update = () => {
|
|
5114
5221
|
const el = ref.current;
|
|
5115
5222
|
if (el)
|
|
@@ -5121,7 +5228,7 @@ function KjunScrollFade({ children }) {
|
|
|
5121
5228
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
5122
5229
|
});
|
|
5123
5230
|
};
|
|
5124
|
-
|
|
5231
|
+
useEffect16(() => {
|
|
5125
5232
|
update();
|
|
5126
5233
|
const observer = new ResizeObserver(update);
|
|
5127
5234
|
if (ref.current) {
|
|
@@ -5130,7 +5237,7 @@ function KjunScrollFade({ children }) {
|
|
|
5130
5237
|
}
|
|
5131
5238
|
return () => observer.disconnect();
|
|
5132
5239
|
}, [children]);
|
|
5133
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5240
|
+
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${tokens22.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${tokens22.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
5134
5241
|
return /* @__PURE__ */ jsx25(
|
|
5135
5242
|
"div",
|
|
5136
5243
|
{
|
|
@@ -5145,7 +5252,7 @@ function KjunScrollFade({ children }) {
|
|
|
5145
5252
|
|
|
5146
5253
|
// packages/react/src/data-state.tsx
|
|
5147
5254
|
import {
|
|
5148
|
-
tokens as
|
|
5255
|
+
tokens as tokens23,
|
|
5149
5256
|
advanceQueryDisplay,
|
|
5150
5257
|
initialQueryDisplay,
|
|
5151
5258
|
queryDisplayStatus
|
|
@@ -5153,10 +5260,10 @@ import {
|
|
|
5153
5260
|
import { Component, useState as useState23 } from "react";
|
|
5154
5261
|
|
|
5155
5262
|
// shared/package-runtime/use-loading-reveal.ts
|
|
5156
|
-
import { useEffect as
|
|
5263
|
+
import { useEffect as useEffect17, useState as useState22 } from "react";
|
|
5157
5264
|
function useLoadingReveal(active, delay = 0) {
|
|
5158
5265
|
const [revealed, setRevealed] = useState22(false);
|
|
5159
|
-
|
|
5266
|
+
useEffect17(() => {
|
|
5160
5267
|
setRevealed(false);
|
|
5161
5268
|
if (!active || delay <= 0) return;
|
|
5162
5269
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -5207,7 +5314,7 @@ function KjunDataState({
|
|
|
5207
5314
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5208
5315
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5209
5316
|
retryText != null ? retryText : retryText = m.retry;
|
|
5210
|
-
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 =
|
|
5317
|
+
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 = tokens23.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5211
5318
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5212
5319
|
/* @__PURE__ */ jsx26("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
5213
5320
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "xs" }),
|
|
@@ -5221,7 +5328,7 @@ function KjunDataState({
|
|
|
5221
5328
|
"aria-label": revealed ? loadingText : void 0,
|
|
5222
5329
|
"aria-hidden": revealed ? void 0 : true,
|
|
5223
5330
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5224
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap:
|
|
5331
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap: tokens23.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx26(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs18("div", { className: "kjun-data-loading", children: [
|
|
5225
5332
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "md" }),
|
|
5226
5333
|
/* @__PURE__ */ jsx26("p", { children: loadingText })
|
|
5227
5334
|
] }))
|
|
@@ -5234,7 +5341,7 @@ function KjunDataState({
|
|
|
5234
5341
|
"aria-hidden": concealed || void 0,
|
|
5235
5342
|
inert: concealed || void 0,
|
|
5236
5343
|
style: {
|
|
5237
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5344
|
+
opacity: query2.loading && !state.usesQueryState ? tokens23.states.opacity.pending : void 0
|
|
5238
5345
|
},
|
|
5239
5346
|
children
|
|
5240
5347
|
},
|
|
@@ -5276,7 +5383,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
5276
5383
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5277
5384
|
|
|
5278
5385
|
// packages/react/src/skeletons.tsx
|
|
5279
|
-
import { tokens as
|
|
5386
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
5280
5387
|
|
|
5281
5388
|
// shared/package-runtime/chart-skeleton.ts
|
|
5282
5389
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5293,11 +5400,11 @@ function chartSkeletonKind(kind) {
|
|
|
5293
5400
|
}
|
|
5294
5401
|
|
|
5295
5402
|
// packages/react/src/market-skeleton.tsx
|
|
5296
|
-
import { tokens as
|
|
5403
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
5297
5404
|
|
|
5298
5405
|
// shared/package-runtime/market-layout.ts
|
|
5299
|
-
import { tokens as
|
|
5300
|
-
var marketGeometry =
|
|
5406
|
+
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
5407
|
+
var marketGeometry = tokens24.extensions.marketTable;
|
|
5301
5408
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5302
5409
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5303
5410
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5338,15 +5445,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5338
5445
|
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: [
|
|
5339
5446
|
/* @__PURE__ */ jsx28(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5340
5447
|
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5341
|
-
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5448
|
+
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens25.extensions.marketTable.actionSkeletonWidth, height: tokens25.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5342
5449
|
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))
|
|
5343
5450
|
] }) }),
|
|
5344
5451
|
/* @__PURE__ */ jsx28("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs20("tr", { children: [
|
|
5345
|
-
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5452
|
+
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens25.extensions.marketTable.actionSkeletonWidth, height: tokens25.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5346
5453
|
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: [
|
|
5347
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5348
|
-
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5349
|
-
] }) : /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width:
|
|
5454
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height: tokens25.extensions.skeleton.lineHeights.md }),
|
|
5455
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height: tokens25.extensions.skeleton.lineHeights.sm })
|
|
5456
|
+
] }) : /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens25.extensions.financial.priceSkeletonWidth, height: tokens25.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
5350
5457
|
] }, row)) })
|
|
5351
5458
|
] }) });
|
|
5352
5459
|
}
|
|
@@ -5357,7 +5464,7 @@ function KjunListSkeleton({
|
|
|
5357
5464
|
rows = 8,
|
|
5358
5465
|
variant = "market",
|
|
5359
5466
|
avatar = true,
|
|
5360
|
-
avatarSize =
|
|
5467
|
+
avatarSize = tokens26.extensions.skeleton.listAvatarSize,
|
|
5361
5468
|
quote = true
|
|
5362
5469
|
}) {
|
|
5363
5470
|
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: [
|
|
@@ -5367,15 +5474,15 @@ function KjunListSkeleton({
|
|
|
5367
5474
|
KjunSkeleton,
|
|
5368
5475
|
{
|
|
5369
5476
|
type: "block",
|
|
5370
|
-
height:
|
|
5477
|
+
height: tokens26.extensions.skeleton.lineHeights.md,
|
|
5371
5478
|
width: i % 2 ? "80%" : "65%"
|
|
5372
5479
|
}
|
|
5373
5480
|
),
|
|
5374
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5481
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5375
5482
|
] }),
|
|
5376
5483
|
quote && /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5377
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5378
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5484
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.quoteHeight, width: tokens26.extensions.skeleton.quoteWidth }),
|
|
5485
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.lineHeights.sm, width: tokens26.extensions.skeleton.detailWidth })
|
|
5379
5486
|
] })
|
|
5380
5487
|
] }, i)) });
|
|
5381
5488
|
}
|
|
@@ -5391,17 +5498,17 @@ function KjunFormSkeleton({
|
|
|
5391
5498
|
"aria-hidden": "true",
|
|
5392
5499
|
className: "kjun-form-skeleton",
|
|
5393
5500
|
"data-columns": columns,
|
|
5394
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5501
|
+
style: { "--_kjun-form-skeleton-radius": `${tokens26.input[size].radius}px` },
|
|
5395
5502
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
5396
5503
|
field ? /* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5397
5504
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5398
|
-
/* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5505
|
+
/* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.formLabelHeight, width: tokens26.extensions.skeleton.formLabelWidth }) })
|
|
5399
5506
|
),
|
|
5400
5507
|
/* @__PURE__ */ jsx29(
|
|
5401
5508
|
KjunSkeleton,
|
|
5402
5509
|
{
|
|
5403
5510
|
type: "block",
|
|
5404
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5511
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? tokens26.input[size].lineHeight * 3 + tokens26.input[size].textareaPaddingY * 2 + 2 * tokens26.border.controlWidth : tokens26.input[size].height
|
|
5405
5512
|
}
|
|
5406
5513
|
)
|
|
5407
5514
|
] }, i))
|
|
@@ -5410,7 +5517,7 @@ function KjunFormSkeleton({
|
|
|
5410
5517
|
}
|
|
5411
5518
|
function KjunChartSkeleton({
|
|
5412
5519
|
kind: requestedKind = "frame",
|
|
5413
|
-
height =
|
|
5520
|
+
height = tokens26.extensions.chartSkeleton.height,
|
|
5414
5521
|
loadingText,
|
|
5415
5522
|
skeleton = true,
|
|
5416
5523
|
loadingDelay = 0,
|
|
@@ -5466,7 +5573,7 @@ function KjunChartSkeleton({
|
|
|
5466
5573
|
d: chartFramePath,
|
|
5467
5574
|
fill: "none",
|
|
5468
5575
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5469
|
-
strokeWidth:
|
|
5576
|
+
strokeWidth: tokens26.border.defaultWidth,
|
|
5470
5577
|
vectorEffect: "non-scaling-stroke"
|
|
5471
5578
|
}
|
|
5472
5579
|
)
|
|
@@ -5479,19 +5586,19 @@ function KjunChartSkeleton({
|
|
|
5479
5586
|
}
|
|
5480
5587
|
|
|
5481
5588
|
// packages/react/src/financial-display.tsx
|
|
5482
|
-
import { deviationLevel, tokens as
|
|
5589
|
+
import { deviationLevel, tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5483
5590
|
import {
|
|
5484
5591
|
useId as useId11
|
|
5485
5592
|
} from "react";
|
|
5486
5593
|
|
|
5487
5594
|
// packages/react/src/number-display.tsx
|
|
5488
|
-
import { tokens as
|
|
5595
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5489
5596
|
|
|
5490
5597
|
// shared/package-runtime/use-number-motion.ts
|
|
5491
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
5598
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef25, useState as useState24 } from "react";
|
|
5492
5599
|
|
|
5493
5600
|
// shared/package-runtime/number-motion.ts
|
|
5494
|
-
import { tokens as
|
|
5601
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
5495
5602
|
function createNumberMotion(apply) {
|
|
5496
5603
|
let frame = 0, revision = 0, current = 0;
|
|
5497
5604
|
let previous;
|
|
@@ -5522,7 +5629,7 @@ function createNumberMotion(apply) {
|
|
|
5522
5629
|
if (from === target) return;
|
|
5523
5630
|
const tick = (now) => {
|
|
5524
5631
|
if (version !== revision) return;
|
|
5525
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5632
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens27.motion.number));
|
|
5526
5633
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5527
5634
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5528
5635
|
};
|
|
@@ -5535,7 +5642,7 @@ function createNumberMotion(apply) {
|
|
|
5535
5642
|
// shared/package-runtime/use-number-motion.ts
|
|
5536
5643
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5537
5644
|
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5538
|
-
const motion =
|
|
5645
|
+
const motion = useRef25(null);
|
|
5539
5646
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5540
5647
|
useLayoutEffect13(() => {
|
|
5541
5648
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
@@ -5601,7 +5708,7 @@ function KjunPriceCell({
|
|
|
5601
5708
|
flashClass = "",
|
|
5602
5709
|
fromPrevious = true
|
|
5603
5710
|
}) {
|
|
5604
|
-
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height:
|
|
5711
|
+
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height: tokens28.extensions.financial.priceSkeletonHeight, width: tokens28.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs22(Fragment11, { children: [
|
|
5605
5712
|
/* @__PURE__ */ jsx30(
|
|
5606
5713
|
"span",
|
|
5607
5714
|
{
|
|
@@ -5649,7 +5756,7 @@ function KjunSignedValue({
|
|
|
5649
5756
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5650
5757
|
},
|
|
5651
5758
|
children: [
|
|
5652
|
-
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width:
|
|
5759
|
+
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width: tokens28.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5653
5760
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ jsx30(KjunFreshness, { stale: true })
|
|
5654
5761
|
]
|
|
5655
5762
|
}
|
|
@@ -5658,7 +5765,7 @@ function KjunSignedValue({
|
|
|
5658
5765
|
|
|
5659
5766
|
// packages/react/src/financial-display.tsx
|
|
5660
5767
|
import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5661
|
-
var deviationFill = { neutral: 1, low:
|
|
5768
|
+
var deviationFill = { neutral: 1, low: tokens29.states.opacity.deviationLow, medium: tokens29.states.opacity.deviationMedium, strong: tokens29.states.opacity.deviationStrong };
|
|
5662
5769
|
function KjunDeviation({
|
|
5663
5770
|
value,
|
|
5664
5771
|
variant = "pill",
|
|
@@ -5690,7 +5797,7 @@ function KjunDeviation({
|
|
|
5690
5797
|
KjunIcon,
|
|
5691
5798
|
{
|
|
5692
5799
|
name: "alert-triangle",
|
|
5693
|
-
size:
|
|
5800
|
+
size: tokens29.extensions.financial.warningIconSize,
|
|
5694
5801
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5695
5802
|
}
|
|
5696
5803
|
) })
|
|
@@ -5703,7 +5810,7 @@ function KjunDeviation({
|
|
|
5703
5810
|
className: "kjun-deviation",
|
|
5704
5811
|
ref: domainColorRef(!neutral),
|
|
5705
5812
|
"data-variant": variant,
|
|
5706
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
5813
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens29.typography.numberLg.fontWeight : tokens29.typography.control.fontWeight },
|
|
5707
5814
|
children: [
|
|
5708
5815
|
variant === "pill" && /* @__PURE__ */ jsx31(
|
|
5709
5816
|
"span",
|
|
@@ -5731,7 +5838,7 @@ function KjunHeatmapCell({
|
|
|
5731
5838
|
}) {
|
|
5732
5839
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5733
5840
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5734
|
-
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } =
|
|
5841
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = tokens29.states.opacity;
|
|
5735
5842
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5736
5843
|
/* @__PURE__ */ jsx31(
|
|
5737
5844
|
"span",
|
|
@@ -5750,7 +5857,7 @@ function KjunProgressCell({
|
|
|
5750
5857
|
showLabel = true,
|
|
5751
5858
|
color = "auto",
|
|
5752
5859
|
customColor,
|
|
5753
|
-
height =
|
|
5860
|
+
height = tokens29.extensions.financial.progressHeight
|
|
5754
5861
|
}) {
|
|
5755
5862
|
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;
|
|
5756
5863
|
return /* @__PURE__ */ jsxs23("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5774,7 +5881,7 @@ function KjunCollectionMark({
|
|
|
5774
5881
|
active = false,
|
|
5775
5882
|
size = "md"
|
|
5776
5883
|
}) {
|
|
5777
|
-
const box =
|
|
5884
|
+
const box = tokens29.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens29.extensions.financial.heartMarkSizes[size] : box;
|
|
5778
5885
|
return /* @__PURE__ */ jsx31(
|
|
5779
5886
|
KjunIcon,
|
|
5780
5887
|
{
|
|
@@ -5810,8 +5917,8 @@ function KjunExecutionStatusBadge({
|
|
|
5810
5917
|
}
|
|
5811
5918
|
function KjunSparkline({
|
|
5812
5919
|
data = [],
|
|
5813
|
-
width =
|
|
5814
|
-
height =
|
|
5920
|
+
width = tokens29.extensions.financial.sparklineWidth,
|
|
5921
|
+
height = tokens29.extensions.financial.sparklineHeight,
|
|
5815
5922
|
color,
|
|
5816
5923
|
semantic = "price",
|
|
5817
5924
|
fill = true,
|
|
@@ -5867,7 +5974,7 @@ function KjunSparkline({
|
|
|
5867
5974
|
|
|
5868
5975
|
// shared/package-runtime/table.ts
|
|
5869
5976
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
5870
|
-
import { useEffect as
|
|
5977
|
+
import { useEffect as useEffect18, useRef as useRef26, useState as useState25 } from "react";
|
|
5871
5978
|
|
|
5872
5979
|
// shared/package-runtime/table-model.ts
|
|
5873
5980
|
function getValue(row, key) {
|
|
@@ -5914,8 +6021,8 @@ function useTableModel(props) {
|
|
|
5914
6021
|
const [internalSort, setSort] = useState25({
|
|
5915
6022
|
key: "",
|
|
5916
6023
|
order: "asc"
|
|
5917
|
-
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer =
|
|
5918
|
-
|
|
6024
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef26(void 0);
|
|
6025
|
+
useEffect18(() => () => clearTimeout(timer.current), []);
|
|
5919
6026
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5920
6027
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5921
6028
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -6004,7 +6111,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6004
6111
|
}
|
|
6005
6112
|
|
|
6006
6113
|
// packages/react/src/table-toolbar.tsx
|
|
6007
|
-
import { tokens as
|
|
6114
|
+
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
6008
6115
|
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6009
6116
|
function TableToolbar({
|
|
6010
6117
|
selectable,
|
|
@@ -6047,7 +6154,7 @@ function TableToolbar({
|
|
|
6047
6154
|
KjunInput,
|
|
6048
6155
|
{
|
|
6049
6156
|
size: "sm",
|
|
6050
|
-
style: { width:
|
|
6157
|
+
style: { width: tokens30.table.searchWidth, maxWidth: "100%" },
|
|
6051
6158
|
value: search,
|
|
6052
6159
|
ariaLabel: m.searchTable,
|
|
6053
6160
|
placeholder: searchPlaceholder,
|
|
@@ -6063,7 +6170,7 @@ function TableToolbar({
|
|
|
6063
6170
|
}
|
|
6064
6171
|
|
|
6065
6172
|
// packages/react/src/table-grid.tsx
|
|
6066
|
-
import { tokens as
|
|
6173
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
6067
6174
|
import { Fragment as Fragment14 } from "react";
|
|
6068
6175
|
|
|
6069
6176
|
// packages/react/src/table-check.tsx
|
|
@@ -6074,11 +6181,11 @@ import minus from "@kjun-ui/icons/icons/minus";
|
|
|
6074
6181
|
var componentIcons = { minus };
|
|
6075
6182
|
|
|
6076
6183
|
// packages/react/src/table-check.tsx
|
|
6077
|
-
import { tokens as
|
|
6184
|
+
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
6078
6185
|
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6079
6186
|
var TableCheck = forwardRef4(
|
|
6080
6187
|
function TableCheck2(props, ref) {
|
|
6081
|
-
const size =
|
|
6188
|
+
const size = tokens31.extensions.checkbox.iconSizes.sm;
|
|
6082
6189
|
return /* @__PURE__ */ jsx33(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs25("span", { className: "kjun-table-check", children: [
|
|
6083
6190
|
/* @__PURE__ */ jsx33("input", { ...props, ref, type: "checkbox" }),
|
|
6084
6191
|
/* @__PURE__ */ jsx33(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6135,7 +6242,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6135
6242
|
KjunIcon,
|
|
6136
6243
|
{
|
|
6137
6244
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6138
|
-
size:
|
|
6245
|
+
size: tokens32.table.sortIconSize
|
|
6139
6246
|
}
|
|
6140
6247
|
)
|
|
6141
6248
|
]
|
|
@@ -6148,14 +6255,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6148
6255
|
}
|
|
6149
6256
|
),
|
|
6150
6257
|
/* @__PURE__ */ jsx34("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsxs26("tr", { "aria-hidden": "true", children: [
|
|
6151
|
-
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height:
|
|
6258
|
+
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height: tokens32.table.selectionSize, width: tokens32.table.selectionSize }) }),
|
|
6152
6259
|
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell" }),
|
|
6153
6260
|
visible.map((col) => /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(
|
|
6154
6261
|
KjunSkeleton,
|
|
6155
6262
|
{
|
|
6156
6263
|
type: "block",
|
|
6157
|
-
height:
|
|
6158
|
-
width: col.key === "actions" ?
|
|
6264
|
+
height: tokens32.table.skeletonHeight,
|
|
6265
|
+
width: col.key === "actions" ? tokens32.table.actionColumnWidth : "75%"
|
|
6159
6266
|
}
|
|
6160
6267
|
) }, col.key))
|
|
6161
6268
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
@@ -6309,8 +6416,8 @@ function TableCards({
|
|
|
6309
6416
|
}
|
|
6310
6417
|
|
|
6311
6418
|
// packages/react/src/table-view.tsx
|
|
6312
|
-
import { useEffect as
|
|
6313
|
-
import { isComposingKey as isComposingKey4, tokens as
|
|
6419
|
+
import { useEffect as useEffect19, useState as useState26 } from "react";
|
|
6420
|
+
import { isComposingKey as isComposingKey4, tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6314
6421
|
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6315
6422
|
function KjunTable(props) {
|
|
6316
6423
|
const m = useKjunMessages();
|
|
@@ -6341,8 +6448,8 @@ function KjunTable(props) {
|
|
|
6341
6448
|
onRetry
|
|
6342
6449
|
} = props;
|
|
6343
6450
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
6344
|
-
|
|
6345
|
-
const media = matchMedia(`(width < ${
|
|
6451
|
+
useEffect19(() => {
|
|
6452
|
+
const media = matchMedia(`(width < ${tokens33.table.mobileBreakpoint}px)`);
|
|
6346
6453
|
const update = () => setMobile(media.matches);
|
|
6347
6454
|
update();
|
|
6348
6455
|
media.addEventListener("change", update);
|
|
@@ -6446,7 +6553,7 @@ function KjunTable(props) {
|
|
|
6446
6553
|
}
|
|
6447
6554
|
|
|
6448
6555
|
// packages/react/src/kpi.tsx
|
|
6449
|
-
import { tokens as
|
|
6556
|
+
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6450
6557
|
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6451
6558
|
var kpiFormat = (item, value = item.value) => {
|
|
6452
6559
|
var _a, _b;
|
|
@@ -6514,7 +6621,7 @@ function KjunKpiHero(props) {
|
|
|
6514
6621
|
] }) }),
|
|
6515
6622
|
showDelta && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6516
6623
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6517
|
-
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width:
|
|
6624
|
+
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: tokens34.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6518
6625
|
) : /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6519
6626
|
deltaAbsolute !== null && /* @__PURE__ */ jsx37(
|
|
6520
6627
|
"span",
|
|
@@ -6646,7 +6753,7 @@ function KjunKpiRow({
|
|
|
6646
6753
|
},
|
|
6647
6754
|
children: [
|
|
6648
6755
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6649
|
-
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width:
|
|
6756
|
+
/* @__PURE__ */ jsx37("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", width: tokens34.extensions.kpiRow.labelSkeletonWidth, height: tokens34.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6650
6757
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6651
6758
|
] }),
|
|
6652
6759
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6704,10 +6811,10 @@ function KjunKpiRow({
|
|
|
6704
6811
|
}
|
|
6705
6812
|
|
|
6706
6813
|
// packages/react/src/market-cards.tsx
|
|
6707
|
-
import { tokens as
|
|
6814
|
+
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6708
6815
|
|
|
6709
6816
|
// shared/package-runtime/market-cards.ts
|
|
6710
|
-
import { useEffect as
|
|
6817
|
+
import { useEffect as useEffect20, useRef as useRef27, useState as useState27 } from "react";
|
|
6711
6818
|
function useMarketCardsModel(props, persistence) {
|
|
6712
6819
|
const {
|
|
6713
6820
|
columns,
|
|
@@ -6724,7 +6831,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6724
6831
|
isDefaultSort: c.defaultSort
|
|
6725
6832
|
}));
|
|
6726
6833
|
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6727
|
-
const mounted =
|
|
6834
|
+
const mounted = useRef27("");
|
|
6728
6835
|
const save = (key2) => {
|
|
6729
6836
|
var _a;
|
|
6730
6837
|
try {
|
|
@@ -6732,7 +6839,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6732
6839
|
} catch (e) {
|
|
6733
6840
|
}
|
|
6734
6841
|
};
|
|
6735
|
-
|
|
6842
|
+
useEffect20(() => {
|
|
6736
6843
|
var _a, _b;
|
|
6737
6844
|
if (mounted.current === restoreSignature) return;
|
|
6738
6845
|
mounted.current = restoreSignature;
|
|
@@ -6912,10 +7019,10 @@ function KjunMarketCards(props) {
|
|
|
6912
7019
|
KjunSparkline,
|
|
6913
7020
|
{
|
|
6914
7021
|
data: getValue(row, state.key) || [],
|
|
6915
|
-
width:
|
|
6916
|
-
height:
|
|
7022
|
+
width: tokens35.extensions.marketTable.sparklineWidth,
|
|
7023
|
+
height: tokens35.extensions.marketTable.sparklineHeight
|
|
6917
7024
|
}
|
|
6918
|
-
) : state.pill ? /* @__PURE__ */ jsx39(Fragment17, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height:
|
|
7025
|
+
) : state.pill ? /* @__PURE__ */ jsx39(Fragment17, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens35.extensions.marketTable.valueSkeletonHeight, width: tokens35.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx39(
|
|
6919
7026
|
KjunSignedValue,
|
|
6920
7027
|
{
|
|
6921
7028
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6923,7 +7030,7 @@ function KjunMarketCards(props) {
|
|
|
6923
7030
|
stale: !!getValue(row, "stale"),
|
|
6924
7031
|
tone: "pill"
|
|
6925
7032
|
}
|
|
6926
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height:
|
|
7033
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height: tokens35.extensions.financial.priceSkeletonHeight, width: tokens35.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs31("div", { className: "kjun-market-metric", children: [
|
|
6927
7034
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6928
7035
|
props,
|
|
6929
7036
|
row,
|
|
@@ -6946,7 +7053,7 @@ function KjunMarketCards(props) {
|
|
|
6946
7053
|
}
|
|
6947
7054
|
|
|
6948
7055
|
// packages/react/src/market-list.tsx
|
|
6949
|
-
import { tokens as
|
|
7056
|
+
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6950
7057
|
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6951
7058
|
function KjunMarketSimpleList(props) {
|
|
6952
7059
|
const m = useKjunMessages();
|
|
@@ -7013,7 +7120,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7013
7120
|
fetchedAt
|
|
7014
7121
|
}
|
|
7015
7122
|
)),
|
|
7016
|
-
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height:
|
|
7123
|
+
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height: tokens36.extensions.marketList.changeSkeletonHeight, width: tokens36.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx40(
|
|
7017
7124
|
KjunSignedValue,
|
|
7018
7125
|
{
|
|
7019
7126
|
value: change,
|
|
@@ -7037,7 +7144,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7037
7144
|
}
|
|
7038
7145
|
|
|
7039
7146
|
// packages/react/src/market-panel.tsx
|
|
7040
|
-
import { tokens as
|
|
7147
|
+
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
7041
7148
|
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7042
7149
|
function KjunMarketListPanel({
|
|
7043
7150
|
controls,
|
|
@@ -7045,12 +7152,12 @@ function KjunMarketListPanel({
|
|
|
7045
7152
|
}) {
|
|
7046
7153
|
return /* @__PURE__ */ jsxs33(KjunCard, { children: [
|
|
7047
7154
|
/* @__PURE__ */ jsx41("div", { children: controls }),
|
|
7048
|
-
/* @__PURE__ */ jsx41("div", { style: { marginTop:
|
|
7155
|
+
/* @__PURE__ */ jsx41("div", { style: { marginTop: tokens37.dimension.value16, borderTop: `${tokens37.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7049
7156
|
] });
|
|
7050
7157
|
}
|
|
7051
7158
|
|
|
7052
7159
|
// packages/react/src/market-table.tsx
|
|
7053
|
-
import { tokens as
|
|
7160
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7054
7161
|
|
|
7055
7162
|
// shared/package-runtime/trailing-overflow.ts
|
|
7056
7163
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7067,7 +7174,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7067
7174
|
}
|
|
7068
7175
|
|
|
7069
7176
|
// packages/react/src/market-table.tsx
|
|
7070
|
-
import { useEffect as
|
|
7177
|
+
import { useEffect as useEffect21, useRef as useRef28, useState as useState28 } from "react";
|
|
7071
7178
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7072
7179
|
function KjunMarketTable(props) {
|
|
7073
7180
|
const m = useKjunMessages();
|
|
@@ -7089,12 +7196,12 @@ function KjunMarketTable(props) {
|
|
|
7089
7196
|
formatMetric,
|
|
7090
7197
|
renderCell
|
|
7091
7198
|
} = props;
|
|
7092
|
-
const scroller =
|
|
7093
|
-
|
|
7199
|
+
const scroller = useRef28(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
7200
|
+
useEffect21(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7094
7201
|
const render = (row, col) => {
|
|
7095
7202
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7096
7203
|
if (cellLoading(row, col))
|
|
7097
|
-
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7204
|
+
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens38.extensions.marketTable.valueSkeletonHeight, width: tokens38.extensions.marketTable.valueSkeletonWidth });
|
|
7098
7205
|
if (renderCell) return renderCell(row, col);
|
|
7099
7206
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7100
7207
|
return /* @__PURE__ */ jsx42(MarketIdentity, { row, props });
|
|
@@ -7103,8 +7210,8 @@ function KjunMarketTable(props) {
|
|
|
7103
7210
|
KjunSparkline,
|
|
7104
7211
|
{
|
|
7105
7212
|
data: Array.isArray(value) ? value : [],
|
|
7106
|
-
width:
|
|
7107
|
-
height:
|
|
7213
|
+
width: tokens38.extensions.marketTable.sparklineWidth,
|
|
7214
|
+
height: tokens38.extensions.marketTable.sparklineHeight
|
|
7108
7215
|
}
|
|
7109
7216
|
);
|
|
7110
7217
|
if (col.type === "price")
|
|
@@ -7186,7 +7293,7 @@ function KjunMarketTable(props) {
|
|
|
7186
7293
|
KjunIcon,
|
|
7187
7294
|
{
|
|
7188
7295
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7189
|
-
size:
|
|
7296
|
+
size: tokens38.extensions.marketTable.sortIconSize
|
|
7190
7297
|
}
|
|
7191
7298
|
)
|
|
7192
7299
|
]
|
|
@@ -7246,7 +7353,7 @@ function KjunMarketTable(props) {
|
|
|
7246
7353
|
{
|
|
7247
7354
|
style: {
|
|
7248
7355
|
textAlign: col.align,
|
|
7249
|
-
fontWeight: col.weight === "bold" ?
|
|
7356
|
+
fontWeight: col.weight === "bold" ? tokens38.typography.control.fontWeight : void 0
|
|
7250
7357
|
},
|
|
7251
7358
|
children: [
|
|
7252
7359
|
render(row, col),
|
|
@@ -7279,26 +7386,28 @@ function KjunMarketTable(props) {
|
|
|
7279
7386
|
}
|
|
7280
7387
|
|
|
7281
7388
|
// packages/react/src/list.tsx
|
|
7389
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7282
7390
|
import { useId as useId12 } from "react";
|
|
7283
7391
|
import { Fragment as Fragment18, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7284
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
7392
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick }) {
|
|
7285
7393
|
const contents = /* @__PURE__ */ jsxs35(Fragment18, { children: [
|
|
7286
7394
|
leading && /* @__PURE__ */ jsx43("span", { className: "kjun-list-leading", children: leading }),
|
|
7287
7395
|
/* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
|
|
7288
7396
|
/* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
|
|
7289
7397
|
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description })
|
|
7290
7398
|
] }),
|
|
7291
|
-
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing })
|
|
7399
|
+
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7400
|
+
chevron && /* @__PURE__ */ jsx43(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: tokens39.iconSizes.default })
|
|
7292
7401
|
] });
|
|
7293
7402
|
const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
|
|
7294
|
-
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", children: [
|
|
7403
|
+
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7295
7404
|
main,
|
|
7296
7405
|
actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7297
7406
|
] });
|
|
7298
7407
|
}
|
|
7299
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
7408
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7300
7409
|
const id = "kjun-" + useId12();
|
|
7301
|
-
return /* @__PURE__ */ jsxs35("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7410
|
+
return /* @__PURE__ */ jsxs35("section", { className: "kjun-list-section", "data-surface": surface ? void 0 : "false", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7302
7411
|
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
|
|
7303
7412
|
/* @__PURE__ */ jsxs35("div", { children: [
|
|
7304
7413
|
title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
|
|
@@ -7309,12 +7418,15 @@ function KjunListSection({ title, description, actions, children, ariaLabel, div
|
|
|
7309
7418
|
/* @__PURE__ */ jsx43("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
|
|
7310
7419
|
] });
|
|
7311
7420
|
}
|
|
7421
|
+
function KjunListItem({ children }) {
|
|
7422
|
+
return /* @__PURE__ */ jsx43("li", { className: "kjun-list-item", children });
|
|
7423
|
+
}
|
|
7312
7424
|
|
|
7313
7425
|
// packages/react/src/app-navigation.tsx
|
|
7314
|
-
import { tokens as
|
|
7426
|
+
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
7315
7427
|
import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7316
7428
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7317
|
-
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value:
|
|
7429
|
+
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value: tokens40.extensions.topNavigation, children: /* @__PURE__ */ jsx44("header", { className: "kjun-top-navigation", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-content", children: [
|
|
7318
7430
|
leading && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7319
7431
|
/* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-title", children: [
|
|
7320
7432
|
/* @__PURE__ */ jsx44("strong", { children: title }),
|
|
@@ -7335,7 +7447,7 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7335
7447
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7336
7448
|
}, children: [
|
|
7337
7449
|
hasIcons && /* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-icon", children: [
|
|
7338
|
-
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size:
|
|
7450
|
+
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size: tokens40.extensions.bottomNavigation.iconSize }),
|
|
7339
7451
|
badge
|
|
7340
7452
|
] }),
|
|
7341
7453
|
/* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7347,18 +7459,18 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7347
7459
|
}
|
|
7348
7460
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7349
7461
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7350
|
-
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7462
|
+
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", style: { paddingBottom: tokens40.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ jsxs36("div", { className: "kjun-bottom-action-content", children: [
|
|
7351
7463
|
description && /* @__PURE__ */ jsx44("p", { children: description }),
|
|
7352
7464
|
/* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children })
|
|
7353
7465
|
] }) });
|
|
7354
7466
|
}
|
|
7355
7467
|
|
|
7356
7468
|
// packages/react/src/media.tsx
|
|
7357
|
-
import { useRef as
|
|
7358
|
-
import { tokens as
|
|
7469
|
+
import { useRef as useRef29, useState as useState29 } from "react";
|
|
7470
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7359
7471
|
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7360
7472
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7361
|
-
const current =
|
|
7473
|
+
const current = useRef29({ src, version: 0 });
|
|
7362
7474
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7363
7475
|
const version = current.current.version;
|
|
7364
7476
|
const [result, setResult] = useState29({ version, state: "loading" });
|
|
@@ -7374,28 +7486,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7374
7486
|
setResult({ version, state: "error" });
|
|
7375
7487
|
onError == null ? void 0 : onError();
|
|
7376
7488
|
} }, version),
|
|
7377
|
-
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:
|
|
7489
|
+
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: tokens41.extensions.image.fallbackIconSize }) })
|
|
7378
7490
|
] });
|
|
7379
7491
|
}
|
|
7380
|
-
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
7492
|
+
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7381
7493
|
const m = useKjunMessages();
|
|
7382
|
-
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7494
|
+
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: tokens41.extensions.avatar[size], height: tokens41.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: tokens41.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7383
7495
|
}
|
|
7384
7496
|
|
|
7385
7497
|
// packages/react/src/chip.tsx
|
|
7386
|
-
import { tokens as
|
|
7498
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7387
7499
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7388
7500
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7389
7501
|
const m = useKjunMessages();
|
|
7390
7502
|
return /* @__PURE__ */ jsxs38("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7391
|
-
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size:
|
|
7503
|
+
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size: tokens42.extensions.chip.iconSizes[size] }),
|
|
7392
7504
|
/* @__PURE__ */ jsx46("span", { children: label }),
|
|
7393
|
-
removable && /* @__PURE__ */ jsx46("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(KjunIcon, { name: "x", size:
|
|
7505
|
+
removable && /* @__PURE__ */ jsx46("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(KjunIcon, { name: "x", size: tokens42.extensions.chip.removeIconSizes[size] }) })
|
|
7394
7506
|
] });
|
|
7395
7507
|
}
|
|
7396
7508
|
|
|
7397
7509
|
// packages/react/src/fab.tsx
|
|
7398
|
-
import { tokens as
|
|
7510
|
+
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7399
7511
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7400
7512
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7401
7513
|
return /* @__PURE__ */ jsx47(
|
|
@@ -7406,14 +7518,14 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7406
7518
|
"aria-label": ariaLabel,
|
|
7407
7519
|
disabled,
|
|
7408
7520
|
onClick,
|
|
7409
|
-
style: { bottom:
|
|
7410
|
-
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size:
|
|
7521
|
+
style: { bottom: tokens43.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7522
|
+
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size: tokens43.extensions.fab.iconSize })
|
|
7411
7523
|
}
|
|
7412
7524
|
);
|
|
7413
7525
|
}
|
|
7414
7526
|
|
|
7415
7527
|
// packages/react/src/range-input.tsx
|
|
7416
|
-
import { useEffect as
|
|
7528
|
+
import { useEffect as useEffect22, useRef as useRef30 } from "react";
|
|
7417
7529
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
7418
7530
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
7419
7531
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -7423,10 +7535,10 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7423
7535
|
const domain = createSliderDomain(min, max, step);
|
|
7424
7536
|
const list = Array.isArray(value) ? value : [value];
|
|
7425
7537
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7426
|
-
const latest =
|
|
7538
|
+
const latest = useRef30(value);
|
|
7427
7539
|
latest.current = value;
|
|
7428
|
-
const active =
|
|
7429
|
-
|
|
7540
|
+
const active = useRef30(false);
|
|
7541
|
+
useEffect22(() => {
|
|
7430
7542
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7431
7543
|
}, [valid]);
|
|
7432
7544
|
const change = (next) => {
|
|
@@ -7463,24 +7575,24 @@ function KjunRangeSlider(props) {
|
|
|
7463
7575
|
}
|
|
7464
7576
|
|
|
7465
7577
|
// packages/react/src/quantity-stepper.tsx
|
|
7466
|
-
import { useEffect as
|
|
7467
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
7578
|
+
import { useEffect as useEffect23, useRef as useRef31, useState as useState30 } from "react";
|
|
7579
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7468
7580
|
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7469
7581
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7470
7582
|
const m = useKjunMessages();
|
|
7471
|
-
const geometry =
|
|
7472
|
-
const buttonStyle = { width:
|
|
7583
|
+
const geometry = tokens44.extensions.compound;
|
|
7584
|
+
const buttonStyle = { width: tokens44.input[size].height, padding: 0 };
|
|
7473
7585
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
7474
7586
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7475
7587
|
const [draft, setDraft] = useState30(String(value));
|
|
7476
7588
|
const field = useKjunField();
|
|
7477
|
-
const composing =
|
|
7478
|
-
|
|
7589
|
+
const composing = useRef31(false), dirty = useRef31(false), accepted = useRef31(value);
|
|
7590
|
+
useEffect23(() => {
|
|
7479
7591
|
setDraft(String(value));
|
|
7480
7592
|
accepted.current = value;
|
|
7481
7593
|
dirty.current = false;
|
|
7482
7594
|
}, [value, precision, min, max, step]);
|
|
7483
|
-
|
|
7595
|
+
useEffect23(() => {
|
|
7484
7596
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7485
7597
|
}, [valid]);
|
|
7486
7598
|
const emit = (next) => {
|
|
@@ -7555,18 +7667,18 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7555
7667
|
}
|
|
7556
7668
|
|
|
7557
7669
|
// packages/react/src/time-picker.tsx
|
|
7558
|
-
import { Fragment as Fragment20, useEffect as
|
|
7670
|
+
import { Fragment as Fragment20, useEffect as useEffect24, useId as useId13, useMemo as useMemo3, useRef as useRef32 } from "react";
|
|
7559
7671
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
7560
7672
|
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7561
7673
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7562
7674
|
const m = useKjunMessages();
|
|
7563
7675
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7564
|
-
const root =
|
|
7676
|
+
const root = useRef32(null);
|
|
7565
7677
|
const field = useKjunField(), uid = useId13();
|
|
7566
7678
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7567
7679
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7568
7680
|
const valid = domain.valid && domain.accepts(value);
|
|
7569
|
-
|
|
7681
|
+
useEffect24(() => {
|
|
7570
7682
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7571
7683
|
}, [valid]);
|
|
7572
7684
|
const change = (next) => {
|
|
@@ -7656,6 +7768,7 @@ export {
|
|
|
7656
7768
|
KjunInput,
|
|
7657
7769
|
KjunKpiHero,
|
|
7658
7770
|
KjunKpiRow,
|
|
7771
|
+
KjunListItem,
|
|
7659
7772
|
KjunListRow,
|
|
7660
7773
|
KjunListSection,
|
|
7661
7774
|
KjunListSkeleton,
|
|
@@ -7695,6 +7808,7 @@ export {
|
|
|
7695
7808
|
KjunTimePicker,
|
|
7696
7809
|
KjunTooltip,
|
|
7697
7810
|
KjunTopNavigation,
|
|
7811
|
+
createKjunFeedback,
|
|
7698
7812
|
groupKeydown,
|
|
7699
7813
|
kjunMessagesEn,
|
|
7700
7814
|
kjunMessagesKo,
|