@kjun-ui/react 0.11.0 → 0.12.1
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 +779 -719
- package/dist/index.js +472 -412
- package/dist/styles.css +82 -0
- package/dist/types/packages/react/src/index.d.cts +1 -0
- package/dist/types/packages/react/src/index.d.ts +1 -0
- package/dist/types/packages/react/src/layout-primitives.d.cts +166 -0
- package/dist/types/packages/react/src/layout-primitives.d.ts +166 -0
- package/dist/types/shared/package-runtime/layout-primitives.d.cts +15 -0
- package/dist/types/shared/package-runtime/layout-primitives.d.ts +15 -0
- package/dist/types/shared/package-runtime/use-layer.d.cts +1 -0
- package/dist/types/shared/package-runtime/use-layer.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -69,6 +69,7 @@ __export(index_exports, {
|
|
|
69
69
|
KjunIcon: () => KjunIcon,
|
|
70
70
|
KjunIconToggle: () => KjunIconToggle,
|
|
71
71
|
KjunImage: () => KjunImage,
|
|
72
|
+
KjunInline: () => KjunInline,
|
|
72
73
|
KjunInput: () => KjunInput,
|
|
73
74
|
KjunKpiHero: () => KjunKpiHero,
|
|
74
75
|
KjunKpiRow: () => KjunKpiRow,
|
|
@@ -101,10 +102,12 @@ __export(index_exports, {
|
|
|
101
102
|
KjunSlider: () => KjunSlider,
|
|
102
103
|
KjunSparkline: () => KjunSparkline,
|
|
103
104
|
KjunSpinner: () => KjunSpinner,
|
|
105
|
+
KjunStack: () => KjunStack,
|
|
104
106
|
KjunSwitch: () => KjunSwitch,
|
|
105
107
|
KjunTabPane: () => KjunTabPane,
|
|
106
108
|
KjunTable: () => KjunTable,
|
|
107
109
|
KjunTabs: () => KjunTabs,
|
|
110
|
+
KjunText: () => KjunText,
|
|
108
111
|
KjunTextarea: () => KjunTextarea,
|
|
109
112
|
KjunTimePicker: () => KjunTimePicker,
|
|
110
113
|
KjunTooltip: () => KjunTooltip,
|
|
@@ -429,19 +432,25 @@ function usePopupFocusGuard(trigger) {
|
|
|
429
432
|
function currentFocus() {
|
|
430
433
|
return typeof document === "undefined" ? null : document.activeElement;
|
|
431
434
|
}
|
|
435
|
+
function domElement(target) {
|
|
436
|
+
const node = target;
|
|
437
|
+
return typeof (node == null ? void 0 : node.matches) === "function" && typeof node.closest === "function" && typeof node.querySelector === "function";
|
|
438
|
+
}
|
|
432
439
|
function focusTrigger(target) {
|
|
433
|
-
if (
|
|
440
|
+
if (domElement(target)) {
|
|
434
441
|
return target.matches("button,input,[href],[tabindex]") ? target : target.querySelector("button,input,[href],[tabindex]") || target;
|
|
435
442
|
}
|
|
436
443
|
return target;
|
|
437
444
|
}
|
|
445
|
+
function isRestorableFocus(item) {
|
|
446
|
+
return (item == null ? void 0 : item.isConnected) !== false && !(domElement(item) && item.closest("[inert]"));
|
|
447
|
+
}
|
|
438
448
|
function restoreFocus(target, state, id, fallback2) {
|
|
439
|
-
const usable = (item) => (item == null ? void 0 : item.isConnected) !== false && !(typeof HTMLElement !== "undefined" && item instanceof HTMLElement && item.closest("[inert]"));
|
|
440
449
|
const restore = () => {
|
|
441
450
|
var _a, _b, _c, _d, _e;
|
|
442
451
|
if (state.entries.has(id)) return;
|
|
443
|
-
if (
|
|
444
|
-
else if (fallback2 && fallback2 !== target &&
|
|
452
|
+
if (isRestorableFocus(target)) (_a = target == null ? void 0 : target.focus) == null ? void 0 : _a.call(target, { preventScroll: true });
|
|
453
|
+
else if (fallback2 && fallback2 !== target && isRestorableFocus(fallback2)) (_b = fallback2.focus) == null ? void 0 : _b.call(fallback2, { preventScroll: true });
|
|
445
454
|
else (_e = (_d = (_c = state.topWindow()) == null ? void 0 : _c.root) == null ? void 0 : _d.focus) == null ? void 0 : _e.call(_d, { preventScroll: true });
|
|
446
455
|
};
|
|
447
456
|
if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(restore);
|
|
@@ -1654,14 +1663,65 @@ function KjunSkeleton({
|
|
|
1654
1663
|
);
|
|
1655
1664
|
}
|
|
1656
1665
|
|
|
1657
|
-
//
|
|
1666
|
+
// packages/react/src/layout-primitives.tsx
|
|
1658
1667
|
var import_react15 = require("react");
|
|
1668
|
+
|
|
1669
|
+
// shared/package-runtime/layout-primitives.ts
|
|
1670
|
+
var numeric = /^(number|display)/;
|
|
1671
|
+
var textTypeClass = (variant) => "kjun-type-" + variant.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
|
|
1672
|
+
var defaultTextTag = (variant) => variant === "pageTitle" ? "h1" : variant === "sectionTitle" ? "h2" : variant === "cardTitle" ? "h3" : numeric.test(variant) ? "span" : "p";
|
|
1673
|
+
|
|
1674
|
+
// packages/react/src/layout-primitives.tsx
|
|
1675
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1676
|
+
var join = (...names) => names.filter(Boolean).join(" ");
|
|
1677
|
+
function KjunText({ variant = "body", tone = "default", as, align, maxLines, className, style, children, ...rest }) {
|
|
1678
|
+
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
1679
|
+
return (0, import_react15.createElement)(as != null ? as : defaultTextTag(variant), {
|
|
1680
|
+
...rest,
|
|
1681
|
+
className: join("kjun-text", textTypeClass(variant), className),
|
|
1682
|
+
// 안에 넣은 링크·강조 같은 앱 요소는 KJUN 리셋을 받지 않는다.
|
|
1683
|
+
"data-kjun-content": "",
|
|
1684
|
+
"data-tone": tone === "default" ? void 0 : tone,
|
|
1685
|
+
"data-align": align,
|
|
1686
|
+
"data-max-lines": lines,
|
|
1687
|
+
style: lines ? { ...style, ["--_kjun-text-lines"]: lines } : style
|
|
1688
|
+
}, children);
|
|
1689
|
+
}
|
|
1690
|
+
function KjunStack({ gap = "md", align = "stretch", as = "div", className, style, children, ...rest }) {
|
|
1691
|
+
return (0, import_react15.createElement)(as, {
|
|
1692
|
+
...rest,
|
|
1693
|
+
className: className || void 0,
|
|
1694
|
+
style,
|
|
1695
|
+
"data-kjun-stack": "",
|
|
1696
|
+
"data-gap": gap,
|
|
1697
|
+
"data-align": align
|
|
1698
|
+
}, children);
|
|
1699
|
+
}
|
|
1700
|
+
function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = true, className, style, children, ...rest }) {
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1702
|
+
"div",
|
|
1703
|
+
{
|
|
1704
|
+
...rest,
|
|
1705
|
+
className: className || void 0,
|
|
1706
|
+
style,
|
|
1707
|
+
"data-kjun-inline": "",
|
|
1708
|
+
"data-gap": gap,
|
|
1709
|
+
"data-align": align,
|
|
1710
|
+
"data-justify": justify,
|
|
1711
|
+
"data-wrap": wrap ? void 0 : "false",
|
|
1712
|
+
children
|
|
1713
|
+
}
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// shared/package-runtime/feedback-dialog.ts
|
|
1718
|
+
var import_react16 = require("react");
|
|
1659
1719
|
function useFeedbackDialog(controller, request) {
|
|
1660
1720
|
const options = request.options;
|
|
1661
|
-
const [value, setValue] = (0,
|
|
1662
|
-
const [error, setError] = (0,
|
|
1663
|
-
const [busy, setBusy] = (0,
|
|
1664
|
-
const working = (0,
|
|
1721
|
+
const [value, setValue] = (0, import_react16.useState)(options.initialValue || "");
|
|
1722
|
+
const [error, setError] = (0, import_react16.useState)("");
|
|
1723
|
+
const [busy, setBusy] = (0, import_react16.useState)(false);
|
|
1724
|
+
const working = (0, import_react16.useRef)(false);
|
|
1665
1725
|
const active = () => {
|
|
1666
1726
|
var _a;
|
|
1667
1727
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -1704,11 +1764,11 @@ function useFeedbackDialog(controller, request) {
|
|
|
1704
1764
|
|
|
1705
1765
|
// shared/package-runtime/feedback-motion.ts
|
|
1706
1766
|
var import_tokens11 = require("@kjun-ui/tokens");
|
|
1707
|
-
var
|
|
1767
|
+
var import_react17 = require("react");
|
|
1708
1768
|
function usePresentedToasts(toasts, reduced) {
|
|
1709
|
-
const [items, setItems] = (0,
|
|
1710
|
-
const removals = (0,
|
|
1711
|
-
(0,
|
|
1769
|
+
const [items, setItems] = (0, import_react17.useState)([]);
|
|
1770
|
+
const removals = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
1771
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
1712
1772
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
1713
1773
|
setItems((previous) => {
|
|
1714
1774
|
const old = new Map(previous.map((item) => [item.toast.id, item]));
|
|
@@ -1730,15 +1790,15 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
1730
1790
|
removals.current.clear();
|
|
1731
1791
|
}
|
|
1732
1792
|
}, [toasts, reduced]);
|
|
1733
|
-
(0,
|
|
1793
|
+
(0, import_react17.useLayoutEffect)(() => () => {
|
|
1734
1794
|
for (const timer of removals.current.values()) clearTimeout(timer);
|
|
1735
1795
|
removals.current.clear();
|
|
1736
1796
|
}, []);
|
|
1737
1797
|
return items;
|
|
1738
1798
|
}
|
|
1739
1799
|
function usePresentedRequest(current, reduced) {
|
|
1740
|
-
const [request, setRequest] = (0,
|
|
1741
|
-
(0,
|
|
1800
|
+
const [request, setRequest] = (0, import_react17.useState)(current);
|
|
1801
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
1742
1802
|
if (!request || request.id === (current == null ? void 0 : current.id) || reduced) {
|
|
1743
1803
|
setRequest(current);
|
|
1744
1804
|
return;
|
|
@@ -1750,15 +1810,15 @@ function usePresentedRequest(current, reduced) {
|
|
|
1750
1810
|
}
|
|
1751
1811
|
|
|
1752
1812
|
// packages/react/src/feedback-context.ts
|
|
1753
|
-
var
|
|
1754
|
-
var KjunFeedbackContext = (0,
|
|
1813
|
+
var import_react18 = require("react");
|
|
1814
|
+
var KjunFeedbackContext = (0, import_react18.createContext)(null);
|
|
1755
1815
|
function useOptionalKjunFeedback() {
|
|
1756
|
-
return (0,
|
|
1816
|
+
return (0, import_react18.useContext)(KjunFeedbackContext);
|
|
1757
1817
|
}
|
|
1758
1818
|
|
|
1759
1819
|
// packages/react/src/toast-stack.tsx
|
|
1760
1820
|
var import_tokens13 = require("@kjun-ui/tokens");
|
|
1761
|
-
var
|
|
1821
|
+
var import_react20 = require("react");
|
|
1762
1822
|
|
|
1763
1823
|
// shared/package-runtime/toast-layout.ts
|
|
1764
1824
|
var import_tokens12 = require("@kjun-ui/tokens");
|
|
@@ -1820,15 +1880,15 @@ function createToastLayout() {
|
|
|
1820
1880
|
}
|
|
1821
1881
|
|
|
1822
1882
|
// packages/react/src/toast.tsx
|
|
1823
|
-
var
|
|
1824
|
-
var
|
|
1883
|
+
var import_react19 = require("react");
|
|
1884
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1825
1885
|
function ToastView({
|
|
1826
1886
|
toast,
|
|
1827
1887
|
controller
|
|
1828
1888
|
}) {
|
|
1829
|
-
const previous = (0,
|
|
1830
|
-
const reasons = (0,
|
|
1831
|
-
(0,
|
|
1889
|
+
const previous = (0, import_react19.useRef)(null);
|
|
1890
|
+
const reasons = (0, import_react19.useRef)({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
1891
|
+
(0, import_react19.useEffect)(() => {
|
|
1832
1892
|
previous.current = document.activeElement;
|
|
1833
1893
|
return () => {
|
|
1834
1894
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -1847,7 +1907,7 @@ function ToastView({
|
|
|
1847
1907
|
warning: "alert-triangle",
|
|
1848
1908
|
info: "info-circle"
|
|
1849
1909
|
}[tone];
|
|
1850
|
-
return /* @__PURE__ */ (0,
|
|
1910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1851
1911
|
"div",
|
|
1852
1912
|
{
|
|
1853
1913
|
className: "kjun-toast",
|
|
@@ -1863,18 +1923,18 @@ function ToastView({
|
|
|
1863
1923
|
controller.resumeToast(toast.id, reasons.focus);
|
|
1864
1924
|
},
|
|
1865
1925
|
children: [
|
|
1866
|
-
/* @__PURE__ */ (0,
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1867
1927
|
"span",
|
|
1868
1928
|
{
|
|
1869
1929
|
className: "kjun-toast-icon",
|
|
1870
1930
|
style: { color: `var(--_kjun-color-${tone}-accent)` },
|
|
1871
|
-
children: /* @__PURE__ */ (0,
|
|
1931
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(KjunIcon, { name: icon })
|
|
1872
1932
|
}
|
|
1873
1933
|
),
|
|
1874
|
-
/* @__PURE__ */ (0,
|
|
1875
|
-
toast.title && /* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1877
|
-
toast.action && /* @__PURE__ */ (0,
|
|
1934
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "kjun-toast-content", children: [
|
|
1935
|
+
toast.title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: toast.title }),
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "kjun-toast-message", children: toast.message }),
|
|
1937
|
+
toast.action && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1878
1938
|
"button",
|
|
1879
1939
|
{
|
|
1880
1940
|
type: "button",
|
|
@@ -1891,17 +1951,17 @@ function ToastView({
|
|
|
1891
1951
|
}
|
|
1892
1952
|
)
|
|
1893
1953
|
] }),
|
|
1894
|
-
toast.closable !== false && /* @__PURE__ */ (0,
|
|
1954
|
+
toast.closable !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1895
1955
|
"button",
|
|
1896
1956
|
{
|
|
1897
1957
|
type: "button",
|
|
1898
1958
|
className: "kjun-toast-close",
|
|
1899
1959
|
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30",
|
|
1900
1960
|
onClick: () => dismiss(),
|
|
1901
|
-
children: /* @__PURE__ */ (0,
|
|
1961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(KjunIcon, { name: "x" })
|
|
1902
1962
|
}
|
|
1903
1963
|
),
|
|
1904
|
-
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */ (0,
|
|
1964
|
+
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1905
1965
|
"div",
|
|
1906
1966
|
{
|
|
1907
1967
|
"aria-hidden": "true",
|
|
@@ -1921,12 +1981,12 @@ function ToastView({
|
|
|
1921
1981
|
}
|
|
1922
1982
|
|
|
1923
1983
|
// packages/react/src/toast-stack.tsx
|
|
1924
|
-
var
|
|
1984
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1925
1985
|
function ToastSurface({ item, controller }) {
|
|
1926
|
-
const ref = (0,
|
|
1927
|
-
const current = (0,
|
|
1928
|
-
const entryFinished = (0,
|
|
1929
|
-
(0,
|
|
1986
|
+
const ref = (0, import_react20.useRef)(null), reduced = useReducedMotion();
|
|
1987
|
+
const current = (0, import_react20.useRef)(null);
|
|
1988
|
+
const entryFinished = (0, import_react20.useRef)(false);
|
|
1989
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
1930
1990
|
var _a, _b;
|
|
1931
1991
|
const el = ref.current;
|
|
1932
1992
|
if (!el) return;
|
|
@@ -1955,24 +2015,24 @@ function ToastSurface({ item, controller }) {
|
|
|
1955
2015
|
for (const animation of animations) animation.cancel();
|
|
1956
2016
|
};
|
|
1957
2017
|
}, [item.exiting, item.born, reduced]);
|
|
1958
|
-
return /* @__PURE__ */ (0,
|
|
2018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, inert: item.exiting, "aria-hidden": item.exiting || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ToastView, { toast: item.toast, controller }) });
|
|
1959
2019
|
}
|
|
1960
2020
|
function ToastStack({ items, controller }) {
|
|
1961
2021
|
var _a;
|
|
1962
2022
|
const layers = useLayerState();
|
|
1963
|
-
const root = (0,
|
|
2023
|
+
const root = (0, import_react20.useRef)(null), layout = (0, import_react20.useRef)(createToastLayout());
|
|
1964
2024
|
const reduced = useReducedMotion();
|
|
1965
|
-
(0,
|
|
2025
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
1966
2026
|
if (root.current) layout.current.update(root.current, reduced);
|
|
1967
2027
|
});
|
|
1968
|
-
(0,
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
2028
|
+
(0, import_react20.useLayoutEffect)(() => () => layout.current.destroy(), []);
|
|
2029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(
|
|
1970
2030
|
"div",
|
|
1971
2031
|
{
|
|
1972
2032
|
"data-toast-id": item.toast.id,
|
|
1973
2033
|
"data-exiting": item.exiting,
|
|
1974
2034
|
className: "kjun-toast-slot",
|
|
1975
|
-
children: /* @__PURE__ */ (0,
|
|
2035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ToastSurface, { item, controller })
|
|
1976
2036
|
},
|
|
1977
2037
|
item.toast.id
|
|
1978
2038
|
)) });
|
|
@@ -1980,8 +2040,8 @@ function ToastStack({ items, controller }) {
|
|
|
1980
2040
|
|
|
1981
2041
|
// packages/react/src/feedback.tsx
|
|
1982
2042
|
var import_tokens14 = require("@kjun-ui/tokens");
|
|
1983
|
-
var
|
|
1984
|
-
var
|
|
2043
|
+
var import_react21 = require("react");
|
|
2044
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1985
2045
|
function useKjunFeedback() {
|
|
1986
2046
|
const value = useOptionalKjunFeedback();
|
|
1987
2047
|
if (!value) throw Error("useKjunFeedback requires KjunFeedbackProvider.");
|
|
@@ -1993,7 +2053,7 @@ function FeedbackDialog({
|
|
|
1993
2053
|
open
|
|
1994
2054
|
}) {
|
|
1995
2055
|
const { options, value, error, busy, edit, cancel, submit } = useFeedbackDialog(controller, request);
|
|
1996
|
-
return /* @__PURE__ */ (0,
|
|
2056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1997
2057
|
KjunModal,
|
|
1998
2058
|
{
|
|
1999
2059
|
open,
|
|
@@ -2011,8 +2071,8 @@ function FeedbackDialog({
|
|
|
2011
2071
|
onConfirm: submit,
|
|
2012
2072
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
2013
2073
|
children: [
|
|
2014
|
-
options.message && /* @__PURE__ */ (0,
|
|
2015
|
-
request.kind === "prompt" && /* @__PURE__ */ (0,
|
|
2074
|
+
options.message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: options.message }),
|
|
2075
|
+
request.kind === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2016
2076
|
KjunInput,
|
|
2017
2077
|
{
|
|
2018
2078
|
autoFocus: true,
|
|
@@ -2030,9 +2090,9 @@ function FeedbackDialog({
|
|
|
2030
2090
|
}
|
|
2031
2091
|
function KjunFeedbackProvider({ children }) {
|
|
2032
2092
|
var _a;
|
|
2033
|
-
const [controller] = (0,
|
|
2034
|
-
const life = (0,
|
|
2035
|
-
const snapshot = (0,
|
|
2093
|
+
const [controller] = (0, import_react21.useState)(import_tokens14.createFeedbackController);
|
|
2094
|
+
const life = (0, import_react21.useRef)(0);
|
|
2095
|
+
const snapshot = (0, import_react21.useSyncExternalStore)(
|
|
2036
2096
|
controller.subscribe,
|
|
2037
2097
|
controller.getSnapshot,
|
|
2038
2098
|
controller.getSnapshot
|
|
@@ -2040,7 +2100,7 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2040
2100
|
const reduced = useReducedMotion();
|
|
2041
2101
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2042
2102
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2043
|
-
(0,
|
|
2103
|
+
(0, import_react21.useEffect)(() => {
|
|
2044
2104
|
const version = ++life.current;
|
|
2045
2105
|
return () => {
|
|
2046
2106
|
queueMicrotask(() => {
|
|
@@ -2048,21 +2108,21 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2048
2108
|
});
|
|
2049
2109
|
};
|
|
2050
2110
|
}, [controller]);
|
|
2051
|
-
const [layers, setLayers] = (0,
|
|
2052
|
-
const register = (0,
|
|
2111
|
+
const [layers, setLayers] = (0, import_react21.useState)([]);
|
|
2112
|
+
const register = (0, import_react21.useCallback)((id, order) => {
|
|
2053
2113
|
setLayers((current) => [...current, { id, order }]);
|
|
2054
2114
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2055
2115
|
}, []);
|
|
2056
2116
|
const top = (_a = [...layers].sort((a, b) => a.order - b.order).at(-1)) == null ? void 0 : _a.id;
|
|
2057
|
-
const renderToasts = () => /* @__PURE__ */ (0,
|
|
2058
|
-
return /* @__PURE__ */ (0,
|
|
2117
|
+
const renderToasts = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastStack, { items: toasts, controller });
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(KjunFeedbackContext.Provider, { value: controller.api, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2059
2119
|
FeedbackOverlayContext.Provider,
|
|
2060
2120
|
{
|
|
2061
2121
|
value: { top, register, render: renderToasts },
|
|
2062
2122
|
children: [
|
|
2063
2123
|
children,
|
|
2064
2124
|
!layers.length && renderToasts(),
|
|
2065
|
-
dialog.request && /* @__PURE__ */ (0,
|
|
2125
|
+
dialog.request && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2066
2126
|
FeedbackDialog,
|
|
2067
2127
|
{
|
|
2068
2128
|
request: dialog.request,
|
|
@@ -2078,11 +2138,11 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2078
2138
|
|
|
2079
2139
|
// packages/react/src/controls.tsx
|
|
2080
2140
|
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2081
|
-
var
|
|
2141
|
+
var import_react23 = require("react");
|
|
2082
2142
|
var import_react_aria_components2 = require("react-aria-components");
|
|
2083
2143
|
|
|
2084
2144
|
// packages/react/src/use-selection-indicator.ts
|
|
2085
|
-
var
|
|
2145
|
+
var import_react22 = require("react");
|
|
2086
2146
|
|
|
2087
2147
|
// shared/package-runtime/selection-indicator.ts
|
|
2088
2148
|
var import_tokens15 = require("@kjun-ui/tokens");
|
|
@@ -2154,11 +2214,11 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2154
2214
|
|
|
2155
2215
|
// packages/react/src/use-selection-indicator.ts
|
|
2156
2216
|
function useSelectionIndicator(tabs = false) {
|
|
2157
|
-
const group = (0,
|
|
2158
|
-
const indicator = (0,
|
|
2159
|
-
const sync = (0,
|
|
2217
|
+
const group = (0, import_react22.useRef)(null);
|
|
2218
|
+
const indicator = (0, import_react22.useRef)(null);
|
|
2219
|
+
const sync = (0, import_react22.useRef)(() => {
|
|
2160
2220
|
});
|
|
2161
|
-
(0,
|
|
2221
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
2162
2222
|
const root = group.current, marker = indicator.current;
|
|
2163
2223
|
if (!root || !marker) return;
|
|
2164
2224
|
const handle = selectionIndicator(root, marker, tabs);
|
|
@@ -2169,7 +2229,7 @@ function useSelectionIndicator(tabs = false) {
|
|
|
2169
2229
|
};
|
|
2170
2230
|
};
|
|
2171
2231
|
}, [tabs]);
|
|
2172
|
-
(0,
|
|
2232
|
+
(0, import_react22.useLayoutEffect)(() => sync.current());
|
|
2173
2233
|
return { group, indicator };
|
|
2174
2234
|
}
|
|
2175
2235
|
|
|
@@ -2188,7 +2248,7 @@ function groupKeydown(event) {
|
|
|
2188
2248
|
}
|
|
2189
2249
|
|
|
2190
2250
|
// packages/react/src/controls.tsx
|
|
2191
|
-
var
|
|
2251
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2192
2252
|
function KjunCheckbox({
|
|
2193
2253
|
value,
|
|
2194
2254
|
val,
|
|
@@ -2202,7 +2262,7 @@ function KjunCheckbox({
|
|
|
2202
2262
|
}) {
|
|
2203
2263
|
const checked = Array.isArray(value) ? value.includes(val) : value;
|
|
2204
2264
|
const field = useKjunField();
|
|
2205
|
-
return /* @__PURE__ */ (0,
|
|
2265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2206
2266
|
import_react_aria_components2.Checkbox,
|
|
2207
2267
|
{
|
|
2208
2268
|
isSelected: checked,
|
|
@@ -2219,14 +2279,14 @@ function KjunCheckbox({
|
|
|
2219
2279
|
onChange == null ? void 0 : onChange(result);
|
|
2220
2280
|
},
|
|
2221
2281
|
children: [
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2223
2283
|
"span",
|
|
2224
2284
|
{
|
|
2225
2285
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2226
|
-
children: checked && /* @__PURE__ */ (0,
|
|
2286
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: "check", size: import_tokens16.tokens.extensions.checkbox.iconSizes[size] })
|
|
2227
2287
|
}
|
|
2228
2288
|
),
|
|
2229
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2289
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2230
2290
|
]
|
|
2231
2291
|
}
|
|
2232
2292
|
);
|
|
@@ -2243,14 +2303,14 @@ function KjunSwitch({
|
|
|
2243
2303
|
}) {
|
|
2244
2304
|
const field = useKjunField();
|
|
2245
2305
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2246
|
-
const markInput = (0,
|
|
2306
|
+
const markInput = (0, import_react23.useCallback)((input) => {
|
|
2247
2307
|
if (!input) return;
|
|
2248
2308
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2249
2309
|
else input.removeAttribute("aria-invalid");
|
|
2250
2310
|
if (required) input.setAttribute("aria-required", "true");
|
|
2251
2311
|
else input.removeAttribute("aria-required");
|
|
2252
2312
|
}, [invalid, required]);
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2254
2314
|
import_react_aria_components2.Switch,
|
|
2255
2315
|
{
|
|
2256
2316
|
isSelected: value,
|
|
@@ -2264,19 +2324,19 @@ function KjunSwitch({
|
|
|
2264
2324
|
onChange == null ? void 0 : onChange(next);
|
|
2265
2325
|
},
|
|
2266
2326
|
children: [
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2268
2328
|
"span",
|
|
2269
2329
|
{
|
|
2270
2330
|
className: `kjun-switch kjun-switch--${size}${value ? " kjun-switch--on" : ""}`,
|
|
2271
|
-
children: /* @__PURE__ */ (0,
|
|
2331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-switch-thumb" })
|
|
2272
2332
|
}
|
|
2273
2333
|
),
|
|
2274
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2334
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2275
2335
|
]
|
|
2276
2336
|
}
|
|
2277
2337
|
);
|
|
2278
2338
|
}
|
|
2279
|
-
var RadioContext = (0,
|
|
2339
|
+
var RadioContext = (0, import_react23.createContext)(null);
|
|
2280
2340
|
function KjunRadio({
|
|
2281
2341
|
value,
|
|
2282
2342
|
val,
|
|
@@ -2288,9 +2348,9 @@ function KjunRadio({
|
|
|
2288
2348
|
onValueChange,
|
|
2289
2349
|
onChange
|
|
2290
2350
|
}) {
|
|
2291
|
-
const group = (0,
|
|
2292
|
-
return /* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2351
|
+
const group = (0, import_react23.useContext)(RadioContext), selected = (group ? group.value : value) === val;
|
|
2352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""), children: [
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2294
2354
|
"input",
|
|
2295
2355
|
{
|
|
2296
2356
|
type: "radio",
|
|
@@ -2308,14 +2368,14 @@ function KjunRadio({
|
|
|
2308
2368
|
}
|
|
2309
2369
|
}
|
|
2310
2370
|
),
|
|
2311
|
-
/* @__PURE__ */ (0,
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2312
2372
|
"span",
|
|
2313
2373
|
{
|
|
2314
2374
|
className: "kjun-choice-control kjun-radio" + (selected ? " kjun-radio--checked" : ""),
|
|
2315
|
-
children: selected && /* @__PURE__ */ (0,
|
|
2375
|
+
children: selected && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-radio-dot" })
|
|
2316
2376
|
}
|
|
2317
2377
|
),
|
|
2318
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2378
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2319
2379
|
] });
|
|
2320
2380
|
}
|
|
2321
2381
|
function KjunRadioGroup({
|
|
@@ -2327,8 +2387,8 @@ function KjunRadioGroup({
|
|
|
2327
2387
|
onValueChange,
|
|
2328
2388
|
onChange
|
|
2329
2389
|
}) {
|
|
2330
|
-
const name = "kjun-" + (0,
|
|
2331
|
-
return /* @__PURE__ */ (0,
|
|
2390
|
+
const name = "kjun-" + (0, import_react23.useId)();
|
|
2391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2332
2392
|
RadioContext.Provider,
|
|
2333
2393
|
{
|
|
2334
2394
|
value: {
|
|
@@ -2339,7 +2399,7 @@ function KjunRadioGroup({
|
|
|
2339
2399
|
onChange == null ? void 0 : onChange(next);
|
|
2340
2400
|
}
|
|
2341
2401
|
},
|
|
2342
|
-
children: /* @__PURE__ */ (0,
|
|
2402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2343
2403
|
"div",
|
|
2344
2404
|
{
|
|
2345
2405
|
role: "radiogroup",
|
|
@@ -2351,7 +2411,7 @@ function KjunRadioGroup({
|
|
|
2351
2411
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2352
2412
|
gap: direction === "vertical" ? import_tokens16.tokens.dimension.value8 : import_tokens16.tokens.dimension.value16
|
|
2353
2413
|
},
|
|
2354
|
-
children: children || options.map((option) => /* @__PURE__ */ (0,
|
|
2414
|
+
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2355
2415
|
KjunRadio,
|
|
2356
2416
|
{
|
|
2357
2417
|
val: option.value,
|
|
@@ -2365,7 +2425,7 @@ function KjunRadioGroup({
|
|
|
2365
2425
|
}
|
|
2366
2426
|
);
|
|
2367
2427
|
}
|
|
2368
|
-
var KjunTextarea = (0,
|
|
2428
|
+
var KjunTextarea = (0, import_react23.forwardRef)(
|
|
2369
2429
|
function KjunTextarea2({
|
|
2370
2430
|
value,
|
|
2371
2431
|
size = "md",
|
|
@@ -2382,7 +2442,7 @@ var KjunTextarea = (0, import_react22.forwardRef)(
|
|
|
2382
2442
|
var _a;
|
|
2383
2443
|
const field = useKjunField();
|
|
2384
2444
|
const spec = import_tokens16.tokens.input[size];
|
|
2385
|
-
return /* @__PURE__ */ (0,
|
|
2445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2386
2446
|
"textarea",
|
|
2387
2447
|
{
|
|
2388
2448
|
...props,
|
|
@@ -2424,7 +2484,7 @@ function KjunButtonGroup({
|
|
|
2424
2484
|
onChange
|
|
2425
2485
|
}) {
|
|
2426
2486
|
const { group, indicator } = useSelectionIndicator();
|
|
2427
|
-
return /* @__PURE__ */ (0,
|
|
2487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2428
2488
|
"div",
|
|
2429
2489
|
{
|
|
2430
2490
|
ref: group,
|
|
@@ -2439,7 +2499,7 @@ function KjunButtonGroup({
|
|
|
2439
2499
|
width: fullWidth ? "100%" : "fit-content"
|
|
2440
2500
|
},
|
|
2441
2501
|
children: [
|
|
2442
|
-
/* @__PURE__ */ (0,
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2443
2503
|
"span",
|
|
2444
2504
|
{
|
|
2445
2505
|
ref: indicator,
|
|
@@ -2449,7 +2509,7 @@ function KjunButtonGroup({
|
|
|
2449
2509
|
style: { borderRadius: import_tokens16.tokens.buttonGroup.itemRadii[size] }
|
|
2450
2510
|
}
|
|
2451
2511
|
),
|
|
2452
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
2512
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2453
2513
|
"button",
|
|
2454
2514
|
{
|
|
2455
2515
|
type: "button",
|
|
@@ -2466,10 +2526,10 @@ function KjunButtonGroup({
|
|
|
2466
2526
|
onChange == null ? void 0 : onChange(option.value);
|
|
2467
2527
|
},
|
|
2468
2528
|
children: [
|
|
2469
|
-
option.icon && /* @__PURE__ */ (0,
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2529
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: option.icon, size: import_tokens16.tokens.extensions.selection.iconSize }),
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "kjun-button-group-label", children: [
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens16.tokens.button.typography[size]), children: option.label }),
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: option.label })
|
|
2473
2533
|
] })
|
|
2474
2534
|
]
|
|
2475
2535
|
},
|
|
@@ -2491,7 +2551,7 @@ function KjunFilterGroup({
|
|
|
2491
2551
|
onChange
|
|
2492
2552
|
}) {
|
|
2493
2553
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
2494
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2495
2555
|
"div",
|
|
2496
2556
|
{
|
|
2497
2557
|
role: "group",
|
|
@@ -2499,7 +2559,7 @@ function KjunFilterGroup({
|
|
|
2499
2559
|
className: "kjun-filter-group",
|
|
2500
2560
|
"data-scroll": scroll,
|
|
2501
2561
|
onKeyDown: groupKeydown,
|
|
2502
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
2562
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2503
2563
|
"button",
|
|
2504
2564
|
{
|
|
2505
2565
|
type: "button",
|
|
@@ -2512,7 +2572,7 @@ function KjunFilterGroup({
|
|
|
2512
2572
|
onValueChange == null ? void 0 : onValueChange(next);
|
|
2513
2573
|
onChange == null ? void 0 : onChange(next);
|
|
2514
2574
|
},
|
|
2515
|
-
children: /* @__PURE__ */ (0,
|
|
2575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2516
2576
|
"span",
|
|
2517
2577
|
{
|
|
2518
2578
|
style: {
|
|
@@ -2521,11 +2581,11 @@ function KjunFilterGroup({
|
|
|
2521
2581
|
...selectionTypeStyle(size, selected(option.value))
|
|
2522
2582
|
},
|
|
2523
2583
|
children: [
|
|
2524
|
-
option.dot && /* @__PURE__ */ (0,
|
|
2525
|
-
option.icon && /* @__PURE__ */ (0,
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2584
|
+
option.dot && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("i", { style: { background: option.dot } }),
|
|
2585
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: option.icon, size: import_tokens16.tokens.extensions.selection.iconSize }),
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "kjun-filter-label", children: [
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens16.tokens.button.typography[size]), children: option.label }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: option.label })
|
|
2529
2589
|
] })
|
|
2530
2590
|
]
|
|
2531
2591
|
}
|
|
@@ -2539,9 +2599,9 @@ function KjunFilterGroup({
|
|
|
2539
2599
|
|
|
2540
2600
|
// packages/react/src/floating-panel.tsx
|
|
2541
2601
|
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2542
|
-
var
|
|
2602
|
+
var import_react24 = require("react");
|
|
2543
2603
|
var import_react_aria_components3 = require("react-aria-components");
|
|
2544
|
-
var
|
|
2604
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2545
2605
|
function FloatingPanel({
|
|
2546
2606
|
open,
|
|
2547
2607
|
onOpenChange,
|
|
@@ -2560,8 +2620,8 @@ function FloatingPanel({
|
|
|
2560
2620
|
const motion = usePresence(open, useReducedMotion(), import_tokens17.tokens.motion.popupExit);
|
|
2561
2621
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2562
2622
|
const container = useKjunPortalContainer();
|
|
2563
|
-
const panel = (0,
|
|
2564
|
-
(0,
|
|
2623
|
+
const panel = (0, import_react24.useRef)(null);
|
|
2624
|
+
(0, import_react24.useEffect)(() => {
|
|
2565
2625
|
var _a;
|
|
2566
2626
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2567
2627
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
@@ -2579,7 +2639,7 @@ function FloatingPanel({
|
|
|
2579
2639
|
return () => document2.removeEventListener("keydown", dismissBeforeFocus, true);
|
|
2580
2640
|
}, [open, nonModal, triggerRef, onOpenChange, layer.keyboardManaged]);
|
|
2581
2641
|
if (container === null || layer.blocked) return null;
|
|
2582
|
-
return /* @__PURE__ */ (0,
|
|
2642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2583
2643
|
import_react_aria_components3.Popover,
|
|
2584
2644
|
{
|
|
2585
2645
|
ref: panel,
|
|
@@ -2611,7 +2671,7 @@ function FloatingPanel({
|
|
|
2611
2671
|
|
|
2612
2672
|
// packages/react/src/popover.tsx
|
|
2613
2673
|
var import_tokens18 = require("@kjun-ui/tokens");
|
|
2614
|
-
var
|
|
2674
|
+
var import_react25 = require("react");
|
|
2615
2675
|
var import_react_aria_components4 = require("react-aria-components");
|
|
2616
2676
|
|
|
2617
2677
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -2674,7 +2734,7 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
2674
2734
|
}
|
|
2675
2735
|
|
|
2676
2736
|
// packages/react/src/popover.tsx
|
|
2677
|
-
var
|
|
2737
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2678
2738
|
function KjunPopover({
|
|
2679
2739
|
noPadding = false,
|
|
2680
2740
|
open: controlled,
|
|
@@ -2692,11 +2752,11 @@ function KjunPopover({
|
|
|
2692
2752
|
trigger,
|
|
2693
2753
|
children
|
|
2694
2754
|
}) {
|
|
2695
|
-
const [internal, setInternal] = (0,
|
|
2755
|
+
const [internal, setInternal] = (0, import_react25.useState)(false), open = controlled != null ? controlled : internal, ref = (0, import_react25.useRef)(null), id = "kjun-" + (0, import_react25.useId)();
|
|
2696
2756
|
const expanded = usePopupExpanded(open, ref);
|
|
2697
|
-
const focusOnMount = (0,
|
|
2757
|
+
const focusOnMount = (0, import_react25.useRef)(focusOnOpen);
|
|
2698
2758
|
focusOnMount.current = focusOnOpen;
|
|
2699
|
-
const focusContent = (0,
|
|
2759
|
+
const focusContent = (0, import_react25.useCallback)((node) => {
|
|
2700
2760
|
if (node && focusOnMount.current) node.focus();
|
|
2701
2761
|
}, []);
|
|
2702
2762
|
const resolveReturn = returnFocus === void 0 ? void 0 : () => typeof returnFocus === "function" ? returnFocus() : returnFocus instanceof HTMLElement ? returnFocus : returnFocus.current;
|
|
@@ -2704,8 +2764,8 @@ function KjunPopover({
|
|
|
2704
2764
|
setInternal(v);
|
|
2705
2765
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
2706
2766
|
};
|
|
2707
|
-
const skipReturn = (0,
|
|
2708
|
-
(0,
|
|
2767
|
+
const skipReturn = (0, import_react25.useRef)(false);
|
|
2768
|
+
(0, import_react25.useEffect)(() => {
|
|
2709
2769
|
if (!open || modal) return;
|
|
2710
2770
|
skipReturn.current = false;
|
|
2711
2771
|
return installNonModalPopover({
|
|
@@ -2720,9 +2780,9 @@ function KjunPopover({
|
|
|
2720
2780
|
}
|
|
2721
2781
|
});
|
|
2722
2782
|
});
|
|
2723
|
-
const content = /* @__PURE__ */ (0,
|
|
2724
|
-
return /* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2783
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
2784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2726
2786
|
"div",
|
|
2727
2787
|
{
|
|
2728
2788
|
ref,
|
|
@@ -2742,7 +2802,7 @@ function KjunPopover({
|
|
|
2742
2802
|
children: typeof trigger === "function" ? trigger(open) : trigger
|
|
2743
2803
|
}
|
|
2744
2804
|
),
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2746
2806
|
FloatingPanel,
|
|
2747
2807
|
{
|
|
2748
2808
|
open,
|
|
@@ -2764,12 +2824,12 @@ function KjunPopover({
|
|
|
2764
2824
|
className: "kjun-popover-dialog",
|
|
2765
2825
|
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens18.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
2766
2826
|
};
|
|
2767
|
-
const body = /* @__PURE__ */ (0,
|
|
2768
|
-
header != null && /* @__PURE__ */ (0,
|
|
2769
|
-
header != null ? /* @__PURE__ */ (0,
|
|
2770
|
-
/* @__PURE__ */ (0,
|
|
2827
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2828
|
+
header != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
2829
|
+
header != null ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "kjun-popover-body", children: content }) : content,
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FeedbackLayerOutlet, {})
|
|
2771
2831
|
] });
|
|
2772
|
-
return modal ? /* @__PURE__ */ (0,
|
|
2832
|
+
return modal ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_aria_components4.Dialog, { ...dialogProps, ref: focusContent, children: body }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("section", { ...dialogProps, role: "dialog", tabIndex: -1, ref: focusContent, children: body });
|
|
2773
2833
|
})()
|
|
2774
2834
|
}
|
|
2775
2835
|
)
|
|
@@ -2784,15 +2844,15 @@ function KjunTooltip({
|
|
|
2784
2844
|
children
|
|
2785
2845
|
}) {
|
|
2786
2846
|
const container = useKjunPortalContainer();
|
|
2787
|
-
const [internal, setInternal] = (0,
|
|
2847
|
+
const [internal, setInternal] = (0, import_react25.useState)(false), open = controlled != null ? controlled : internal;
|
|
2788
2848
|
const setOpen = (value) => {
|
|
2789
2849
|
setInternal(value);
|
|
2790
2850
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
2791
2851
|
};
|
|
2792
2852
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
2793
|
-
return /* @__PURE__ */ (0,
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
container !== null && /* @__PURE__ */ (0,
|
|
2853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_aria_components4.TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content || !layer.scopeActive, children: [
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_aria_components4.Focusable, { children }),
|
|
2855
|
+
container !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2796
2856
|
import_react_aria_components4.Tooltip,
|
|
2797
2857
|
{
|
|
2798
2858
|
style: { zIndex: layer.zIndex },
|
|
@@ -2801,7 +2861,7 @@ function KjunTooltip({
|
|
|
2801
2861
|
offset: import_tokens18.tokens.extensions.floating.anchorGap,
|
|
2802
2862
|
className: "kjun-scope kjun-tooltip",
|
|
2803
2863
|
children: [
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_aria_components4.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: import_tokens18.tokens.extensions.tooltip.arrowSize, height: import_tokens18.tokens.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
2805
2865
|
content
|
|
2806
2866
|
]
|
|
2807
2867
|
}
|
|
@@ -2811,10 +2871,10 @@ function KjunTooltip({
|
|
|
2811
2871
|
|
|
2812
2872
|
// packages/react/src/dropdown.tsx
|
|
2813
2873
|
var import_tokens19 = require("@kjun-ui/tokens");
|
|
2814
|
-
var
|
|
2874
|
+
var import_react26 = require("react");
|
|
2815
2875
|
var import_react_aria_components5 = require("react-aria-components");
|
|
2816
|
-
var
|
|
2817
|
-
var DropdownContext = (0,
|
|
2876
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2877
|
+
var DropdownContext = (0, import_react26.createContext)(null);
|
|
2818
2878
|
function KjunDropdown({
|
|
2819
2879
|
disabled = false,
|
|
2820
2880
|
placement = "bottom-start",
|
|
@@ -2826,10 +2886,10 @@ function KjunDropdown({
|
|
|
2826
2886
|
onOpen,
|
|
2827
2887
|
onClose
|
|
2828
2888
|
}) {
|
|
2829
|
-
const [open, setOpen] = (0,
|
|
2830
|
-
const menuFocusCleanup = (0,
|
|
2889
|
+
const [open, setOpen] = (0, import_react26.useState)(false), currentOpen = (0, import_react26.useRef)(false), ref = (0, import_react26.useRef)(null), id = "kjun-" + (0, import_react26.useId)();
|
|
2890
|
+
const menuFocusCleanup = (0, import_react26.useRef)(() => {
|
|
2831
2891
|
});
|
|
2832
|
-
const bindMenu = (0,
|
|
2892
|
+
const bindMenu = (0, import_react26.useCallback)((menu) => {
|
|
2833
2893
|
menuFocusCleanup.current();
|
|
2834
2894
|
menuFocusCleanup.current = () => {
|
|
2835
2895
|
};
|
|
@@ -2851,19 +2911,19 @@ function KjunDropdown({
|
|
|
2851
2911
|
};
|
|
2852
2912
|
}, []);
|
|
2853
2913
|
let control = trigger;
|
|
2854
|
-
while ((0,
|
|
2914
|
+
while ((0, import_react26.isValidElement)(control) && control.type === KjunTooltip)
|
|
2855
2915
|
control = control.props.children;
|
|
2856
|
-
const unavailable = disabled || (0,
|
|
2857
|
-
const controlId = triggerId || (0,
|
|
2916
|
+
const unavailable = disabled || (0, import_react26.isValidElement)(control) && !!(control.props.disabled || control.props.loading);
|
|
2917
|
+
const controlId = triggerId || (0, import_react26.isValidElement)(control) && control.props.id || id;
|
|
2858
2918
|
const popupId = menuId || id + "-menu";
|
|
2859
2919
|
const bindTrigger = (node) => {
|
|
2860
|
-
if (!(0,
|
|
2920
|
+
if (!(0, import_react26.isValidElement)(node)) return node;
|
|
2861
2921
|
if (node.type === KjunTooltip) {
|
|
2862
2922
|
const tooltip = node;
|
|
2863
|
-
return (0,
|
|
2923
|
+
return (0, import_react26.cloneElement)(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
2864
2924
|
}
|
|
2865
2925
|
const button = node;
|
|
2866
|
-
return (0,
|
|
2926
|
+
return (0, import_react26.cloneElement)(button, {
|
|
2867
2927
|
id: controlId,
|
|
2868
2928
|
"aria-haspopup": "menu",
|
|
2869
2929
|
"aria-expanded": open,
|
|
@@ -2880,11 +2940,11 @@ function KjunDropdown({
|
|
|
2880
2940
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
2881
2941
|
else onClose == null ? void 0 : onClose();
|
|
2882
2942
|
};
|
|
2883
|
-
(0,
|
|
2943
|
+
(0, import_react26.useEffect)(() => {
|
|
2884
2944
|
if (unavailable) change(false);
|
|
2885
2945
|
}, [unavailable]);
|
|
2886
|
-
return /* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownContext.Provider, { value: () => change(false), children: [
|
|
2947
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2888
2948
|
"div",
|
|
2889
2949
|
{
|
|
2890
2950
|
ref,
|
|
@@ -2896,10 +2956,10 @@ function KjunDropdown({
|
|
|
2896
2956
|
change(true);
|
|
2897
2957
|
}
|
|
2898
2958
|
},
|
|
2899
|
-
children: /* @__PURE__ */ (0,
|
|
2959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: bindTrigger(trigger) })
|
|
2900
2960
|
}
|
|
2901
2961
|
),
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2962
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2903
2963
|
FloatingPanel,
|
|
2904
2964
|
{
|
|
2905
2965
|
open,
|
|
@@ -2907,7 +2967,7 @@ function KjunDropdown({
|
|
|
2907
2967
|
triggerRef: ref,
|
|
2908
2968
|
placement,
|
|
2909
2969
|
className: "kjun-dropdown",
|
|
2910
|
-
children: /* @__PURE__ */ (0,
|
|
2970
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2911
2971
|
import_react_aria_components5.Menu,
|
|
2912
2972
|
{
|
|
2913
2973
|
ref: bindMenu,
|
|
@@ -2933,8 +2993,8 @@ function KjunDropdownItem({
|
|
|
2933
2993
|
children,
|
|
2934
2994
|
onClick
|
|
2935
2995
|
}) {
|
|
2936
|
-
const close = (0,
|
|
2937
|
-
const node = (0,
|
|
2996
|
+
const close = (0, import_react26.useContext)(DropdownContext);
|
|
2997
|
+
const node = (0, import_react26.useCallback)((element) => {
|
|
2938
2998
|
if (!element) return;
|
|
2939
2999
|
if (selected === null) {
|
|
2940
3000
|
element.setAttribute("role", "menuitem");
|
|
@@ -2944,7 +3004,7 @@ function KjunDropdownItem({
|
|
|
2944
3004
|
element.setAttribute("role", "menuitemradio");
|
|
2945
3005
|
element.setAttribute("aria-checked", String(selected));
|
|
2946
3006
|
}, [selected]);
|
|
2947
|
-
return /* @__PURE__ */ (0,
|
|
3007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2948
3008
|
import_react_aria_components5.MenuItem,
|
|
2949
3009
|
{
|
|
2950
3010
|
ref: node,
|
|
@@ -2959,9 +3019,9 @@ function KjunDropdownItem({
|
|
|
2959
3019
|
close == null ? void 0 : close();
|
|
2960
3020
|
},
|
|
2961
3021
|
children: [
|
|
2962
|
-
icon && /* @__PURE__ */ (0,
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2964
|
-
selected !== null && /* @__PURE__ */ (0,
|
|
3022
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size: import_tokens19.tokens.extensions.menu.iconSize }),
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children }),
|
|
3024
|
+
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2965
3025
|
KjunIcon,
|
|
2966
3026
|
{
|
|
2967
3027
|
name: "check",
|
|
@@ -2975,7 +3035,7 @@ function KjunDropdownItem({
|
|
|
2975
3035
|
);
|
|
2976
3036
|
}
|
|
2977
3037
|
function KjunDropdownDivider() {
|
|
2978
|
-
return /* @__PURE__ */ (0,
|
|
3038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.Separator, { className: "kjun-menu-divider" });
|
|
2979
3039
|
}
|
|
2980
3040
|
function KjunMenuButton({
|
|
2981
3041
|
label,
|
|
@@ -2991,8 +3051,8 @@ function KjunMenuButton({
|
|
|
2991
3051
|
onClose,
|
|
2992
3052
|
...props
|
|
2993
3053
|
}) {
|
|
2994
|
-
const [open, setOpen] = (0,
|
|
2995
|
-
const button = /* @__PURE__ */ (0,
|
|
3054
|
+
const [open, setOpen] = (0, import_react26.useState)(false);
|
|
3055
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2996
3056
|
KjunButton,
|
|
2997
3057
|
{
|
|
2998
3058
|
className: "kjun-menu-button",
|
|
@@ -3006,7 +3066,7 @@ function KjunMenuButton({
|
|
|
3006
3066
|
children: compact ? void 0 : label
|
|
3007
3067
|
}
|
|
3008
3068
|
);
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3010
3070
|
KjunDropdown,
|
|
3011
3071
|
{
|
|
3012
3072
|
...props,
|
|
@@ -3018,7 +3078,7 @@ function KjunMenuButton({
|
|
|
3018
3078
|
setOpen(false);
|
|
3019
3079
|
onClose == null ? void 0 : onClose();
|
|
3020
3080
|
},
|
|
3021
|
-
trigger: tooltip ? /* @__PURE__ */ (0,
|
|
3081
|
+
trigger: tooltip ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3022
3082
|
KjunTooltip,
|
|
3023
3083
|
{
|
|
3024
3084
|
content: open ? "" : tooltip,
|
|
@@ -3045,7 +3105,7 @@ function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
|
3045
3105
|
|
|
3046
3106
|
// packages/react/src/drawer.tsx
|
|
3047
3107
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3048
|
-
var
|
|
3108
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3049
3109
|
function KjunDrawer({
|
|
3050
3110
|
open,
|
|
3051
3111
|
onOpenChange,
|
|
@@ -3076,7 +3136,7 @@ function KjunDrawer({
|
|
|
3076
3136
|
if (closeOnEsc) close();
|
|
3077
3137
|
});
|
|
3078
3138
|
if (container === null) return null;
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3080
3140
|
import_react_aria_components6.ModalOverlay,
|
|
3081
3141
|
{
|
|
3082
3142
|
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
@@ -3093,7 +3153,7 @@ function KjunDrawer({
|
|
|
3093
3153
|
"data-motion-open": String(motion.active),
|
|
3094
3154
|
inert: !open || !layer.active,
|
|
3095
3155
|
"data-position": position,
|
|
3096
|
-
children: /* @__PURE__ */ (0,
|
|
3156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3097
3157
|
import_react_aria_components6.Modal,
|
|
3098
3158
|
{
|
|
3099
3159
|
className: "kjun-drawer",
|
|
@@ -3101,7 +3161,7 @@ function KjunDrawer({
|
|
|
3101
3161
|
zIndex: layer.state.zIndex(layer.id, "content"),
|
|
3102
3162
|
width: position === "left" || position === "right" ? width : "100%"
|
|
3103
3163
|
},
|
|
3104
|
-
children: /* @__PURE__ */ (0,
|
|
3164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3105
3165
|
import_react_aria_components6.Dialog,
|
|
3106
3166
|
{
|
|
3107
3167
|
"aria-label": ariaLabel || title || "\uD328\uB110",
|
|
@@ -3111,9 +3171,9 @@ function KjunDrawer({
|
|
|
3111
3171
|
if (entry) entry.root = node;
|
|
3112
3172
|
},
|
|
3113
3173
|
children: [
|
|
3114
|
-
(title || header || closable) && /* @__PURE__ */ (0,
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3116
|
-
closable && /* @__PURE__ */ (0,
|
|
3174
|
+
(title || header || closable) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "kjun-drawer-header", children: [
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: header || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h2", { children: title }) }),
|
|
3176
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3117
3177
|
KjunButton,
|
|
3118
3178
|
{
|
|
3119
3179
|
size: "sm",
|
|
@@ -3121,11 +3181,11 @@ function KjunDrawer({
|
|
|
3121
3181
|
ariaLabel: "\uB2EB\uAE30",
|
|
3122
3182
|
onClick: close,
|
|
3123
3183
|
style: { borderRadius: import_tokens20.tokens.extensions.drawer.closeRadius, width: import_tokens20.tokens.extensions.drawer.closeSize, height: import_tokens20.tokens.extensions.drawer.closeSize, padding: 0 },
|
|
3124
|
-
children: /* @__PURE__ */ (0,
|
|
3184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: "x", size: import_tokens20.tokens.extensions.drawer.closeIconSize })
|
|
3125
3185
|
}
|
|
3126
3186
|
)
|
|
3127
3187
|
] }),
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3129
3189
|
"div",
|
|
3130
3190
|
{
|
|
3131
3191
|
className: "kjun-drawer-body",
|
|
@@ -3133,8 +3193,8 @@ function KjunDrawer({
|
|
|
3133
3193
|
children
|
|
3134
3194
|
}
|
|
3135
3195
|
),
|
|
3136
|
-
footer && /* @__PURE__ */ (0,
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3196
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "kjun-drawer-footer", children: footer }),
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FeedbackLayerOutlet, {})
|
|
3138
3198
|
]
|
|
3139
3199
|
}
|
|
3140
3200
|
)
|
|
@@ -3145,7 +3205,7 @@ function KjunDrawer({
|
|
|
3145
3205
|
}
|
|
3146
3206
|
|
|
3147
3207
|
// shared/package-runtime/combobox.ts
|
|
3148
|
-
var
|
|
3208
|
+
var import_react27 = require("react");
|
|
3149
3209
|
|
|
3150
3210
|
// shared/package-runtime/options.ts
|
|
3151
3211
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3222,10 +3282,10 @@ function useComboboxModel({
|
|
|
3222
3282
|
}) {
|
|
3223
3283
|
const selected = options.find((option) => optionValue(option, valueKey) === value);
|
|
3224
3284
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3225
|
-
const [query2, setQuery] = (0,
|
|
3226
|
-
const [open, setOpen] = (0,
|
|
3227
|
-
(0,
|
|
3228
|
-
(0,
|
|
3285
|
+
const [query2, setQuery] = (0, import_react27.useState)(selectedLabel);
|
|
3286
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
3287
|
+
(0, import_react27.useEffect)(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3288
|
+
(0, import_react27.useEffect)(() => {
|
|
3229
3289
|
if (disabled) setOpen(false);
|
|
3230
3290
|
}, [disabled]);
|
|
3231
3291
|
const change = (next) => {
|
|
@@ -3258,8 +3318,8 @@ function useComboboxModel({
|
|
|
3258
3318
|
}
|
|
3259
3319
|
|
|
3260
3320
|
// packages/react/src/combobox.tsx
|
|
3261
|
-
var
|
|
3262
|
-
var
|
|
3321
|
+
var import_react28 = require("react");
|
|
3322
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3263
3323
|
function KjunCombobox({
|
|
3264
3324
|
value,
|
|
3265
3325
|
options = [],
|
|
@@ -3291,7 +3351,7 @@ function KjunCombobox({
|
|
|
3291
3351
|
onSearch,
|
|
3292
3352
|
onClear
|
|
3293
3353
|
});
|
|
3294
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3295
3355
|
SearchField,
|
|
3296
3356
|
{
|
|
3297
3357
|
error,
|
|
@@ -3338,12 +3398,12 @@ function SearchField({
|
|
|
3338
3398
|
onEnter
|
|
3339
3399
|
}) {
|
|
3340
3400
|
const composition = useCompositionGuard();
|
|
3341
|
-
const clearing = (0,
|
|
3342
|
-
const ref = (0,
|
|
3401
|
+
const clearing = (0, import_react28.useRef)(false);
|
|
3402
|
+
const ref = (0, import_react28.useRef)(null), [highlighted, setActive] = (0, import_react28.useState)(-1), id = "kjun-" + (0, import_react28.useId)();
|
|
3343
3403
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3344
3404
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3345
|
-
(0,
|
|
3346
|
-
(0,
|
|
3405
|
+
(0, import_react28.useEffect)(() => setActive(-1), [value, options.length]);
|
|
3406
|
+
(0, import_react28.useEffect)(() => {
|
|
3347
3407
|
if (!open) return;
|
|
3348
3408
|
const leaveField = (event) => {
|
|
3349
3409
|
var _a, _b, _c;
|
|
@@ -3353,7 +3413,7 @@ function SearchField({
|
|
|
3353
3413
|
document.addEventListener("focusin", leaveField);
|
|
3354
3414
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3355
3415
|
}, [open, onOpenChange, id]);
|
|
3356
|
-
(0,
|
|
3416
|
+
(0, import_react28.useEffect)(() => {
|
|
3357
3417
|
if (highlighted !== active) setActive(-1);
|
|
3358
3418
|
}, [highlighted, active]);
|
|
3359
3419
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3364,8 +3424,8 @@ function SearchField({
|
|
|
3364
3424
|
onOpenChange(false);
|
|
3365
3425
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3366
3426
|
};
|
|
3367
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
-
/* @__PURE__ */ (0,
|
|
3427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3369
3429
|
KjunInput,
|
|
3370
3430
|
{
|
|
3371
3431
|
error,
|
|
@@ -3440,7 +3500,7 @@ function SearchField({
|
|
|
3440
3500
|
}
|
|
3441
3501
|
}
|
|
3442
3502
|
),
|
|
3443
|
-
/* @__PURE__ */ (0,
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3444
3504
|
FloatingPanel,
|
|
3445
3505
|
{
|
|
3446
3506
|
field: true,
|
|
@@ -3451,14 +3511,14 @@ function SearchField({
|
|
|
3451
3511
|
placement: "bottom-start",
|
|
3452
3512
|
matchTriggerWidth: true,
|
|
3453
3513
|
className: "kjun-select-panel",
|
|
3454
|
-
children: /* @__PURE__ */ (0,
|
|
3514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3455
3515
|
"div",
|
|
3456
3516
|
{
|
|
3457
3517
|
id,
|
|
3458
3518
|
role: "listbox",
|
|
3459
3519
|
"aria-label": ariaLabel || placeholder,
|
|
3460
3520
|
onMouseDown: (e) => e.preventDefault(),
|
|
3461
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
3521
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "kjun-select-empty", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunSpinner, { size: "sm", text: "\uAC80\uC0C9 \uC911..." }) }) : failed ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "kjun-select-empty", role: "alert", children: errorText }) : options.length ? options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3462
3522
|
"div",
|
|
3463
3523
|
{
|
|
3464
3524
|
id: id + "-" + i,
|
|
@@ -3476,7 +3536,7 @@ function SearchField({
|
|
|
3476
3536
|
children: (renderOption == null ? void 0 : renderOption(o)) || optionLabel(o, labelKey)
|
|
3477
3537
|
},
|
|
3478
3538
|
optionKey(o, itemKey, i)
|
|
3479
|
-
)) : /* @__PURE__ */ (0,
|
|
3539
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "kjun-select-empty", children: emptyText })
|
|
3480
3540
|
}
|
|
3481
3541
|
)
|
|
3482
3542
|
}
|
|
@@ -3486,8 +3546,8 @@ function SearchField({
|
|
|
3486
3546
|
|
|
3487
3547
|
// packages/react/src/date-picker.tsx
|
|
3488
3548
|
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3489
|
-
var
|
|
3490
|
-
var
|
|
3549
|
+
var import_react29 = require("react");
|
|
3550
|
+
var import_jsx_runtime19 = (
|
|
3491
3551
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3492
3552
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
3493
3553
|
require("react/jsx-runtime")
|
|
@@ -3503,13 +3563,13 @@ function KjunDatePicker({
|
|
|
3503
3563
|
onBlur,
|
|
3504
3564
|
...props
|
|
3505
3565
|
}) {
|
|
3506
|
-
const [focus, setFocus] = (0,
|
|
3507
|
-
return /* @__PURE__ */ (0,
|
|
3566
|
+
const [focus, setFocus] = (0, import_react29.useState)(false);
|
|
3567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
3508
3568
|
position: "relative",
|
|
3509
3569
|
["--_kjun-date-icon-inset"]: import_tokens21.tokens.input[size].padding + "px",
|
|
3510
3570
|
["--_kjun-date-icon-size"]: import_tokens21.tokens.input[size].iconSize + "px"
|
|
3511
3571
|
}, children: [
|
|
3512
|
-
/* @__PURE__ */ (0,
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3513
3573
|
KjunInput,
|
|
3514
3574
|
{
|
|
3515
3575
|
...props,
|
|
@@ -3531,7 +3591,7 @@ function KjunDatePicker({
|
|
|
3531
3591
|
}
|
|
3532
3592
|
}
|
|
3533
3593
|
),
|
|
3534
|
-
!focus && /* @__PURE__ */ (0,
|
|
3594
|
+
!focus && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3535
3595
|
"span",
|
|
3536
3596
|
{
|
|
3537
3597
|
"aria-hidden": "true",
|
|
@@ -3549,10 +3609,10 @@ function KjunDatePicker({
|
|
|
3549
3609
|
}
|
|
3550
3610
|
|
|
3551
3611
|
// packages/react/src/search-input.tsx
|
|
3552
|
-
var
|
|
3612
|
+
var import_react31 = require("react");
|
|
3553
3613
|
|
|
3554
3614
|
// shared/package-runtime/search-input.ts
|
|
3555
|
-
var
|
|
3615
|
+
var import_react30 = require("react");
|
|
3556
3616
|
function useSearchInputModel({
|
|
3557
3617
|
value,
|
|
3558
3618
|
disabled = false,
|
|
@@ -3562,20 +3622,20 @@ function useSearchInputModel({
|
|
|
3562
3622
|
onValueChange,
|
|
3563
3623
|
onSearchError
|
|
3564
3624
|
}, open) {
|
|
3565
|
-
const [query2, setQuery] = (0,
|
|
3625
|
+
const [query2, setQuery] = (0, import_react30.useState)(value), [options, setOptions] = (0, import_react30.useState)([]), [loading, setLoading] = (0, import_react30.useState)(false), [failed, setFailed] = (0, import_react30.useState)(false), version = (0, import_react30.useRef)(0), notify = (0, import_react30.useRef)(onSearchError);
|
|
3566
3626
|
notify.current = onSearchError;
|
|
3567
|
-
const timer = (0,
|
|
3568
|
-
const notifyValue = (0,
|
|
3627
|
+
const timer = (0, import_react30.useRef)(void 0);
|
|
3628
|
+
const notifyValue = (0, import_react30.useRef)(onValueChange);
|
|
3569
3629
|
notifyValue.current = onValueChange;
|
|
3570
|
-
(0,
|
|
3630
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3571
3631
|
clearTimeout(timer.current);
|
|
3572
3632
|
setQuery(value);
|
|
3573
3633
|
}, [value]);
|
|
3574
|
-
(0,
|
|
3634
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3575
3635
|
clearTimeout(timer.current);
|
|
3576
3636
|
return () => clearTimeout(timer.current);
|
|
3577
3637
|
}, [disabled, debounce, !!loadOptions]);
|
|
3578
|
-
(0,
|
|
3638
|
+
(0, import_react30.useEffect)(() => {
|
|
3579
3639
|
const current = ++version.current, abort = new AbortController();
|
|
3580
3640
|
setFailed(false);
|
|
3581
3641
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -3639,7 +3699,7 @@ function useSearchInputModel({
|
|
|
3639
3699
|
}
|
|
3640
3700
|
|
|
3641
3701
|
// packages/react/src/search-input.tsx
|
|
3642
|
-
var
|
|
3702
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3643
3703
|
function KjunSearchInput({
|
|
3644
3704
|
value,
|
|
3645
3705
|
placeholder = "\uAC80\uC0C9...",
|
|
@@ -3662,7 +3722,7 @@ function KjunSearchInput({
|
|
|
3662
3722
|
onEnter,
|
|
3663
3723
|
onClear
|
|
3664
3724
|
}) {
|
|
3665
|
-
const [open, setOpen] = (0,
|
|
3725
|
+
const [open, setOpen] = (0, import_react31.useState)(false);
|
|
3666
3726
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
3667
3727
|
const { query: query2, options, loading, failed } = model;
|
|
3668
3728
|
const update = (value2) => {
|
|
@@ -3675,7 +3735,7 @@ function KjunSearchInput({
|
|
|
3675
3735
|
onClear == null ? void 0 : onClear();
|
|
3676
3736
|
};
|
|
3677
3737
|
if (!loadOptions)
|
|
3678
|
-
return /* @__PURE__ */ (0,
|
|
3738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3679
3739
|
KjunInput,
|
|
3680
3740
|
{
|
|
3681
3741
|
error,
|
|
@@ -3691,7 +3751,7 @@ function KjunSearchInput({
|
|
|
3691
3751
|
onEnter
|
|
3692
3752
|
}
|
|
3693
3753
|
);
|
|
3694
|
-
return /* @__PURE__ */ (0,
|
|
3754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3695
3755
|
SearchField,
|
|
3696
3756
|
{
|
|
3697
3757
|
error,
|
|
@@ -3725,20 +3785,20 @@ function KjunSearchInput({
|
|
|
3725
3785
|
|
|
3726
3786
|
// packages/react/src/select-control.tsx
|
|
3727
3787
|
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3728
|
-
var
|
|
3788
|
+
var import_react34 = require("react");
|
|
3729
3789
|
var import_react_aria_components7 = require("react-aria-components");
|
|
3730
3790
|
|
|
3731
3791
|
// shared/package-runtime/select.ts
|
|
3732
|
-
var
|
|
3792
|
+
var import_react32 = require("react");
|
|
3733
3793
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
3734
|
-
const [internal, setInternal] = (0,
|
|
3735
|
-
const [query2, setQuery] = (0,
|
|
3736
|
-
const [limit, setLimit] = (0,
|
|
3737
|
-
const [session, setSession] = (0,
|
|
3794
|
+
const [internal, setInternal] = (0, import_react32.useState)(false);
|
|
3795
|
+
const [query2, setQuery] = (0, import_react32.useState)("");
|
|
3796
|
+
const [limit, setLimit] = (0, import_react32.useState)(pageSize);
|
|
3797
|
+
const [session, setSession] = (0, import_react32.useState)(0);
|
|
3738
3798
|
const isControlled = typeof controlled === "boolean";
|
|
3739
3799
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
3740
|
-
const previousOpen = (0,
|
|
3741
|
-
(0,
|
|
3800
|
+
const previousOpen = (0, import_react32.useRef)(open);
|
|
3801
|
+
(0, import_react32.useEffect)(() => {
|
|
3742
3802
|
if (disabled && !isControlled) setInternal(false);
|
|
3743
3803
|
if (previousOpen.current && !open) {
|
|
3744
3804
|
setQuery("");
|
|
@@ -3747,7 +3807,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3747
3807
|
}
|
|
3748
3808
|
previousOpen.current = open;
|
|
3749
3809
|
}, [open, disabled, isControlled, pageSize]);
|
|
3750
|
-
(0,
|
|
3810
|
+
(0, import_react32.useEffect)(() => {
|
|
3751
3811
|
setLimit(pageSize);
|
|
3752
3812
|
}, [pageSize]);
|
|
3753
3813
|
const changeOpen = (next) => {
|
|
@@ -3763,11 +3823,11 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3763
3823
|
}
|
|
3764
3824
|
|
|
3765
3825
|
// packages/react/src/compound-control.ts
|
|
3766
|
-
var
|
|
3767
|
-
var CompoundControlContext = (0,
|
|
3826
|
+
var import_react33 = require("react");
|
|
3827
|
+
var CompoundControlContext = (0, import_react33.createContext)(null);
|
|
3768
3828
|
|
|
3769
3829
|
// packages/react/src/select-control.tsx
|
|
3770
|
-
var
|
|
3830
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3771
3831
|
function KjunSelect({
|
|
3772
3832
|
value,
|
|
3773
3833
|
options = [],
|
|
@@ -3800,17 +3860,17 @@ function KjunSelect({
|
|
|
3800
3860
|
}) {
|
|
3801
3861
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
3802
3862
|
const composition = useCompositionGuard();
|
|
3803
|
-
const ref = (0,
|
|
3804
|
-
const segment = (0,
|
|
3863
|
+
const ref = (0, import_react34.useRef)(null), menu = (0, import_react34.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react34.useId)();
|
|
3864
|
+
const segment = (0, import_react34.useContext)(CompoundControlContext) !== null;
|
|
3805
3865
|
const spec = import_tokens22.tokens.input[size];
|
|
3806
3866
|
const expanded = usePopupExpanded(open, ref);
|
|
3807
3867
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
3808
|
-
(0,
|
|
3868
|
+
(0, import_react34.useEffect)(() => {
|
|
3809
3869
|
if (!registerControl || !triggerId) return;
|
|
3810
3870
|
registerControl(triggerId);
|
|
3811
3871
|
return () => registerControl(void 0);
|
|
3812
3872
|
}, [registerControl, triggerId]);
|
|
3813
|
-
(0,
|
|
3873
|
+
(0, import_react34.useEffect)(() => {
|
|
3814
3874
|
var _a, _b;
|
|
3815
3875
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
3816
3876
|
if (!open) composition.onCompositionEnd();
|
|
@@ -3832,9 +3892,9 @@ function KjunSelect({
|
|
|
3832
3892
|
filterFn,
|
|
3833
3893
|
searchKeys
|
|
3834
3894
|
});
|
|
3835
|
-
return /* @__PURE__ */ (0,
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3837
|
-
/* @__PURE__ */ (0,
|
|
3895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3896
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "kjun-select-shell", children: [
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3838
3898
|
"button",
|
|
3839
3899
|
{
|
|
3840
3900
|
ref,
|
|
@@ -3865,12 +3925,12 @@ function KjunSelect({
|
|
|
3865
3925
|
}
|
|
3866
3926
|
},
|
|
3867
3927
|
children: [
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3928
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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 }),
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "chevron-down", className: "kjun-select-indicator", "data-open": expanded || void 0, size: segment ? import_tokens22.tokens.extensions.timePicker.iconSize : spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
3870
3930
|
]
|
|
3871
3931
|
}
|
|
3872
3932
|
),
|
|
3873
|
-
clearable && !!label && /* @__PURE__ */ (0,
|
|
3933
|
+
clearable && !!label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3874
3934
|
KjunButton,
|
|
3875
3935
|
{
|
|
3876
3936
|
size: "sm",
|
|
@@ -3892,11 +3952,11 @@ function KjunSelect({
|
|
|
3892
3952
|
onClear == null ? void 0 : onClear();
|
|
3893
3953
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3894
3954
|
},
|
|
3895
|
-
children: /* @__PURE__ */ (0,
|
|
3955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "x", size: spec.iconSize })
|
|
3896
3956
|
}
|
|
3897
3957
|
)
|
|
3898
3958
|
] }),
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3900
3960
|
FloatingPanel,
|
|
3901
3961
|
{
|
|
3902
3962
|
field: true,
|
|
@@ -3906,9 +3966,9 @@ function KjunSelect({
|
|
|
3906
3966
|
placement: "bottom-start",
|
|
3907
3967
|
matchTriggerWidth: true,
|
|
3908
3968
|
className: "kjun-select-panel kjun-select-options-panel",
|
|
3909
|
-
children: /* @__PURE__ */ (0,
|
|
3910
|
-
menuHeader && /* @__PURE__ */ (0,
|
|
3911
|
-
searchable && /* @__PURE__ */ (0,
|
|
3969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldContext.Provider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { ref: menu, className: "kjun-select-content", children: [
|
|
3970
|
+
menuHeader && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-header", children: menuHeader }),
|
|
3971
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-search", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3912
3972
|
KjunInput,
|
|
3913
3973
|
{
|
|
3914
3974
|
autoFocus: true,
|
|
@@ -3939,8 +3999,8 @@ function KjunSelect({
|
|
|
3939
3999
|
}
|
|
3940
4000
|
}
|
|
3941
4001
|
) }),
|
|
3942
|
-
loading && /* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
4002
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-empty", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunSpinner, { size: "sm", text: "\uAC80\uC0C9 \uC911..." }) }),
|
|
4003
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3944
4004
|
import_react_aria_components7.ListBox,
|
|
3945
4005
|
{
|
|
3946
4006
|
id,
|
|
@@ -3957,7 +4017,7 @@ function KjunSelect({
|
|
|
3957
4017
|
),
|
|
3958
4018
|
autoFocus: searchable ? false : "first",
|
|
3959
4019
|
className: "kjun-listbox",
|
|
3960
|
-
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0,
|
|
4020
|
+
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3961
4021
|
import_react_aria_components7.ListBoxItem,
|
|
3962
4022
|
{
|
|
3963
4023
|
id: key,
|
|
@@ -3969,8 +4029,8 @@ function KjunSelect({
|
|
|
3969
4029
|
textValue: optionLabel(o, labelKey),
|
|
3970
4030
|
className: "kjun-option",
|
|
3971
4031
|
children: [
|
|
3972
|
-
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0,
|
|
3973
|
-
selected(o) && /* @__PURE__ */ (0,
|
|
4032
|
+
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4033
|
+
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "check", size: import_tokens22.tokens.extensions.menu.iconSize })
|
|
3974
4034
|
]
|
|
3975
4035
|
},
|
|
3976
4036
|
key
|
|
@@ -3978,8 +4038,8 @@ function KjunSelect({
|
|
|
3978
4038
|
},
|
|
3979
4039
|
session
|
|
3980
4040
|
),
|
|
3981
|
-
!loading && !matching.length && /* @__PURE__ */ (0,
|
|
3982
|
-
!loading && visible.length < matching.length && /* @__PURE__ */ (0,
|
|
4041
|
+
!loading && !matching.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-empty", children: "\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }),
|
|
4042
|
+
!loading && visible.length < matching.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3983
4043
|
KjunButton,
|
|
3984
4044
|
{
|
|
3985
4045
|
size: "sm",
|
|
@@ -4000,17 +4060,17 @@ var import_tokens24 = require("@kjun-ui/tokens");
|
|
|
4000
4060
|
|
|
4001
4061
|
// packages/react/src/collapse.tsx
|
|
4002
4062
|
var import_tokens23 = require("@kjun-ui/tokens");
|
|
4003
|
-
var
|
|
4004
|
-
var
|
|
4063
|
+
var import_react35 = require("react");
|
|
4064
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4005
4065
|
function Collapse({ open, children }) {
|
|
4006
4066
|
const reduced = useReducedMotion();
|
|
4007
|
-
const [retained, setRetained] = (0,
|
|
4008
|
-
const root = (0,
|
|
4009
|
-
const animation = (0,
|
|
4010
|
-
const previous = (0,
|
|
4011
|
-
const interrupted = (0,
|
|
4067
|
+
const [retained, setRetained] = (0, import_react35.useState)(open);
|
|
4068
|
+
const root = (0, import_react35.useRef)(null), body = (0, import_react35.useRef)(null);
|
|
4069
|
+
const animation = (0, import_react35.useRef)(null);
|
|
4070
|
+
const previous = (0, import_react35.useRef)(open);
|
|
4071
|
+
const interrupted = (0, import_react35.useRef)(null);
|
|
4012
4072
|
const present = open || retained;
|
|
4013
|
-
(0,
|
|
4073
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
4014
4074
|
const el = root.current, inner = body.current;
|
|
4015
4075
|
if (!el || !inner) return;
|
|
4016
4076
|
let disposed = false;
|
|
@@ -4061,14 +4121,14 @@ function Collapse({ open, children }) {
|
|
|
4061
4121
|
}
|
|
4062
4122
|
};
|
|
4063
4123
|
}, [open, reduced, present]);
|
|
4064
|
-
return present ? /* @__PURE__ */ (0,
|
|
4124
|
+
return present ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: root, className: "kjun-motion-collapse", inert: !open, "aria-hidden": !open || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: body, children }) }) : null;
|
|
4065
4125
|
}
|
|
4066
4126
|
|
|
4067
4127
|
// shared/package-runtime/navigation.ts
|
|
4068
|
-
var
|
|
4128
|
+
var import_react36 = require("react");
|
|
4069
4129
|
function useInitialTab(value, candidate, change) {
|
|
4070
|
-
const requested = (0,
|
|
4071
|
-
(0,
|
|
4130
|
+
const requested = (0, import_react36.useRef)(/* @__PURE__ */ new Set());
|
|
4131
|
+
(0, import_react36.useEffect)(() => {
|
|
4072
4132
|
if (value !== "") {
|
|
4073
4133
|
requested.current.clear();
|
|
4074
4134
|
return;
|
|
@@ -4079,8 +4139,8 @@ function useInitialTab(value, candidate, change) {
|
|
|
4079
4139
|
}, [value, candidate, change]);
|
|
4080
4140
|
}
|
|
4081
4141
|
function useAccordionState(multiple) {
|
|
4082
|
-
const [opened, setOpened] = (0,
|
|
4083
|
-
(0,
|
|
4142
|
+
const [opened, setOpened] = (0, import_react36.useState)(/* @__PURE__ */ new Set());
|
|
4143
|
+
(0, import_react36.useEffect)(() => {
|
|
4084
4144
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4085
4145
|
}, [multiple]);
|
|
4086
4146
|
return {
|
|
@@ -4164,9 +4224,9 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4164
4224
|
}
|
|
4165
4225
|
|
|
4166
4226
|
// packages/react/src/navigation.tsx
|
|
4167
|
-
var
|
|
4227
|
+
var import_react37 = require("react");
|
|
4168
4228
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4169
|
-
var
|
|
4229
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4170
4230
|
function KjunTabs({
|
|
4171
4231
|
value,
|
|
4172
4232
|
items = [],
|
|
@@ -4181,33 +4241,33 @@ function KjunTabs({
|
|
|
4181
4241
|
}) {
|
|
4182
4242
|
var _a;
|
|
4183
4243
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4184
|
-
const panes =
|
|
4185
|
-
|
|
4244
|
+
const panes = import_react37.Children.toArray(children).filter(
|
|
4245
|
+
import_react37.isValidElement
|
|
4186
4246
|
);
|
|
4187
4247
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4188
|
-
(0,
|
|
4248
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4189
4249
|
var _a2;
|
|
4190
4250
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4191
4251
|
if (list) return manageTabList(list, () => {
|
|
4192
4252
|
}, false);
|
|
4193
4253
|
}, [group]);
|
|
4194
|
-
(0,
|
|
4254
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4195
4255
|
var _a2;
|
|
4196
4256
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4197
4257
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4198
4258
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4199
4259
|
}
|
|
4200
4260
|
});
|
|
4201
|
-
const timer = (0,
|
|
4202
|
-
const menuState = (0,
|
|
4261
|
+
const timer = (0, import_react37.useRef)(void 0), press = (0, import_react37.useRef)(null);
|
|
4262
|
+
const menuState = (0, import_react37.useRef)({ tabs, onTabMenu });
|
|
4203
4263
|
menuState.current = { tabs, onTabMenu };
|
|
4204
4264
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4205
4265
|
const clear = () => {
|
|
4206
4266
|
clearTimeout(timer.current);
|
|
4207
4267
|
press.current = null;
|
|
4208
4268
|
};
|
|
4209
|
-
(0,
|
|
4210
|
-
(0,
|
|
4269
|
+
(0, import_react37.useEffect)(() => clear, []);
|
|
4270
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4211
4271
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4212
4272
|
}, [tabs, onTabMenu]);
|
|
4213
4273
|
const change = (name) => {
|
|
@@ -4215,7 +4275,7 @@ function KjunTabs({
|
|
|
4215
4275
|
onChange == null ? void 0 : onChange(name);
|
|
4216
4276
|
};
|
|
4217
4277
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4218
|
-
return /* @__PURE__ */ (0,
|
|
4278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4219
4279
|
import_react_aria_components8.Tabs,
|
|
4220
4280
|
{
|
|
4221
4281
|
selectedKey: value,
|
|
@@ -4224,9 +4284,9 @@ function KjunTabs({
|
|
|
4224
4284
|
"data-variant": variant,
|
|
4225
4285
|
"data-density": density,
|
|
4226
4286
|
children: [
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4228
|
-
/* @__PURE__ */ (0,
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-tabs-header", children: [
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-tabs-track", ref: group, tabIndex: -1, children: [
|
|
4289
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_aria_components8.TabList, { "aria-label": ariaLabel, className: "kjun-tabs-list", children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4230
4290
|
import_react_aria_components8.Tab,
|
|
4231
4291
|
{
|
|
4232
4292
|
id: tab.name,
|
|
@@ -4266,10 +4326,10 @@ function KjunTabs({
|
|
|
4266
4326
|
onTouchEnd: clear,
|
|
4267
4327
|
onTouchCancel: clear,
|
|
4268
4328
|
children: [
|
|
4269
|
-
tab.icon && /* @__PURE__ */ (0,
|
|
4329
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: tab.icon, size: import_tokens24.tokens.extensions.tabs.iconSize }),
|
|
4270
4330
|
" ",
|
|
4271
|
-
/* @__PURE__ */ (0,
|
|
4272
|
-
tab.badge != null && /* @__PURE__ */ (0,
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: tab.label }) }),
|
|
4332
|
+
tab.badge != null && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4273
4333
|
"span",
|
|
4274
4334
|
{
|
|
4275
4335
|
className: "kjun-tab-badge",
|
|
@@ -4283,17 +4343,17 @@ function KjunTabs({
|
|
|
4283
4343
|
},
|
|
4284
4344
|
tab.name
|
|
4285
4345
|
)) }),
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4287
4347
|
] }),
|
|
4288
4348
|
actions
|
|
4289
4349
|
] }),
|
|
4290
|
-
children && /* @__PURE__ */ (0,
|
|
4350
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-tab-content", children })
|
|
4291
4351
|
]
|
|
4292
4352
|
}
|
|
4293
4353
|
);
|
|
4294
4354
|
}
|
|
4295
4355
|
function KjunTabPane({ name, children }) {
|
|
4296
|
-
return /* @__PURE__ */ (0,
|
|
4356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4297
4357
|
import_react_aria_components8.TabPanel,
|
|
4298
4358
|
{
|
|
4299
4359
|
id: name,
|
|
@@ -4304,18 +4364,18 @@ function KjunTabPane({ name, children }) {
|
|
|
4304
4364
|
}
|
|
4305
4365
|
);
|
|
4306
4366
|
}
|
|
4307
|
-
var AccordionContext = (0,
|
|
4367
|
+
var AccordionContext = (0, import_react37.createContext)(null);
|
|
4308
4368
|
function KjunAccordion({
|
|
4309
4369
|
multiple = false,
|
|
4310
4370
|
tone = "card",
|
|
4311
4371
|
children
|
|
4312
4372
|
}) {
|
|
4313
4373
|
const state = useAccordionState(multiple);
|
|
4314
|
-
return /* @__PURE__ */ (0,
|
|
4374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4315
4375
|
AccordionContext.Provider,
|
|
4316
4376
|
{
|
|
4317
4377
|
value: state,
|
|
4318
|
-
children: /* @__PURE__ */ (0,
|
|
4378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-accordion", "data-tone": tone, children })
|
|
4319
4379
|
}
|
|
4320
4380
|
);
|
|
4321
4381
|
}
|
|
@@ -4326,12 +4386,12 @@ function KjunAccordionItem({
|
|
|
4326
4386
|
header,
|
|
4327
4387
|
children
|
|
4328
4388
|
}) {
|
|
4329
|
-
const group = (0,
|
|
4330
|
-
(0,
|
|
4389
|
+
const group = (0, import_react37.useContext)(AccordionContext), id = "kjun-" + (0, import_react37.useId)(), [own, setOwn] = (0, import_react37.useState)(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
4390
|
+
(0, import_react37.useEffect)(() => {
|
|
4331
4391
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4332
4392
|
}, []);
|
|
4333
|
-
return /* @__PURE__ */ (0,
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-accordion-item", children: [
|
|
4394
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4335
4395
|
"button",
|
|
4336
4396
|
{
|
|
4337
4397
|
type: "button",
|
|
@@ -4342,8 +4402,8 @@ function KjunAccordionItem({
|
|
|
4342
4402
|
className: "kjun-accordion-trigger",
|
|
4343
4403
|
onClick: () => group ? group.toggle(id) : setOwn(!own),
|
|
4344
4404
|
children: [
|
|
4345
|
-
/* @__PURE__ */ (0,
|
|
4346
|
-
/* @__PURE__ */ (0,
|
|
4405
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4406
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4347
4407
|
KjunIcon,
|
|
4348
4408
|
{
|
|
4349
4409
|
name: "chevron-down",
|
|
@@ -4355,7 +4415,7 @@ function KjunAccordionItem({
|
|
|
4355
4415
|
]
|
|
4356
4416
|
}
|
|
4357
4417
|
),
|
|
4358
|
-
/* @__PURE__ */ (0,
|
|
4418
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4359
4419
|
"div",
|
|
4360
4420
|
{
|
|
4361
4421
|
role: "region",
|
|
@@ -4372,16 +4432,16 @@ function KjunBreadcrumb({
|
|
|
4372
4432
|
renderLink,
|
|
4373
4433
|
ariaLabel = "\uD604\uC7AC \uC704\uCE58"
|
|
4374
4434
|
}) {
|
|
4375
|
-
return /* @__PURE__ */ (0,
|
|
4376
|
-
const label = /* @__PURE__ */ (0,
|
|
4377
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4436
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4437
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: item.icon, size: import_tokens24.tokens.extensions.breadcrumb.iconSize }),
|
|
4378
4438
|
" ",
|
|
4379
4439
|
item.label
|
|
4380
4440
|
] });
|
|
4381
|
-
return /* @__PURE__ */ (0,
|
|
4382
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
4441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react37.Fragment, { children: [
|
|
4442
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens24.tokens.extensions.breadcrumb.separatorSize }),
|
|
4383
4443
|
" ",
|
|
4384
|
-
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ (0,
|
|
4444
|
+
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { href: item.to, children: label }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-current": i === items.length - 1 ? "page" : void 0, children: label })
|
|
4385
4445
|
] }, i);
|
|
4386
4446
|
}) });
|
|
4387
4447
|
}
|
|
@@ -4418,18 +4478,18 @@ function KjunPagination({
|
|
|
4418
4478
|
).filter((v) => v >= 1 && v <= totalPages)
|
|
4419
4479
|
]);
|
|
4420
4480
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
4421
|
-
const button = (target, label, icon) => /* @__PURE__ */ (0,
|
|
4481
|
+
const button = (target, label, icon) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4422
4482
|
"button",
|
|
4423
4483
|
{
|
|
4424
4484
|
type: "button",
|
|
4425
4485
|
"aria-label": label,
|
|
4426
4486
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4427
4487
|
onClick: () => change(target),
|
|
4428
|
-
children: /* @__PURE__ */ (0,
|
|
4488
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: icon, size: import_tokens24.tokens.extensions.pagination.iconSize })
|
|
4429
4489
|
}
|
|
4430
4490
|
);
|
|
4431
|
-
return /* @__PURE__ */ (0,
|
|
4432
|
-
showInfo && totalRows > 0 ? /* @__PURE__ */ (0,
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("nav", { "aria-label": "\uD398\uC774\uC9C0 \uD0D0\uC0C9", className: "kjun-pagination", children: [
|
|
4492
|
+
showInfo && totalRows > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
4433
4493
|
(current - 1) * pageSize + 1,
|
|
4434
4494
|
" -",
|
|
4435
4495
|
" ",
|
|
@@ -4437,9 +4497,9 @@ function KjunPagination({
|
|
|
4437
4497
|
" / ",
|
|
4438
4498
|
formatter(totalRows),
|
|
4439
4499
|
"\uAC1C"
|
|
4440
|
-
] }) : /* @__PURE__ */ (0,
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4442
|
-
showSizeSelector && /* @__PURE__ */ (0,
|
|
4500
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", {}),
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-controls", children: [
|
|
4502
|
+
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-pagination-size", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4443
4503
|
KjunSelect,
|
|
4444
4504
|
{
|
|
4445
4505
|
size: "sm",
|
|
@@ -4453,20 +4513,20 @@ function KjunPagination({
|
|
|
4453
4513
|
}
|
|
4454
4514
|
}
|
|
4455
4515
|
) }),
|
|
4456
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4516
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-mobile", children: [
|
|
4457
4517
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4518
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
4519
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: current }),
|
|
4460
4520
|
" / ",
|
|
4461
4521
|
totalPages
|
|
4462
4522
|
] }),
|
|
4463
4523
|
button(current + 1, "\uB2E4\uC74C \uD398\uC774\uC9C0", "chevron-right")
|
|
4464
4524
|
] }),
|
|
4465
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4525
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-desktop", children: [
|
|
4466
4526
|
showFirstLast && button(1, "\uCCAB \uD398\uC774\uC9C0", "chevrons-left"),
|
|
4467
4527
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4468
4528
|
pages.map(
|
|
4469
|
-
(n, i) => typeof n === "string" ? /* @__PURE__ */ (0,
|
|
4529
|
+
(n, i) => typeof n === "string" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "..." }, "dots" + i) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4470
4530
|
"button",
|
|
4471
4531
|
{
|
|
4472
4532
|
type: "button",
|
|
@@ -4487,8 +4547,8 @@ function KjunPagination({
|
|
|
4487
4547
|
|
|
4488
4548
|
// packages/react/src/actions.tsx
|
|
4489
4549
|
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4490
|
-
var
|
|
4491
|
-
var
|
|
4550
|
+
var import_react38 = require("react");
|
|
4551
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4492
4552
|
function KjunIconToggle({
|
|
4493
4553
|
active = false,
|
|
4494
4554
|
activeIcon,
|
|
@@ -4507,8 +4567,8 @@ function KjunIconToggle({
|
|
|
4507
4567
|
onToggle
|
|
4508
4568
|
}) {
|
|
4509
4569
|
var _a;
|
|
4510
|
-
const navigation = (0,
|
|
4511
|
-
return /* @__PURE__ */ (0,
|
|
4570
|
+
const navigation = (0, import_react38.useContext)(TopNavigationContext);
|
|
4571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4512
4572
|
"button",
|
|
4513
4573
|
{
|
|
4514
4574
|
type: "button",
|
|
@@ -4523,7 +4583,7 @@ function KjunIconToggle({
|
|
|
4523
4583
|
e.stopPropagation();
|
|
4524
4584
|
onToggle == null ? void 0 : onToggle();
|
|
4525
4585
|
},
|
|
4526
|
-
children: loading ? navigation ? /* @__PURE__ */ (0,
|
|
4586
|
+
children: loading ? navigation ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "loader-2", spin: true, size: navigation.iconSize }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunSpinner, { size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4527
4587
|
KjunIcon,
|
|
4528
4588
|
{
|
|
4529
4589
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
@@ -4567,16 +4627,16 @@ function KjunCopyButton({
|
|
|
4567
4627
|
onCopyError
|
|
4568
4628
|
}) {
|
|
4569
4629
|
const feedback = useOptionalKjunFeedback();
|
|
4570
|
-
const [copied, setCopied] = (0,
|
|
4571
|
-
(0,
|
|
4630
|
+
const [copied, setCopied] = (0, import_react38.useState)(false), [failed, setFailed] = (0, import_react38.useState)(false), busy = (0, import_react38.useRef)(false), timer = (0, import_react38.useRef)(void 0), mounted = (0, import_react38.useRef)(true);
|
|
4631
|
+
(0, import_react38.useEffect)(() => {
|
|
4572
4632
|
mounted.current = true;
|
|
4573
4633
|
return () => {
|
|
4574
4634
|
mounted.current = false;
|
|
4575
4635
|
clearTimeout(timer.current);
|
|
4576
4636
|
};
|
|
4577
4637
|
}, []);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
4579
|
-
/* @__PURE__ */ (0,
|
|
4638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4639
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4580
4640
|
"button",
|
|
4581
4641
|
{
|
|
4582
4642
|
type: "button",
|
|
@@ -4614,7 +4674,7 @@ function KjunCopyButton({
|
|
|
4614
4674
|
}
|
|
4615
4675
|
},
|
|
4616
4676
|
children: [
|
|
4617
|
-
/* @__PURE__ */ (0,
|
|
4677
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4618
4678
|
KjunIcon,
|
|
4619
4679
|
{
|
|
4620
4680
|
name: copied ? "check" : "copy",
|
|
@@ -4622,11 +4682,11 @@ function KjunCopyButton({
|
|
|
4622
4682
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
4623
4683
|
}
|
|
4624
4684
|
),
|
|
4625
|
-
text && !inline && /* @__PURE__ */ (0,
|
|
4685
|
+
text && !inline && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: copied ? successText : text })
|
|
4626
4686
|
]
|
|
4627
4687
|
}
|
|
4628
4688
|
),
|
|
4629
|
-
/* @__PURE__ */ (0,
|
|
4689
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { role: feedback ? void 0 : "status", "aria-hidden": feedback ? true : void 0, className: "kjun-sr-only", children: copied ? successText : failed ? "\uBCF5\uC0AC \uC2E4\uD328" : "" })
|
|
4630
4690
|
] });
|
|
4631
4691
|
}
|
|
4632
4692
|
function KjunRefreshButton({
|
|
@@ -4648,7 +4708,7 @@ function KjunRefreshButton({
|
|
|
4648
4708
|
const reduced = useReducedMotion();
|
|
4649
4709
|
const label = ariaLabel || [targetName, mode === "text" ? text : "\uC0C8\uB85C\uACE0\uCE68"].filter(Boolean).join(" ");
|
|
4650
4710
|
const hint = (_a = tooltip != null ? tooltip : title) != null ? _a : mode === "icon" ? label : "";
|
|
4651
|
-
return /* @__PURE__ */ (0,
|
|
4711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunTooltip, { content: props.disabled || props.loading ? "" : hint, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4652
4712
|
KjunButton,
|
|
4653
4713
|
{
|
|
4654
4714
|
...props,
|
|
@@ -4676,8 +4736,8 @@ function KjunExternalLink({
|
|
|
4676
4736
|
label,
|
|
4677
4737
|
children
|
|
4678
4738
|
}) {
|
|
4679
|
-
const url = safeExternalUrl(href), name = label || (mode === "icon" ? "\uC678\uBD80 \uB9C1\uD06C" : void 0), body = mode === "icon" ? /* @__PURE__ */ (0,
|
|
4680
|
-
return url ? /* @__PURE__ */ (0,
|
|
4739
|
+
const url = safeExternalUrl(href), name = label || (mode === "icon" ? "\uC678\uBD80 \uB9C1\uD06C" : void 0), body = mode === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "external-link" }) : children;
|
|
4740
|
+
return url ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4681
4741
|
"a",
|
|
4682
4742
|
{
|
|
4683
4743
|
href: url,
|
|
@@ -4689,14 +4749,14 @@ function KjunExternalLink({
|
|
|
4689
4749
|
onClick: (e) => e.stopPropagation(),
|
|
4690
4750
|
children: [
|
|
4691
4751
|
body,
|
|
4692
|
-
mode === "text" && /* @__PURE__ */ (0,
|
|
4693
|
-
!name && /* @__PURE__ */ (0,
|
|
4752
|
+
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "external-link", size: import_tokens25.tokens.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
4753
|
+
!name && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kjun-sr-only", children: " (\uC0C8 \uCC3D)" })
|
|
4694
4754
|
]
|
|
4695
4755
|
}
|
|
4696
|
-
) : /* @__PURE__ */ (0,
|
|
4756
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-label": name, children: body });
|
|
4697
4757
|
}
|
|
4698
4758
|
function KjunScrollFade({ children }) {
|
|
4699
|
-
const ref = (0,
|
|
4759
|
+
const ref = (0, import_react38.useRef)(null), [edges, setEdges] = (0, import_react38.useState)({ left: false, right: false });
|
|
4700
4760
|
const update = () => {
|
|
4701
4761
|
const el = ref.current;
|
|
4702
4762
|
if (el)
|
|
@@ -4708,7 +4768,7 @@ function KjunScrollFade({ children }) {
|
|
|
4708
4768
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
4709
4769
|
});
|
|
4710
4770
|
};
|
|
4711
|
-
(0,
|
|
4771
|
+
(0, import_react38.useEffect)(() => {
|
|
4712
4772
|
update();
|
|
4713
4773
|
const observer = new ResizeObserver(update);
|
|
4714
4774
|
if (ref.current) {
|
|
@@ -4718,7 +4778,7 @@ function KjunScrollFade({ children }) {
|
|
|
4718
4778
|
return () => observer.disconnect();
|
|
4719
4779
|
}, [children]);
|
|
4720
4780
|
const mask = edges.left || edges.right ? `linear-gradient(to right, ${edges.left ? `transparent, currentColor ${import_tokens25.tokens.extensions.scrollFade.width}px` : "currentColor"}, ${edges.right ? `currentColor calc(100% - ${import_tokens25.tokens.extensions.scrollFade.width}px), transparent` : "currentColor"})` : void 0;
|
|
4721
|
-
return /* @__PURE__ */ (0,
|
|
4781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4722
4782
|
"div",
|
|
4723
4783
|
{
|
|
4724
4784
|
ref,
|
|
@@ -4732,13 +4792,13 @@ function KjunScrollFade({ children }) {
|
|
|
4732
4792
|
|
|
4733
4793
|
// packages/react/src/data-state.tsx
|
|
4734
4794
|
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4735
|
-
var
|
|
4795
|
+
var import_react40 = require("react");
|
|
4736
4796
|
|
|
4737
4797
|
// shared/package-runtime/use-loading-reveal.ts
|
|
4738
|
-
var
|
|
4798
|
+
var import_react39 = require("react");
|
|
4739
4799
|
function useLoadingReveal(active, delay = 0) {
|
|
4740
|
-
const [revealed, setRevealed] = (0,
|
|
4741
|
-
(0,
|
|
4800
|
+
const [revealed, setRevealed] = (0, import_react39.useState)(false);
|
|
4801
|
+
(0, import_react39.useEffect)(() => {
|
|
4742
4802
|
setRevealed(false);
|
|
4743
4803
|
if (!active || delay <= 0) return;
|
|
4744
4804
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -4748,10 +4808,10 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
4748
4808
|
}
|
|
4749
4809
|
|
|
4750
4810
|
// packages/react/src/data-state.tsx
|
|
4751
|
-
var
|
|
4811
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4752
4812
|
function useQueryDisplay(props) {
|
|
4753
4813
|
var _a;
|
|
4754
|
-
const [state, setState] = (0,
|
|
4814
|
+
const [state, setState] = (0, import_react40.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
|
|
4755
4815
|
let next = state;
|
|
4756
4816
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4757
4817
|
next = (0, import_tokens26.advanceQueryDisplay)(state, props);
|
|
@@ -4785,12 +4845,12 @@ function KjunDataState({
|
|
|
4785
4845
|
...query2
|
|
4786
4846
|
}) {
|
|
4787
4847
|
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_tokens26.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
4788
|
-
return /* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4790
|
-
/* @__PURE__ */ (0,
|
|
4791
|
-
/* @__PURE__ */ (0,
|
|
4848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4849
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "kjun-data-status-slot", children: (refreshing || state.queryRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-data-status", role: "status", children: [
|
|
4850
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunSpinner, { size: "xs" }),
|
|
4851
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: refreshingText })
|
|
4792
4852
|
] }) }),
|
|
4793
|
-
state.initialLoading ? /* @__PURE__ */ (0,
|
|
4853
|
+
state.initialLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4794
4854
|
"div",
|
|
4795
4855
|
{
|
|
4796
4856
|
className: "kjun-data-loading-block",
|
|
@@ -4798,13 +4858,13 @@ function KjunDataState({
|
|
|
4798
4858
|
"aria-label": revealed ? loadingText : void 0,
|
|
4799
4859
|
"aria-hidden": revealed ? void 0 : true,
|
|
4800
4860
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4801
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0,
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
4803
|
-
/* @__PURE__ */ (0,
|
|
4861
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { display: "grid", gap: import_tokens26.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-data-loading", children: [
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunSpinner, { size: "md" }),
|
|
4863
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: loadingText })
|
|
4804
4864
|
] }))
|
|
4805
4865
|
}
|
|
4806
|
-
) : blockingError ? /* @__PURE__ */ (0,
|
|
4807
|
-
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ (0,
|
|
4866
|
+
) : blockingError ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "kjun-data-error kjun-state-actions", style: { paddingBlock: padding }, children: errorContent || /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunAlert, { type: "danger", title: "\uC624\uB958 \uBC1C\uC0DD", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: query2.error }) }) : empty ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "kjun-data-empty kjun-state-actions", style: { paddingBlock: padding }, children: emptyContent || /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunEmpty, { text: emptyText, icon: emptyIcon, children: emptyActionText && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunButton, { onClick: onEmptyAction, children: emptyActionText }) }) }) : null,
|
|
4867
|
+
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4808
4868
|
"div",
|
|
4809
4869
|
{
|
|
4810
4870
|
className: "kjun-data-content" + (concealed ? " kjun-data-concealed" : ""),
|
|
@@ -4817,13 +4877,13 @@ function KjunDataState({
|
|
|
4817
4877
|
},
|
|
4818
4878
|
"content"
|
|
4819
4879
|
),
|
|
4820
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0,
|
|
4880
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "kjun-data-warning kjun-state-actions", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunButton, { variant: "secondary", onClick: onRetry, children: retryText }), children: [
|
|
4821
4881
|
visibleRefreshError,
|
|
4822
4882
|
" \xB7 \uC774\uC804 \uC870\uD68C \uACB0\uACFC\uB97C \uD45C\uC2DC\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."
|
|
4823
4883
|
] }) })
|
|
4824
4884
|
] });
|
|
4825
4885
|
}
|
|
4826
|
-
var KjunErrorBoundary = class extends
|
|
4886
|
+
var KjunErrorBoundary = class extends import_react40.Component {
|
|
4827
4887
|
constructor() {
|
|
4828
4888
|
super(...arguments);
|
|
4829
4889
|
this.state = { error: false };
|
|
@@ -4836,10 +4896,10 @@ var KjunErrorBoundary = class extends import_react39.Component {
|
|
|
4836
4896
|
(_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error, info);
|
|
4837
4897
|
}
|
|
4838
4898
|
render() {
|
|
4839
|
-
return this.state.error ? this.props.fallback || /* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
4899
|
+
return this.state.error ? this.props.fallback || /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-error-fallback", children: [
|
|
4900
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { children: this.props.fallbackMessage || "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4" }),
|
|
4901
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "\uB2E4\uC2DC \uC2DC\uB3C4\uD558\uBA74 \uBB38\uC81C\uAC00 \uD574\uACB0\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4." }),
|
|
4902
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4843
4903
|
KjunButton,
|
|
4844
4904
|
{
|
|
4845
4905
|
onClick: () => {
|
|
@@ -4901,37 +4961,37 @@ function webMarketLayout(columns, showActions, widthClass) {
|
|
|
4901
4961
|
}
|
|
4902
4962
|
|
|
4903
4963
|
// packages/react/src/market-layout.tsx
|
|
4904
|
-
var
|
|
4964
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4905
4965
|
function MarketColumns({ columns, showActions, widthClass }) {
|
|
4906
4966
|
const layout = webMarketLayout(columns, showActions, widthClass);
|
|
4907
|
-
return /* @__PURE__ */ (0,
|
|
4908
|
-
showActions && /* @__PURE__ */ (0,
|
|
4909
|
-
layout.columns.map((column, index) => /* @__PURE__ */ (0,
|
|
4967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("colgroup", { children: [
|
|
4968
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("col", { style: { width: marketGeometry.actionsWidth } }),
|
|
4969
|
+
layout.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("col", { ...column }, columns[index].key || index))
|
|
4910
4970
|
] });
|
|
4911
4971
|
}
|
|
4912
4972
|
|
|
4913
4973
|
// packages/react/src/market-skeleton.tsx
|
|
4914
|
-
var
|
|
4974
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4915
4975
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false, alignClass, widthClass }) {
|
|
4916
4976
|
const cols = normalizeMarketColumns(columns);
|
|
4917
|
-
return /* @__PURE__ */ (0,
|
|
4918
|
-
/* @__PURE__ */ (0,
|
|
4919
|
-
/* @__PURE__ */ (0,
|
|
4920
|
-
showActions && /* @__PURE__ */ (0,
|
|
4921
|
-
cols.map((col, i) => /* @__PURE__ */ (0,
|
|
4977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { "aria-hidden": "true", className: "kjun-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("table", { className: "kjun-market-table-grid", style: webMarketLayout(cols, showActions, widthClass).tableStyle, children: [
|
|
4978
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("tr", { children: [
|
|
4980
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("th", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: import_tokens28.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens28.tokens.extensions.marketTable.headerSkeletonHeight }) }) }),
|
|
4981
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("th", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: col.label }, col.key || i))
|
|
4922
4982
|
] }) }),
|
|
4923
|
-
/* @__PURE__ */ (0,
|
|
4924
|
-
showActions && /* @__PURE__ */ (0,
|
|
4925
|
-
cols.map((col, i) => /* @__PURE__ */ (0,
|
|
4926
|
-
/* @__PURE__ */ (0,
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
4928
|
-
] }) : /* @__PURE__ */ (0,
|
|
4983
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("tr", { children: [
|
|
4984
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("td", { className: "kjun-market-actions", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: import_tokens28.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens28.tokens.extensions.financial.priceSkeletonHeight }) }) }),
|
|
4985
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("td", { className: alignClass == null ? void 0 : alignClass(col.align), style: { textAlign: col.align }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "kjun-market-skeleton-identity", children: [
|
|
4986
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens28.tokens.extensions.skeleton.lineHeights.md }),
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens28.tokens.extensions.skeleton.lineHeights.sm })
|
|
4988
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "kjun-market-skeleton-value", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: import_tokens28.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens28.tokens.extensions.financial.priceSkeletonHeight }) }) }, col.key || i))
|
|
4929
4989
|
] }, row)) })
|
|
4930
4990
|
] }) });
|
|
4931
4991
|
}
|
|
4932
4992
|
|
|
4933
4993
|
// packages/react/src/skeletons.tsx
|
|
4934
|
-
var
|
|
4994
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4935
4995
|
function KjunListSkeleton({
|
|
4936
4996
|
rows = 8,
|
|
4937
4997
|
variant = "market",
|
|
@@ -4939,10 +4999,10 @@ function KjunListSkeleton({
|
|
|
4939
4999
|
avatarSize = import_tokens29.tokens.extensions.skeleton.listAvatarSize,
|
|
4940
5000
|
quote = true
|
|
4941
5001
|
}) {
|
|
4942
|
-
return /* @__PURE__ */ (0,
|
|
4943
|
-
avatar && /* @__PURE__ */ (0,
|
|
4944
|
-
/* @__PURE__ */ (0,
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
5002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { "aria-hidden": "true", children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-list-skeleton-row", "data-variant": variant, children: [
|
|
5003
|
+
avatar && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-list-skeleton-label", children: [
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4946
5006
|
KjunSkeleton,
|
|
4947
5007
|
{
|
|
4948
5008
|
type: "block",
|
|
@@ -4950,11 +5010,11 @@ function KjunListSkeleton({
|
|
|
4950
5010
|
width: i % 2 ? "80%" : "65%"
|
|
4951
5011
|
}
|
|
4952
5012
|
),
|
|
4953
|
-
/* @__PURE__ */ (0,
|
|
5013
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
4954
5014
|
] }),
|
|
4955
|
-
quote && /* @__PURE__ */ (0,
|
|
4956
|
-
/* @__PURE__ */ (0,
|
|
4957
|
-
/* @__PURE__ */ (0,
|
|
5015
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5016
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.quoteHeight, width: import_tokens29.tokens.extensions.skeleton.quoteWidth }),
|
|
5017
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens29.tokens.extensions.skeleton.detailWidth })
|
|
4958
5018
|
] })
|
|
4959
5019
|
] }, i)) });
|
|
4960
5020
|
}
|
|
@@ -4964,19 +5024,19 @@ function KjunFormSkeleton({
|
|
|
4964
5024
|
multiline = false,
|
|
4965
5025
|
size = "md"
|
|
4966
5026
|
}) {
|
|
4967
|
-
return /* @__PURE__ */ (0,
|
|
5027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4968
5028
|
"div",
|
|
4969
5029
|
{
|
|
4970
5030
|
"aria-hidden": "true",
|
|
4971
5031
|
className: "kjun-form-skeleton",
|
|
4972
5032
|
"data-columns": columns,
|
|
4973
5033
|
style: { "--_kjun-form-skeleton-radius": `${import_tokens29.tokens.input[size].radius}px` },
|
|
4974
|
-
children: fields.map((field, i) => /* @__PURE__ */ (0,
|
|
4975
|
-
field ? /* @__PURE__ */ (0,
|
|
5034
|
+
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5035
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
4976
5036
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
4977
|
-
/* @__PURE__ */ (0,
|
|
5037
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "kjun-form-skeleton-label-slot", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.formLabelHeight, width: import_tokens29.tokens.extensions.skeleton.formLabelWidth }) })
|
|
4978
5038
|
),
|
|
4979
|
-
/* @__PURE__ */ (0,
|
|
5039
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4980
5040
|
KjunSkeleton,
|
|
4981
5041
|
{
|
|
4982
5042
|
type: "block",
|
|
@@ -4997,7 +5057,7 @@ function KjunChartSkeleton({
|
|
|
4997
5057
|
columns = 14
|
|
4998
5058
|
}) {
|
|
4999
5059
|
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
5000
|
-
return /* @__PURE__ */ (0,
|
|
5060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5001
5061
|
"div",
|
|
5002
5062
|
{
|
|
5003
5063
|
className: "kjun-chart-skeleton",
|
|
@@ -5005,11 +5065,11 @@ function KjunChartSkeleton({
|
|
|
5005
5065
|
"data-skeleton": skeleton ? void 0 : "false",
|
|
5006
5066
|
"aria-hidden": revealed ? void 0 : true,
|
|
5007
5067
|
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
5008
|
-
children: !skeleton ? /* @__PURE__ */ (0,
|
|
5009
|
-
/* @__PURE__ */ (0,
|
|
5010
|
-
loadingText && /* @__PURE__ */ (0,
|
|
5011
|
-
] }) : /* @__PURE__ */ (0,
|
|
5012
|
-
kind === "donut" ? /* @__PURE__ */ (0,
|
|
5068
|
+
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
5069
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSpinner, { size: "md" }) }),
|
|
5070
|
+
loadingText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { children: loadingText })
|
|
5071
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5072
|
+
kind === "donut" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut", "aria-hidden": "true" }) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5013
5073
|
"div",
|
|
5014
5074
|
{
|
|
5015
5075
|
className: "kjun-chart-skeleton-matrix",
|
|
@@ -5019,7 +5079,7 @@ function KjunChartSkeleton({
|
|
|
5019
5079
|
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
5020
5080
|
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
5021
5081
|
},
|
|
5022
|
-
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0,
|
|
5082
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5023
5083
|
"div",
|
|
5024
5084
|
{
|
|
5025
5085
|
className: "kjun-chart-skeleton-cell",
|
|
@@ -5029,7 +5089,7 @@ function KjunChartSkeleton({
|
|
|
5029
5089
|
i
|
|
5030
5090
|
))
|
|
5031
5091
|
}
|
|
5032
|
-
) : /* @__PURE__ */ (0,
|
|
5092
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5033
5093
|
"svg",
|
|
5034
5094
|
{
|
|
5035
5095
|
viewBox: chartFrameViewBox,
|
|
@@ -5037,7 +5097,7 @@ function KjunChartSkeleton({
|
|
|
5037
5097
|
className: "kjun-chart-skeleton-plot",
|
|
5038
5098
|
"data-kjun-chart-part": "plot",
|
|
5039
5099
|
"aria-hidden": "true",
|
|
5040
|
-
children: /* @__PURE__ */ (0,
|
|
5100
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5041
5101
|
"path",
|
|
5042
5102
|
{
|
|
5043
5103
|
d: chartFramePath,
|
|
@@ -5049,7 +5109,7 @@ function KjunChartSkeleton({
|
|
|
5049
5109
|
)
|
|
5050
5110
|
}
|
|
5051
5111
|
),
|
|
5052
|
-
loadingText && /* @__PURE__ */ (0,
|
|
5112
|
+
loadingText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "kjun-chart-skeleton-status", "data-kjun-chart-part": "status", role: status, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: loadingText }) })
|
|
5053
5113
|
] })
|
|
5054
5114
|
}
|
|
5055
5115
|
);
|
|
@@ -5057,13 +5117,13 @@ function KjunChartSkeleton({
|
|
|
5057
5117
|
|
|
5058
5118
|
// packages/react/src/financial-display.tsx
|
|
5059
5119
|
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5060
|
-
var
|
|
5120
|
+
var import_react42 = require("react");
|
|
5061
5121
|
|
|
5062
5122
|
// packages/react/src/number-display.tsx
|
|
5063
5123
|
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5064
5124
|
|
|
5065
5125
|
// shared/package-runtime/use-number-motion.ts
|
|
5066
|
-
var
|
|
5126
|
+
var import_react41 = require("react");
|
|
5067
5127
|
|
|
5068
5128
|
// shared/package-runtime/number-motion.ts
|
|
5069
5129
|
var import_tokens30 = require("@kjun-ui/tokens");
|
|
@@ -5109,14 +5169,14 @@ function createNumberMotion(apply) {
|
|
|
5109
5169
|
|
|
5110
5170
|
// shared/package-runtime/use-number-motion.ts
|
|
5111
5171
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5112
|
-
const [display, setDisplay] = (0,
|
|
5113
|
-
const motion = (0,
|
|
5172
|
+
const [display, setDisplay] = (0, import_react41.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5173
|
+
const motion = (0, import_react41.useRef)(null);
|
|
5114
5174
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5115
|
-
(0,
|
|
5175
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
5116
5176
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5117
5177
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5118
5178
|
}, [value, animated, fromPrevious, reduced]);
|
|
5119
|
-
(0,
|
|
5179
|
+
(0, import_react41.useLayoutEffect)(() => () => {
|
|
5120
5180
|
var _a;
|
|
5121
5181
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5122
5182
|
motion.current = null;
|
|
@@ -5146,7 +5206,7 @@ function formatRelativeTime(value, now = Date.now()) {
|
|
|
5146
5206
|
}
|
|
5147
5207
|
|
|
5148
5208
|
// packages/react/src/number-display.tsx
|
|
5149
|
-
var
|
|
5209
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5150
5210
|
var finiteNumber = (value) => value == null || typeof value === "boolean" || typeof value === "string" && !value.trim() || !["number", "string"].includes(typeof value) || !Number.isFinite(Number(value)) ? null : Number(value) || 0;
|
|
5151
5211
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5152
5212
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5166,10 +5226,10 @@ function KjunAnimatedNumber({
|
|
|
5166
5226
|
className = ""
|
|
5167
5227
|
}) {
|
|
5168
5228
|
const n = useCountUp(value, animated, fromPrevious);
|
|
5169
|
-
return /* @__PURE__ */ (0,
|
|
5170
|
-
prefix && /* @__PURE__ */ (0,
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5172
|
-
suffix && /* @__PURE__ */ (0,
|
|
5229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "kjun-animated-number " + className, children: [
|
|
5230
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
5231
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals) }),
|
|
5232
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "kjun-number-affix", "data-side": "suffix", children: suffix })
|
|
5173
5233
|
] });
|
|
5174
5234
|
}
|
|
5175
5235
|
function KjunFreshness({
|
|
@@ -5178,11 +5238,11 @@ function KjunFreshness({
|
|
|
5178
5238
|
fetchedAt,
|
|
5179
5239
|
formatter
|
|
5180
5240
|
}) {
|
|
5181
|
-
return stale ? /* @__PURE__ */ (0,
|
|
5241
|
+
return stale ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5182
5242
|
KjunTooltip,
|
|
5183
5243
|
{
|
|
5184
5244
|
content: (source === "close" ? "\uC2E4\uC2DC\uAC04 \uC2DC\uC138 \uC5C6\uC74C \xB7 \uCD5C\uADFC \uC885\uAC00 \uD45C\uC2DC" : "\uC2E4\uC2DC\uAC04 \uC2DC\uC138 \uC9C0\uC5F0") + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt)) : ""),
|
|
5185
|
-
children: /* @__PURE__ */ (0,
|
|
5245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { tabIndex: 0, className: "kjun-freshness", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunBadge, { variant: "warning", size: "xs", children: source === "close" ? "\uC885\uAC00" : "\uC9C0\uC5F0" }) })
|
|
5186
5246
|
}
|
|
5187
5247
|
) : null;
|
|
5188
5248
|
}
|
|
@@ -5196,14 +5256,14 @@ function KjunPriceCell({
|
|
|
5196
5256
|
flashClass = "",
|
|
5197
5257
|
fromPrevious = true
|
|
5198
5258
|
}) {
|
|
5199
|
-
return value == null ? /* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5259
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", height: import_tokens31.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens31.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5201
5261
|
"span",
|
|
5202
5262
|
{
|
|
5203
5263
|
className: "kjun-price-cell " + flashClass,
|
|
5204
5264
|
ref: domainColorRef(/\bkjun-price-flash-(up|down)/.test(flashClass)),
|
|
5205
5265
|
style: { color: stale ? "var(--_kjun-color-text-tertiary)" : void 0 },
|
|
5206
|
-
children: /* @__PURE__ */ (0,
|
|
5266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5207
5267
|
KjunAnimatedNumber,
|
|
5208
5268
|
{
|
|
5209
5269
|
value,
|
|
@@ -5213,7 +5273,7 @@ function KjunPriceCell({
|
|
|
5213
5273
|
)
|
|
5214
5274
|
}
|
|
5215
5275
|
),
|
|
5216
|
-
showFreshness && /* @__PURE__ */ (0,
|
|
5276
|
+
showFreshness && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunFreshness, { stale, source, fetchedAt })
|
|
5217
5277
|
] });
|
|
5218
5278
|
}
|
|
5219
5279
|
function KjunSignedValue({
|
|
@@ -5232,7 +5292,7 @@ function KjunSignedValue({
|
|
|
5232
5292
|
}) {
|
|
5233
5293
|
const n = finiteNumber(value), role2 = loading || n === null ? "text-secondary" : stale ? "text-tertiary" : n > 0 ? "price-up" : n < 0 ? "price-down" : "price-neutral";
|
|
5234
5294
|
const display = n === null ? "\u2014" : formatter ? formatter(n) : prefix + (showSign && n > 0 ? "+" : "") + format(kind === "percent" && !isRaw ? n * 100 : n, decimals) + (kind === "percent" ? "%" : "") + suffix;
|
|
5235
|
-
return /* @__PURE__ */ (0,
|
|
5295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5236
5296
|
"span",
|
|
5237
5297
|
{
|
|
5238
5298
|
className: "kjun-signed-value",
|
|
@@ -5244,15 +5304,15 @@ function KjunSignedValue({
|
|
|
5244
5304
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5245
5305
|
},
|
|
5246
5306
|
children: [
|
|
5247
|
-
loading ? /* @__PURE__ */ (0,
|
|
5248
|
-
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0,
|
|
5307
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", width: import_tokens31.tokens.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5308
|
+
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunFreshness, { stale: true })
|
|
5249
5309
|
]
|
|
5250
5310
|
}
|
|
5251
5311
|
);
|
|
5252
5312
|
}
|
|
5253
5313
|
|
|
5254
5314
|
// packages/react/src/financial-display.tsx
|
|
5255
|
-
var
|
|
5315
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5256
5316
|
var deviationFill = { neutral: 1, low: import_tokens32.tokens.states.opacity.deviationLow, medium: import_tokens32.tokens.states.opacity.deviationMedium, strong: import_tokens32.tokens.states.opacity.deviationStrong };
|
|
5257
5317
|
function KjunDeviation({
|
|
5258
5318
|
value,
|
|
@@ -5263,11 +5323,11 @@ function KjunDeviation({
|
|
|
5263
5323
|
}) {
|
|
5264
5324
|
const n = finiteNumber(value);
|
|
5265
5325
|
if (n === null)
|
|
5266
|
-
return /* @__PURE__ */ (0,
|
|
5326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5267
5327
|
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens32.deviationLevel)(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
5268
5328
|
if (variant === "badge")
|
|
5269
|
-
return /* @__PURE__ */ (0,
|
|
5270
|
-
/* @__PURE__ */ (0,
|
|
5329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5271
5331
|
KjunBadge,
|
|
5272
5332
|
{
|
|
5273
5333
|
variant: neutral ? "secondary" : n > 0 ? "price-up" : "price-down",
|
|
@@ -5276,11 +5336,11 @@ function KjunDeviation({
|
|
|
5276
5336
|
children: label
|
|
5277
5337
|
}
|
|
5278
5338
|
),
|
|
5279
|
-
!signal ? /* @__PURE__ */ (0,
|
|
5339
|
+
!signal ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "kjun-deviation-signal-slot", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5280
5340
|
KjunTooltip,
|
|
5281
5341
|
{
|
|
5282
5342
|
content: `\uAD34\uB9AC\uC728 ${signalThreshold}% \uCD08\uACFC \u2014 \uCC28\uC775\uAC70\uB798 \uAE30\uD68C \uAC00\uB2A5`,
|
|
5283
|
-
children: /* @__PURE__ */ (0,
|
|
5343
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { tabIndex: 0, role: "img", "aria-label": "\uCC28\uC775\uAC70\uB798 \uAE30\uD68C", className: "kjun-deviation-signal", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5284
5344
|
KjunIcon,
|
|
5285
5345
|
{
|
|
5286
5346
|
name: "alert-triangle",
|
|
@@ -5291,7 +5351,7 @@ function KjunDeviation({
|
|
|
5291
5351
|
}
|
|
5292
5352
|
)
|
|
5293
5353
|
] });
|
|
5294
|
-
return /* @__PURE__ */ (0,
|
|
5354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5295
5355
|
"span",
|
|
5296
5356
|
{
|
|
5297
5357
|
className: "kjun-deviation",
|
|
@@ -5299,7 +5359,7 @@ function KjunDeviation({
|
|
|
5299
5359
|
"data-variant": variant,
|
|
5300
5360
|
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
|
|
5301
5361
|
children: [
|
|
5302
|
-
variant === "pill" && /* @__PURE__ */ (0,
|
|
5362
|
+
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5303
5363
|
"span",
|
|
5304
5364
|
{
|
|
5305
5365
|
"aria-hidden": "true",
|
|
@@ -5310,7 +5370,7 @@ function KjunDeviation({
|
|
|
5310
5370
|
}
|
|
5311
5371
|
}
|
|
5312
5372
|
),
|
|
5313
|
-
/* @__PURE__ */ (0,
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: label })
|
|
5314
5374
|
]
|
|
5315
5375
|
}
|
|
5316
5376
|
);
|
|
@@ -5326,8 +5386,8 @@ function KjunHeatmapCell({
|
|
|
5326
5386
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5327
5387
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5328
5388
|
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = import_tokens32.tokens.states.opacity;
|
|
5329
|
-
return /* @__PURE__ */ (0,
|
|
5330
|
-
/* @__PURE__ */ (0,
|
|
5389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5390
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5331
5391
|
"span",
|
|
5332
5392
|
{
|
|
5333
5393
|
"aria-hidden": "true",
|
|
@@ -5335,7 +5395,7 @@ function KjunHeatmapCell({
|
|
|
5335
5395
|
style: magnitude ? { background: `var(--_kjun-color-${role2})`, opacity: heatMinimum + (heatMaximum - heatMinimum) * magnitude } : { background: "var(--_kjun-color-secondary)" }
|
|
5336
5396
|
}
|
|
5337
5397
|
),
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: children != null ? children : value })
|
|
5339
5399
|
] });
|
|
5340
5400
|
}
|
|
5341
5401
|
function KjunProgressCell({
|
|
@@ -5347,8 +5407,8 @@ function KjunProgressCell({
|
|
|
5347
5407
|
height = import_tokens32.tokens.extensions.financial.progressHeight
|
|
5348
5408
|
}) {
|
|
5349
5409
|
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;
|
|
5350
|
-
return /* @__PURE__ */ (0,
|
|
5351
|
-
/* @__PURE__ */ (0,
|
|
5410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
5411
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { height }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5352
5412
|
"span",
|
|
5353
5413
|
{
|
|
5354
5414
|
style: {
|
|
@@ -5357,7 +5417,7 @@ function KjunProgressCell({
|
|
|
5357
5417
|
}
|
|
5358
5418
|
}
|
|
5359
5419
|
) }),
|
|
5360
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5420
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
|
|
5361
5421
|
Math.round(percent),
|
|
5362
5422
|
"%"
|
|
5363
5423
|
] })
|
|
@@ -5369,7 +5429,7 @@ function KjunCollectionMark({
|
|
|
5369
5429
|
size = "md"
|
|
5370
5430
|
}) {
|
|
5371
5431
|
const box = import_tokens32.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens32.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5372
|
-
return /* @__PURE__ */ (0,
|
|
5432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5373
5433
|
KjunIcon,
|
|
5374
5434
|
{
|
|
5375
5435
|
ref: domainColorRef(active),
|
|
@@ -5399,7 +5459,7 @@ function KjunExecutionStatusBadge({
|
|
|
5399
5459
|
size = "md"
|
|
5400
5460
|
}) {
|
|
5401
5461
|
const state = status ? executionStates[status] : void 0;
|
|
5402
|
-
return /* @__PURE__ */ (0,
|
|
5462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunBadge, { variant: (state == null ? void 0 : state[0]) || "secondary", size, dot: status === "running", children: label || (state == null ? void 0 : state[1]) || (status ? "\uC54C \uC218 \uC5C6\uC74C" : "\uC2E4\uD589 \uC774\uB825 \uC5C6\uC74C") });
|
|
5403
5463
|
}
|
|
5404
5464
|
function KjunSparkline({
|
|
5405
5465
|
data = [],
|
|
@@ -5412,10 +5472,10 @@ function KjunSparkline({
|
|
|
5412
5472
|
stretch = false,
|
|
5413
5473
|
ariaLabel
|
|
5414
5474
|
}) {
|
|
5415
|
-
const id = "kjun-" + (0,
|
|
5475
|
+
const id = "kjun-" + (0, import_react42.useId)().replace(/:/g, ""), values = data.filter(Number.isFinite), min = Math.min(...values), max = Math.max(...values), range = max - min || 1, points = values.map(
|
|
5416
5476
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5417
5477
|
).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"})`;
|
|
5418
|
-
return /* @__PURE__ */ (0,
|
|
5478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5419
5479
|
"svg",
|
|
5420
5480
|
{
|
|
5421
5481
|
ref: domainColorRef(!color && semantic === "price" && change !== 0),
|
|
@@ -5428,12 +5488,12 @@ function KjunSparkline({
|
|
|
5428
5488
|
"aria-hidden": !ariaLabel || void 0,
|
|
5429
5489
|
className: "kjun-sparkline",
|
|
5430
5490
|
children: [
|
|
5431
|
-
fill && values.length > 1 && /* @__PURE__ */ (0,
|
|
5432
|
-
/* @__PURE__ */ (0,
|
|
5433
|
-
/* @__PURE__ */ (0,
|
|
5434
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
fill && values.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5492
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("stop", { offset: "0%", stopColor: line, stopOpacity: 0.3 }),
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("stop", { offset: "100%", stopColor: line, stopOpacity: 0.05 })
|
|
5435
5495
|
] }) }),
|
|
5436
|
-
/* @__PURE__ */ (0,
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5437
5497
|
"polygon",
|
|
5438
5498
|
{
|
|
5439
5499
|
points: `2,${height - 2} ${points} ${width - 2},${height - 2}`,
|
|
@@ -5441,7 +5501,7 @@ function KjunSparkline({
|
|
|
5441
5501
|
}
|
|
5442
5502
|
)
|
|
5443
5503
|
] }),
|
|
5444
|
-
values.length > 1 ? /* @__PURE__ */ (0,
|
|
5504
|
+
values.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5445
5505
|
"polyline",
|
|
5446
5506
|
{
|
|
5447
5507
|
points,
|
|
@@ -5452,7 +5512,7 @@ function KjunSparkline({
|
|
|
5452
5512
|
strokeLinejoin: "round",
|
|
5453
5513
|
vectorEffect: stretch ? "non-scaling-stroke" : void 0
|
|
5454
5514
|
}
|
|
5455
|
-
) : values.length === 1 ? /* @__PURE__ */ (0,
|
|
5515
|
+
) : values.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("circle", { cx: width / 2, cy: height / 2, r: 2, fill: line }) : null
|
|
5456
5516
|
]
|
|
5457
5517
|
}
|
|
5458
5518
|
);
|
|
@@ -5460,7 +5520,7 @@ function KjunSparkline({
|
|
|
5460
5520
|
|
|
5461
5521
|
// shared/package-runtime/table.ts
|
|
5462
5522
|
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5463
|
-
var
|
|
5523
|
+
var import_react43 = require("react");
|
|
5464
5524
|
|
|
5465
5525
|
// shared/package-runtime/table-model.ts
|
|
5466
5526
|
function getValue(row, key) {
|
|
@@ -5504,11 +5564,11 @@ function useTableModel(props) {
|
|
|
5504
5564
|
expandSingle = false,
|
|
5505
5565
|
onExpandedRowsChange
|
|
5506
5566
|
} = props;
|
|
5507
|
-
const [internalSort, setSort] = (0,
|
|
5567
|
+
const [internalSort, setSort] = (0, import_react43.useState)({
|
|
5508
5568
|
key: "",
|
|
5509
5569
|
order: "asc"
|
|
5510
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5511
|
-
(0,
|
|
5570
|
+
}), [internalExpanded, setExpanded] = (0, import_react43.useState)([]), [search, setSearch] = (0, import_react43.useState)(""), timer = (0, import_react43.useRef)(void 0);
|
|
5571
|
+
(0, import_react43.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5512
5572
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5513
5573
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5514
5574
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5598,7 +5658,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
5598
5658
|
|
|
5599
5659
|
// packages/react/src/table-toolbar.tsx
|
|
5600
5660
|
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5601
|
-
var
|
|
5661
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5602
5662
|
function TableToolbar({
|
|
5603
5663
|
selectable,
|
|
5604
5664
|
selected,
|
|
@@ -5611,20 +5671,20 @@ function TableToolbar({
|
|
|
5611
5671
|
searchPlaceholder,
|
|
5612
5672
|
toolbar
|
|
5613
5673
|
}) {
|
|
5614
|
-
return /* @__PURE__ */ (0,
|
|
5615
|
-
selectable && selected.length > 0 && /* @__PURE__ */ (0,
|
|
5674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
5675
|
+
selectable && selected.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5616
5676
|
"div",
|
|
5617
5677
|
{
|
|
5618
5678
|
role: "group",
|
|
5619
5679
|
"aria-label": "\uC120\uD0DD \uC791\uC5C5",
|
|
5620
5680
|
className: "kjun-table-selection",
|
|
5621
5681
|
children: [
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
5682
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("strong", { children: [
|
|
5623
5683
|
selected.length,
|
|
5624
5684
|
"\uAC1C \uC120\uD0DD"
|
|
5625
5685
|
] }),
|
|
5626
|
-
/* @__PURE__ */ (0,
|
|
5627
|
-
/* @__PURE__ */ (0,
|
|
5686
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(KjunButton, { size: "xs", variant: "ghost", onClick: toggleAll, children: "\uC804\uCCB4 \uC120\uD0DD" }),
|
|
5687
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5628
5688
|
KjunButton,
|
|
5629
5689
|
{
|
|
5630
5690
|
size: "xs",
|
|
@@ -5637,8 +5697,8 @@ function TableToolbar({
|
|
|
5637
5697
|
]
|
|
5638
5698
|
}
|
|
5639
5699
|
),
|
|
5640
|
-
(searchable || toolbar) && /* @__PURE__ */ (0,
|
|
5641
|
-
searchable && /* @__PURE__ */ (0,
|
|
5700
|
+
(searchable || toolbar) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-table-toolbar", children: [
|
|
5701
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5642
5702
|
KjunInput,
|
|
5643
5703
|
{
|
|
5644
5704
|
size: "sm",
|
|
@@ -5659,10 +5719,10 @@ function TableToolbar({
|
|
|
5659
5719
|
|
|
5660
5720
|
// packages/react/src/table-grid.tsx
|
|
5661
5721
|
var import_tokens36 = require("@kjun-ui/tokens");
|
|
5662
|
-
var
|
|
5722
|
+
var import_react45 = require("react");
|
|
5663
5723
|
|
|
5664
5724
|
// packages/react/src/table-check.tsx
|
|
5665
|
-
var
|
|
5725
|
+
var import_react44 = require("react");
|
|
5666
5726
|
|
|
5667
5727
|
// shared/package-runtime/component-icons.ts
|
|
5668
5728
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -5670,22 +5730,22 @@ var componentIcons = { minus: import_minus.default };
|
|
|
5670
5730
|
|
|
5671
5731
|
// packages/react/src/table-check.tsx
|
|
5672
5732
|
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5673
|
-
var
|
|
5674
|
-
var TableCheck = (0,
|
|
5733
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5734
|
+
var TableCheck = (0, import_react44.forwardRef)(
|
|
5675
5735
|
function TableCheck2(props, ref) {
|
|
5676
5736
|
const size = import_tokens35.tokens.extensions.checkbox.iconSizes.sm;
|
|
5677
|
-
return /* @__PURE__ */ (0,
|
|
5678
|
-
/* @__PURE__ */ (0,
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "kjun-table-check", children: [
|
|
5738
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(KjunIcon, { name: "minus", size, className: "kjun-table-check-dash" })
|
|
5681
5741
|
] }) });
|
|
5682
5742
|
}
|
|
5683
5743
|
);
|
|
5684
5744
|
|
|
5685
5745
|
// packages/react/src/table-grid.tsx
|
|
5686
|
-
var
|
|
5746
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5687
5747
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }) {
|
|
5688
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "kjun-table-scroll", style: { maxHeight, visibility: skeletonHidden ? "hidden" : void 0 }, "aria-hidden": skeletonHidden || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5689
5749
|
"table",
|
|
5690
5750
|
{
|
|
5691
5751
|
className: "kjun-table",
|
|
@@ -5694,12 +5754,12 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5694
5754
|
"data-hoverable": hoverable,
|
|
5695
5755
|
"data-striped": striped,
|
|
5696
5756
|
children: [
|
|
5697
|
-
/* @__PURE__ */ (0,
|
|
5757
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5698
5758
|
"thead",
|
|
5699
5759
|
{
|
|
5700
5760
|
style: stickyHeader ? { position: "sticky", top: 0, zIndex: 2 } : void 0,
|
|
5701
|
-
children: /* @__PURE__ */ (0,
|
|
5702
|
-
selectable && /* @__PURE__ */ (0,
|
|
5761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tr", { children: [
|
|
5762
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { scope: "col", className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5703
5763
|
TableCheck,
|
|
5704
5764
|
{
|
|
5705
5765
|
"aria-label": "\uC804\uCCB4 \uC120\uD0DD",
|
|
@@ -5710,22 +5770,22 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5710
5770
|
onChange: state.toggleAll
|
|
5711
5771
|
}
|
|
5712
5772
|
) }),
|
|
5713
|
-
expandable && /* @__PURE__ */ (0,
|
|
5714
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5773
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { scope: "col", className: "kjun-table-action-cell" }),
|
|
5774
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5715
5775
|
"th",
|
|
5716
5776
|
{
|
|
5717
5777
|
scope: "col",
|
|
5718
5778
|
style: { width: col.width, textAlign: col.align },
|
|
5719
5779
|
className: col.headerClass,
|
|
5720
5780
|
"aria-sort": col.sortable && sortable !== false ? state.sort.key === col.key ? state.sort.order === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
5721
|
-
children: col.sortable && sortable !== false ? /* @__PURE__ */ (0,
|
|
5781
|
+
children: col.sortable && sortable !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5722
5782
|
"button",
|
|
5723
5783
|
{
|
|
5724
5784
|
type: "button",
|
|
5725
5785
|
onClick: () => state.sortColumn(col),
|
|
5726
5786
|
children: [
|
|
5727
5787
|
col.label,
|
|
5728
|
-
state.sort.key === col.key && /* @__PURE__ */ (0,
|
|
5788
|
+
state.sort.key === col.key && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5729
5789
|
KjunIcon,
|
|
5730
5790
|
{
|
|
5731
5791
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
@@ -5741,10 +5801,10 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5741
5801
|
] })
|
|
5742
5802
|
}
|
|
5743
5803
|
),
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
5745
|
-
selectable && /* @__PURE__ */ (0,
|
|
5746
|
-
expandable && /* @__PURE__ */ (0,
|
|
5747
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tbody", { children: initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tr", { "aria-hidden": "true", children: [
|
|
5805
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(KjunSkeleton, { type: "block", height: import_tokens36.tokens.table.selectionSize, width: import_tokens36.tokens.table.selectionSize }) }),
|
|
5806
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
5807
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5748
5808
|
KjunSkeleton,
|
|
5749
5809
|
{
|
|
5750
5810
|
type: "block",
|
|
@@ -5752,15 +5812,15 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5752
5812
|
width: col.key === "actions" ? import_tokens36.tokens.table.actionColumnWidth : "75%"
|
|
5753
5813
|
}
|
|
5754
5814
|
) }, col.key))
|
|
5755
|
-
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0,
|
|
5815
|
+
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5756
5816
|
"td",
|
|
5757
5817
|
{
|
|
5758
5818
|
colSpan: visible.length + Number(selectable) + Number(expandable),
|
|
5759
5819
|
className: "kjun-table-empty",
|
|
5760
5820
|
children: emptyContent || emptyText
|
|
5761
5821
|
}
|
|
5762
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0,
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5822
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react45.Fragment, { children: [
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5764
5824
|
"tr",
|
|
5765
5825
|
{
|
|
5766
5826
|
className: "kjun-table-row-action " + customClass(row, i),
|
|
@@ -5769,9 +5829,9 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5769
5829
|
"data-selected": state.selectedRow(row) || void 0,
|
|
5770
5830
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5771
5831
|
children: [
|
|
5772
|
-
selectable && /* @__PURE__ */ (0,
|
|
5773
|
-
expandable && /* @__PURE__ */ (0,
|
|
5774
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5832
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell", children: checkbox(row, i) }),
|
|
5833
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell", children: expand(row, i) }),
|
|
5834
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5775
5835
|
"td",
|
|
5776
5836
|
{
|
|
5777
5837
|
style: { textAlign: col.align },
|
|
@@ -5784,7 +5844,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5784
5844
|
]
|
|
5785
5845
|
}
|
|
5786
5846
|
),
|
|
5787
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0,
|
|
5847
|
+
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tr", { className: "kjun-table-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5788
5848
|
"td",
|
|
5789
5849
|
{
|
|
5790
5850
|
colSpan: visible.length + Number(selectable) + 1,
|
|
@@ -5798,7 +5858,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5798
5858
|
}
|
|
5799
5859
|
|
|
5800
5860
|
// packages/react/src/table-cards.tsx
|
|
5801
|
-
var
|
|
5861
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5802
5862
|
function TableCards({
|
|
5803
5863
|
initialLoading,
|
|
5804
5864
|
skeletonRows,
|
|
@@ -5819,7 +5879,7 @@ function TableCards({
|
|
|
5819
5879
|
rowKeyDown
|
|
5820
5880
|
}) {
|
|
5821
5881
|
const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
|
|
5822
|
-
return /* @__PURE__ */ (0,
|
|
5882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5823
5883
|
"div",
|
|
5824
5884
|
{
|
|
5825
5885
|
className: "kjun-table-cards",
|
|
@@ -5828,7 +5888,7 @@ function TableCards({
|
|
|
5828
5888
|
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5829
5889
|
"aria-hidden": skeletonHidden || void 0,
|
|
5830
5890
|
children: [
|
|
5831
|
-
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0,
|
|
5891
|
+
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSkeleton, { type: "card" }) }, i)) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5832
5892
|
"div",
|
|
5833
5893
|
{
|
|
5834
5894
|
role: "listitem",
|
|
@@ -5837,40 +5897,40 @@ function TableCards({
|
|
|
5837
5897
|
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5838
5898
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5839
5899
|
children: [
|
|
5840
|
-
/* @__PURE__ */ (0,
|
|
5841
|
-
/* @__PURE__ */ (0,
|
|
5900
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "kjun-table-card-header", children: [
|
|
5901
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "kjun-table-card-header-left", children: [
|
|
5842
5902
|
selectable && checkbox(row, i),
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5844
5904
|
] }),
|
|
5845
|
-
badges.length ? /* @__PURE__ */ (0,
|
|
5846
|
-
inline.length > 0 && /* @__PURE__ */ (0,
|
|
5905
|
+
badges.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-badges", children: badges.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: cell(col, row, i) }, col.key)) }) : subtitle ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-subtitle", children: cell(subtitle, row, i) }) : null,
|
|
5906
|
+
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5847
5907
|
"div",
|
|
5848
5908
|
{
|
|
5849
5909
|
className: "kjun-table-card-header-actions",
|
|
5850
5910
|
onClick: (e) => e.stopPropagation(),
|
|
5851
|
-
children: inline.map((col) => /* @__PURE__ */ (0,
|
|
5911
|
+
children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: cell(col, row, i) }, col.key))
|
|
5852
5912
|
}
|
|
5853
5913
|
)
|
|
5854
5914
|
] }),
|
|
5855
5915
|
sections.map((section, index) => {
|
|
5856
5916
|
const cols = columnsForSection(row, section);
|
|
5857
|
-
return cols.length ? /* @__PURE__ */ (0,
|
|
5917
|
+
return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5858
5918
|
"section",
|
|
5859
5919
|
{
|
|
5860
5920
|
className: "kjun-table-card-section",
|
|
5861
5921
|
children: [
|
|
5862
|
-
section.label && /* @__PURE__ */ (0,
|
|
5863
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
section.label && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5864
5924
|
"div",
|
|
5865
5925
|
{
|
|
5866
5926
|
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5867
|
-
children: cols.map((col) => /* @__PURE__ */ (0,
|
|
5927
|
+
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5868
5928
|
"div",
|
|
5869
5929
|
{
|
|
5870
5930
|
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5871
5931
|
children: [
|
|
5872
|
-
/* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-label", children: col.label }),
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5874
5934
|
]
|
|
5875
5935
|
},
|
|
5876
5936
|
col.key
|
|
@@ -5882,9 +5942,9 @@ function TableCards({
|
|
|
5882
5942
|
section.key || index
|
|
5883
5943
|
) : null;
|
|
5884
5944
|
}),
|
|
5885
|
-
expandable && /* @__PURE__ */ (0,
|
|
5886
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0,
|
|
5887
|
-
actions && !actions.inlineInCard && /* @__PURE__ */ (0,
|
|
5945
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
5946
|
+
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-expand-content", children: renderExpand == null ? void 0 : renderExpand(row, i) }),
|
|
5947
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5888
5948
|
"div",
|
|
5889
5949
|
{
|
|
5890
5950
|
className: "kjun-table-card-actions",
|
|
@@ -5896,16 +5956,16 @@ function TableCards({
|
|
|
5896
5956
|
},
|
|
5897
5957
|
state.key(row, i)
|
|
5898
5958
|
)),
|
|
5899
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ (0,
|
|
5959
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5900
5960
|
]
|
|
5901
5961
|
}
|
|
5902
5962
|
);
|
|
5903
5963
|
}
|
|
5904
5964
|
|
|
5905
5965
|
// packages/react/src/table-view.tsx
|
|
5906
|
-
var
|
|
5966
|
+
var import_react46 = require("react");
|
|
5907
5967
|
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5908
|
-
var
|
|
5968
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5909
5969
|
function KjunTable(props) {
|
|
5910
5970
|
const {
|
|
5911
5971
|
skeletonRows = 8,
|
|
@@ -5933,8 +5993,8 @@ function KjunTable(props) {
|
|
|
5933
5993
|
onRowClick,
|
|
5934
5994
|
onRetry
|
|
5935
5995
|
} = props;
|
|
5936
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
5937
|
-
(0,
|
|
5996
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react46.useState)(false);
|
|
5997
|
+
(0, import_react46.useEffect)(() => {
|
|
5938
5998
|
const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
|
|
5939
5999
|
const update = () => setMobile(media.matches);
|
|
5940
6000
|
update();
|
|
@@ -5945,7 +6005,7 @@ function KjunTable(props) {
|
|
|
5945
6005
|
const { card, visible } = layout;
|
|
5946
6006
|
const cell = (col, row, index) => {
|
|
5947
6007
|
const { value, body } = tableCellValue(props, col, row, index);
|
|
5948
|
-
return col.pill ? /* @__PURE__ */ (0,
|
|
6008
|
+
return col.pill ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5949
6009
|
"span",
|
|
5950
6010
|
{
|
|
5951
6011
|
className: "kjun-table-pill " + (Number(value) > 0 ? "kjun-table-pill-up" : Number(value) < 0 ? "kjun-table-pill-down" : ""),
|
|
@@ -5961,7 +6021,7 @@ function KjunTable(props) {
|
|
|
5961
6021
|
onRowClick(row, index);
|
|
5962
6022
|
}
|
|
5963
6023
|
};
|
|
5964
|
-
const checkbox = (row, i) => /* @__PURE__ */ (0,
|
|
6024
|
+
const checkbox = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5965
6025
|
TableCheck,
|
|
5966
6026
|
{
|
|
5967
6027
|
"aria-label": `\uD589 \uC120\uD0DD ${i + 1}`,
|
|
@@ -5970,7 +6030,7 @@ function KjunTable(props) {
|
|
|
5970
6030
|
onChange: () => state.toggleRow(row)
|
|
5971
6031
|
}
|
|
5972
6032
|
);
|
|
5973
|
-
const expand = (row, i) => /* @__PURE__ */ (0,
|
|
6033
|
+
const expand = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5974
6034
|
KjunButton,
|
|
5975
6035
|
{
|
|
5976
6036
|
variant: "ghost",
|
|
@@ -5982,14 +6042,14 @@ function KjunTable(props) {
|
|
|
5982
6042
|
children: card ? state.expanded.includes(state.key(row, i)) ? "\uC811\uAE30" : "\uC0C1\uC138 \uBCF4\uAE30" : void 0
|
|
5983
6043
|
}
|
|
5984
6044
|
);
|
|
5985
|
-
return /* @__PURE__ */ (0,
|
|
6045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
5986
6046
|
"div",
|
|
5987
6047
|
{
|
|
5988
6048
|
className: "kjun-table-state",
|
|
5989
6049
|
"aria-busy": !!props.loading,
|
|
5990
6050
|
ref: domainColorRef(!query2.initialLoading && state.rows.length > 0 && props.columns.some((column) => column.pill)),
|
|
5991
6051
|
children: [
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5993
6053
|
TableToolbar,
|
|
5994
6054
|
{
|
|
5995
6055
|
...{ selectable, selected, renderSelectionToolbar, searchable, searchPlaceholder, toolbar },
|
|
@@ -6002,7 +6062,7 @@ function KjunTable(props) {
|
|
|
6002
6062
|
searchChange: state.searchChange
|
|
6003
6063
|
}
|
|
6004
6064
|
),
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6065
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6006
6066
|
KjunDataState,
|
|
6007
6067
|
{
|
|
6008
6068
|
queryKey: props.queryKey,
|
|
@@ -6016,8 +6076,8 @@ function KjunTable(props) {
|
|
|
6016
6076
|
loadingText,
|
|
6017
6077
|
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
6018
6078
|
children: [
|
|
6019
|
-
card ? /* @__PURE__ */ (0,
|
|
6020
|
-
pagination && /* @__PURE__ */ (0,
|
|
6079
|
+
card ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown } }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown }, sortable: props.sortable }),
|
|
6080
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6021
6081
|
KjunPagination,
|
|
6022
6082
|
{
|
|
6023
6083
|
currentPage: pagination.page,
|
|
@@ -6040,7 +6100,7 @@ function KjunTable(props) {
|
|
|
6040
6100
|
|
|
6041
6101
|
// packages/react/src/kpi.tsx
|
|
6042
6102
|
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6043
|
-
var
|
|
6103
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6044
6104
|
var kpiFormat = (item, value = item.value) => {
|
|
6045
6105
|
var _a, _b;
|
|
6046
6106
|
return typeof value === "string" ? value : item.formatter ? item.formatter(value) : (item.showSign && value > 0 ? "+" : item.semantic === "price" && value < 0 ? "\u2212" : "") + new Intl.NumberFormat(void 0, {
|
|
@@ -6072,16 +6132,16 @@ function KjunKpiHero(props) {
|
|
|
6072
6132
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6073
6133
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6074
6134
|
);
|
|
6075
|
-
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ (0,
|
|
6135
|
+
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6076
6136
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6077
|
-
kind === "absolute" && prefix && /* @__PURE__ */ (0,
|
|
6137
|
+
kind === "absolute" && prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
6078
6138
|
new Intl.NumberFormat(void 0, {
|
|
6079
6139
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
6080
6140
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
6081
6141
|
}).format(Math.abs(v)),
|
|
6082
|
-
kind === "percent" && /* @__PURE__ */ (0,
|
|
6142
|
+
kind === "percent" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-number-affix", "data-side": "suffix", children: "%" })
|
|
6083
6143
|
] });
|
|
6084
|
-
return /* @__PURE__ */ (0,
|
|
6144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6085
6145
|
"div",
|
|
6086
6146
|
{
|
|
6087
6147
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
@@ -6089,12 +6149,12 @@ function KjunKpiHero(props) {
|
|
|
6089
6149
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
6090
6150
|
"aria-busy": loading,
|
|
6091
6151
|
children: [
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
/* @__PURE__ */ (0,
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
prefix && /* @__PURE__ */ (0,
|
|
6097
|
-
/* @__PURE__ */ (0,
|
|
6152
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-hero__layout", children: [
|
|
6153
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-hero__main", children: [
|
|
6154
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__label", children: label }),
|
|
6155
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6156
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
6157
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6098
6158
|
KjunAnimatedNumber,
|
|
6099
6159
|
{
|
|
6100
6160
|
value,
|
|
@@ -6103,13 +6163,13 @@ function KjunKpiHero(props) {
|
|
|
6103
6163
|
formatter
|
|
6104
6164
|
}
|
|
6105
6165
|
),
|
|
6106
|
-
suffix && /* @__PURE__ */ (0,
|
|
6166
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__affix", children: suffix })
|
|
6107
6167
|
] }) }),
|
|
6108
|
-
showDelta && /* @__PURE__ */ (0,
|
|
6168
|
+
showDelta && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6109
6169
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6110
|
-
/* @__PURE__ */ (0,
|
|
6111
|
-
) : /* @__PURE__ */ (0,
|
|
6112
|
-
deltaAbsolute !== null && /* @__PURE__ */ (0,
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: import_tokens38.tokens.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
6171
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6172
|
+
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6113
6173
|
"span",
|
|
6114
6174
|
{
|
|
6115
6175
|
className: "kjun-kpi-hero__delta-abs",
|
|
@@ -6123,7 +6183,7 @@ function KjunKpiHero(props) {
|
|
|
6123
6183
|
children: delta(deltaAbsolute, "absolute")
|
|
6124
6184
|
}
|
|
6125
6185
|
),
|
|
6126
|
-
deltaPercent !== null && /* @__PURE__ */ (0,
|
|
6186
|
+
deltaPercent !== null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6127
6187
|
"span",
|
|
6128
6188
|
{
|
|
6129
6189
|
className: "kjun-kpi-hero__delta-pct",
|
|
@@ -6133,31 +6193,31 @@ function KjunKpiHero(props) {
|
|
|
6133
6193
|
children: delta(deltaPercent, "percent")
|
|
6134
6194
|
}
|
|
6135
6195
|
),
|
|
6136
|
-
deltaDescription && /* @__PURE__ */ (0,
|
|
6196
|
+
deltaDescription && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__delta-desc", children: deltaDescription })
|
|
6137
6197
|
] }) })
|
|
6138
6198
|
] }),
|
|
6139
|
-
aside && /* @__PURE__ */ (0,
|
|
6199
|
+
aside && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__aside", children: aside })
|
|
6140
6200
|
] }),
|
|
6141
|
-
secondary.length > 0 && /* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6201
|
+
secondary.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__secondary", children: secondary.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-hero__sec-item", children: [
|
|
6202
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__sec-label", children: item.label }),
|
|
6203
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6144
6204
|
"div",
|
|
6145
6205
|
{
|
|
6146
6206
|
className: "kjun-kpi-hero__sec-value",
|
|
6147
6207
|
style: { color: kpiColor(item.value, item.semantic) },
|
|
6148
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
6149
|
-
item.prefix && /* @__PURE__ */ (0,
|
|
6150
|
-
/* @__PURE__ */ (0,
|
|
6151
|
-
item.suffix && /* @__PURE__ */ (0,
|
|
6208
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderSecondary == null ? void 0 : renderSecondary(item, i)) || /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6209
|
+
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
6210
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: kpiFormat(item) }),
|
|
6211
|
+
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
6152
6212
|
] })
|
|
6153
6213
|
}
|
|
6154
6214
|
),
|
|
6155
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6215
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6156
6216
|
"div",
|
|
6157
6217
|
{
|
|
6158
6218
|
className: "kjun-kpi-hero__sec-desc " + (item.descClass || ""),
|
|
6159
6219
|
style: { color: "var(--_kjun-color-text-tertiary)" },
|
|
6160
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
6220
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", width: "7ch", height: "1lh" }) : item.desc
|
|
6161
6221
|
}
|
|
6162
6222
|
)
|
|
6163
6223
|
] }, i)) })
|
|
@@ -6187,7 +6247,7 @@ function KjunKpiRow({
|
|
|
6187
6247
|
const v = item.badge.variant || "neutral", dot = ["warning", "success", "danger", "price-up", "price-down"].includes(
|
|
6188
6248
|
v
|
|
6189
6249
|
), role2 = v === "neutral" ? "text-secondary" : v === "info" ? "brand" : v;
|
|
6190
|
-
return /* @__PURE__ */ (0,
|
|
6250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6191
6251
|
"span",
|
|
6192
6252
|
{
|
|
6193
6253
|
className: "kjun-kpi-row__badge",
|
|
@@ -6196,7 +6256,7 @@ function KjunKpiRow({
|
|
|
6196
6256
|
background: `var(--_kjun-color-${v === "neutral" ? "secondary" : v === "info" ? "info-bg" : v + "-bg"})`
|
|
6197
6257
|
},
|
|
6198
6258
|
children: [
|
|
6199
|
-
dot && /* @__PURE__ */ (0,
|
|
6259
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6200
6260
|
"span",
|
|
6201
6261
|
{
|
|
6202
6262
|
className: "kjun-kpi-row__badge-dot",
|
|
@@ -6208,7 +6268,7 @@ function KjunKpiRow({
|
|
|
6208
6268
|
}
|
|
6209
6269
|
);
|
|
6210
6270
|
};
|
|
6211
|
-
return /* @__PURE__ */ (0,
|
|
6271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6212
6272
|
"div",
|
|
6213
6273
|
{
|
|
6214
6274
|
className: "kjun-kpi-row" + (size === "sm" ? " kjun-kpi-row--sm" : "") + (((_a = items[0]) == null ? void 0 : _a.mobileFull) ? " kjun-kpi-row--hero-first" : "") + (mobileSummary && size !== "sm" ? " kjun-kpi-row--mobile-summary" : ""),
|
|
@@ -6223,7 +6283,7 @@ function KjunKpiRow({
|
|
|
6223
6283
|
const busy = loading || !!item.loading, click = () => {
|
|
6224
6284
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6225
6285
|
};
|
|
6226
|
-
return /* @__PURE__ */ (0,
|
|
6286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6227
6287
|
"div",
|
|
6228
6288
|
{
|
|
6229
6289
|
role: item.clickable ? "button" : void 0,
|
|
@@ -6238,12 +6298,12 @@ function KjunKpiRow({
|
|
|
6238
6298
|
}
|
|
6239
6299
|
},
|
|
6240
6300
|
children: [
|
|
6241
|
-
/* @__PURE__ */ (0,
|
|
6242
|
-
/* @__PURE__ */ (0,
|
|
6301
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", width: import_tokens38.tokens.extensions.kpiRow.labelSkeletonWidth, height: import_tokens38.tokens.extensions.kpiRow.labelSkeletonHeight }) : item.label }),
|
|
6243
6303
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6244
6304
|
] }),
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
/* @__PURE__ */ (0,
|
|
6305
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
6306
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6247
6307
|
"div",
|
|
6248
6308
|
{
|
|
6249
6309
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
@@ -6251,19 +6311,19 @@ function KjunKpiRow({
|
|
|
6251
6311
|
style: {
|
|
6252
6312
|
color: item.valueClass ? void 0 : kpiColor(item.value, item.semantic)
|
|
6253
6313
|
},
|
|
6254
|
-
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0,
|
|
6314
|
+
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6255
6315
|
"span",
|
|
6256
6316
|
{
|
|
6257
6317
|
className: (seg.class || "") + (seg.label ? " kjun-kpi-row__segment--labeled" : "") + (seg.separator ? " kjun-kpi-row__segment--separator" : ""),
|
|
6258
6318
|
children: [
|
|
6259
|
-
seg.label && /* @__PURE__ */ (0,
|
|
6260
|
-
busy && !seg.separator ? /* @__PURE__ */ (0,
|
|
6319
|
+
seg.label && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__segment-label", children: seg.label }),
|
|
6320
|
+
busy && !seg.separator ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "3ch" }) : seg.text
|
|
6261
6321
|
]
|
|
6262
6322
|
},
|
|
6263
6323
|
j
|
|
6264
|
-
)) : busy ? /* @__PURE__ */ (0,
|
|
6265
|
-
item.prefix && /* @__PURE__ */ (0,
|
|
6266
|
-
item.animated && typeof item.value === "number" ? /* @__PURE__ */ (0,
|
|
6324
|
+
)) : busy ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "5ch" }) : (renderValue == null ? void 0 : renderValue(item, i)) || /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6325
|
+
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6326
|
+
item.animated && typeof item.value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6267
6327
|
KjunAnimatedNumber,
|
|
6268
6328
|
{
|
|
6269
6329
|
fromPrevious: true,
|
|
@@ -6271,20 +6331,20 @@ function KjunKpiRow({
|
|
|
6271
6331
|
formatter: (v) => kpiFormat(item, v)
|
|
6272
6332
|
}
|
|
6273
6333
|
) : kpiFormat(item),
|
|
6274
|
-
item.suffix && /* @__PURE__ */ (0,
|
|
6334
|
+
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6275
6335
|
] })
|
|
6276
6336
|
}
|
|
6277
6337
|
),
|
|
6278
6338
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
6279
6339
|
] }),
|
|
6280
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6340
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6281
6341
|
"div",
|
|
6282
6342
|
{
|
|
6283
6343
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6284
6344
|
style: {
|
|
6285
6345
|
color: item.descClass ? void 0 : kpiColor(item.value, item.semantic, "text-secondary")
|
|
6286
6346
|
},
|
|
6287
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
6347
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6288
6348
|
}
|
|
6289
6349
|
)
|
|
6290
6350
|
]
|
|
@@ -6300,7 +6360,7 @@ function KjunKpiRow({
|
|
|
6300
6360
|
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6301
6361
|
|
|
6302
6362
|
// shared/package-runtime/market-cards.ts
|
|
6303
|
-
var
|
|
6363
|
+
var import_react47 = require("react");
|
|
6304
6364
|
function useMarketCardsModel(props, persistence) {
|
|
6305
6365
|
const {
|
|
6306
6366
|
columns,
|
|
@@ -6316,8 +6376,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6316
6376
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6317
6377
|
isDefaultSort: c.defaultSort
|
|
6318
6378
|
}));
|
|
6319
|
-
const [key, setKey] = (0,
|
|
6320
|
-
const mounted = (0,
|
|
6379
|
+
const [key, setKey] = (0, import_react47.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6380
|
+
const mounted = (0, import_react47.useRef)("");
|
|
6321
6381
|
const save = (key2) => {
|
|
6322
6382
|
var _a;
|
|
6323
6383
|
try {
|
|
@@ -6325,7 +6385,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6325
6385
|
} catch (e) {
|
|
6326
6386
|
}
|
|
6327
6387
|
};
|
|
6328
|
-
(0,
|
|
6388
|
+
(0, import_react47.useEffect)(() => {
|
|
6329
6389
|
var _a, _b;
|
|
6330
6390
|
if (mounted.current === restoreSignature) return;
|
|
6331
6391
|
mounted.current = restoreSignature;
|
|
@@ -6362,26 +6422,26 @@ function useMarketCards(props) {
|
|
|
6362
6422
|
}
|
|
6363
6423
|
|
|
6364
6424
|
// packages/react/src/market-parts.tsx
|
|
6365
|
-
var
|
|
6425
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6366
6426
|
function MarketIdentity({
|
|
6367
6427
|
row,
|
|
6368
6428
|
props
|
|
6369
6429
|
}) {
|
|
6370
6430
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6371
6431
|
const label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
6372
|
-
const body = /* @__PURE__ */ (0,
|
|
6432
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6373
6433
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
6374
|
-
/* @__PURE__ */ (0,
|
|
6375
|
-
/* @__PURE__ */ (0,
|
|
6376
|
-
/* @__PURE__ */ (0,
|
|
6377
|
-
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */ (0,
|
|
6378
|
-
((_g = props.favoriteKeys) == null ? void 0 : _g.has(id)) && /* @__PURE__ */ (0,
|
|
6434
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-identity-text", children: [
|
|
6435
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-name", children: [
|
|
6436
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { title: label, children: label }),
|
|
6437
|
+
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunCollectionMark, { kind: "interest", size: "sm", active: true }),
|
|
6438
|
+
((_g = props.favoriteKeys) == null ? void 0 : _g.has(id)) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunCollectionMark, { kind: "favorite", size: "sm", active: true }),
|
|
6379
6439
|
(_h = props.renderNameSuffix) == null ? void 0 : _h.call(props, row)
|
|
6380
6440
|
] }),
|
|
6381
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ (0,
|
|
6441
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-market-meta", children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || meta })
|
|
6382
6442
|
] })
|
|
6383
6443
|
] });
|
|
6384
|
-
return /* @__PURE__ */ (0,
|
|
6444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "kjun-market-identity", children: ((_j = props.renderIdentity) == null ? void 0 : _j.call(props, row, body)) || body });
|
|
6385
6445
|
}
|
|
6386
6446
|
function MarketFooter({
|
|
6387
6447
|
props
|
|
@@ -6396,8 +6456,8 @@ function MarketFooter({
|
|
|
6396
6456
|
totalCount = 0,
|
|
6397
6457
|
unitLabel = "\uAC1C"
|
|
6398
6458
|
} = props;
|
|
6399
|
-
return /* @__PURE__ */ (0,
|
|
6400
|
-
pagination && /* @__PURE__ */ (0,
|
|
6459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6460
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6401
6461
|
KjunPagination,
|
|
6402
6462
|
{
|
|
6403
6463
|
currentPage: pagination.page,
|
|
@@ -6409,9 +6469,9 @@ function MarketFooter({
|
|
|
6409
6469
|
}
|
|
6410
6470
|
),
|
|
6411
6471
|
" ",
|
|
6412
|
-
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ (0,
|
|
6413
|
-
/* @__PURE__ */ (0,
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
6472
|
+
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-footer", children: [
|
|
6473
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: calculatedAt ? "\uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8: " + (((_a = props.formatDate) == null ? void 0 : _a.call(props, calculatedAt)) || calculatedAt) : footerNote }),
|
|
6474
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
|
|
6415
6475
|
"\uCD1D ",
|
|
6416
6476
|
totalCount,
|
|
6417
6477
|
unitLabel
|
|
@@ -6421,7 +6481,7 @@ function MarketFooter({
|
|
|
6421
6481
|
}
|
|
6422
6482
|
|
|
6423
6483
|
// packages/react/src/market-cards.tsx
|
|
6424
|
-
var
|
|
6484
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6425
6485
|
function KjunMarketCards(props) {
|
|
6426
6486
|
const {
|
|
6427
6487
|
rows = [],
|
|
@@ -6446,8 +6506,8 @@ function KjunMarketCards(props) {
|
|
|
6446
6506
|
column: props.columns.find((c) => c.key === state.key)
|
|
6447
6507
|
}) : value == null ? "-" : String(value);
|
|
6448
6508
|
};
|
|
6449
|
-
return /* @__PURE__ */ (0,
|
|
6450
|
-
/* @__PURE__ */ (0,
|
|
6509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "kjun-market-cards", children: [
|
|
6510
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "kjun-metric-pills", role: "group", "aria-label": "\uD45C\uC2DC \uC9C0\uD45C", children: state.pills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6451
6511
|
"button",
|
|
6452
6512
|
{
|
|
6453
6513
|
type: "button",
|
|
@@ -6462,7 +6522,7 @@ function KjunMarketCards(props) {
|
|
|
6462
6522
|
},
|
|
6463
6523
|
children: [
|
|
6464
6524
|
pill.label,
|
|
6465
|
-
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */ (0,
|
|
6525
|
+
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: sortOrder === "desc" ? "\u2193" : "\u2191" })
|
|
6466
6526
|
]
|
|
6467
6527
|
},
|
|
6468
6528
|
pill.key
|
|
@@ -6471,20 +6531,20 @@ function KjunMarketCards(props) {
|
|
|
6471
6531
|
selectedKey: state.key,
|
|
6472
6532
|
selectedPill: state.pill,
|
|
6473
6533
|
metricDisplay: display
|
|
6474
|
-
}) : /* @__PURE__ */ (0,
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
6534
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6535
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6476
6536
|
KjunDataState,
|
|
6477
6537
|
{
|
|
6478
6538
|
...props,
|
|
6479
6539
|
loadingPadding: "none",
|
|
6480
6540
|
empty: !rows.length,
|
|
6481
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6482
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6483
|
-
children: /* @__PURE__ */ (0,
|
|
6484
|
-
state.pill && /* @__PURE__ */ (0,
|
|
6541
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
6542
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
6544
|
+
state.pill && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
6485
6545
|
rows.map((row, i) => {
|
|
6486
6546
|
var _a, _b, _c;
|
|
6487
|
-
return /* @__PURE__ */ (0,
|
|
6547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6488
6548
|
"div",
|
|
6489
6549
|
{
|
|
6490
6550
|
className: "kjun-market-row kjun-market-row-compact",
|
|
@@ -6502,15 +6562,15 @@ function KjunMarketCards(props) {
|
|
|
6502
6562
|
}
|
|
6503
6563
|
},
|
|
6504
6564
|
children: [
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
6506
|
-
/* @__PURE__ */ (0,
|
|
6565
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarketIdentity, { row, props }),
|
|
6566
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "kjun-market-quote", children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6507
6567
|
KjunSparkline,
|
|
6508
6568
|
{
|
|
6509
6569
|
data: getValue(row, state.key) || [],
|
|
6510
6570
|
width: import_tokens39.tokens.extensions.marketTable.sparklineWidth,
|
|
6511
6571
|
height: import_tokens39.tokens.extensions.marketTable.sparklineHeight
|
|
6512
6572
|
}
|
|
6513
|
-
) : state.pill ? /* @__PURE__ */ (0,
|
|
6573
|
+
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunSkeleton, { type: "block", height: import_tokens39.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens39.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6514
6574
|
KjunSignedValue,
|
|
6515
6575
|
{
|
|
6516
6576
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6518,7 +6578,7 @@ function KjunMarketCards(props) {
|
|
|
6518
6578
|
stale: !!getValue(row, "stale"),
|
|
6519
6579
|
tone: "pill"
|
|
6520
6580
|
}
|
|
6521
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0,
|
|
6581
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunSkeleton, { type: "block", height: import_tokens39.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens39.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "kjun-market-metric", children: [
|
|
6522
6582
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6523
6583
|
props,
|
|
6524
6584
|
row,
|
|
@@ -6535,14 +6595,14 @@ function KjunMarketCards(props) {
|
|
|
6535
6595
|
] })
|
|
6536
6596
|
}
|
|
6537
6597
|
),
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6598
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarketFooter, { props })
|
|
6539
6599
|
] })
|
|
6540
6600
|
] });
|
|
6541
6601
|
}
|
|
6542
6602
|
|
|
6543
6603
|
// packages/react/src/market-list.tsx
|
|
6544
6604
|
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6545
|
-
var
|
|
6605
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6546
6606
|
function KjunMarketSimpleList(props) {
|
|
6547
6607
|
const {
|
|
6548
6608
|
rows = [],
|
|
@@ -6555,20 +6615,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6555
6615
|
emptyMessage = "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
6556
6616
|
emptySubMessage = ""
|
|
6557
6617
|
} = props;
|
|
6558
|
-
return /* @__PURE__ */ (0,
|
|
6559
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-simple-list", children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6560
6620
|
KjunDataState,
|
|
6561
6621
|
{
|
|
6562
6622
|
...props,
|
|
6563
6623
|
loadingPadding: "none",
|
|
6564
6624
|
empty: !rows.length,
|
|
6565
6625
|
emptyText: emptyMessage,
|
|
6566
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6567
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6568
|
-
children: /* @__PURE__ */ (0,
|
|
6626
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunListSkeleton, {}),
|
|
6627
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: rows.map((row, i) => {
|
|
6569
6629
|
var _a, _b;
|
|
6570
6630
|
const price = priceValue(row), change = changeValue(row), stale = !!getValue(row, "stale"), source = String(getValue(row, "source") || ""), fetchedAt = String(getValue(row, "fetched_at") || "");
|
|
6571
|
-
return /* @__PURE__ */ (0,
|
|
6631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6572
6632
|
"div",
|
|
6573
6633
|
{
|
|
6574
6634
|
className: "kjun-market-row",
|
|
@@ -6586,9 +6646,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6586
6646
|
}
|
|
6587
6647
|
},
|
|
6588
6648
|
children: [
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6649
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarketIdentity, { row, props }),
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-quote", children: [
|
|
6651
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "kjun-market-price", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6592
6652
|
KjunPriceCell,
|
|
6593
6653
|
{
|
|
6594
6654
|
value: price,
|
|
@@ -6597,9 +6657,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6597
6657
|
showFreshness: false
|
|
6598
6658
|
}
|
|
6599
6659
|
) }),
|
|
6600
|
-
/* @__PURE__ */ (0,
|
|
6660
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-change", children: [
|
|
6601
6661
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
6602
|
-
(finiteNumber(price) !== null || !changeLoading(row) && finiteNumber(change) !== null) && (closingPrice && !stale ? /* @__PURE__ */ (0,
|
|
6662
|
+
(finiteNumber(price) !== null || !changeLoading(row) && finiteNumber(change) !== null) && (closingPrice && !stale ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunBadge, { variant: "secondary", size: "xs", children: "\uC885\uAC00" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6603
6663
|
KjunFreshness,
|
|
6604
6664
|
{
|
|
6605
6665
|
stale,
|
|
@@ -6607,7 +6667,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6607
6667
|
fetchedAt
|
|
6608
6668
|
}
|
|
6609
6669
|
)),
|
|
6610
|
-
changeLoading(row) ? /* @__PURE__ */ (0,
|
|
6670
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: "block", height: import_tokens40.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens40.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6611
6671
|
KjunSignedValue,
|
|
6612
6672
|
{
|
|
6613
6673
|
value: change,
|
|
@@ -6616,7 +6676,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6616
6676
|
format: "percent",
|
|
6617
6677
|
isRaw: true
|
|
6618
6678
|
}
|
|
6619
|
-
) : /* @__PURE__ */ (0,
|
|
6679
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "-" })
|
|
6620
6680
|
] })
|
|
6621
6681
|
] })
|
|
6622
6682
|
]
|
|
@@ -6626,20 +6686,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6626
6686
|
}) })
|
|
6627
6687
|
}
|
|
6628
6688
|
),
|
|
6629
|
-
/* @__PURE__ */ (0,
|
|
6689
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarketFooter, { props })
|
|
6630
6690
|
] });
|
|
6631
6691
|
}
|
|
6632
6692
|
|
|
6633
6693
|
// packages/react/src/market-panel.tsx
|
|
6634
6694
|
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6635
|
-
var
|
|
6695
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6636
6696
|
function KjunMarketListPanel({
|
|
6637
6697
|
controls,
|
|
6638
6698
|
children
|
|
6639
6699
|
}) {
|
|
6640
|
-
return /* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6642
|
-
/* @__PURE__ */ (0,
|
|
6700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(KjunCard, { children: [
|
|
6701
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: controls }),
|
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { style: { marginTop: import_tokens41.tokens.dimension.value16, borderTop: `${import_tokens41.tokens.border.defaultWidth}px solid var(--_kjun-color-border)` }, children })
|
|
6643
6703
|
] });
|
|
6644
6704
|
}
|
|
6645
6705
|
|
|
@@ -6661,8 +6721,8 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6661
6721
|
}
|
|
6662
6722
|
|
|
6663
6723
|
// packages/react/src/market-table.tsx
|
|
6664
|
-
var
|
|
6665
|
-
var
|
|
6724
|
+
var import_react48 = require("react");
|
|
6725
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6666
6726
|
function KjunMarketTable(props) {
|
|
6667
6727
|
const {
|
|
6668
6728
|
rows = [],
|
|
@@ -6682,17 +6742,17 @@ function KjunMarketTable(props) {
|
|
|
6682
6742
|
formatMetric,
|
|
6683
6743
|
renderCell
|
|
6684
6744
|
} = props;
|
|
6685
|
-
const scroller = (0,
|
|
6686
|
-
(0,
|
|
6745
|
+
const scroller = (0, import_react48.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react48.useState)(false);
|
|
6746
|
+
(0, import_react48.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6687
6747
|
const render = (row, col) => {
|
|
6688
6748
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6689
6749
|
if (cellLoading(row, col))
|
|
6690
|
-
return /* @__PURE__ */ (0,
|
|
6750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens42.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens42.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
6691
6751
|
if (renderCell) return renderCell(row, col);
|
|
6692
6752
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
6693
|
-
return /* @__PURE__ */ (0,
|
|
6753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketIdentity, { row, props });
|
|
6694
6754
|
if (col.type === "sparkline")
|
|
6695
|
-
return /* @__PURE__ */ (0,
|
|
6755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6696
6756
|
KjunSparkline,
|
|
6697
6757
|
{
|
|
6698
6758
|
data: Array.isArray(value) ? value : [],
|
|
@@ -6701,7 +6761,7 @@ function KjunMarketTable(props) {
|
|
|
6701
6761
|
}
|
|
6702
6762
|
);
|
|
6703
6763
|
if (col.type === "price")
|
|
6704
|
-
return /* @__PURE__ */ (0,
|
|
6764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6705
6765
|
KjunPriceCell,
|
|
6706
6766
|
{
|
|
6707
6767
|
value: finiteNumber(value),
|
|
@@ -6711,7 +6771,7 @@ function KjunMarketTable(props) {
|
|
|
6711
6771
|
}
|
|
6712
6772
|
);
|
|
6713
6773
|
if (col.type === "percent")
|
|
6714
|
-
return value == null ? "-" : /* @__PURE__ */ (0,
|
|
6774
|
+
return value == null ? "-" : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6715
6775
|
KjunSignedValue,
|
|
6716
6776
|
{
|
|
6717
6777
|
value: finiteNumber(value),
|
|
@@ -6727,7 +6787,7 @@ function KjunMarketTable(props) {
|
|
|
6727
6787
|
}
|
|
6728
6788
|
);
|
|
6729
6789
|
const text = formatMetric ? formatMetric(value, col.type || "text", { currency, row, column: col }) : value == null ? "-" : String(value);
|
|
6730
|
-
return ["investor", "net_amount", "net_volume"].includes(col.type || "") ? /* @__PURE__ */ (0,
|
|
6790
|
+
return ["investor", "net_amount", "net_volume"].includes(col.type || "") ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6731
6791
|
KjunSignedValue,
|
|
6732
6792
|
{
|
|
6733
6793
|
value: finiteNumber(value),
|
|
@@ -6737,35 +6797,35 @@ function KjunMarketTable(props) {
|
|
|
6737
6797
|
}
|
|
6738
6798
|
) : text;
|
|
6739
6799
|
};
|
|
6740
|
-
return /* @__PURE__ */ (0,
|
|
6800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6741
6801
|
"div",
|
|
6742
6802
|
{
|
|
6743
6803
|
className: "kjun-market-table",
|
|
6744
6804
|
"data-embedded": embedded,
|
|
6745
6805
|
ref: domainColorRef(showActions && rows.length > 0 && !props.loading),
|
|
6746
6806
|
children: [
|
|
6747
|
-
/* @__PURE__ */ (0,
|
|
6807
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6748
6808
|
KjunDataState,
|
|
6749
6809
|
{
|
|
6750
6810
|
...props,
|
|
6751
6811
|
loadingPadding: "none",
|
|
6752
6812
|
empty: !rows.length,
|
|
6753
6813
|
emptyText: emptyMessage,
|
|
6754
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6755
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6756
|
-
children: /* @__PURE__ */ (0,
|
|
6757
|
-
/* @__PURE__ */ (0,
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
6759
|
-
showActions && /* @__PURE__ */ (0,
|
|
6760
|
-
/* @__PURE__ */ (0,
|
|
6761
|
-
/* @__PURE__ */ (0,
|
|
6814
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6815
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "kjun-table-scroll", ref: scroller, "data-fade-end": fadeEnd || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("table", { "aria-label": "\uC2DC\uC7A5 \uB370\uC774\uD130", className: "kjun-market-table-grid", style: webMarketLayout(columns, showActions).tableStyle, children: [
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketColumns, { columns, showActions }),
|
|
6818
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { children: [
|
|
6819
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("th", { className: "kjun-market-actions", children: [
|
|
6820
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "kjun-market-actions-mark", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunCollectionMark, { kind: "interest", size: "md" }) }),
|
|
6821
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "kjun-market-actions-mark", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunCollectionMark, { kind: "favorite", size: "md" }) })
|
|
6762
6822
|
] }),
|
|
6763
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6823
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6764
6824
|
"th",
|
|
6765
6825
|
{
|
|
6766
6826
|
style: { textAlign: col.align },
|
|
6767
6827
|
"aria-sort": col.sortable ? sortKey === col.key ? sortOrder === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
6768
|
-
children: col.sortable ? /* @__PURE__ */ (0,
|
|
6828
|
+
children: col.sortable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6769
6829
|
"button",
|
|
6770
6830
|
{
|
|
6771
6831
|
type: "button",
|
|
@@ -6775,7 +6835,7 @@ function KjunMarketTable(props) {
|
|
|
6775
6835
|
},
|
|
6776
6836
|
children: [
|
|
6777
6837
|
col.label,
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6838
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6779
6839
|
KjunIcon,
|
|
6780
6840
|
{
|
|
6781
6841
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
@@ -6789,12 +6849,12 @@ function KjunMarketTable(props) {
|
|
|
6789
6849
|
col.key
|
|
6790
6850
|
))
|
|
6791
6851
|
] }) }),
|
|
6792
|
-
/* @__PURE__ */ (0,
|
|
6852
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, i) => {
|
|
6793
6853
|
var _a, _b, _c, _d, _e, _f;
|
|
6794
6854
|
const id = getValue(row, rowKey), priceCol = columns.find(
|
|
6795
6855
|
(c) => c.type === "price" && !cellLoading(row, c) && getValue(row, c.key) != null
|
|
6796
6856
|
);
|
|
6797
|
-
return /* @__PURE__ */ (0,
|
|
6857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6798
6858
|
"tr",
|
|
6799
6859
|
{
|
|
6800
6860
|
onClick: () => {
|
|
@@ -6802,8 +6862,8 @@ function KjunMarketTable(props) {
|
|
|
6802
6862
|
return (_a2 = props.onRowClick) == null ? void 0 : _a2.call(props, row);
|
|
6803
6863
|
},
|
|
6804
6864
|
children: [
|
|
6805
|
-
showActions && /* @__PURE__ */ (0,
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
6865
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("td", { className: "kjun-market-actions", children: [
|
|
6866
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6807
6867
|
KjunIconToggle,
|
|
6808
6868
|
{
|
|
6809
6869
|
size: "xs",
|
|
@@ -6822,7 +6882,7 @@ function KjunMarketTable(props) {
|
|
|
6822
6882
|
}
|
|
6823
6883
|
}
|
|
6824
6884
|
),
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6885
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6826
6886
|
KjunIconToggle,
|
|
6827
6887
|
{
|
|
6828
6888
|
size: "xs",
|
|
@@ -6842,7 +6902,7 @@ function KjunMarketTable(props) {
|
|
|
6842
6902
|
}
|
|
6843
6903
|
)
|
|
6844
6904
|
] }),
|
|
6845
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6905
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6846
6906
|
"td",
|
|
6847
6907
|
{
|
|
6848
6908
|
style: {
|
|
@@ -6851,7 +6911,7 @@ function KjunMarketTable(props) {
|
|
|
6851
6911
|
},
|
|
6852
6912
|
children: [
|
|
6853
6913
|
render(row, col),
|
|
6854
|
-
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */ (0,
|
|
6914
|
+
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6855
6915
|
KjunFreshness,
|
|
6856
6916
|
{
|
|
6857
6917
|
stale: !!getValue(row, "stale"),
|
|
@@ -6873,71 +6933,71 @@ function KjunMarketTable(props) {
|
|
|
6873
6933
|
] }) })
|
|
6874
6934
|
}
|
|
6875
6935
|
),
|
|
6876
|
-
/* @__PURE__ */ (0,
|
|
6936
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketFooter, { props })
|
|
6877
6937
|
]
|
|
6878
6938
|
}
|
|
6879
6939
|
);
|
|
6880
6940
|
}
|
|
6881
6941
|
|
|
6882
6942
|
// packages/react/src/list.tsx
|
|
6883
|
-
var
|
|
6884
|
-
var
|
|
6943
|
+
var import_react49 = require("react");
|
|
6944
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6885
6945
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
6886
|
-
const contents = /* @__PURE__ */ (0,
|
|
6887
|
-
leading && /* @__PURE__ */ (0,
|
|
6888
|
-
/* @__PURE__ */ (0,
|
|
6889
|
-
/* @__PURE__ */ (0,
|
|
6890
|
-
description && /* @__PURE__ */ (0,
|
|
6946
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6947
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-leading", children: leading }),
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "kjun-list-body", children: [
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
6950
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-description", children: description })
|
|
6891
6951
|
] }),
|
|
6892
|
-
trailing && /* @__PURE__ */ (0,
|
|
6952
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-trailing", children: trailing })
|
|
6893
6953
|
] });
|
|
6894
|
-
const main = href ? /* @__PURE__ */ (0,
|
|
6895
|
-
return /* @__PURE__ */ (0,
|
|
6954
|
+
const main = href ? /* @__PURE__ */ (0, import_jsx_runtime42.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_runtime42.jsx)("button", { className: "kjun-list-main", type: "button", disabled, onClick, children: contents }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "kjun-list-main", children: contents });
|
|
6955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("li", { className: "kjun-list-row", children: [
|
|
6896
6956
|
main,
|
|
6897
|
-
actions && /* @__PURE__ */ (0,
|
|
6957
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
6898
6958
|
] });
|
|
6899
6959
|
}
|
|
6900
6960
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
6901
|
-
const id = "kjun-" + (0,
|
|
6902
|
-
return /* @__PURE__ */ (0,
|
|
6903
|
-
(title || description || actions) && /* @__PURE__ */ (0,
|
|
6904
|
-
/* @__PURE__ */ (0,
|
|
6905
|
-
title && /* @__PURE__ */ (0,
|
|
6906
|
-
description && /* @__PURE__ */ (0,
|
|
6961
|
+
const id = "kjun-" + (0, import_react49.useId)();
|
|
6962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("section", { className: "kjun-list-section", "aria-labelledby": title ? id : void 0, "aria-label": title ? void 0 : ariaLabel, children: [
|
|
6963
|
+
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
6964
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6965
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { id, children: title }),
|
|
6966
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: description })
|
|
6907
6967
|
] }),
|
|
6908
6968
|
actions
|
|
6909
6969
|
] }),
|
|
6910
|
-
/* @__PURE__ */ (0,
|
|
6970
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: "kjun-list", "aria-label": ariaLabel || title, children })
|
|
6911
6971
|
] });
|
|
6912
6972
|
}
|
|
6913
6973
|
|
|
6914
6974
|
// packages/react/src/app-navigation.tsx
|
|
6915
6975
|
var import_tokens43 = require("@kjun-ui/tokens");
|
|
6916
|
-
var
|
|
6976
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6917
6977
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
6918
|
-
return /* @__PURE__ */ (0,
|
|
6919
|
-
leading && /* @__PURE__ */ (0,
|
|
6920
|
-
/* @__PURE__ */ (0,
|
|
6921
|
-
/* @__PURE__ */ (0,
|
|
6922
|
-
description && /* @__PURE__ */ (0,
|
|
6978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TopNavigationContext.Provider, { value: import_tokens43.tokens.extensions.topNavigation, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("header", { className: "kjun-top-navigation", style: { paddingTop: Math.max(0, safeAreaTop) }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-navigation-content", children: [
|
|
6979
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
6980
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
6981
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: title }),
|
|
6982
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description })
|
|
6923
6983
|
] }),
|
|
6924
|
-
actions && /* @__PURE__ */ (0,
|
|
6984
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-actions", children: actions })
|
|
6925
6985
|
] }) }) });
|
|
6926
6986
|
}
|
|
6927
6987
|
function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\uC0C9", safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
6928
6988
|
const hasIcons = items.some((item) => item.icon);
|
|
6929
6989
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6930
|
-
return /* @__PURE__ */ (0,
|
|
6931
|
-
const badge = item.badge != null && /* @__PURE__ */ (0,
|
|
6932
|
-
return /* @__PURE__ */ (0,
|
|
6990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("nav", { className: "kjun-bottom-navigation", "data-icons": hasIcons || void 0, "aria-label": ariaLabel, style: { paddingBottom: Math.max(0, safeAreaBottom) }, children: items.map((item) => {
|
|
6991
|
+
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
6992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("a", { href: item.disabled ? void 0 : item.href, "aria-label": item.label + (item.badge != null ? ", " + item.badge : ""), "aria-disabled": item.disabled || void 0, "aria-current": value === item.key ? "page" : void 0, onClick: (event) => {
|
|
6933
6993
|
if (item.disabled) event.preventDefault();
|
|
6934
6994
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
6935
6995
|
}, children: [
|
|
6936
|
-
hasIcons && /* @__PURE__ */ (0,
|
|
6937
|
-
item.icon && /* @__PURE__ */ (0,
|
|
6996
|
+
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
6997
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: item.icon, size: import_tokens43.tokens.extensions.bottomNavigation.iconSize }),
|
|
6938
6998
|
badge
|
|
6939
6999
|
] }),
|
|
6940
|
-
/* @__PURE__ */ (0,
|
|
7000
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
6941
7001
|
item.label,
|
|
6942
7002
|
!hasIcons && badge
|
|
6943
7003
|
] })
|
|
@@ -6946,25 +7006,25 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
6946
7006
|
}
|
|
6947
7007
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
6948
7008
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6949
|
-
return /* @__PURE__ */ (0,
|
|
6950
|
-
description && /* @__PURE__ */ (0,
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
7009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-bottom-action-bar", style: { paddingBottom: import_tokens43.tokens.extensions.navigation.padding + Math.max(0, safeAreaBottom) }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-bottom-action-content", children: [
|
|
7010
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description }),
|
|
7011
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
6952
7012
|
] }) });
|
|
6953
7013
|
}
|
|
6954
7014
|
|
|
6955
7015
|
// packages/react/src/media.tsx
|
|
6956
|
-
var
|
|
7016
|
+
var import_react50 = require("react");
|
|
6957
7017
|
var import_tokens44 = require("@kjun-ui/tokens");
|
|
6958
|
-
var
|
|
7018
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6959
7019
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6960
|
-
const current = (0,
|
|
7020
|
+
const current = (0, import_react50.useRef)({ src, version: 0 });
|
|
6961
7021
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6962
7022
|
const version = current.current.version;
|
|
6963
|
-
const [result, setResult] = (0,
|
|
7023
|
+
const [result, setResult] = (0, import_react50.useState)({ version, state: "loading" });
|
|
6964
7024
|
const state = result.version === version ? result.state : "loading";
|
|
6965
7025
|
const failed = !src || state === "error";
|
|
6966
|
-
return /* @__PURE__ */ (0,
|
|
6967
|
-
!failed && /* @__PURE__ */ (0,
|
|
7026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
7027
|
+
!failed && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("img", { src, alt: decorative ? "" : alt, loading: lazy ? "lazy" : "eager", style: { objectFit: fit }, onLoad: () => {
|
|
6968
7028
|
if (current.current.version !== version) return;
|
|
6969
7029
|
setResult({ version, state: "loaded" });
|
|
6970
7030
|
onLoad == null ? void 0 : onLoad();
|
|
@@ -6973,38 +7033,38 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
6973
7033
|
setResult({ version, state: "error" });
|
|
6974
7034
|
onError == null ? void 0 : onError();
|
|
6975
7035
|
} }, version),
|
|
6976
|
-
failed && /* @__PURE__ */ (0,
|
|
7036
|
+
failed && /* @__PURE__ */ (0, import_jsx_runtime44.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_runtime44.jsx)(KjunIcon, { name: "image", size: import_tokens44.tokens.extensions.image.fallbackIconSize }) })
|
|
6977
7037
|
] });
|
|
6978
7038
|
}
|
|
6979
7039
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
6980
|
-
return /* @__PURE__ */ (0,
|
|
7040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: import_tokens44.tokens.extensions.avatar[size], height: import_tokens44.tokens.extensions.avatar[size] }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunImage, { src, alt: alt || name || "\uC0AC\uC6A9\uC790", decorative, fallback: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KjunIcon, { name: "user", size: import_tokens44.tokens.extensions.avatar.fallbackIconSizes[size] }), onLoad, onError }) });
|
|
6981
7041
|
}
|
|
6982
7042
|
|
|
6983
7043
|
// packages/react/src/chip.tsx
|
|
6984
7044
|
var import_tokens45 = require("@kjun-ui/tokens");
|
|
6985
|
-
var
|
|
7045
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6986
7046
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
6987
|
-
return /* @__PURE__ */ (0,
|
|
6988
|
-
icon && /* @__PURE__ */ (0,
|
|
6989
|
-
/* @__PURE__ */ (0,
|
|
6990
|
-
removable && /* @__PURE__ */ (0,
|
|
7047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7048
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: icon, size: import_tokens45.tokens.extensions.chip.iconSizes[size] }),
|
|
7049
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: label }),
|
|
7050
|
+
removable && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-label": removeLabel || label + " \uC0AD\uC81C", disabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: "x", size: import_tokens45.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
6991
7051
|
] });
|
|
6992
7052
|
}
|
|
6993
7053
|
|
|
6994
7054
|
// packages/react/src/range-input.tsx
|
|
6995
|
-
var
|
|
7055
|
+
var import_react51 = require("react");
|
|
6996
7056
|
var import_react_aria_components9 = require("react-aria-components");
|
|
6997
7057
|
var import_tokens46 = require("@kjun-ui/tokens");
|
|
6998
|
-
var
|
|
7058
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6999
7059
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
7000
7060
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"] : ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"];
|
|
7001
7061
|
const domain = (0, import_tokens46.createSliderDomain)(min, max, step);
|
|
7002
7062
|
const list = Array.isArray(value) ? value : [value];
|
|
7003
7063
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
7004
|
-
const latest = (0,
|
|
7064
|
+
const latest = (0, import_react51.useRef)(value);
|
|
7005
7065
|
latest.current = value;
|
|
7006
|
-
const active = (0,
|
|
7007
|
-
(0,
|
|
7066
|
+
const active = (0, import_react51.useRef)(false);
|
|
7067
|
+
(0, import_react51.useEffect)(() => {
|
|
7008
7068
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7009
7069
|
}, [valid]);
|
|
7010
7070
|
const change = (next) => {
|
|
@@ -7016,48 +7076,48 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7016
7076
|
active.current = true;
|
|
7017
7077
|
onValueChange == null ? void 0 : onValueChange(result);
|
|
7018
7078
|
};
|
|
7019
|
-
return /* @__PURE__ */ (0,
|
|
7079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_aria_components9.Slider, { className: "kjun-slider", "data-disabled": disabled || !valid, "aria-label": ariaLabel || label || "\uAC12", value: valid ? value : Array.isArray(value) ? [0, 100] : 0, minValue: valid ? min : 0, maxValue: valid ? domain.snap(max) : 100, step: valid ? step : 1, isDisabled: disabled || !valid, onChange: change, onChangeEnd: () => {
|
|
7020
7080
|
if (valid && !disabled && active.current) {
|
|
7021
7081
|
active.current = false;
|
|
7022
7082
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7023
7083
|
}
|
|
7024
7084
|
}, children: [
|
|
7025
|
-
/* @__PURE__ */ (0,
|
|
7026
|
-
label && /* @__PURE__ */ (0,
|
|
7027
|
-
/* @__PURE__ */ (0,
|
|
7085
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "kjun-slider-caption", children: [
|
|
7086
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.Label, { className: "kjun-slider-label", children: label }),
|
|
7087
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.join(" \u2013 ") })
|
|
7028
7088
|
] }),
|
|
7029
|
-
/* @__PURE__ */ (0,
|
|
7030
|
-
/* @__PURE__ */ (0,
|
|
7031
|
-
/* @__PURE__ */ (0,
|
|
7032
|
-
list.map((_, i) => /* @__PURE__ */ (0,
|
|
7089
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
7090
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "kjun-slider-rail" }),
|
|
7091
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "kjun-slider-fill", style: { left: (list.length === 2 ? state.getThumbPercent(0) * 100 : 0) + "%", width: (state.getThumbPercent(list.length - 1) - (list.length === 2 ? state.getThumbPercent(0) : 0)) * 100 + "%" } }),
|
|
7092
|
+
list.map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.SliderThumb, { index: i, className: "kjun-slider-thumb", "aria-label": list.length === 2 ? thumbLabels[i] : ariaLabel || label || "\uAC12" }, i))
|
|
7033
7093
|
] }) })
|
|
7034
7094
|
] });
|
|
7035
7095
|
}
|
|
7036
7096
|
function KjunSlider(props) {
|
|
7037
|
-
return /* @__PURE__ */ (0,
|
|
7097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7038
7098
|
}
|
|
7039
7099
|
function KjunRangeSlider(props) {
|
|
7040
|
-
return /* @__PURE__ */ (0,
|
|
7100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7041
7101
|
}
|
|
7042
7102
|
|
|
7043
7103
|
// packages/react/src/quantity-stepper.tsx
|
|
7044
|
-
var
|
|
7104
|
+
var import_react52 = require("react");
|
|
7045
7105
|
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7046
|
-
var
|
|
7106
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7047
7107
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7048
7108
|
const geometry = import_tokens47.tokens.extensions.compound;
|
|
7049
7109
|
const buttonStyle = { width: import_tokens47.tokens.input[size].height, padding: 0 };
|
|
7050
7110
|
const domain = (0, import_tokens47.createNumberDomain)({ min, max, step, precision });
|
|
7051
7111
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7052
|
-
const [draft, setDraft] = (0,
|
|
7112
|
+
const [draft, setDraft] = (0, import_react52.useState)(String(value));
|
|
7053
7113
|
const field = useKjunField();
|
|
7054
|
-
const composing = (0,
|
|
7055
|
-
(0,
|
|
7114
|
+
const composing = (0, import_react52.useRef)(false), dirty = (0, import_react52.useRef)(false), accepted = (0, import_react52.useRef)(value);
|
|
7115
|
+
(0, import_react52.useEffect)(() => {
|
|
7056
7116
|
setDraft(String(value));
|
|
7057
7117
|
accepted.current = value;
|
|
7058
7118
|
dirty.current = false;
|
|
7059
7119
|
}, [value, precision, min, max, step]);
|
|
7060
|
-
(0,
|
|
7120
|
+
(0, import_react52.useEffect)(() => {
|
|
7061
7121
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7062
7122
|
}, [valid]);
|
|
7063
7123
|
const emit = (next) => {
|
|
@@ -7091,9 +7151,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7091
7151
|
} else if (action === "commit") commit();
|
|
7092
7152
|
else move(action === "increment" ? 1 : -1);
|
|
7093
7153
|
};
|
|
7094
|
-
return /* @__PURE__ */ (0,
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7096
|
-
/* @__PURE__ */ (0,
|
|
7154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "kjun-quantity", "data-size": size, "data-block": block, "data-error": error || !!(field == null ? void 0 : field.error), children: [
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunButton, { size, style: buttonStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uC904\uC774\uAE30", disabled: blocked || value <= min, onMouseDown: (e) => e.preventDefault(), onClick: () => move(-1), prefixIcon: "minus" }),
|
|
7156
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7097
7157
|
"input",
|
|
7098
7158
|
{
|
|
7099
7159
|
className: "kjun-input",
|
|
@@ -7127,21 +7187,21 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7127
7187
|
"aria-required": (field == null ? void 0 : field.required) || void 0
|
|
7128
7188
|
}
|
|
7129
7189
|
),
|
|
7130
|
-
/* @__PURE__ */ (0,
|
|
7190
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(KjunButton, { size, style: buttonStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uB298\uB9AC\uAE30", disabled: blocked || max !== void 0 && value >= max, onMouseDown: (e) => e.preventDefault(), onClick: () => move(1), prefixIcon: "plus" })
|
|
7131
7191
|
] }) });
|
|
7132
7192
|
}
|
|
7133
7193
|
|
|
7134
7194
|
// packages/react/src/time-picker.tsx
|
|
7135
|
-
var
|
|
7195
|
+
var import_react53 = require("react");
|
|
7136
7196
|
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7137
|
-
var
|
|
7197
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7138
7198
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel = "\uC2DC\uAC04", onValueChange, onChangeCommit }) {
|
|
7139
|
-
const root = (0,
|
|
7140
|
-
const field = useKjunField(), uid = (0,
|
|
7199
|
+
const root = (0, import_react53.useRef)(null);
|
|
7200
|
+
const field = useKjunField(), uid = (0, import_react53.useId)();
|
|
7141
7201
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7142
|
-
const domain = (0,
|
|
7202
|
+
const domain = (0, import_react53.useMemo)(() => (0, import_tokens48.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7143
7203
|
const valid = domain.valid && domain.accepts(value);
|
|
7144
|
-
(0,
|
|
7204
|
+
(0, import_react53.useEffect)(() => {
|
|
7145
7205
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7146
7206
|
}, [valid]);
|
|
7147
7207
|
const change = (next) => {
|
|
@@ -7151,15 +7211,15 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7151
7211
|
}
|
|
7152
7212
|
};
|
|
7153
7213
|
const time = value === null ? null : domain.parse(value);
|
|
7154
|
-
return /* @__PURE__ */ (0,
|
|
7155
|
-
/* @__PURE__ */ (0,
|
|
7214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { ref: root, className: "kjun-time-picker", "data-size": size, "data-error": error || !!(field == null ? void 0 : field.error), "data-disabled": disabled || !valid, role: "group", "aria-label": ariaLabel, "aria-labelledby": field == null ? void 0 : field.labelId, "aria-describedby": field == null ? void 0 : field.describedBy, children: [
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CompoundControlContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "kjun-time-segments", children: ["\uC2DC", "\uBD84", "\uCD08"].slice(0, precision === "second" ? 3 : 2).map((label, index) => {
|
|
7156
7216
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7157
7217
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7158
|
-
return /* @__PURE__ */ (0,
|
|
7159
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7161
|
-
/* @__PURE__ */ (0,
|
|
7162
|
-
/* @__PURE__ */ (0,
|
|
7218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react53.Fragment, { children: [
|
|
7219
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldContext.Provider, { value: { ...field, id: segmentId, labelId: (field == null ? void 0 : field.labelId) ? `${field.labelId} ${labelId}` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "kjun-time-segment", children: [
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|
|
7222
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7163
7223
|
KjunSelect,
|
|
7164
7224
|
{
|
|
7165
7225
|
value: time === null ? null : domain.part(time, index),
|
|
@@ -7179,7 +7239,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7179
7239
|
] }) })
|
|
7180
7240
|
] }, label);
|
|
7181
7241
|
}) }) }),
|
|
7182
|
-
clearable && value !== null && /* @__PURE__ */ (0,
|
|
7242
|
+
clearable && value !== null && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(KjunButton, { className: "kjun-time-clear", size, variant: "ghost", prefixIcon: "x", ariaLabel: ariaLabel + " \uC9C0\uC6B0\uAE30", disabled: disabled || !valid, onClick: () => {
|
|
7183
7243
|
var _a, _b;
|
|
7184
7244
|
change(null);
|
|
7185
7245
|
(_b = (_a = root.current) == null ? void 0 : _a.querySelector(".kjun-select-trigger")) == null ? void 0 : _b.focus();
|