@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.cjs
CHANGED
|
@@ -74,6 +74,7 @@ __export(index_exports, {
|
|
|
74
74
|
KjunInput: () => KjunInput,
|
|
75
75
|
KjunKpiHero: () => KjunKpiHero,
|
|
76
76
|
KjunKpiRow: () => KjunKpiRow,
|
|
77
|
+
KjunListItem: () => KjunListItem,
|
|
77
78
|
KjunListRow: () => KjunListRow,
|
|
78
79
|
KjunListSection: () => KjunListSection,
|
|
79
80
|
KjunListSkeleton: () => KjunListSkeleton,
|
|
@@ -113,6 +114,7 @@ __export(index_exports, {
|
|
|
113
114
|
KjunTimePicker: () => KjunTimePicker,
|
|
114
115
|
KjunTooltip: () => KjunTooltip,
|
|
115
116
|
KjunTopNavigation: () => KjunTopNavigation,
|
|
117
|
+
createKjunFeedback: () => import_tokens16.createKjunFeedback,
|
|
116
118
|
groupKeydown: () => groupKeydown,
|
|
117
119
|
kjunMessagesEn: () => kjunMessagesEn,
|
|
118
120
|
kjunMessagesKo: () => kjunMessagesKo,
|
|
@@ -1356,14 +1358,33 @@ var KjunInput = (0, import_react9.forwardRef)(
|
|
|
1356
1358
|
}
|
|
1357
1359
|
);
|
|
1358
1360
|
|
|
1361
|
+
// shared/package-runtime/use-after-close.ts
|
|
1362
|
+
var import_react10 = require("react");
|
|
1363
|
+
function useAfterCloseRef(open, onAfterClose) {
|
|
1364
|
+
const state = (0, import_react10.useRef)({ open, mounted: false, callback: onAfterClose });
|
|
1365
|
+
state.current.open = open;
|
|
1366
|
+
state.current.callback = onAfterClose;
|
|
1367
|
+
return (0, import_react10.useCallback)((node) => {
|
|
1368
|
+
const current = state.current;
|
|
1369
|
+
if (node) current.mounted = true;
|
|
1370
|
+
else if (current.mounted) {
|
|
1371
|
+
current.mounted = false;
|
|
1372
|
+
queueMicrotask(() => {
|
|
1373
|
+
var _a;
|
|
1374
|
+
if (!current.open && !current.mounted) (_a = current.callback) == null ? void 0 : _a.call(current);
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
}, []);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1359
1380
|
// shared/package-runtime/use-presence.ts
|
|
1360
1381
|
var import_tokens8 = require("@kjun-ui/tokens");
|
|
1361
|
-
var
|
|
1382
|
+
var import_react11 = require("react");
|
|
1362
1383
|
function usePresence(open, reduced, exitDuration = import_tokens8.tokens.motion.layerExit) {
|
|
1363
|
-
const [retained, setRetained] = (0,
|
|
1364
|
-
const [active, setActive] = (0,
|
|
1365
|
-
const mounted = (0,
|
|
1366
|
-
(0,
|
|
1384
|
+
const [retained, setRetained] = (0, import_react11.useState)(open);
|
|
1385
|
+
const [active, setActive] = (0, import_react11.useState)(false);
|
|
1386
|
+
const mounted = (0, import_react11.useRef)(false);
|
|
1387
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
1367
1388
|
let first = 0, second = 0, timer;
|
|
1368
1389
|
if (open) {
|
|
1369
1390
|
setRetained(true);
|
|
@@ -1391,7 +1412,7 @@ function usePresence(open, reduced, exitDuration = import_tokens8.tokens.motion.
|
|
|
1391
1412
|
}
|
|
1392
1413
|
|
|
1393
1414
|
// packages/react/src/use-reduced-motion.ts
|
|
1394
|
-
var
|
|
1415
|
+
var import_react12 = require("react");
|
|
1395
1416
|
var query = "(prefers-reduced-motion: reduce)";
|
|
1396
1417
|
function subscribe(notify) {
|
|
1397
1418
|
const media = window.matchMedia(query);
|
|
@@ -1399,12 +1420,12 @@ function subscribe(notify) {
|
|
|
1399
1420
|
return () => media.removeEventListener("change", notify);
|
|
1400
1421
|
}
|
|
1401
1422
|
function useReducedMotion() {
|
|
1402
|
-
return (0,
|
|
1423
|
+
return (0, import_react12.useSyncExternalStore)(subscribe, () => window.matchMedia(query).matches, () => true);
|
|
1403
1424
|
}
|
|
1404
1425
|
|
|
1405
1426
|
// packages/react/src/modal.tsx
|
|
1406
1427
|
var import_tokens9 = require("@kjun-ui/tokens");
|
|
1407
|
-
var
|
|
1428
|
+
var import_react14 = require("react");
|
|
1408
1429
|
|
|
1409
1430
|
// shared/package-runtime/form-actions.ts
|
|
1410
1431
|
function formActionsNeedStack(width, widths, gap) {
|
|
@@ -1457,17 +1478,17 @@ function observeFormActions(root) {
|
|
|
1457
1478
|
var import_react_aria_components2 = require("react-aria-components");
|
|
1458
1479
|
|
|
1459
1480
|
// packages/react/src/overlay-host.tsx
|
|
1460
|
-
var
|
|
1461
|
-
var FeedbackOverlayContext = (0,
|
|
1481
|
+
var import_react13 = require("react");
|
|
1482
|
+
var FeedbackOverlayContext = (0, import_react13.createContext)(
|
|
1462
1483
|
null
|
|
1463
1484
|
);
|
|
1464
1485
|
function FeedbackLayerOutlet() {
|
|
1465
1486
|
var _a;
|
|
1466
|
-
const layers = useLayerState(), scope = (0,
|
|
1487
|
+
const layers = useLayerState(), scope = (0, import_react13.useContext)(LayerScope);
|
|
1467
1488
|
const entry = scope ? layers.entries.get(scope) : void 0;
|
|
1468
1489
|
const active = !!entry && layers.isActive(entry.id), order = (_a = entry == null ? void 0 : entry.order) != null ? _a : 0;
|
|
1469
|
-
const host = (0,
|
|
1470
|
-
(0,
|
|
1490
|
+
const host = (0, import_react13.useContext)(FeedbackOverlayContext), id = "kjun-" + (0, import_react13.useId)(), register = host == null ? void 0 : host.register;
|
|
1491
|
+
(0, import_react13.useLayoutEffect)(() => active ? register == null ? void 0 : register(id, order) : void 0, [register, id, active, order]);
|
|
1471
1492
|
return (host == null ? void 0 : host.top) === id ? host.render() : null;
|
|
1472
1493
|
}
|
|
1473
1494
|
|
|
@@ -1490,8 +1511,8 @@ function KjunFormActions({
|
|
|
1490
1511
|
const m = useKjunMessages();
|
|
1491
1512
|
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1492
1513
|
confirmText != null ? confirmText : confirmText = m.save;
|
|
1493
|
-
const ref = (0,
|
|
1494
|
-
(0,
|
|
1514
|
+
const ref = (0, import_react14.useRef)(null);
|
|
1515
|
+
(0, import_react14.useLayoutEffect)(() => observeFormActions(ref.current), []);
|
|
1495
1516
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "kjun-form-actions", ref, children: [
|
|
1496
1517
|
showCancel && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1497
1518
|
KjunButton,
|
|
@@ -1520,6 +1541,7 @@ function KjunModal({
|
|
|
1520
1541
|
open,
|
|
1521
1542
|
onOpenChange,
|
|
1522
1543
|
onClose,
|
|
1544
|
+
onAfterClose,
|
|
1523
1545
|
onCancel,
|
|
1524
1546
|
onConfirm,
|
|
1525
1547
|
title = "",
|
|
@@ -1548,8 +1570,9 @@ function KjunModal({
|
|
|
1548
1570
|
confirmText != null ? confirmText : confirmText = m.confirm;
|
|
1549
1571
|
cancelText != null ? cancelText : cancelText = m.cancel;
|
|
1550
1572
|
const motion = usePresence(open, useReducedMotion());
|
|
1573
|
+
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
1551
1574
|
const portalContainer = useKjunPortalContainer();
|
|
1552
|
-
const id = "kjun-" + (0,
|
|
1575
|
+
const id = "kjun-" + (0, import_react14.useId)();
|
|
1553
1576
|
const explicitLabel = ariaLabel == null ? void 0 : ariaLabel.trim();
|
|
1554
1577
|
const heading = header || title;
|
|
1555
1578
|
const labelledByHeading = showHeader && !explicitLabel && (typeof heading === "string" ? !!heading.trim() : !!heading);
|
|
@@ -1565,6 +1588,7 @@ function KjunModal({
|
|
|
1565
1588
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1566
1589
|
import_react_aria_components2.ModalOverlay,
|
|
1567
1590
|
{
|
|
1591
|
+
ref: afterCloseRef,
|
|
1568
1592
|
style: { zIndex: layer.zIndex },
|
|
1569
1593
|
isOpen: motion.present && layer.active,
|
|
1570
1594
|
isExiting: motion.present && !layer.active,
|
|
@@ -1652,12 +1676,12 @@ function KjunModal({
|
|
|
1652
1676
|
}
|
|
1653
1677
|
|
|
1654
1678
|
// shared/package-runtime/content-presence.ts
|
|
1655
|
-
var
|
|
1679
|
+
var import_react15 = require("react");
|
|
1656
1680
|
function hasContent(node) {
|
|
1657
1681
|
if (node == null || typeof node === "boolean") return false;
|
|
1658
1682
|
if (typeof node === "string") return node.trim().length > 0;
|
|
1659
1683
|
if (Array.isArray(node)) return node.some(hasContent);
|
|
1660
|
-
if ((0,
|
|
1684
|
+
if ((0, import_react15.isValidElement)(node) && node.type === import_react15.Fragment)
|
|
1661
1685
|
return hasContent(node.props.children);
|
|
1662
1686
|
return true;
|
|
1663
1687
|
}
|
|
@@ -1670,10 +1694,43 @@ function alertRole(tone, live) {
|
|
|
1670
1694
|
}
|
|
1671
1695
|
|
|
1672
1696
|
// packages/react/src/display.tsx
|
|
1697
|
+
var import_tokens11 = require("@kjun-ui/tokens");
|
|
1698
|
+
|
|
1699
|
+
// shared/package-runtime/progress-circle.ts
|
|
1673
1700
|
var import_tokens10 = require("@kjun-ui/tokens");
|
|
1674
|
-
|
|
1701
|
+
function progressCircle(size, percentage) {
|
|
1702
|
+
const { size: diameter, stroke } = import_tokens10.tokens.extensions.progress.circle[size];
|
|
1703
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
1704
|
+
return {
|
|
1705
|
+
diameter,
|
|
1706
|
+
stroke,
|
|
1707
|
+
radius,
|
|
1708
|
+
centre: diameter / 2,
|
|
1709
|
+
circumference,
|
|
1710
|
+
offset: circumference * (1 - percentage / 100),
|
|
1711
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
1712
|
+
showsPercentage: size !== "sm"
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// packages/react/src/display.tsx
|
|
1717
|
+
var import_react17 = require("react");
|
|
1718
|
+
|
|
1719
|
+
// shared/package-runtime/nested-controls.ts
|
|
1720
|
+
var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
1721
|
+
function developmentMode3() {
|
|
1722
|
+
try {
|
|
1723
|
+
return true;
|
|
1724
|
+
} catch (e) {
|
|
1725
|
+
return false;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
function warnNestedControls(root, message) {
|
|
1729
|
+
if (developmentMode3() && (root == null ? void 0 : root.querySelector(interactive))) console.warn(message);
|
|
1730
|
+
}
|
|
1675
1731
|
|
|
1676
1732
|
// packages/react/src/card.tsx
|
|
1733
|
+
var import_react16 = require("react");
|
|
1677
1734
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1678
1735
|
function KjunCard({
|
|
1679
1736
|
title,
|
|
@@ -1689,17 +1746,44 @@ function KjunCard({
|
|
|
1689
1746
|
elevation = "flat",
|
|
1690
1747
|
border = false,
|
|
1691
1748
|
dividers = false,
|
|
1749
|
+
pressable = false,
|
|
1750
|
+
disabled = false,
|
|
1751
|
+
ariaLabel,
|
|
1692
1752
|
children,
|
|
1693
1753
|
style,
|
|
1694
1754
|
className = "",
|
|
1755
|
+
onClick,
|
|
1756
|
+
onKeyDown,
|
|
1695
1757
|
...props
|
|
1696
1758
|
}) {
|
|
1759
|
+
const root = (0, import_react16.useRef)(null);
|
|
1760
|
+
(0, import_react16.useEffect)(() => {
|
|
1761
|
+
if (pressable) warnNestedControls(root.current, "KJUN Card: a pressable card contains buttons or links; move them out or drop pressable.");
|
|
1762
|
+
}, [pressable]);
|
|
1763
|
+
const press = pressable ? {
|
|
1764
|
+
role: "button",
|
|
1765
|
+
tabIndex: disabled ? -1 : 0,
|
|
1766
|
+
"aria-disabled": disabled || void 0,
|
|
1767
|
+
"aria-label": ariaLabel != null ? ariaLabel : title,
|
|
1768
|
+
"data-pressable": "",
|
|
1769
|
+
onClick: (event) => {
|
|
1770
|
+
if (!disabled) onClick == null ? void 0 : onClick(event);
|
|
1771
|
+
},
|
|
1772
|
+
onKeyDown: (event) => {
|
|
1773
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
1774
|
+
if (event.defaultPrevented || disabled || event.key !== "Enter" && event.key !== " ") return;
|
|
1775
|
+
event.preventDefault();
|
|
1776
|
+
event.currentTarget.click();
|
|
1777
|
+
}
|
|
1778
|
+
} : { onClick, onKeyDown };
|
|
1697
1779
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
1698
1780
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
1699
1781
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1700
1782
|
"div",
|
|
1701
1783
|
{
|
|
1702
1784
|
...props,
|
|
1785
|
+
...press,
|
|
1786
|
+
ref: root,
|
|
1703
1787
|
className: ["kjun-card", className].filter(Boolean).join(" "),
|
|
1704
1788
|
"data-surface": surface,
|
|
1705
1789
|
"data-padding": padding,
|
|
@@ -1711,7 +1795,8 @@ function KjunCard({
|
|
|
1711
1795
|
"--_kjun-card-padding": `var(--_kjun-geometry-card-padding-${padding})`,
|
|
1712
1796
|
"--_kjun-card-body-padding": `var(--_kjun-geometry-card-padding-${bodyPadding})`,
|
|
1713
1797
|
borderRadius: `var(--_kjun-geometry-card-radii-${radius})`,
|
|
1714
|
-
|
|
1798
|
+
// A pressable card's shadow comes from CSS so its hover lift can replace it.
|
|
1799
|
+
[pressable ? "--_kjun-card-shadow" : "boxShadow"]: `var(--_kjun-card-elevation-${elevation})`,
|
|
1715
1800
|
...style
|
|
1716
1801
|
},
|
|
1717
1802
|
children: [
|
|
@@ -1741,7 +1826,7 @@ function KjunBadge({
|
|
|
1741
1826
|
style,
|
|
1742
1827
|
...props
|
|
1743
1828
|
}) {
|
|
1744
|
-
const { x, y } =
|
|
1829
|
+
const { x, y } = import_tokens11.tokens.extensions.badge.padding[size];
|
|
1745
1830
|
const neutral = variant === "default" || variant === "secondary";
|
|
1746
1831
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1747
1832
|
"span",
|
|
@@ -1776,7 +1861,7 @@ function KjunEmpty({
|
|
|
1776
1861
|
const m = useKjunMessages();
|
|
1777
1862
|
text != null ? text : text = m.noData;
|
|
1778
1863
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-empty", children: [
|
|
1779
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size:
|
|
1864
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: icon, size: import_tokens11.tokens.extensions.empty.iconSize }),
|
|
1780
1865
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: text }),
|
|
1781
1866
|
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { children: description }),
|
|
1782
1867
|
children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children })
|
|
@@ -1784,14 +1869,14 @@ function KjunEmpty({
|
|
|
1784
1869
|
}
|
|
1785
1870
|
function KjunSpinner({ size = "md", text }) {
|
|
1786
1871
|
const m = useKjunMessages();
|
|
1787
|
-
const stroke =
|
|
1872
|
+
const stroke = import_tokens11.tokens.extensions.spinner.strokeWidths[size] * 24 / import_tokens11.tokens.extensions.spinner.sizes[size];
|
|
1788
1873
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { role: "status", "aria-label": text || m.loading, className: "kjun-spinner", children: [
|
|
1789
1874
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1790
1875
|
"svg",
|
|
1791
1876
|
{
|
|
1792
1877
|
className: "kjun-spin",
|
|
1793
|
-
width:
|
|
1794
|
-
height:
|
|
1878
|
+
width: import_tokens11.tokens.extensions.spinner.sizes[size],
|
|
1879
|
+
height: import_tokens11.tokens.extensions.spinner.sizes[size],
|
|
1795
1880
|
viewBox: "0 0 24 24",
|
|
1796
1881
|
fill: "none",
|
|
1797
1882
|
"aria-hidden": "true",
|
|
@@ -1833,7 +1918,7 @@ function KjunAlert({
|
|
|
1833
1918
|
onClose
|
|
1834
1919
|
}) {
|
|
1835
1920
|
const m = useKjunMessages();
|
|
1836
|
-
const [visible, setVisible] = (0,
|
|
1921
|
+
const [visible, setVisible] = (0, import_react17.useState)(true);
|
|
1837
1922
|
if (!visible) return null;
|
|
1838
1923
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
1839
1924
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
@@ -1857,7 +1942,7 @@ function KjunAlert({
|
|
|
1857
1942
|
warning: "alert-triangle",
|
|
1858
1943
|
danger: "alert-circle"
|
|
1859
1944
|
}[tone],
|
|
1860
|
-
size:
|
|
1945
|
+
size: import_tokens11.tokens.extensions.alert.iconSizes[small ? "sm" : "md"]
|
|
1861
1946
|
}
|
|
1862
1947
|
) }),
|
|
1863
1948
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-alert-content", children: [
|
|
@@ -1875,7 +1960,7 @@ function KjunAlert({
|
|
|
1875
1960
|
setVisible(false);
|
|
1876
1961
|
onClose == null ? void 0 : onClose();
|
|
1877
1962
|
},
|
|
1878
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size:
|
|
1963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(KjunIcon, { name: "x", size: import_tokens11.tokens.extensions.alert.closeIconSize })
|
|
1879
1964
|
}
|
|
1880
1965
|
)
|
|
1881
1966
|
]
|
|
@@ -1889,10 +1974,55 @@ function KjunProgress({
|
|
|
1889
1974
|
variant = "primary",
|
|
1890
1975
|
showLabel = false,
|
|
1891
1976
|
label,
|
|
1892
|
-
subLabel
|
|
1977
|
+
subLabel,
|
|
1978
|
+
shape = "bar"
|
|
1893
1979
|
}) {
|
|
1894
1980
|
const m = useKjunMessages();
|
|
1895
1981
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
1982
|
+
const name = typeof label === "string" ? label : m.progress, color = role(variant === "primary" ? "brand" : variant);
|
|
1983
|
+
if (shape === "circle") {
|
|
1984
|
+
const c = progressCircle(size, percentage);
|
|
1985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", "data-shape": "circle", "data-size": size, children: [
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1987
|
+
"div",
|
|
1988
|
+
{
|
|
1989
|
+
role: "progressbar",
|
|
1990
|
+
"aria-label": name,
|
|
1991
|
+
"aria-valuemin": 0,
|
|
1992
|
+
"aria-valuemax": 100,
|
|
1993
|
+
"aria-valuenow": percentage,
|
|
1994
|
+
className: "kjun-progress-circle",
|
|
1995
|
+
style: { width: c.diameter, height: c.diameter },
|
|
1996
|
+
children: [
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, fill: "none", "aria-hidden": "true", children: [
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { className: "kjun-progress-circle-track", cx: c.centre, cy: c.centre, r: c.radius, strokeWidth: c.stroke }),
|
|
1999
|
+
percentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2000
|
+
"circle",
|
|
2001
|
+
{
|
|
2002
|
+
className: "kjun-progress-circle-value",
|
|
2003
|
+
cx: c.centre,
|
|
2004
|
+
cy: c.centre,
|
|
2005
|
+
r: c.radius,
|
|
2006
|
+
strokeWidth: c.stroke,
|
|
2007
|
+
stroke: color,
|
|
2008
|
+
strokeLinecap: "round",
|
|
2009
|
+
strokeDasharray: c.circumference,
|
|
2010
|
+
strokeDashoffset: c.offset,
|
|
2011
|
+
transform: `rotate(-90 ${c.centre} ${c.centre})`
|
|
2012
|
+
}
|
|
2013
|
+
)
|
|
2014
|
+
] }),
|
|
2015
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "kjun-progress-circle-percent", children: [
|
|
2016
|
+
percentage,
|
|
2017
|
+
"%"
|
|
2018
|
+
] })
|
|
2019
|
+
]
|
|
2020
|
+
}
|
|
2021
|
+
),
|
|
2022
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-circle-label", children: label }),
|
|
2023
|
+
subLabel && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-progress-sub", children: subLabel })
|
|
2024
|
+
] });
|
|
2025
|
+
}
|
|
1896
2026
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress", children: [
|
|
1897
2027
|
(label || showLabel) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-progress-label", children: [
|
|
1898
2028
|
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }),
|
|
@@ -1905,18 +2035,18 @@ function KjunProgress({
|
|
|
1905
2035
|
"div",
|
|
1906
2036
|
{
|
|
1907
2037
|
role: "progressbar",
|
|
1908
|
-
"aria-label":
|
|
2038
|
+
"aria-label": name,
|
|
1909
2039
|
"aria-valuemin": 0,
|
|
1910
2040
|
"aria-valuemax": 100,
|
|
1911
2041
|
"aria-valuenow": percentage,
|
|
1912
2042
|
className: "kjun-progress-track",
|
|
1913
|
-
style: { height:
|
|
2043
|
+
style: { height: import_tokens11.tokens.extensions.progress.heights[size] },
|
|
1914
2044
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1915
2045
|
"div",
|
|
1916
2046
|
{
|
|
1917
2047
|
style: {
|
|
1918
2048
|
width: percentage + "%",
|
|
1919
|
-
background:
|
|
2049
|
+
background: color
|
|
1920
2050
|
}
|
|
1921
2051
|
}
|
|
1922
2052
|
)
|
|
@@ -1947,9 +2077,9 @@ function KjunSkeleton({
|
|
|
1947
2077
|
{
|
|
1948
2078
|
className: "kjun-skeleton-avatar" + (sm ? " kjun-skeleton-avatar-sm" : ""),
|
|
1949
2079
|
style: sm ? void 0 : {
|
|
1950
|
-
width: width ||
|
|
1951
|
-
height: height ||
|
|
1952
|
-
borderRadius: rounded ? "50%" :
|
|
2080
|
+
width: width || import_tokens11.tokens.extensions.skeleton.avatarSize,
|
|
2081
|
+
height: height || import_tokens11.tokens.extensions.skeleton.avatarSize,
|
|
2082
|
+
borderRadius: rounded ? "50%" : import_tokens11.tokens.radius.radius8
|
|
1953
2083
|
}
|
|
1954
2084
|
}
|
|
1955
2085
|
);
|
|
@@ -1973,7 +2103,7 @@ function KjunSkeleton({
|
|
|
1973
2103
|
avatar(true),
|
|
1974
2104
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-header-text", children: [
|
|
1975
2105
|
line("60%"),
|
|
1976
|
-
line("40%", void 0,
|
|
2106
|
+
line("40%", void 0, import_tokens11.tokens.extensions.skeleton.lineHeights.sm)
|
|
1977
2107
|
] })
|
|
1978
2108
|
] }),
|
|
1979
2109
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-card-body", children: [
|
|
@@ -1996,9 +2126,9 @@ function KjunSkeleton({
|
|
|
1996
2126
|
)) }),
|
|
1997
2127
|
type === "stat" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat", children: [
|
|
1998
2128
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "kjun-skeleton-stat-content", children: [
|
|
1999
|
-
line("40%", 0,
|
|
2000
|
-
line("60%", 1,
|
|
2001
|
-
line("30%", 2,
|
|
2129
|
+
line("40%", 0, import_tokens11.tokens.extensions.skeleton.lineHeights.sm),
|
|
2130
|
+
line("60%", 1, import_tokens11.tokens.extensions.skeleton.lineHeights.lg),
|
|
2131
|
+
line("30%", 2, import_tokens11.tokens.extensions.skeleton.lineHeights.sm)
|
|
2002
2132
|
] }),
|
|
2003
2133
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-stat-chart", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "kjun-skeleton-sparkline" }) })
|
|
2004
2134
|
] }),
|
|
@@ -2006,7 +2136,7 @@ function KjunSkeleton({
|
|
|
2006
2136
|
"div",
|
|
2007
2137
|
{
|
|
2008
2138
|
className: "kjun-skeleton-block",
|
|
2009
|
-
style: { width: width || "100%", height: height != null ? height :
|
|
2139
|
+
style: { width: width || "100%", height: height != null ? height : import_tokens11.tokens.extensions.skeleton.blockHeight }
|
|
2010
2140
|
}
|
|
2011
2141
|
)
|
|
2012
2142
|
]
|
|
@@ -2015,7 +2145,7 @@ function KjunSkeleton({
|
|
|
2015
2145
|
}
|
|
2016
2146
|
|
|
2017
2147
|
// packages/react/src/layout-primitives.tsx
|
|
2018
|
-
var
|
|
2148
|
+
var import_react18 = require("react");
|
|
2019
2149
|
|
|
2020
2150
|
// shared/package-runtime/layout-primitives.ts
|
|
2021
2151
|
var numeric = /^(number|display)/;
|
|
@@ -2027,7 +2157,7 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
|
2027
2157
|
var join = (...names) => names.filter(Boolean).join(" ");
|
|
2028
2158
|
function KjunText({ variant = "body", tone = "default", as, align, maxLines, className, style, children, ...rest }) {
|
|
2029
2159
|
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
2030
|
-
return (0,
|
|
2160
|
+
return (0, import_react18.createElement)(as != null ? as : defaultTextTag(variant), {
|
|
2031
2161
|
...rest,
|
|
2032
2162
|
className: join("kjun-text", textTypeClass(variant), className),
|
|
2033
2163
|
// 안에 넣은 링크·강조 같은 앱 요소는 KJUN 리셋을 받지 않는다.
|
|
@@ -2039,7 +2169,7 @@ function KjunText({ variant = "body", tone = "default", as, align, maxLines, cla
|
|
|
2039
2169
|
}, children);
|
|
2040
2170
|
}
|
|
2041
2171
|
function KjunStack({ gap = "md", align = "stretch", as = "div", className, style, children, ...rest }) {
|
|
2042
|
-
return (0,
|
|
2172
|
+
return (0, import_react18.createElement)(as, {
|
|
2043
2173
|
...rest,
|
|
2044
2174
|
className: className || void 0,
|
|
2045
2175
|
style,
|
|
@@ -2066,13 +2196,13 @@ function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = tr
|
|
|
2066
2196
|
}
|
|
2067
2197
|
|
|
2068
2198
|
// shared/package-runtime/feedback-dialog.ts
|
|
2069
|
-
var
|
|
2199
|
+
var import_react19 = require("react");
|
|
2070
2200
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
2071
2201
|
const options = request.options;
|
|
2072
|
-
const [value, setValue] = (0,
|
|
2073
|
-
const [error, setError] = (0,
|
|
2074
|
-
const [busy, setBusy] = (0,
|
|
2075
|
-
const working = (0,
|
|
2202
|
+
const [value, setValue] = (0, import_react19.useState)(options.initialValue || "");
|
|
2203
|
+
const [error, setError] = (0, import_react19.useState)("");
|
|
2204
|
+
const [busy, setBusy] = (0, import_react19.useState)(false);
|
|
2205
|
+
const working = (0, import_react19.useRef)(false);
|
|
2076
2206
|
const active = () => {
|
|
2077
2207
|
var _a;
|
|
2078
2208
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -2114,12 +2244,12 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2114
2244
|
}
|
|
2115
2245
|
|
|
2116
2246
|
// shared/package-runtime/feedback-motion.ts
|
|
2117
|
-
var
|
|
2118
|
-
var
|
|
2247
|
+
var import_tokens12 = require("@kjun-ui/tokens");
|
|
2248
|
+
var import_react20 = require("react");
|
|
2119
2249
|
function usePresentedToasts(toasts, reduced) {
|
|
2120
|
-
const [items, setItems] = (0,
|
|
2121
|
-
const removals = (0,
|
|
2122
|
-
(0,
|
|
2250
|
+
const [items, setItems] = (0, import_react20.useState)([]);
|
|
2251
|
+
const removals = (0, import_react20.useRef)(/* @__PURE__ */ new Map());
|
|
2252
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
2123
2253
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
2124
2254
|
setItems((previous) => {
|
|
2125
2255
|
const old = new Map(previous.map((item) => [item.toast.id, item]));
|
|
@@ -2132,7 +2262,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2132
2262
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2133
2263
|
removals.current.delete(item.toast.id);
|
|
2134
2264
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2135
|
-
},
|
|
2265
|
+
}, import_tokens12.tokens.motion.toastExit));
|
|
2136
2266
|
}
|
|
2137
2267
|
return next;
|
|
2138
2268
|
});
|
|
@@ -2141,38 +2271,38 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2141
2271
|
removals.current.clear();
|
|
2142
2272
|
}
|
|
2143
2273
|
}, [toasts, reduced]);
|
|
2144
|
-
(0,
|
|
2274
|
+
(0, import_react20.useLayoutEffect)(() => () => {
|
|
2145
2275
|
for (const timer of removals.current.values()) clearTimeout(timer);
|
|
2146
2276
|
removals.current.clear();
|
|
2147
2277
|
}, []);
|
|
2148
2278
|
return items;
|
|
2149
2279
|
}
|
|
2150
2280
|
function usePresentedRequest(current, reduced) {
|
|
2151
|
-
const [request, setRequest] = (0,
|
|
2152
|
-
(0,
|
|
2281
|
+
const [request, setRequest] = (0, import_react20.useState)(current);
|
|
2282
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
2153
2283
|
if (!request || request.id === (current == null ? void 0 : current.id) || reduced) {
|
|
2154
2284
|
setRequest(current);
|
|
2155
2285
|
return;
|
|
2156
2286
|
}
|
|
2157
|
-
const timer = setTimeout(() => setRequest(current),
|
|
2287
|
+
const timer = setTimeout(() => setRequest(current), import_tokens12.tokens.motion.layerExit);
|
|
2158
2288
|
return () => clearTimeout(timer);
|
|
2159
2289
|
}, [current, request, reduced]);
|
|
2160
2290
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
2161
2291
|
}
|
|
2162
2292
|
|
|
2163
2293
|
// packages/react/src/feedback-context.ts
|
|
2164
|
-
var
|
|
2165
|
-
var KjunFeedbackContext = (0,
|
|
2294
|
+
var import_react21 = require("react");
|
|
2295
|
+
var KjunFeedbackContext = (0, import_react21.createContext)(null);
|
|
2166
2296
|
function useOptionalKjunFeedback() {
|
|
2167
|
-
return (0,
|
|
2297
|
+
return (0, import_react21.useContext)(KjunFeedbackContext);
|
|
2168
2298
|
}
|
|
2169
2299
|
|
|
2170
2300
|
// packages/react/src/toast-stack.tsx
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2301
|
+
var import_tokens14 = require("@kjun-ui/tokens");
|
|
2302
|
+
var import_react23 = require("react");
|
|
2173
2303
|
|
|
2174
2304
|
// shared/package-runtime/toast-layout.ts
|
|
2175
|
-
var
|
|
2305
|
+
var import_tokens13 = require("@kjun-ui/tokens");
|
|
2176
2306
|
function createToastLayout() {
|
|
2177
2307
|
let root = null;
|
|
2178
2308
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -2215,7 +2345,7 @@ function createToastLayout() {
|
|
|
2215
2345
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
2216
2346
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
2217
2347
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
2218
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
2348
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: import_tokens13.tokens.motion.toastMove, easing: import_tokens13.tokens.motion.easeOut });
|
|
2219
2349
|
animations.set(node, animation);
|
|
2220
2350
|
}
|
|
2221
2351
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -2231,16 +2361,16 @@ function createToastLayout() {
|
|
|
2231
2361
|
}
|
|
2232
2362
|
|
|
2233
2363
|
// packages/react/src/toast.tsx
|
|
2234
|
-
var
|
|
2364
|
+
var import_react22 = require("react");
|
|
2235
2365
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2236
2366
|
function ToastView({
|
|
2237
2367
|
toast,
|
|
2238
2368
|
controller
|
|
2239
2369
|
}) {
|
|
2240
2370
|
const m = useKjunMessages();
|
|
2241
|
-
const previous = (0,
|
|
2242
|
-
const reasons = (0,
|
|
2243
|
-
(0,
|
|
2371
|
+
const previous = (0, import_react22.useRef)(null);
|
|
2372
|
+
const reasons = (0, import_react22.useRef)({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
2373
|
+
(0, import_react22.useEffect)(() => {
|
|
2244
2374
|
previous.current = document.activeElement;
|
|
2245
2375
|
return () => {
|
|
2246
2376
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -2335,10 +2465,10 @@ function ToastView({
|
|
|
2335
2465
|
// packages/react/src/toast-stack.tsx
|
|
2336
2466
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2337
2467
|
function ToastSurface({ item, controller }) {
|
|
2338
|
-
const ref = (0,
|
|
2339
|
-
const current = (0,
|
|
2340
|
-
const entryFinished = (0,
|
|
2341
|
-
(0,
|
|
2468
|
+
const ref = (0, import_react23.useRef)(null), reduced = useReducedMotion();
|
|
2469
|
+
const current = (0, import_react23.useRef)(null);
|
|
2470
|
+
const entryFinished = (0, import_react23.useRef)(false);
|
|
2471
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
2342
2472
|
var _a, _b;
|
|
2343
2473
|
const el = ref.current;
|
|
2344
2474
|
if (!el) return;
|
|
@@ -2347,15 +2477,15 @@ function ToastSurface({ item, controller }) {
|
|
|
2347
2477
|
return;
|
|
2348
2478
|
}
|
|
2349
2479
|
const elapsed = Date.now() - item.born;
|
|
2350
|
-
if (!item.exiting && (elapsed >=
|
|
2351
|
-
const hidden = `translateY(${-
|
|
2480
|
+
if (!item.exiting && (elapsed >= import_tokens14.tokens.motion.toastEnter || entryFinished.current)) return;
|
|
2481
|
+
const hidden = `translateY(${-import_tokens14.tokens.motionDistance.toast}px)`, from = current.current;
|
|
2352
2482
|
const animations = item.exiting ? [
|
|
2353
|
-
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration:
|
|
2354
|
-
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration:
|
|
2483
|
+
el.animate([{ opacity: (_a = from == null ? void 0 : from.opacity) != null ? _a : "1" }, { opacity: 0 }], { duration: import_tokens14.tokens.motion.fadeExit, easing: import_tokens14.tokens.motion.easeLinear, fill: "both" }),
|
|
2484
|
+
el.animate([{ transform: (_b = from == null ? void 0 : from.transform) != null ? _b : "translateY(0)" }, { transform: hidden }], { duration: import_tokens14.tokens.motion.toastExit, easing: import_tokens14.tokens.motion.easeIn, fill: "both" })
|
|
2355
2485
|
] : [el.animate([{ opacity: 0, transform: hidden }, { opacity: 1, transform: "translateY(0)" }], {
|
|
2356
|
-
duration:
|
|
2486
|
+
duration: import_tokens14.tokens.motion.toastEnter,
|
|
2357
2487
|
delay: -elapsed,
|
|
2358
|
-
easing:
|
|
2488
|
+
easing: import_tokens14.tokens.motion.easeOut,
|
|
2359
2489
|
fill: "both"
|
|
2360
2490
|
})];
|
|
2361
2491
|
animations[0].onfinish = () => {
|
|
@@ -2372,12 +2502,12 @@ function ToastSurface({ item, controller }) {
|
|
|
2372
2502
|
function ToastStack({ items, controller }) {
|
|
2373
2503
|
var _a;
|
|
2374
2504
|
const layers = useLayerState();
|
|
2375
|
-
const root = (0,
|
|
2505
|
+
const root = (0, import_react23.useRef)(null), layout = (0, import_react23.useRef)(createToastLayout());
|
|
2376
2506
|
const reduced = useReducedMotion();
|
|
2377
|
-
(0,
|
|
2507
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
2378
2508
|
if (root.current) layout.current.update(root.current, reduced);
|
|
2379
2509
|
});
|
|
2380
|
-
(0,
|
|
2510
|
+
(0, import_react23.useLayoutEffect)(() => () => layout.current.destroy(), []);
|
|
2381
2511
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: root, className: "kjun-toast-stack", style: { zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast") }, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2382
2512
|
"div",
|
|
2383
2513
|
{
|
|
@@ -2391,8 +2521,9 @@ function ToastStack({ items, controller }) {
|
|
|
2391
2521
|
}
|
|
2392
2522
|
|
|
2393
2523
|
// packages/react/src/feedback.tsx
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2524
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2525
|
+
var import_react24 = require("react");
|
|
2526
|
+
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2396
2527
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2397
2528
|
function useKjunFeedback() {
|
|
2398
2529
|
const value = useOptionalKjunFeedback();
|
|
@@ -2441,11 +2572,13 @@ function FeedbackDialog({
|
|
|
2441
2572
|
}
|
|
2442
2573
|
);
|
|
2443
2574
|
}
|
|
2444
|
-
function KjunFeedbackProvider({ children }) {
|
|
2575
|
+
function KjunFeedbackProvider({ children, controller: controllerProp }) {
|
|
2445
2576
|
var _a;
|
|
2446
|
-
const [
|
|
2447
|
-
const
|
|
2448
|
-
|
|
2577
|
+
const [owned] = (0, import_react24.useState)(() => controllerProp ? void 0 : (0, import_tokens15.createFeedbackController)());
|
|
2578
|
+
const controller = controllerProp ? (0, import_tokens15.feedbackControllerOf)(controllerProp) : owned;
|
|
2579
|
+
(0, import_react24.useEffect)(() => controller.attach(), [controller]);
|
|
2580
|
+
const life = (0, import_react24.useRef)(0);
|
|
2581
|
+
const snapshot = (0, import_react24.useSyncExternalStore)(
|
|
2449
2582
|
controller.subscribe,
|
|
2450
2583
|
controller.getSnapshot,
|
|
2451
2584
|
controller.getSnapshot
|
|
@@ -2453,16 +2586,16 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2453
2586
|
const reduced = useReducedMotion();
|
|
2454
2587
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2455
2588
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2456
|
-
(0,
|
|
2589
|
+
(0, import_react24.useEffect)(() => {
|
|
2457
2590
|
const version = ++life.current;
|
|
2458
2591
|
return () => {
|
|
2459
2592
|
queueMicrotask(() => {
|
|
2460
|
-
if (life.current === version) controller.dispose();
|
|
2593
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
2461
2594
|
});
|
|
2462
2595
|
};
|
|
2463
2596
|
}, [controller]);
|
|
2464
|
-
const [layers, setLayers] = (0,
|
|
2465
|
-
const register = (0,
|
|
2597
|
+
const [layers, setLayers] = (0, import_react24.useState)([]);
|
|
2598
|
+
const register = (0, import_react24.useCallback)((id, order) => {
|
|
2466
2599
|
setLayers((current) => [...current, { id, order }]);
|
|
2467
2600
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2468
2601
|
}, []);
|
|
@@ -2490,15 +2623,15 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2490
2623
|
}
|
|
2491
2624
|
|
|
2492
2625
|
// packages/react/src/controls.tsx
|
|
2493
|
-
var
|
|
2494
|
-
var
|
|
2626
|
+
var import_tokens18 = require("@kjun-ui/tokens");
|
|
2627
|
+
var import_react26 = require("react");
|
|
2495
2628
|
var import_react_aria_components3 = require("react-aria-components");
|
|
2496
2629
|
|
|
2497
2630
|
// packages/react/src/use-selection-indicator.ts
|
|
2498
|
-
var
|
|
2631
|
+
var import_react25 = require("react");
|
|
2499
2632
|
|
|
2500
2633
|
// shared/package-runtime/selection-indicator.ts
|
|
2501
|
-
var
|
|
2634
|
+
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2502
2635
|
function selectionIndicator(root, marker, tabs = false) {
|
|
2503
2636
|
var _a;
|
|
2504
2637
|
let selected = null, bounds = "", disposed = false;
|
|
@@ -2538,7 +2671,7 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2538
2671
|
const style = getComputedStyle(next);
|
|
2539
2672
|
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2540
2673
|
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2541
|
-
const height = underline ?
|
|
2674
|
+
const height = underline ? import_tokens17.tokens.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2542
2675
|
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2543
2676
|
if (key !== bounds) {
|
|
2544
2677
|
marker.dataset.animate = String(!!selected && selected !== next);
|
|
@@ -2567,11 +2700,11 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2567
2700
|
|
|
2568
2701
|
// packages/react/src/use-selection-indicator.ts
|
|
2569
2702
|
function useSelectionIndicator(tabs = false) {
|
|
2570
|
-
const group = (0,
|
|
2571
|
-
const indicator = (0,
|
|
2572
|
-
const sync = (0,
|
|
2703
|
+
const group = (0, import_react25.useRef)(null);
|
|
2704
|
+
const indicator = (0, import_react25.useRef)(null);
|
|
2705
|
+
const sync = (0, import_react25.useRef)(() => {
|
|
2573
2706
|
});
|
|
2574
|
-
(0,
|
|
2707
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
2575
2708
|
const root = group.current, marker = indicator.current;
|
|
2576
2709
|
if (!root || !marker) return;
|
|
2577
2710
|
const handle = selectionIndicator(root, marker, tabs);
|
|
@@ -2582,7 +2715,7 @@ function useSelectionIndicator(tabs = false) {
|
|
|
2582
2715
|
};
|
|
2583
2716
|
};
|
|
2584
2717
|
}, [tabs]);
|
|
2585
|
-
(0,
|
|
2718
|
+
(0, import_react25.useLayoutEffect)(() => sync.current());
|
|
2586
2719
|
return { group, indicator };
|
|
2587
2720
|
}
|
|
2588
2721
|
|
|
@@ -2636,7 +2769,7 @@ function KjunCheckbox({
|
|
|
2636
2769
|
"span",
|
|
2637
2770
|
{
|
|
2638
2771
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2639
|
-
children: checked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: "check", size:
|
|
2772
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: "check", size: import_tokens18.tokens.extensions.checkbox.iconSizes[size] })
|
|
2640
2773
|
}
|
|
2641
2774
|
),
|
|
2642
2775
|
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
@@ -2656,9 +2789,9 @@ function KjunSwitch({
|
|
|
2656
2789
|
onChange
|
|
2657
2790
|
}) {
|
|
2658
2791
|
const field = useKjunField();
|
|
2659
|
-
const descriptionId = "kjun-" + (0,
|
|
2792
|
+
const descriptionId = "kjun-" + (0, import_react26.useId)().replace(/:/g, "") + "-description";
|
|
2660
2793
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2661
|
-
const markInput = (0,
|
|
2794
|
+
const markInput = (0, import_react26.useCallback)((input) => {
|
|
2662
2795
|
if (!input) return;
|
|
2663
2796
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2664
2797
|
else input.removeAttribute("aria-invalid");
|
|
@@ -2694,7 +2827,7 @@ function KjunSwitch({
|
|
|
2694
2827
|
}
|
|
2695
2828
|
);
|
|
2696
2829
|
}
|
|
2697
|
-
var RadioContext = (0,
|
|
2830
|
+
var RadioContext = (0, import_react26.createContext)(null);
|
|
2698
2831
|
function KjunRadio({
|
|
2699
2832
|
value,
|
|
2700
2833
|
val,
|
|
@@ -2706,7 +2839,7 @@ function KjunRadio({
|
|
|
2706
2839
|
onValueChange,
|
|
2707
2840
|
onChange
|
|
2708
2841
|
}) {
|
|
2709
|
-
const group = (0,
|
|
2842
|
+
const group = (0, import_react26.useContext)(RadioContext), selected = (group ? group.value : value) === val;
|
|
2710
2843
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""), children: [
|
|
2711
2844
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2712
2845
|
"input",
|
|
@@ -2745,7 +2878,7 @@ function KjunRadioGroup({
|
|
|
2745
2878
|
onValueChange,
|
|
2746
2879
|
onChange
|
|
2747
2880
|
}) {
|
|
2748
|
-
const name = "kjun-" + (0,
|
|
2881
|
+
const name = "kjun-" + (0, import_react26.useId)();
|
|
2749
2882
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2750
2883
|
RadioContext.Provider,
|
|
2751
2884
|
{
|
|
@@ -2767,7 +2900,7 @@ function KjunRadioGroup({
|
|
|
2767
2900
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
2768
2901
|
// A wrapping column would split into extra columns whenever the group's height is fixed.
|
|
2769
2902
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2770
|
-
gap: direction === "vertical" ?
|
|
2903
|
+
gap: direction === "vertical" ? import_tokens18.tokens.dimension.value8 : import_tokens18.tokens.dimension.value16
|
|
2771
2904
|
},
|
|
2772
2905
|
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2773
2906
|
KjunRadio,
|
|
@@ -2783,7 +2916,7 @@ function KjunRadioGroup({
|
|
|
2783
2916
|
}
|
|
2784
2917
|
);
|
|
2785
2918
|
}
|
|
2786
|
-
var KjunTextarea = (0,
|
|
2919
|
+
var KjunTextarea = (0, import_react26.forwardRef)(
|
|
2787
2920
|
function KjunTextarea2({
|
|
2788
2921
|
value,
|
|
2789
2922
|
size = "md",
|
|
@@ -2799,7 +2932,7 @@ var KjunTextarea = (0, import_react24.forwardRef)(
|
|
|
2799
2932
|
}, ref) {
|
|
2800
2933
|
var _a;
|
|
2801
2934
|
const field = useKjunField();
|
|
2802
|
-
const spec =
|
|
2935
|
+
const spec = import_tokens18.tokens.input[size];
|
|
2803
2936
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2804
2937
|
"textarea",
|
|
2805
2938
|
{
|
|
@@ -2817,8 +2950,8 @@ var KjunTextarea = (0, import_react24.forwardRef)(
|
|
|
2817
2950
|
style: {
|
|
2818
2951
|
fontSize: spec.fontSize / 16 + "rem",
|
|
2819
2952
|
lineHeight: spec.lineHeight / 16 + "rem",
|
|
2820
|
-
padding: `${spec.textareaPaddingY}px ${spec.padding -
|
|
2821
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
2953
|
+
padding: `${spec.textareaPaddingY}px ${spec.padding - import_tokens18.tokens.border.controlWidth}px`,
|
|
2954
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * import_tokens18.tokens.border.controlWidth),
|
|
2822
2955
|
borderRadius: spec.radius,
|
|
2823
2956
|
resize,
|
|
2824
2957
|
...style
|
|
@@ -2851,9 +2984,9 @@ function KjunButtonGroup({
|
|
|
2851
2984
|
className: "kjun-button-group",
|
|
2852
2985
|
onKeyDown: groupKeydown,
|
|
2853
2986
|
style: {
|
|
2854
|
-
height:
|
|
2855
|
-
padding:
|
|
2856
|
-
borderRadius:
|
|
2987
|
+
height: import_tokens18.tokens.buttonGroup.heights[size],
|
|
2988
|
+
padding: import_tokens18.tokens.buttonGroup.padding[size],
|
|
2989
|
+
borderRadius: import_tokens18.tokens.buttonGroup.radii[size],
|
|
2857
2990
|
width: fullWidth ? "100%" : "fit-content"
|
|
2858
2991
|
},
|
|
2859
2992
|
children: [
|
|
@@ -2864,7 +2997,7 @@ function KjunButtonGroup({
|
|
|
2864
2997
|
className: "kjun-button-group-indicator",
|
|
2865
2998
|
"aria-hidden": "true",
|
|
2866
2999
|
hidden: true,
|
|
2867
|
-
style: { borderRadius:
|
|
3000
|
+
style: { borderRadius: import_tokens18.tokens.buttonGroup.itemRadii[size] }
|
|
2868
3001
|
}
|
|
2869
3002
|
),
|
|
2870
3003
|
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -2875,8 +3008,8 @@ function KjunButtonGroup({
|
|
|
2875
3008
|
disabled: disabled || option.disabled,
|
|
2876
3009
|
style: {
|
|
2877
3010
|
flex: fullWidth ? 1 : void 0,
|
|
2878
|
-
paddingInline:
|
|
2879
|
-
borderRadius:
|
|
3011
|
+
paddingInline: import_tokens18.tokens.buttonGroup.itemPaddingX[size],
|
|
3012
|
+
borderRadius: import_tokens18.tokens.buttonGroup.itemRadii[size],
|
|
2880
3013
|
...selectionTypeStyle(size, value === option.value)
|
|
2881
3014
|
},
|
|
2882
3015
|
onClick: () => {
|
|
@@ -2884,9 +3017,9 @@ function KjunButtonGroup({
|
|
|
2884
3017
|
onChange == null ? void 0 : onChange(option.value);
|
|
2885
3018
|
},
|
|
2886
3019
|
children: [
|
|
2887
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
3020
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens18.tokens.extensions.selection.iconSize }),
|
|
2888
3021
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-button-group-label", children: [
|
|
2889
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
3022
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens18.tokens.button.typography[size]), children: option.label }),
|
|
2890
3023
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
2891
3024
|
] })
|
|
2892
3025
|
]
|
|
@@ -2922,7 +3055,7 @@ function KjunFilterGroup({
|
|
|
2922
3055
|
{
|
|
2923
3056
|
type: "button",
|
|
2924
3057
|
className: "kjun-filter-chip",
|
|
2925
|
-
style: { borderRadius:
|
|
3058
|
+
style: { borderRadius: import_tokens18.tokens.button.radii[size] },
|
|
2926
3059
|
"aria-pressed": selected(option.value),
|
|
2927
3060
|
disabled: disabled || option.disabled,
|
|
2928
3061
|
onClick: () => {
|
|
@@ -2934,15 +3067,15 @@ function KjunFilterGroup({
|
|
|
2934
3067
|
"span",
|
|
2935
3068
|
{
|
|
2936
3069
|
style: {
|
|
2937
|
-
height:
|
|
2938
|
-
paddingInline: { xs:
|
|
3070
|
+
height: import_tokens18.tokens.button.heights[size],
|
|
3071
|
+
paddingInline: { xs: import_tokens18.tokens.dimension.value8, sm: import_tokens18.tokens.dimension.value12, md: import_tokens18.tokens.dimension.value12, lg: import_tokens18.tokens.dimension.value14, xl: import_tokens18.tokens.dimension.value16 }[size],
|
|
2939
3072
|
...selectionTypeStyle(size, selected(option.value))
|
|
2940
3073
|
},
|
|
2941
3074
|
children: [
|
|
2942
3075
|
option.dot && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", { style: { background: option.dot } }),
|
|
2943
|
-
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size:
|
|
3076
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KjunIcon, { name: option.icon, size: import_tokens18.tokens.extensions.selection.iconSize }),
|
|
2944
3077
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "kjun-filter-label", children: [
|
|
2945
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens18.tokens.button.typography[size]), children: option.label }),
|
|
2946
3079
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: option.label })
|
|
2947
3080
|
] })
|
|
2948
3081
|
]
|
|
@@ -2956,8 +3089,8 @@ function KjunFilterGroup({
|
|
|
2956
3089
|
}
|
|
2957
3090
|
|
|
2958
3091
|
// packages/react/src/floating-panel.tsx
|
|
2959
|
-
var
|
|
2960
|
-
var
|
|
3092
|
+
var import_tokens19 = require("@kjun-ui/tokens");
|
|
3093
|
+
var import_react27 = require("react");
|
|
2961
3094
|
var import_react_aria_components4 = require("react-aria-components");
|
|
2962
3095
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2963
3096
|
function FloatingPanel({
|
|
@@ -2975,18 +3108,18 @@ function FloatingPanel({
|
|
|
2975
3108
|
ownsDismiss = false,
|
|
2976
3109
|
returnFocus
|
|
2977
3110
|
}) {
|
|
2978
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3111
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens19.tokens.motion.popupExit);
|
|
2979
3112
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2980
3113
|
const container = useKjunPortalContainer();
|
|
2981
|
-
const panel = (0,
|
|
2982
|
-
(0,
|
|
3114
|
+
const panel = (0, import_react27.useRef)(null);
|
|
3115
|
+
(0, import_react27.useEffect)(() => {
|
|
2983
3116
|
var _a;
|
|
2984
3117
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2985
3118
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
2986
3119
|
const dismissBeforeFocus = (event) => {
|
|
2987
3120
|
var _a2, _b;
|
|
2988
3121
|
const popup = panel.current, focused = document2.activeElement;
|
|
2989
|
-
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0,
|
|
3122
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.repeat || (0, import_tokens19.isComposingKey)(event) || !popup || popup.closest('[inert], [aria-hidden="true"]')) return;
|
|
2990
3123
|
if (focused !== document2.body && focused !== document2.documentElement && !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(focused))) return;
|
|
2991
3124
|
event.preventDefault();
|
|
2992
3125
|
event.stopPropagation();
|
|
@@ -3011,9 +3144,9 @@ function FloatingPanel({
|
|
|
3011
3144
|
UNSTABLE_portalContainer: container,
|
|
3012
3145
|
placement: placement.replace("-", " "),
|
|
3013
3146
|
shouldFlip: flip,
|
|
3014
|
-
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ?
|
|
3015
|
-
offset: field ?
|
|
3016
|
-
containerPadding:
|
|
3147
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight : maxHeight == null ? field ? import_tokens19.tokens.extensions.menu.listMaxHeight : import_tokens19.tokens.extensions.floating.maxHeight : void 0,
|
|
3148
|
+
offset: field ? import_tokens19.tokens.extensions.floating.fieldGap : import_tokens19.tokens.extensions.floating.anchorGap,
|
|
3149
|
+
containerPadding: import_tokens19.tokens.extensions.floating.viewportInset,
|
|
3017
3150
|
className: "kjun-scope kjun-floating " + className,
|
|
3018
3151
|
"data-motion": "popup",
|
|
3019
3152
|
"data-motion-open": String(motion.active),
|
|
@@ -3026,10 +3159,11 @@ function FloatingPanel({
|
|
|
3026
3159
|
}
|
|
3027
3160
|
) });
|
|
3028
3161
|
}
|
|
3162
|
+
var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
|
|
3029
3163
|
|
|
3030
3164
|
// packages/react/src/popover.tsx
|
|
3031
|
-
var
|
|
3032
|
-
var
|
|
3165
|
+
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3166
|
+
var import_react28 = require("react");
|
|
3033
3167
|
var import_react_aria_components5 = require("react-aria-components");
|
|
3034
3168
|
|
|
3035
3169
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -3111,20 +3245,20 @@ function KjunPopover({
|
|
|
3111
3245
|
children
|
|
3112
3246
|
}) {
|
|
3113
3247
|
const m = useKjunMessages();
|
|
3114
|
-
const [internal, setInternal] = (0,
|
|
3248
|
+
const [internal, setInternal] = (0, import_react28.useState)(false), open = controlled != null ? controlled : internal, ref = (0, import_react28.useRef)(null), id = "kjun-" + (0, import_react28.useId)();
|
|
3115
3249
|
const expanded = usePopupExpanded(open, ref);
|
|
3116
|
-
const focusOnMount = (0,
|
|
3250
|
+
const focusOnMount = (0, import_react28.useRef)(focusOnOpen);
|
|
3117
3251
|
focusOnMount.current = focusOnOpen;
|
|
3118
|
-
const focusContent = (0,
|
|
3252
|
+
const focusContent = (0, import_react28.useCallback)((node) => {
|
|
3119
3253
|
if (node && focusOnMount.current) node.focus();
|
|
3120
3254
|
}, []);
|
|
3121
|
-
const resolveReturn =
|
|
3255
|
+
const resolveReturn = resolveFocusReturn(returnFocus);
|
|
3122
3256
|
const change = (v) => {
|
|
3123
3257
|
setInternal(v);
|
|
3124
3258
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
3125
3259
|
};
|
|
3126
|
-
const skipReturn = (0,
|
|
3127
|
-
(0,
|
|
3260
|
+
const skipReturn = (0, import_react28.useRef)(false);
|
|
3261
|
+
(0, import_react28.useEffect)(() => {
|
|
3128
3262
|
if (!open || modal) return;
|
|
3129
3263
|
skipReturn.current = false;
|
|
3130
3264
|
return installNonModalPopover({
|
|
@@ -3181,7 +3315,7 @@ function KjunPopover({
|
|
|
3181
3315
|
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || m.details,
|
|
3182
3316
|
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
3183
3317
|
className: "kjun-popover-dialog",
|
|
3184
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${
|
|
3318
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens20.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
3185
3319
|
};
|
|
3186
3320
|
const body = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3187
3321
|
header != null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
@@ -3203,7 +3337,7 @@ function KjunTooltip({
|
|
|
3203
3337
|
children
|
|
3204
3338
|
}) {
|
|
3205
3339
|
const container = useKjunPortalContainer();
|
|
3206
|
-
const [internal, setInternal] = (0,
|
|
3340
|
+
const [internal, setInternal] = (0, import_react28.useState)(false), open = controlled != null ? controlled : internal;
|
|
3207
3341
|
const setOpen = (value) => {
|
|
3208
3342
|
setInternal(value);
|
|
3209
3343
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
@@ -3217,10 +3351,10 @@ function KjunTooltip({
|
|
|
3217
3351
|
style: { zIndex: layer.zIndex },
|
|
3218
3352
|
UNSTABLE_portalContainer: container,
|
|
3219
3353
|
placement,
|
|
3220
|
-
offset:
|
|
3354
|
+
offset: import_tokens20.tokens.extensions.floating.anchorGap,
|
|
3221
3355
|
className: "kjun-scope kjun-tooltip",
|
|
3222
3356
|
children: [
|
|
3223
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width:
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: import_tokens20.tokens.extensions.tooltip.arrowSize, height: import_tokens20.tokens.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
3224
3358
|
content
|
|
3225
3359
|
]
|
|
3226
3360
|
}
|
|
@@ -3229,11 +3363,11 @@ function KjunTooltip({
|
|
|
3229
3363
|
}
|
|
3230
3364
|
|
|
3231
3365
|
// packages/react/src/dropdown.tsx
|
|
3232
|
-
var
|
|
3233
|
-
var
|
|
3366
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3367
|
+
var import_react29 = require("react");
|
|
3234
3368
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3235
3369
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3236
|
-
var DropdownContext = (0,
|
|
3370
|
+
var DropdownContext = (0, import_react29.createContext)(null);
|
|
3237
3371
|
function KjunDropdown({
|
|
3238
3372
|
disabled = false,
|
|
3239
3373
|
placement = "bottom-start",
|
|
@@ -3243,12 +3377,13 @@ function KjunDropdown({
|
|
|
3243
3377
|
trigger,
|
|
3244
3378
|
children,
|
|
3245
3379
|
onOpen,
|
|
3246
|
-
onClose
|
|
3380
|
+
onClose,
|
|
3381
|
+
returnFocus
|
|
3247
3382
|
}) {
|
|
3248
|
-
const [open, setOpen] = (0,
|
|
3249
|
-
const menuFocusCleanup = (0,
|
|
3383
|
+
const [open, setOpen] = (0, import_react29.useState)(false), currentOpen = (0, import_react29.useRef)(false), ref = (0, import_react29.useRef)(null), id = "kjun-" + (0, import_react29.useId)();
|
|
3384
|
+
const menuFocusCleanup = (0, import_react29.useRef)(() => {
|
|
3250
3385
|
});
|
|
3251
|
-
const bindMenu = (0,
|
|
3386
|
+
const bindMenu = (0, import_react29.useCallback)((menu) => {
|
|
3252
3387
|
menuFocusCleanup.current();
|
|
3253
3388
|
menuFocusCleanup.current = () => {
|
|
3254
3389
|
};
|
|
@@ -3270,19 +3405,19 @@ function KjunDropdown({
|
|
|
3270
3405
|
};
|
|
3271
3406
|
}, []);
|
|
3272
3407
|
let control = trigger;
|
|
3273
|
-
while ((0,
|
|
3408
|
+
while ((0, import_react29.isValidElement)(control) && control.type === KjunTooltip)
|
|
3274
3409
|
control = control.props.children;
|
|
3275
|
-
const unavailable = disabled || (0,
|
|
3276
|
-
const controlId = triggerId || (0,
|
|
3410
|
+
const unavailable = disabled || (0, import_react29.isValidElement)(control) && !!(control.props.disabled || control.props.loading);
|
|
3411
|
+
const controlId = triggerId || (0, import_react29.isValidElement)(control) && control.props.id || id;
|
|
3277
3412
|
const popupId = menuId || id + "-menu";
|
|
3278
3413
|
const bindTrigger = (node) => {
|
|
3279
|
-
if (!(0,
|
|
3414
|
+
if (!(0, import_react29.isValidElement)(node)) return node;
|
|
3280
3415
|
if (node.type === KjunTooltip) {
|
|
3281
3416
|
const tooltip = node;
|
|
3282
|
-
return (0,
|
|
3417
|
+
return (0, import_react29.cloneElement)(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
3283
3418
|
}
|
|
3284
3419
|
const button = node;
|
|
3285
|
-
return (0,
|
|
3420
|
+
return (0, import_react29.cloneElement)(button, {
|
|
3286
3421
|
id: controlId,
|
|
3287
3422
|
"aria-haspopup": "menu",
|
|
3288
3423
|
"aria-expanded": open,
|
|
@@ -3299,7 +3434,7 @@ function KjunDropdown({
|
|
|
3299
3434
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
3300
3435
|
else onClose == null ? void 0 : onClose();
|
|
3301
3436
|
};
|
|
3302
|
-
(0,
|
|
3437
|
+
(0, import_react29.useEffect)(() => {
|
|
3303
3438
|
if (unavailable) change(false);
|
|
3304
3439
|
}, [unavailable]);
|
|
3305
3440
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -3323,6 +3458,7 @@ function KjunDropdown({
|
|
|
3323
3458
|
{
|
|
3324
3459
|
open,
|
|
3325
3460
|
onOpenChange: change,
|
|
3461
|
+
returnFocus: resolveFocusReturn(returnFocus),
|
|
3326
3462
|
triggerRef: ref,
|
|
3327
3463
|
placement,
|
|
3328
3464
|
className: "kjun-dropdown",
|
|
@@ -3352,8 +3488,8 @@ function KjunDropdownItem({
|
|
|
3352
3488
|
children,
|
|
3353
3489
|
onClick
|
|
3354
3490
|
}) {
|
|
3355
|
-
const close = (0,
|
|
3356
|
-
const node = (0,
|
|
3491
|
+
const close = (0, import_react29.useContext)(DropdownContext);
|
|
3492
|
+
const node = (0, import_react29.useCallback)((element) => {
|
|
3357
3493
|
if (!element) return;
|
|
3358
3494
|
if (selected === null) {
|
|
3359
3495
|
element.setAttribute("role", "menuitem");
|
|
@@ -3378,14 +3514,14 @@ function KjunDropdownItem({
|
|
|
3378
3514
|
close == null ? void 0 : close();
|
|
3379
3515
|
},
|
|
3380
3516
|
children: [
|
|
3381
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size:
|
|
3517
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size: import_tokens21.tokens.extensions.menu.iconSize }),
|
|
3382
3518
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children }),
|
|
3383
3519
|
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3384
3520
|
KjunIcon,
|
|
3385
3521
|
{
|
|
3386
3522
|
name: "check",
|
|
3387
3523
|
className: "kjun-menu-check",
|
|
3388
|
-
size:
|
|
3524
|
+
size: import_tokens21.tokens.extensions.menu.iconSize,
|
|
3389
3525
|
style: { visibility: selected ? "visible" : "hidden" }
|
|
3390
3526
|
}
|
|
3391
3527
|
)
|
|
@@ -3411,7 +3547,7 @@ function KjunMenuButton({
|
|
|
3411
3547
|
...props
|
|
3412
3548
|
}) {
|
|
3413
3549
|
const m = useKjunMessages();
|
|
3414
|
-
const [open, setOpen] = (0,
|
|
3550
|
+
const [open, setOpen] = (0, import_react29.useState)(false);
|
|
3415
3551
|
const button = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3416
3552
|
KjunButton,
|
|
3417
3553
|
{
|
|
@@ -3452,7 +3588,7 @@ function KjunMenuButton({
|
|
|
3452
3588
|
}
|
|
3453
3589
|
|
|
3454
3590
|
// packages/react/src/drawer.tsx
|
|
3455
|
-
var
|
|
3591
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3456
3592
|
|
|
3457
3593
|
// shared/package-runtime/drawer-geometry.ts
|
|
3458
3594
|
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
@@ -3471,7 +3607,7 @@ function KjunDrawer({
|
|
|
3471
3607
|
onOpenChange,
|
|
3472
3608
|
title,
|
|
3473
3609
|
position = "right",
|
|
3474
|
-
width =
|
|
3610
|
+
width = import_tokens22.tokens.extensions.drawer.width,
|
|
3475
3611
|
closable = true,
|
|
3476
3612
|
closeOnOverlay = true,
|
|
3477
3613
|
closeOnEsc = true,
|
|
@@ -3480,13 +3616,15 @@ function KjunDrawer({
|
|
|
3480
3616
|
footer,
|
|
3481
3617
|
children,
|
|
3482
3618
|
onClose,
|
|
3619
|
+
onAfterClose,
|
|
3483
3620
|
ariaLabel,
|
|
3484
3621
|
safeAreaTop = 0,
|
|
3485
3622
|
safeAreaBottom = 0,
|
|
3486
3623
|
maxHeight
|
|
3487
3624
|
}) {
|
|
3488
3625
|
const m = useKjunMessages();
|
|
3489
|
-
const motion = usePresence(open, useReducedMotion(),
|
|
3626
|
+
const motion = usePresence(open, useReducedMotion(), import_tokens22.tokens.motion.layerExit);
|
|
3627
|
+
const afterCloseRef = useAfterCloseRef(open, onAfterClose);
|
|
3490
3628
|
const container = useKjunPortalContainer();
|
|
3491
3629
|
const close = () => {
|
|
3492
3630
|
if (!open) return;
|
|
@@ -3500,6 +3638,7 @@ function KjunDrawer({
|
|
|
3500
3638
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3501
3639
|
import_react_aria_components7.ModalOverlay,
|
|
3502
3640
|
{
|
|
3641
|
+
ref: afterCloseRef,
|
|
3503
3642
|
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
3504
3643
|
isOpen: motion.present && layer.active,
|
|
3505
3644
|
isExiting: motion.present && !layer.active,
|
|
@@ -3541,8 +3680,8 @@ function KjunDrawer({
|
|
|
3541
3680
|
variant: "ghost",
|
|
3542
3681
|
ariaLabel: m.close,
|
|
3543
3682
|
onClick: close,
|
|
3544
|
-
style: { borderRadius:
|
|
3545
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size:
|
|
3683
|
+
style: { borderRadius: import_tokens22.tokens.extensions.drawer.closeRadius, width: import_tokens22.tokens.extensions.drawer.closeSize, height: import_tokens22.tokens.extensions.drawer.closeSize, padding: 0 },
|
|
3684
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", size: import_tokens22.tokens.extensions.drawer.closeIconSize })
|
|
3546
3685
|
}
|
|
3547
3686
|
)
|
|
3548
3687
|
] }),
|
|
@@ -3550,7 +3689,7 @@ function KjunDrawer({
|
|
|
3550
3689
|
"div",
|
|
3551
3690
|
{
|
|
3552
3691
|
className: "kjun-drawer-body",
|
|
3553
|
-
style: { padding: noPadding ? 0 :
|
|
3692
|
+
style: { padding: noPadding ? 0 : import_tokens22.tokens.extensions.drawer.bodyPadding },
|
|
3554
3693
|
children
|
|
3555
3694
|
}
|
|
3556
3695
|
),
|
|
@@ -3566,7 +3705,7 @@ function KjunDrawer({
|
|
|
3566
3705
|
}
|
|
3567
3706
|
|
|
3568
3707
|
// shared/package-runtime/combobox.ts
|
|
3569
|
-
var
|
|
3708
|
+
var import_react30 = require("react");
|
|
3570
3709
|
|
|
3571
3710
|
// shared/package-runtime/options.ts
|
|
3572
3711
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3644,10 +3783,10 @@ function useComboboxModel({
|
|
|
3644
3783
|
}) {
|
|
3645
3784
|
const selected = options.find((option) => optionValue(option, valueKey) === value);
|
|
3646
3785
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3647
|
-
const [query2, setQuery] = (0,
|
|
3648
|
-
const [open, setOpen] = (0,
|
|
3649
|
-
(0,
|
|
3650
|
-
(0,
|
|
3786
|
+
const [query2, setQuery] = (0, import_react30.useState)(selectedLabel);
|
|
3787
|
+
const [open, setOpen] = (0, import_react30.useState)(false);
|
|
3788
|
+
(0, import_react30.useEffect)(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3789
|
+
(0, import_react30.useEffect)(() => {
|
|
3651
3790
|
if (disabled) setOpen(false);
|
|
3652
3791
|
}, [disabled]);
|
|
3653
3792
|
const change = (next) => {
|
|
@@ -3680,7 +3819,7 @@ function useComboboxModel({
|
|
|
3680
3819
|
}
|
|
3681
3820
|
|
|
3682
3821
|
// packages/react/src/combobox.tsx
|
|
3683
|
-
var
|
|
3822
|
+
var import_react31 = require("react");
|
|
3684
3823
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3685
3824
|
function KjunCombobox({
|
|
3686
3825
|
value,
|
|
@@ -3699,7 +3838,8 @@ function KjunCombobox({
|
|
|
3699
3838
|
onValueChange,
|
|
3700
3839
|
onChange,
|
|
3701
3840
|
onSearch,
|
|
3702
|
-
onClear
|
|
3841
|
+
onClear,
|
|
3842
|
+
returnFocus
|
|
3703
3843
|
}) {
|
|
3704
3844
|
const m = useKjunMessages();
|
|
3705
3845
|
placeholder != null ? placeholder : placeholder = m.searchOrSelect;
|
|
@@ -3735,7 +3875,8 @@ function KjunCombobox({
|
|
|
3735
3875
|
renderOption,
|
|
3736
3876
|
onValueChange: (v) => model.search(v, true),
|
|
3737
3877
|
onSelect: model.select,
|
|
3738
|
-
onClear: model.clear
|
|
3878
|
+
onClear: model.clear,
|
|
3879
|
+
returnFocus: resolveFocusReturn(returnFocus)
|
|
3739
3880
|
}
|
|
3740
3881
|
);
|
|
3741
3882
|
}
|
|
@@ -3760,16 +3901,17 @@ function SearchField({
|
|
|
3760
3901
|
onValueChange,
|
|
3761
3902
|
onSelect,
|
|
3762
3903
|
onClear,
|
|
3763
|
-
onEnter
|
|
3904
|
+
onEnter,
|
|
3905
|
+
returnFocus
|
|
3764
3906
|
}) {
|
|
3765
3907
|
const m = useKjunMessages();
|
|
3766
3908
|
const composition = useCompositionGuard();
|
|
3767
|
-
const clearing = (0,
|
|
3768
|
-
const ref = (0,
|
|
3909
|
+
const clearing = (0, import_react31.useRef)(false);
|
|
3910
|
+
const ref = (0, import_react31.useRef)(null), [highlighted, setActive] = (0, import_react31.useState)(-1), id = "kjun-" + (0, import_react31.useId)();
|
|
3769
3911
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3770
3912
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3771
|
-
(0,
|
|
3772
|
-
(0,
|
|
3913
|
+
(0, import_react31.useEffect)(() => setActive(-1), [value, options.length]);
|
|
3914
|
+
(0, import_react31.useEffect)(() => {
|
|
3773
3915
|
if (!open) return;
|
|
3774
3916
|
const leaveField = (event) => {
|
|
3775
3917
|
var _a, _b, _c;
|
|
@@ -3779,16 +3921,16 @@ function SearchField({
|
|
|
3779
3921
|
document.addEventListener("focusin", leaveField);
|
|
3780
3922
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3781
3923
|
}, [open, onOpenChange, id]);
|
|
3782
|
-
(0,
|
|
3924
|
+
(0, import_react31.useEffect)(() => {
|
|
3783
3925
|
if (highlighted !== active) setActive(-1);
|
|
3784
3926
|
}, [highlighted, active]);
|
|
3785
3927
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
3786
3928
|
const select = (o) => {
|
|
3787
|
-
var _a;
|
|
3929
|
+
var _a, _b;
|
|
3788
3930
|
if (o === void 0 || disabled || loading || optionDisabled(o)) return;
|
|
3789
3931
|
onSelect(o);
|
|
3790
3932
|
onOpenChange(false);
|
|
3791
|
-
(_a = ref.current) == null ? void 0 :
|
|
3933
|
+
(_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
|
|
3792
3934
|
};
|
|
3793
3935
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3794
3936
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -3836,7 +3978,7 @@ function SearchField({
|
|
|
3836
3978
|
onCompositionStart: composition.onCompositionStart,
|
|
3837
3979
|
onCompositionEnd: composition.onCompositionEnd,
|
|
3838
3980
|
onKeyDown: (e) => {
|
|
3839
|
-
var _a, _b, _c, _d;
|
|
3981
|
+
var _a, _b, _c, _d, _e;
|
|
3840
3982
|
if (composition.isComposing(e)) return;
|
|
3841
3983
|
let next = active;
|
|
3842
3984
|
if (e.key === "ArrowDown") {
|
|
@@ -3859,10 +4001,11 @@ function SearchField({
|
|
|
3859
4001
|
e.preventDefault();
|
|
3860
4002
|
e.stopPropagation();
|
|
3861
4003
|
onOpenChange(false);
|
|
4004
|
+
(_d = returnFocus == null ? void 0 : returnFocus()) == null ? void 0 : _d.focus();
|
|
3862
4005
|
}
|
|
3863
4006
|
setActive(next);
|
|
3864
4007
|
if (next >= 0)
|
|
3865
|
-
(
|
|
4008
|
+
(_e = document.getElementById(id + "-" + next)) == null ? void 0 : _e.scrollIntoView({ block: "nearest" });
|
|
3866
4009
|
}
|
|
3867
4010
|
}
|
|
3868
4011
|
),
|
|
@@ -3911,8 +4054,8 @@ function SearchField({
|
|
|
3911
4054
|
}
|
|
3912
4055
|
|
|
3913
4056
|
// packages/react/src/date-picker.tsx
|
|
3914
|
-
var
|
|
3915
|
-
var
|
|
4057
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
4058
|
+
var import_react32 = require("react");
|
|
3916
4059
|
var import_jsx_runtime20 = (
|
|
3917
4060
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3918
4061
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
@@ -3932,12 +4075,12 @@ function KjunDatePicker({
|
|
|
3932
4075
|
}) {
|
|
3933
4076
|
const scope = useKjunMessageScope();
|
|
3934
4077
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
3935
|
-
const [focus, setFocus] = (0,
|
|
4078
|
+
const [focus, setFocus] = (0, import_react32.useState)(false);
|
|
3936
4079
|
const clear = clearable && !!value && !props.disabled && !props.readOnly;
|
|
3937
4080
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
3938
4081
|
position: "relative",
|
|
3939
|
-
["--_kjun-date-icon-inset"]:
|
|
3940
|
-
["--_kjun-date-icon-size"]:
|
|
4082
|
+
["--_kjun-date-icon-inset"]: import_tokens23.tokens.input[size].padding + "px",
|
|
4083
|
+
["--_kjun-date-icon-size"]: import_tokens23.tokens.input[size].iconSize + "px"
|
|
3941
4084
|
}, children: [
|
|
3942
4085
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3943
4086
|
KjunInput,
|
|
@@ -3967,8 +4110,8 @@ function KjunDatePicker({
|
|
|
3967
4110
|
"aria-hidden": "true",
|
|
3968
4111
|
className: "kjun-date-overlay",
|
|
3969
4112
|
style: {
|
|
3970
|
-
left:
|
|
3971
|
-
right:
|
|
4113
|
+
left: import_tokens23.tokens.input[size].padding,
|
|
4114
|
+
right: import_tokens23.tokens.input[size].padding + import_tokens23.tokens.input[size].iconSize + import_tokens23.tokens.input[size].affixGap + (clear ? import_tokens23.tokens.input[size].clearSize + import_tokens23.tokens.input[size].affixGap : 0),
|
|
3972
4115
|
...inputTypeStyle(size),
|
|
3973
4116
|
color: props.disabled ? "var(--_kjun-color-text-disabled)" : props.readOnly ? "var(--_kjun-color-text-secondary)" : value ? "var(--_kjun-color-text)" : "var(--_kjun-color-input-placeholder)"
|
|
3974
4117
|
},
|
|
@@ -3984,24 +4127,24 @@ function KjunDatePicker({
|
|
|
3984
4127
|
className: "kjun-select-clear",
|
|
3985
4128
|
style: {
|
|
3986
4129
|
padding: 0,
|
|
3987
|
-
right:
|
|
3988
|
-
width:
|
|
3989
|
-
height:
|
|
3990
|
-
minHeight:
|
|
4130
|
+
right: import_tokens23.tokens.input[size].padding + import_tokens23.tokens.input[size].iconSize + import_tokens23.tokens.input[size].affixGap,
|
|
4131
|
+
width: import_tokens23.tokens.input[size].clearSize,
|
|
4132
|
+
height: import_tokens23.tokens.input[size].clearSize,
|
|
4133
|
+
minHeight: import_tokens23.tokens.input[size].clearSize,
|
|
3991
4134
|
borderRadius: "50%"
|
|
3992
4135
|
},
|
|
3993
4136
|
onClick: () => onValueChange == null ? void 0 : onValueChange(""),
|
|
3994
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size:
|
|
4137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KjunIcon, { name: "x", size: import_tokens23.tokens.input[size].iconSize })
|
|
3995
4138
|
}
|
|
3996
4139
|
)
|
|
3997
4140
|
] });
|
|
3998
4141
|
}
|
|
3999
4142
|
|
|
4000
4143
|
// packages/react/src/search-input.tsx
|
|
4001
|
-
var
|
|
4144
|
+
var import_react34 = require("react");
|
|
4002
4145
|
|
|
4003
4146
|
// shared/package-runtime/search-input.ts
|
|
4004
|
-
var
|
|
4147
|
+
var import_react33 = require("react");
|
|
4005
4148
|
function useSearchInputModel({
|
|
4006
4149
|
value,
|
|
4007
4150
|
disabled = false,
|
|
@@ -4011,20 +4154,20 @@ function useSearchInputModel({
|
|
|
4011
4154
|
onValueChange,
|
|
4012
4155
|
onSearchError
|
|
4013
4156
|
}, open) {
|
|
4014
|
-
const [query2, setQuery] = (0,
|
|
4157
|
+
const [query2, setQuery] = (0, import_react33.useState)(value), [options, setOptions] = (0, import_react33.useState)([]), [loading, setLoading] = (0, import_react33.useState)(false), [failed, setFailed] = (0, import_react33.useState)(false), version = (0, import_react33.useRef)(0), notify = (0, import_react33.useRef)(onSearchError);
|
|
4015
4158
|
notify.current = onSearchError;
|
|
4016
|
-
const timer = (0,
|
|
4017
|
-
const notifyValue = (0,
|
|
4159
|
+
const timer = (0, import_react33.useRef)(void 0);
|
|
4160
|
+
const notifyValue = (0, import_react33.useRef)(onValueChange);
|
|
4018
4161
|
notifyValue.current = onValueChange;
|
|
4019
|
-
(0,
|
|
4162
|
+
(0, import_react33.useLayoutEffect)(() => {
|
|
4020
4163
|
clearTimeout(timer.current);
|
|
4021
4164
|
setQuery(value);
|
|
4022
4165
|
}, [value]);
|
|
4023
|
-
(0,
|
|
4166
|
+
(0, import_react33.useLayoutEffect)(() => {
|
|
4024
4167
|
clearTimeout(timer.current);
|
|
4025
4168
|
return () => clearTimeout(timer.current);
|
|
4026
4169
|
}, [disabled, debounce, !!loadOptions]);
|
|
4027
|
-
(0,
|
|
4170
|
+
(0, import_react33.useEffect)(() => {
|
|
4028
4171
|
const current = ++version.current, abort = new AbortController();
|
|
4029
4172
|
setFailed(false);
|
|
4030
4173
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -4115,7 +4258,7 @@ function KjunSearchInput({
|
|
|
4115
4258
|
placeholder != null ? placeholder : placeholder = m.search;
|
|
4116
4259
|
emptyText != null ? emptyText : emptyText = m.noResults;
|
|
4117
4260
|
errorText != null ? errorText : errorText = m.searchFailed;
|
|
4118
|
-
const [open, setOpen] = (0,
|
|
4261
|
+
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
4119
4262
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
4120
4263
|
const { query: query2, options, loading, failed } = model;
|
|
4121
4264
|
const update = (value2) => {
|
|
@@ -4177,21 +4320,21 @@ function KjunSearchInput({
|
|
|
4177
4320
|
}
|
|
4178
4321
|
|
|
4179
4322
|
// packages/react/src/select-control.tsx
|
|
4180
|
-
var
|
|
4181
|
-
var
|
|
4323
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
4324
|
+
var import_react37 = require("react");
|
|
4182
4325
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4183
4326
|
|
|
4184
4327
|
// shared/package-runtime/select.ts
|
|
4185
|
-
var
|
|
4328
|
+
var import_react35 = require("react");
|
|
4186
4329
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
4187
|
-
const [internal, setInternal] = (0,
|
|
4188
|
-
const [query2, setQuery] = (0,
|
|
4189
|
-
const [limit, setLimit] = (0,
|
|
4190
|
-
const [session, setSession] = (0,
|
|
4330
|
+
const [internal, setInternal] = (0, import_react35.useState)(false);
|
|
4331
|
+
const [query2, setQuery] = (0, import_react35.useState)("");
|
|
4332
|
+
const [limit, setLimit] = (0, import_react35.useState)(pageSize);
|
|
4333
|
+
const [session, setSession] = (0, import_react35.useState)(0);
|
|
4191
4334
|
const isControlled = typeof controlled === "boolean";
|
|
4192
4335
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
4193
|
-
const previousOpen = (0,
|
|
4194
|
-
(0,
|
|
4336
|
+
const previousOpen = (0, import_react35.useRef)(open);
|
|
4337
|
+
(0, import_react35.useEffect)(() => {
|
|
4195
4338
|
if (disabled && !isControlled) setInternal(false);
|
|
4196
4339
|
if (previousOpen.current && !open) {
|
|
4197
4340
|
setQuery("");
|
|
@@ -4200,7 +4343,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4200
4343
|
}
|
|
4201
4344
|
previousOpen.current = open;
|
|
4202
4345
|
}, [open, disabled, isControlled, pageSize]);
|
|
4203
|
-
(0,
|
|
4346
|
+
(0, import_react35.useEffect)(() => {
|
|
4204
4347
|
setLimit(pageSize);
|
|
4205
4348
|
}, [pageSize]);
|
|
4206
4349
|
const changeOpen = (next) => {
|
|
@@ -4216,8 +4359,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
4216
4359
|
}
|
|
4217
4360
|
|
|
4218
4361
|
// packages/react/src/compound-control.ts
|
|
4219
|
-
var
|
|
4220
|
-
var CompoundControlContext = (0,
|
|
4362
|
+
var import_react36 = require("react");
|
|
4363
|
+
var CompoundControlContext = (0, import_react36.createContext)(null);
|
|
4221
4364
|
|
|
4222
4365
|
// packages/react/src/select-control.tsx
|
|
4223
4366
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -4249,24 +4392,25 @@ function KjunSelect({
|
|
|
4249
4392
|
onSearch,
|
|
4250
4393
|
onClear,
|
|
4251
4394
|
filterFn,
|
|
4252
|
-
searchKeys
|
|
4395
|
+
searchKeys,
|
|
4396
|
+
returnFocus
|
|
4253
4397
|
}) {
|
|
4254
4398
|
const m = useKjunMessages();
|
|
4255
4399
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
4256
4400
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
4257
4401
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
4258
4402
|
const composition = useCompositionGuard();
|
|
4259
|
-
const ref = (0,
|
|
4260
|
-
const segment = (0,
|
|
4261
|
-
const spec =
|
|
4403
|
+
const ref = (0, import_react37.useRef)(null), menu = (0, import_react37.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react37.useId)();
|
|
4404
|
+
const segment = (0, import_react37.useContext)(CompoundControlContext) !== null;
|
|
4405
|
+
const spec = import_tokens24.tokens.input[size];
|
|
4262
4406
|
const expanded = usePopupExpanded(open, ref);
|
|
4263
4407
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
4264
|
-
(0,
|
|
4408
|
+
(0, import_react37.useEffect)(() => {
|
|
4265
4409
|
if (!registerControl || !triggerId) return;
|
|
4266
4410
|
registerControl(triggerId);
|
|
4267
4411
|
return () => registerControl(void 0);
|
|
4268
4412
|
}, [registerControl, triggerId]);
|
|
4269
|
-
(0,
|
|
4413
|
+
(0, import_react37.useEffect)(() => {
|
|
4270
4414
|
var _a, _b;
|
|
4271
4415
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
4272
4416
|
if (!open) composition.onCompositionEnd();
|
|
@@ -4312,7 +4456,7 @@ function KjunSelect({
|
|
|
4312
4456
|
borderRadius: spec.radius,
|
|
4313
4457
|
...inputTypeStyle(size),
|
|
4314
4458
|
// Time segments take their padding from compound-controls.css, which also aligns the first value.
|
|
4315
|
-
...segment ? {} : { paddingInline: spec.padding -
|
|
4459
|
+
...segment ? {} : { paddingInline: spec.padding - import_tokens24.tokens.border.controlWidth }
|
|
4316
4460
|
},
|
|
4317
4461
|
onClick: () => changeOpen(!open),
|
|
4318
4462
|
onKeyDown: (e) => {
|
|
@@ -4323,7 +4467,7 @@ function KjunSelect({
|
|
|
4323
4467
|
},
|
|
4324
4468
|
children: [
|
|
4325
4469
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: !label ? "kjun-placeholder" : void 0, style: { flex: 1, paddingRight: clearable && label ? spec.clearSize + spec.affixGap : void 0 }, children: (renderSelected == null ? void 0 : renderSelected(selectedOption)) || label || placeholder }),
|
|
4326
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ?
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? import_tokens24.tokens.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
4327
4471
|
]
|
|
4328
4472
|
}
|
|
4329
4473
|
),
|
|
@@ -4358,6 +4502,7 @@ function KjunSelect({
|
|
|
4358
4502
|
{
|
|
4359
4503
|
field: true,
|
|
4360
4504
|
open,
|
|
4505
|
+
returnFocus: resolveFocusReturn(returnFocus),
|
|
4361
4506
|
onOpenChange: changeOpen,
|
|
4362
4507
|
triggerRef: ref,
|
|
4363
4508
|
placement: "bottom-start",
|
|
@@ -4427,7 +4572,7 @@ function KjunSelect({
|
|
|
4427
4572
|
className: "kjun-option",
|
|
4428
4573
|
children: [
|
|
4429
4574
|
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4430
|
-
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size:
|
|
4575
|
+
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(KjunIcon, { name: "check", size: import_tokens24.tokens.extensions.menu.iconSize })
|
|
4431
4576
|
]
|
|
4432
4577
|
},
|
|
4433
4578
|
key
|
|
@@ -4453,21 +4598,23 @@ function KjunSelect({
|
|
|
4453
4598
|
}
|
|
4454
4599
|
|
|
4455
4600
|
// packages/react/src/navigation.tsx
|
|
4456
|
-
var
|
|
4601
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4457
4602
|
|
|
4458
4603
|
// packages/react/src/collapse.tsx
|
|
4459
|
-
var
|
|
4460
|
-
var
|
|
4604
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4605
|
+
var import_react38 = require("react");
|
|
4461
4606
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4462
|
-
function Collapse({ open, children }) {
|
|
4607
|
+
function Collapse({ open, keepMounted = false, children }) {
|
|
4463
4608
|
const reduced = useReducedMotion();
|
|
4464
|
-
const [retained, setRetained] = (0,
|
|
4465
|
-
const root = (0,
|
|
4466
|
-
const animation = (0,
|
|
4467
|
-
const previous = (0,
|
|
4468
|
-
const interrupted = (0,
|
|
4469
|
-
const
|
|
4470
|
-
|
|
4609
|
+
const [retained, setRetained] = (0, import_react38.useState)(open);
|
|
4610
|
+
const root = (0, import_react38.useRef)(null), body = (0, import_react38.useRef)(null);
|
|
4611
|
+
const animation = (0, import_react38.useRef)(null);
|
|
4612
|
+
const previous = (0, import_react38.useRef)(open);
|
|
4613
|
+
const interrupted = (0, import_react38.useRef)(null);
|
|
4614
|
+
const opened = (0, import_react38.useRef)(open);
|
|
4615
|
+
if (open) opened.current = true;
|
|
4616
|
+
const present = open || retained || keepMounted && opened.current;
|
|
4617
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
4471
4618
|
const el = root.current, inner = body.current;
|
|
4472
4619
|
if (!el || !inner) return;
|
|
4473
4620
|
let disposed = false;
|
|
@@ -4492,8 +4639,8 @@ function Collapse({ open, children }) {
|
|
|
4492
4639
|
}
|
|
4493
4640
|
el.style.height = end + "px";
|
|
4494
4641
|
const transition = el.animate([{ height: start + "px" }, { height: end + "px" }], {
|
|
4495
|
-
duration:
|
|
4496
|
-
easing:
|
|
4642
|
+
duration: import_tokens25.tokens.motion.collapse,
|
|
4643
|
+
easing: import_tokens25.tokens.motion.easeOut
|
|
4497
4644
|
});
|
|
4498
4645
|
animation.current = transition;
|
|
4499
4646
|
transition.onfinish = finish;
|
|
@@ -4522,10 +4669,10 @@ function Collapse({ open, children }) {
|
|
|
4522
4669
|
}
|
|
4523
4670
|
|
|
4524
4671
|
// shared/package-runtime/navigation.ts
|
|
4525
|
-
var
|
|
4672
|
+
var import_react39 = require("react");
|
|
4526
4673
|
function useInitialTab(value, candidate, change) {
|
|
4527
|
-
const requested = (0,
|
|
4528
|
-
(0,
|
|
4674
|
+
const requested = (0, import_react39.useRef)(/* @__PURE__ */ new Set());
|
|
4675
|
+
(0, import_react39.useEffect)(() => {
|
|
4529
4676
|
if (value !== "") {
|
|
4530
4677
|
requested.current.clear();
|
|
4531
4678
|
return;
|
|
@@ -4536,8 +4683,8 @@ function useInitialTab(value, candidate, change) {
|
|
|
4536
4683
|
}, [value, candidate, change]);
|
|
4537
4684
|
}
|
|
4538
4685
|
function useAccordionState(multiple) {
|
|
4539
|
-
const [opened, setOpened] = (0,
|
|
4540
|
-
(0,
|
|
4686
|
+
const [opened, setOpened] = (0, import_react39.useState)(/* @__PURE__ */ new Set());
|
|
4687
|
+
(0, import_react39.useEffect)(() => {
|
|
4541
4688
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4542
4689
|
}, [multiple]);
|
|
4543
4690
|
return {
|
|
@@ -4621,7 +4768,7 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4621
4768
|
}
|
|
4622
4769
|
|
|
4623
4770
|
// packages/react/src/navigation.tsx
|
|
4624
|
-
var
|
|
4771
|
+
var import_react40 = require("react");
|
|
4625
4772
|
var import_react_aria_components9 = require("react-aria-components");
|
|
4626
4773
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4627
4774
|
function KjunTabs({
|
|
@@ -4640,33 +4787,33 @@ function KjunTabs({
|
|
|
4640
4787
|
const m = useKjunMessages();
|
|
4641
4788
|
ariaLabel != null ? ariaLabel : ariaLabel = m.tabs;
|
|
4642
4789
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4643
|
-
const panes =
|
|
4644
|
-
|
|
4790
|
+
const panes = import_react40.Children.toArray(children).filter(
|
|
4791
|
+
import_react40.isValidElement
|
|
4645
4792
|
);
|
|
4646
4793
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4647
|
-
(0,
|
|
4794
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4648
4795
|
var _a2;
|
|
4649
4796
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4650
4797
|
if (list) return manageTabList(list, () => {
|
|
4651
4798
|
}, false);
|
|
4652
4799
|
}, [group]);
|
|
4653
|
-
(0,
|
|
4800
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4654
4801
|
var _a2;
|
|
4655
4802
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4656
4803
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4657
4804
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4658
4805
|
}
|
|
4659
4806
|
});
|
|
4660
|
-
const timer = (0,
|
|
4661
|
-
const menuState = (0,
|
|
4807
|
+
const timer = (0, import_react40.useRef)(void 0), press = (0, import_react40.useRef)(null);
|
|
4808
|
+
const menuState = (0, import_react40.useRef)({ tabs, onTabMenu });
|
|
4662
4809
|
menuState.current = { tabs, onTabMenu };
|
|
4663
4810
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4664
4811
|
const clear = () => {
|
|
4665
4812
|
clearTimeout(timer.current);
|
|
4666
4813
|
press.current = null;
|
|
4667
4814
|
};
|
|
4668
|
-
(0,
|
|
4669
|
-
(0,
|
|
4815
|
+
(0, import_react40.useEffect)(() => clear, []);
|
|
4816
|
+
(0, import_react40.useLayoutEffect)(() => {
|
|
4670
4817
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4671
4818
|
}, [tabs, onTabMenu]);
|
|
4672
4819
|
const change = (name) => {
|
|
@@ -4725,7 +4872,7 @@ function KjunTabs({
|
|
|
4725
4872
|
onTouchEnd: clear,
|
|
4726
4873
|
onTouchCancel: clear,
|
|
4727
4874
|
children: [
|
|
4728
|
-
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: tab.icon, size:
|
|
4875
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: tab.icon, size: import_tokens26.tokens.extensions.tabs.iconSize }),
|
|
4729
4876
|
" ",
|
|
4730
4877
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: tab.label }) }),
|
|
4731
4878
|
tab.badge != null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4763,7 +4910,7 @@ function KjunTabPane({ name, children }) {
|
|
|
4763
4910
|
}
|
|
4764
4911
|
);
|
|
4765
4912
|
}
|
|
4766
|
-
var AccordionContext = (0,
|
|
4913
|
+
var AccordionContext = (0, import_react40.createContext)(null);
|
|
4767
4914
|
function KjunAccordion({
|
|
4768
4915
|
multiple = false,
|
|
4769
4916
|
tone = "card",
|
|
@@ -4783,12 +4930,30 @@ function KjunAccordionItem({
|
|
|
4783
4930
|
defaultOpen = false,
|
|
4784
4931
|
disabled = false,
|
|
4785
4932
|
header,
|
|
4933
|
+
open: openProp,
|
|
4934
|
+
onOpenChange,
|
|
4935
|
+
keepMounted = false,
|
|
4786
4936
|
children
|
|
4787
4937
|
}) {
|
|
4788
|
-
const
|
|
4789
|
-
(0,
|
|
4938
|
+
const controlled = openProp !== void 0, context = (0, import_react40.useContext)(AccordionContext), group = controlled ? null : context, id = "kjun-" + (0, import_react40.useId)(), [own, setOwn] = (0, import_react40.useState)(defaultOpen), open = controlled ? openProp : group ? group.opened.has(id) : own;
|
|
4939
|
+
(0, import_react40.useEffect)(() => {
|
|
4790
4940
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4791
4941
|
}, []);
|
|
4942
|
+
const reported = (0, import_react40.useRef)(open), notify = (0, import_react40.useRef)(onOpenChange), registering = (0, import_react40.useRef)(!!group && defaultOpen);
|
|
4943
|
+
notify.current = onOpenChange;
|
|
4944
|
+
(0, import_react40.useEffect)(() => {
|
|
4945
|
+
var _a;
|
|
4946
|
+
if (registering.current) {
|
|
4947
|
+
if (open) {
|
|
4948
|
+
registering.current = false;
|
|
4949
|
+
reported.current = open;
|
|
4950
|
+
}
|
|
4951
|
+
return;
|
|
4952
|
+
}
|
|
4953
|
+
if (controlled || reported.current === open) return;
|
|
4954
|
+
reported.current = open;
|
|
4955
|
+
(_a = notify.current) == null ? void 0 : _a.call(notify, open);
|
|
4956
|
+
}, [open, controlled]);
|
|
4792
4957
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "kjun-accordion-item", children: [
|
|
4793
4958
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4794
4959
|
"button",
|
|
@@ -4799,7 +4964,10 @@ function KjunAccordionItem({
|
|
|
4799
4964
|
"aria-expanded": open,
|
|
4800
4965
|
"aria-controls": id + "-panel",
|
|
4801
4966
|
className: "kjun-accordion-trigger",
|
|
4802
|
-
onClick: () =>
|
|
4967
|
+
onClick: () => {
|
|
4968
|
+
registering.current = false;
|
|
4969
|
+
controlled ? onOpenChange == null ? void 0 : onOpenChange(!open) : group ? group.toggle(id) : setOwn(!own);
|
|
4970
|
+
},
|
|
4803
4971
|
children: [
|
|
4804
4972
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4805
4973
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4807,14 +4975,14 @@ function KjunAccordionItem({
|
|
|
4807
4975
|
{
|
|
4808
4976
|
name: "chevron-down",
|
|
4809
4977
|
className: "kjun-accordion-chevron",
|
|
4810
|
-
size:
|
|
4978
|
+
size: import_tokens26.tokens.extensions.accordion.iconSize,
|
|
4811
4979
|
style: { transform: open ? "rotate(180deg)" : void 0 }
|
|
4812
4980
|
}
|
|
4813
4981
|
)
|
|
4814
4982
|
]
|
|
4815
4983
|
}
|
|
4816
4984
|
),
|
|
4817
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4985
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Collapse, { open, keepMounted, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4818
4986
|
"div",
|
|
4819
4987
|
{
|
|
4820
4988
|
role: "region",
|
|
@@ -4835,12 +5003,12 @@ function KjunBreadcrumb({
|
|
|
4835
5003
|
ariaLabel != null ? ariaLabel : ariaLabel = m.breadcrumb;
|
|
4836
5004
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4837
5005
|
const label = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4838
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size:
|
|
5006
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: item.icon, size: import_tokens26.tokens.extensions.breadcrumb.iconSize }),
|
|
4839
5007
|
" ",
|
|
4840
5008
|
item.label
|
|
4841
5009
|
] });
|
|
4842
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4843
|
-
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size:
|
|
5010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react40.Fragment, { children: [
|
|
5011
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens26.tokens.extensions.breadcrumb.separatorSize }),
|
|
4844
5012
|
" ",
|
|
4845
5013
|
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("a", { href: item.to, children: label }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-current": i === items.length - 1 ? "page" : void 0, children: label })
|
|
4846
5014
|
] }, i);
|
|
@@ -4887,7 +5055,7 @@ function KjunPagination({
|
|
|
4887
5055
|
"aria-label": label,
|
|
4888
5056
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4889
5057
|
onClick: () => change(target),
|
|
4890
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size:
|
|
5058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: icon, size: import_tokens26.tokens.extensions.pagination.iconSize })
|
|
4891
5059
|
}
|
|
4892
5060
|
);
|
|
4893
5061
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { "aria-label": m.pagination, className: "kjun-pagination", children: [
|
|
@@ -4940,8 +5108,8 @@ function KjunPagination({
|
|
|
4940
5108
|
}
|
|
4941
5109
|
|
|
4942
5110
|
// packages/react/src/actions.tsx
|
|
4943
|
-
var
|
|
4944
|
-
var
|
|
5111
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
5112
|
+
var import_react41 = require("react");
|
|
4945
5113
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4946
5114
|
function KjunIconToggle({
|
|
4947
5115
|
active = false,
|
|
@@ -4961,7 +5129,7 @@ function KjunIconToggle({
|
|
|
4961
5129
|
onToggle
|
|
4962
5130
|
}) {
|
|
4963
5131
|
var _a;
|
|
4964
|
-
const navigation = (0,
|
|
5132
|
+
const navigation = (0, import_react41.useContext)(TopNavigationContext);
|
|
4965
5133
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4966
5134
|
"button",
|
|
4967
5135
|
{
|
|
@@ -4982,7 +5150,7 @@ function KjunIconToggle({
|
|
|
4982
5150
|
{
|
|
4983
5151
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
4984
5152
|
filled: active,
|
|
4985
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
5153
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens27.tokens.button.iconSizes[size],
|
|
4986
5154
|
style: { ["--_kjun-icon-toggle-color"]: active ? activeColor : inactiveColor },
|
|
4987
5155
|
className: active ? activeColorClass : inactiveColorClass,
|
|
4988
5156
|
"data-kjun-color-class": (active ? activeColorClass : inactiveColorClass) ? "" : void 0
|
|
@@ -5023,8 +5191,8 @@ function KjunCopyButton({
|
|
|
5023
5191
|
const m = useKjunMessages();
|
|
5024
5192
|
successText != null ? successText : successText = m.copied;
|
|
5025
5193
|
const feedback = useOptionalKjunFeedback();
|
|
5026
|
-
const [copied, setCopied] = (0,
|
|
5027
|
-
(0,
|
|
5194
|
+
const [copied, setCopied] = (0, import_react41.useState)(false), [failed, setFailed] = (0, import_react41.useState)(false), busy = (0, import_react41.useRef)(false), timer = (0, import_react41.useRef)(void 0), mounted = (0, import_react41.useRef)(true);
|
|
5195
|
+
(0, import_react41.useEffect)(() => {
|
|
5028
5196
|
mounted.current = true;
|
|
5029
5197
|
return () => {
|
|
5030
5198
|
mounted.current = false;
|
|
@@ -5042,9 +5210,9 @@ function KjunCopyButton({
|
|
|
5042
5210
|
"data-inline": inline,
|
|
5043
5211
|
style: {
|
|
5044
5212
|
...typeStyle(size === "xs" ? "controlSmall" : "control"),
|
|
5045
|
-
minHeight:
|
|
5213
|
+
minHeight: import_tokens27.tokens.button.heights[size],
|
|
5046
5214
|
paddingBlock: 0,
|
|
5047
|
-
paddingInline: { xs:
|
|
5215
|
+
paddingInline: { xs: import_tokens27.tokens.dimension.value4, sm: import_tokens27.tokens.dimension.value8, md: import_tokens27.tokens.dimension.value12 }[size]
|
|
5048
5216
|
},
|
|
5049
5217
|
onClick: async (event) => {
|
|
5050
5218
|
event.stopPropagation();
|
|
@@ -5074,7 +5242,7 @@ function KjunCopyButton({
|
|
|
5074
5242
|
KjunIcon,
|
|
5075
5243
|
{
|
|
5076
5244
|
name: copied ? "check" : "copy",
|
|
5077
|
-
size:
|
|
5245
|
+
size: import_tokens27.tokens.button.iconSizes[size],
|
|
5078
5246
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
5079
5247
|
}
|
|
5080
5248
|
),
|
|
@@ -5148,14 +5316,14 @@ function KjunExternalLink({
|
|
|
5148
5316
|
onClick: (e) => e.stopPropagation(),
|
|
5149
5317
|
children: [
|
|
5150
5318
|
body,
|
|
5151
|
-
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size:
|
|
5319
|
+
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "external-link", size: import_tokens27.tokens.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
5152
5320
|
!name && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "kjun-sr-only", children: m.newWindow })
|
|
5153
5321
|
]
|
|
5154
5322
|
}
|
|
5155
5323
|
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-label": name, children: body });
|
|
5156
5324
|
}
|
|
5157
5325
|
function KjunScrollFade({ children }) {
|
|
5158
|
-
const ref = (0,
|
|
5326
|
+
const ref = (0, import_react41.useRef)(null), [edges, setEdges] = (0, import_react41.useState)({ left: false, right: false });
|
|
5159
5327
|
const update = () => {
|
|
5160
5328
|
const el = ref.current;
|
|
5161
5329
|
if (el)
|
|
@@ -5167,7 +5335,7 @@ function KjunScrollFade({ children }) {
|
|
|
5167
5335
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
5168
5336
|
});
|
|
5169
5337
|
};
|
|
5170
|
-
(0,
|
|
5338
|
+
(0, import_react41.useEffect)(() => {
|
|
5171
5339
|
update();
|
|
5172
5340
|
const observer = new ResizeObserver(update);
|
|
5173
5341
|
if (ref.current) {
|
|
@@ -5176,7 +5344,7 @@ function KjunScrollFade({ children }) {
|
|
|
5176
5344
|
}
|
|
5177
5345
|
return () => observer.disconnect();
|
|
5178
5346
|
}, [children]);
|
|
5179
|
-
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${
|
|
5347
|
+
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${import_tokens27.tokens.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${import_tokens27.tokens.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
5180
5348
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5181
5349
|
"div",
|
|
5182
5350
|
{
|
|
@@ -5190,14 +5358,14 @@ function KjunScrollFade({ children }) {
|
|
|
5190
5358
|
}
|
|
5191
5359
|
|
|
5192
5360
|
// packages/react/src/data-state.tsx
|
|
5193
|
-
var
|
|
5194
|
-
var
|
|
5361
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
5362
|
+
var import_react43 = require("react");
|
|
5195
5363
|
|
|
5196
5364
|
// shared/package-runtime/use-loading-reveal.ts
|
|
5197
|
-
var
|
|
5365
|
+
var import_react42 = require("react");
|
|
5198
5366
|
function useLoadingReveal(active, delay = 0) {
|
|
5199
|
-
const [revealed, setRevealed] = (0,
|
|
5200
|
-
(0,
|
|
5367
|
+
const [revealed, setRevealed] = (0, import_react42.useState)(false);
|
|
5368
|
+
(0, import_react42.useEffect)(() => {
|
|
5201
5369
|
setRevealed(false);
|
|
5202
5370
|
if (!active || delay <= 0) return;
|
|
5203
5371
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -5210,13 +5378,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
5210
5378
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5211
5379
|
function useQueryDisplay(props) {
|
|
5212
5380
|
var _a;
|
|
5213
|
-
const [state, setState] = (0,
|
|
5381
|
+
const [state, setState] = (0, import_react43.useState)(() => (0, import_tokens28.initialQueryDisplay)(props));
|
|
5214
5382
|
let next = state;
|
|
5215
5383
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
5216
|
-
next = (0,
|
|
5384
|
+
next = (0, import_tokens28.advanceQueryDisplay)(state, props);
|
|
5217
5385
|
setState(next);
|
|
5218
5386
|
}
|
|
5219
|
-
return (0,
|
|
5387
|
+
return (0, import_tokens28.queryDisplayStatus)(next, props);
|
|
5220
5388
|
}
|
|
5221
5389
|
function KjunDataState({
|
|
5222
5390
|
preserveContent = false,
|
|
@@ -5248,7 +5416,7 @@ function KjunDataState({
|
|
|
5248
5416
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
5249
5417
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
5250
5418
|
retryText != null ? retryText : retryText = m.retry;
|
|
5251
|
-
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding =
|
|
5419
|
+
const state = useQueryDisplay(query2), blockingError = query2.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query2.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = import_tokens28.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
5252
5420
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
5253
5421
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-status", role: "status", children: [
|
|
5254
5422
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "xs" }),
|
|
@@ -5262,7 +5430,7 @@ function KjunDataState({
|
|
|
5262
5430
|
"aria-label": revealed ? loadingText : void 0,
|
|
5263
5431
|
"aria-hidden": revealed ? void 0 : true,
|
|
5264
5432
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
5265
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap:
|
|
5433
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { display: "grid", gap: import_tokens28.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "kjun-data-loading", children: [
|
|
5266
5434
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunSpinner, { size: "md" }),
|
|
5267
5435
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: loadingText })
|
|
5268
5436
|
] }))
|
|
@@ -5275,7 +5443,7 @@ function KjunDataState({
|
|
|
5275
5443
|
"aria-hidden": concealed || void 0,
|
|
5276
5444
|
inert: concealed || void 0,
|
|
5277
5445
|
style: {
|
|
5278
|
-
opacity: query2.loading && !state.usesQueryState ?
|
|
5446
|
+
opacity: query2.loading && !state.usesQueryState ? import_tokens28.tokens.states.opacity.pending : void 0
|
|
5279
5447
|
},
|
|
5280
5448
|
children
|
|
5281
5449
|
},
|
|
@@ -5284,7 +5452,7 @@ function KjunDataState({
|
|
|
5284
5452
|
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "kjun-data-warning kjun-state-actions", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) })
|
|
5285
5453
|
] });
|
|
5286
5454
|
}
|
|
5287
|
-
var KjunErrorBoundary = class extends
|
|
5455
|
+
var KjunErrorBoundary = class extends import_react43.Component {
|
|
5288
5456
|
constructor() {
|
|
5289
5457
|
super(...arguments);
|
|
5290
5458
|
this.state = { error: false };
|
|
@@ -5317,7 +5485,7 @@ var KjunErrorBoundary = class extends import_react41.Component {
|
|
|
5317
5485
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
5318
5486
|
|
|
5319
5487
|
// packages/react/src/skeletons.tsx
|
|
5320
|
-
var
|
|
5488
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5321
5489
|
|
|
5322
5490
|
// shared/package-runtime/chart-skeleton.ts
|
|
5323
5491
|
var chartFrameViewBox = "0 0 600 240";
|
|
@@ -5334,11 +5502,11 @@ function chartSkeletonKind(kind) {
|
|
|
5334
5502
|
}
|
|
5335
5503
|
|
|
5336
5504
|
// packages/react/src/market-skeleton.tsx
|
|
5337
|
-
var
|
|
5505
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
5338
5506
|
|
|
5339
5507
|
// shared/package-runtime/market-layout.ts
|
|
5340
|
-
var
|
|
5341
|
-
var marketGeometry =
|
|
5508
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
5509
|
+
var marketGeometry = import_tokens29.tokens.extensions.marketTable;
|
|
5342
5510
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
5343
5511
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
5344
5512
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -5379,15 +5547,15 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
5379
5547
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-hidden": "true", className: "kjun-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("table", { className: "kjun-market-table-grid", style: webMarketLayout(cols, showActions, widthClass).tableStyle, children: [
|
|
5380
5548
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
5381
5549
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5382
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5550
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens30.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens30.tokens.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
5383
5551
|
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: col.label }, col.key || i))
|
|
5384
5552
|
] }) }),
|
|
5385
5553
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("tr", { children: [
|
|
5386
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5554
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens30.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens30.tokens.extensions.financial.priceSkeletonHeight }) }) }),
|
|
5387
5555
|
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-market-skeleton-identity", children: [
|
|
5388
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height:
|
|
5389
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height:
|
|
5390
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width:
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens30.tokens.extensions.skeleton.lineHeights.md }),
|
|
5557
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens30.tokens.extensions.skeleton.lineHeights.sm })
|
|
5558
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", width: import_tokens30.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens30.tokens.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
5391
5559
|
] }, row)) })
|
|
5392
5560
|
] }) });
|
|
5393
5561
|
}
|
|
@@ -5398,7 +5566,7 @@ function KjunListSkeleton({
|
|
|
5398
5566
|
rows = 8,
|
|
5399
5567
|
variant = "market",
|
|
5400
5568
|
avatar = true,
|
|
5401
|
-
avatarSize =
|
|
5569
|
+
avatarSize = import_tokens31.tokens.extensions.skeleton.listAvatarSize,
|
|
5402
5570
|
quote = true
|
|
5403
5571
|
}) {
|
|
5404
5572
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-row", "data-variant": variant, children: [
|
|
@@ -5408,15 +5576,15 @@ function KjunListSkeleton({
|
|
|
5408
5576
|
KjunSkeleton,
|
|
5409
5577
|
{
|
|
5410
5578
|
type: "block",
|
|
5411
|
-
height:
|
|
5579
|
+
height: import_tokens31.tokens.extensions.skeleton.lineHeights.md,
|
|
5412
5580
|
width: i % 2 ? "80%" : "65%"
|
|
5413
5581
|
}
|
|
5414
5582
|
),
|
|
5415
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5583
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
5416
5584
|
] }),
|
|
5417
5585
|
quote && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5418
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5419
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.quoteHeight, width: import_tokens31.tokens.extensions.skeleton.quoteWidth }),
|
|
5587
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens31.tokens.extensions.skeleton.detailWidth })
|
|
5420
5588
|
] })
|
|
5421
5589
|
] }, i)) });
|
|
5422
5590
|
}
|
|
@@ -5432,17 +5600,17 @@ function KjunFormSkeleton({
|
|
|
5432
5600
|
"aria-hidden": "true",
|
|
5433
5601
|
className: "kjun-form-skeleton",
|
|
5434
5602
|
"data-columns": columns,
|
|
5435
|
-
style: { "--_kjun-form-skeleton-radius": `${
|
|
5603
|
+
style: { "--_kjun-form-skeleton-radius": `${import_tokens31.tokens.input[size].radius}px` },
|
|
5436
5604
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5437
5605
|
field ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
5438
5606
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
5439
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height:
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.skeleton.formLabelHeight, width: import_tokens31.tokens.extensions.skeleton.formLabelWidth }) })
|
|
5440
5608
|
),
|
|
5441
5609
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5442
5610
|
KjunSkeleton,
|
|
5443
5611
|
{
|
|
5444
5612
|
type: "block",
|
|
5445
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
5613
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? import_tokens31.tokens.input[size].lineHeight * 3 + import_tokens31.tokens.input[size].textareaPaddingY * 2 + 2 * import_tokens31.tokens.border.controlWidth : import_tokens31.tokens.input[size].height
|
|
5446
5614
|
}
|
|
5447
5615
|
)
|
|
5448
5616
|
] }, i))
|
|
@@ -5451,7 +5619,7 @@ function KjunFormSkeleton({
|
|
|
5451
5619
|
}
|
|
5452
5620
|
function KjunChartSkeleton({
|
|
5453
5621
|
kind: requestedKind = "frame",
|
|
5454
|
-
height =
|
|
5622
|
+
height = import_tokens31.tokens.extensions.chartSkeleton.height,
|
|
5455
5623
|
loadingText,
|
|
5456
5624
|
skeleton = true,
|
|
5457
5625
|
loadingDelay = 0,
|
|
@@ -5507,7 +5675,7 @@ function KjunChartSkeleton({
|
|
|
5507
5675
|
d: chartFramePath,
|
|
5508
5676
|
fill: "none",
|
|
5509
5677
|
stroke: "var(--_kjun-color-chart-grid)",
|
|
5510
|
-
strokeWidth:
|
|
5678
|
+
strokeWidth: import_tokens31.tokens.border.defaultWidth,
|
|
5511
5679
|
vectorEffect: "non-scaling-stroke"
|
|
5512
5680
|
}
|
|
5513
5681
|
)
|
|
@@ -5520,17 +5688,17 @@ function KjunChartSkeleton({
|
|
|
5520
5688
|
}
|
|
5521
5689
|
|
|
5522
5690
|
// packages/react/src/financial-display.tsx
|
|
5523
|
-
var
|
|
5524
|
-
var
|
|
5691
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5692
|
+
var import_react45 = require("react");
|
|
5525
5693
|
|
|
5526
5694
|
// packages/react/src/number-display.tsx
|
|
5527
|
-
var
|
|
5695
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5528
5696
|
|
|
5529
5697
|
// shared/package-runtime/use-number-motion.ts
|
|
5530
|
-
var
|
|
5698
|
+
var import_react44 = require("react");
|
|
5531
5699
|
|
|
5532
5700
|
// shared/package-runtime/number-motion.ts
|
|
5533
|
-
var
|
|
5701
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5534
5702
|
function createNumberMotion(apply) {
|
|
5535
5703
|
let frame = 0, revision = 0, current = 0;
|
|
5536
5704
|
let previous;
|
|
@@ -5561,7 +5729,7 @@ function createNumberMotion(apply) {
|
|
|
5561
5729
|
if (from === target) return;
|
|
5562
5730
|
const tick = (now) => {
|
|
5563
5731
|
if (version !== revision) return;
|
|
5564
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
5732
|
+
const progress = Math.min(1, Math.max(0, (now - started) / import_tokens32.tokens.motion.number));
|
|
5565
5733
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
5566
5734
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
5567
5735
|
};
|
|
@@ -5573,14 +5741,14 @@ function createNumberMotion(apply) {
|
|
|
5573
5741
|
|
|
5574
5742
|
// shared/package-runtime/use-number-motion.ts
|
|
5575
5743
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5576
|
-
const [display, setDisplay] = (0,
|
|
5577
|
-
const motion = (0,
|
|
5744
|
+
const [display, setDisplay] = (0, import_react44.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5745
|
+
const motion = (0, import_react44.useRef)(null);
|
|
5578
5746
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5579
|
-
(0,
|
|
5747
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
5580
5748
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5581
5749
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5582
5750
|
}, [value, animated, fromPrevious, reduced]);
|
|
5583
|
-
(0,
|
|
5751
|
+
(0, import_react44.useLayoutEffect)(() => () => {
|
|
5584
5752
|
var _a;
|
|
5585
5753
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5586
5754
|
motion.current = null;
|
|
@@ -5640,7 +5808,7 @@ function KjunPriceCell({
|
|
|
5640
5808
|
flashClass = "",
|
|
5641
5809
|
fromPrevious = true
|
|
5642
5810
|
}) {
|
|
5643
|
-
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height:
|
|
5811
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", height: import_tokens33.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens33.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5644
5812
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5645
5813
|
"span",
|
|
5646
5814
|
{
|
|
@@ -5688,7 +5856,7 @@ function KjunSignedValue({
|
|
|
5688
5856
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5689
5857
|
},
|
|
5690
5858
|
children: [
|
|
5691
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width:
|
|
5859
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSkeleton, { type: "block", width: import_tokens33.tokens.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5692
5860
|
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunFreshness, { stale: true })
|
|
5693
5861
|
]
|
|
5694
5862
|
}
|
|
@@ -5697,7 +5865,7 @@ function KjunSignedValue({
|
|
|
5697
5865
|
|
|
5698
5866
|
// packages/react/src/financial-display.tsx
|
|
5699
5867
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5700
|
-
var deviationFill = { neutral: 1, low:
|
|
5868
|
+
var deviationFill = { neutral: 1, low: import_tokens34.tokens.states.opacity.deviationLow, medium: import_tokens34.tokens.states.opacity.deviationMedium, strong: import_tokens34.tokens.states.opacity.deviationStrong };
|
|
5701
5869
|
function KjunDeviation({
|
|
5702
5870
|
value,
|
|
5703
5871
|
variant = "pill",
|
|
@@ -5709,7 +5877,7 @@ function KjunDeviation({
|
|
|
5709
5877
|
const n = finiteNumber(value);
|
|
5710
5878
|
if (n === null)
|
|
5711
5879
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5712
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0,
|
|
5880
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens34.deviationLevel)(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
5713
5881
|
if (variant === "badge")
|
|
5714
5882
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5715
5883
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -5729,7 +5897,7 @@ function KjunDeviation({
|
|
|
5729
5897
|
KjunIcon,
|
|
5730
5898
|
{
|
|
5731
5899
|
name: "alert-triangle",
|
|
5732
|
-
size:
|
|
5900
|
+
size: import_tokens34.tokens.extensions.financial.warningIconSize,
|
|
5733
5901
|
style: { color: "var(--_kjun-color-warning)" }
|
|
5734
5902
|
}
|
|
5735
5903
|
) })
|
|
@@ -5742,7 +5910,7 @@ function KjunDeviation({
|
|
|
5742
5910
|
className: "kjun-deviation",
|
|
5743
5911
|
ref: domainColorRef(!neutral),
|
|
5744
5912
|
"data-variant": variant,
|
|
5745
|
-
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ?
|
|
5913
|
+
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens34.tokens.typography.numberLg.fontWeight : import_tokens34.tokens.typography.control.fontWeight },
|
|
5746
5914
|
children: [
|
|
5747
5915
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5748
5916
|
"span",
|
|
@@ -5770,7 +5938,7 @@ function KjunHeatmapCell({
|
|
|
5770
5938
|
}) {
|
|
5771
5939
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5772
5940
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5773
|
-
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } =
|
|
5941
|
+
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = import_tokens34.tokens.states.opacity;
|
|
5774
5942
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5775
5943
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5776
5944
|
"span",
|
|
@@ -5789,7 +5957,7 @@ function KjunProgressCell({
|
|
|
5789
5957
|
showLabel = true,
|
|
5790
5958
|
color = "auto",
|
|
5791
5959
|
customColor,
|
|
5792
|
-
height =
|
|
5960
|
+
height = import_tokens34.tokens.extensions.financial.progressHeight
|
|
5793
5961
|
}) {
|
|
5794
5962
|
const percent = max > 0 && Number.isFinite(value) ? Math.min(100, Math.max(0, value / max * 100)) : 0, role2 = color === "auto" ? percent < 30 ? "danger" : percent < 70 ? "warning" : "success" : color;
|
|
5795
5963
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
@@ -5813,7 +5981,7 @@ function KjunCollectionMark({
|
|
|
5813
5981
|
active = false,
|
|
5814
5982
|
size = "md"
|
|
5815
5983
|
}) {
|
|
5816
|
-
const box =
|
|
5984
|
+
const box = import_tokens34.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens34.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5817
5985
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5818
5986
|
KjunIcon,
|
|
5819
5987
|
{
|
|
@@ -5849,8 +6017,8 @@ function KjunExecutionStatusBadge({
|
|
|
5849
6017
|
}
|
|
5850
6018
|
function KjunSparkline({
|
|
5851
6019
|
data = [],
|
|
5852
|
-
width =
|
|
5853
|
-
height =
|
|
6020
|
+
width = import_tokens34.tokens.extensions.financial.sparklineWidth,
|
|
6021
|
+
height = import_tokens34.tokens.extensions.financial.sparklineHeight,
|
|
5854
6022
|
color,
|
|
5855
6023
|
semantic = "price",
|
|
5856
6024
|
fill = true,
|
|
@@ -5858,7 +6026,7 @@ function KjunSparkline({
|
|
|
5858
6026
|
stretch = false,
|
|
5859
6027
|
ariaLabel
|
|
5860
6028
|
}) {
|
|
5861
|
-
const id = "kjun-" + (0,
|
|
6029
|
+
const id = "kjun-" + (0, import_react45.useId)().replace(/:/g, ""), values = data.filter(Number.isFinite), min = Math.min(...values), max = Math.max(...values), range = max - min || 1, points = values.map(
|
|
5862
6030
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5863
6031
|
).join(" "), change = values.length > 1 ? values[values.length - 1] - values[0] : 0, line = color || `var(--_kjun-color-${change === 0 ? "text-tertiary" : semantic === "status" ? change > 0 ? "success" : "danger" : change > 0 ? "price-up" : "price-down"})`;
|
|
5864
6032
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
@@ -5905,8 +6073,8 @@ function KjunSparkline({
|
|
|
5905
6073
|
}
|
|
5906
6074
|
|
|
5907
6075
|
// shared/package-runtime/table.ts
|
|
5908
|
-
var
|
|
5909
|
-
var
|
|
6076
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
6077
|
+
var import_react46 = require("react");
|
|
5910
6078
|
|
|
5911
6079
|
// shared/package-runtime/table-model.ts
|
|
5912
6080
|
function getValue(row, key) {
|
|
@@ -5950,11 +6118,11 @@ function useTableModel(props) {
|
|
|
5950
6118
|
expandSingle = false,
|
|
5951
6119
|
onExpandedRowsChange
|
|
5952
6120
|
} = props;
|
|
5953
|
-
const [internalSort, setSort] = (0,
|
|
6121
|
+
const [internalSort, setSort] = (0, import_react46.useState)({
|
|
5954
6122
|
key: "",
|
|
5955
6123
|
order: "asc"
|
|
5956
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5957
|
-
(0,
|
|
6124
|
+
}), [internalExpanded, setExpanded] = (0, import_react46.useState)([]), [search, setSearch] = (0, import_react46.useState)(""), timer = (0, import_react46.useRef)(void 0);
|
|
6125
|
+
(0, import_react46.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5958
6126
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5959
6127
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5960
6128
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5979,7 +6147,7 @@ function useTableModel(props) {
|
|
|
5979
6147
|
sortColumn: (col) => {
|
|
5980
6148
|
var _a2;
|
|
5981
6149
|
if (!sortable || !col.sortable) return;
|
|
5982
|
-
const next = (0,
|
|
6150
|
+
const next = (0, import_tokens35.nextTableSort)(sort, col.key);
|
|
5983
6151
|
if (props.sort === void 0) setSort(next);
|
|
5984
6152
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
5985
6153
|
},
|
|
@@ -6043,7 +6211,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
6043
6211
|
}
|
|
6044
6212
|
|
|
6045
6213
|
// packages/react/src/table-toolbar.tsx
|
|
6046
|
-
var
|
|
6214
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6047
6215
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6048
6216
|
function TableToolbar({
|
|
6049
6217
|
selectable,
|
|
@@ -6086,7 +6254,7 @@ function TableToolbar({
|
|
|
6086
6254
|
KjunInput,
|
|
6087
6255
|
{
|
|
6088
6256
|
size: "sm",
|
|
6089
|
-
style: { width:
|
|
6257
|
+
style: { width: import_tokens36.tokens.table.searchWidth, maxWidth: "100%" },
|
|
6090
6258
|
value: search,
|
|
6091
6259
|
ariaLabel: m.searchTable,
|
|
6092
6260
|
placeholder: searchPlaceholder,
|
|
@@ -6102,22 +6270,22 @@ function TableToolbar({
|
|
|
6102
6270
|
}
|
|
6103
6271
|
|
|
6104
6272
|
// packages/react/src/table-grid.tsx
|
|
6105
|
-
var
|
|
6106
|
-
var
|
|
6273
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6274
|
+
var import_react48 = require("react");
|
|
6107
6275
|
|
|
6108
6276
|
// packages/react/src/table-check.tsx
|
|
6109
|
-
var
|
|
6277
|
+
var import_react47 = require("react");
|
|
6110
6278
|
|
|
6111
6279
|
// shared/package-runtime/component-icons.ts
|
|
6112
6280
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
6113
6281
|
var componentIcons = { minus: import_minus.default };
|
|
6114
6282
|
|
|
6115
6283
|
// packages/react/src/table-check.tsx
|
|
6116
|
-
var
|
|
6284
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6117
6285
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6118
|
-
var TableCheck = (0,
|
|
6286
|
+
var TableCheck = (0, import_react47.forwardRef)(
|
|
6119
6287
|
function TableCheck2(props, ref) {
|
|
6120
|
-
const size =
|
|
6288
|
+
const size = import_tokens37.tokens.extensions.checkbox.iconSizes.sm;
|
|
6121
6289
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "kjun-table-check", children: [
|
|
6122
6290
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
6123
6291
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
@@ -6174,7 +6342,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6174
6342
|
KjunIcon,
|
|
6175
6343
|
{
|
|
6176
6344
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
6177
|
-
size:
|
|
6345
|
+
size: import_tokens38.tokens.table.sortIconSize
|
|
6178
6346
|
}
|
|
6179
6347
|
)
|
|
6180
6348
|
]
|
|
@@ -6187,14 +6355,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6187
6355
|
}
|
|
6188
6356
|
),
|
|
6189
6357
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tr", { "aria-hidden": "true", children: [
|
|
6190
|
-
selectable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "block", height:
|
|
6358
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "block", height: import_tokens38.tokens.table.selectionSize, width: import_tokens38.tokens.table.selectionSize }) }),
|
|
6191
6359
|
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
6192
6360
|
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6193
6361
|
KjunSkeleton,
|
|
6194
6362
|
{
|
|
6195
6363
|
type: "block",
|
|
6196
|
-
height:
|
|
6197
|
-
width: col.key === "actions" ?
|
|
6364
|
+
height: import_tokens38.tokens.table.skeletonHeight,
|
|
6365
|
+
width: col.key === "actions" ? import_tokens38.tokens.table.actionColumnWidth : "75%"
|
|
6198
6366
|
}
|
|
6199
6367
|
) }, col.key))
|
|
6200
6368
|
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6204,7 +6372,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
6204
6372
|
className: "kjun-table-empty",
|
|
6205
6373
|
children: emptyContent || emptyText
|
|
6206
6374
|
}
|
|
6207
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6375
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react48.Fragment, { children: [
|
|
6208
6376
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6209
6377
|
"tr",
|
|
6210
6378
|
{
|
|
@@ -6348,8 +6516,8 @@ function TableCards({
|
|
|
6348
6516
|
}
|
|
6349
6517
|
|
|
6350
6518
|
// packages/react/src/table-view.tsx
|
|
6351
|
-
var
|
|
6352
|
-
var
|
|
6519
|
+
var import_react49 = require("react");
|
|
6520
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6353
6521
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6354
6522
|
function KjunTable(props) {
|
|
6355
6523
|
const m = useKjunMessages();
|
|
@@ -6379,9 +6547,9 @@ function KjunTable(props) {
|
|
|
6379
6547
|
onRowClick,
|
|
6380
6548
|
onRetry
|
|
6381
6549
|
} = props;
|
|
6382
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
6383
|
-
(0,
|
|
6384
|
-
const media = matchMedia(`(width < ${
|
|
6550
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react49.useState)(false);
|
|
6551
|
+
(0, import_react49.useEffect)(() => {
|
|
6552
|
+
const media = matchMedia(`(width < ${import_tokens39.tokens.table.mobileBreakpoint}px)`);
|
|
6385
6553
|
const update = () => setMobile(media.matches);
|
|
6386
6554
|
update();
|
|
6387
6555
|
media.addEventListener("change", update);
|
|
@@ -6401,7 +6569,7 @@ function KjunTable(props) {
|
|
|
6401
6569
|
};
|
|
6402
6570
|
const customClass = (row, i) => typeof rowClass === "function" ? rowClass(row, i) : rowClass || "";
|
|
6403
6571
|
const rowKeyDown = (event, row, index) => {
|
|
6404
|
-
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0,
|
|
6572
|
+
if (!onRowClick || event.target !== event.currentTarget || event.defaultPrevented || (0, import_tokens39.isComposingKey)(event)) return;
|
|
6405
6573
|
if (event.key === "Enter" || event.key === " ") {
|
|
6406
6574
|
event.preventDefault();
|
|
6407
6575
|
onRowClick(row, index);
|
|
@@ -6485,7 +6653,7 @@ function KjunTable(props) {
|
|
|
6485
6653
|
}
|
|
6486
6654
|
|
|
6487
6655
|
// packages/react/src/kpi.tsx
|
|
6488
|
-
var
|
|
6656
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6489
6657
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6490
6658
|
var kpiFormat = (item, value = item.value) => {
|
|
6491
6659
|
var _a, _b;
|
|
@@ -6553,7 +6721,7 @@ function KjunKpiHero(props) {
|
|
|
6553
6721
|
] }) }),
|
|
6554
6722
|
showDelta && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6555
6723
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6556
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width:
|
|
6724
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: import_tokens40.tokens.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6557
6725
|
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6558
6726
|
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6559
6727
|
"span",
|
|
@@ -6685,7 +6853,7 @@ function KjunKpiRow({
|
|
|
6685
6853
|
},
|
|
6686
6854
|
children: [
|
|
6687
6855
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6688
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", width:
|
|
6856
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunSkeleton, { type: "block", width: import_tokens40.tokens.extensions.kpiRow.labelSkeletonWidth, height: import_tokens40.tokens.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6689
6857
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6690
6858
|
] }),
|
|
6691
6859
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
@@ -6743,10 +6911,10 @@ function KjunKpiRow({
|
|
|
6743
6911
|
}
|
|
6744
6912
|
|
|
6745
6913
|
// packages/react/src/market-cards.tsx
|
|
6746
|
-
var
|
|
6914
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6747
6915
|
|
|
6748
6916
|
// shared/package-runtime/market-cards.ts
|
|
6749
|
-
var
|
|
6917
|
+
var import_react50 = require("react");
|
|
6750
6918
|
function useMarketCardsModel(props, persistence) {
|
|
6751
6919
|
const {
|
|
6752
6920
|
columns,
|
|
@@ -6762,8 +6930,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6762
6930
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6763
6931
|
isDefaultSort: c.defaultSort
|
|
6764
6932
|
}));
|
|
6765
|
-
const [key, setKey] = (0,
|
|
6766
|
-
const mounted = (0,
|
|
6933
|
+
const [key, setKey] = (0, import_react50.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6934
|
+
const mounted = (0, import_react50.useRef)("");
|
|
6767
6935
|
const save = (key2) => {
|
|
6768
6936
|
var _a;
|
|
6769
6937
|
try {
|
|
@@ -6771,7 +6939,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6771
6939
|
} catch (e) {
|
|
6772
6940
|
}
|
|
6773
6941
|
};
|
|
6774
|
-
(0,
|
|
6942
|
+
(0, import_react50.useEffect)(() => {
|
|
6775
6943
|
var _a, _b;
|
|
6776
6944
|
if (mounted.current === restoreSignature) return;
|
|
6777
6945
|
mounted.current = restoreSignature;
|
|
@@ -6951,10 +7119,10 @@ function KjunMarketCards(props) {
|
|
|
6951
7119
|
KjunSparkline,
|
|
6952
7120
|
{
|
|
6953
7121
|
data: getValue(row, state.key) || [],
|
|
6954
|
-
width:
|
|
6955
|
-
height:
|
|
7122
|
+
width: import_tokens41.tokens.extensions.marketTable.sparklineWidth,
|
|
7123
|
+
height: import_tokens41.tokens.extensions.marketTable.sparklineHeight
|
|
6956
7124
|
}
|
|
6957
|
-
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height:
|
|
7125
|
+
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens41.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens41.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6958
7126
|
KjunSignedValue,
|
|
6959
7127
|
{
|
|
6960
7128
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6962,7 +7130,7 @@ function KjunMarketCards(props) {
|
|
|
6962
7130
|
stale: !!getValue(row, "stale"),
|
|
6963
7131
|
tone: "pill"
|
|
6964
7132
|
}
|
|
6965
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height:
|
|
7133
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens41.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens41.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-metric", children: [
|
|
6966
7134
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6967
7135
|
props,
|
|
6968
7136
|
row,
|
|
@@ -6985,7 +7153,7 @@ function KjunMarketCards(props) {
|
|
|
6985
7153
|
}
|
|
6986
7154
|
|
|
6987
7155
|
// packages/react/src/market-list.tsx
|
|
6988
|
-
var
|
|
7156
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
6989
7157
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6990
7158
|
function KjunMarketSimpleList(props) {
|
|
6991
7159
|
const m = useKjunMessages();
|
|
@@ -7052,7 +7220,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7052
7220
|
fetchedAt
|
|
7053
7221
|
}
|
|
7054
7222
|
)),
|
|
7055
|
-
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height:
|
|
7223
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", height: import_tokens42.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens42.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7056
7224
|
KjunSignedValue,
|
|
7057
7225
|
{
|
|
7058
7226
|
value: change,
|
|
@@ -7076,7 +7244,7 @@ function KjunMarketSimpleList(props) {
|
|
|
7076
7244
|
}
|
|
7077
7245
|
|
|
7078
7246
|
// packages/react/src/market-panel.tsx
|
|
7079
|
-
var
|
|
7247
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
7080
7248
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7081
7249
|
function KjunMarketListPanel({
|
|
7082
7250
|
controls,
|
|
@@ -7084,12 +7252,12 @@ function KjunMarketListPanel({
|
|
|
7084
7252
|
}) {
|
|
7085
7253
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(KjunCard, { children: [
|
|
7086
7254
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: controls }),
|
|
7087
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop:
|
|
7255
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { marginTop: import_tokens43.tokens.dimension.value16, borderTop: `${import_tokens43.tokens.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
7088
7256
|
] });
|
|
7089
7257
|
}
|
|
7090
7258
|
|
|
7091
7259
|
// packages/react/src/market-table.tsx
|
|
7092
|
-
var
|
|
7260
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7093
7261
|
|
|
7094
7262
|
// shared/package-runtime/trailing-overflow.ts
|
|
7095
7263
|
function watchTrailingOverflow(element, onChange) {
|
|
@@ -7106,7 +7274,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
7106
7274
|
}
|
|
7107
7275
|
|
|
7108
7276
|
// packages/react/src/market-table.tsx
|
|
7109
|
-
var
|
|
7277
|
+
var import_react51 = require("react");
|
|
7110
7278
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7111
7279
|
function KjunMarketTable(props) {
|
|
7112
7280
|
const m = useKjunMessages();
|
|
@@ -7128,12 +7296,12 @@ function KjunMarketTable(props) {
|
|
|
7128
7296
|
formatMetric,
|
|
7129
7297
|
renderCell
|
|
7130
7298
|
} = props;
|
|
7131
|
-
const scroller = (0,
|
|
7132
|
-
(0,
|
|
7299
|
+
const scroller = (0, import_react51.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react51.useState)(false);
|
|
7300
|
+
(0, import_react51.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
7133
7301
|
const render = (row, col) => {
|
|
7134
7302
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
7135
7303
|
if (cellLoading(row, col))
|
|
7136
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height:
|
|
7304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens44.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
7137
7305
|
if (renderCell) return renderCell(row, col);
|
|
7138
7306
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
7139
7307
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MarketIdentity, { row, props });
|
|
@@ -7142,8 +7310,8 @@ function KjunMarketTable(props) {
|
|
|
7142
7310
|
KjunSparkline,
|
|
7143
7311
|
{
|
|
7144
7312
|
data: Array.isArray(value) ? value : [],
|
|
7145
|
-
width:
|
|
7146
|
-
height:
|
|
7313
|
+
width: import_tokens44.tokens.extensions.marketTable.sparklineWidth,
|
|
7314
|
+
height: import_tokens44.tokens.extensions.marketTable.sparklineHeight
|
|
7147
7315
|
}
|
|
7148
7316
|
);
|
|
7149
7317
|
if (col.type === "price")
|
|
@@ -7225,7 +7393,7 @@ function KjunMarketTable(props) {
|
|
|
7225
7393
|
KjunIcon,
|
|
7226
7394
|
{
|
|
7227
7395
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
7228
|
-
size:
|
|
7396
|
+
size: import_tokens44.tokens.extensions.marketTable.sortIconSize
|
|
7229
7397
|
}
|
|
7230
7398
|
)
|
|
7231
7399
|
]
|
|
@@ -7285,7 +7453,7 @@ function KjunMarketTable(props) {
|
|
|
7285
7453
|
{
|
|
7286
7454
|
style: {
|
|
7287
7455
|
textAlign: col.align,
|
|
7288
|
-
fontWeight: col.weight === "bold" ?
|
|
7456
|
+
fontWeight: col.weight === "bold" ? import_tokens44.tokens.typography.control.fontWeight : void 0
|
|
7289
7457
|
},
|
|
7290
7458
|
children: [
|
|
7291
7459
|
render(row, col),
|
|
@@ -7318,26 +7486,33 @@ function KjunMarketTable(props) {
|
|
|
7318
7486
|
}
|
|
7319
7487
|
|
|
7320
7488
|
// packages/react/src/list.tsx
|
|
7321
|
-
var
|
|
7489
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7490
|
+
var import_react52 = require("react");
|
|
7322
7491
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7323
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
7492
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onClick, ariaLabel, children }) {
|
|
7493
|
+
const content = (0, import_react52.useRef)(null), pressable = !!(href || onClick);
|
|
7494
|
+
(0, import_react52.useEffect)(() => {
|
|
7495
|
+
if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
|
|
7496
|
+
}, [pressable]);
|
|
7324
7497
|
const contents = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
7325
7498
|
leading && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-leading", children: leading }),
|
|
7326
7499
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-list-body", children: [
|
|
7327
7500
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
7328
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-description", children: description })
|
|
7501
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-description", children: description }),
|
|
7502
|
+
hasContent(children) && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { ref: content, className: "kjun-list-content", children })
|
|
7329
7503
|
] }),
|
|
7330
|
-
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing })
|
|
7504
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-list-trailing", children: trailing }),
|
|
7505
|
+
chevron && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "chevron-right", className: "kjun-list-chevron", size: import_tokens45.tokens.iconSizes.default })
|
|
7331
7506
|
] });
|
|
7332
|
-
const main = href ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: "kjun-list-main", type: "button", disabled, onClick, children: contents }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-main", children: contents });
|
|
7333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", children: [
|
|
7507
|
+
const main = href ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("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__ */ (0, import_jsx_runtime43.jsx)("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-main", children: contents });
|
|
7508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("li", { className: "kjun-list-row", "data-destructive": destructive || void 0, children: [
|
|
7334
7509
|
main,
|
|
7335
7510
|
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
7336
7511
|
] });
|
|
7337
7512
|
}
|
|
7338
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
7339
|
-
const id = "kjun-" + (0,
|
|
7340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7513
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
7514
|
+
const id = "kjun-" + (0, import_react52.useId)();
|
|
7515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "kjun-list-section", "data-surface": surface ? void 0 : "false", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
7341
7516
|
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
7342
7517
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
7343
7518
|
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { id, children: title }),
|
|
@@ -7348,12 +7523,15 @@ function KjunListSection({ title, description, actions, children, ariaLabel, div
|
|
|
7348
7523
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("ul", { className: "kjun-list", "aria-label": ariaLabel || title, "data-divider": divider ? void 0 : "false", "data-density": density === "compact" ? "compact" : void 0, children })
|
|
7349
7524
|
] });
|
|
7350
7525
|
}
|
|
7526
|
+
function KjunListItem({ children }) {
|
|
7527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { className: "kjun-list-item", children });
|
|
7528
|
+
}
|
|
7351
7529
|
|
|
7352
7530
|
// packages/react/src/app-navigation.tsx
|
|
7353
|
-
var
|
|
7531
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7354
7532
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7355
7533
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
7356
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value:
|
|
7534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TopNavigationContext.Provider, { value: import_tokens46.tokens.extensions.topNavigation, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("header", { className: "kjun-top-navigation", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-content", children: [
|
|
7357
7535
|
leading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
7358
7536
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
7359
7537
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: title }),
|
|
@@ -7374,7 +7552,7 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7374
7552
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
7375
7553
|
}, children: [
|
|
7376
7554
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
7377
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size:
|
|
7555
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: item.icon, size: import_tokens46.tokens.extensions.bottomNavigation.iconSize }),
|
|
7378
7556
|
badge
|
|
7379
7557
|
] }),
|
|
7380
7558
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
@@ -7386,21 +7564,21 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeAreaBottom = 0, key
|
|
|
7386
7564
|
}
|
|
7387
7565
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
7388
7566
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
7389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom:
|
|
7567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom: import_tokens46.tokens.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "kjun-bottom-action-content", children: [
|
|
7390
7568
|
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { children: description }),
|
|
7391
7569
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
7392
7570
|
] }) });
|
|
7393
7571
|
}
|
|
7394
7572
|
|
|
7395
7573
|
// packages/react/src/media.tsx
|
|
7396
|
-
var
|
|
7397
|
-
var
|
|
7574
|
+
var import_react53 = require("react");
|
|
7575
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7398
7576
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7399
7577
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
7400
|
-
const current = (0,
|
|
7578
|
+
const current = (0, import_react53.useRef)({ src, version: 0 });
|
|
7401
7579
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
7402
7580
|
const version = current.current.version;
|
|
7403
|
-
const [result, setResult] = (0,
|
|
7581
|
+
const [result, setResult] = (0, import_react53.useState)({ version, state: "loading" });
|
|
7404
7582
|
const state = result.version === version ? result.state : "loading";
|
|
7405
7583
|
const failed = !src || state === "error";
|
|
7406
7584
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
@@ -7413,28 +7591,28 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
7413
7591
|
setResult({ version, state: "error" });
|
|
7414
7592
|
onError == null ? void 0 : onError();
|
|
7415
7593
|
} }, version),
|
|
7416
|
-
failed && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "image", size:
|
|
7594
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-image-fallback", role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "image", size: import_tokens47.tokens.extensions.image.fallbackIconSize }) })
|
|
7417
7595
|
] });
|
|
7418
7596
|
}
|
|
7419
|
-
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
7597
|
+
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
7420
7598
|
const m = useKjunMessages();
|
|
7421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width:
|
|
7599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: import_tokens47.tokens.extensions.avatar[size], height: import_tokens47.tokens.extensions.avatar[size], ["--_kjun-avatar-color"]: color, ["--_kjun-avatar-text-color"]: textColor }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunImage, { src, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "user", size: import_tokens47.tokens.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
7422
7600
|
}
|
|
7423
7601
|
|
|
7424
7602
|
// packages/react/src/chip.tsx
|
|
7425
|
-
var
|
|
7603
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7426
7604
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7427
7605
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
7428
7606
|
const m = useKjunMessages();
|
|
7429
7607
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7430
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size:
|
|
7608
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: icon, size: import_tokens48.tokens.extensions.chip.iconSizes[size] }),
|
|
7431
7609
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: label }),
|
|
7432
|
-
removable && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: "x", size:
|
|
7610
|
+
removable && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-label": removeLabel || m.remove(label), disabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunIcon, { name: "x", size: import_tokens48.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
7433
7611
|
] });
|
|
7434
7612
|
}
|
|
7435
7613
|
|
|
7436
7614
|
// packages/react/src/fab.tsx
|
|
7437
|
-
var
|
|
7615
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
7438
7616
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7439
7617
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onClick }) {
|
|
7440
7618
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
@@ -7445,27 +7623,27 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
7445
7623
|
"aria-label": ariaLabel,
|
|
7446
7624
|
disabled,
|
|
7447
7625
|
onClick,
|
|
7448
|
-
style: { bottom:
|
|
7449
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size:
|
|
7626
|
+
style: { bottom: import_tokens49.tokens.extensions.fab.inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom) },
|
|
7627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunIcon, { name: icon, size: import_tokens49.tokens.extensions.fab.iconSize })
|
|
7450
7628
|
}
|
|
7451
7629
|
);
|
|
7452
7630
|
}
|
|
7453
7631
|
|
|
7454
7632
|
// packages/react/src/range-input.tsx
|
|
7455
|
-
var
|
|
7633
|
+
var import_react54 = require("react");
|
|
7456
7634
|
var import_react_aria_components10 = require("react-aria-components");
|
|
7457
|
-
var
|
|
7635
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
7458
7636
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7459
7637
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
7460
7638
|
const m = useKjunMessages();
|
|
7461
7639
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
|
|
7462
|
-
const domain = (0,
|
|
7640
|
+
const domain = (0, import_tokens50.createSliderDomain)(min, max, step);
|
|
7463
7641
|
const list = Array.isArray(value) ? value : [value];
|
|
7464
7642
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7465
|
-
const latest = (0,
|
|
7643
|
+
const latest = (0, import_react54.useRef)(value);
|
|
7466
7644
|
latest.current = value;
|
|
7467
|
-
const active = (0,
|
|
7468
|
-
(0,
|
|
7645
|
+
const active = (0, import_react54.useRef)(false);
|
|
7646
|
+
(0, import_react54.useEffect)(() => {
|
|
7469
7647
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7470
7648
|
}, [valid]);
|
|
7471
7649
|
const change = (next) => {
|
|
@@ -7502,24 +7680,24 @@ function KjunRangeSlider(props) {
|
|
|
7502
7680
|
}
|
|
7503
7681
|
|
|
7504
7682
|
// packages/react/src/quantity-stepper.tsx
|
|
7505
|
-
var
|
|
7506
|
-
var
|
|
7683
|
+
var import_react55 = require("react");
|
|
7684
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
7507
7685
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7508
7686
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7509
7687
|
const m = useKjunMessages();
|
|
7510
|
-
const geometry =
|
|
7511
|
-
const buttonStyle = { width:
|
|
7512
|
-
const domain = (0,
|
|
7688
|
+
const geometry = import_tokens51.tokens.extensions.compound;
|
|
7689
|
+
const buttonStyle = { width: import_tokens51.tokens.input[size].height, padding: 0 };
|
|
7690
|
+
const domain = (0, import_tokens51.createNumberDomain)({ min, max, step, precision });
|
|
7513
7691
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7514
|
-
const [draft, setDraft] = (0,
|
|
7692
|
+
const [draft, setDraft] = (0, import_react55.useState)(String(value));
|
|
7515
7693
|
const field = useKjunField();
|
|
7516
|
-
const composing = (0,
|
|
7517
|
-
(0,
|
|
7694
|
+
const composing = (0, import_react55.useRef)(false), dirty = (0, import_react55.useRef)(false), accepted = (0, import_react55.useRef)(value);
|
|
7695
|
+
(0, import_react55.useEffect)(() => {
|
|
7518
7696
|
setDraft(String(value));
|
|
7519
7697
|
accepted.current = value;
|
|
7520
7698
|
dirty.current = false;
|
|
7521
7699
|
}, [value, precision, min, max, step]);
|
|
7522
|
-
(0,
|
|
7700
|
+
(0, import_react55.useEffect)(() => {
|
|
7523
7701
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7524
7702
|
}, [valid]);
|
|
7525
7703
|
const emit = (next) => {
|
|
@@ -7543,7 +7721,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7543
7721
|
};
|
|
7544
7722
|
const key = (event) => {
|
|
7545
7723
|
if (blocked) return;
|
|
7546
|
-
const action = (0,
|
|
7724
|
+
const action = (0, import_tokens51.quantityKeyAction)(event, composing.current, dirty.current);
|
|
7547
7725
|
if (!action) return;
|
|
7548
7726
|
event.preventDefault();
|
|
7549
7727
|
if (action === "cancel") {
|
|
@@ -7594,18 +7772,18 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7594
7772
|
}
|
|
7595
7773
|
|
|
7596
7774
|
// packages/react/src/time-picker.tsx
|
|
7597
|
-
var
|
|
7598
|
-
var
|
|
7775
|
+
var import_react56 = require("react");
|
|
7776
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
7599
7777
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7600
7778
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
7601
7779
|
const m = useKjunMessages();
|
|
7602
7780
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
7603
|
-
const root = (0,
|
|
7604
|
-
const field = useKjunField(), uid = (0,
|
|
7781
|
+
const root = (0, import_react56.useRef)(null);
|
|
7782
|
+
const field = useKjunField(), uid = (0, import_react56.useId)();
|
|
7605
7783
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7606
|
-
const domain = (0,
|
|
7784
|
+
const domain = (0, import_react56.useMemo)(() => (0, import_tokens52.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7607
7785
|
const valid = domain.valid && domain.accepts(value);
|
|
7608
|
-
(0,
|
|
7786
|
+
(0, import_react56.useEffect)(() => {
|
|
7609
7787
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7610
7788
|
}, [valid]);
|
|
7611
7789
|
const change = (next) => {
|
|
@@ -7619,7 +7797,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7619
7797
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "kjun-time-segments", children: [m.hour, m.minute, m.second].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
7620
7798
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7621
7799
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
7800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react56.Fragment, { children: [
|
|
7623
7801
|
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7624
7802
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "kjun-time-segment", children: [
|
|
7625
7803
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|