@kjun-ui/react 0.13.0 → 0.15.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 +613 -435
- package/dist/index.js +508 -329
- package/dist/styles.css +73 -1
- 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/collapse.d.cts +3 -1
- package/dist/types/packages/react/src/collapse.d.ts +3 -1
- package/dist/types/packages/react/src/combobox.d.cts +6 -2
- package/dist/types/packages/react/src/combobox.d.ts +6 -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/drawer.d.cts +3 -1
- package/dist/types/packages/react/src/drawer.d.ts +3 -1
- package/dist/types/packages/react/src/dropdown.d.cts +4 -2
- package/dist/types/packages/react/src/dropdown.d.ts +4 -2
- 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/floating-panel.d.cts +3 -0
- package/dist/types/packages/react/src/floating-panel.d.ts +3 -0
- 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 +17 -2
- package/dist/types/packages/react/src/list.d.ts +17 -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/packages/react/src/modal.d.cts +3 -1
- package/dist/types/packages/react/src/modal.d.ts +3 -1
- package/dist/types/packages/react/src/navigation.d.cts +7 -1
- package/dist/types/packages/react/src/navigation.d.ts +7 -1
- package/dist/types/packages/react/src/select-control.d.cts +4 -1
- package/dist/types/packages/react/src/select-control.d.ts +4 -1
- 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/nested-controls.d.cts +2 -0
- package/dist/types/shared/package-runtime/nested-controls.d.ts +2 -0
- 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/dist/types/shared/package-runtime/use-after-close.d.cts +6 -0
- package/dist/types/shared/package-runtime/use-after-close.d.ts +6 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1258,13 +1258,32 @@ var KjunInput = forwardRef2(
|
|
|
1258
1258
|
}
|
|
1259
1259
|
);
|
|
1260
1260
|
|
|
1261
|
+
// shared/package-runtime/use-after-close.ts
|
|
1262
|
+
import { useCallback, useEffect as useEffect3, useRef as useRef5 } from "react";
|
|
1263
|
+
function useAfterCloseRef(open, onAfterClose) {
|
|
1264
|
+
const state = useRef5({ open, mounted: false, callback: onAfterClose });
|
|
1265
|
+
state.current.open = open;
|
|
1266
|
+
state.current.callback = onAfterClose;
|
|
1267
|
+
return useCallback((node) => {
|
|
1268
|
+
const current = state.current;
|
|
1269
|
+
if (node) current.mounted = true;
|
|
1270
|
+
else if (current.mounted) {
|
|
1271
|
+
current.mounted = false;
|
|
1272
|
+
queueMicrotask(() => {
|
|
1273
|
+
var _a;
|
|
1274
|
+
if (!current.open && !current.mounted) (_a = current.callback) == null ? void 0 : _a.call(current);
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}, []);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1261
1280
|
// shared/package-runtime/use-presence.ts
|
|
1262
1281
|
import { tokens as tokens5 } from "@kjun-ui/tokens";
|
|
1263
|
-
import { useLayoutEffect as useLayoutEffect4, useRef as
|
|
1282
|
+
import { useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState5 } from "react";
|
|
1264
1283
|
function usePresence(open, reduced, exitDuration = tokens5.motion.layerExit) {
|
|
1265
1284
|
const [retained, setRetained] = useState5(open);
|
|
1266
1285
|
const [active, setActive] = useState5(false);
|
|
1267
|
-
const mounted =
|
|
1286
|
+
const mounted = useRef6(false);
|
|
1268
1287
|
useLayoutEffect4(() => {
|
|
1269
1288
|
let first = 0, second = 0, timer;
|
|
1270
1289
|
if (open) {
|
|
@@ -1306,7 +1325,7 @@ function useReducedMotion() {
|
|
|
1306
1325
|
|
|
1307
1326
|
// packages/react/src/modal.tsx
|
|
1308
1327
|
import { tokens as tokens6 } from "@kjun-ui/tokens";
|
|
1309
|
-
import { useId as useId4, useLayoutEffect as useLayoutEffect6, useRef as
|
|
1328
|
+
import { useId as useId4, useLayoutEffect as useLayoutEffect6, useRef as useRef7 } from "react";
|
|
1310
1329
|
|
|
1311
1330
|
// shared/package-runtime/form-actions.ts
|
|
1312
1331
|
function formActionsNeedStack(width, widths, gap) {
|
|
@@ -1397,7 +1416,7 @@ function KjunFormActions({
|
|
|
1397
1416
|
const m = useKjunMessages();
|
|
1398
1417
|
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1399
1418
|
confirmText != null ? confirmText : confirmText = m.save;
|
|
1400
|
-
const ref =
|
|
1419
|
+
const ref = useRef7(null);
|
|
1401
1420
|
useLayoutEffect6(() => observeFormActions(ref.current), []);
|
|
1402
1421
|
return /* @__PURE__ */ jsxs4("div", { className: "kjun-form-actions", ref, children: [
|
|
1403
1422
|
showCancel && /* @__PURE__ */ jsx7(
|
|
@@ -1427,6 +1446,7 @@ function KjunModal({
|
|
|
1427
1446
|
open,
|
|
1428
1447
|
onOpenChange,
|
|
1429
1448
|
onClose,
|
|
1449
|
+
onAfterClose,
|
|
1430
1450
|
onCancel,
|
|
1431
1451
|
onConfirm,
|
|
1432
1452
|
title = "",
|
|
@@ -1455,6 +1475,7 @@ function KjunModal({
|
|
|
1455
1475
|
confirmText != null ? confirmText : confirmText = m.confirm;
|
|
1456
1476
|
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1457
1477
|
const motion = usePresence(open, useReducedMotion());
|
|
1478
|
+
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
1458
1479
|
const portalContainer = useKjunPortalContainer();
|
|
1459
1480
|
const id = "kjun-" + useId4();
|
|
1460
1481
|
const explicitLabel = ariaLabel == null ? void 0 : ariaLabel.trim();
|
|
@@ -1472,6 +1493,7 @@ function KjunModal({
|
|
|
1472
1493
|
return /* @__PURE__ */ jsx7(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx7(
|
|
1473
1494
|
ModalOverlay,
|
|
1474
1495
|
{
|
|
1496
|
+
ref: afterCloseRef,
|
|
1475
1497
|
style: { zIndex: layer.zIndex },
|
|
1476
1498
|
isOpen: motion.present && layer.active,
|
|
1477
1499
|
isExiting: motion.present && !layer.active,
|
|
@@ -1577,12 +1599,45 @@ function alertRole(tone, live) {
|
|
|
1577
1599
|
}
|
|
1578
1600
|
|
|
1579
1601
|
// packages/react/src/display.tsx
|
|
1602
|
+
import { tokens as tokens8 } from "@kjun-ui/tokens";
|
|
1603
|
+
|
|
1604
|
+
// shared/package-runtime/progress-circle.ts
|
|
1580
1605
|
import { tokens as tokens7 } from "@kjun-ui/tokens";
|
|
1606
|
+
function progressCircle(size, percentage) {
|
|
1607
|
+
const { size: diameter, stroke } = tokens7.extensions.progress.circle[size];
|
|
1608
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1609
|
+
return {
|
|
1610
|
+
diameter,
|
|
1611
|
+
stroke,
|
|
1612
|
+
radius,
|
|
1613
|
+
centre: diameter / 2,
|
|
1614
|
+
circumference,
|
|
1615
|
+
offset: circumference * (1 - percentage / 100),
|
|
1616
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
1617
|
+
showsPercentage: size !== "sm"
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
// packages/react/src/display.tsx
|
|
1581
1622
|
import {
|
|
1582
1623
|
useState as useState6
|
|
1583
1624
|
} from "react";
|
|
1584
1625
|
|
|
1626
|
+
// shared/package-runtime/nested-controls.ts
|
|
1627
|
+
var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
1628
|
+
function developmentMode3() {
|
|
1629
|
+
try {
|
|
1630
|
+
return true;
|
|
1631
|
+
} catch (e) {
|
|
1632
|
+
return false;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
function warnNestedControls(root, message) {
|
|
1636
|
+
if (developmentMode3() && (root == null ? void 0 : root.querySelector(interactive))) console.warn(message);
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1585
1639
|
// packages/react/src/card.tsx
|
|
1640
|
+
import { useEffect as useEffect4, useRef as useRef8 } from "react";
|
|
1586
1641
|
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1587
1642
|
function KjunCard({
|
|
1588
1643
|
title,
|
|
@@ -1598,17 +1653,44 @@ function KjunCard({
|
|
|
1598
1653
|
elevation = "flat",
|
|
1599
1654
|
border = false,
|
|
1600
1655
|
dividers = false,
|
|
1656
|
+
pressable = false,
|
|
1657
|
+
disabled = false,
|
|
1658
|
+
ariaLabel,
|
|
1601
1659
|
children,
|
|
1602
1660
|
style,
|
|
1603
1661
|
className = "",
|
|
1662
|
+
onClick,
|
|
1663
|
+
onKeyDown,
|
|
1604
1664
|
...props
|
|
1605
1665
|
}) {
|
|
1666
|
+
const root = useRef8(null);
|
|
1667
|
+
useEffect4(() => {
|
|
1668
|
+
if (pressable) warnNestedControls(root.current, "KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
|
|
1669
|
+
}, [pressable]);
|
|
1670
|
+
const press = pressable ? {
|
|
1671
|
+
role: "button",
|
|
1672
|
+
tabIndex: disabled ? -1 : 0,
|
|
1673
|
+
"aria-disabled": disabled || void 0,
|
|
1674
|
+
"aria-label": ariaLabel != null ? ariaLabel : title,
|
|
1675
|
+
"data-pressable": "",
|
|
1676
|
+
onClick: (event) => {
|
|
1677
|
+
if (!disabled) onClick == null ? void 0 : onClick(event);
|
|
1678
|
+
},
|
|
1679
|
+
onKeyDown: (event) => {
|
|
1680
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
1681
|
+
if (event.defaultPrevented || disabled || event.key !== "Enter" && event.key !== " ") return;
|
|
1682
|
+
event.preventDefault();
|
|
1683
|
+
event.currentTarget.click();
|
|
1684
|
+
}
|
|
1685
|
+
} : { onClick, onKeyDown };
|
|
1606
1686
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
1607
1687
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
1608
1688
|
return /* @__PURE__ */ jsxs5(
|
|
1609
1689
|
"div",
|
|
1610
1690
|
{
|
|
1611
1691
|
...props,
|
|
1692
|
+
...press,
|
|
1693
|
+
ref: root,
|
|
1612
1694
|
className: ["kjun-card", className].filter(Boolean).join(" "),
|
|
1613
1695
|
"data-surface": surface,
|
|
1614
1696
|
"data-padding": padding,
|
|
@@ -1620,7 +1702,8 @@ function KjunCard({
|
|
|
1620
1702
|
"--_kjun-card-padding": `var(--_kjun-geometry-card-padding-${padding})`,
|
|
1621
1703
|
"--_kjun-card-body-padding": `var(--_kjun-geometry-card-padding-${bodyPadding})`,
|
|
1622
1704
|
borderRadius: `var(--_kjun-geometry-card-radii-${radius})`,
|
|
1623
|
-
|
|
1705
|
+
// A pressable card's shadow comes from CSS so its hover lift can replace it.
|
|
1706
|
+
[pressable ? "--_kjun-card-shadow" : "boxShadow"]: `var(--_kjun-card-elevation-${elevation})`,
|
|
1624
1707
|
...style
|
|
1625
1708
|
},
|
|
1626
1709
|
children: [
|
|
@@ -1650,7 +1733,7 @@ function KjunBadge({
|
|
|
1650
1733
|
style,
|
|
1651
1734
|
...props
|
|
1652
1735
|
}) {
|
|
1653
|
-
const { x, y } =
|
|
1736
|
+
const { x, y } = tokens8.extensions.badge.padding[size];
|
|
1654
1737
|
const neutral = variant === "default" || variant === "secondary";
|
|
1655
1738
|
return /* @__PURE__ */ jsxs6(
|
|
1656
1739
|
"span",
|
|
@@ -1685,7 +1768,7 @@ function KjunEmpty({
|
|
|
1685
1768
|
const m = useKjunMessages();
|
|
1686
1769
|
text != null ? text : text = m.noData;
|
|
1687
1770
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-empty", children: [
|
|
1688
|
-
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size:
|
|
1771
|
+
icon && /* @__PURE__ */ jsx9(KjunIcon, { name: icon, size: tokens8.extensions.empty.iconSize }),
|
|
1689
1772
|
/* @__PURE__ */ jsx9("p", { children: text }),
|
|
1690
1773
|
description && /* @__PURE__ */ jsx9("small", { children: description }),
|
|
1691
1774
|
children && /* @__PURE__ */ jsx9("div", { children })
|
|
@@ -1693,14 +1776,14 @@ function KjunEmpty({
|
|
|
1693
1776
|
}
|
|
1694
1777
|
function KjunSpinner({ size = "md", text }) {
|
|
1695
1778
|
const m = useKjunMessages();
|
|
1696
|
-
const stroke =
|
|
1779
|
+
const stroke = tokens8.extensions.spinner.strokeWidths[size] * 24 / tokens8.extensions.spinner.sizes[size];
|
|
1697
1780
|
return /* @__PURE__ */ jsxs6("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1698
1781
|
/* @__PURE__ */ jsxs6(
|
|
1699
1782
|
"svg",
|
|
1700
1783
|
{
|
|
1701
1784
|
className: "kjun-spin",
|
|
1702
|
-
width:
|
|
1703
|
-
height:
|
|
1785
|
+
width: tokens8.extensions.spinner.sizes[size],
|
|
1786
|
+
height: tokens8.extensions.spinner.sizes[size],
|
|
1704
1787
|
viewBox: "0 0 24 24",
|
|
1705
1788
|
fill: "none",
|
|
1706
1789
|
"aria-hidden": "true",
|
|
@@ -1766,7 +1849,7 @@ function KjunAlert({
|
|
|
1766
1849
|
warning: "alert-triangle",
|
|
1767
1850
|
danger: "alert-circle"
|
|
1768
1851
|
}[tone],
|
|
1769
|
-
size:
|
|
1852
|
+
size: tokens8.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1770
1853
|
}
|
|
1771
1854
|
) }),
|
|
1772
1855
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-alert-content", children: [
|
|
@@ -1784,7 +1867,7 @@ function KjunAlert({
|
|
|
1784
1867
|
setVisible(false);
|
|
1785
1868
|
onClose == null ? void 0 : onClose();
|
|
1786
1869
|
},
|
|
1787
|
-
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size:
|
|
1870
|
+
children: /* @__PURE__ */ jsx9(KjunIcon, { name: "x", size: tokens8.extensions.alert.closeIconSize })
|
|
1788
1871
|
}
|
|
1789
1872
|
)
|
|
1790
1873
|
]
|
|
@@ -1798,10 +1881,55 @@ function KjunProgress({
|
|
|
1798
1881
|
variant = "primary",
|
|
1799
1882
|
showLabel = false,
|
|
1800
1883
|
label,
|
|
1801
|
-
subLabel
|
|
1884
|
+
subLabel,
|
|
1885
|
+
shape = "bar"
|
|
1802
1886
|
}) {
|
|
1803
1887
|
const m = useKjunMessages();
|
|
1804
1888
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1889
|
+
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
1890
|
+
if (shape === "circle") {
|
|
1891
|
+
const c = progressCircle(size, percentage);
|
|
1892
|
+
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1893
|
+
/* @__PURE__ */ jsxs6(
|
|
1894
|
+
"div",
|
|
1895
|
+
{
|
|
1896
|
+
role: "progressbar",
|
|
1897
|
+
"aria-label": name,
|
|
1898
|
+
"aria-valuemin": 0,
|
|
1899
|
+
"aria-valuemax": 100,
|
|
1900
|
+
"aria-valuenow": percentage,
|
|
1901
|
+
className: "kjun-progress-circle",
|
|
1902
|
+
style: { width: c.diameter, height: c.diameter },
|
|
1903
|
+
children: [
|
|
1904
|
+
/* @__PURE__ */ jsxs6("svg", { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
1905
|
+
/* @__PURE__ */ jsx9("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
1906
|
+
percentage > 0 && /* @__PURE__ */ jsx9(
|
|
1907
|
+
"circle",
|
|
1908
|
+
{
|
|
1909
|
+
className: "kjun-progress-circle-value",
|
|
1910
|
+
cx: c.centre,
|
|
1911
|
+
cy: c.centre,
|
|
1912
|
+
r: c.radius,
|
|
1913
|
+
strokeWidth: c.stroke,
|
|
1914
|
+
stroke: color,
|
|
1915
|
+
strokeLinecap: "round",
|
|
1916
|
+
strokeDasharray: c.circumference,
|
|
1917
|
+
strokeDashoffset: c.offset,
|
|
1918
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
1919
|
+
}
|
|
1920
|
+
)
|
|
1921
|
+
] }),
|
|
1922
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ jsxs6("span", { className: "kjun-progress-circle-percent", children: [
|
|
1923
|
+
percentage,
|
|
1924
|
+
"%"
|
|
1925
|
+
] })
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
),
|
|
1929
|
+
label && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-circle-label", children: label }),
|
|
1930
|
+
subLabel && /* @__PURE__ */ jsx9("div", { className: "kjun-progress-sub", children: subLabel })
|
|
1931
|
+
] });
|
|
1932
|
+
}
|
|
1805
1933
|
return /* @__PURE__ */ jsxs6("div", { className: "kjun-progress", children: [
|
|
1806
1934
|
(label || showLabel) && /* @__PURE__ */ jsxs6("div", { className: "kjun-progress-label", children: [
|
|
1807
1935
|
label && /* @__PURE__ */ jsx9("span", { children: label }),
|
|
@@ -1814,18 +1942,18 @@ function KjunProgress({
|
|
|
1814
1942
|
"div",
|
|
1815
1943
|
{
|
|
1816
1944
|
role: "progressbar",
|
|
1817
|
-
"aria-label":
|
|
1945
|
+
"aria-label": name,
|
|
1818
1946
|
"aria-valuemin": 0,
|
|
1819
1947
|
"aria-valuemax": 100,
|
|
1820
1948
|
"aria-valuenow": percentage,
|
|
1821
1949
|
className: "kjun-progress-track",
|
|
1822
|
-
style: { height:
|
|
1950
|
+
style: { height: tokens8.extensions.progress.heights[size] },
|
|
1823
1951
|
children: /* @__PURE__ */ jsx9(
|
|
1824
1952
|
"div",
|
|
1825
1953
|
{
|
|
1826
1954
|
style: {
|
|
1827
1955
|
width: percentage + "%",
|
|
1828
|
-
background:
|
|
1956
|
+
background: color
|
|
1829
1957
|
}
|
|
1830
1958
|
}
|
|
1831
1959
|
)
|
|
@@ -1856,9 +1984,9 @@ function KjunSkeleton({
|
|
|
1856
1984
|
{
|
|
1857
1985
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
1858
1986
|
style: sm ? void 0 : {
|
|
1859
|
-
width: width ||
|
|
1860
|
-
height: height ||
|
|
1861
|
-
borderRadius: rounded ? "50%" :
|
|
1987
|
+
width: width || tokens8.extensions.skeleton.avatarSize,
|
|
1988
|
+
height: height || tokens8.extensions.skeleton.avatarSize,
|
|
1989
|
+
borderRadius: rounded ? "50%" : tokens8.radius.radius8
|
|
1862
1990
|
}
|
|
1863
1991
|
}
|
|
1864
1992
|
);
|
|
@@ -1882,7 +2010,7 @@ function KjunSkeleton({
|
|
|
1882
2010
|
avatar(true),
|
|
1883
2011
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
1884
2012
|
line("60%"),
|
|
1885
|
-
line("40%", void 0,
|
|
2013
|
+
line("40%", void 0, tokens8.extensions.skeleton.lineHeights.sm)
|
|
1886
2014
|
] })
|
|
1887
2015
|
] }),
|
|
1888
2016
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -1905,9 +2033,9 @@ function KjunSkeleton({
|
|
|
1905
2033
|
)) }),
|
|
1906
2034
|
type === "stat" && /* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat", children: [
|
|
1907
2035
|
/* @__PURE__ */ jsxs6("div", { className: "kjun-skeleton-stat-content", children: [
|
|
1908
|
-
line("40%", 0,
|
|
1909
|
-
line("60%", 1,
|
|
1910
|
-
line("30%", 2,
|
|
2036
|
+
line("40%", 0, tokens8.extensions.skeleton.lineHeights.sm),
|
|
2037
|
+
line("60%", 1, tokens8.extensions.skeleton.lineHeights.lg),
|
|
2038
|
+
line("30%", 2, tokens8.extensions.skeleton.lineHeights.sm)
|
|
1911
2039
|
] }),
|
|
1912
2040
|
/* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ jsx9("div", { className: "kjun-skeleton-sparkline" }) })
|
|
1913
2041
|
] }),
|
|
@@ -1915,7 +2043,7 @@ function KjunSkeleton({
|
|
|
1915
2043
|
"div",
|
|
1916
2044
|
{
|
|
1917
2045
|
className: "kjun-skeleton-block",
|
|
1918
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2046
|
+
style: { width: width || "100%", height: height != null ? height : tokens8.extensions.skeleton.blockHeight }
|
|
1919
2047
|
}
|
|
1920
2048
|
)
|
|
1921
2049
|
]
|
|
@@ -1975,13 +2103,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
1975
2103
|
}
|
|
1976
2104
|
|
|
1977
2105
|
// shared/package-runtime/feedback-dialog.ts
|
|
1978
|
-
import { useRef as
|
|
2106
|
+
import { useRef as useRef9, useState as useState7 } from "react";
|
|
1979
2107
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
1980
2108
|
const options = request.options;
|
|
1981
2109
|
const [value, setValue] = useState7(options.initialValue || "");
|
|
1982
2110
|
const [error, setError] = useState7("");
|
|
1983
2111
|
const [busy, setBusy] = useState7(false);
|
|
1984
|
-
const working =
|
|
2112
|
+
const working = useRef9(false);
|
|
1985
2113
|
const active = () => {
|
|
1986
2114
|
var _a;
|
|
1987
2115
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -2023,11 +2151,11 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2023
2151
|
}
|
|
2024
2152
|
|
|
2025
2153
|
// shared/package-runtime/feedback-motion.ts
|
|
2026
|
-
import { tokens as
|
|
2027
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
2154
|
+
import { tokens as tokens9 } from "@kjun-ui/tokens";
|
|
2155
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef10, useState as useState8 } from "react";
|
|
2028
2156
|
function usePresentedToasts(toasts, reduced) {
|
|
2029
2157
|
const [items, setItems] = useState8([]);
|
|
2030
|
-
const removals =
|
|
2158
|
+
const removals = useRef10(/* @__PURE__ */ new Map());
|
|
2031
2159
|
useLayoutEffect7(() => {
|
|
2032
2160
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
2033
2161
|
setItems((previous) => {
|
|
@@ -2041,7 +2169,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2041
2169
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2042
2170
|
removals.current.delete(item.toast.id);
|
|
2043
2171
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2044
|
-
},
|
|
2172
|
+
}, tokens9.motion.toastExit));
|
|
2045
2173
|
}
|
|
2046
2174
|
return next;
|
|
2047
2175
|
});
|
|
@@ -2063,7 +2191,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
2063
2191
|
setRequest(current);
|
|
2064
2192
|
return;
|
|
2065
2193
|
}
|
|
2066
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2194
|
+
const timer = setTimeout(() => setRequest(current), tokens9.motion.layerExit);
|
|
2067
2195
|
return () => clearTimeout(timer);
|
|
2068
2196
|
}, [current, request, reduced]);
|
|
2069
2197
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -2077,11 +2205,11 @@ function useOptionalKjunFeedback() {
|
|
|
2077
2205
|
}
|
|
2078
2206
|
|
|
2079
2207
|
// packages/react/src/toast-stack.tsx
|
|
2080
|
-
import { tokens as
|
|
2081
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
2208
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
2209
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef12 } from "react";
|
|
2082
2210
|
|
|
2083
2211
|
// shared/package-runtime/toast-layout.ts
|
|
2084
|
-
import { tokens as
|
|
2212
|
+
import { tokens as tokens10 } from "@kjun-ui/tokens";
|
|
2085
2213
|
function createToastLayout() {
|
|
2086
2214
|
let root = null;
|
|
2087
2215
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2124,7 +2252,7 @@ function createToastLayout() {
|
|
|
2124
2252
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2125
2253
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2126
2254
|
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:
|
|
2255
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: tokens10.motion.toastMove, easing: tokens10.motion.easeOut });
|
|
2128
2256
|
animations.set(node, animation);
|
|
2129
2257
|
}
|
|
2130
2258
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2140,16 +2268,16 @@ function createToastLayout() {
|
|
|
2140
2268
|
}
|
|
2141
2269
|
|
|
2142
2270
|
// packages/react/src/toast.tsx
|
|
2143
|
-
import { useEffect as
|
|
2271
|
+
import { useEffect as useEffect5, useRef as useRef11 } from "react";
|
|
2144
2272
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2145
2273
|
function ToastView({
|
|
2146
2274
|
toast,
|
|
2147
2275
|
controller
|
|
2148
2276
|
}) {
|
|
2149
2277
|
const m = useKjunMessages();
|
|
2150
|
-
const previous =
|
|
2151
|
-
const reasons =
|
|
2152
|
-
|
|
2278
|
+
const previous = useRef11(null);
|
|
2279
|
+
const reasons = useRef11({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
2280
|
+
useEffect5(() => {
|
|
2153
2281
|
previous.current = document.activeElement;
|
|
2154
2282
|
return () => {
|
|
2155
2283
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -2244,9 +2372,9 @@ function ToastView({
|
|
|
2244
2372
|
// packages/react/src/toast-stack.tsx
|
|
2245
2373
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2246
2374
|
function ToastSurface({ item, controller }) {
|
|
2247
|
-
const ref =
|
|
2248
|
-
const current =
|
|
2249
|
-
const entryFinished =
|
|
2375
|
+
const ref = useRef12(null), reduced = useReducedMotion();
|
|
2376
|
+
const current = useRef12(null);
|
|
2377
|
+
const entryFinished = useRef12(false);
|
|
2250
2378
|
useLayoutEffect8(() => {
|
|
2251
2379
|
var _a, _b;
|
|
2252
2380
|
const el = ref.current;
|
|
@@ -2256,15 +2384,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2256
2384
|
return;
|
|
2257
2385
|
}
|
|
2258
2386
|
const elapsed = Date.now() - item.born;
|
|
2259
|
-
if (!item.exiting && (elapsed >=
|
|
2260
|
-
const hidden = `translateY(${-
|
|
2387
|
+
if (!item.exiting && (elapsed >= tokens11.motion.toastEnter || entryFinished.current)) return;
|
|
2388
|
+
const hidden = `translateY(${-tokens11.motionDistance.toast}px)`, from = current.current;
|
|
2261
2389
|
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:
|
|
2390
|
+
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" }),
|
|
2391
|
+
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
2392
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2265
|
-
duration:
|
|
2393
|
+
duration: tokens11.motion.toastEnter,
|
|
2266
2394
|
delay: -elapsed,
|
|
2267
|
-
easing:
|
|
2395
|
+
easing: tokens11.motion.easeOut,
|
|
2268
2396
|
fill: "both"
|
|
2269
2397
|
})];
|
|
2270
2398
|
animations[0].onfinish = () => {
|
|
@@ -2281,7 +2409,7 @@ function ToastSurface({ item, controller }) {
|
|
|
2281
2409
|
function ToastStack({ items, controller }) {
|
|
2282
2410
|
var _a;
|
|
2283
2411
|
const layers = useLayerState();
|
|
2284
|
-
const root =
|
|
2412
|
+
const root = useRef12(null), layout = useRef12(createToastLayout());
|
|
2285
2413
|
const reduced = useReducedMotion();
|
|
2286
2414
|
useLayoutEffect8(() => {
|
|
2287
2415
|
if (root.current) layout.current.update(root.current, reduced);
|
|
@@ -2301,15 +2429,17 @@ function ToastStack({ items, controller }) {
|
|
|
2301
2429
|
|
|
2302
2430
|
// packages/react/src/feedback.tsx
|
|
2303
2431
|
import {
|
|
2304
|
-
createFeedbackController
|
|
2432
|
+
createFeedbackController,
|
|
2433
|
+
feedbackControllerOf
|
|
2305
2434
|
} from "@kjun-ui/tokens";
|
|
2306
2435
|
import {
|
|
2307
|
-
useCallback,
|
|
2308
|
-
useEffect as
|
|
2309
|
-
useRef as
|
|
2436
|
+
useCallback as useCallback2,
|
|
2437
|
+
useEffect as useEffect6,
|
|
2438
|
+
useRef as useRef13,
|
|
2310
2439
|
useState as useState9,
|
|
2311
2440
|
useSyncExternalStore as useSyncExternalStore3
|
|
2312
2441
|
} from "react";
|
|
2442
|
+
import { createKjunFeedback } from "@kjun-ui/tokens";
|
|
2313
2443
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2314
2444
|
function useKjunFeedback() {
|
|
2315
2445
|
const value = useOptionalKjunFeedback();
|
|
@@ -2358,10 +2488,12 @@ function FeedbackDialog({
|
|
|
2358
2488
|
}
|
|
2359
2489
|
);
|
|
2360
2490
|
}
|
|
2361
|
-
function KjunFeedbackProvider({ children }) {
|
|
2491
|
+
function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
2362
2492
|
var _a;
|
|
2363
|
-
const [
|
|
2364
|
-
const
|
|
2493
|
+
const [owned] = useState9(() => controllerProp ? void 0 : createFeedbackController());
|
|
2494
|
+
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
2495
|
+
useEffect6(() => controller.attach(), [controller]);
|
|
2496
|
+
const life = useRef13(0);
|
|
2365
2497
|
const snapshot = useSyncExternalStore3(
|
|
2366
2498
|
controller.subscribe,
|
|
2367
2499
|
controller.getSnapshot,
|
|
@@ -2370,16 +2502,16 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2370
2502
|
const reduced = useReducedMotion();
|
|
2371
2503
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2372
2504
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2373
|
-
|
|
2505
|
+
useEffect6(() => {
|
|
2374
2506
|
const version = ++life.current;
|
|
2375
2507
|
return () => {
|
|
2376
2508
|
queueMicrotask(() => {
|
|
2377
|
-
if (life.current === version) controller.dispose();
|
|
2509
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
2378
2510
|
});
|
|
2379
2511
|
};
|
|
2380
2512
|
}, [controller]);
|
|
2381
2513
|
const [layers, setLayers] = useState9([]);
|
|
2382
|
-
const register =
|
|
2514
|
+
const register = useCallback2((id, order) => {
|
|
2383
2515
|
setLayers((current) => [...current, { id, order }]);
|
|
2384
2516
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2385
2517
|
}, []);
|
|
@@ -2407,11 +2539,11 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2407
2539
|
}
|
|
2408
2540
|
|
|
2409
2541
|
// packages/react/src/controls.tsx
|
|
2410
|
-
import { tokens as
|
|
2542
|
+
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2411
2543
|
import {
|
|
2412
2544
|
createContext as createContext10,
|
|
2413
2545
|
forwardRef as forwardRef3,
|
|
2414
|
-
useCallback as
|
|
2546
|
+
useCallback as useCallback3,
|
|
2415
2547
|
useContext as useContext10,
|
|
2416
2548
|
useId as useId5
|
|
2417
2549
|
} from "react";
|
|
@@ -2421,10 +2553,10 @@ import {
|
|
|
2421
2553
|
} from "react-aria-components";
|
|
2422
2554
|
|
|
2423
2555
|
// packages/react/src/use-selection-indicator.ts
|
|
2424
|
-
import { useLayoutEffect as useLayoutEffect9, useRef as
|
|
2556
|
+
import { useLayoutEffect as useLayoutEffect9, useRef as useRef14 } from "react";
|
|
2425
2557
|
|
|
2426
2558
|
// shared/package-runtime/selection-indicator.ts
|
|
2427
|
-
import { tokens as
|
|
2559
|
+
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2428
2560
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2429
2561
|
var _a;
|
|
2430
2562
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2464,7 +2596,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2464
2596
|
const style = getComputedStyle(next);
|
|
2465
2597
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2466
2598
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2467
|
-
const height = underline ?
|
|
2599
|
+
const height = underline ? tokens12.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2468
2600
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2469
2601
|
if (key !== bounds) {
|
|
2470
2602
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2493,9 +2625,9 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2493
2625
|
|
|
2494
2626
|
// packages/react/src/use-selection-indicator.ts
|
|
2495
2627
|
function useSelectionIndicator(tabs = false) {
|
|
2496
|
-
const group =
|
|
2497
|
-
const indicator =
|
|
2498
|
-
const sync =
|
|
2628
|
+
const group = useRef14(null);
|
|
2629
|
+
const indicator = useRef14(null);
|
|
2630
|
+
const sync = useRef14(() => {
|
|
2499
2631
|
});
|
|
2500
2632
|
useLayoutEffect9(() => {
|
|
2501
2633
|
const root = group.current, marker = indicator.current;
|
|
@@ -2562,7 +2694,7 @@ function KjunCheckbox({
|
|
|
2562
2694
|
"span",
|
|
2563
2695
|
{
|
|
2564
2696
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2565
|
-
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size:
|
|
2697
|
+
children: checked && /* @__PURE__ */ jsx14(KjunIcon, { name: "check", size: tokens13.extensions.checkbox.iconSizes[size] })
|
|
2566
2698
|
}
|
|
2567
2699
|
),
|
|
2568
2700
|
(children || label) && /* @__PURE__ */ jsx14("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2584,7 +2716,7 @@ function KjunSwitch({
|
|
|
2584
2716
|
const field = useKjunField();
|
|
2585
2717
|
const descriptionId = "kjun-" + useId5().replace(/:/g, "") + "-description";
|
|
2586
2718
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2587
|
-
const markInput =
|
|
2719
|
+
const markInput = useCallback3((input) => {
|
|
2588
2720
|
if (!input) return;
|
|
2589
2721
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2590
2722
|
else input.removeAttribute("aria-invalid");
|
|
@@ -2693,7 +2825,7 @@ function KjunRadioGroup({
|
|
|
2693
2825
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2694
2826
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2695
2827
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2696
|
-
gap: direction === "vertical" ?
|
|
2828
|
+
gap: direction === "vertical" ? tokens13.dimension.value8 : tokens13.dimension.value16
|
|
2697
2829
|
},
|
|
2698
2830
|
children: children || options.map((option) => /* @__PURE__ */ jsx14(
|
|
2699
2831
|
KjunRadio,
|
|
@@ -2725,7 +2857,7 @@ var KjunTextarea = forwardRef3(
|
|
|
2725
2857
|
}, ref) {
|
|
2726
2858
|
var _a;
|
|
2727
2859
|
const field = useKjunField();
|
|
2728
|
-
const spec =
|
|
2860
|
+
const spec = tokens13.input[size];
|
|
2729
2861
|
return /* @__PURE__ */ jsx14(
|
|
2730
2862
|
"textarea",
|
|
2731
2863
|
{
|
|
@@ -2743,8 +2875,8 @@ var KjunTextarea = forwardRef3(
|
|
|
2743
2875
|
style: {
|
|
2744
2876
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2745
2877
|
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 *
|
|
2878
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - tokens13.border.controlWidth}px`,
|
|
2879
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * tokens13.border.controlWidth),
|
|
2748
2880
|
borderRadius: spec.radius,
|
|
2749
2881
|
resize,
|
|
2750
2882
|
...style
|
|
@@ -2777,9 +2909,9 @@ function KjunButtonGroup({
|
|
|
2777
2909
|
className: "kjun-button-group",
|
|
2778
2910
|
onKeyDown: groupKeydown,
|
|
2779
2911
|
style: {
|
|
2780
|
-
height:
|
|
2781
|
-
padding:
|
|
2782
|
-
borderRadius:
|
|
2912
|
+
height: tokens13.buttonGroup.heights[size],
|
|
2913
|
+
padding: tokens13.buttonGroup.padding[size],
|
|
2914
|
+
borderRadius: tokens13.buttonGroup.radii[size],
|
|
2783
2915
|
width: fullWidth ? "100%" : "fit-content"
|
|
2784
2916
|
},
|
|
2785
2917
|
children: [
|
|
@@ -2790,7 +2922,7 @@ function KjunButtonGroup({
|
|
|
2790
2922
|
className: "kjun-button-group-indicator",
|
|
2791
2923
|
"aria-hidden": "true",
|
|
2792
2924
|
hidden: true,
|
|
2793
|
-
style: { borderRadius:
|
|
2925
|
+
style: { borderRadius: tokens13.buttonGroup.itemRadii[size] }
|
|
2794
2926
|
}
|
|
2795
2927
|
),
|
|
2796
2928
|
options.map((option) => /* @__PURE__ */ jsxs9(
|
|
@@ -2801,8 +2933,8 @@ function KjunButtonGroup({
|
|
|
2801
2933
|
disabled: disabled || option.disabled,
|
|
2802
2934
|
style: {
|
|
2803
2935
|
flex: fullWidth ? 1 : void 0,
|
|
2804
|
-
paddingInline:
|
|
2805
|
-
borderRadius:
|
|
2936
|
+
paddingInline: tokens13.buttonGroup.itemPaddingX[size],
|
|
2937
|
+
borderRadius: tokens13.buttonGroup.itemRadii[size],
|
|
2806
2938
|
...selectionTypeStyle(size, value === option.value)
|
|
2807
2939
|
},
|
|
2808
2940
|
onClick: () => {
|
|
@@ -2810,9 +2942,9 @@ function KjunButtonGroup({
|
|
|
2810
2942
|
onChange == null ? void 0 : onChange(option.value);
|
|
2811
2943
|
},
|
|
2812
2944
|
children: [
|
|
2813
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
2945
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens13.extensions.selection.iconSize }),
|
|
2814
2946
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-button-group-label", children: [
|
|
2815
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
2947
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens13.button.typography[size]), children: option.label }),
|
|
2816
2948
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2817
2949
|
] })
|
|
2818
2950
|
]
|
|
@@ -2848,7 +2980,7 @@ function KjunFilterGroup({
|
|
|
2848
2980
|
{
|
|
2849
2981
|
type: "button",
|
|
2850
2982
|
className: "kjun-filter-chip",
|
|
2851
|
-
style: { borderRadius:
|
|
2983
|
+
style: { borderRadius: tokens13.button.radii[size] },
|
|
2852
2984
|
"aria-pressed": selected(option.value),
|
|
2853
2985
|
disabled: disabled || option.disabled,
|
|
2854
2986
|
onClick: () => {
|
|
@@ -2860,15 +2992,15 @@ function KjunFilterGroup({
|
|
|
2860
2992
|
"span",
|
|
2861
2993
|
{
|
|
2862
2994
|
style: {
|
|
2863
|
-
height:
|
|
2864
|
-
paddingInline: { xs:
|
|
2995
|
+
height: tokens13.button.heights[size],
|
|
2996
|
+
paddingInline: { xs: tokens13.dimension.value8, sm: tokens13.dimension.value12, md: tokens13.dimension.value12, lg: tokens13.dimension.value14, xl: tokens13.dimension.value16 }[size],
|
|
2865
2997
|
...selectionTypeStyle(size, selected(option.value))
|
|
2866
2998
|
},
|
|
2867
2999
|
children: [
|
|
2868
3000
|
option.dot && /* @__PURE__ */ jsx14("i", { style: { background: option.dot } }),
|
|
2869
|
-
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size:
|
|
3001
|
+
option.icon && /* @__PURE__ */ jsx14(KjunIcon, { name: option.icon, size: tokens13.extensions.selection.iconSize }),
|
|
2870
3002
|
/* @__PURE__ */ jsxs9("span", { className: "kjun-filter-label", children: [
|
|
2871
|
-
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(
|
|
3003
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", style: typeStyle(tokens13.button.typography[size]), children: option.label }),
|
|
2872
3004
|
/* @__PURE__ */ jsx14("span", { children: option.label })
|
|
2873
3005
|
] })
|
|
2874
3006
|
]
|
|
@@ -2882,8 +3014,8 @@ function KjunFilterGroup({
|
|
|
2882
3014
|
}
|
|
2883
3015
|
|
|
2884
3016
|
// packages/react/src/floating-panel.tsx
|
|
2885
|
-
import { isComposingKey as isComposingKey3, tokens as
|
|
2886
|
-
import { useEffect as
|
|
3017
|
+
import { isComposingKey as isComposingKey3, tokens as tokens14 } from "@kjun-ui/tokens";
|
|
3018
|
+
import { useEffect as useEffect7, useRef as useRef15 } from "react";
|
|
2887
3019
|
import { Popover as AriaPopover } from "react-aria-components";
|
|
2888
3020
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2889
3021
|
function FloatingPanel({
|
|
@@ -2901,11 +3033,11 @@ function FloatingPanel({
|
|
|
2901
3033
|
ownsDismiss = false,
|
|
2902
3034
|
returnFocus
|
|
2903
3035
|
}) {
|
|
2904
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3036
|
+
const motion = usePresence(open, useReducedMotion(), tokens14.motion.popupExit);
|
|
2905
3037
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2906
3038
|
const container = useKjunPortalContainer();
|
|
2907
|
-
const panel =
|
|
2908
|
-
|
|
3039
|
+
const panel = useRef15(null);
|
|
3040
|
+
useEffect7(() => {
|
|
2909
3041
|
var _a;
|
|
2910
3042
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2911
3043
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
@@ -2937,9 +3069,9 @@ function FloatingPanel({
|
|
|
2937
3069
|
UNSTABLE_portalContainer: container,
|
|
2938
3070
|
placement: placement.replace("-", " "),
|
|
2939
3071
|
shouldFlip: flip,
|
|
2940
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
2941
|
-
offset: field ?
|
|
2942
|
-
containerPadding:
|
|
3072
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? tokens14.extensions.menu.listMaxHeight : tokens14.extensions.floating.maxHeight : void 0,
|
|
3073
|
+
offset: field ? tokens14.extensions.floating.fieldGap : tokens14.extensions.floating.anchorGap,
|
|
3074
|
+
containerPadding: tokens14.extensions.floating.viewportInset,
|
|
2943
3075
|
className: "kjun-scope kjun-floating " + className,
|
|
2944
3076
|
"data-motion": "popup",
|
|
2945
3077
|
"data-motion-open": String(motion.active),
|
|
@@ -2952,10 +3084,11 @@ function FloatingPanel({
|
|
|
2952
3084
|
}
|
|
2953
3085
|
) });
|
|
2954
3086
|
}
|
|
3087
|
+
var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
|
|
2955
3088
|
|
|
2956
3089
|
// packages/react/src/popover.tsx
|
|
2957
|
-
import { tokens as
|
|
2958
|
-
import { useCallback as
|
|
3090
|
+
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
3091
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useId as useId6, useRef as useRef16, useState as useState10 } from "react";
|
|
2959
3092
|
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger } from "react-aria-components";
|
|
2960
3093
|
|
|
2961
3094
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -3037,20 +3170,20 @@ function KjunPopover({
|
|
|
3037
3170
|
children
|
|
3038
3171
|
}) {
|
|
3039
3172
|
const m = useKjunMessages();
|
|
3040
|
-
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref =
|
|
3173
|
+
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal, ref = useRef16(null), id = "kjun-" + useId6();
|
|
3041
3174
|
const expanded = usePopupExpanded(open, ref);
|
|
3042
|
-
const focusOnMount =
|
|
3175
|
+
const focusOnMount = useRef16(focusOnOpen);
|
|
3043
3176
|
focusOnMount.current = focusOnOpen;
|
|
3044
|
-
const focusContent =
|
|
3177
|
+
const focusContent = useCallback4((node) => {
|
|
3045
3178
|
if (node && focusOnMount.current) node.focus();
|
|
3046
3179
|
}, []);
|
|
3047
|
-
const resolveReturn =
|
|
3180
|
+
const resolveReturn = resolveFocusReturn(returnFocus);
|
|
3048
3181
|
const change = (v) => {
|
|
3049
3182
|
setInternal(v);
|
|
3050
3183
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3051
3184
|
};
|
|
3052
|
-
const skipReturn =
|
|
3053
|
-
|
|
3185
|
+
const skipReturn = useRef16(false);
|
|
3186
|
+
useEffect8(() => {
|
|
3054
3187
|
if (!open || modal) return;
|
|
3055
3188
|
skipReturn.current = false;
|
|
3056
3189
|
return installNonModalPopover({
|
|
@@ -3107,7 +3240,7 @@ function KjunPopover({
|
|
|
3107
3240
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3108
3241
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3109
3242
|
className: "kjun-popover-dialog",
|
|
3110
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3243
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens15.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3111
3244
|
};
|
|
3112
3245
|
const body = /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
3113
3246
|
header != null && /* @__PURE__ */ jsx16("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3143,10 +3276,10 @@ function KjunTooltip({
|
|
|
3143
3276
|
style: { zIndex: layer.zIndex },
|
|
3144
3277
|
UNSTABLE_portalContainer: container,
|
|
3145
3278
|
placement,
|
|
3146
|
-
offset:
|
|
3279
|
+
offset: tokens15.extensions.floating.anchorGap,
|
|
3147
3280
|
className: "kjun-scope kjun-tooltip",
|
|
3148
3281
|
children: [
|
|
3149
|
-
/* @__PURE__ */ jsx16(OverlayArrow, { children: /* @__PURE__ */ jsx16("svg", { width:
|
|
3282
|
+
/* @__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
3283
|
content
|
|
3151
3284
|
]
|
|
3152
3285
|
}
|
|
@@ -3155,8 +3288,8 @@ function KjunTooltip({
|
|
|
3155
3288
|
}
|
|
3156
3289
|
|
|
3157
3290
|
// packages/react/src/dropdown.tsx
|
|
3158
|
-
import { tokens as
|
|
3159
|
-
import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as
|
|
3291
|
+
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
3292
|
+
import { cloneElement, createContext as createContext11, isValidElement as isValidElement2, useCallback as useCallback5, useContext as useContext11, useEffect as useEffect9, useId as useId7, useRef as useRef17, useState as useState11 } from "react";
|
|
3160
3293
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
3161
3294
|
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3162
3295
|
var DropdownContext = createContext11(null);
|
|
@@ -3169,12 +3302,13 @@ function KjunDropdown({
|
|
|
3169
3302
|
trigger,
|
|
3170
3303
|
children,
|
|
3171
3304
|
onOpen,
|
|
3172
|
-
onClose
|
|
3305
|
+
onClose,
|
|
3306
|
+
returnFocus
|
|
3173
3307
|
}) {
|
|
3174
|
-
const [open, setOpen] = useState11(false), currentOpen =
|
|
3175
|
-
const menuFocusCleanup =
|
|
3308
|
+
const [open, setOpen] = useState11(false), currentOpen = useRef17(false), ref = useRef17(null), id = "kjun-" + useId7();
|
|
3309
|
+
const menuFocusCleanup = useRef17(() => {
|
|
3176
3310
|
});
|
|
3177
|
-
const bindMenu =
|
|
3311
|
+
const bindMenu = useCallback5((menu) => {
|
|
3178
3312
|
menuFocusCleanup.current();
|
|
3179
3313
|
menuFocusCleanup.current = () => {
|
|
3180
3314
|
};
|
|
@@ -3225,7 +3359,7 @@ function KjunDropdown({
|
|
|
3225
3359
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
3226
3360
|
else onClose == null ? void 0 : onClose();
|
|
3227
3361
|
};
|
|
3228
|
-
|
|
3362
|
+
useEffect9(() => {
|
|
3229
3363
|
if (unavailable) change(false);
|
|
3230
3364
|
}, [unavailable]);
|
|
3231
3365
|
return /* @__PURE__ */ jsxs11(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -3249,6 +3383,7 @@ function KjunDropdown({
|
|
|
3249
3383
|
{
|
|
3250
3384
|
open,
|
|
3251
3385
|
onOpenChange: change,
|
|
3386
|
+
returnFocus: resolveFocusReturn(returnFocus),
|
|
3252
3387
|
triggerRef: ref,
|
|
3253
3388
|
placement,
|
|
3254
3389
|
className: "kjun-dropdown",
|
|
@@ -3279,7 +3414,7 @@ function KjunDropdownItem({
|
|
|
3279
3414
|
onClick
|
|
3280
3415
|
}) {
|
|
3281
3416
|
const close = useContext11(DropdownContext);
|
|
3282
|
-
const node =
|
|
3417
|
+
const node = useCallback5((element) => {
|
|
3283
3418
|
if (!element) return;
|
|
3284
3419
|
if (selected === null) {
|
|
3285
3420
|
element.setAttribute("role", "menuitem");
|
|
@@ -3304,14 +3439,14 @@ function KjunDropdownItem({
|
|
|
3304
3439
|
close == null ? void 0 : close();
|
|
3305
3440
|
},
|
|
3306
3441
|
children: [
|
|
3307
|
-
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3442
|
+
icon && /* @__PURE__ */ jsx17(KjunIcon, { name: icon, className: "kjun-menu-icon", size: tokens16.extensions.menu.iconSize }),
|
|
3308
3443
|
/* @__PURE__ */ jsx17("span", { children }),
|
|
3309
3444
|
selected !== null && /* @__PURE__ */ jsx17(
|
|
3310
3445
|
KjunIcon,
|
|
3311
3446
|
{
|
|
3312
3447
|
name: "check",
|
|
3313
3448
|
className: "kjun-menu-check",
|
|
3314
|
-
size:
|
|
3449
|
+
size: tokens16.extensions.menu.iconSize,
|
|
3315
3450
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3316
3451
|
}
|
|
3317
3452
|
)
|
|
@@ -3378,7 +3513,7 @@ function KjunMenuButton({
|
|
|
3378
3513
|
}
|
|
3379
3514
|
|
|
3380
3515
|
// packages/react/src/drawer.tsx
|
|
3381
|
-
import { tokens as
|
|
3516
|
+
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
3382
3517
|
|
|
3383
3518
|
// shared/package-runtime/drawer-geometry.ts
|
|
3384
3519
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3397,7 +3532,7 @@ function KjunDrawer({
|
|
|
3397
3532
|
onOpenChange,
|
|
3398
3533
|
title,
|
|
3399
3534
|
position = "right",
|
|
3400
|
-
width =
|
|
3535
|
+
width = tokens17.extensions.drawer.width,
|
|
3401
3536
|
closable = true,
|
|
3402
3537
|
closeOnOverlay = true,
|
|
3403
3538
|
closeOnEsc = true,
|
|
@@ -3406,13 +3541,15 @@ function KjunDrawer({
|
|
|
3406
3541
|
footer,
|
|
3407
3542
|
children,
|
|
3408
3543
|
onClose,
|
|
3544
|
+
onAfterClose,
|
|
3409
3545
|
ariaLabel,
|
|
3410
3546
|
safeAreaTop = 0,
|
|
3411
3547
|
safeAreaBottom = 0,
|
|
3412
3548
|
maxHeight
|
|
3413
3549
|
}) {
|
|
3414
3550
|
const m = useKjunMessages();
|
|
3415
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3551
|
+
const motion = usePresence(open, useReducedMotion(), tokens17.motion.layerExit);
|
|
3552
|
+
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3416
3553
|
const container = useKjunPortalContainer();
|
|
3417
3554
|
const close = () => {
|
|
3418
3555
|
if (!open) return;
|
|
@@ -3426,6 +3563,7 @@ function KjunDrawer({
|
|
|
3426
3563
|
return /* @__PURE__ */ jsx18(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx18(
|
|
3427
3564
|
ModalOverlay2,
|
|
3428
3565
|
{
|
|
3566
|
+
ref: afterCloseRef,
|
|
3429
3567
|
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
3430
3568
|
isOpen: motion.present && layer.active,
|
|
3431
3569
|
isExiting: motion.present && !layer.active,
|
|
@@ -3467,8 +3605,8 @@ function KjunDrawer({
|
|
|
3467
3605
|
variant: "ghost",
|
|
3468
3606
|
ariaLabel: m.close,
|
|
3469
3607
|
onClick: close,
|
|
3470
|
-
style: { borderRadius:
|
|
3471
|
-
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size:
|
|
3608
|
+
style: { borderRadius: tokens17.extensions.drawer.closeRadius, width: tokens17.extensions.drawer.closeSize, height: tokens17.extensions.drawer.closeSize, padding: 0 },
|
|
3609
|
+
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", size: tokens17.extensions.drawer.closeIconSize })
|
|
3472
3610
|
}
|
|
3473
3611
|
)
|
|
3474
3612
|
] }),
|
|
@@ -3476,7 +3614,7 @@ function KjunDrawer({
|
|
|
3476
3614
|
"div",
|
|
3477
3615
|
{
|
|
3478
3616
|
className: "kjun-drawer-body",
|
|
3479
|
-
style: { padding: noPadding ? 0 :
|
|
3617
|
+
style: { padding: noPadding ? 0 : tokens17.extensions.drawer.bodyPadding },
|
|
3480
3618
|
children
|
|
3481
3619
|
}
|
|
3482
3620
|
),
|
|
@@ -3492,7 +3630,7 @@ function KjunDrawer({
|
|
|
3492
3630
|
}
|
|
3493
3631
|
|
|
3494
3632
|
// shared/package-runtime/combobox.ts
|
|
3495
|
-
import { useEffect as
|
|
3633
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
3496
3634
|
|
|
3497
3635
|
// shared/package-runtime/options.ts
|
|
3498
3636
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3572,8 +3710,8 @@ function useComboboxModel({
|
|
|
3572
3710
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3573
3711
|
const [query2, setQuery] = useState12(selectedLabel);
|
|
3574
3712
|
const [open, setOpen] = useState12(false);
|
|
3575
|
-
|
|
3576
|
-
|
|
3713
|
+
useEffect10(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3714
|
+
useEffect10(() => {
|
|
3577
3715
|
if (disabled) setOpen(false);
|
|
3578
3716
|
}, [disabled]);
|
|
3579
3717
|
const change = (next) => {
|
|
@@ -3607,9 +3745,9 @@ function useComboboxModel({
|
|
|
3607
3745
|
|
|
3608
3746
|
// packages/react/src/combobox.tsx
|
|
3609
3747
|
import {
|
|
3610
|
-
useEffect as
|
|
3748
|
+
useEffect as useEffect11,
|
|
3611
3749
|
useId as useId8,
|
|
3612
|
-
useRef as
|
|
3750
|
+
useRef as useRef18,
|
|
3613
3751
|
useState as useState13
|
|
3614
3752
|
} from "react";
|
|
3615
3753
|
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
@@ -3630,7 +3768,8 @@ function KjunCombobox({
|
|
|
3630
3768
|
onValueChange,
|
|
3631
3769
|
onChange,
|
|
3632
3770
|
onSearch,
|
|
3633
|
-
onClear
|
|
3771
|
+
onClear,
|
|
3772
|
+
returnFocus
|
|
3634
3773
|
}) {
|
|
3635
3774
|
const m = useKjunMessages();
|
|
3636
3775
|
placeholder != null ? placeholder : placeholder = m.searchOrSelect;
|
|
@@ -3666,7 +3805,8 @@ function KjunCombobox({
|
|
|
3666
3805
|
renderOption,
|
|
3667
3806
|
onValueChange: (v) => model.search(v, true),
|
|
3668
3807
|
onSelect: model.select,
|
|
3669
|
-
onClear: model.clear
|
|
3808
|
+
onClear: model.clear,
|
|
3809
|
+
returnFocus: resolveFocusReturn(returnFocus)
|
|
3670
3810
|
}
|
|
3671
3811
|
);
|
|
3672
3812
|
}
|
|
@@ -3691,16 +3831,17 @@ function SearchField({
|
|
|
3691
3831
|
onValueChange,
|
|
3692
3832
|
onSelect,
|
|
3693
3833
|
onClear,
|
|
3694
|
-
onEnter
|
|
3834
|
+
onEnter,
|
|
3835
|
+
returnFocus
|
|
3695
3836
|
}) {
|
|
3696
3837
|
const m = useKjunMessages();
|
|
3697
3838
|
const composition = useCompositionGuard();
|
|
3698
|
-
const clearing =
|
|
3699
|
-
const ref =
|
|
3839
|
+
const clearing = useRef18(false);
|
|
3840
|
+
const ref = useRef18(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
3700
3841
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3701
3842
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3702
|
-
|
|
3703
|
-
|
|
3843
|
+
useEffect11(() => setActive(-1), [value, options.length]);
|
|
3844
|
+
useEffect11(() => {
|
|
3704
3845
|
if (!open) return;
|
|
3705
3846
|
const leaveField = (event) => {
|
|
3706
3847
|
var _a, _b, _c;
|
|
@@ -3710,16 +3851,16 @@ function SearchField({
|
|
|
3710
3851
|
document.addEventListener("focusin", leaveField);
|
|
3711
3852
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3712
3853
|
}, [open, onOpenChange, id]);
|
|
3713
|
-
|
|
3854
|
+
useEffect11(() => {
|
|
3714
3855
|
if (highlighted !== active) setActive(-1);
|
|
3715
3856
|
}, [highlighted, active]);
|
|
3716
3857
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
3717
3858
|
const select = (o) => {
|
|
3718
|
-
var _a;
|
|
3859
|
+
var _a, _b;
|
|
3719
3860
|
if (o === void 0 || disabled || loading || optionDisabled(o)) return;
|
|
3720
3861
|
onSelect(o);
|
|
3721
3862
|
onOpenChange(false);
|
|
3722
|
-
(_a = ref.current) == null ? void 0 :
|
|
3863
|
+
(_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
|
|
3723
3864
|
};
|
|
3724
3865
|
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3725
3866
|
/* @__PURE__ */ jsx19(
|
|
@@ -3767,7 +3908,7 @@ function SearchField({
|
|
|
3767
3908
|
onCompositionStart: composition.onCompositionStart,
|
|
3768
3909
|
onCompositionEnd: composition.onCompositionEnd,
|
|
3769
3910
|
onKeyDown: (e) => {
|
|
3770
|
-
var _a, _b, _c, _d;
|
|
3911
|
+
var _a, _b, _c, _d, _e;
|
|
3771
3912
|
if (composition.isComposing(e)) return;
|
|
3772
3913
|
let next = active;
|
|
3773
3914
|
if (e.key === "ArrowDown") {
|
|
@@ -3790,10 +3931,11 @@ function SearchField({
|
|
|
3790
3931
|
e.preventDefault();
|
|
3791
3932
|
e.stopPropagation();
|
|
3792
3933
|
onOpenChange(false);
|
|
3934
|
+
(_d = returnFocus == null ? void 0 : returnFocus()) == null ? void 0 : _d.focus();
|
|
3793
3935
|
}
|
|
3794
3936
|
setActive(next);
|
|
3795
3937
|
if (next >= 0)
|
|
3796
|
-
(
|
|
3938
|
+
(_e = document.getElementById(id + "-" + next)) == null ? void 0 : _e.scrollIntoView({ block: "nearest" });
|
|
3797
3939
|
}
|
|
3798
3940
|
}
|
|
3799
3941
|
),
|
|
@@ -3842,7 +3984,7 @@ function SearchField({
|
|
|
3842
3984
|
}
|
|
3843
3985
|
|
|
3844
3986
|
// packages/react/src/date-picker.tsx
|
|
3845
|
-
import { tokens as
|
|
3987
|
+
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3846
3988
|
import {
|
|
3847
3989
|
useState as useState14
|
|
3848
3990
|
} from "react";
|
|
@@ -3868,8 +4010,8 @@ function KjunDatePicker({
|
|
|
3868
4010
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
3869
4011
|
/* @__PURE__ */ jsxs14("div", { className: "kjun-date-picker", style: {
|
|
3870
4012
|
position: "relative",
|
|
3871
|
-
["--_kjun-date-icon-inset"]:
|
|
3872
|
-
["--_kjun-date-icon-size"]:
|
|
4013
|
+
["--_kjun-date-icon-inset"]: tokens18.input[size].padding + "px",
|
|
4014
|
+
["--_kjun-date-icon-size"]: tokens18.input[size].iconSize + "px"
|
|
3873
4015
|
}, children: [
|
|
3874
4016
|
/* @__PURE__ */ jsx20(
|
|
3875
4017
|
KjunInput,
|
|
@@ -3899,8 +4041,8 @@ function KjunDatePicker({
|
|
|
3899
4041
|
"aria-hidden": "true",
|
|
3900
4042
|
className: "kjun-date-overlay",
|
|
3901
4043
|
style: {
|
|
3902
|
-
left:
|
|
3903
|
-
right:
|
|
4044
|
+
left: tokens18.input[size].padding,
|
|
4045
|
+
right: tokens18.input[size].padding + tokens18.input[size].iconSize + tokens18.input[size].affixGap + (clear ? tokens18.input[size].clearSize + tokens18.input[size].affixGap : 0),
|
|
3904
4046
|
...inputTypeStyle(size),
|
|
3905
4047
|
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
4048
|
},
|
|
@@ -3916,14 +4058,14 @@ function KjunDatePicker({
|
|
|
3916
4058
|
className: "kjun-select-clear",
|
|
3917
4059
|
style: {
|
|
3918
4060
|
padding: 0,
|
|
3919
|
-
right:
|
|
3920
|
-
width:
|
|
3921
|
-
height:
|
|
3922
|
-
minHeight:
|
|
4061
|
+
right: tokens18.input[size].padding + tokens18.input[size].iconSize + tokens18.input[size].affixGap,
|
|
4062
|
+
width: tokens18.input[size].clearSize,
|
|
4063
|
+
height: tokens18.input[size].clearSize,
|
|
4064
|
+
minHeight: tokens18.input[size].clearSize,
|
|
3923
4065
|
borderRadius: "50%"
|
|
3924
4066
|
},
|
|
3925
4067
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
3926
|
-
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size:
|
|
4068
|
+
children: /* @__PURE__ */ jsx20(KjunIcon, { name: "x", size: tokens18.input[size].iconSize })
|
|
3927
4069
|
}
|
|
3928
4070
|
)
|
|
3929
4071
|
] })
|
|
@@ -3934,7 +4076,7 @@ function KjunDatePicker({
|
|
|
3934
4076
|
import { useState as useState16 } from "react";
|
|
3935
4077
|
|
|
3936
4078
|
// shared/package-runtime/search-input.ts
|
|
3937
|
-
import { useEffect as
|
|
4079
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect10, useRef as useRef19, useState as useState15 } from "react";
|
|
3938
4080
|
function useSearchInputModel({
|
|
3939
4081
|
value,
|
|
3940
4082
|
disabled = false,
|
|
@@ -3944,10 +4086,10 @@ function useSearchInputModel({
|
|
|
3944
4086
|
onValueChange,
|
|
3945
4087
|
onSearchError
|
|
3946
4088
|
}, open) {
|
|
3947
|
-
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version =
|
|
4089
|
+
const [query2, setQuery] = useState15(value), [options, setOptions] = useState15([]), [loading, setLoading] = useState15(false), [failed, setFailed] = useState15(false), version = useRef19(0), notify = useRef19(onSearchError);
|
|
3948
4090
|
notify.current = onSearchError;
|
|
3949
|
-
const timer =
|
|
3950
|
-
const notifyValue =
|
|
4091
|
+
const timer = useRef19(void 0);
|
|
4092
|
+
const notifyValue = useRef19(onValueChange);
|
|
3951
4093
|
notifyValue.current = onValueChange;
|
|
3952
4094
|
useLayoutEffect10(() => {
|
|
3953
4095
|
clearTimeout(timer.current);
|
|
@@ -3957,7 +4099,7 @@ function useSearchInputModel({
|
|
|
3957
4099
|
clearTimeout(timer.current);
|
|
3958
4100
|
return () => clearTimeout(timer.current);
|
|
3959
4101
|
}, [disabled, debounce, !!loadOptions]);
|
|
3960
|
-
|
|
4102
|
+
useEffect12(() => {
|
|
3961
4103
|
const current = ++version.current, abort = new AbortController();
|
|
3962
4104
|
setFailed(false);
|
|
3963
4105
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -4110,17 +4252,17 @@ function KjunSearchInput({
|
|
|
4110
4252
|
}
|
|
4111
4253
|
|
|
4112
4254
|
// packages/react/src/select-control.tsx
|
|
4113
|
-
import { tokens as
|
|
4255
|
+
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
4114
4256
|
import {
|
|
4115
4257
|
useId as useId9,
|
|
4116
4258
|
useContext as useContext12,
|
|
4117
|
-
useRef as
|
|
4118
|
-
useEffect as
|
|
4259
|
+
useRef as useRef21,
|
|
4260
|
+
useEffect as useEffect14
|
|
4119
4261
|
} from "react";
|
|
4120
4262
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
4121
4263
|
|
|
4122
4264
|
// shared/package-runtime/select.ts
|
|
4123
|
-
import { useEffect as
|
|
4265
|
+
import { useEffect as useEffect13, useRef as useRef20, useState as useState17 } from "react";
|
|
4124
4266
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4125
4267
|
const [internal, setInternal] = useState17(false);
|
|
4126
4268
|
const [query2, setQuery] = useState17("");
|
|
@@ -4128,8 +4270,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4128
4270
|
const [session, setSession] = useState17(0);
|
|
4129
4271
|
const isControlled = typeof controlled === "boolean";
|
|
4130
4272
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4131
|
-
const previousOpen =
|
|
4132
|
-
|
|
4273
|
+
const previousOpen = useRef20(open);
|
|
4274
|
+
useEffect13(() => {
|
|
4133
4275
|
if (disabled && !isControlled) setInternal(false);
|
|
4134
4276
|
if (previousOpen.current && !open) {
|
|
4135
4277
|
setQuery("");
|
|
@@ -4138,7 +4280,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4138
4280
|
}
|
|
4139
4281
|
previousOpen.current = open;
|
|
4140
4282
|
}, [open, disabled, isControlled, pageSize]);
|
|
4141
|
-
|
|
4283
|
+
useEffect13(() => {
|
|
4142
4284
|
setLimit(pageSize);
|
|
4143
4285
|
}, [pageSize]);
|
|
4144
4286
|
const changeOpen = (next) => {
|
|
@@ -4187,24 +4329,25 @@ function KjunSelect({
|
|
|
4187
4329
|
onSearch,
|
|
4188
4330
|
onClear,
|
|
4189
4331
|
filterFn,
|
|
4190
|
-
searchKeys
|
|
4332
|
+
searchKeys,
|
|
4333
|
+
returnFocus
|
|
4191
4334
|
}) {
|
|
4192
4335
|
const m = useKjunMessages();
|
|
4193
4336
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
4194
4337
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4195
4338
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4196
4339
|
const composition = useCompositionGuard();
|
|
4197
|
-
const ref =
|
|
4340
|
+
const ref = useRef21(null), menu = useRef21(null), field = useKjunField(), id = "kjun-" + useId9();
|
|
4198
4341
|
const segment = useContext12(CompoundControlContext) !== null;
|
|
4199
|
-
const spec =
|
|
4342
|
+
const spec = tokens19.input[size];
|
|
4200
4343
|
const expanded = usePopupExpanded(open, ref);
|
|
4201
4344
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4202
|
-
|
|
4345
|
+
useEffect14(() => {
|
|
4203
4346
|
if (!registerControl || !triggerId) return;
|
|
4204
4347
|
registerControl(triggerId);
|
|
4205
4348
|
return () => registerControl(void 0);
|
|
4206
4349
|
}, [registerControl, triggerId]);
|
|
4207
|
-
|
|
4350
|
+
useEffect14(() => {
|
|
4208
4351
|
var _a, _b;
|
|
4209
4352
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
4210
4353
|
if (!open) composition.onCompositionEnd();
|
|
@@ -4250,7 +4393,7 @@ function KjunSelect({
|
|
|
4250
4393
|
borderRadius: spec.radius,
|
|
4251
4394
|
...inputTypeStyle(size),
|
|
4252
4395
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4253
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4396
|
+
...segment ? {} : { paddingInline: spec.padding - tokens19.border.controlWidth }
|
|
4254
4397
|
},
|
|
4255
4398
|
onClick: () => changeOpen(!open),
|
|
4256
4399
|
onKeyDown: (e) => {
|
|
@@ -4261,7 +4404,7 @@ function KjunSelect({
|
|
|
4261
4404
|
},
|
|
4262
4405
|
children: [
|
|
4263
4406
|
/* @__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 ?
|
|
4407
|
+
/* @__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
4408
|
]
|
|
4266
4409
|
}
|
|
4267
4410
|
),
|
|
@@ -4296,6 +4439,7 @@ function KjunSelect({
|
|
|
4296
4439
|
{
|
|
4297
4440
|
field: true,
|
|
4298
4441
|
open,
|
|
4442
|
+
returnFocus: resolveFocusReturn(returnFocus),
|
|
4299
4443
|
onOpenChange: changeOpen,
|
|
4300
4444
|
triggerRef: ref,
|
|
4301
4445
|
placement: "bottom-start",
|
|
@@ -4365,7 +4509,7 @@ function KjunSelect({
|
|
|
4365
4509
|
className: "kjun-option",
|
|
4366
4510
|
children: [
|
|
4367
4511
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ jsx22("span", { children: optionLabel(o, labelKey) }),
|
|
4368
|
-
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size:
|
|
4512
|
+
selected(o) && /* @__PURE__ */ jsx22(KjunIcon, { name: "check", size: tokens19.extensions.menu.iconSize })
|
|
4369
4513
|
]
|
|
4370
4514
|
},
|
|
4371
4515
|
key
|
|
@@ -4391,20 +4535,22 @@ function KjunSelect({
|
|
|
4391
4535
|
}
|
|
4392
4536
|
|
|
4393
4537
|
// packages/react/src/navigation.tsx
|
|
4394
|
-
import { tokens as
|
|
4538
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4395
4539
|
|
|
4396
4540
|
// packages/react/src/collapse.tsx
|
|
4397
|
-
import { tokens as
|
|
4398
|
-
import { useLayoutEffect as useLayoutEffect11, useRef as
|
|
4541
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
4542
|
+
import { useLayoutEffect as useLayoutEffect11, useRef as useRef22, useState as useState18 } from "react";
|
|
4399
4543
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4400
|
-
function Collapse({ open, children }) {
|
|
4544
|
+
function Collapse({ open, keepMounted = false, children }) {
|
|
4401
4545
|
const reduced = useReducedMotion();
|
|
4402
4546
|
const [retained, setRetained] = useState18(open);
|
|
4403
|
-
const root =
|
|
4404
|
-
const animation =
|
|
4405
|
-
const previous =
|
|
4406
|
-
const interrupted =
|
|
4407
|
-
const
|
|
4547
|
+
const root = useRef22(null), body = useRef22(null);
|
|
4548
|
+
const animation = useRef22(null);
|
|
4549
|
+
const previous = useRef22(open);
|
|
4550
|
+
const interrupted = useRef22(null);
|
|
4551
|
+
const opened = useRef22(open);
|
|
4552
|
+
if (open) opened.current = true;
|
|
4553
|
+
const present = open || retained || keepMounted && opened.current;
|
|
4408
4554
|
useLayoutEffect11(() => {
|
|
4409
4555
|
const el = root.current, inner = body.current;
|
|
4410
4556
|
if (!el || !inner) return;
|
|
@@ -4430,8 +4576,8 @@ function Collapse({ open, children }) {
|
|
|
4430
4576
|
}
|
|
4431
4577
|
el.style.height = end + "px";
|
|
4432
4578
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4433
|
-
duration:
|
|
4434
|
-
easing:
|
|
4579
|
+
duration: tokens20.motion.collapse,
|
|
4580
|
+
easing: tokens20.motion.easeOut
|
|
4435
4581
|
});
|
|
4436
4582
|
animation.current = transition;
|
|
4437
4583
|
transition.onfinish = finish;
|
|
@@ -4460,10 +4606,10 @@ function Collapse({ open, children }) {
|
|
|
4460
4606
|
}
|
|
4461
4607
|
|
|
4462
4608
|
// shared/package-runtime/navigation.ts
|
|
4463
|
-
import { useEffect as
|
|
4609
|
+
import { useEffect as useEffect15, useRef as useRef23, useState as useState19 } from "react";
|
|
4464
4610
|
function useInitialTab(value, candidate, change) {
|
|
4465
|
-
const requested =
|
|
4466
|
-
|
|
4611
|
+
const requested = useRef23(/* @__PURE__ */ new Set());
|
|
4612
|
+
useEffect15(() => {
|
|
4467
4613
|
if (value !== "") {
|
|
4468
4614
|
requested.current.clear();
|
|
4469
4615
|
return;
|
|
@@ -4475,7 +4621,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
4475
4621
|
}
|
|
4476
4622
|
function useAccordionState(multiple) {
|
|
4477
4623
|
const [opened, setOpened] = useState19(/* @__PURE__ */ new Set());
|
|
4478
|
-
|
|
4624
|
+
useEffect15(() => {
|
|
4479
4625
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4480
4626
|
}, [multiple]);
|
|
4481
4627
|
return {
|
|
@@ -4565,10 +4711,10 @@ import {
|
|
|
4565
4711
|
Fragment as Fragment7,
|
|
4566
4712
|
isValidElement as isValidElement3,
|
|
4567
4713
|
useContext as useContext13,
|
|
4568
|
-
useEffect as
|
|
4714
|
+
useEffect as useEffect16,
|
|
4569
4715
|
useLayoutEffect as useLayoutEffect12,
|
|
4570
4716
|
useId as useId10,
|
|
4571
|
-
useRef as
|
|
4717
|
+
useRef as useRef24,
|
|
4572
4718
|
useState as useState20
|
|
4573
4719
|
} from "react";
|
|
4574
4720
|
import { Tab, TabList, TabPanel, Tabs } from "react-aria-components";
|
|
@@ -4606,15 +4752,15 @@ function KjunTabs({
|
|
|
4606
4752
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4607
4753
|
}
|
|
4608
4754
|
});
|
|
4609
|
-
const timer =
|
|
4610
|
-
const menuState =
|
|
4755
|
+
const timer = useRef24(void 0), press = useRef24(null);
|
|
4756
|
+
const menuState = useRef24({ tabs, onTabMenu });
|
|
4611
4757
|
menuState.current = { tabs, onTabMenu };
|
|
4612
4758
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4613
4759
|
const clear = () => {
|
|
4614
4760
|
clearTimeout(timer.current);
|
|
4615
4761
|
press.current = null;
|
|
4616
4762
|
};
|
|
4617
|
-
|
|
4763
|
+
useEffect16(() => clear, []);
|
|
4618
4764
|
useLayoutEffect12(() => {
|
|
4619
4765
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4620
4766
|
}, [tabs, onTabMenu]);
|
|
@@ -4674,7 +4820,7 @@ function KjunTabs({
|
|
|
4674
4820
|
onTouchEnd: clear,
|
|
4675
4821
|
onTouchCancel: clear,
|
|
4676
4822
|
children: [
|
|
4677
|
-
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size:
|
|
4823
|
+
tab.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: tab.icon, size: tokens21.extensions.tabs.iconSize }),
|
|
4678
4824
|
" ",
|
|
4679
4825
|
/* @__PURE__ */ jsx24("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ jsx24("span", { children: tab.label }) }),
|
|
4680
4826
|
tab.badge != null && /* @__PURE__ */ jsx24(
|
|
@@ -4732,12 +4878,30 @@ function KjunAccordionItem({
|
|
|
4732
4878
|
defaultOpen = false,
|
|
4733
4879
|
disabled = false,
|
|
4734
4880
|
header,
|
|
4881
|
+
open: openProp,
|
|
4882
|
+
onOpenChange,
|
|
4883
|
+
keepMounted = false,
|
|
4735
4884
|
children
|
|
4736
4885
|
}) {
|
|
4737
|
-
const
|
|
4738
|
-
|
|
4886
|
+
const controlled = openProp !== void 0, context = useContext13(AccordionContext), group = controlled ? null : context, id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = controlled ? openProp : group ? group.opened.has(id) : own;
|
|
4887
|
+
useEffect16(() => {
|
|
4739
4888
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4740
4889
|
}, []);
|
|
4890
|
+
const reported = useRef24(open), notify = useRef24(onOpenChange), registering = useRef24(!!group && defaultOpen);
|
|
4891
|
+
notify.current = onOpenChange;
|
|
4892
|
+
useEffect16(() => {
|
|
4893
|
+
var _a;
|
|
4894
|
+
if (registering.current) {
|
|
4895
|
+
if (open) {
|
|
4896
|
+
registering.current = false;
|
|
4897
|
+
reported.current = open;
|
|
4898
|
+
}
|
|
4899
|
+
return;
|
|
4900
|
+
}
|
|
4901
|
+
if (controlled || reported.current === open) return;
|
|
4902
|
+
reported.current = open;
|
|
4903
|
+
(_a = notify.current) == null ? void 0 : _a.call(notify, open);
|
|
4904
|
+
}, [open, controlled]);
|
|
4741
4905
|
return /* @__PURE__ */ jsxs16("div", { className: "kjun-accordion-item", children: [
|
|
4742
4906
|
/* @__PURE__ */ jsxs16(
|
|
4743
4907
|
"button",
|
|
@@ -4748,7 +4912,10 @@ function KjunAccordionItem({
|
|
|
4748
4912
|
"aria-expanded": open,
|
|
4749
4913
|
"aria-controls": id + "-panel",
|
|
4750
4914
|
className: "kjun-accordion-trigger",
|
|
4751
|
-
onClick: () =>
|
|
4915
|
+
onClick: () => {
|
|
4916
|
+
registering.current = false;
|
|
4917
|
+
controlled ? onOpenChange == null ? void 0 : onOpenChange(!open) : group ? group.toggle(id) : setOwn(!own);
|
|
4918
|
+
},
|
|
4752
4919
|
children: [
|
|
4753
4920
|
/* @__PURE__ */ jsx24("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4754
4921
|
/* @__PURE__ */ jsx24(
|
|
@@ -4756,14 +4923,14 @@ function KjunAccordionItem({
|
|
|
4756
4923
|
{
|
|
4757
4924
|
name: "chevron-down",
|
|
4758
4925
|
className: "kjun-accordion-chevron",
|
|
4759
|
-
size:
|
|
4926
|
+
size: tokens21.extensions.accordion.iconSize,
|
|
4760
4927
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4761
4928
|
}
|
|
4762
4929
|
)
|
|
4763
4930
|
]
|
|
4764
4931
|
}
|
|
4765
4932
|
),
|
|
4766
|
-
/* @__PURE__ */ jsx24(Collapse, { open, children: /* @__PURE__ */ jsx24(
|
|
4933
|
+
/* @__PURE__ */ jsx24(Collapse, { open, keepMounted, children: /* @__PURE__ */ jsx24(
|
|
4767
4934
|
"div",
|
|
4768
4935
|
{
|
|
4769
4936
|
role: "region",
|
|
@@ -4784,12 +4951,12 @@ function KjunBreadcrumb({
|
|
|
4784
4951
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4785
4952
|
return /* @__PURE__ */ jsx24("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4786
4953
|
const label = /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
4787
|
-
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size:
|
|
4954
|
+
item.icon && /* @__PURE__ */ jsx24(KjunIcon, { name: item.icon, size: tokens21.extensions.breadcrumb.iconSize }),
|
|
4788
4955
|
" ",
|
|
4789
4956
|
item.label
|
|
4790
4957
|
] });
|
|
4791
4958
|
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
4792
|
-
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size:
|
|
4959
|
+
i > 0 && /* @__PURE__ */ jsx24(KjunIcon, { name: "chevron-right", size: tokens21.extensions.breadcrumb.separatorSize }),
|
|
4793
4960
|
" ",
|
|
4794
4961
|
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
4962
|
] }, i);
|
|
@@ -4836,7 +5003,7 @@ function KjunPagination({
|
|
|
4836
5003
|
"aria-label": label,
|
|
4837
5004
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4838
5005
|
onClick: () => change(target),
|
|
4839
|
-
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size:
|
|
5006
|
+
children: /* @__PURE__ */ jsx24(KjunIcon, { name: icon, size: tokens21.extensions.pagination.iconSize })
|
|
4840
5007
|
}
|
|
4841
5008
|
);
|
|
4842
5009
|
return /* @__PURE__ */ jsxs16("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -4889,11 +5056,11 @@ function KjunPagination({
|
|
|
4889
5056
|
}
|
|
4890
5057
|
|
|
4891
5058
|
// packages/react/src/actions.tsx
|
|
4892
|
-
import { tokens as
|
|
5059
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
4893
5060
|
import {
|
|
4894
5061
|
useContext as useContext14,
|
|
4895
|
-
useEffect as
|
|
4896
|
-
useRef as
|
|
5062
|
+
useEffect as useEffect17,
|
|
5063
|
+
useRef as useRef25,
|
|
4897
5064
|
useState as useState21
|
|
4898
5065
|
} from "react";
|
|
4899
5066
|
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -4936,7 +5103,7 @@ function KjunIconToggle({
|
|
|
4936
5103
|
{
|
|
4937
5104
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
4938
5105
|
filled: active,
|
|
4939
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5106
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens22.button.iconSizes[size],
|
|
4940
5107
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4941
5108
|
className: active ? activeColorClass : inactiveColorClass,
|
|
4942
5109
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -4977,8 +5144,8 @@ function KjunCopyButton({
|
|
|
4977
5144
|
const m = useKjunMessages();
|
|
4978
5145
|
successText != null ? successText : successText = m.copied;
|
|
4979
5146
|
const feedback = useOptionalKjunFeedback();
|
|
4980
|
-
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy =
|
|
4981
|
-
|
|
5147
|
+
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef25(false), timer = useRef25(void 0), mounted = useRef25(true);
|
|
5148
|
+
useEffect17(() => {
|
|
4982
5149
|
mounted.current = true;
|
|
4983
5150
|
return () => {
|
|
4984
5151
|
mounted.current = false;
|
|
@@ -4996,9 +5163,9 @@ function KjunCopyButton({
|
|
|
4996
5163
|
"data-inline": inline,
|
|
4997
5164
|
style: {
|
|
4998
5165
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
4999
|
-
minHeight:
|
|
5166
|
+
minHeight: tokens22.button.heights[size],
|
|
5000
5167
|
paddingBlock: 0,
|
|
5001
|
-
paddingInline: { xs:
|
|
5168
|
+
paddingInline: { xs: tokens22.dimension.value4, sm: tokens22.dimension.value8, md: tokens22.dimension.value12 }[size]
|
|
5002
5169
|
},
|
|
5003
5170
|
onClick: async (event) => {
|
|
5004
5171
|
event.stopPropagation();
|
|
@@ -5028,7 +5195,7 @@ function KjunCopyButton({
|
|
|
5028
5195
|
KjunIcon,
|
|
5029
5196
|
{
|
|
5030
5197
|
name: copied ? "check" : "copy",
|
|
5031
|
-
size:
|
|
5198
|
+
size: tokens22.button.iconSizes[size],
|
|
5032
5199
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5033
5200
|
}
|
|
5034
5201
|
),
|
|
@@ -5102,14 +5269,14 @@ function KjunExternalLink({
|
|
|
5102
5269
|
onClick: (e) => e.stopPropagation(),
|
|
5103
5270
|
children: [
|
|
5104
5271
|
body,
|
|
5105
|
-
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size:
|
|
5272
|
+
mode === "text" && /* @__PURE__ */ jsx25(KjunIcon, { name: "external-link", size: tokens22.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5106
5273
|
!name && /* @__PURE__ */ jsx25("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5107
5274
|
]
|
|
5108
5275
|
}
|
|
5109
5276
|
) : /* @__PURE__ */ jsx25("span", { "aria-label": name, children: body });
|
|
5110
5277
|
}
|
|
5111
5278
|
function KjunScrollFade({ children }) {
|
|
5112
|
-
const ref =
|
|
5279
|
+
const ref = useRef25(null), [edges, setEdges] = useState21({ left: false, right: false });
|
|
5113
5280
|
const update = () => {
|
|
5114
5281
|
const el = ref.current;
|
|
5115
5282
|
if (el)
|
|
@@ -5121,7 +5288,7 @@ function KjunScrollFade({ children }) {
|
|
|
5121
5288
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
5122
5289
|
});
|
|
5123
5290
|
};
|
|
5124
|
-
|
|
5291
|
+
useEffect17(() => {
|
|
5125
5292
|
update();
|
|
5126
5293
|
const observer = new ResizeObserver(update);
|
|
5127
5294
|
if (ref.current) {
|
|
@@ -5130,7 +5297,7 @@ function KjunScrollFade({ children }) {
|
|
|
5130
5297
|
}
|
|
5131
5298
|
return () => observer.disconnect();
|
|
5132
5299
|
}, [children]);
|
|
5133
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5300
|
+
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
5301
|
return /* @__PURE__ */ jsx25(
|
|
5135
5302
|
"div",
|
|
5136
5303
|
{
|
|
@@ -5145,7 +5312,7 @@ function KjunScrollFade({ children }) {
|
|
|
5145
5312
|
|
|
5146
5313
|
// packages/react/src/data-state.tsx
|
|
5147
5314
|
import {
|
|
5148
|
-
tokens as
|
|
5315
|
+
tokens as tokens23,
|
|
5149
5316
|
advanceQueryDisplay,
|
|
5150
5317
|
initialQueryDisplay,
|
|
5151
5318
|
queryDisplayStatus
|
|
@@ -5153,10 +5320,10 @@ import {
|
|
|
5153
5320
|
import { Component, useState as useState23 } from "react";
|
|
5154
5321
|
|
|
5155
5322
|
// shared/package-runtime/use-loading-reveal.ts
|
|
5156
|
-
import { useEffect as
|
|
5323
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
5157
5324
|
function useLoadingReveal(active, delay = 0) {
|
|
5158
5325
|
const [revealed, setRevealed] = useState22(false);
|
|
5159
|
-
|
|
5326
|
+
useEffect18(() => {
|
|
5160
5327
|
setRevealed(false);
|
|
5161
5328
|
if (!active || delay <= 0) return;
|
|
5162
5329
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -5207,7 +5374,7 @@ function KjunDataState({
|
|
|
5207
5374
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5208
5375
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5209
5376
|
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 =
|
|
5377
|
+
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = tokens23.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5211
5378
|
return /* @__PURE__ */ jsxs18("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5212
5379
|
/* @__PURE__ */ jsx26("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ jsxs18("div", { className: "kjun-data-status", role: "status", children: [
|
|
5213
5380
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "xs" }),
|
|
@@ -5221,7 +5388,7 @@ function KjunDataState({
|
|
|
5221
5388
|
"aria-label": revealed ? loadingText : void 0,
|
|
5222
5389
|
"aria-hidden": revealed ? void 0 : true,
|
|
5223
5390
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5224
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx26("div", { style: { display: "grid", gap:
|
|
5391
|
+
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
5392
|
/* @__PURE__ */ jsx26(KjunSpinner, { size: "md" }),
|
|
5226
5393
|
/* @__PURE__ */ jsx26("p", { children: loadingText })
|
|
5227
5394
|
] }))
|
|
@@ -5234,7 +5401,7 @@ function KjunDataState({
|
|
|
5234
5401
|
"aria-hidden": concealed || void 0,
|
|
5235
5402
|
inert: concealed || void 0,
|
|
5236
5403
|
style: {
|
|
5237
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5404
|
+
opacity: query2.loading && !state.usesQueryState ? tokens23.states.opacity.pending : void 0
|
|
5238
5405
|
},
|
|
5239
5406
|
children
|
|
5240
5407
|
},
|
|
@@ -5276,7 +5443,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
5276
5443
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5277
5444
|
|
|
5278
5445
|
// packages/react/src/skeletons.tsx
|
|
5279
|
-
import { tokens as
|
|
5446
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
5280
5447
|
|
|
5281
5448
|
// shared/package-runtime/chart-skeleton.ts
|
|
5282
5449
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5293,11 +5460,11 @@ function chartSkeletonKind(kind) {
|
|
|
5293
5460
|
}
|
|
5294
5461
|
|
|
5295
5462
|
// packages/react/src/market-skeleton.tsx
|
|
5296
|
-
import { tokens as
|
|
5463
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
5297
5464
|
|
|
5298
5465
|
// shared/package-runtime/market-layout.ts
|
|
5299
|
-
import { tokens as
|
|
5300
|
-
var marketGeometry =
|
|
5466
|
+
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
5467
|
+
var marketGeometry = tokens24.extensions.marketTable;
|
|
5301
5468
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5302
5469
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5303
5470
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5338,15 +5505,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5338
5505
|
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
5506
|
/* @__PURE__ */ jsx28(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5340
5507
|
/* @__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:
|
|
5508
|
+
showActions && /* @__PURE__ */ jsx28("th", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens25.extensions.marketTable.actionSkeletonWidth, height: tokens25.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5342
5509
|
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
5510
|
] }) }),
|
|
5344
5511
|
/* @__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:
|
|
5512
|
+
showActions && /* @__PURE__ */ jsx28("td", { className: "kjun-market-actions", children: /* @__PURE__ */ jsx28("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: tokens25.extensions.marketTable.actionSkeletonWidth, height: tokens25.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5346
5513
|
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:
|
|
5514
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "80%", height: tokens25.extensions.skeleton.lineHeights.md }),
|
|
5515
|
+
/* @__PURE__ */ jsx28(KjunSkeleton, { type: "block", width: "60%", height: tokens25.extensions.skeleton.lineHeights.sm })
|
|
5516
|
+
] }) : /* @__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
5517
|
] }, row)) })
|
|
5351
5518
|
] }) });
|
|
5352
5519
|
}
|
|
@@ -5357,7 +5524,7 @@ function KjunListSkeleton({
|
|
|
5357
5524
|
rows = 8,
|
|
5358
5525
|
variant = "market",
|
|
5359
5526
|
avatar = true,
|
|
5360
|
-
avatarSize =
|
|
5527
|
+
avatarSize = tokens26.extensions.skeleton.listAvatarSize,
|
|
5361
5528
|
quote = true
|
|
5362
5529
|
}) {
|
|
5363
5530
|
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 +5534,15 @@ function KjunListSkeleton({
|
|
|
5367
5534
|
KjunSkeleton,
|
|
5368
5535
|
{
|
|
5369
5536
|
type: "block",
|
|
5370
|
-
height:
|
|
5537
|
+
height: tokens26.extensions.skeleton.lineHeights.md,
|
|
5371
5538
|
width: i % 2 ? "80%" : "65%"
|
|
5372
5539
|
}
|
|
5373
5540
|
),
|
|
5374
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5541
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5375
5542
|
] }),
|
|
5376
5543
|
quote && /* @__PURE__ */ jsxs21("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5377
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5378
|
-
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height:
|
|
5544
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.quoteHeight, width: tokens26.extensions.skeleton.quoteWidth }),
|
|
5545
|
+
/* @__PURE__ */ jsx29(KjunSkeleton, { type: "block", height: tokens26.extensions.skeleton.lineHeights.sm, width: tokens26.extensions.skeleton.detailWidth })
|
|
5379
5546
|
] })
|
|
5380
5547
|
] }, i)) });
|
|
5381
5548
|
}
|
|
@@ -5391,17 +5558,17 @@ function KjunFormSkeleton({
|
|
|
5391
5558
|
"aria-hidden": "true",
|
|
5392
5559
|
className: "kjun-form-skeleton",
|
|
5393
5560
|
"data-columns": columns,
|
|
5394
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5561
|
+
style: { "--_kjun-form-skeleton-radius": `${tokens26.input[size].radius}px` },
|
|
5395
5562
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs21("div", { children: [
|
|
5396
5563
|
field ? /* @__PURE__ */ jsx29("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5397
5564
|
// 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:
|
|
5565
|
+
/* @__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
5566
|
),
|
|
5400
5567
|
/* @__PURE__ */ jsx29(
|
|
5401
5568
|
KjunSkeleton,
|
|
5402
5569
|
{
|
|
5403
5570
|
type: "block",
|
|
5404
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5571
|
+
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
5572
|
}
|
|
5406
5573
|
)
|
|
5407
5574
|
] }, i))
|
|
@@ -5410,7 +5577,7 @@ function KjunFormSkeleton({
|
|
|
5410
5577
|
}
|
|
5411
5578
|
function KjunChartSkeleton({
|
|
5412
5579
|
kind: requestedKind = "frame",
|
|
5413
|
-
height =
|
|
5580
|
+
height = tokens26.extensions.chartSkeleton.height,
|
|
5414
5581
|
loadingText,
|
|
5415
5582
|
skeleton = true,
|
|
5416
5583
|
loadingDelay = 0,
|
|
@@ -5466,7 +5633,7 @@ function KjunChartSkeleton({
|
|
|
5466
5633
|
d: chartFramePath,
|
|
5467
5634
|
fill: "none",
|
|
5468
5635
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5469
|
-
strokeWidth:
|
|
5636
|
+
strokeWidth: tokens26.border.defaultWidth,
|
|
5470
5637
|
vectorEffect: "non-scaling-stroke"
|
|
5471
5638
|
}
|
|
5472
5639
|
)
|
|
@@ -5479,19 +5646,19 @@ function KjunChartSkeleton({
|
|
|
5479
5646
|
}
|
|
5480
5647
|
|
|
5481
5648
|
// packages/react/src/financial-display.tsx
|
|
5482
|
-
import { deviationLevel, tokens as
|
|
5649
|
+
import { deviationLevel, tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5483
5650
|
import {
|
|
5484
5651
|
useId as useId11
|
|
5485
5652
|
} from "react";
|
|
5486
5653
|
|
|
5487
5654
|
// packages/react/src/number-display.tsx
|
|
5488
|
-
import { tokens as
|
|
5655
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5489
5656
|
|
|
5490
5657
|
// shared/package-runtime/use-number-motion.ts
|
|
5491
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
5658
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef26, useState as useState24 } from "react";
|
|
5492
5659
|
|
|
5493
5660
|
// shared/package-runtime/number-motion.ts
|
|
5494
|
-
import { tokens as
|
|
5661
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
5495
5662
|
function createNumberMotion(apply) {
|
|
5496
5663
|
let frame = 0, revision = 0, current = 0;
|
|
5497
5664
|
let previous;
|
|
@@ -5522,7 +5689,7 @@ function createNumberMotion(apply) {
|
|
|
5522
5689
|
if (from === target) return;
|
|
5523
5690
|
const tick = (now) => {
|
|
5524
5691
|
if (version !== revision) return;
|
|
5525
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5692
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens27.motion.number));
|
|
5526
5693
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5527
5694
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5528
5695
|
};
|
|
@@ -5535,7 +5702,7 @@ function createNumberMotion(apply) {
|
|
|
5535
5702
|
// shared/package-runtime/use-number-motion.ts
|
|
5536
5703
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5537
5704
|
const [display, setDisplay] = useState24(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5538
|
-
const motion =
|
|
5705
|
+
const motion = useRef26(null);
|
|
5539
5706
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5540
5707
|
useLayoutEffect13(() => {
|
|
5541
5708
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
@@ -5601,7 +5768,7 @@ function KjunPriceCell({
|
|
|
5601
5768
|
flashClass = "",
|
|
5602
5769
|
fromPrevious = true
|
|
5603
5770
|
}) {
|
|
5604
|
-
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height:
|
|
5771
|
+
return value == null ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", height: tokens28.extensions.financial.priceSkeletonHeight, width: tokens28.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs22(Fragment11, { children: [
|
|
5605
5772
|
/* @__PURE__ */ jsx30(
|
|
5606
5773
|
"span",
|
|
5607
5774
|
{
|
|
@@ -5649,7 +5816,7 @@ function KjunSignedValue({
|
|
|
5649
5816
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5650
5817
|
},
|
|
5651
5818
|
children: [
|
|
5652
|
-
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width:
|
|
5819
|
+
loading ? /* @__PURE__ */ jsx30(KjunSkeleton, { type: "block", width: tokens28.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5653
5820
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ jsx30(KjunFreshness, { stale: true })
|
|
5654
5821
|
]
|
|
5655
5822
|
}
|
|
@@ -5658,7 +5825,7 @@ function KjunSignedValue({
|
|
|
5658
5825
|
|
|
5659
5826
|
// packages/react/src/financial-display.tsx
|
|
5660
5827
|
import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5661
|
-
var deviationFill = { neutral: 1, low:
|
|
5828
|
+
var deviationFill = { neutral: 1, low: tokens29.states.opacity.deviationLow, medium: tokens29.states.opacity.deviationMedium, strong: tokens29.states.opacity.deviationStrong };
|
|
5662
5829
|
function KjunDeviation({
|
|
5663
5830
|
value,
|
|
5664
5831
|
variant = "pill",
|
|
@@ -5690,7 +5857,7 @@ function KjunDeviation({
|
|
|
5690
5857
|
KjunIcon,
|
|
5691
5858
|
{
|
|
5692
5859
|
name: "alert-triangle",
|
|
5693
|
-
size:
|
|
5860
|
+
size: tokens29.extensions.financial.warningIconSize,
|
|
5694
5861
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5695
5862
|
}
|
|
5696
5863
|
) })
|
|
@@ -5703,7 +5870,7 @@ function KjunDeviation({
|
|
|
5703
5870
|
className: "kjun-deviation",
|
|
5704
5871
|
ref: domainColorRef(!neutral),
|
|
5705
5872
|
"data-variant": variant,
|
|
5706
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
5873
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? tokens29.typography.numberLg.fontWeight : tokens29.typography.control.fontWeight },
|
|
5707
5874
|
children: [
|
|
5708
5875
|
variant === "pill" && /* @__PURE__ */ jsx31(
|
|
5709
5876
|
"span",
|
|
@@ -5731,7 +5898,7 @@ function KjunHeatmapCell({
|
|
|
5731
5898
|
}) {
|
|
5732
5899
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5733
5900
|
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 } =
|
|
5901
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = tokens29.states.opacity;
|
|
5735
5902
|
return /* @__PURE__ */ jsxs23("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5736
5903
|
/* @__PURE__ */ jsx31(
|
|
5737
5904
|
"span",
|
|
@@ -5750,7 +5917,7 @@ function KjunProgressCell({
|
|
|
5750
5917
|
showLabel = true,
|
|
5751
5918
|
color = "auto",
|
|
5752
5919
|
customColor,
|
|
5753
|
-
height =
|
|
5920
|
+
height = tokens29.extensions.financial.progressHeight
|
|
5754
5921
|
}) {
|
|
5755
5922
|
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
5923
|
return /* @__PURE__ */ jsxs23("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5774,7 +5941,7 @@ function KjunCollectionMark({
|
|
|
5774
5941
|
active = false,
|
|
5775
5942
|
size = "md"
|
|
5776
5943
|
}) {
|
|
5777
|
-
const box =
|
|
5944
|
+
const box = tokens29.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens29.extensions.financial.heartMarkSizes[size] : box;
|
|
5778
5945
|
return /* @__PURE__ */ jsx31(
|
|
5779
5946
|
KjunIcon,
|
|
5780
5947
|
{
|
|
@@ -5810,8 +5977,8 @@ function KjunExecutionStatusBadge({
|
|
|
5810
5977
|
}
|
|
5811
5978
|
function KjunSparkline({
|
|
5812
5979
|
data = [],
|
|
5813
|
-
width =
|
|
5814
|
-
height =
|
|
5980
|
+
width = tokens29.extensions.financial.sparklineWidth,
|
|
5981
|
+
height = tokens29.extensions.financial.sparklineHeight,
|
|
5815
5982
|
color,
|
|
5816
5983
|
semantic = "price",
|
|
5817
5984
|
fill = true,
|
|
@@ -5867,7 +6034,7 @@ function KjunSparkline({
|
|
|
5867
6034
|
|
|
5868
6035
|
// shared/package-runtime/table.ts
|
|
5869
6036
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
5870
|
-
import { useEffect as
|
|
6037
|
+
import { useEffect as useEffect19, useRef as useRef27, useState as useState25 } from "react";
|
|
5871
6038
|
|
|
5872
6039
|
// shared/package-runtime/table-model.ts
|
|
5873
6040
|
function getValue(row, key) {
|
|
@@ -5914,8 +6081,8 @@ function useTableModel(props) {
|
|
|
5914
6081
|
const [internalSort, setSort] = useState25({
|
|
5915
6082
|
key: "",
|
|
5916
6083
|
order: "asc"
|
|
5917
|
-
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer =
|
|
5918
|
-
|
|
6084
|
+
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef27(void 0);
|
|
6085
|
+
useEffect19(() => () => clearTimeout(timer.current), []);
|
|
5919
6086
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5920
6087
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5921
6088
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -6004,7 +6171,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6004
6171
|
}
|
|
6005
6172
|
|
|
6006
6173
|
// packages/react/src/table-toolbar.tsx
|
|
6007
|
-
import { tokens as
|
|
6174
|
+
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
6008
6175
|
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6009
6176
|
function TableToolbar({
|
|
6010
6177
|
selectable,
|
|
@@ -6047,7 +6214,7 @@ function TableToolbar({
|
|
|
6047
6214
|
KjunInput,
|
|
6048
6215
|
{
|
|
6049
6216
|
size: "sm",
|
|
6050
|
-
style: { width:
|
|
6217
|
+
style: { width: tokens30.table.searchWidth, maxWidth: "100%" },
|
|
6051
6218
|
value: search,
|
|
6052
6219
|
ariaLabel: m.searchTable,
|
|
6053
6220
|
placeholder: searchPlaceholder,
|
|
@@ -6063,7 +6230,7 @@ function TableToolbar({
|
|
|
6063
6230
|
}
|
|
6064
6231
|
|
|
6065
6232
|
// packages/react/src/table-grid.tsx
|
|
6066
|
-
import { tokens as
|
|
6233
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
6067
6234
|
import { Fragment as Fragment14 } from "react";
|
|
6068
6235
|
|
|
6069
6236
|
// packages/react/src/table-check.tsx
|
|
@@ -6074,11 +6241,11 @@ import minus from "@kjun-ui/icons/icons/minus";
|
|
|
6074
6241
|
var componentIcons = { minus };
|
|
6075
6242
|
|
|
6076
6243
|
// packages/react/src/table-check.tsx
|
|
6077
|
-
import { tokens as
|
|
6244
|
+
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
6078
6245
|
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6079
6246
|
var TableCheck = forwardRef4(
|
|
6080
6247
|
function TableCheck2(props, ref) {
|
|
6081
|
-
const size =
|
|
6248
|
+
const size = tokens31.extensions.checkbox.iconSizes.sm;
|
|
6082
6249
|
return /* @__PURE__ */ jsx33(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs25("span", { className: "kjun-table-check", children: [
|
|
6083
6250
|
/* @__PURE__ */ jsx33("input", { ...props, ref, type: "checkbox" }),
|
|
6084
6251
|
/* @__PURE__ */ jsx33(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6135,7 +6302,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6135
6302
|
KjunIcon,
|
|
6136
6303
|
{
|
|
6137
6304
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6138
|
-
size:
|
|
6305
|
+
size: tokens32.table.sortIconSize
|
|
6139
6306
|
}
|
|
6140
6307
|
)
|
|
6141
6308
|
]
|
|
@@ -6148,14 +6315,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6148
6315
|
}
|
|
6149
6316
|
),
|
|
6150
6317
|
/* @__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:
|
|
6318
|
+
selectable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ jsx34(KjunSkeleton, { type: "block", height: tokens32.table.selectionSize, width: tokens32.table.selectionSize }) }),
|
|
6152
6319
|
expandable && /* @__PURE__ */ jsx34("td", { className: "kjun-table-action-cell" }),
|
|
6153
6320
|
visible.map((col) => /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(
|
|
6154
6321
|
KjunSkeleton,
|
|
6155
6322
|
{
|
|
6156
6323
|
type: "block",
|
|
6157
|
-
height:
|
|
6158
|
-
width: col.key === "actions" ?
|
|
6324
|
+
height: tokens32.table.skeletonHeight,
|
|
6325
|
+
width: col.key === "actions" ? tokens32.table.actionColumnWidth : "75%"
|
|
6159
6326
|
}
|
|
6160
6327
|
) }, col.key))
|
|
6161
6328
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
@@ -6309,8 +6476,8 @@ function TableCards({
|
|
|
6309
6476
|
}
|
|
6310
6477
|
|
|
6311
6478
|
// packages/react/src/table-view.tsx
|
|
6312
|
-
import { useEffect as
|
|
6313
|
-
import { isComposingKey as isComposingKey4, tokens as
|
|
6479
|
+
import { useEffect as useEffect20, useState as useState26 } from "react";
|
|
6480
|
+
import { isComposingKey as isComposingKey4, tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6314
6481
|
import { jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6315
6482
|
function KjunTable(props) {
|
|
6316
6483
|
const m = useKjunMessages();
|
|
@@ -6341,8 +6508,8 @@ function KjunTable(props) {
|
|
|
6341
6508
|
onRetry
|
|
6342
6509
|
} = props;
|
|
6343
6510
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
6344
|
-
|
|
6345
|
-
const media = matchMedia(`(width < ${
|
|
6511
|
+
useEffect20(() => {
|
|
6512
|
+
const media = matchMedia(`(width < ${tokens33.table.mobileBreakpoint}px)`);
|
|
6346
6513
|
const update = () => setMobile(media.matches);
|
|
6347
6514
|
update();
|
|
6348
6515
|
media.addEventListener("change", update);
|
|
@@ -6446,7 +6613,7 @@ function KjunTable(props) {
|
|
|
6446
6613
|
}
|
|
6447
6614
|
|
|
6448
6615
|
// packages/react/src/kpi.tsx
|
|
6449
|
-
import { tokens as
|
|
6616
|
+
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6450
6617
|
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6451
6618
|
var kpiFormat = (item, value = item.value) => {
|
|
6452
6619
|
var _a, _b;
|
|
@@ -6514,7 +6681,7 @@ function KjunKpiHero(props) {
|
|
|
6514
6681
|
] }) }),
|
|
6515
6682
|
showDelta && /* @__PURE__ */ jsx37("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6516
6683
|
// 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:
|
|
6684
|
+
/* @__PURE__ */ jsx37("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx37(KjunSkeleton, { type: "block", height: "1lh", width: tokens34.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6518
6685
|
) : /* @__PURE__ */ jsxs29(Fragment15, { children: [
|
|
6519
6686
|
deltaAbsolute !== null && /* @__PURE__ */ jsx37(
|
|
6520
6687
|
"span",
|
|
@@ -6646,7 +6813,7 @@ function KjunKpiRow({
|
|
|
6646
6813
|
},
|
|
6647
6814
|
children: [
|
|
6648
6815
|
/* @__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:
|
|
6816
|
+
/* @__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
6817
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6651
6818
|
] }),
|
|
6652
6819
|
/* @__PURE__ */ jsxs29("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6704,10 +6871,10 @@ function KjunKpiRow({
|
|
|
6704
6871
|
}
|
|
6705
6872
|
|
|
6706
6873
|
// packages/react/src/market-cards.tsx
|
|
6707
|
-
import { tokens as
|
|
6874
|
+
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6708
6875
|
|
|
6709
6876
|
// shared/package-runtime/market-cards.ts
|
|
6710
|
-
import { useEffect as
|
|
6877
|
+
import { useEffect as useEffect21, useRef as useRef28, useState as useState27 } from "react";
|
|
6711
6878
|
function useMarketCardsModel(props, persistence) {
|
|
6712
6879
|
const {
|
|
6713
6880
|
columns,
|
|
@@ -6724,7 +6891,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6724
6891
|
isDefaultSort: c.defaultSort
|
|
6725
6892
|
}));
|
|
6726
6893
|
const [key, setKey] = useState27(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6727
|
-
const mounted =
|
|
6894
|
+
const mounted = useRef28("");
|
|
6728
6895
|
const save = (key2) => {
|
|
6729
6896
|
var _a;
|
|
6730
6897
|
try {
|
|
@@ -6732,7 +6899,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6732
6899
|
} catch (e) {
|
|
6733
6900
|
}
|
|
6734
6901
|
};
|
|
6735
|
-
|
|
6902
|
+
useEffect21(() => {
|
|
6736
6903
|
var _a, _b;
|
|
6737
6904
|
if (mounted.current === restoreSignature) return;
|
|
6738
6905
|
mounted.current = restoreSignature;
|
|
@@ -6912,10 +7079,10 @@ function KjunMarketCards(props) {
|
|
|
6912
7079
|
KjunSparkline,
|
|
6913
7080
|
{
|
|
6914
7081
|
data: getValue(row, state.key) || [],
|
|
6915
|
-
width:
|
|
6916
|
-
height:
|
|
7082
|
+
width: tokens35.extensions.marketTable.sparklineWidth,
|
|
7083
|
+
height: tokens35.extensions.marketTable.sparklineHeight
|
|
6917
7084
|
}
|
|
6918
|
-
) : state.pill ? /* @__PURE__ */ jsx39(Fragment17, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height:
|
|
7085
|
+
) : 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
7086
|
KjunSignedValue,
|
|
6920
7087
|
{
|
|
6921
7088
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6923,7 +7090,7 @@ function KjunMarketCards(props) {
|
|
|
6923
7090
|
stale: !!getValue(row, "stale"),
|
|
6924
7091
|
tone: "pill"
|
|
6925
7092
|
}
|
|
6926
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx39(KjunSkeleton, { type: "block", height:
|
|
7093
|
+
) : 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
7094
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6928
7095
|
props,
|
|
6929
7096
|
row,
|
|
@@ -6946,7 +7113,7 @@ function KjunMarketCards(props) {
|
|
|
6946
7113
|
}
|
|
6947
7114
|
|
|
6948
7115
|
// packages/react/src/market-list.tsx
|
|
6949
|
-
import { tokens as
|
|
7116
|
+
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6950
7117
|
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6951
7118
|
function KjunMarketSimpleList(props) {
|
|
6952
7119
|
const m = useKjunMessages();
|
|
@@ -7013,7 +7180,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7013
7180
|
fetchedAt
|
|
7014
7181
|
}
|
|
7015
7182
|
)),
|
|
7016
|
-
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height:
|
|
7183
|
+
changeLoading(row) ? /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", height: tokens36.extensions.marketList.changeSkeletonHeight, width: tokens36.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx40(
|
|
7017
7184
|
KjunSignedValue,
|
|
7018
7185
|
{
|
|
7019
7186
|
value: change,
|
|
@@ -7037,7 +7204,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7037
7204
|
}
|
|
7038
7205
|
|
|
7039
7206
|
// packages/react/src/market-panel.tsx
|
|
7040
|
-
import { tokens as
|
|
7207
|
+
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
7041
7208
|
import { jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7042
7209
|
function KjunMarketListPanel({
|
|
7043
7210
|
controls,
|
|
@@ -7045,12 +7212,12 @@ function KjunMarketListPanel({
|
|
|
7045
7212
|
}) {
|
|
7046
7213
|
return /* @__PURE__ */ jsxs33(KjunCard, { children: [
|
|
7047
7214
|
/* @__PURE__ */ jsx41("div", { children: controls }),
|
|
7048
|
-
/* @__PURE__ */ jsx41("div", { style: { marginTop:
|
|
7215
|
+
/* @__PURE__ */ jsx41("div", { style: { marginTop: tokens37.dimension.value16, borderTop: `${tokens37.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7049
7216
|
] });
|
|
7050
7217
|
}
|
|
7051
7218
|
|
|
7052
7219
|
// packages/react/src/market-table.tsx
|
|
7053
|
-
import { tokens as
|
|
7220
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7054
7221
|
|
|
7055
7222
|
// shared/package-runtime/trailing-overflow.ts
|
|
7056
7223
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7067,7 +7234,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7067
7234
|
}
|
|
7068
7235
|
|
|
7069
7236
|
// packages/react/src/market-table.tsx
|
|
7070
|
-
import { useEffect as
|
|
7237
|
+
import { useEffect as useEffect22, useRef as useRef29, useState as useState28 } from "react";
|
|
7071
7238
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7072
7239
|
function KjunMarketTable(props) {
|
|
7073
7240
|
const m = useKjunMessages();
|
|
@@ -7089,12 +7256,12 @@ function KjunMarketTable(props) {
|
|
|
7089
7256
|
formatMetric,
|
|
7090
7257
|
renderCell
|
|
7091
7258
|
} = props;
|
|
7092
|
-
const scroller =
|
|
7093
|
-
|
|
7259
|
+
const scroller = useRef29(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
7260
|
+
useEffect22(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7094
7261
|
const render = (row, col) => {
|
|
7095
7262
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7096
7263
|
if (cellLoading(row, col))
|
|
7097
|
-
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7264
|
+
return /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens38.extensions.marketTable.valueSkeletonHeight, width: tokens38.extensions.marketTable.valueSkeletonWidth });
|
|
7098
7265
|
if (renderCell) return renderCell(row, col);
|
|
7099
7266
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7100
7267
|
return /* @__PURE__ */ jsx42(MarketIdentity, { row, props });
|
|
@@ -7103,8 +7270,8 @@ function KjunMarketTable(props) {
|
|
|
7103
7270
|
KjunSparkline,
|
|
7104
7271
|
{
|
|
7105
7272
|
data: Array.isArray(value) ? value : [],
|
|
7106
|
-
width:
|
|
7107
|
-
height:
|
|
7273
|
+
width: tokens38.extensions.marketTable.sparklineWidth,
|
|
7274
|
+
height: tokens38.extensions.marketTable.sparklineHeight
|
|
7108
7275
|
}
|
|
7109
7276
|
);
|
|
7110
7277
|
if (col.type === "price")
|
|
@@ -7186,7 +7353,7 @@ function KjunMarketTable(props) {
|
|
|
7186
7353
|
KjunIcon,
|
|
7187
7354
|
{
|
|
7188
7355
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7189
|
-
size:
|
|
7356
|
+
size: tokens38.extensions.marketTable.sortIconSize
|
|
7190
7357
|
}
|
|
7191
7358
|
)
|
|
7192
7359
|
]
|
|
@@ -7246,7 +7413,7 @@ function KjunMarketTable(props) {
|
|
|
7246
7413
|
{
|
|
7247
7414
|
style: {
|
|
7248
7415
|
textAlign: col.align,
|
|
7249
|
-
fontWeight: col.weight === "bold" ?
|
|
7416
|
+
fontWeight: col.weight === "bold" ? tokens38.typography.control.fontWeight : void 0
|
|
7250
7417
|
},
|
|
7251
7418
|
children: [
|
|
7252
7419
|
render(row, col),
|
|
@@ -7279,26 +7446,33 @@ function KjunMarketTable(props) {
|
|
|
7279
7446
|
}
|
|
7280
7447
|
|
|
7281
7448
|
// packages/react/src/list.tsx
|
|
7282
|
-
import {
|
|
7449
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7450
|
+
import { useEffect as useEffect23, useId as useId12, useRef as useRef30 } from "react";
|
|
7283
7451
|
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 }) {
|
|
7452
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7453
|
+
const content = useRef30(null), pressable = !!(href || onClick);
|
|
7454
|
+
useEffect23(() => {
|
|
7455
|
+
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7456
|
+
}, [pressable]);
|
|
7285
7457
|
const contents = /* @__PURE__ */ jsxs35(Fragment18, { children: [
|
|
7286
7458
|
leading && /* @__PURE__ */ jsx43("span", { className: "kjun-list-leading", children: leading }),
|
|
7287
7459
|
/* @__PURE__ */ jsxs35("span", { className: "kjun-list-body", children: [
|
|
7288
7460
|
/* @__PURE__ */ jsx43("span", { className: "kjun-list-title", children: title }),
|
|
7289
|
-
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description })
|
|
7461
|
+
description && /* @__PURE__ */ jsx43("span", { className: "kjun-list-description", children: description }),
|
|
7462
|
+
hasContent(children) && /* @__PURE__ */ jsx43("span", { ref: content, className: "kjun-list-content", children })
|
|
7290
7463
|
] }),
|
|
7291
|
-
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing })
|
|
7464
|
+
trailing && /* @__PURE__ */ jsx43("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7465
|
+
chevron && /* @__PURE__ */ jsx43(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: tokens39.iconSizes.default })
|
|
7292
7466
|
] });
|
|
7293
|
-
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: [
|
|
7467
|
+
const main = href ? /* @__PURE__ */ jsx43("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-label": ariaLabel, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx43("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ jsx43("div", { className: "kjun-list-main", children: contents });
|
|
7468
|
+
return /* @__PURE__ */ jsxs35("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7295
7469
|
main,
|
|
7296
7470
|
actions && /* @__PURE__ */ jsx43("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7297
7471
|
] });
|
|
7298
7472
|
}
|
|
7299
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
7473
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7300
7474
|
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: [
|
|
7475
|
+
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
7476
|
(title || description || actions) && /* @__PURE__ */ jsxs35("div", { className: "kjun-list-heading", children: [
|
|
7303
7477
|
/* @__PURE__ */ jsxs35("div", { children: [
|
|
7304
7478
|
title && /* @__PURE__ */ jsx43("h3", { id, children: title }),
|
|
@@ -7309,12 +7483,15 @@ function KjunListSection({ title, description, actions, children, ariaLabel, div
|
|
|
7309
7483
|
/* @__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
7484
|
] });
|
|
7311
7485
|
}
|
|
7486
|
+
function KjunListItem({ children }) {
|
|
7487
|
+
return /* @__PURE__ */ jsx43("li", { className: "kjun-list-item", children });
|
|
7488
|
+
}
|
|
7312
7489
|
|
|
7313
7490
|
// packages/react/src/app-navigation.tsx
|
|
7314
|
-
import { tokens as
|
|
7491
|
+
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
7315
7492
|
import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7316
7493
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7317
|
-
return /* @__PURE__ */ jsx44(TopNavigationContext.Provider, { value:
|
|
7494
|
+
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
7495
|
leading && /* @__PURE__ */ jsx44("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7319
7496
|
/* @__PURE__ */ jsxs36("div", { className: "kjun-navigation-title", children: [
|
|
7320
7497
|
/* @__PURE__ */ jsx44("strong", { children: title }),
|
|
@@ -7335,7 +7512,7 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7335
7512
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7336
7513
|
}, children: [
|
|
7337
7514
|
hasIcons && /* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-icon", children: [
|
|
7338
|
-
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size:
|
|
7515
|
+
item.icon && /* @__PURE__ */ jsx44(KjunIcon, { name: item.icon, size: tokens40.extensions.bottomNavigation.iconSize }),
|
|
7339
7516
|
badge
|
|
7340
7517
|
] }),
|
|
7341
7518
|
/* @__PURE__ */ jsxs36("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7347,18 +7524,18 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7347
7524
|
}
|
|
7348
7525
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7349
7526
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7350
|
-
return /* @__PURE__ */ jsx44("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7527
|
+
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
7528
|
description && /* @__PURE__ */ jsx44("p", { children: description }),
|
|
7352
7529
|
/* @__PURE__ */ jsx44("div", { className: "kjun-navigation-actions", children })
|
|
7353
7530
|
] }) });
|
|
7354
7531
|
}
|
|
7355
7532
|
|
|
7356
7533
|
// packages/react/src/media.tsx
|
|
7357
|
-
import { useRef as
|
|
7358
|
-
import { tokens as
|
|
7534
|
+
import { useRef as useRef31, useState as useState29 } from "react";
|
|
7535
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7359
7536
|
import { jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
7360
7537
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7361
|
-
const current =
|
|
7538
|
+
const current = useRef31({ src, version: 0 });
|
|
7362
7539
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7363
7540
|
const version = current.current.version;
|
|
7364
7541
|
const [result, setResult] = useState29({ version, state: "loading" });
|
|
@@ -7374,28 +7551,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7374
7551
|
setResult({ version, state: "error" });
|
|
7375
7552
|
onError == null ? void 0 : onError();
|
|
7376
7553
|
} }, 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:
|
|
7554
|
+
failed && /* @__PURE__ */ jsx45("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ jsx45(KjunIcon, { name: "image", size: tokens41.extensions.image.fallbackIconSize }) })
|
|
7378
7555
|
] });
|
|
7379
7556
|
}
|
|
7380
|
-
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
7557
|
+
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7381
7558
|
const m = useKjunMessages();
|
|
7382
|
-
return /* @__PURE__ */ jsx45("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7559
|
+
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
7560
|
}
|
|
7384
7561
|
|
|
7385
7562
|
// packages/react/src/chip.tsx
|
|
7386
|
-
import { tokens as
|
|
7563
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7387
7564
|
import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7388
7565
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7389
7566
|
const m = useKjunMessages();
|
|
7390
7567
|
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:
|
|
7568
|
+
icon && /* @__PURE__ */ jsx46(KjunIcon, { name: icon, size: tokens42.extensions.chip.iconSizes[size] }),
|
|
7392
7569
|
/* @__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:
|
|
7570
|
+
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
7571
|
] });
|
|
7395
7572
|
}
|
|
7396
7573
|
|
|
7397
7574
|
// packages/react/src/fab.tsx
|
|
7398
|
-
import { tokens as
|
|
7575
|
+
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7399
7576
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7400
7577
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7401
7578
|
return /* @__PURE__ */ jsx47(
|
|
@@ -7406,14 +7583,14 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7406
7583
|
"aria-label": ariaLabel,
|
|
7407
7584
|
disabled,
|
|
7408
7585
|
onClick,
|
|
7409
|
-
style: { bottom:
|
|
7410
|
-
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size:
|
|
7586
|
+
style: { bottom: tokens43.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7587
|
+
children: /* @__PURE__ */ jsx47(KjunIcon, { name: icon, size: tokens43.extensions.fab.iconSize })
|
|
7411
7588
|
}
|
|
7412
7589
|
);
|
|
7413
7590
|
}
|
|
7414
7591
|
|
|
7415
7592
|
// packages/react/src/range-input.tsx
|
|
7416
|
-
import { useEffect as
|
|
7593
|
+
import { useEffect as useEffect24, useRef as useRef32 } from "react";
|
|
7417
7594
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
7418
7595
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
7419
7596
|
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -7423,10 +7600,10 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7423
7600
|
const domain = createSliderDomain(min, max, step);
|
|
7424
7601
|
const list = Array.isArray(value) ? value : [value];
|
|
7425
7602
|
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 =
|
|
7603
|
+
const latest = useRef32(value);
|
|
7427
7604
|
latest.current = value;
|
|
7428
|
-
const active =
|
|
7429
|
-
|
|
7605
|
+
const active = useRef32(false);
|
|
7606
|
+
useEffect24(() => {
|
|
7430
7607
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7431
7608
|
}, [valid]);
|
|
7432
7609
|
const change = (next) => {
|
|
@@ -7463,24 +7640,24 @@ function KjunRangeSlider(props) {
|
|
|
7463
7640
|
}
|
|
7464
7641
|
|
|
7465
7642
|
// packages/react/src/quantity-stepper.tsx
|
|
7466
|
-
import { useEffect as
|
|
7467
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
7643
|
+
import { useEffect as useEffect25, useRef as useRef33, useState as useState30 } from "react";
|
|
7644
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7468
7645
|
import { jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7469
7646
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7470
7647
|
const m = useKjunMessages();
|
|
7471
|
-
const geometry =
|
|
7472
|
-
const buttonStyle = { width:
|
|
7648
|
+
const geometry = tokens44.extensions.compound;
|
|
7649
|
+
const buttonStyle = { width: tokens44.input[size].height, padding: 0 };
|
|
7473
7650
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
7474
7651
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7475
7652
|
const [draft, setDraft] = useState30(String(value));
|
|
7476
7653
|
const field = useKjunField();
|
|
7477
|
-
const composing =
|
|
7478
|
-
|
|
7654
|
+
const composing = useRef33(false), dirty = useRef33(false), accepted = useRef33(value);
|
|
7655
|
+
useEffect25(() => {
|
|
7479
7656
|
setDraft(String(value));
|
|
7480
7657
|
accepted.current = value;
|
|
7481
7658
|
dirty.current = false;
|
|
7482
7659
|
}, [value, precision, min, max, step]);
|
|
7483
|
-
|
|
7660
|
+
useEffect25(() => {
|
|
7484
7661
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7485
7662
|
}, [valid]);
|
|
7486
7663
|
const emit = (next) => {
|
|
@@ -7555,18 +7732,18 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7555
7732
|
}
|
|
7556
7733
|
|
|
7557
7734
|
// packages/react/src/time-picker.tsx
|
|
7558
|
-
import { Fragment as Fragment20, useEffect as
|
|
7735
|
+
import { Fragment as Fragment20, useEffect as useEffect26, useId as useId13, useMemo as useMemo3, useRef as useRef34 } from "react";
|
|
7559
7736
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
7560
7737
|
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7561
7738
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7562
7739
|
const m = useKjunMessages();
|
|
7563
7740
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7564
|
-
const root =
|
|
7741
|
+
const root = useRef34(null);
|
|
7565
7742
|
const field = useKjunField(), uid = useId13();
|
|
7566
7743
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7567
7744
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7568
7745
|
const valid = domain.valid && domain.accepts(value);
|
|
7569
|
-
|
|
7746
|
+
useEffect26(() => {
|
|
7570
7747
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7571
7748
|
}, [valid]);
|
|
7572
7749
|
const change = (next) => {
|
|
@@ -7656,6 +7833,7 @@ export {
|
|
|
7656
7833
|
KjunInput,
|
|
7657
7834
|
KjunKpiHero,
|
|
7658
7835
|
KjunKpiRow,
|
|
7836
|
+
KjunListItem,
|
|
7659
7837
|
KjunListRow,
|
|
7660
7838
|
KjunListSection,
|
|
7661
7839
|
KjunListSkeleton,
|
|
@@ -7695,6 +7873,7 @@ export {
|
|
|
7695
7873
|
KjunTimePicker,
|
|
7696
7874
|
KjunTooltip,
|
|
7697
7875
|
KjunTopNavigation,
|
|
7876
|
+
createKjunFeedback,
|
|
7698
7877
|
groupKeydown,
|
|
7699
7878
|
kjunMessagesEn,
|
|
7700
7879
|
kjunMessagesKo,
|