@kjun-ui/react 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +769 -715
- package/dist/index.js +462 -408
- 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/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,
|
|
@@ -1654,14 +1657,65 @@ function KjunSkeleton({
|
|
|
1654
1657
|
);
|
|
1655
1658
|
}
|
|
1656
1659
|
|
|
1657
|
-
//
|
|
1660
|
+
// packages/react/src/layout-primitives.tsx
|
|
1658
1661
|
var import_react15 = require("react");
|
|
1662
|
+
|
|
1663
|
+
// shared/package-runtime/layout-primitives.ts
|
|
1664
|
+
var numeric = /^(number|display)/;
|
|
1665
|
+
var textTypeClass = (variant) => "kjun-type-" + variant.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
|
|
1666
|
+
var defaultTextTag = (variant) => variant === "pageTitle" ? "h1" : variant === "sectionTitle" ? "h2" : variant === "cardTitle" ? "h3" : numeric.test(variant) ? "span" : "p";
|
|
1667
|
+
|
|
1668
|
+
// packages/react/src/layout-primitives.tsx
|
|
1669
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1670
|
+
var join = (...names) => names.filter(Boolean).join(" ");
|
|
1671
|
+
function KjunText({ variant = "body", tone = "default", as, align, maxLines, className, style, children, ...rest }) {
|
|
1672
|
+
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
1673
|
+
return (0, import_react15.createElement)(as != null ? as : defaultTextTag(variant), {
|
|
1674
|
+
...rest,
|
|
1675
|
+
className: join("kjun-text", textTypeClass(variant), className),
|
|
1676
|
+
// 안에 넣은 링크·강조 같은 앱 요소는 KJUN 리셋을 받지 않는다.
|
|
1677
|
+
"data-kjun-content": "",
|
|
1678
|
+
"data-tone": tone === "default" ? void 0 : tone,
|
|
1679
|
+
"data-align": align,
|
|
1680
|
+
"data-max-lines": lines,
|
|
1681
|
+
style: lines ? { ...style, ["--_kjun-text-lines"]: lines } : style
|
|
1682
|
+
}, children);
|
|
1683
|
+
}
|
|
1684
|
+
function KjunStack({ gap = "md", align = "stretch", as = "div", className, style, children, ...rest }) {
|
|
1685
|
+
return (0, import_react15.createElement)(as, {
|
|
1686
|
+
...rest,
|
|
1687
|
+
className: className || void 0,
|
|
1688
|
+
style,
|
|
1689
|
+
"data-kjun-stack": "",
|
|
1690
|
+
"data-gap": gap,
|
|
1691
|
+
"data-align": align
|
|
1692
|
+
}, children);
|
|
1693
|
+
}
|
|
1694
|
+
function KjunInline({ gap = "sm", align = "center", justify = "start", wrap = true, className, style, children, ...rest }) {
|
|
1695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1696
|
+
"div",
|
|
1697
|
+
{
|
|
1698
|
+
...rest,
|
|
1699
|
+
className: className || void 0,
|
|
1700
|
+
style,
|
|
1701
|
+
"data-kjun-inline": "",
|
|
1702
|
+
"data-gap": gap,
|
|
1703
|
+
"data-align": align,
|
|
1704
|
+
"data-justify": justify,
|
|
1705
|
+
"data-wrap": wrap ? void 0 : "false",
|
|
1706
|
+
children
|
|
1707
|
+
}
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// shared/package-runtime/feedback-dialog.ts
|
|
1712
|
+
var import_react16 = require("react");
|
|
1659
1713
|
function useFeedbackDialog(controller, request) {
|
|
1660
1714
|
const options = request.options;
|
|
1661
|
-
const [value, setValue] = (0,
|
|
1662
|
-
const [error, setError] = (0,
|
|
1663
|
-
const [busy, setBusy] = (0,
|
|
1664
|
-
const working = (0,
|
|
1715
|
+
const [value, setValue] = (0, import_react16.useState)(options.initialValue || "");
|
|
1716
|
+
const [error, setError] = (0, import_react16.useState)("");
|
|
1717
|
+
const [busy, setBusy] = (0, import_react16.useState)(false);
|
|
1718
|
+
const working = (0, import_react16.useRef)(false);
|
|
1665
1719
|
const active = () => {
|
|
1666
1720
|
var _a;
|
|
1667
1721
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -1704,11 +1758,11 @@ function useFeedbackDialog(controller, request) {
|
|
|
1704
1758
|
|
|
1705
1759
|
// shared/package-runtime/feedback-motion.ts
|
|
1706
1760
|
var import_tokens11 = require("@kjun-ui/tokens");
|
|
1707
|
-
var
|
|
1761
|
+
var import_react17 = require("react");
|
|
1708
1762
|
function usePresentedToasts(toasts, reduced) {
|
|
1709
|
-
const [items, setItems] = (0,
|
|
1710
|
-
const removals = (0,
|
|
1711
|
-
(0,
|
|
1763
|
+
const [items, setItems] = (0, import_react17.useState)([]);
|
|
1764
|
+
const removals = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
1765
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
1712
1766
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
1713
1767
|
setItems((previous) => {
|
|
1714
1768
|
const old = new Map(previous.map((item) => [item.toast.id, item]));
|
|
@@ -1730,15 +1784,15 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
1730
1784
|
removals.current.clear();
|
|
1731
1785
|
}
|
|
1732
1786
|
}, [toasts, reduced]);
|
|
1733
|
-
(0,
|
|
1787
|
+
(0, import_react17.useLayoutEffect)(() => () => {
|
|
1734
1788
|
for (const timer of removals.current.values()) clearTimeout(timer);
|
|
1735
1789
|
removals.current.clear();
|
|
1736
1790
|
}, []);
|
|
1737
1791
|
return items;
|
|
1738
1792
|
}
|
|
1739
1793
|
function usePresentedRequest(current, reduced) {
|
|
1740
|
-
const [request, setRequest] = (0,
|
|
1741
|
-
(0,
|
|
1794
|
+
const [request, setRequest] = (0, import_react17.useState)(current);
|
|
1795
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
1742
1796
|
if (!request || request.id === (current == null ? void 0 : current.id) || reduced) {
|
|
1743
1797
|
setRequest(current);
|
|
1744
1798
|
return;
|
|
@@ -1750,15 +1804,15 @@ function usePresentedRequest(current, reduced) {
|
|
|
1750
1804
|
}
|
|
1751
1805
|
|
|
1752
1806
|
// packages/react/src/feedback-context.ts
|
|
1753
|
-
var
|
|
1754
|
-
var KjunFeedbackContext = (0,
|
|
1807
|
+
var import_react18 = require("react");
|
|
1808
|
+
var KjunFeedbackContext = (0, import_react18.createContext)(null);
|
|
1755
1809
|
function useOptionalKjunFeedback() {
|
|
1756
|
-
return (0,
|
|
1810
|
+
return (0, import_react18.useContext)(KjunFeedbackContext);
|
|
1757
1811
|
}
|
|
1758
1812
|
|
|
1759
1813
|
// packages/react/src/toast-stack.tsx
|
|
1760
1814
|
var import_tokens13 = require("@kjun-ui/tokens");
|
|
1761
|
-
var
|
|
1815
|
+
var import_react20 = require("react");
|
|
1762
1816
|
|
|
1763
1817
|
// shared/package-runtime/toast-layout.ts
|
|
1764
1818
|
var import_tokens12 = require("@kjun-ui/tokens");
|
|
@@ -1820,15 +1874,15 @@ function createToastLayout() {
|
|
|
1820
1874
|
}
|
|
1821
1875
|
|
|
1822
1876
|
// packages/react/src/toast.tsx
|
|
1823
|
-
var
|
|
1824
|
-
var
|
|
1877
|
+
var import_react19 = require("react");
|
|
1878
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1825
1879
|
function ToastView({
|
|
1826
1880
|
toast,
|
|
1827
1881
|
controller
|
|
1828
1882
|
}) {
|
|
1829
|
-
const previous = (0,
|
|
1830
|
-
const reasons = (0,
|
|
1831
|
-
(0,
|
|
1883
|
+
const previous = (0, import_react19.useRef)(null);
|
|
1884
|
+
const reasons = (0, import_react19.useRef)({ hover: /* @__PURE__ */ Symbol("hover"), focus: /* @__PURE__ */ Symbol("focus") }).current;
|
|
1885
|
+
(0, import_react19.useEffect)(() => {
|
|
1832
1886
|
previous.current = document.activeElement;
|
|
1833
1887
|
return () => {
|
|
1834
1888
|
controller.resumeToast(toast.id, reasons.hover);
|
|
@@ -1847,7 +1901,7 @@ function ToastView({
|
|
|
1847
1901
|
warning: "alert-triangle",
|
|
1848
1902
|
info: "info-circle"
|
|
1849
1903
|
}[tone];
|
|
1850
|
-
return /* @__PURE__ */ (0,
|
|
1904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1851
1905
|
"div",
|
|
1852
1906
|
{
|
|
1853
1907
|
className: "kjun-toast",
|
|
@@ -1863,18 +1917,18 @@ function ToastView({
|
|
|
1863
1917
|
controller.resumeToast(toast.id, reasons.focus);
|
|
1864
1918
|
},
|
|
1865
1919
|
children: [
|
|
1866
|
-
/* @__PURE__ */ (0,
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1867
1921
|
"span",
|
|
1868
1922
|
{
|
|
1869
1923
|
className: "kjun-toast-icon",
|
|
1870
1924
|
style: { color: `var(--_kjun-color-${tone}-accent)` },
|
|
1871
|
-
children: /* @__PURE__ */ (0,
|
|
1925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(KjunIcon, { name: icon })
|
|
1872
1926
|
}
|
|
1873
1927
|
),
|
|
1874
|
-
/* @__PURE__ */ (0,
|
|
1875
|
-
toast.title && /* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1877
|
-
toast.action && /* @__PURE__ */ (0,
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "kjun-toast-content", children: [
|
|
1929
|
+
toast.title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: toast.title }),
|
|
1930
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "kjun-toast-message", children: toast.message }),
|
|
1931
|
+
toast.action && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1878
1932
|
"button",
|
|
1879
1933
|
{
|
|
1880
1934
|
type: "button",
|
|
@@ -1891,17 +1945,17 @@ function ToastView({
|
|
|
1891
1945
|
}
|
|
1892
1946
|
)
|
|
1893
1947
|
] }),
|
|
1894
|
-
toast.closable !== false && /* @__PURE__ */ (0,
|
|
1948
|
+
toast.closable !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1895
1949
|
"button",
|
|
1896
1950
|
{
|
|
1897
1951
|
type: "button",
|
|
1898
1952
|
className: "kjun-toast-close",
|
|
1899
1953
|
"aria-label": "\uC54C\uB9BC \uB2EB\uAE30",
|
|
1900
1954
|
onClick: () => dismiss(),
|
|
1901
|
-
children: /* @__PURE__ */ (0,
|
|
1955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(KjunIcon, { name: "x" })
|
|
1902
1956
|
}
|
|
1903
1957
|
),
|
|
1904
|
-
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */ (0,
|
|
1958
|
+
toast.showProgress !== false && !!toast.duration && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1905
1959
|
"div",
|
|
1906
1960
|
{
|
|
1907
1961
|
"aria-hidden": "true",
|
|
@@ -1921,12 +1975,12 @@ function ToastView({
|
|
|
1921
1975
|
}
|
|
1922
1976
|
|
|
1923
1977
|
// packages/react/src/toast-stack.tsx
|
|
1924
|
-
var
|
|
1978
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1925
1979
|
function ToastSurface({ item, controller }) {
|
|
1926
|
-
const ref = (0,
|
|
1927
|
-
const current = (0,
|
|
1928
|
-
const entryFinished = (0,
|
|
1929
|
-
(0,
|
|
1980
|
+
const ref = (0, import_react20.useRef)(null), reduced = useReducedMotion();
|
|
1981
|
+
const current = (0, import_react20.useRef)(null);
|
|
1982
|
+
const entryFinished = (0, import_react20.useRef)(false);
|
|
1983
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
1930
1984
|
var _a, _b;
|
|
1931
1985
|
const el = ref.current;
|
|
1932
1986
|
if (!el) return;
|
|
@@ -1955,24 +2009,24 @@ function ToastSurface({ item, controller }) {
|
|
|
1955
2009
|
for (const animation of animations) animation.cancel();
|
|
1956
2010
|
};
|
|
1957
2011
|
}, [item.exiting, item.born, reduced]);
|
|
1958
|
-
return /* @__PURE__ */ (0,
|
|
2012
|
+
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
2013
|
}
|
|
1960
2014
|
function ToastStack({ items, controller }) {
|
|
1961
2015
|
var _a;
|
|
1962
2016
|
const layers = useLayerState();
|
|
1963
|
-
const root = (0,
|
|
2017
|
+
const root = (0, import_react20.useRef)(null), layout = (0, import_react20.useRef)(createToastLayout());
|
|
1964
2018
|
const reduced = useReducedMotion();
|
|
1965
|
-
(0,
|
|
2019
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
1966
2020
|
if (root.current) layout.current.update(root.current, reduced);
|
|
1967
2021
|
});
|
|
1968
|
-
(0,
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
2022
|
+
(0, import_react20.useLayoutEffect)(() => () => layout.current.destroy(), []);
|
|
2023
|
+
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
2024
|
"div",
|
|
1971
2025
|
{
|
|
1972
2026
|
"data-toast-id": item.toast.id,
|
|
1973
2027
|
"data-exiting": item.exiting,
|
|
1974
2028
|
className: "kjun-toast-slot",
|
|
1975
|
-
children: /* @__PURE__ */ (0,
|
|
2029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ToastSurface, { item, controller })
|
|
1976
2030
|
},
|
|
1977
2031
|
item.toast.id
|
|
1978
2032
|
)) });
|
|
@@ -1980,8 +2034,8 @@ function ToastStack({ items, controller }) {
|
|
|
1980
2034
|
|
|
1981
2035
|
// packages/react/src/feedback.tsx
|
|
1982
2036
|
var import_tokens14 = require("@kjun-ui/tokens");
|
|
1983
|
-
var
|
|
1984
|
-
var
|
|
2037
|
+
var import_react21 = require("react");
|
|
2038
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1985
2039
|
function useKjunFeedback() {
|
|
1986
2040
|
const value = useOptionalKjunFeedback();
|
|
1987
2041
|
if (!value) throw Error("useKjunFeedback requires KjunFeedbackProvider.");
|
|
@@ -1993,7 +2047,7 @@ function FeedbackDialog({
|
|
|
1993
2047
|
open
|
|
1994
2048
|
}) {
|
|
1995
2049
|
const { options, value, error, busy, edit, cancel, submit } = useFeedbackDialog(controller, request);
|
|
1996
|
-
return /* @__PURE__ */ (0,
|
|
2050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1997
2051
|
KjunModal,
|
|
1998
2052
|
{
|
|
1999
2053
|
open,
|
|
@@ -2011,8 +2065,8 @@ function FeedbackDialog({
|
|
|
2011
2065
|
onConfirm: submit,
|
|
2012
2066
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
2013
2067
|
children: [
|
|
2014
|
-
options.message && /* @__PURE__ */ (0,
|
|
2015
|
-
request.kind === "prompt" && /* @__PURE__ */ (0,
|
|
2068
|
+
options.message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: options.message }),
|
|
2069
|
+
request.kind === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2016
2070
|
KjunInput,
|
|
2017
2071
|
{
|
|
2018
2072
|
autoFocus: true,
|
|
@@ -2030,9 +2084,9 @@ function FeedbackDialog({
|
|
|
2030
2084
|
}
|
|
2031
2085
|
function KjunFeedbackProvider({ children }) {
|
|
2032
2086
|
var _a;
|
|
2033
|
-
const [controller] = (0,
|
|
2034
|
-
const life = (0,
|
|
2035
|
-
const snapshot = (0,
|
|
2087
|
+
const [controller] = (0, import_react21.useState)(import_tokens14.createFeedbackController);
|
|
2088
|
+
const life = (0, import_react21.useRef)(0);
|
|
2089
|
+
const snapshot = (0, import_react21.useSyncExternalStore)(
|
|
2036
2090
|
controller.subscribe,
|
|
2037
2091
|
controller.getSnapshot,
|
|
2038
2092
|
controller.getSnapshot
|
|
@@ -2040,7 +2094,7 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2040
2094
|
const reduced = useReducedMotion();
|
|
2041
2095
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
2042
2096
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
2043
|
-
(0,
|
|
2097
|
+
(0, import_react21.useEffect)(() => {
|
|
2044
2098
|
const version = ++life.current;
|
|
2045
2099
|
return () => {
|
|
2046
2100
|
queueMicrotask(() => {
|
|
@@ -2048,21 +2102,21 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2048
2102
|
});
|
|
2049
2103
|
};
|
|
2050
2104
|
}, [controller]);
|
|
2051
|
-
const [layers, setLayers] = (0,
|
|
2052
|
-
const register = (0,
|
|
2105
|
+
const [layers, setLayers] = (0, import_react21.useState)([]);
|
|
2106
|
+
const register = (0, import_react21.useCallback)((id, order) => {
|
|
2053
2107
|
setLayers((current) => [...current, { id, order }]);
|
|
2054
2108
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
2055
2109
|
}, []);
|
|
2056
2110
|
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,
|
|
2111
|
+
const renderToasts = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastStack, { items: toasts, controller });
|
|
2112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(KjunFeedbackContext.Provider, { value: controller.api, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2059
2113
|
FeedbackOverlayContext.Provider,
|
|
2060
2114
|
{
|
|
2061
2115
|
value: { top, register, render: renderToasts },
|
|
2062
2116
|
children: [
|
|
2063
2117
|
children,
|
|
2064
2118
|
!layers.length && renderToasts(),
|
|
2065
|
-
dialog.request && /* @__PURE__ */ (0,
|
|
2119
|
+
dialog.request && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2066
2120
|
FeedbackDialog,
|
|
2067
2121
|
{
|
|
2068
2122
|
request: dialog.request,
|
|
@@ -2078,11 +2132,11 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2078
2132
|
|
|
2079
2133
|
// packages/react/src/controls.tsx
|
|
2080
2134
|
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2081
|
-
var
|
|
2135
|
+
var import_react23 = require("react");
|
|
2082
2136
|
var import_react_aria_components2 = require("react-aria-components");
|
|
2083
2137
|
|
|
2084
2138
|
// packages/react/src/use-selection-indicator.ts
|
|
2085
|
-
var
|
|
2139
|
+
var import_react22 = require("react");
|
|
2086
2140
|
|
|
2087
2141
|
// shared/package-runtime/selection-indicator.ts
|
|
2088
2142
|
var import_tokens15 = require("@kjun-ui/tokens");
|
|
@@ -2154,11 +2208,11 @@ function selectionIndicator(root, marker, tabs = false) {
|
|
|
2154
2208
|
|
|
2155
2209
|
// packages/react/src/use-selection-indicator.ts
|
|
2156
2210
|
function useSelectionIndicator(tabs = false) {
|
|
2157
|
-
const group = (0,
|
|
2158
|
-
const indicator = (0,
|
|
2159
|
-
const sync = (0,
|
|
2211
|
+
const group = (0, import_react22.useRef)(null);
|
|
2212
|
+
const indicator = (0, import_react22.useRef)(null);
|
|
2213
|
+
const sync = (0, import_react22.useRef)(() => {
|
|
2160
2214
|
});
|
|
2161
|
-
(0,
|
|
2215
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
2162
2216
|
const root = group.current, marker = indicator.current;
|
|
2163
2217
|
if (!root || !marker) return;
|
|
2164
2218
|
const handle = selectionIndicator(root, marker, tabs);
|
|
@@ -2169,7 +2223,7 @@ function useSelectionIndicator(tabs = false) {
|
|
|
2169
2223
|
};
|
|
2170
2224
|
};
|
|
2171
2225
|
}, [tabs]);
|
|
2172
|
-
(0,
|
|
2226
|
+
(0, import_react22.useLayoutEffect)(() => sync.current());
|
|
2173
2227
|
return { group, indicator };
|
|
2174
2228
|
}
|
|
2175
2229
|
|
|
@@ -2188,7 +2242,7 @@ function groupKeydown(event) {
|
|
|
2188
2242
|
}
|
|
2189
2243
|
|
|
2190
2244
|
// packages/react/src/controls.tsx
|
|
2191
|
-
var
|
|
2245
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2192
2246
|
function KjunCheckbox({
|
|
2193
2247
|
value,
|
|
2194
2248
|
val,
|
|
@@ -2202,7 +2256,7 @@ function KjunCheckbox({
|
|
|
2202
2256
|
}) {
|
|
2203
2257
|
const checked = Array.isArray(value) ? value.includes(val) : value;
|
|
2204
2258
|
const field = useKjunField();
|
|
2205
|
-
return /* @__PURE__ */ (0,
|
|
2259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2206
2260
|
import_react_aria_components2.Checkbox,
|
|
2207
2261
|
{
|
|
2208
2262
|
isSelected: checked,
|
|
@@ -2219,14 +2273,14 @@ function KjunCheckbox({
|
|
|
2219
2273
|
onChange == null ? void 0 : onChange(result);
|
|
2220
2274
|
},
|
|
2221
2275
|
children: [
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2223
2277
|
"span",
|
|
2224
2278
|
{
|
|
2225
2279
|
className: `kjun-choice-control kjun-checkbox kjun-checkbox--${size}${checked ? " kjun-checkbox--checked" : ""}`,
|
|
2226
|
-
children: checked && /* @__PURE__ */ (0,
|
|
2280
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: "check", size: import_tokens16.tokens.extensions.checkbox.iconSizes[size] })
|
|
2227
2281
|
}
|
|
2228
2282
|
),
|
|
2229
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2283
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2230
2284
|
]
|
|
2231
2285
|
}
|
|
2232
2286
|
);
|
|
@@ -2243,14 +2297,14 @@ function KjunSwitch({
|
|
|
2243
2297
|
}) {
|
|
2244
2298
|
const field = useKjunField();
|
|
2245
2299
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2246
|
-
const markInput = (0,
|
|
2300
|
+
const markInput = (0, import_react23.useCallback)((input) => {
|
|
2247
2301
|
if (!input) return;
|
|
2248
2302
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2249
2303
|
else input.removeAttribute("aria-invalid");
|
|
2250
2304
|
if (required) input.setAttribute("aria-required", "true");
|
|
2251
2305
|
else input.removeAttribute("aria-required");
|
|
2252
2306
|
}, [invalid, required]);
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2254
2308
|
import_react_aria_components2.Switch,
|
|
2255
2309
|
{
|
|
2256
2310
|
isSelected: value,
|
|
@@ -2264,19 +2318,19 @@ function KjunSwitch({
|
|
|
2264
2318
|
onChange == null ? void 0 : onChange(next);
|
|
2265
2319
|
},
|
|
2266
2320
|
children: [
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2268
2322
|
"span",
|
|
2269
2323
|
{
|
|
2270
2324
|
className: `kjun-switch kjun-switch--${size}${value ? " kjun-switch--on" : ""}`,
|
|
2271
|
-
children: /* @__PURE__ */ (0,
|
|
2325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-switch-thumb" })
|
|
2272
2326
|
}
|
|
2273
2327
|
),
|
|
2274
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2328
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2275
2329
|
]
|
|
2276
2330
|
}
|
|
2277
2331
|
);
|
|
2278
2332
|
}
|
|
2279
|
-
var RadioContext = (0,
|
|
2333
|
+
var RadioContext = (0, import_react23.createContext)(null);
|
|
2280
2334
|
function KjunRadio({
|
|
2281
2335
|
value,
|
|
2282
2336
|
val,
|
|
@@ -2288,9 +2342,9 @@ function KjunRadio({
|
|
|
2288
2342
|
onValueChange,
|
|
2289
2343
|
onChange
|
|
2290
2344
|
}) {
|
|
2291
|
-
const group = (0,
|
|
2292
|
-
return /* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2345
|
+
const group = (0, import_react23.useContext)(RadioContext), selected = (group ? group.value : value) === val;
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""), children: [
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2294
2348
|
"input",
|
|
2295
2349
|
{
|
|
2296
2350
|
type: "radio",
|
|
@@ -2308,14 +2362,14 @@ function KjunRadio({
|
|
|
2308
2362
|
}
|
|
2309
2363
|
}
|
|
2310
2364
|
),
|
|
2311
|
-
/* @__PURE__ */ (0,
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2312
2366
|
"span",
|
|
2313
2367
|
{
|
|
2314
2368
|
className: "kjun-choice-control kjun-radio" + (selected ? " kjun-radio--checked" : ""),
|
|
2315
|
-
children: selected && /* @__PURE__ */ (0,
|
|
2369
|
+
children: selected && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-radio-dot" })
|
|
2316
2370
|
}
|
|
2317
2371
|
),
|
|
2318
|
-
(children || label) && /* @__PURE__ */ (0,
|
|
2372
|
+
(children || label) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "kjun-choice-label", children: children || label })
|
|
2319
2373
|
] });
|
|
2320
2374
|
}
|
|
2321
2375
|
function KjunRadioGroup({
|
|
@@ -2327,8 +2381,8 @@ function KjunRadioGroup({
|
|
|
2327
2381
|
onValueChange,
|
|
2328
2382
|
onChange
|
|
2329
2383
|
}) {
|
|
2330
|
-
const name = "kjun-" + (0,
|
|
2331
|
-
return /* @__PURE__ */ (0,
|
|
2384
|
+
const name = "kjun-" + (0, import_react23.useId)();
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2332
2386
|
RadioContext.Provider,
|
|
2333
2387
|
{
|
|
2334
2388
|
value: {
|
|
@@ -2339,7 +2393,7 @@ function KjunRadioGroup({
|
|
|
2339
2393
|
onChange == null ? void 0 : onChange(next);
|
|
2340
2394
|
}
|
|
2341
2395
|
},
|
|
2342
|
-
children: /* @__PURE__ */ (0,
|
|
2396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2343
2397
|
"div",
|
|
2344
2398
|
{
|
|
2345
2399
|
role: "radiogroup",
|
|
@@ -2351,7 +2405,7 @@ function KjunRadioGroup({
|
|
|
2351
2405
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
2352
2406
|
gap: direction === "vertical" ? import_tokens16.tokens.dimension.value8 : import_tokens16.tokens.dimension.value16
|
|
2353
2407
|
},
|
|
2354
|
-
children: children || options.map((option) => /* @__PURE__ */ (0,
|
|
2408
|
+
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2355
2409
|
KjunRadio,
|
|
2356
2410
|
{
|
|
2357
2411
|
val: option.value,
|
|
@@ -2365,7 +2419,7 @@ function KjunRadioGroup({
|
|
|
2365
2419
|
}
|
|
2366
2420
|
);
|
|
2367
2421
|
}
|
|
2368
|
-
var KjunTextarea = (0,
|
|
2422
|
+
var KjunTextarea = (0, import_react23.forwardRef)(
|
|
2369
2423
|
function KjunTextarea2({
|
|
2370
2424
|
value,
|
|
2371
2425
|
size = "md",
|
|
@@ -2382,7 +2436,7 @@ var KjunTextarea = (0, import_react22.forwardRef)(
|
|
|
2382
2436
|
var _a;
|
|
2383
2437
|
const field = useKjunField();
|
|
2384
2438
|
const spec = import_tokens16.tokens.input[size];
|
|
2385
|
-
return /* @__PURE__ */ (0,
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2386
2440
|
"textarea",
|
|
2387
2441
|
{
|
|
2388
2442
|
...props,
|
|
@@ -2424,7 +2478,7 @@ function KjunButtonGroup({
|
|
|
2424
2478
|
onChange
|
|
2425
2479
|
}) {
|
|
2426
2480
|
const { group, indicator } = useSelectionIndicator();
|
|
2427
|
-
return /* @__PURE__ */ (0,
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2428
2482
|
"div",
|
|
2429
2483
|
{
|
|
2430
2484
|
ref: group,
|
|
@@ -2439,7 +2493,7 @@ function KjunButtonGroup({
|
|
|
2439
2493
|
width: fullWidth ? "100%" : "fit-content"
|
|
2440
2494
|
},
|
|
2441
2495
|
children: [
|
|
2442
|
-
/* @__PURE__ */ (0,
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2443
2497
|
"span",
|
|
2444
2498
|
{
|
|
2445
2499
|
ref: indicator,
|
|
@@ -2449,7 +2503,7 @@ function KjunButtonGroup({
|
|
|
2449
2503
|
style: { borderRadius: import_tokens16.tokens.buttonGroup.itemRadii[size] }
|
|
2450
2504
|
}
|
|
2451
2505
|
),
|
|
2452
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
2506
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2453
2507
|
"button",
|
|
2454
2508
|
{
|
|
2455
2509
|
type: "button",
|
|
@@ -2466,10 +2520,10 @@ function KjunButtonGroup({
|
|
|
2466
2520
|
onChange == null ? void 0 : onChange(option.value);
|
|
2467
2521
|
},
|
|
2468
2522
|
children: [
|
|
2469
|
-
option.icon && /* @__PURE__ */ (0,
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: option.icon, size: import_tokens16.tokens.extensions.selection.iconSize }),
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "kjun-button-group-label", children: [
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens16.tokens.button.typography[size]), children: option.label }),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: option.label })
|
|
2473
2527
|
] })
|
|
2474
2528
|
]
|
|
2475
2529
|
},
|
|
@@ -2491,7 +2545,7 @@ function KjunFilterGroup({
|
|
|
2491
2545
|
onChange
|
|
2492
2546
|
}) {
|
|
2493
2547
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
2494
|
-
return /* @__PURE__ */ (0,
|
|
2548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2495
2549
|
"div",
|
|
2496
2550
|
{
|
|
2497
2551
|
role: "group",
|
|
@@ -2499,7 +2553,7 @@ function KjunFilterGroup({
|
|
|
2499
2553
|
className: "kjun-filter-group",
|
|
2500
2554
|
"data-scroll": scroll,
|
|
2501
2555
|
onKeyDown: groupKeydown,
|
|
2502
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
2556
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2503
2557
|
"button",
|
|
2504
2558
|
{
|
|
2505
2559
|
type: "button",
|
|
@@ -2512,7 +2566,7 @@ function KjunFilterGroup({
|
|
|
2512
2566
|
onValueChange == null ? void 0 : onValueChange(next);
|
|
2513
2567
|
onChange == null ? void 0 : onChange(next);
|
|
2514
2568
|
},
|
|
2515
|
-
children: /* @__PURE__ */ (0,
|
|
2569
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2516
2570
|
"span",
|
|
2517
2571
|
{
|
|
2518
2572
|
style: {
|
|
@@ -2521,11 +2575,11 @@ function KjunFilterGroup({
|
|
|
2521
2575
|
...selectionTypeStyle(size, selected(option.value))
|
|
2522
2576
|
},
|
|
2523
2577
|
children: [
|
|
2524
|
-
option.dot && /* @__PURE__ */ (0,
|
|
2525
|
-
option.icon && /* @__PURE__ */ (0,
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2578
|
+
option.dot && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("i", { style: { background: option.dot } }),
|
|
2579
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KjunIcon, { name: option.icon, size: import_tokens16.tokens.extensions.selection.iconSize }),
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "kjun-filter-label", children: [
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", style: typeStyle(import_tokens16.tokens.button.typography[size]), children: option.label }),
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: option.label })
|
|
2529
2583
|
] })
|
|
2530
2584
|
]
|
|
2531
2585
|
}
|
|
@@ -2539,9 +2593,9 @@ function KjunFilterGroup({
|
|
|
2539
2593
|
|
|
2540
2594
|
// packages/react/src/floating-panel.tsx
|
|
2541
2595
|
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2542
|
-
var
|
|
2596
|
+
var import_react24 = require("react");
|
|
2543
2597
|
var import_react_aria_components3 = require("react-aria-components");
|
|
2544
|
-
var
|
|
2598
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2545
2599
|
function FloatingPanel({
|
|
2546
2600
|
open,
|
|
2547
2601
|
onOpenChange,
|
|
@@ -2560,8 +2614,8 @@ function FloatingPanel({
|
|
|
2560
2614
|
const motion = usePresence(open, useReducedMotion(), import_tokens17.tokens.motion.popupExit);
|
|
2561
2615
|
const layer = useLayer(open, motion.present, "popup", () => onOpenChange(false), triggerRef, returnFocus);
|
|
2562
2616
|
const container = useKjunPortalContainer();
|
|
2563
|
-
const panel = (0,
|
|
2564
|
-
(0,
|
|
2617
|
+
const panel = (0, import_react24.useRef)(null);
|
|
2618
|
+
(0, import_react24.useEffect)(() => {
|
|
2565
2619
|
var _a;
|
|
2566
2620
|
const document2 = (_a = triggerRef.current) == null ? void 0 : _a.ownerDocument;
|
|
2567
2621
|
if (!open || nonModal || !document2 || layer.keyboardManaged) return;
|
|
@@ -2579,7 +2633,7 @@ function FloatingPanel({
|
|
|
2579
2633
|
return () => document2.removeEventListener("keydown", dismissBeforeFocus, true);
|
|
2580
2634
|
}, [open, nonModal, triggerRef, onOpenChange, layer.keyboardManaged]);
|
|
2581
2635
|
if (container === null || layer.blocked) return null;
|
|
2582
|
-
return /* @__PURE__ */ (0,
|
|
2636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2583
2637
|
import_react_aria_components3.Popover,
|
|
2584
2638
|
{
|
|
2585
2639
|
ref: panel,
|
|
@@ -2611,7 +2665,7 @@ function FloatingPanel({
|
|
|
2611
2665
|
|
|
2612
2666
|
// packages/react/src/popover.tsx
|
|
2613
2667
|
var import_tokens18 = require("@kjun-ui/tokens");
|
|
2614
|
-
var
|
|
2668
|
+
var import_react25 = require("react");
|
|
2615
2669
|
var import_react_aria_components4 = require("react-aria-components");
|
|
2616
2670
|
|
|
2617
2671
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -2674,7 +2728,7 @@ function installNonModalPopover({ panel, trigger, close }) {
|
|
|
2674
2728
|
}
|
|
2675
2729
|
|
|
2676
2730
|
// packages/react/src/popover.tsx
|
|
2677
|
-
var
|
|
2731
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2678
2732
|
function KjunPopover({
|
|
2679
2733
|
noPadding = false,
|
|
2680
2734
|
open: controlled,
|
|
@@ -2692,11 +2746,11 @@ function KjunPopover({
|
|
|
2692
2746
|
trigger,
|
|
2693
2747
|
children
|
|
2694
2748
|
}) {
|
|
2695
|
-
const [internal, setInternal] = (0,
|
|
2749
|
+
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
2750
|
const expanded = usePopupExpanded(open, ref);
|
|
2697
|
-
const focusOnMount = (0,
|
|
2751
|
+
const focusOnMount = (0, import_react25.useRef)(focusOnOpen);
|
|
2698
2752
|
focusOnMount.current = focusOnOpen;
|
|
2699
|
-
const focusContent = (0,
|
|
2753
|
+
const focusContent = (0, import_react25.useCallback)((node) => {
|
|
2700
2754
|
if (node && focusOnMount.current) node.focus();
|
|
2701
2755
|
}, []);
|
|
2702
2756
|
const resolveReturn = returnFocus === void 0 ? void 0 : () => typeof returnFocus === "function" ? returnFocus() : returnFocus instanceof HTMLElement ? returnFocus : returnFocus.current;
|
|
@@ -2704,8 +2758,8 @@ function KjunPopover({
|
|
|
2704
2758
|
setInternal(v);
|
|
2705
2759
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
2706
2760
|
};
|
|
2707
|
-
const skipReturn = (0,
|
|
2708
|
-
(0,
|
|
2761
|
+
const skipReturn = (0, import_react25.useRef)(false);
|
|
2762
|
+
(0, import_react25.useEffect)(() => {
|
|
2709
2763
|
if (!open || modal) return;
|
|
2710
2764
|
skipReturn.current = false;
|
|
2711
2765
|
return installNonModalPopover({
|
|
@@ -2720,9 +2774,9 @@ function KjunPopover({
|
|
|
2720
2774
|
}
|
|
2721
2775
|
});
|
|
2722
2776
|
});
|
|
2723
|
-
const content = /* @__PURE__ */ (0,
|
|
2724
|
-
return /* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2777
|
+
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 });
|
|
2778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2726
2780
|
"div",
|
|
2727
2781
|
{
|
|
2728
2782
|
ref,
|
|
@@ -2742,7 +2796,7 @@ function KjunPopover({
|
|
|
2742
2796
|
children: typeof trigger === "function" ? trigger(open) : trigger
|
|
2743
2797
|
}
|
|
2744
2798
|
),
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2746
2800
|
FloatingPanel,
|
|
2747
2801
|
{
|
|
2748
2802
|
open,
|
|
@@ -2764,12 +2818,12 @@ function KjunPopover({
|
|
|
2764
2818
|
className: "kjun-popover-dialog",
|
|
2765
2819
|
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens18.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
2766
2820
|
};
|
|
2767
|
-
const body = /* @__PURE__ */ (0,
|
|
2768
|
-
header != null && /* @__PURE__ */ (0,
|
|
2769
|
-
header != null ? /* @__PURE__ */ (0,
|
|
2770
|
-
/* @__PURE__ */ (0,
|
|
2821
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2822
|
+
header != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
2823
|
+
header != null ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "kjun-popover-body", children: content }) : content,
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FeedbackLayerOutlet, {})
|
|
2771
2825
|
] });
|
|
2772
|
-
return modal ? /* @__PURE__ */ (0,
|
|
2826
|
+
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
2827
|
})()
|
|
2774
2828
|
}
|
|
2775
2829
|
)
|
|
@@ -2784,15 +2838,15 @@ function KjunTooltip({
|
|
|
2784
2838
|
children
|
|
2785
2839
|
}) {
|
|
2786
2840
|
const container = useKjunPortalContainer();
|
|
2787
|
-
const [internal, setInternal] = (0,
|
|
2841
|
+
const [internal, setInternal] = (0, import_react25.useState)(false), open = controlled != null ? controlled : internal;
|
|
2788
2842
|
const setOpen = (value) => {
|
|
2789
2843
|
setInternal(value);
|
|
2790
2844
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
2791
2845
|
};
|
|
2792
2846
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
2793
|
-
return /* @__PURE__ */ (0,
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
container !== null && /* @__PURE__ */ (0,
|
|
2847
|
+
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: [
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_aria_components4.Focusable, { children }),
|
|
2849
|
+
container !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2796
2850
|
import_react_aria_components4.Tooltip,
|
|
2797
2851
|
{
|
|
2798
2852
|
style: { zIndex: layer.zIndex },
|
|
@@ -2801,7 +2855,7 @@ function KjunTooltip({
|
|
|
2801
2855
|
offset: import_tokens18.tokens.extensions.floating.anchorGap,
|
|
2802
2856
|
className: "kjun-scope kjun-tooltip",
|
|
2803
2857
|
children: [
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2858
|
+
/* @__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
2859
|
content
|
|
2806
2860
|
]
|
|
2807
2861
|
}
|
|
@@ -2811,10 +2865,10 @@ function KjunTooltip({
|
|
|
2811
2865
|
|
|
2812
2866
|
// packages/react/src/dropdown.tsx
|
|
2813
2867
|
var import_tokens19 = require("@kjun-ui/tokens");
|
|
2814
|
-
var
|
|
2868
|
+
var import_react26 = require("react");
|
|
2815
2869
|
var import_react_aria_components5 = require("react-aria-components");
|
|
2816
|
-
var
|
|
2817
|
-
var DropdownContext = (0,
|
|
2870
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2871
|
+
var DropdownContext = (0, import_react26.createContext)(null);
|
|
2818
2872
|
function KjunDropdown({
|
|
2819
2873
|
disabled = false,
|
|
2820
2874
|
placement = "bottom-start",
|
|
@@ -2826,10 +2880,10 @@ function KjunDropdown({
|
|
|
2826
2880
|
onOpen,
|
|
2827
2881
|
onClose
|
|
2828
2882
|
}) {
|
|
2829
|
-
const [open, setOpen] = (0,
|
|
2830
|
-
const menuFocusCleanup = (0,
|
|
2883
|
+
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)();
|
|
2884
|
+
const menuFocusCleanup = (0, import_react26.useRef)(() => {
|
|
2831
2885
|
});
|
|
2832
|
-
const bindMenu = (0,
|
|
2886
|
+
const bindMenu = (0, import_react26.useCallback)((menu) => {
|
|
2833
2887
|
menuFocusCleanup.current();
|
|
2834
2888
|
menuFocusCleanup.current = () => {
|
|
2835
2889
|
};
|
|
@@ -2851,19 +2905,19 @@ function KjunDropdown({
|
|
|
2851
2905
|
};
|
|
2852
2906
|
}, []);
|
|
2853
2907
|
let control = trigger;
|
|
2854
|
-
while ((0,
|
|
2908
|
+
while ((0, import_react26.isValidElement)(control) && control.type === KjunTooltip)
|
|
2855
2909
|
control = control.props.children;
|
|
2856
|
-
const unavailable = disabled || (0,
|
|
2857
|
-
const controlId = triggerId || (0,
|
|
2910
|
+
const unavailable = disabled || (0, import_react26.isValidElement)(control) && !!(control.props.disabled || control.props.loading);
|
|
2911
|
+
const controlId = triggerId || (0, import_react26.isValidElement)(control) && control.props.id || id;
|
|
2858
2912
|
const popupId = menuId || id + "-menu";
|
|
2859
2913
|
const bindTrigger = (node) => {
|
|
2860
|
-
if (!(0,
|
|
2914
|
+
if (!(0, import_react26.isValidElement)(node)) return node;
|
|
2861
2915
|
if (node.type === KjunTooltip) {
|
|
2862
2916
|
const tooltip = node;
|
|
2863
|
-
return (0,
|
|
2917
|
+
return (0, import_react26.cloneElement)(tooltip, {}, bindTrigger(tooltip.props.children));
|
|
2864
2918
|
}
|
|
2865
2919
|
const button = node;
|
|
2866
|
-
return (0,
|
|
2920
|
+
return (0, import_react26.cloneElement)(button, {
|
|
2867
2921
|
id: controlId,
|
|
2868
2922
|
"aria-haspopup": "menu",
|
|
2869
2923
|
"aria-expanded": open,
|
|
@@ -2880,11 +2934,11 @@ function KjunDropdown({
|
|
|
2880
2934
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
2881
2935
|
else onClose == null ? void 0 : onClose();
|
|
2882
2936
|
};
|
|
2883
|
-
(0,
|
|
2937
|
+
(0, import_react26.useEffect)(() => {
|
|
2884
2938
|
if (unavailable) change(false);
|
|
2885
2939
|
}, [unavailable]);
|
|
2886
|
-
return /* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownContext.Provider, { value: () => change(false), children: [
|
|
2941
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2888
2942
|
"div",
|
|
2889
2943
|
{
|
|
2890
2944
|
ref,
|
|
@@ -2896,10 +2950,10 @@ function KjunDropdown({
|
|
|
2896
2950
|
change(true);
|
|
2897
2951
|
}
|
|
2898
2952
|
},
|
|
2899
|
-
children: /* @__PURE__ */ (0,
|
|
2953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: bindTrigger(trigger) })
|
|
2900
2954
|
}
|
|
2901
2955
|
),
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2903
2957
|
FloatingPanel,
|
|
2904
2958
|
{
|
|
2905
2959
|
open,
|
|
@@ -2907,7 +2961,7 @@ function KjunDropdown({
|
|
|
2907
2961
|
triggerRef: ref,
|
|
2908
2962
|
placement,
|
|
2909
2963
|
className: "kjun-dropdown",
|
|
2910
|
-
children: /* @__PURE__ */ (0,
|
|
2964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2911
2965
|
import_react_aria_components5.Menu,
|
|
2912
2966
|
{
|
|
2913
2967
|
ref: bindMenu,
|
|
@@ -2933,8 +2987,8 @@ function KjunDropdownItem({
|
|
|
2933
2987
|
children,
|
|
2934
2988
|
onClick
|
|
2935
2989
|
}) {
|
|
2936
|
-
const close = (0,
|
|
2937
|
-
const node = (0,
|
|
2990
|
+
const close = (0, import_react26.useContext)(DropdownContext);
|
|
2991
|
+
const node = (0, import_react26.useCallback)((element) => {
|
|
2938
2992
|
if (!element) return;
|
|
2939
2993
|
if (selected === null) {
|
|
2940
2994
|
element.setAttribute("role", "menuitem");
|
|
@@ -2944,7 +2998,7 @@ function KjunDropdownItem({
|
|
|
2944
2998
|
element.setAttribute("role", "menuitemradio");
|
|
2945
2999
|
element.setAttribute("aria-checked", String(selected));
|
|
2946
3000
|
}, [selected]);
|
|
2947
|
-
return /* @__PURE__ */ (0,
|
|
3001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2948
3002
|
import_react_aria_components5.MenuItem,
|
|
2949
3003
|
{
|
|
2950
3004
|
ref: node,
|
|
@@ -2959,9 +3013,9 @@ function KjunDropdownItem({
|
|
|
2959
3013
|
close == null ? void 0 : close();
|
|
2960
3014
|
},
|
|
2961
3015
|
children: [
|
|
2962
|
-
icon && /* @__PURE__ */ (0,
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2964
|
-
selected !== null && /* @__PURE__ */ (0,
|
|
3016
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(KjunIcon, { name: icon, className: "kjun-menu-icon", size: import_tokens19.tokens.extensions.menu.iconSize }),
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children }),
|
|
3018
|
+
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2965
3019
|
KjunIcon,
|
|
2966
3020
|
{
|
|
2967
3021
|
name: "check",
|
|
@@ -2975,7 +3029,7 @@ function KjunDropdownItem({
|
|
|
2975
3029
|
);
|
|
2976
3030
|
}
|
|
2977
3031
|
function KjunDropdownDivider() {
|
|
2978
|
-
return /* @__PURE__ */ (0,
|
|
3032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components5.Separator, { className: "kjun-menu-divider" });
|
|
2979
3033
|
}
|
|
2980
3034
|
function KjunMenuButton({
|
|
2981
3035
|
label,
|
|
@@ -2991,8 +3045,8 @@ function KjunMenuButton({
|
|
|
2991
3045
|
onClose,
|
|
2992
3046
|
...props
|
|
2993
3047
|
}) {
|
|
2994
|
-
const [open, setOpen] = (0,
|
|
2995
|
-
const button = /* @__PURE__ */ (0,
|
|
3048
|
+
const [open, setOpen] = (0, import_react26.useState)(false);
|
|
3049
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2996
3050
|
KjunButton,
|
|
2997
3051
|
{
|
|
2998
3052
|
className: "kjun-menu-button",
|
|
@@ -3006,7 +3060,7 @@ function KjunMenuButton({
|
|
|
3006
3060
|
children: compact ? void 0 : label
|
|
3007
3061
|
}
|
|
3008
3062
|
);
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3010
3064
|
KjunDropdown,
|
|
3011
3065
|
{
|
|
3012
3066
|
...props,
|
|
@@ -3018,7 +3072,7 @@ function KjunMenuButton({
|
|
|
3018
3072
|
setOpen(false);
|
|
3019
3073
|
onClose == null ? void 0 : onClose();
|
|
3020
3074
|
},
|
|
3021
|
-
trigger: tooltip ? /* @__PURE__ */ (0,
|
|
3075
|
+
trigger: tooltip ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3022
3076
|
KjunTooltip,
|
|
3023
3077
|
{
|
|
3024
3078
|
content: open ? "" : tooltip,
|
|
@@ -3045,7 +3099,7 @@ function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
|
3045
3099
|
|
|
3046
3100
|
// packages/react/src/drawer.tsx
|
|
3047
3101
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3048
|
-
var
|
|
3102
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3049
3103
|
function KjunDrawer({
|
|
3050
3104
|
open,
|
|
3051
3105
|
onOpenChange,
|
|
@@ -3076,7 +3130,7 @@ function KjunDrawer({
|
|
|
3076
3130
|
if (closeOnEsc) close();
|
|
3077
3131
|
});
|
|
3078
3132
|
if (container === null) return null;
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3080
3134
|
import_react_aria_components6.ModalOverlay,
|
|
3081
3135
|
{
|
|
3082
3136
|
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
@@ -3093,7 +3147,7 @@ function KjunDrawer({
|
|
|
3093
3147
|
"data-motion-open": String(motion.active),
|
|
3094
3148
|
inert: !open || !layer.active,
|
|
3095
3149
|
"data-position": position,
|
|
3096
|
-
children: /* @__PURE__ */ (0,
|
|
3150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3097
3151
|
import_react_aria_components6.Modal,
|
|
3098
3152
|
{
|
|
3099
3153
|
className: "kjun-drawer",
|
|
@@ -3101,7 +3155,7 @@ function KjunDrawer({
|
|
|
3101
3155
|
zIndex: layer.state.zIndex(layer.id, "content"),
|
|
3102
3156
|
width: position === "left" || position === "right" ? width : "100%"
|
|
3103
3157
|
},
|
|
3104
|
-
children: /* @__PURE__ */ (0,
|
|
3158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3105
3159
|
import_react_aria_components6.Dialog,
|
|
3106
3160
|
{
|
|
3107
3161
|
"aria-label": ariaLabel || title || "\uD328\uB110",
|
|
@@ -3111,9 +3165,9 @@ function KjunDrawer({
|
|
|
3111
3165
|
if (entry) entry.root = node;
|
|
3112
3166
|
},
|
|
3113
3167
|
children: [
|
|
3114
|
-
(title || header || closable) && /* @__PURE__ */ (0,
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3116
|
-
closable && /* @__PURE__ */ (0,
|
|
3168
|
+
(title || header || closable) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "kjun-drawer-header", children: [
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: header || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h2", { children: title }) }),
|
|
3170
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3117
3171
|
KjunButton,
|
|
3118
3172
|
{
|
|
3119
3173
|
size: "sm",
|
|
@@ -3121,11 +3175,11 @@ function KjunDrawer({
|
|
|
3121
3175
|
ariaLabel: "\uB2EB\uAE30",
|
|
3122
3176
|
onClick: close,
|
|
3123
3177
|
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,
|
|
3178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: "x", size: import_tokens20.tokens.extensions.drawer.closeIconSize })
|
|
3125
3179
|
}
|
|
3126
3180
|
)
|
|
3127
3181
|
] }),
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3182
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3129
3183
|
"div",
|
|
3130
3184
|
{
|
|
3131
3185
|
className: "kjun-drawer-body",
|
|
@@ -3133,8 +3187,8 @@ function KjunDrawer({
|
|
|
3133
3187
|
children
|
|
3134
3188
|
}
|
|
3135
3189
|
),
|
|
3136
|
-
footer && /* @__PURE__ */ (0,
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3190
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "kjun-drawer-footer", children: footer }),
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FeedbackLayerOutlet, {})
|
|
3138
3192
|
]
|
|
3139
3193
|
}
|
|
3140
3194
|
)
|
|
@@ -3145,7 +3199,7 @@ function KjunDrawer({
|
|
|
3145
3199
|
}
|
|
3146
3200
|
|
|
3147
3201
|
// shared/package-runtime/combobox.ts
|
|
3148
|
-
var
|
|
3202
|
+
var import_react27 = require("react");
|
|
3149
3203
|
|
|
3150
3204
|
// shared/package-runtime/options.ts
|
|
3151
3205
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3222,10 +3276,10 @@ function useComboboxModel({
|
|
|
3222
3276
|
}) {
|
|
3223
3277
|
const selected = options.find((option) => optionValue(option, valueKey) === value);
|
|
3224
3278
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3225
|
-
const [query2, setQuery] = (0,
|
|
3226
|
-
const [open, setOpen] = (0,
|
|
3227
|
-
(0,
|
|
3228
|
-
(0,
|
|
3279
|
+
const [query2, setQuery] = (0, import_react27.useState)(selectedLabel);
|
|
3280
|
+
const [open, setOpen] = (0, import_react27.useState)(false);
|
|
3281
|
+
(0, import_react27.useEffect)(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3282
|
+
(0, import_react27.useEffect)(() => {
|
|
3229
3283
|
if (disabled) setOpen(false);
|
|
3230
3284
|
}, [disabled]);
|
|
3231
3285
|
const change = (next) => {
|
|
@@ -3258,8 +3312,8 @@ function useComboboxModel({
|
|
|
3258
3312
|
}
|
|
3259
3313
|
|
|
3260
3314
|
// packages/react/src/combobox.tsx
|
|
3261
|
-
var
|
|
3262
|
-
var
|
|
3315
|
+
var import_react28 = require("react");
|
|
3316
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3263
3317
|
function KjunCombobox({
|
|
3264
3318
|
value,
|
|
3265
3319
|
options = [],
|
|
@@ -3291,7 +3345,7 @@ function KjunCombobox({
|
|
|
3291
3345
|
onSearch,
|
|
3292
3346
|
onClear
|
|
3293
3347
|
});
|
|
3294
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3295
3349
|
SearchField,
|
|
3296
3350
|
{
|
|
3297
3351
|
error,
|
|
@@ -3338,12 +3392,12 @@ function SearchField({
|
|
|
3338
3392
|
onEnter
|
|
3339
3393
|
}) {
|
|
3340
3394
|
const composition = useCompositionGuard();
|
|
3341
|
-
const clearing = (0,
|
|
3342
|
-
const ref = (0,
|
|
3395
|
+
const clearing = (0, import_react28.useRef)(false);
|
|
3396
|
+
const ref = (0, import_react28.useRef)(null), [highlighted, setActive] = (0, import_react28.useState)(-1), id = "kjun-" + (0, import_react28.useId)();
|
|
3343
3397
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3344
3398
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3345
|
-
(0,
|
|
3346
|
-
(0,
|
|
3399
|
+
(0, import_react28.useEffect)(() => setActive(-1), [value, options.length]);
|
|
3400
|
+
(0, import_react28.useEffect)(() => {
|
|
3347
3401
|
if (!open) return;
|
|
3348
3402
|
const leaveField = (event) => {
|
|
3349
3403
|
var _a, _b, _c;
|
|
@@ -3353,7 +3407,7 @@ function SearchField({
|
|
|
3353
3407
|
document.addEventListener("focusin", leaveField);
|
|
3354
3408
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3355
3409
|
}, [open, onOpenChange, id]);
|
|
3356
|
-
(0,
|
|
3410
|
+
(0, import_react28.useEffect)(() => {
|
|
3357
3411
|
if (highlighted !== active) setActive(-1);
|
|
3358
3412
|
}, [highlighted, active]);
|
|
3359
3413
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3364,8 +3418,8 @@ function SearchField({
|
|
|
3364
3418
|
onOpenChange(false);
|
|
3365
3419
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3366
3420
|
};
|
|
3367
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3369
3423
|
KjunInput,
|
|
3370
3424
|
{
|
|
3371
3425
|
error,
|
|
@@ -3440,7 +3494,7 @@ function SearchField({
|
|
|
3440
3494
|
}
|
|
3441
3495
|
}
|
|
3442
3496
|
),
|
|
3443
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3444
3498
|
FloatingPanel,
|
|
3445
3499
|
{
|
|
3446
3500
|
field: true,
|
|
@@ -3451,14 +3505,14 @@ function SearchField({
|
|
|
3451
3505
|
placement: "bottom-start",
|
|
3452
3506
|
matchTriggerWidth: true,
|
|
3453
3507
|
className: "kjun-select-panel",
|
|
3454
|
-
children: /* @__PURE__ */ (0,
|
|
3508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3455
3509
|
"div",
|
|
3456
3510
|
{
|
|
3457
3511
|
id,
|
|
3458
3512
|
role: "listbox",
|
|
3459
3513
|
"aria-label": ariaLabel || placeholder,
|
|
3460
3514
|
onMouseDown: (e) => e.preventDefault(),
|
|
3461
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
3515
|
+
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
3516
|
"div",
|
|
3463
3517
|
{
|
|
3464
3518
|
id: id + "-" + i,
|
|
@@ -3476,7 +3530,7 @@ function SearchField({
|
|
|
3476
3530
|
children: (renderOption == null ? void 0 : renderOption(o)) || optionLabel(o, labelKey)
|
|
3477
3531
|
},
|
|
3478
3532
|
optionKey(o, itemKey, i)
|
|
3479
|
-
)) : /* @__PURE__ */ (0,
|
|
3533
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "kjun-select-empty", children: emptyText })
|
|
3480
3534
|
}
|
|
3481
3535
|
)
|
|
3482
3536
|
}
|
|
@@ -3486,8 +3540,8 @@ function SearchField({
|
|
|
3486
3540
|
|
|
3487
3541
|
// packages/react/src/date-picker.tsx
|
|
3488
3542
|
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3489
|
-
var
|
|
3490
|
-
var
|
|
3543
|
+
var import_react29 = require("react");
|
|
3544
|
+
var import_jsx_runtime19 = (
|
|
3491
3545
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3492
3546
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
3493
3547
|
require("react/jsx-runtime")
|
|
@@ -3503,13 +3557,13 @@ function KjunDatePicker({
|
|
|
3503
3557
|
onBlur,
|
|
3504
3558
|
...props
|
|
3505
3559
|
}) {
|
|
3506
|
-
const [focus, setFocus] = (0,
|
|
3507
|
-
return /* @__PURE__ */ (0,
|
|
3560
|
+
const [focus, setFocus] = (0, import_react29.useState)(false);
|
|
3561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "kjun-date-picker", style: {
|
|
3508
3562
|
position: "relative",
|
|
3509
3563
|
["--_kjun-date-icon-inset"]: import_tokens21.tokens.input[size].padding + "px",
|
|
3510
3564
|
["--_kjun-date-icon-size"]: import_tokens21.tokens.input[size].iconSize + "px"
|
|
3511
3565
|
}, children: [
|
|
3512
|
-
/* @__PURE__ */ (0,
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3513
3567
|
KjunInput,
|
|
3514
3568
|
{
|
|
3515
3569
|
...props,
|
|
@@ -3531,7 +3585,7 @@ function KjunDatePicker({
|
|
|
3531
3585
|
}
|
|
3532
3586
|
}
|
|
3533
3587
|
),
|
|
3534
|
-
!focus && /* @__PURE__ */ (0,
|
|
3588
|
+
!focus && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3535
3589
|
"span",
|
|
3536
3590
|
{
|
|
3537
3591
|
"aria-hidden": "true",
|
|
@@ -3549,10 +3603,10 @@ function KjunDatePicker({
|
|
|
3549
3603
|
}
|
|
3550
3604
|
|
|
3551
3605
|
// packages/react/src/search-input.tsx
|
|
3552
|
-
var
|
|
3606
|
+
var import_react31 = require("react");
|
|
3553
3607
|
|
|
3554
3608
|
// shared/package-runtime/search-input.ts
|
|
3555
|
-
var
|
|
3609
|
+
var import_react30 = require("react");
|
|
3556
3610
|
function useSearchInputModel({
|
|
3557
3611
|
value,
|
|
3558
3612
|
disabled = false,
|
|
@@ -3562,20 +3616,20 @@ function useSearchInputModel({
|
|
|
3562
3616
|
onValueChange,
|
|
3563
3617
|
onSearchError
|
|
3564
3618
|
}, open) {
|
|
3565
|
-
const [query2, setQuery] = (0,
|
|
3619
|
+
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
3620
|
notify.current = onSearchError;
|
|
3567
|
-
const timer = (0,
|
|
3568
|
-
const notifyValue = (0,
|
|
3621
|
+
const timer = (0, import_react30.useRef)(void 0);
|
|
3622
|
+
const notifyValue = (0, import_react30.useRef)(onValueChange);
|
|
3569
3623
|
notifyValue.current = onValueChange;
|
|
3570
|
-
(0,
|
|
3624
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3571
3625
|
clearTimeout(timer.current);
|
|
3572
3626
|
setQuery(value);
|
|
3573
3627
|
}, [value]);
|
|
3574
|
-
(0,
|
|
3628
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3575
3629
|
clearTimeout(timer.current);
|
|
3576
3630
|
return () => clearTimeout(timer.current);
|
|
3577
3631
|
}, [disabled, debounce, !!loadOptions]);
|
|
3578
|
-
(0,
|
|
3632
|
+
(0, import_react30.useEffect)(() => {
|
|
3579
3633
|
const current = ++version.current, abort = new AbortController();
|
|
3580
3634
|
setFailed(false);
|
|
3581
3635
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -3639,7 +3693,7 @@ function useSearchInputModel({
|
|
|
3639
3693
|
}
|
|
3640
3694
|
|
|
3641
3695
|
// packages/react/src/search-input.tsx
|
|
3642
|
-
var
|
|
3696
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3643
3697
|
function KjunSearchInput({
|
|
3644
3698
|
value,
|
|
3645
3699
|
placeholder = "\uAC80\uC0C9...",
|
|
@@ -3662,7 +3716,7 @@ function KjunSearchInput({
|
|
|
3662
3716
|
onEnter,
|
|
3663
3717
|
onClear
|
|
3664
3718
|
}) {
|
|
3665
|
-
const [open, setOpen] = (0,
|
|
3719
|
+
const [open, setOpen] = (0, import_react31.useState)(false);
|
|
3666
3720
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
3667
3721
|
const { query: query2, options, loading, failed } = model;
|
|
3668
3722
|
const update = (value2) => {
|
|
@@ -3675,7 +3729,7 @@ function KjunSearchInput({
|
|
|
3675
3729
|
onClear == null ? void 0 : onClear();
|
|
3676
3730
|
};
|
|
3677
3731
|
if (!loadOptions)
|
|
3678
|
-
return /* @__PURE__ */ (0,
|
|
3732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3679
3733
|
KjunInput,
|
|
3680
3734
|
{
|
|
3681
3735
|
error,
|
|
@@ -3691,7 +3745,7 @@ function KjunSearchInput({
|
|
|
3691
3745
|
onEnter
|
|
3692
3746
|
}
|
|
3693
3747
|
);
|
|
3694
|
-
return /* @__PURE__ */ (0,
|
|
3748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3695
3749
|
SearchField,
|
|
3696
3750
|
{
|
|
3697
3751
|
error,
|
|
@@ -3725,20 +3779,20 @@ function KjunSearchInput({
|
|
|
3725
3779
|
|
|
3726
3780
|
// packages/react/src/select-control.tsx
|
|
3727
3781
|
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3728
|
-
var
|
|
3782
|
+
var import_react34 = require("react");
|
|
3729
3783
|
var import_react_aria_components7 = require("react-aria-components");
|
|
3730
3784
|
|
|
3731
3785
|
// shared/package-runtime/select.ts
|
|
3732
|
-
var
|
|
3786
|
+
var import_react32 = require("react");
|
|
3733
3787
|
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,
|
|
3788
|
+
const [internal, setInternal] = (0, import_react32.useState)(false);
|
|
3789
|
+
const [query2, setQuery] = (0, import_react32.useState)("");
|
|
3790
|
+
const [limit, setLimit] = (0, import_react32.useState)(pageSize);
|
|
3791
|
+
const [session, setSession] = (0, import_react32.useState)(0);
|
|
3738
3792
|
const isControlled = typeof controlled === "boolean";
|
|
3739
3793
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
3740
|
-
const previousOpen = (0,
|
|
3741
|
-
(0,
|
|
3794
|
+
const previousOpen = (0, import_react32.useRef)(open);
|
|
3795
|
+
(0, import_react32.useEffect)(() => {
|
|
3742
3796
|
if (disabled && !isControlled) setInternal(false);
|
|
3743
3797
|
if (previousOpen.current && !open) {
|
|
3744
3798
|
setQuery("");
|
|
@@ -3747,7 +3801,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3747
3801
|
}
|
|
3748
3802
|
previousOpen.current = open;
|
|
3749
3803
|
}, [open, disabled, isControlled, pageSize]);
|
|
3750
|
-
(0,
|
|
3804
|
+
(0, import_react32.useEffect)(() => {
|
|
3751
3805
|
setLimit(pageSize);
|
|
3752
3806
|
}, [pageSize]);
|
|
3753
3807
|
const changeOpen = (next) => {
|
|
@@ -3763,11 +3817,11 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3763
3817
|
}
|
|
3764
3818
|
|
|
3765
3819
|
// packages/react/src/compound-control.ts
|
|
3766
|
-
var
|
|
3767
|
-
var CompoundControlContext = (0,
|
|
3820
|
+
var import_react33 = require("react");
|
|
3821
|
+
var CompoundControlContext = (0, import_react33.createContext)(null);
|
|
3768
3822
|
|
|
3769
3823
|
// packages/react/src/select-control.tsx
|
|
3770
|
-
var
|
|
3824
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3771
3825
|
function KjunSelect({
|
|
3772
3826
|
value,
|
|
3773
3827
|
options = [],
|
|
@@ -3800,17 +3854,17 @@ function KjunSelect({
|
|
|
3800
3854
|
}) {
|
|
3801
3855
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
3802
3856
|
const composition = useCompositionGuard();
|
|
3803
|
-
const ref = (0,
|
|
3804
|
-
const segment = (0,
|
|
3857
|
+
const ref = (0, import_react34.useRef)(null), menu = (0, import_react34.useRef)(null), field = useKjunField(), id = "kjun-" + (0, import_react34.useId)();
|
|
3858
|
+
const segment = (0, import_react34.useContext)(CompoundControlContext) !== null;
|
|
3805
3859
|
const spec = import_tokens22.tokens.input[size];
|
|
3806
3860
|
const expanded = usePopupExpanded(open, ref);
|
|
3807
3861
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
3808
|
-
(0,
|
|
3862
|
+
(0, import_react34.useEffect)(() => {
|
|
3809
3863
|
if (!registerControl || !triggerId) return;
|
|
3810
3864
|
registerControl(triggerId);
|
|
3811
3865
|
return () => registerControl(void 0);
|
|
3812
3866
|
}, [registerControl, triggerId]);
|
|
3813
|
-
(0,
|
|
3867
|
+
(0, import_react34.useEffect)(() => {
|
|
3814
3868
|
var _a, _b;
|
|
3815
3869
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
3816
3870
|
if (!open) composition.onCompositionEnd();
|
|
@@ -3832,9 +3886,9 @@ function KjunSelect({
|
|
|
3832
3886
|
filterFn,
|
|
3833
3887
|
searchKeys
|
|
3834
3888
|
});
|
|
3835
|
-
return /* @__PURE__ */ (0,
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3837
|
-
/* @__PURE__ */ (0,
|
|
3889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3890
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "kjun-select-shell", children: [
|
|
3891
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3838
3892
|
"button",
|
|
3839
3893
|
{
|
|
3840
3894
|
ref,
|
|
@@ -3865,12 +3919,12 @@ function KjunSelect({
|
|
|
3865
3919
|
}
|
|
3866
3920
|
},
|
|
3867
3921
|
children: [
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3922
|
+
/* @__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 }),
|
|
3923
|
+
/* @__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
3924
|
]
|
|
3871
3925
|
}
|
|
3872
3926
|
),
|
|
3873
|
-
clearable && !!label && /* @__PURE__ */ (0,
|
|
3927
|
+
clearable && !!label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3874
3928
|
KjunButton,
|
|
3875
3929
|
{
|
|
3876
3930
|
size: "sm",
|
|
@@ -3892,11 +3946,11 @@ function KjunSelect({
|
|
|
3892
3946
|
onClear == null ? void 0 : onClear();
|
|
3893
3947
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3894
3948
|
},
|
|
3895
|
-
children: /* @__PURE__ */ (0,
|
|
3949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "x", size: spec.iconSize })
|
|
3896
3950
|
}
|
|
3897
3951
|
)
|
|
3898
3952
|
] }),
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3900
3954
|
FloatingPanel,
|
|
3901
3955
|
{
|
|
3902
3956
|
field: true,
|
|
@@ -3906,9 +3960,9 @@ function KjunSelect({
|
|
|
3906
3960
|
placement: "bottom-start",
|
|
3907
3961
|
matchTriggerWidth: true,
|
|
3908
3962
|
className: "kjun-select-panel kjun-select-options-panel",
|
|
3909
|
-
children: /* @__PURE__ */ (0,
|
|
3910
|
-
menuHeader && /* @__PURE__ */ (0,
|
|
3911
|
-
searchable && /* @__PURE__ */ (0,
|
|
3963
|
+
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: [
|
|
3964
|
+
menuHeader && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-header", children: menuHeader }),
|
|
3965
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-search", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3912
3966
|
KjunInput,
|
|
3913
3967
|
{
|
|
3914
3968
|
autoFocus: true,
|
|
@@ -3939,8 +3993,8 @@ function KjunSelect({
|
|
|
3939
3993
|
}
|
|
3940
3994
|
}
|
|
3941
3995
|
) }),
|
|
3942
|
-
loading && /* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
3996
|
+
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..." }) }),
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3944
3998
|
import_react_aria_components7.ListBox,
|
|
3945
3999
|
{
|
|
3946
4000
|
id,
|
|
@@ -3957,7 +4011,7 @@ function KjunSelect({
|
|
|
3957
4011
|
),
|
|
3958
4012
|
autoFocus: searchable ? false : "first",
|
|
3959
4013
|
className: "kjun-listbox",
|
|
3960
|
-
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0,
|
|
4014
|
+
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3961
4015
|
import_react_aria_components7.ListBoxItem,
|
|
3962
4016
|
{
|
|
3963
4017
|
id: key,
|
|
@@ -3969,8 +4023,8 @@ function KjunSelect({
|
|
|
3969
4023
|
textValue: optionLabel(o, labelKey),
|
|
3970
4024
|
className: "kjun-option",
|
|
3971
4025
|
children: [
|
|
3972
|
-
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0,
|
|
3973
|
-
selected(o) && /* @__PURE__ */ (0,
|
|
4026
|
+
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: optionLabel(o, labelKey) }),
|
|
4027
|
+
selected(o) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "check", size: import_tokens22.tokens.extensions.menu.iconSize })
|
|
3974
4028
|
]
|
|
3975
4029
|
},
|
|
3976
4030
|
key
|
|
@@ -3978,8 +4032,8 @@ function KjunSelect({
|
|
|
3978
4032
|
},
|
|
3979
4033
|
session
|
|
3980
4034
|
),
|
|
3981
|
-
!loading && !matching.length && /* @__PURE__ */ (0,
|
|
3982
|
-
!loading && visible.length < matching.length && /* @__PURE__ */ (0,
|
|
4035
|
+
!loading && !matching.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "kjun-select-empty", children: "\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }),
|
|
4036
|
+
!loading && visible.length < matching.length && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3983
4037
|
KjunButton,
|
|
3984
4038
|
{
|
|
3985
4039
|
size: "sm",
|
|
@@ -4000,17 +4054,17 @@ var import_tokens24 = require("@kjun-ui/tokens");
|
|
|
4000
4054
|
|
|
4001
4055
|
// packages/react/src/collapse.tsx
|
|
4002
4056
|
var import_tokens23 = require("@kjun-ui/tokens");
|
|
4003
|
-
var
|
|
4004
|
-
var
|
|
4057
|
+
var import_react35 = require("react");
|
|
4058
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4005
4059
|
function Collapse({ open, children }) {
|
|
4006
4060
|
const reduced = useReducedMotion();
|
|
4007
|
-
const [retained, setRetained] = (0,
|
|
4008
|
-
const root = (0,
|
|
4009
|
-
const animation = (0,
|
|
4010
|
-
const previous = (0,
|
|
4011
|
-
const interrupted = (0,
|
|
4061
|
+
const [retained, setRetained] = (0, import_react35.useState)(open);
|
|
4062
|
+
const root = (0, import_react35.useRef)(null), body = (0, import_react35.useRef)(null);
|
|
4063
|
+
const animation = (0, import_react35.useRef)(null);
|
|
4064
|
+
const previous = (0, import_react35.useRef)(open);
|
|
4065
|
+
const interrupted = (0, import_react35.useRef)(null);
|
|
4012
4066
|
const present = open || retained;
|
|
4013
|
-
(0,
|
|
4067
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
4014
4068
|
const el = root.current, inner = body.current;
|
|
4015
4069
|
if (!el || !inner) return;
|
|
4016
4070
|
let disposed = false;
|
|
@@ -4061,14 +4115,14 @@ function Collapse({ open, children }) {
|
|
|
4061
4115
|
}
|
|
4062
4116
|
};
|
|
4063
4117
|
}, [open, reduced, present]);
|
|
4064
|
-
return present ? /* @__PURE__ */ (0,
|
|
4118
|
+
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
4119
|
}
|
|
4066
4120
|
|
|
4067
4121
|
// shared/package-runtime/navigation.ts
|
|
4068
|
-
var
|
|
4122
|
+
var import_react36 = require("react");
|
|
4069
4123
|
function useInitialTab(value, candidate, change) {
|
|
4070
|
-
const requested = (0,
|
|
4071
|
-
(0,
|
|
4124
|
+
const requested = (0, import_react36.useRef)(/* @__PURE__ */ new Set());
|
|
4125
|
+
(0, import_react36.useEffect)(() => {
|
|
4072
4126
|
if (value !== "") {
|
|
4073
4127
|
requested.current.clear();
|
|
4074
4128
|
return;
|
|
@@ -4079,8 +4133,8 @@ function useInitialTab(value, candidate, change) {
|
|
|
4079
4133
|
}, [value, candidate, change]);
|
|
4080
4134
|
}
|
|
4081
4135
|
function useAccordionState(multiple) {
|
|
4082
|
-
const [opened, setOpened] = (0,
|
|
4083
|
-
(0,
|
|
4136
|
+
const [opened, setOpened] = (0, import_react36.useState)(/* @__PURE__ */ new Set());
|
|
4137
|
+
(0, import_react36.useEffect)(() => {
|
|
4084
4138
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4085
4139
|
}, [multiple]);
|
|
4086
4140
|
return {
|
|
@@ -4164,9 +4218,9 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4164
4218
|
}
|
|
4165
4219
|
|
|
4166
4220
|
// packages/react/src/navigation.tsx
|
|
4167
|
-
var
|
|
4221
|
+
var import_react37 = require("react");
|
|
4168
4222
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4169
|
-
var
|
|
4223
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4170
4224
|
function KjunTabs({
|
|
4171
4225
|
value,
|
|
4172
4226
|
items = [],
|
|
@@ -4181,33 +4235,33 @@ function KjunTabs({
|
|
|
4181
4235
|
}) {
|
|
4182
4236
|
var _a;
|
|
4183
4237
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4184
|
-
const panes =
|
|
4185
|
-
|
|
4238
|
+
const panes = import_react37.Children.toArray(children).filter(
|
|
4239
|
+
import_react37.isValidElement
|
|
4186
4240
|
);
|
|
4187
4241
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4188
|
-
(0,
|
|
4242
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4189
4243
|
var _a2;
|
|
4190
4244
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4191
4245
|
if (list) return manageTabList(list, () => {
|
|
4192
4246
|
}, false);
|
|
4193
4247
|
}, [group]);
|
|
4194
|
-
(0,
|
|
4248
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4195
4249
|
var _a2;
|
|
4196
4250
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4197
4251
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4198
4252
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4199
4253
|
}
|
|
4200
4254
|
});
|
|
4201
|
-
const timer = (0,
|
|
4202
|
-
const menuState = (0,
|
|
4255
|
+
const timer = (0, import_react37.useRef)(void 0), press = (0, import_react37.useRef)(null);
|
|
4256
|
+
const menuState = (0, import_react37.useRef)({ tabs, onTabMenu });
|
|
4203
4257
|
menuState.current = { tabs, onTabMenu };
|
|
4204
4258
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4205
4259
|
const clear = () => {
|
|
4206
4260
|
clearTimeout(timer.current);
|
|
4207
4261
|
press.current = null;
|
|
4208
4262
|
};
|
|
4209
|
-
(0,
|
|
4210
|
-
(0,
|
|
4263
|
+
(0, import_react37.useEffect)(() => clear, []);
|
|
4264
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4211
4265
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4212
4266
|
}, [tabs, onTabMenu]);
|
|
4213
4267
|
const change = (name) => {
|
|
@@ -4215,7 +4269,7 @@ function KjunTabs({
|
|
|
4215
4269
|
onChange == null ? void 0 : onChange(name);
|
|
4216
4270
|
};
|
|
4217
4271
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4218
|
-
return /* @__PURE__ */ (0,
|
|
4272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4219
4273
|
import_react_aria_components8.Tabs,
|
|
4220
4274
|
{
|
|
4221
4275
|
selectedKey: value,
|
|
@@ -4224,9 +4278,9 @@ function KjunTabs({
|
|
|
4224
4278
|
"data-variant": variant,
|
|
4225
4279
|
"data-density": density,
|
|
4226
4280
|
children: [
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4228
|
-
/* @__PURE__ */ (0,
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4281
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-tabs-header", children: [
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-tabs-track", ref: group, tabIndex: -1, children: [
|
|
4283
|
+
/* @__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
4284
|
import_react_aria_components8.Tab,
|
|
4231
4285
|
{
|
|
4232
4286
|
id: tab.name,
|
|
@@ -4266,10 +4320,10 @@ function KjunTabs({
|
|
|
4266
4320
|
onTouchEnd: clear,
|
|
4267
4321
|
onTouchCancel: clear,
|
|
4268
4322
|
children: [
|
|
4269
|
-
tab.icon && /* @__PURE__ */ (0,
|
|
4323
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: tab.icon, size: import_tokens24.tokens.extensions.tabs.iconSize }),
|
|
4270
4324
|
" ",
|
|
4271
|
-
/* @__PURE__ */ (0,
|
|
4272
|
-
tab.badge != null && /* @__PURE__ */ (0,
|
|
4325
|
+
/* @__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 }) }),
|
|
4326
|
+
tab.badge != null && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4273
4327
|
"span",
|
|
4274
4328
|
{
|
|
4275
4329
|
className: "kjun-tab-badge",
|
|
@@ -4283,17 +4337,17 @@ function KjunTabs({
|
|
|
4283
4337
|
},
|
|
4284
4338
|
tab.name
|
|
4285
4339
|
)) }),
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4287
4341
|
] }),
|
|
4288
4342
|
actions
|
|
4289
4343
|
] }),
|
|
4290
|
-
children && /* @__PURE__ */ (0,
|
|
4344
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-tab-content", children })
|
|
4291
4345
|
]
|
|
4292
4346
|
}
|
|
4293
4347
|
);
|
|
4294
4348
|
}
|
|
4295
4349
|
function KjunTabPane({ name, children }) {
|
|
4296
|
-
return /* @__PURE__ */ (0,
|
|
4350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4297
4351
|
import_react_aria_components8.TabPanel,
|
|
4298
4352
|
{
|
|
4299
4353
|
id: name,
|
|
@@ -4304,18 +4358,18 @@ function KjunTabPane({ name, children }) {
|
|
|
4304
4358
|
}
|
|
4305
4359
|
);
|
|
4306
4360
|
}
|
|
4307
|
-
var AccordionContext = (0,
|
|
4361
|
+
var AccordionContext = (0, import_react37.createContext)(null);
|
|
4308
4362
|
function KjunAccordion({
|
|
4309
4363
|
multiple = false,
|
|
4310
4364
|
tone = "card",
|
|
4311
4365
|
children
|
|
4312
4366
|
}) {
|
|
4313
4367
|
const state = useAccordionState(multiple);
|
|
4314
|
-
return /* @__PURE__ */ (0,
|
|
4368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4315
4369
|
AccordionContext.Provider,
|
|
4316
4370
|
{
|
|
4317
4371
|
value: state,
|
|
4318
|
-
children: /* @__PURE__ */ (0,
|
|
4372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-accordion", "data-tone": tone, children })
|
|
4319
4373
|
}
|
|
4320
4374
|
);
|
|
4321
4375
|
}
|
|
@@ -4326,12 +4380,12 @@ function KjunAccordionItem({
|
|
|
4326
4380
|
header,
|
|
4327
4381
|
children
|
|
4328
4382
|
}) {
|
|
4329
|
-
const group = (0,
|
|
4330
|
-
(0,
|
|
4383
|
+
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;
|
|
4384
|
+
(0, import_react37.useEffect)(() => {
|
|
4331
4385
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4332
4386
|
}, []);
|
|
4333
|
-
return /* @__PURE__ */ (0,
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-accordion-item", children: [
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4335
4389
|
"button",
|
|
4336
4390
|
{
|
|
4337
4391
|
type: "button",
|
|
@@ -4342,8 +4396,8 @@ function KjunAccordionItem({
|
|
|
4342
4396
|
className: "kjun-accordion-trigger",
|
|
4343
4397
|
onClick: () => group ? group.toggle(id) : setOwn(!own),
|
|
4344
4398
|
children: [
|
|
4345
|
-
/* @__PURE__ */ (0,
|
|
4346
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4347
4401
|
KjunIcon,
|
|
4348
4402
|
{
|
|
4349
4403
|
name: "chevron-down",
|
|
@@ -4355,7 +4409,7 @@ function KjunAccordionItem({
|
|
|
4355
4409
|
]
|
|
4356
4410
|
}
|
|
4357
4411
|
),
|
|
4358
|
-
/* @__PURE__ */ (0,
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4359
4413
|
"div",
|
|
4360
4414
|
{
|
|
4361
4415
|
role: "region",
|
|
@@ -4372,16 +4426,16 @@ function KjunBreadcrumb({
|
|
|
4372
4426
|
renderLink,
|
|
4373
4427
|
ariaLabel = "\uD604\uC7AC \uC704\uCE58"
|
|
4374
4428
|
}) {
|
|
4375
|
-
return /* @__PURE__ */ (0,
|
|
4376
|
-
const label = /* @__PURE__ */ (0,
|
|
4377
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("nav", { "aria-label": ariaLabel, className: "kjun-breadcrumb", children: items.map((item, i) => {
|
|
4430
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4431
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: item.icon, size: import_tokens24.tokens.extensions.breadcrumb.iconSize }),
|
|
4378
4432
|
" ",
|
|
4379
4433
|
item.label
|
|
4380
4434
|
] });
|
|
4381
|
-
return /* @__PURE__ */ (0,
|
|
4382
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
4435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react37.Fragment, { children: [
|
|
4436
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens24.tokens.extensions.breadcrumb.separatorSize }),
|
|
4383
4437
|
" ",
|
|
4384
|
-
item.to && i < items.length - 1 ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ (0,
|
|
4438
|
+
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
4439
|
] }, i);
|
|
4386
4440
|
}) });
|
|
4387
4441
|
}
|
|
@@ -4418,18 +4472,18 @@ function KjunPagination({
|
|
|
4418
4472
|
).filter((v) => v >= 1 && v <= totalPages)
|
|
4419
4473
|
]);
|
|
4420
4474
|
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,
|
|
4475
|
+
const button = (target, label, icon) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4422
4476
|
"button",
|
|
4423
4477
|
{
|
|
4424
4478
|
type: "button",
|
|
4425
4479
|
"aria-label": label,
|
|
4426
4480
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4427
4481
|
onClick: () => change(target),
|
|
4428
|
-
children: /* @__PURE__ */ (0,
|
|
4482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: icon, size: import_tokens24.tokens.extensions.pagination.iconSize })
|
|
4429
4483
|
}
|
|
4430
4484
|
);
|
|
4431
|
-
return /* @__PURE__ */ (0,
|
|
4432
|
-
showInfo && totalRows > 0 ? /* @__PURE__ */ (0,
|
|
4485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("nav", { "aria-label": "\uD398\uC774\uC9C0 \uD0D0\uC0C9", className: "kjun-pagination", children: [
|
|
4486
|
+
showInfo && totalRows > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
4433
4487
|
(current - 1) * pageSize + 1,
|
|
4434
4488
|
" -",
|
|
4435
4489
|
" ",
|
|
@@ -4437,9 +4491,9 @@ function KjunPagination({
|
|
|
4437
4491
|
" / ",
|
|
4438
4492
|
formatter(totalRows),
|
|
4439
4493
|
"\uAC1C"
|
|
4440
|
-
] }) : /* @__PURE__ */ (0,
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4442
|
-
showSizeSelector && /* @__PURE__ */ (0,
|
|
4494
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", {}),
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-controls", children: [
|
|
4496
|
+
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-pagination-size", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4443
4497
|
KjunSelect,
|
|
4444
4498
|
{
|
|
4445
4499
|
size: "sm",
|
|
@@ -4453,20 +4507,20 @@ function KjunPagination({
|
|
|
4453
4507
|
}
|
|
4454
4508
|
}
|
|
4455
4509
|
) }),
|
|
4456
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4510
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-mobile", children: [
|
|
4457
4511
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: current }),
|
|
4460
4514
|
" / ",
|
|
4461
4515
|
totalPages
|
|
4462
4516
|
] }),
|
|
4463
4517
|
button(current + 1, "\uB2E4\uC74C \uD398\uC774\uC9C0", "chevron-right")
|
|
4464
4518
|
] }),
|
|
4465
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4519
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-desktop", children: [
|
|
4466
4520
|
showFirstLast && button(1, "\uCCAB \uD398\uC774\uC9C0", "chevrons-left"),
|
|
4467
4521
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4468
4522
|
pages.map(
|
|
4469
|
-
(n, i) => typeof n === "string" ? /* @__PURE__ */ (0,
|
|
4523
|
+
(n, i) => typeof n === "string" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: "..." }, "dots" + i) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4470
4524
|
"button",
|
|
4471
4525
|
{
|
|
4472
4526
|
type: "button",
|
|
@@ -4487,8 +4541,8 @@ function KjunPagination({
|
|
|
4487
4541
|
|
|
4488
4542
|
// packages/react/src/actions.tsx
|
|
4489
4543
|
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4490
|
-
var
|
|
4491
|
-
var
|
|
4544
|
+
var import_react38 = require("react");
|
|
4545
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4492
4546
|
function KjunIconToggle({
|
|
4493
4547
|
active = false,
|
|
4494
4548
|
activeIcon,
|
|
@@ -4507,8 +4561,8 @@ function KjunIconToggle({
|
|
|
4507
4561
|
onToggle
|
|
4508
4562
|
}) {
|
|
4509
4563
|
var _a;
|
|
4510
|
-
const navigation = (0,
|
|
4511
|
-
return /* @__PURE__ */ (0,
|
|
4564
|
+
const navigation = (0, import_react38.useContext)(TopNavigationContext);
|
|
4565
|
+
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
4566
|
"button",
|
|
4513
4567
|
{
|
|
4514
4568
|
type: "button",
|
|
@@ -4523,7 +4577,7 @@ function KjunIconToggle({
|
|
|
4523
4577
|
e.stopPropagation();
|
|
4524
4578
|
onToggle == null ? void 0 : onToggle();
|
|
4525
4579
|
},
|
|
4526
|
-
children: loading ? navigation ? /* @__PURE__ */ (0,
|
|
4580
|
+
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
4581
|
KjunIcon,
|
|
4528
4582
|
{
|
|
4529
4583
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
@@ -4567,16 +4621,16 @@ function KjunCopyButton({
|
|
|
4567
4621
|
onCopyError
|
|
4568
4622
|
}) {
|
|
4569
4623
|
const feedback = useOptionalKjunFeedback();
|
|
4570
|
-
const [copied, setCopied] = (0,
|
|
4571
|
-
(0,
|
|
4624
|
+
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);
|
|
4625
|
+
(0, import_react38.useEffect)(() => {
|
|
4572
4626
|
mounted.current = true;
|
|
4573
4627
|
return () => {
|
|
4574
4628
|
mounted.current = false;
|
|
4575
4629
|
clearTimeout(timer.current);
|
|
4576
4630
|
};
|
|
4577
4631
|
}, []);
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
4579
|
-
/* @__PURE__ */ (0,
|
|
4632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4633
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4580
4634
|
"button",
|
|
4581
4635
|
{
|
|
4582
4636
|
type: "button",
|
|
@@ -4614,7 +4668,7 @@ function KjunCopyButton({
|
|
|
4614
4668
|
}
|
|
4615
4669
|
},
|
|
4616
4670
|
children: [
|
|
4617
|
-
/* @__PURE__ */ (0,
|
|
4671
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4618
4672
|
KjunIcon,
|
|
4619
4673
|
{
|
|
4620
4674
|
name: copied ? "check" : "copy",
|
|
@@ -4622,11 +4676,11 @@ function KjunCopyButton({
|
|
|
4622
4676
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
4623
4677
|
}
|
|
4624
4678
|
),
|
|
4625
|
-
text && !inline && /* @__PURE__ */ (0,
|
|
4679
|
+
text && !inline && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: copied ? successText : text })
|
|
4626
4680
|
]
|
|
4627
4681
|
}
|
|
4628
4682
|
),
|
|
4629
|
-
/* @__PURE__ */ (0,
|
|
4683
|
+
/* @__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
4684
|
] });
|
|
4631
4685
|
}
|
|
4632
4686
|
function KjunRefreshButton({
|
|
@@ -4648,7 +4702,7 @@ function KjunRefreshButton({
|
|
|
4648
4702
|
const reduced = useReducedMotion();
|
|
4649
4703
|
const label = ariaLabel || [targetName, mode === "text" ? text : "\uC0C8\uB85C\uACE0\uCE68"].filter(Boolean).join(" ");
|
|
4650
4704
|
const hint = (_a = tooltip != null ? tooltip : title) != null ? _a : mode === "icon" ? label : "";
|
|
4651
|
-
return /* @__PURE__ */ (0,
|
|
4705
|
+
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
4706
|
KjunButton,
|
|
4653
4707
|
{
|
|
4654
4708
|
...props,
|
|
@@ -4676,8 +4730,8 @@ function KjunExternalLink({
|
|
|
4676
4730
|
label,
|
|
4677
4731
|
children
|
|
4678
4732
|
}) {
|
|
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,
|
|
4733
|
+
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;
|
|
4734
|
+
return url ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4681
4735
|
"a",
|
|
4682
4736
|
{
|
|
4683
4737
|
href: url,
|
|
@@ -4689,14 +4743,14 @@ function KjunExternalLink({
|
|
|
4689
4743
|
onClick: (e) => e.stopPropagation(),
|
|
4690
4744
|
children: [
|
|
4691
4745
|
body,
|
|
4692
|
-
mode === "text" && /* @__PURE__ */ (0,
|
|
4693
|
-
!name && /* @__PURE__ */ (0,
|
|
4746
|
+
mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(KjunIcon, { name: "external-link", size: import_tokens25.tokens.iconSizes.small, className: "kjun-external-link-icon" }),
|
|
4747
|
+
!name && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kjun-sr-only", children: " (\uC0C8 \uCC3D)" })
|
|
4694
4748
|
]
|
|
4695
4749
|
}
|
|
4696
|
-
) : /* @__PURE__ */ (0,
|
|
4750
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-label": name, children: body });
|
|
4697
4751
|
}
|
|
4698
4752
|
function KjunScrollFade({ children }) {
|
|
4699
|
-
const ref = (0,
|
|
4753
|
+
const ref = (0, import_react38.useRef)(null), [edges, setEdges] = (0, import_react38.useState)({ left: false, right: false });
|
|
4700
4754
|
const update = () => {
|
|
4701
4755
|
const el = ref.current;
|
|
4702
4756
|
if (el)
|
|
@@ -4708,7 +4762,7 @@ function KjunScrollFade({ children }) {
|
|
|
4708
4762
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
4709
4763
|
});
|
|
4710
4764
|
};
|
|
4711
|
-
(0,
|
|
4765
|
+
(0, import_react38.useEffect)(() => {
|
|
4712
4766
|
update();
|
|
4713
4767
|
const observer = new ResizeObserver(update);
|
|
4714
4768
|
if (ref.current) {
|
|
@@ -4718,7 +4772,7 @@ function KjunScrollFade({ children }) {
|
|
|
4718
4772
|
return () => observer.disconnect();
|
|
4719
4773
|
}, [children]);
|
|
4720
4774
|
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,
|
|
4775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4722
4776
|
"div",
|
|
4723
4777
|
{
|
|
4724
4778
|
ref,
|
|
@@ -4732,13 +4786,13 @@ function KjunScrollFade({ children }) {
|
|
|
4732
4786
|
|
|
4733
4787
|
// packages/react/src/data-state.tsx
|
|
4734
4788
|
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4735
|
-
var
|
|
4789
|
+
var import_react40 = require("react");
|
|
4736
4790
|
|
|
4737
4791
|
// shared/package-runtime/use-loading-reveal.ts
|
|
4738
|
-
var
|
|
4792
|
+
var import_react39 = require("react");
|
|
4739
4793
|
function useLoadingReveal(active, delay = 0) {
|
|
4740
|
-
const [revealed, setRevealed] = (0,
|
|
4741
|
-
(0,
|
|
4794
|
+
const [revealed, setRevealed] = (0, import_react39.useState)(false);
|
|
4795
|
+
(0, import_react39.useEffect)(() => {
|
|
4742
4796
|
setRevealed(false);
|
|
4743
4797
|
if (!active || delay <= 0) return;
|
|
4744
4798
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -4748,10 +4802,10 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
4748
4802
|
}
|
|
4749
4803
|
|
|
4750
4804
|
// packages/react/src/data-state.tsx
|
|
4751
|
-
var
|
|
4805
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4752
4806
|
function useQueryDisplay(props) {
|
|
4753
4807
|
var _a;
|
|
4754
|
-
const [state, setState] = (0,
|
|
4808
|
+
const [state, setState] = (0, import_react40.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
|
|
4755
4809
|
let next = state;
|
|
4756
4810
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4757
4811
|
next = (0, import_tokens26.advanceQueryDisplay)(state, props);
|
|
@@ -4785,12 +4839,12 @@ function KjunDataState({
|
|
|
4785
4839
|
...query2
|
|
4786
4840
|
}) {
|
|
4787
4841
|
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,
|
|
4842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-data-state", "aria-busy": !!query2.loading || refreshing, children: [
|
|
4843
|
+
/* @__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: [
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunSpinner, { size: "xs" }),
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: refreshingText })
|
|
4792
4846
|
] }) }),
|
|
4793
|
-
state.initialLoading ? /* @__PURE__ */ (0,
|
|
4847
|
+
state.initialLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4794
4848
|
"div",
|
|
4795
4849
|
{
|
|
4796
4850
|
className: "kjun-data-loading-block",
|
|
@@ -4798,13 +4852,13 @@ function KjunDataState({
|
|
|
4798
4852
|
"aria-label": revealed ? loadingText : void 0,
|
|
4799
4853
|
"aria-hidden": revealed ? void 0 : true,
|
|
4800
4854
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4801
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0,
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
4803
|
-
/* @__PURE__ */ (0,
|
|
4855
|
+
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: [
|
|
4856
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunSpinner, { size: "md" }),
|
|
4857
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: loadingText })
|
|
4804
4858
|
] }))
|
|
4805
4859
|
}
|
|
4806
|
-
) : blockingError ? /* @__PURE__ */ (0,
|
|
4807
|
-
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ (0,
|
|
4860
|
+
) : 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,
|
|
4861
|
+
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4808
4862
|
"div",
|
|
4809
4863
|
{
|
|
4810
4864
|
className: "kjun-data-content" + (concealed ? " kjun-data-concealed" : ""),
|
|
@@ -4817,13 +4871,13 @@ function KjunDataState({
|
|
|
4817
4871
|
},
|
|
4818
4872
|
"content"
|
|
4819
4873
|
),
|
|
4820
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0,
|
|
4874
|
+
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
4875
|
visibleRefreshError,
|
|
4822
4876
|
" \xB7 \uC774\uC804 \uC870\uD68C \uACB0\uACFC\uB97C \uD45C\uC2DC\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."
|
|
4823
4877
|
] }) })
|
|
4824
4878
|
] });
|
|
4825
4879
|
}
|
|
4826
|
-
var KjunErrorBoundary = class extends
|
|
4880
|
+
var KjunErrorBoundary = class extends import_react40.Component {
|
|
4827
4881
|
constructor() {
|
|
4828
4882
|
super(...arguments);
|
|
4829
4883
|
this.state = { error: false };
|
|
@@ -4836,10 +4890,10 @@ var KjunErrorBoundary = class extends import_react39.Component {
|
|
|
4836
4890
|
(_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error, info);
|
|
4837
4891
|
}
|
|
4838
4892
|
render() {
|
|
4839
|
-
return this.state.error ? this.props.fallback || /* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
4893
|
+
return this.state.error ? this.props.fallback || /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "kjun-error-fallback", children: [
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { children: this.props.fallbackMessage || "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4" }),
|
|
4895
|
+
/* @__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." }),
|
|
4896
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4843
4897
|
KjunButton,
|
|
4844
4898
|
{
|
|
4845
4899
|
onClick: () => {
|
|
@@ -4901,37 +4955,37 @@ function webMarketLayout(columns, showActions, widthClass) {
|
|
|
4901
4955
|
}
|
|
4902
4956
|
|
|
4903
4957
|
// packages/react/src/market-layout.tsx
|
|
4904
|
-
var
|
|
4958
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4905
4959
|
function MarketColumns({ columns, showActions, widthClass }) {
|
|
4906
4960
|
const layout = webMarketLayout(columns, showActions, widthClass);
|
|
4907
|
-
return /* @__PURE__ */ (0,
|
|
4908
|
-
showActions && /* @__PURE__ */ (0,
|
|
4909
|
-
layout.columns.map((column, index) => /* @__PURE__ */ (0,
|
|
4961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("colgroup", { children: [
|
|
4962
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("col", { style: { width: marketGeometry.actionsWidth } }),
|
|
4963
|
+
layout.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("col", { ...column }, columns[index].key || index))
|
|
4910
4964
|
] });
|
|
4911
4965
|
}
|
|
4912
4966
|
|
|
4913
4967
|
// packages/react/src/market-skeleton.tsx
|
|
4914
|
-
var
|
|
4968
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4915
4969
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false, alignClass, widthClass }) {
|
|
4916
4970
|
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,
|
|
4971
|
+
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: [
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarketColumns, { columns: cols, showActions, widthClass }),
|
|
4973
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("tr", { children: [
|
|
4974
|
+
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 }) }) }),
|
|
4975
|
+
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
4976
|
] }) }),
|
|
4923
|
-
/* @__PURE__ */ (0,
|
|
4924
|
-
showActions && /* @__PURE__ */ (0,
|
|
4925
|
-
cols.map((col, i) => /* @__PURE__ */ (0,
|
|
4926
|
-
/* @__PURE__ */ (0,
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
4928
|
-
] }) : /* @__PURE__ */ (0,
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tbody", { children: Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("tr", { children: [
|
|
4978
|
+
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 }) }) }),
|
|
4979
|
+
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: [
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens28.tokens.extensions.skeleton.lineHeights.md }),
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens28.tokens.extensions.skeleton.lineHeights.sm })
|
|
4982
|
+
] }) : /* @__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
4983
|
] }, row)) })
|
|
4930
4984
|
] }) });
|
|
4931
4985
|
}
|
|
4932
4986
|
|
|
4933
4987
|
// packages/react/src/skeletons.tsx
|
|
4934
|
-
var
|
|
4988
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4935
4989
|
function KjunListSkeleton({
|
|
4936
4990
|
rows = 8,
|
|
4937
4991
|
variant = "market",
|
|
@@ -4939,10 +4993,10 @@ function KjunListSkeleton({
|
|
|
4939
4993
|
avatarSize = import_tokens29.tokens.extensions.skeleton.listAvatarSize,
|
|
4940
4994
|
quote = true
|
|
4941
4995
|
}) {
|
|
4942
|
-
return /* @__PURE__ */ (0,
|
|
4943
|
-
avatar && /* @__PURE__ */ (0,
|
|
4944
|
-
/* @__PURE__ */ (0,
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
4996
|
+
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: [
|
|
4997
|
+
avatar && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
4998
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-list-skeleton-label", children: [
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4946
5000
|
KjunSkeleton,
|
|
4947
5001
|
{
|
|
4948
5002
|
type: "block",
|
|
@@ -4950,11 +5004,11 @@ function KjunListSkeleton({
|
|
|
4950
5004
|
width: i % 2 ? "80%" : "65%"
|
|
4951
5005
|
}
|
|
4952
5006
|
),
|
|
4953
|
-
/* @__PURE__ */ (0,
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
4954
5008
|
] }),
|
|
4955
|
-
quote && /* @__PURE__ */ (0,
|
|
4956
|
-
/* @__PURE__ */ (0,
|
|
4957
|
-
/* @__PURE__ */ (0,
|
|
5009
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-list-skeleton-quote", children: [
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.quoteHeight, width: import_tokens29.tokens.extensions.skeleton.quoteWidth }),
|
|
5011
|
+
/* @__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
5012
|
] })
|
|
4959
5013
|
] }, i)) });
|
|
4960
5014
|
}
|
|
@@ -4964,19 +5018,19 @@ function KjunFormSkeleton({
|
|
|
4964
5018
|
multiline = false,
|
|
4965
5019
|
size = "md"
|
|
4966
5020
|
}) {
|
|
4967
|
-
return /* @__PURE__ */ (0,
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4968
5022
|
"div",
|
|
4969
5023
|
{
|
|
4970
5024
|
"aria-hidden": "true",
|
|
4971
5025
|
className: "kjun-form-skeleton",
|
|
4972
5026
|
"data-columns": columns,
|
|
4973
5027
|
style: { "--_kjun-form-skeleton-radius": `${import_tokens29.tokens.input[size].radius}px` },
|
|
4974
|
-
children: fields.map((field, i) => /* @__PURE__ */ (0,
|
|
4975
|
-
field ? /* @__PURE__ */ (0,
|
|
5028
|
+
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5029
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "kjun-form-skeleton-label", children: typeof field === "string" ? field : field.label }) : (
|
|
4976
5030
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
4977
|
-
/* @__PURE__ */ (0,
|
|
5031
|
+
/* @__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
5032
|
),
|
|
4979
|
-
/* @__PURE__ */ (0,
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4980
5034
|
KjunSkeleton,
|
|
4981
5035
|
{
|
|
4982
5036
|
type: "block",
|
|
@@ -4997,7 +5051,7 @@ function KjunChartSkeleton({
|
|
|
4997
5051
|
columns = 14
|
|
4998
5052
|
}) {
|
|
4999
5053
|
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
5000
|
-
return /* @__PURE__ */ (0,
|
|
5054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5001
5055
|
"div",
|
|
5002
5056
|
{
|
|
5003
5057
|
className: "kjun-chart-skeleton",
|
|
@@ -5005,11 +5059,11 @@ function KjunChartSkeleton({
|
|
|
5005
5059
|
"data-skeleton": skeleton ? void 0 : "false",
|
|
5006
5060
|
"aria-hidden": revealed ? void 0 : true,
|
|
5007
5061
|
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,
|
|
5062
|
+
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSpinner, { size: "md" }) }),
|
|
5064
|
+
loadingText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { children: loadingText })
|
|
5065
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5066
|
+
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
5067
|
"div",
|
|
5014
5068
|
{
|
|
5015
5069
|
className: "kjun-chart-skeleton-matrix",
|
|
@@ -5019,7 +5073,7 @@ function KjunChartSkeleton({
|
|
|
5019
5073
|
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
5020
5074
|
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
5021
5075
|
},
|
|
5022
|
-
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0,
|
|
5076
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5023
5077
|
"div",
|
|
5024
5078
|
{
|
|
5025
5079
|
className: "kjun-chart-skeleton-cell",
|
|
@@ -5029,7 +5083,7 @@ function KjunChartSkeleton({
|
|
|
5029
5083
|
i
|
|
5030
5084
|
))
|
|
5031
5085
|
}
|
|
5032
|
-
) : /* @__PURE__ */ (0,
|
|
5086
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5033
5087
|
"svg",
|
|
5034
5088
|
{
|
|
5035
5089
|
viewBox: chartFrameViewBox,
|
|
@@ -5037,7 +5091,7 @@ function KjunChartSkeleton({
|
|
|
5037
5091
|
className: "kjun-chart-skeleton-plot",
|
|
5038
5092
|
"data-kjun-chart-part": "plot",
|
|
5039
5093
|
"aria-hidden": "true",
|
|
5040
|
-
children: /* @__PURE__ */ (0,
|
|
5094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5041
5095
|
"path",
|
|
5042
5096
|
{
|
|
5043
5097
|
d: chartFramePath,
|
|
@@ -5049,7 +5103,7 @@ function KjunChartSkeleton({
|
|
|
5049
5103
|
)
|
|
5050
5104
|
}
|
|
5051
5105
|
),
|
|
5052
|
-
loadingText && /* @__PURE__ */ (0,
|
|
5106
|
+
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
5107
|
] })
|
|
5054
5108
|
}
|
|
5055
5109
|
);
|
|
@@ -5057,13 +5111,13 @@ function KjunChartSkeleton({
|
|
|
5057
5111
|
|
|
5058
5112
|
// packages/react/src/financial-display.tsx
|
|
5059
5113
|
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5060
|
-
var
|
|
5114
|
+
var import_react42 = require("react");
|
|
5061
5115
|
|
|
5062
5116
|
// packages/react/src/number-display.tsx
|
|
5063
5117
|
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5064
5118
|
|
|
5065
5119
|
// shared/package-runtime/use-number-motion.ts
|
|
5066
|
-
var
|
|
5120
|
+
var import_react41 = require("react");
|
|
5067
5121
|
|
|
5068
5122
|
// shared/package-runtime/number-motion.ts
|
|
5069
5123
|
var import_tokens30 = require("@kjun-ui/tokens");
|
|
@@ -5109,14 +5163,14 @@ function createNumberMotion(apply) {
|
|
|
5109
5163
|
|
|
5110
5164
|
// shared/package-runtime/use-number-motion.ts
|
|
5111
5165
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5112
|
-
const [display, setDisplay] = (0,
|
|
5113
|
-
const motion = (0,
|
|
5166
|
+
const [display, setDisplay] = (0, import_react41.useState)(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
5167
|
+
const motion = (0, import_react41.useRef)(null);
|
|
5114
5168
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5115
|
-
(0,
|
|
5169
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
5116
5170
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5117
5171
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5118
5172
|
}, [value, animated, fromPrevious, reduced]);
|
|
5119
|
-
(0,
|
|
5173
|
+
(0, import_react41.useLayoutEffect)(() => () => {
|
|
5120
5174
|
var _a;
|
|
5121
5175
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5122
5176
|
motion.current = null;
|
|
@@ -5146,7 +5200,7 @@ function formatRelativeTime(value, now = Date.now()) {
|
|
|
5146
5200
|
}
|
|
5147
5201
|
|
|
5148
5202
|
// packages/react/src/number-display.tsx
|
|
5149
|
-
var
|
|
5203
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5150
5204
|
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
5205
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5152
5206
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5166,10 +5220,10 @@ function KjunAnimatedNumber({
|
|
|
5166
5220
|
className = ""
|
|
5167
5221
|
}) {
|
|
5168
5222
|
const n = useCountUp(value, animated, fromPrevious);
|
|
5169
|
-
return /* @__PURE__ */ (0,
|
|
5170
|
-
prefix && /* @__PURE__ */ (0,
|
|
5171
|
-
/* @__PURE__ */ (0,
|
|
5172
|
-
suffix && /* @__PURE__ */ (0,
|
|
5223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "kjun-animated-number " + className, children: [
|
|
5224
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
5225
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals) }),
|
|
5226
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "kjun-number-affix", "data-side": "suffix", children: suffix })
|
|
5173
5227
|
] });
|
|
5174
5228
|
}
|
|
5175
5229
|
function KjunFreshness({
|
|
@@ -5178,11 +5232,11 @@ function KjunFreshness({
|
|
|
5178
5232
|
fetchedAt,
|
|
5179
5233
|
formatter
|
|
5180
5234
|
}) {
|
|
5181
|
-
return stale ? /* @__PURE__ */ (0,
|
|
5235
|
+
return stale ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5182
5236
|
KjunTooltip,
|
|
5183
5237
|
{
|
|
5184
5238
|
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,
|
|
5239
|
+
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
5240
|
}
|
|
5187
5241
|
) : null;
|
|
5188
5242
|
}
|
|
@@ -5196,14 +5250,14 @@ function KjunPriceCell({
|
|
|
5196
5250
|
flashClass = "",
|
|
5197
5251
|
fromPrevious = true
|
|
5198
5252
|
}) {
|
|
5199
|
-
return value == null ? /* @__PURE__ */ (0,
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
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: [
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5201
5255
|
"span",
|
|
5202
5256
|
{
|
|
5203
5257
|
className: "kjun-price-cell " + flashClass,
|
|
5204
5258
|
ref: domainColorRef(/\bkjun-price-flash-(up|down)/.test(flashClass)),
|
|
5205
5259
|
style: { color: stale ? "var(--_kjun-color-text-tertiary)" : void 0 },
|
|
5206
|
-
children: /* @__PURE__ */ (0,
|
|
5260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5207
5261
|
KjunAnimatedNumber,
|
|
5208
5262
|
{
|
|
5209
5263
|
value,
|
|
@@ -5213,7 +5267,7 @@ function KjunPriceCell({
|
|
|
5213
5267
|
)
|
|
5214
5268
|
}
|
|
5215
5269
|
),
|
|
5216
|
-
showFreshness && /* @__PURE__ */ (0,
|
|
5270
|
+
showFreshness && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunFreshness, { stale, source, fetchedAt })
|
|
5217
5271
|
] });
|
|
5218
5272
|
}
|
|
5219
5273
|
function KjunSignedValue({
|
|
@@ -5232,7 +5286,7 @@ function KjunSignedValue({
|
|
|
5232
5286
|
}) {
|
|
5233
5287
|
const n = finiteNumber(value), role2 = loading || n === null ? "text-secondary" : stale ? "text-tertiary" : n > 0 ? "price-up" : n < 0 ? "price-down" : "price-neutral";
|
|
5234
5288
|
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,
|
|
5289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5236
5290
|
"span",
|
|
5237
5291
|
{
|
|
5238
5292
|
className: "kjun-signed-value",
|
|
@@ -5244,15 +5298,15 @@ function KjunSignedValue({
|
|
|
5244
5298
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5245
5299
|
},
|
|
5246
5300
|
children: [
|
|
5247
|
-
loading ? /* @__PURE__ */ (0,
|
|
5248
|
-
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0,
|
|
5301
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunSkeleton, { type: "block", width: import_tokens31.tokens.extensions.financial.signedSkeletonWidth, height: "1lh" }) : display,
|
|
5302
|
+
!loading && showFreshness && stale && n !== null && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunFreshness, { stale: true })
|
|
5249
5303
|
]
|
|
5250
5304
|
}
|
|
5251
5305
|
);
|
|
5252
5306
|
}
|
|
5253
5307
|
|
|
5254
5308
|
// packages/react/src/financial-display.tsx
|
|
5255
|
-
var
|
|
5309
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5256
5310
|
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
5311
|
function KjunDeviation({
|
|
5258
5312
|
value,
|
|
@@ -5263,11 +5317,11 @@ function KjunDeviation({
|
|
|
5263
5317
|
}) {
|
|
5264
5318
|
const n = finiteNumber(value);
|
|
5265
5319
|
if (n === null)
|
|
5266
|
-
return /* @__PURE__ */ (0,
|
|
5320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5267
5321
|
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
5322
|
if (variant === "badge")
|
|
5269
|
-
return /* @__PURE__ */ (0,
|
|
5270
|
-
/* @__PURE__ */ (0,
|
|
5323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5271
5325
|
KjunBadge,
|
|
5272
5326
|
{
|
|
5273
5327
|
variant: neutral ? "secondary" : n > 0 ? "price-up" : "price-down",
|
|
@@ -5276,11 +5330,11 @@ function KjunDeviation({
|
|
|
5276
5330
|
children: label
|
|
5277
5331
|
}
|
|
5278
5332
|
),
|
|
5279
|
-
!signal ? /* @__PURE__ */ (0,
|
|
5333
|
+
!signal ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "kjun-deviation-signal-slot", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5280
5334
|
KjunTooltip,
|
|
5281
5335
|
{
|
|
5282
5336
|
content: `\uAD34\uB9AC\uC728 ${signalThreshold}% \uCD08\uACFC \u2014 \uCC28\uC775\uAC70\uB798 \uAE30\uD68C \uAC00\uB2A5`,
|
|
5283
|
-
children: /* @__PURE__ */ (0,
|
|
5337
|
+
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
5338
|
KjunIcon,
|
|
5285
5339
|
{
|
|
5286
5340
|
name: "alert-triangle",
|
|
@@ -5291,7 +5345,7 @@ function KjunDeviation({
|
|
|
5291
5345
|
}
|
|
5292
5346
|
)
|
|
5293
5347
|
] });
|
|
5294
|
-
return /* @__PURE__ */ (0,
|
|
5348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5295
5349
|
"span",
|
|
5296
5350
|
{
|
|
5297
5351
|
className: "kjun-deviation",
|
|
@@ -5299,7 +5353,7 @@ function KjunDeviation({
|
|
|
5299
5353
|
"data-variant": variant,
|
|
5300
5354
|
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
|
|
5301
5355
|
children: [
|
|
5302
|
-
variant === "pill" && /* @__PURE__ */ (0,
|
|
5356
|
+
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5303
5357
|
"span",
|
|
5304
5358
|
{
|
|
5305
5359
|
"aria-hidden": "true",
|
|
@@ -5310,7 +5364,7 @@ function KjunDeviation({
|
|
|
5310
5364
|
}
|
|
5311
5365
|
}
|
|
5312
5366
|
),
|
|
5313
|
-
/* @__PURE__ */ (0,
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: label })
|
|
5314
5368
|
]
|
|
5315
5369
|
}
|
|
5316
5370
|
);
|
|
@@ -5326,8 +5380,8 @@ function KjunHeatmapCell({
|
|
|
5326
5380
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5327
5381
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5328
5382
|
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,
|
|
5383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "kjun-heat-cell", ref: domainColorRef(mode === "price"), children: [
|
|
5384
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5331
5385
|
"span",
|
|
5332
5386
|
{
|
|
5333
5387
|
"aria-hidden": "true",
|
|
@@ -5335,7 +5389,7 @@ function KjunHeatmapCell({
|
|
|
5335
5389
|
style: magnitude ? { background: `var(--_kjun-color-${role2})`, opacity: heatMinimum + (heatMaximum - heatMinimum) * magnitude } : { background: "var(--_kjun-color-secondary)" }
|
|
5336
5390
|
}
|
|
5337
5391
|
),
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: children != null ? children : value })
|
|
5339
5393
|
] });
|
|
5340
5394
|
}
|
|
5341
5395
|
function KjunProgressCell({
|
|
@@ -5347,8 +5401,8 @@ function KjunProgressCell({
|
|
|
5347
5401
|
height = import_tokens32.tokens.extensions.financial.progressHeight
|
|
5348
5402
|
}) {
|
|
5349
5403
|
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,
|
|
5404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "kjun-progress-cell", children: [
|
|
5405
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { height }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5352
5406
|
"span",
|
|
5353
5407
|
{
|
|
5354
5408
|
style: {
|
|
@@ -5357,7 +5411,7 @@ function KjunProgressCell({
|
|
|
5357
5411
|
}
|
|
5358
5412
|
}
|
|
5359
5413
|
) }),
|
|
5360
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5414
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
|
|
5361
5415
|
Math.round(percent),
|
|
5362
5416
|
"%"
|
|
5363
5417
|
] })
|
|
@@ -5369,7 +5423,7 @@ function KjunCollectionMark({
|
|
|
5369
5423
|
size = "md"
|
|
5370
5424
|
}) {
|
|
5371
5425
|
const box = import_tokens32.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens32.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5372
|
-
return /* @__PURE__ */ (0,
|
|
5426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5373
5427
|
KjunIcon,
|
|
5374
5428
|
{
|
|
5375
5429
|
ref: domainColorRef(active),
|
|
@@ -5399,7 +5453,7 @@ function KjunExecutionStatusBadge({
|
|
|
5399
5453
|
size = "md"
|
|
5400
5454
|
}) {
|
|
5401
5455
|
const state = status ? executionStates[status] : void 0;
|
|
5402
|
-
return /* @__PURE__ */ (0,
|
|
5456
|
+
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
5457
|
}
|
|
5404
5458
|
function KjunSparkline({
|
|
5405
5459
|
data = [],
|
|
@@ -5412,10 +5466,10 @@ function KjunSparkline({
|
|
|
5412
5466
|
stretch = false,
|
|
5413
5467
|
ariaLabel
|
|
5414
5468
|
}) {
|
|
5415
|
-
const id = "kjun-" + (0,
|
|
5469
|
+
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
5470
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5417
5471
|
).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,
|
|
5472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5419
5473
|
"svg",
|
|
5420
5474
|
{
|
|
5421
5475
|
ref: domainColorRef(!color && semantic === "price" && change !== 0),
|
|
@@ -5428,12 +5482,12 @@ function KjunSparkline({
|
|
|
5428
5482
|
"aria-hidden": !ariaLabel || void 0,
|
|
5429
5483
|
className: "kjun-sparkline",
|
|
5430
5484
|
children: [
|
|
5431
|
-
fill && values.length > 1 && /* @__PURE__ */ (0,
|
|
5432
|
-
/* @__PURE__ */ (0,
|
|
5433
|
-
/* @__PURE__ */ (0,
|
|
5434
|
-
/* @__PURE__ */ (0,
|
|
5485
|
+
fill && values.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5486
|
+
/* @__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: [
|
|
5487
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("stop", { offset: "0%", stopColor: line, stopOpacity: 0.3 }),
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("stop", { offset: "100%", stopColor: line, stopOpacity: 0.05 })
|
|
5435
5489
|
] }) }),
|
|
5436
|
-
/* @__PURE__ */ (0,
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5437
5491
|
"polygon",
|
|
5438
5492
|
{
|
|
5439
5493
|
points: `2,${height - 2} ${points} ${width - 2},${height - 2}`,
|
|
@@ -5441,7 +5495,7 @@ function KjunSparkline({
|
|
|
5441
5495
|
}
|
|
5442
5496
|
)
|
|
5443
5497
|
] }),
|
|
5444
|
-
values.length > 1 ? /* @__PURE__ */ (0,
|
|
5498
|
+
values.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5445
5499
|
"polyline",
|
|
5446
5500
|
{
|
|
5447
5501
|
points,
|
|
@@ -5452,7 +5506,7 @@ function KjunSparkline({
|
|
|
5452
5506
|
strokeLinejoin: "round",
|
|
5453
5507
|
vectorEffect: stretch ? "non-scaling-stroke" : void 0
|
|
5454
5508
|
}
|
|
5455
|
-
) : values.length === 1 ? /* @__PURE__ */ (0,
|
|
5509
|
+
) : values.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("circle", { cx: width / 2, cy: height / 2, r: 2, fill: line }) : null
|
|
5456
5510
|
]
|
|
5457
5511
|
}
|
|
5458
5512
|
);
|
|
@@ -5460,7 +5514,7 @@ function KjunSparkline({
|
|
|
5460
5514
|
|
|
5461
5515
|
// shared/package-runtime/table.ts
|
|
5462
5516
|
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5463
|
-
var
|
|
5517
|
+
var import_react43 = require("react");
|
|
5464
5518
|
|
|
5465
5519
|
// shared/package-runtime/table-model.ts
|
|
5466
5520
|
function getValue(row, key) {
|
|
@@ -5504,11 +5558,11 @@ function useTableModel(props) {
|
|
|
5504
5558
|
expandSingle = false,
|
|
5505
5559
|
onExpandedRowsChange
|
|
5506
5560
|
} = props;
|
|
5507
|
-
const [internalSort, setSort] = (0,
|
|
5561
|
+
const [internalSort, setSort] = (0, import_react43.useState)({
|
|
5508
5562
|
key: "",
|
|
5509
5563
|
order: "asc"
|
|
5510
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5511
|
-
(0,
|
|
5564
|
+
}), [internalExpanded, setExpanded] = (0, import_react43.useState)([]), [search, setSearch] = (0, import_react43.useState)(""), timer = (0, import_react43.useRef)(void 0);
|
|
5565
|
+
(0, import_react43.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
5512
5566
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5513
5567
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5514
5568
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5598,7 +5652,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
5598
5652
|
|
|
5599
5653
|
// packages/react/src/table-toolbar.tsx
|
|
5600
5654
|
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5601
|
-
var
|
|
5655
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5602
5656
|
function TableToolbar({
|
|
5603
5657
|
selectable,
|
|
5604
5658
|
selected,
|
|
@@ -5611,20 +5665,20 @@ function TableToolbar({
|
|
|
5611
5665
|
searchPlaceholder,
|
|
5612
5666
|
toolbar
|
|
5613
5667
|
}) {
|
|
5614
|
-
return /* @__PURE__ */ (0,
|
|
5615
|
-
selectable && selected.length > 0 && /* @__PURE__ */ (0,
|
|
5668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
5669
|
+
selectable && selected.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5616
5670
|
"div",
|
|
5617
5671
|
{
|
|
5618
5672
|
role: "group",
|
|
5619
5673
|
"aria-label": "\uC120\uD0DD \uC791\uC5C5",
|
|
5620
5674
|
className: "kjun-table-selection",
|
|
5621
5675
|
children: [
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("strong", { children: [
|
|
5623
5677
|
selected.length,
|
|
5624
5678
|
"\uAC1C \uC120\uD0DD"
|
|
5625
5679
|
] }),
|
|
5626
|
-
/* @__PURE__ */ (0,
|
|
5627
|
-
/* @__PURE__ */ (0,
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(KjunButton, { size: "xs", variant: "ghost", onClick: toggleAll, children: "\uC804\uCCB4 \uC120\uD0DD" }),
|
|
5681
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5628
5682
|
KjunButton,
|
|
5629
5683
|
{
|
|
5630
5684
|
size: "xs",
|
|
@@ -5637,8 +5691,8 @@ function TableToolbar({
|
|
|
5637
5691
|
]
|
|
5638
5692
|
}
|
|
5639
5693
|
),
|
|
5640
|
-
(searchable || toolbar) && /* @__PURE__ */ (0,
|
|
5641
|
-
searchable && /* @__PURE__ */ (0,
|
|
5694
|
+
(searchable || toolbar) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "kjun-table-toolbar", children: [
|
|
5695
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5642
5696
|
KjunInput,
|
|
5643
5697
|
{
|
|
5644
5698
|
size: "sm",
|
|
@@ -5659,10 +5713,10 @@ function TableToolbar({
|
|
|
5659
5713
|
|
|
5660
5714
|
// packages/react/src/table-grid.tsx
|
|
5661
5715
|
var import_tokens36 = require("@kjun-ui/tokens");
|
|
5662
|
-
var
|
|
5716
|
+
var import_react45 = require("react");
|
|
5663
5717
|
|
|
5664
5718
|
// packages/react/src/table-check.tsx
|
|
5665
|
-
var
|
|
5719
|
+
var import_react44 = require("react");
|
|
5666
5720
|
|
|
5667
5721
|
// shared/package-runtime/component-icons.ts
|
|
5668
5722
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -5670,22 +5724,22 @@ var componentIcons = { minus: import_minus.default };
|
|
|
5670
5724
|
|
|
5671
5725
|
// packages/react/src/table-check.tsx
|
|
5672
5726
|
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5673
|
-
var
|
|
5674
|
-
var TableCheck = (0,
|
|
5727
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5728
|
+
var TableCheck = (0, import_react44.forwardRef)(
|
|
5675
5729
|
function TableCheck2(props, ref) {
|
|
5676
5730
|
const size = import_tokens35.tokens.extensions.checkbox.iconSizes.sm;
|
|
5677
|
-
return /* @__PURE__ */ (0,
|
|
5678
|
-
/* @__PURE__ */ (0,
|
|
5679
|
-
/* @__PURE__ */ (0,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "kjun-table-check", children: [
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("input", { ...props, ref, type: "checkbox" }),
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(KjunIcon, { name: "check", size, className: "kjun-table-check-mark" }),
|
|
5734
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(KjunIcon, { name: "minus", size, className: "kjun-table-check-dash" })
|
|
5681
5735
|
] }) });
|
|
5682
5736
|
}
|
|
5683
5737
|
);
|
|
5684
5738
|
|
|
5685
5739
|
// packages/react/src/table-grid.tsx
|
|
5686
|
-
var
|
|
5740
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5687
5741
|
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,
|
|
5742
|
+
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
5743
|
"table",
|
|
5690
5744
|
{
|
|
5691
5745
|
className: "kjun-table",
|
|
@@ -5694,12 +5748,12 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5694
5748
|
"data-hoverable": hoverable,
|
|
5695
5749
|
"data-striped": striped,
|
|
5696
5750
|
children: [
|
|
5697
|
-
/* @__PURE__ */ (0,
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5698
5752
|
"thead",
|
|
5699
5753
|
{
|
|
5700
5754
|
style: stickyHeader ? { position: "sticky", top: 0, zIndex: 2 } : void 0,
|
|
5701
|
-
children: /* @__PURE__ */ (0,
|
|
5702
|
-
selectable && /* @__PURE__ */ (0,
|
|
5755
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tr", { children: [
|
|
5756
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { scope: "col", className: "kjun-table-action-cell", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5703
5757
|
TableCheck,
|
|
5704
5758
|
{
|
|
5705
5759
|
"aria-label": "\uC804\uCCB4 \uC120\uD0DD",
|
|
@@ -5710,22 +5764,22 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5710
5764
|
onChange: state.toggleAll
|
|
5711
5765
|
}
|
|
5712
5766
|
) }),
|
|
5713
|
-
expandable && /* @__PURE__ */ (0,
|
|
5714
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5767
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { scope: "col", className: "kjun-table-action-cell" }),
|
|
5768
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5715
5769
|
"th",
|
|
5716
5770
|
{
|
|
5717
5771
|
scope: "col",
|
|
5718
5772
|
style: { width: col.width, textAlign: col.align },
|
|
5719
5773
|
className: col.headerClass,
|
|
5720
5774
|
"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,
|
|
5775
|
+
children: col.sortable && sortable !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5722
5776
|
"button",
|
|
5723
5777
|
{
|
|
5724
5778
|
type: "button",
|
|
5725
5779
|
onClick: () => state.sortColumn(col),
|
|
5726
5780
|
children: [
|
|
5727
5781
|
col.label,
|
|
5728
|
-
state.sort.key === col.key && /* @__PURE__ */ (0,
|
|
5782
|
+
state.sort.key === col.key && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5729
5783
|
KjunIcon,
|
|
5730
5784
|
{
|
|
5731
5785
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
@@ -5741,10 +5795,10 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5741
5795
|
] })
|
|
5742
5796
|
}
|
|
5743
5797
|
),
|
|
5744
|
-
/* @__PURE__ */ (0,
|
|
5745
|
-
selectable && /* @__PURE__ */ (0,
|
|
5746
|
-
expandable && /* @__PURE__ */ (0,
|
|
5747
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5798
|
+
/* @__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: [
|
|
5799
|
+
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 }) }),
|
|
5800
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell" }),
|
|
5801
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5748
5802
|
KjunSkeleton,
|
|
5749
5803
|
{
|
|
5750
5804
|
type: "block",
|
|
@@ -5752,15 +5806,15 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5752
5806
|
width: col.key === "actions" ? import_tokens36.tokens.table.actionColumnWidth : "75%"
|
|
5753
5807
|
}
|
|
5754
5808
|
) }, col.key))
|
|
5755
|
-
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0,
|
|
5809
|
+
] }, i)) : !state.rows.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5756
5810
|
"td",
|
|
5757
5811
|
{
|
|
5758
5812
|
colSpan: visible.length + Number(selectable) + Number(expandable),
|
|
5759
5813
|
className: "kjun-table-empty",
|
|
5760
5814
|
children: emptyContent || emptyText
|
|
5761
5815
|
}
|
|
5762
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0,
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5816
|
+
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react45.Fragment, { children: [
|
|
5817
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5764
5818
|
"tr",
|
|
5765
5819
|
{
|
|
5766
5820
|
className: "kjun-table-row-action " + customClass(row, i),
|
|
@@ -5769,9 +5823,9 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5769
5823
|
"data-selected": state.selectedRow(row) || void 0,
|
|
5770
5824
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5771
5825
|
children: [
|
|
5772
|
-
selectable && /* @__PURE__ */ (0,
|
|
5773
|
-
expandable && /* @__PURE__ */ (0,
|
|
5774
|
-
visible.map((col) => /* @__PURE__ */ (0,
|
|
5826
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell", children: checkbox(row, i) }),
|
|
5827
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "kjun-table-action-cell", children: expand(row, i) }),
|
|
5828
|
+
visible.map((col) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5775
5829
|
"td",
|
|
5776
5830
|
{
|
|
5777
5831
|
style: { textAlign: col.align },
|
|
@@ -5784,7 +5838,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5784
5838
|
]
|
|
5785
5839
|
}
|
|
5786
5840
|
),
|
|
5787
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0,
|
|
5841
|
+
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
5842
|
"td",
|
|
5789
5843
|
{
|
|
5790
5844
|
colSpan: visible.length + Number(selectable) + 1,
|
|
@@ -5798,7 +5852,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5798
5852
|
}
|
|
5799
5853
|
|
|
5800
5854
|
// packages/react/src/table-cards.tsx
|
|
5801
|
-
var
|
|
5855
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5802
5856
|
function TableCards({
|
|
5803
5857
|
initialLoading,
|
|
5804
5858
|
skeletonRows,
|
|
@@ -5819,7 +5873,7 @@ function TableCards({
|
|
|
5819
5873
|
rowKeyDown
|
|
5820
5874
|
}) {
|
|
5821
5875
|
const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
|
|
5822
|
-
return /* @__PURE__ */ (0,
|
|
5876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5823
5877
|
"div",
|
|
5824
5878
|
{
|
|
5825
5879
|
className: "kjun-table-cards",
|
|
@@ -5828,7 +5882,7 @@ function TableCards({
|
|
|
5828
5882
|
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5829
5883
|
"aria-hidden": skeletonHidden || void 0,
|
|
5830
5884
|
children: [
|
|
5831
|
-
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0,
|
|
5885
|
+
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
5886
|
"div",
|
|
5833
5887
|
{
|
|
5834
5888
|
role: "listitem",
|
|
@@ -5837,40 +5891,40 @@ function TableCards({
|
|
|
5837
5891
|
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5838
5892
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5839
5893
|
children: [
|
|
5840
|
-
/* @__PURE__ */ (0,
|
|
5841
|
-
/* @__PURE__ */ (0,
|
|
5894
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "kjun-table-card-header", children: [
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "kjun-table-card-header-left", children: [
|
|
5842
5896
|
selectable && checkbox(row, i),
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5844
5898
|
] }),
|
|
5845
|
-
badges.length ? /* @__PURE__ */ (0,
|
|
5846
|
-
inline.length > 0 && /* @__PURE__ */ (0,
|
|
5899
|
+
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,
|
|
5900
|
+
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5847
5901
|
"div",
|
|
5848
5902
|
{
|
|
5849
5903
|
className: "kjun-table-card-header-actions",
|
|
5850
5904
|
onClick: (e) => e.stopPropagation(),
|
|
5851
|
-
children: inline.map((col) => /* @__PURE__ */ (0,
|
|
5905
|
+
children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: cell(col, row, i) }, col.key))
|
|
5852
5906
|
}
|
|
5853
5907
|
)
|
|
5854
5908
|
] }),
|
|
5855
5909
|
sections.map((section, index) => {
|
|
5856
5910
|
const cols = columnsForSection(row, section);
|
|
5857
|
-
return cols.length ? /* @__PURE__ */ (0,
|
|
5911
|
+
return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5858
5912
|
"section",
|
|
5859
5913
|
{
|
|
5860
5914
|
className: "kjun-table-card-section",
|
|
5861
5915
|
children: [
|
|
5862
|
-
section.label && /* @__PURE__ */ (0,
|
|
5863
|
-
/* @__PURE__ */ (0,
|
|
5916
|
+
section.label && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-section-label", children: section.label }),
|
|
5917
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5864
5918
|
"div",
|
|
5865
5919
|
{
|
|
5866
5920
|
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5867
|
-
children: cols.map((col) => /* @__PURE__ */ (0,
|
|
5921
|
+
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5868
5922
|
"div",
|
|
5869
5923
|
{
|
|
5870
5924
|
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5871
5925
|
children: [
|
|
5872
|
-
/* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-label", children: col.label }),
|
|
5927
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-value", children: cell(col, row, i) })
|
|
5874
5928
|
]
|
|
5875
5929
|
},
|
|
5876
5930
|
col.key
|
|
@@ -5882,9 +5936,9 @@ function TableCards({
|
|
|
5882
5936
|
section.key || index
|
|
5883
5937
|
) : null;
|
|
5884
5938
|
}),
|
|
5885
|
-
expandable && /* @__PURE__ */ (0,
|
|
5886
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0,
|
|
5887
|
-
actions && !actions.inlineInCard && /* @__PURE__ */ (0,
|
|
5939
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-expand-toggle", children: expand(row, i) }),
|
|
5940
|
+
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) }),
|
|
5941
|
+
actions && !actions.inlineInCard && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5888
5942
|
"div",
|
|
5889
5943
|
{
|
|
5890
5944
|
className: "kjun-table-card-actions",
|
|
@@ -5896,16 +5950,16 @@ function TableCards({
|
|
|
5896
5950
|
},
|
|
5897
5951
|
state.key(row, i)
|
|
5898
5952
|
)),
|
|
5899
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ (0,
|
|
5953
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "kjun-table-card-empty", children: emptyContent || emptyText })
|
|
5900
5954
|
]
|
|
5901
5955
|
}
|
|
5902
5956
|
);
|
|
5903
5957
|
}
|
|
5904
5958
|
|
|
5905
5959
|
// packages/react/src/table-view.tsx
|
|
5906
|
-
var
|
|
5960
|
+
var import_react46 = require("react");
|
|
5907
5961
|
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5908
|
-
var
|
|
5962
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5909
5963
|
function KjunTable(props) {
|
|
5910
5964
|
const {
|
|
5911
5965
|
skeletonRows = 8,
|
|
@@ -5933,8 +5987,8 @@ function KjunTable(props) {
|
|
|
5933
5987
|
onRowClick,
|
|
5934
5988
|
onRetry
|
|
5935
5989
|
} = props;
|
|
5936
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
5937
|
-
(0,
|
|
5990
|
+
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0, import_react46.useState)(false);
|
|
5991
|
+
(0, import_react46.useEffect)(() => {
|
|
5938
5992
|
const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
|
|
5939
5993
|
const update = () => setMobile(media.matches);
|
|
5940
5994
|
update();
|
|
@@ -5945,7 +5999,7 @@ function KjunTable(props) {
|
|
|
5945
5999
|
const { card, visible } = layout;
|
|
5946
6000
|
const cell = (col, row, index) => {
|
|
5947
6001
|
const { value, body } = tableCellValue(props, col, row, index);
|
|
5948
|
-
return col.pill ? /* @__PURE__ */ (0,
|
|
6002
|
+
return col.pill ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5949
6003
|
"span",
|
|
5950
6004
|
{
|
|
5951
6005
|
className: "kjun-table-pill " + (Number(value) > 0 ? "kjun-table-pill-up" : Number(value) < 0 ? "kjun-table-pill-down" : ""),
|
|
@@ -5961,7 +6015,7 @@ function KjunTable(props) {
|
|
|
5961
6015
|
onRowClick(row, index);
|
|
5962
6016
|
}
|
|
5963
6017
|
};
|
|
5964
|
-
const checkbox = (row, i) => /* @__PURE__ */ (0,
|
|
6018
|
+
const checkbox = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5965
6019
|
TableCheck,
|
|
5966
6020
|
{
|
|
5967
6021
|
"aria-label": `\uD589 \uC120\uD0DD ${i + 1}`,
|
|
@@ -5970,7 +6024,7 @@ function KjunTable(props) {
|
|
|
5970
6024
|
onChange: () => state.toggleRow(row)
|
|
5971
6025
|
}
|
|
5972
6026
|
);
|
|
5973
|
-
const expand = (row, i) => /* @__PURE__ */ (0,
|
|
6027
|
+
const expand = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5974
6028
|
KjunButton,
|
|
5975
6029
|
{
|
|
5976
6030
|
variant: "ghost",
|
|
@@ -5982,14 +6036,14 @@ function KjunTable(props) {
|
|
|
5982
6036
|
children: card ? state.expanded.includes(state.key(row, i)) ? "\uC811\uAE30" : "\uC0C1\uC138 \uBCF4\uAE30" : void 0
|
|
5983
6037
|
}
|
|
5984
6038
|
);
|
|
5985
|
-
return /* @__PURE__ */ (0,
|
|
6039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
5986
6040
|
"div",
|
|
5987
6041
|
{
|
|
5988
6042
|
className: "kjun-table-state",
|
|
5989
6043
|
"aria-busy": !!props.loading,
|
|
5990
6044
|
ref: domainColorRef(!query2.initialLoading && state.rows.length > 0 && props.columns.some((column) => column.pill)),
|
|
5991
6045
|
children: [
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5993
6047
|
TableToolbar,
|
|
5994
6048
|
{
|
|
5995
6049
|
...{ selectable, selected, renderSelectionToolbar, searchable, searchPlaceholder, toolbar },
|
|
@@ -6002,7 +6056,7 @@ function KjunTable(props) {
|
|
|
6002
6056
|
searchChange: state.searchChange
|
|
6003
6057
|
}
|
|
6004
6058
|
),
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6006
6060
|
KjunDataState,
|
|
6007
6061
|
{
|
|
6008
6062
|
queryKey: props.queryKey,
|
|
@@ -6016,8 +6070,8 @@ function KjunTable(props) {
|
|
|
6016
6070
|
loadingText,
|
|
6017
6071
|
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
6018
6072
|
children: [
|
|
6019
|
-
card ? /* @__PURE__ */ (0,
|
|
6020
|
-
pagination && /* @__PURE__ */ (0,
|
|
6073
|
+
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 }),
|
|
6074
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6021
6075
|
KjunPagination,
|
|
6022
6076
|
{
|
|
6023
6077
|
currentPage: pagination.page,
|
|
@@ -6040,7 +6094,7 @@ function KjunTable(props) {
|
|
|
6040
6094
|
|
|
6041
6095
|
// packages/react/src/kpi.tsx
|
|
6042
6096
|
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6043
|
-
var
|
|
6097
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6044
6098
|
var kpiFormat = (item, value = item.value) => {
|
|
6045
6099
|
var _a, _b;
|
|
6046
6100
|
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 +6126,16 @@ function KjunKpiHero(props) {
|
|
|
6072
6126
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6073
6127
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6074
6128
|
);
|
|
6075
|
-
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ (0,
|
|
6129
|
+
const delta = (v, kind) => deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6076
6130
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6077
|
-
kind === "absolute" && prefix && /* @__PURE__ */ (0,
|
|
6131
|
+
kind === "absolute" && prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
6078
6132
|
new Intl.NumberFormat(void 0, {
|
|
6079
6133
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
6080
6134
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
6081
6135
|
}).format(Math.abs(v)),
|
|
6082
|
-
kind === "percent" && /* @__PURE__ */ (0,
|
|
6136
|
+
kind === "percent" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-number-affix", "data-side": "suffix", children: "%" })
|
|
6083
6137
|
] });
|
|
6084
|
-
return /* @__PURE__ */ (0,
|
|
6138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6085
6139
|
"div",
|
|
6086
6140
|
{
|
|
6087
6141
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
@@ -6089,12 +6143,12 @@ function KjunKpiHero(props) {
|
|
|
6089
6143
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
6090
6144
|
"aria-busy": loading,
|
|
6091
6145
|
children: [
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
/* @__PURE__ */ (0,
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6095
|
-
/* @__PURE__ */ (0,
|
|
6096
|
-
prefix && /* @__PURE__ */ (0,
|
|
6097
|
-
/* @__PURE__ */ (0,
|
|
6146
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-hero__layout", children: [
|
|
6147
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-hero__main", children: [
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__label", children: label }),
|
|
6149
|
+
/* @__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: [
|
|
6150
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
6151
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6098
6152
|
KjunAnimatedNumber,
|
|
6099
6153
|
{
|
|
6100
6154
|
value,
|
|
@@ -6103,13 +6157,13 @@ function KjunKpiHero(props) {
|
|
|
6103
6157
|
formatter
|
|
6104
6158
|
}
|
|
6105
6159
|
),
|
|
6106
|
-
suffix && /* @__PURE__ */ (0,
|
|
6160
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__affix", children: suffix })
|
|
6107
6161
|
] }) }),
|
|
6108
|
-
showDelta && /* @__PURE__ */ (0,
|
|
6162
|
+
showDelta && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6109
6163
|
// 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,
|
|
6164
|
+
/* @__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 }) })
|
|
6165
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
6166
|
+
deltaAbsolute !== null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6113
6167
|
"span",
|
|
6114
6168
|
{
|
|
6115
6169
|
className: "kjun-kpi-hero__delta-abs",
|
|
@@ -6123,7 +6177,7 @@ function KjunKpiHero(props) {
|
|
|
6123
6177
|
children: delta(deltaAbsolute, "absolute")
|
|
6124
6178
|
}
|
|
6125
6179
|
),
|
|
6126
|
-
deltaPercent !== null && /* @__PURE__ */ (0,
|
|
6180
|
+
deltaPercent !== null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6127
6181
|
"span",
|
|
6128
6182
|
{
|
|
6129
6183
|
className: "kjun-kpi-hero__delta-pct",
|
|
@@ -6133,31 +6187,31 @@ function KjunKpiHero(props) {
|
|
|
6133
6187
|
children: delta(deltaPercent, "percent")
|
|
6134
6188
|
}
|
|
6135
6189
|
),
|
|
6136
|
-
deltaDescription && /* @__PURE__ */ (0,
|
|
6190
|
+
deltaDescription && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__delta-desc", children: deltaDescription })
|
|
6137
6191
|
] }) })
|
|
6138
6192
|
] }),
|
|
6139
|
-
aside && /* @__PURE__ */ (0,
|
|
6193
|
+
aside && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__aside", children: aside })
|
|
6140
6194
|
] }),
|
|
6141
|
-
secondary.length > 0 && /* @__PURE__ */ (0,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6143
|
-
/* @__PURE__ */ (0,
|
|
6195
|
+
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: [
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__sec-label", children: item.label }),
|
|
6197
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6144
6198
|
"div",
|
|
6145
6199
|
{
|
|
6146
6200
|
className: "kjun-kpi-hero__sec-value",
|
|
6147
6201
|
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,
|
|
6202
|
+
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: [
|
|
6203
|
+
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: kpiFormat(item) }),
|
|
6205
|
+
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
6152
6206
|
] })
|
|
6153
6207
|
}
|
|
6154
6208
|
),
|
|
6155
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6209
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6156
6210
|
"div",
|
|
6157
6211
|
{
|
|
6158
6212
|
className: "kjun-kpi-hero__sec-desc " + (item.descClass || ""),
|
|
6159
6213
|
style: { color: "var(--_kjun-color-text-tertiary)" },
|
|
6160
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
6214
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", width: "7ch", height: "1lh" }) : item.desc
|
|
6161
6215
|
}
|
|
6162
6216
|
)
|
|
6163
6217
|
] }, i)) })
|
|
@@ -6187,7 +6241,7 @@ function KjunKpiRow({
|
|
|
6187
6241
|
const v = item.badge.variant || "neutral", dot = ["warning", "success", "danger", "price-up", "price-down"].includes(
|
|
6188
6242
|
v
|
|
6189
6243
|
), role2 = v === "neutral" ? "text-secondary" : v === "info" ? "brand" : v;
|
|
6190
|
-
return /* @__PURE__ */ (0,
|
|
6244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6191
6245
|
"span",
|
|
6192
6246
|
{
|
|
6193
6247
|
className: "kjun-kpi-row__badge",
|
|
@@ -6196,7 +6250,7 @@ function KjunKpiRow({
|
|
|
6196
6250
|
background: `var(--_kjun-color-${v === "neutral" ? "secondary" : v === "info" ? "info-bg" : v + "-bg"})`
|
|
6197
6251
|
},
|
|
6198
6252
|
children: [
|
|
6199
|
-
dot && /* @__PURE__ */ (0,
|
|
6253
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6200
6254
|
"span",
|
|
6201
6255
|
{
|
|
6202
6256
|
className: "kjun-kpi-row__badge-dot",
|
|
@@ -6208,7 +6262,7 @@ function KjunKpiRow({
|
|
|
6208
6262
|
}
|
|
6209
6263
|
);
|
|
6210
6264
|
};
|
|
6211
|
-
return /* @__PURE__ */ (0,
|
|
6265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6212
6266
|
"div",
|
|
6213
6267
|
{
|
|
6214
6268
|
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 +6277,7 @@ function KjunKpiRow({
|
|
|
6223
6277
|
const busy = loading || !!item.loading, click = () => {
|
|
6224
6278
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6225
6279
|
};
|
|
6226
|
-
return /* @__PURE__ */ (0,
|
|
6280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6227
6281
|
"div",
|
|
6228
6282
|
{
|
|
6229
6283
|
role: item.clickable ? "button" : void 0,
|
|
@@ -6238,12 +6292,12 @@ function KjunKpiRow({
|
|
|
6238
6292
|
}
|
|
6239
6293
|
},
|
|
6240
6294
|
children: [
|
|
6241
|
-
/* @__PURE__ */ (0,
|
|
6242
|
-
/* @__PURE__ */ (0,
|
|
6295
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-row__label-row", children: [
|
|
6296
|
+
/* @__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
6297
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6244
6298
|
] }),
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
/* @__PURE__ */ (0,
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
6300
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6247
6301
|
"div",
|
|
6248
6302
|
{
|
|
6249
6303
|
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 +6305,19 @@ function KjunKpiRow({
|
|
|
6251
6305
|
style: {
|
|
6252
6306
|
color: item.valueClass ? void 0 : kpiColor(item.value, item.semantic)
|
|
6253
6307
|
},
|
|
6254
|
-
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0,
|
|
6308
|
+
children: item.valueSegments ? item.valueSegments.map((seg, j) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6255
6309
|
"span",
|
|
6256
6310
|
{
|
|
6257
6311
|
className: (seg.class || "") + (seg.label ? " kjun-kpi-row__segment--labeled" : "") + (seg.separator ? " kjun-kpi-row__segment--separator" : ""),
|
|
6258
6312
|
children: [
|
|
6259
|
-
seg.label && /* @__PURE__ */ (0,
|
|
6260
|
-
busy && !seg.separator ? /* @__PURE__ */ (0,
|
|
6313
|
+
seg.label && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__segment-label", children: seg.label }),
|
|
6314
|
+
busy && !seg.separator ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "3ch" }) : seg.text
|
|
6261
6315
|
]
|
|
6262
6316
|
},
|
|
6263
6317
|
j
|
|
6264
|
-
)) : busy ? /* @__PURE__ */ (0,
|
|
6265
|
-
item.prefix && /* @__PURE__ */ (0,
|
|
6266
|
-
item.animated && typeof item.value === "number" ? /* @__PURE__ */ (0,
|
|
6318
|
+
)) : 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: [
|
|
6319
|
+
item.prefix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__affix", children: item.prefix }),
|
|
6320
|
+
item.animated && typeof item.value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6267
6321
|
KjunAnimatedNumber,
|
|
6268
6322
|
{
|
|
6269
6323
|
fromPrevious: true,
|
|
@@ -6271,20 +6325,20 @@ function KjunKpiRow({
|
|
|
6271
6325
|
formatter: (v) => kpiFormat(item, v)
|
|
6272
6326
|
}
|
|
6273
6327
|
) : kpiFormat(item),
|
|
6274
|
-
item.suffix && /* @__PURE__ */ (0,
|
|
6328
|
+
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6275
6329
|
] })
|
|
6276
6330
|
}
|
|
6277
6331
|
),
|
|
6278
6332
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
6279
6333
|
] }),
|
|
6280
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6334
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6281
6335
|
"div",
|
|
6282
6336
|
{
|
|
6283
6337
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6284
6338
|
style: {
|
|
6285
6339
|
color: item.descClass ? void 0 : kpiColor(item.value, item.semantic, "text-secondary")
|
|
6286
6340
|
},
|
|
6287
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
6341
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6288
6342
|
}
|
|
6289
6343
|
)
|
|
6290
6344
|
]
|
|
@@ -6300,7 +6354,7 @@ function KjunKpiRow({
|
|
|
6300
6354
|
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6301
6355
|
|
|
6302
6356
|
// shared/package-runtime/market-cards.ts
|
|
6303
|
-
var
|
|
6357
|
+
var import_react47 = require("react");
|
|
6304
6358
|
function useMarketCardsModel(props, persistence) {
|
|
6305
6359
|
const {
|
|
6306
6360
|
columns,
|
|
@@ -6316,8 +6370,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6316
6370
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6317
6371
|
isDefaultSort: c.defaultSort
|
|
6318
6372
|
}));
|
|
6319
|
-
const [key, setKey] = (0,
|
|
6320
|
-
const mounted = (0,
|
|
6373
|
+
const [key, setKey] = (0, import_react47.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6374
|
+
const mounted = (0, import_react47.useRef)("");
|
|
6321
6375
|
const save = (key2) => {
|
|
6322
6376
|
var _a;
|
|
6323
6377
|
try {
|
|
@@ -6325,7 +6379,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6325
6379
|
} catch (e) {
|
|
6326
6380
|
}
|
|
6327
6381
|
};
|
|
6328
|
-
(0,
|
|
6382
|
+
(0, import_react47.useEffect)(() => {
|
|
6329
6383
|
var _a, _b;
|
|
6330
6384
|
if (mounted.current === restoreSignature) return;
|
|
6331
6385
|
mounted.current = restoreSignature;
|
|
@@ -6362,26 +6416,26 @@ function useMarketCards(props) {
|
|
|
6362
6416
|
}
|
|
6363
6417
|
|
|
6364
6418
|
// packages/react/src/market-parts.tsx
|
|
6365
|
-
var
|
|
6419
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6366
6420
|
function MarketIdentity({
|
|
6367
6421
|
row,
|
|
6368
6422
|
props
|
|
6369
6423
|
}) {
|
|
6370
6424
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6371
6425
|
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,
|
|
6426
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6373
6427
|
(_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,
|
|
6428
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-identity-text", children: [
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-name", children: [
|
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { title: label, children: label }),
|
|
6431
|
+
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunCollectionMark, { kind: "interest", size: "sm", active: true }),
|
|
6432
|
+
((_g = props.favoriteKeys) == null ? void 0 : _g.has(id)) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunCollectionMark, { kind: "favorite", size: "sm", active: true }),
|
|
6379
6433
|
(_h = props.renderNameSuffix) == null ? void 0 : _h.call(props, row)
|
|
6380
6434
|
] }),
|
|
6381
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ (0,
|
|
6435
|
+
(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
6436
|
] })
|
|
6383
6437
|
] });
|
|
6384
|
-
return /* @__PURE__ */ (0,
|
|
6438
|
+
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
6439
|
}
|
|
6386
6440
|
function MarketFooter({
|
|
6387
6441
|
props
|
|
@@ -6396,8 +6450,8 @@ function MarketFooter({
|
|
|
6396
6450
|
totalCount = 0,
|
|
6397
6451
|
unitLabel = "\uAC1C"
|
|
6398
6452
|
} = props;
|
|
6399
|
-
return /* @__PURE__ */ (0,
|
|
6400
|
-
pagination && /* @__PURE__ */ (0,
|
|
6453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6454
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6401
6455
|
KjunPagination,
|
|
6402
6456
|
{
|
|
6403
6457
|
currentPage: pagination.page,
|
|
@@ -6409,9 +6463,9 @@ function MarketFooter({
|
|
|
6409
6463
|
}
|
|
6410
6464
|
),
|
|
6411
6465
|
" ",
|
|
6412
|
-
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ (0,
|
|
6413
|
-
/* @__PURE__ */ (0,
|
|
6414
|
-
/* @__PURE__ */ (0,
|
|
6466
|
+
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "kjun-market-footer", children: [
|
|
6467
|
+
/* @__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 }),
|
|
6468
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
|
|
6415
6469
|
"\uCD1D ",
|
|
6416
6470
|
totalCount,
|
|
6417
6471
|
unitLabel
|
|
@@ -6421,7 +6475,7 @@ function MarketFooter({
|
|
|
6421
6475
|
}
|
|
6422
6476
|
|
|
6423
6477
|
// packages/react/src/market-cards.tsx
|
|
6424
|
-
var
|
|
6478
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6425
6479
|
function KjunMarketCards(props) {
|
|
6426
6480
|
const {
|
|
6427
6481
|
rows = [],
|
|
@@ -6446,8 +6500,8 @@ function KjunMarketCards(props) {
|
|
|
6446
6500
|
column: props.columns.find((c) => c.key === state.key)
|
|
6447
6501
|
}) : value == null ? "-" : String(value);
|
|
6448
6502
|
};
|
|
6449
|
-
return /* @__PURE__ */ (0,
|
|
6450
|
-
/* @__PURE__ */ (0,
|
|
6503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "kjun-market-cards", children: [
|
|
6504
|
+
/* @__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
6505
|
"button",
|
|
6452
6506
|
{
|
|
6453
6507
|
type: "button",
|
|
@@ -6462,7 +6516,7 @@ function KjunMarketCards(props) {
|
|
|
6462
6516
|
},
|
|
6463
6517
|
children: [
|
|
6464
6518
|
pill.label,
|
|
6465
|
-
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */ (0,
|
|
6519
|
+
state.key === pill.key && pill.sortKey && (emitSortOnMount || pill.sortKey === sortKey) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: sortOrder === "desc" ? "\u2193" : "\u2191" })
|
|
6466
6520
|
]
|
|
6467
6521
|
},
|
|
6468
6522
|
pill.key
|
|
@@ -6471,20 +6525,20 @@ function KjunMarketCards(props) {
|
|
|
6471
6525
|
selectedKey: state.key,
|
|
6472
6526
|
selectedPill: state.pill,
|
|
6473
6527
|
metricDisplay: display
|
|
6474
|
-
}) : /* @__PURE__ */ (0,
|
|
6475
|
-
/* @__PURE__ */ (0,
|
|
6528
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6529
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6476
6530
|
KjunDataState,
|
|
6477
6531
|
{
|
|
6478
6532
|
...props,
|
|
6479
6533
|
loadingPadding: "none",
|
|
6480
6534
|
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,
|
|
6535
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
6536
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
6538
|
+
state.pill && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "kjun-market-column-label", children: state.pill.label }),
|
|
6485
6539
|
rows.map((row, i) => {
|
|
6486
6540
|
var _a, _b, _c;
|
|
6487
|
-
return /* @__PURE__ */ (0,
|
|
6541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6488
6542
|
"div",
|
|
6489
6543
|
{
|
|
6490
6544
|
className: "kjun-market-row kjun-market-row-compact",
|
|
@@ -6502,15 +6556,15 @@ function KjunMarketCards(props) {
|
|
|
6502
6556
|
}
|
|
6503
6557
|
},
|
|
6504
6558
|
children: [
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
6506
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarketIdentity, { row, props }),
|
|
6560
|
+
/* @__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
6561
|
KjunSparkline,
|
|
6508
6562
|
{
|
|
6509
6563
|
data: getValue(row, state.key) || [],
|
|
6510
6564
|
width: import_tokens39.tokens.extensions.marketTable.sparklineWidth,
|
|
6511
6565
|
height: import_tokens39.tokens.extensions.marketTable.sparklineHeight
|
|
6512
6566
|
}
|
|
6513
|
-
) : state.pill ? /* @__PURE__ */ (0,
|
|
6567
|
+
) : 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
6568
|
KjunSignedValue,
|
|
6515
6569
|
{
|
|
6516
6570
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6518,7 +6572,7 @@ function KjunMarketCards(props) {
|
|
|
6518
6572
|
stale: !!getValue(row, "stale"),
|
|
6519
6573
|
tone: "pill"
|
|
6520
6574
|
}
|
|
6521
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0,
|
|
6575
|
+
) : 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
6576
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6523
6577
|
props,
|
|
6524
6578
|
row,
|
|
@@ -6535,14 +6589,14 @@ function KjunMarketCards(props) {
|
|
|
6535
6589
|
] })
|
|
6536
6590
|
}
|
|
6537
6591
|
),
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarketFooter, { props })
|
|
6539
6593
|
] })
|
|
6540
6594
|
] });
|
|
6541
6595
|
}
|
|
6542
6596
|
|
|
6543
6597
|
// packages/react/src/market-list.tsx
|
|
6544
6598
|
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6545
|
-
var
|
|
6599
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6546
6600
|
function KjunMarketSimpleList(props) {
|
|
6547
6601
|
const {
|
|
6548
6602
|
rows = [],
|
|
@@ -6555,20 +6609,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6555
6609
|
emptyMessage = "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
6556
6610
|
emptySubMessage = ""
|
|
6557
6611
|
} = props;
|
|
6558
|
-
return /* @__PURE__ */ (0,
|
|
6559
|
-
/* @__PURE__ */ (0,
|
|
6612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-simple-list", children: [
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6560
6614
|
KjunDataState,
|
|
6561
6615
|
{
|
|
6562
6616
|
...props,
|
|
6563
6617
|
loadingPadding: "none",
|
|
6564
6618
|
empty: !rows.length,
|
|
6565
6619
|
emptyText: emptyMessage,
|
|
6566
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6567
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6568
|
-
children: /* @__PURE__ */ (0,
|
|
6620
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunListSkeleton, {}),
|
|
6621
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: rows.map((row, i) => {
|
|
6569
6623
|
var _a, _b;
|
|
6570
6624
|
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,
|
|
6625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6572
6626
|
"div",
|
|
6573
6627
|
{
|
|
6574
6628
|
className: "kjun-market-row",
|
|
@@ -6586,9 +6640,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6586
6640
|
}
|
|
6587
6641
|
},
|
|
6588
6642
|
children: [
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6643
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarketIdentity, { row, props }),
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-quote", children: [
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "kjun-market-price", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6592
6646
|
KjunPriceCell,
|
|
6593
6647
|
{
|
|
6594
6648
|
value: price,
|
|
@@ -6597,9 +6651,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6597
6651
|
showFreshness: false
|
|
6598
6652
|
}
|
|
6599
6653
|
) }),
|
|
6600
|
-
/* @__PURE__ */ (0,
|
|
6654
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-change", children: [
|
|
6601
6655
|
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,
|
|
6656
|
+
(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
6657
|
KjunFreshness,
|
|
6604
6658
|
{
|
|
6605
6659
|
stale,
|
|
@@ -6607,7 +6661,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6607
6661
|
fetchedAt
|
|
6608
6662
|
}
|
|
6609
6663
|
)),
|
|
6610
|
-
changeLoading(row) ? /* @__PURE__ */ (0,
|
|
6664
|
+
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
6665
|
KjunSignedValue,
|
|
6612
6666
|
{
|
|
6613
6667
|
value: change,
|
|
@@ -6616,7 +6670,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6616
6670
|
format: "percent",
|
|
6617
6671
|
isRaw: true
|
|
6618
6672
|
}
|
|
6619
|
-
) : /* @__PURE__ */ (0,
|
|
6673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "-" })
|
|
6620
6674
|
] })
|
|
6621
6675
|
] })
|
|
6622
6676
|
]
|
|
@@ -6626,20 +6680,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6626
6680
|
}) })
|
|
6627
6681
|
}
|
|
6628
6682
|
),
|
|
6629
|
-
/* @__PURE__ */ (0,
|
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarketFooter, { props })
|
|
6630
6684
|
] });
|
|
6631
6685
|
}
|
|
6632
6686
|
|
|
6633
6687
|
// packages/react/src/market-panel.tsx
|
|
6634
6688
|
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6635
|
-
var
|
|
6689
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6636
6690
|
function KjunMarketListPanel({
|
|
6637
6691
|
controls,
|
|
6638
6692
|
children
|
|
6639
6693
|
}) {
|
|
6640
|
-
return /* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6642
|
-
/* @__PURE__ */ (0,
|
|
6694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(KjunCard, { children: [
|
|
6695
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: controls }),
|
|
6696
|
+
/* @__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
6697
|
] });
|
|
6644
6698
|
}
|
|
6645
6699
|
|
|
@@ -6661,8 +6715,8 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6661
6715
|
}
|
|
6662
6716
|
|
|
6663
6717
|
// packages/react/src/market-table.tsx
|
|
6664
|
-
var
|
|
6665
|
-
var
|
|
6718
|
+
var import_react48 = require("react");
|
|
6719
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6666
6720
|
function KjunMarketTable(props) {
|
|
6667
6721
|
const {
|
|
6668
6722
|
rows = [],
|
|
@@ -6682,17 +6736,17 @@ function KjunMarketTable(props) {
|
|
|
6682
6736
|
formatMetric,
|
|
6683
6737
|
renderCell
|
|
6684
6738
|
} = props;
|
|
6685
|
-
const scroller = (0,
|
|
6686
|
-
(0,
|
|
6739
|
+
const scroller = (0, import_react48.useRef)(null), [fadeEnd, setFadeEnd] = (0, import_react48.useState)(false);
|
|
6740
|
+
(0, import_react48.useEffect)(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6687
6741
|
const render = (row, col) => {
|
|
6688
6742
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6689
6743
|
if (cellLoading(row, col))
|
|
6690
|
-
return /* @__PURE__ */ (0,
|
|
6744
|
+
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
6745
|
if (renderCell) return renderCell(row, col);
|
|
6692
6746
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
6693
|
-
return /* @__PURE__ */ (0,
|
|
6747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketIdentity, { row, props });
|
|
6694
6748
|
if (col.type === "sparkline")
|
|
6695
|
-
return /* @__PURE__ */ (0,
|
|
6749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6696
6750
|
KjunSparkline,
|
|
6697
6751
|
{
|
|
6698
6752
|
data: Array.isArray(value) ? value : [],
|
|
@@ -6701,7 +6755,7 @@ function KjunMarketTable(props) {
|
|
|
6701
6755
|
}
|
|
6702
6756
|
);
|
|
6703
6757
|
if (col.type === "price")
|
|
6704
|
-
return /* @__PURE__ */ (0,
|
|
6758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6705
6759
|
KjunPriceCell,
|
|
6706
6760
|
{
|
|
6707
6761
|
value: finiteNumber(value),
|
|
@@ -6711,7 +6765,7 @@ function KjunMarketTable(props) {
|
|
|
6711
6765
|
}
|
|
6712
6766
|
);
|
|
6713
6767
|
if (col.type === "percent")
|
|
6714
|
-
return value == null ? "-" : /* @__PURE__ */ (0,
|
|
6768
|
+
return value == null ? "-" : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6715
6769
|
KjunSignedValue,
|
|
6716
6770
|
{
|
|
6717
6771
|
value: finiteNumber(value),
|
|
@@ -6727,7 +6781,7 @@ function KjunMarketTable(props) {
|
|
|
6727
6781
|
}
|
|
6728
6782
|
);
|
|
6729
6783
|
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,
|
|
6784
|
+
return ["investor", "net_amount", "net_volume"].includes(col.type || "") ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6731
6785
|
KjunSignedValue,
|
|
6732
6786
|
{
|
|
6733
6787
|
value: finiteNumber(value),
|
|
@@ -6737,35 +6791,35 @@ function KjunMarketTable(props) {
|
|
|
6737
6791
|
}
|
|
6738
6792
|
) : text;
|
|
6739
6793
|
};
|
|
6740
|
-
return /* @__PURE__ */ (0,
|
|
6794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6741
6795
|
"div",
|
|
6742
6796
|
{
|
|
6743
6797
|
className: "kjun-market-table",
|
|
6744
6798
|
"data-embedded": embedded,
|
|
6745
6799
|
ref: domainColorRef(showActions && rows.length > 0 && !props.loading),
|
|
6746
6800
|
children: [
|
|
6747
|
-
/* @__PURE__ */ (0,
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6748
6802
|
KjunDataState,
|
|
6749
6803
|
{
|
|
6750
6804
|
...props,
|
|
6751
6805
|
loadingPadding: "none",
|
|
6752
6806
|
empty: !rows.length,
|
|
6753
6807
|
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,
|
|
6808
|
+
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunMarketTableSkeleton, { columns, showActions }),
|
|
6809
|
+
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
6810
|
+
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: [
|
|
6811
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketColumns, { columns, showActions }),
|
|
6812
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { children: [
|
|
6813
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("th", { className: "kjun-market-actions", children: [
|
|
6814
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "kjun-market-actions-mark", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunCollectionMark, { kind: "interest", size: "md" }) }),
|
|
6815
|
+
/* @__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
6816
|
] }),
|
|
6763
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6817
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6764
6818
|
"th",
|
|
6765
6819
|
{
|
|
6766
6820
|
style: { textAlign: col.align },
|
|
6767
6821
|
"aria-sort": col.sortable ? sortKey === col.key ? sortOrder === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
6768
|
-
children: col.sortable ? /* @__PURE__ */ (0,
|
|
6822
|
+
children: col.sortable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6769
6823
|
"button",
|
|
6770
6824
|
{
|
|
6771
6825
|
type: "button",
|
|
@@ -6775,7 +6829,7 @@ function KjunMarketTable(props) {
|
|
|
6775
6829
|
},
|
|
6776
6830
|
children: [
|
|
6777
6831
|
col.label,
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6832
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6779
6833
|
KjunIcon,
|
|
6780
6834
|
{
|
|
6781
6835
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
@@ -6789,12 +6843,12 @@ function KjunMarketTable(props) {
|
|
|
6789
6843
|
col.key
|
|
6790
6844
|
))
|
|
6791
6845
|
] }) }),
|
|
6792
|
-
/* @__PURE__ */ (0,
|
|
6846
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, i) => {
|
|
6793
6847
|
var _a, _b, _c, _d, _e, _f;
|
|
6794
6848
|
const id = getValue(row, rowKey), priceCol = columns.find(
|
|
6795
6849
|
(c) => c.type === "price" && !cellLoading(row, c) && getValue(row, c.key) != null
|
|
6796
6850
|
);
|
|
6797
|
-
return /* @__PURE__ */ (0,
|
|
6851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6798
6852
|
"tr",
|
|
6799
6853
|
{
|
|
6800
6854
|
onClick: () => {
|
|
@@ -6802,8 +6856,8 @@ function KjunMarketTable(props) {
|
|
|
6802
6856
|
return (_a2 = props.onRowClick) == null ? void 0 : _a2.call(props, row);
|
|
6803
6857
|
},
|
|
6804
6858
|
children: [
|
|
6805
|
-
showActions && /* @__PURE__ */ (0,
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
6859
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("td", { className: "kjun-market-actions", children: [
|
|
6860
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6807
6861
|
KjunIconToggle,
|
|
6808
6862
|
{
|
|
6809
6863
|
size: "xs",
|
|
@@ -6822,7 +6876,7 @@ function KjunMarketTable(props) {
|
|
|
6822
6876
|
}
|
|
6823
6877
|
}
|
|
6824
6878
|
),
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6826
6880
|
KjunIconToggle,
|
|
6827
6881
|
{
|
|
6828
6882
|
size: "xs",
|
|
@@ -6842,7 +6896,7 @@ function KjunMarketTable(props) {
|
|
|
6842
6896
|
}
|
|
6843
6897
|
)
|
|
6844
6898
|
] }),
|
|
6845
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6899
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6846
6900
|
"td",
|
|
6847
6901
|
{
|
|
6848
6902
|
style: {
|
|
@@ -6851,7 +6905,7 @@ function KjunMarketTable(props) {
|
|
|
6851
6905
|
},
|
|
6852
6906
|
children: [
|
|
6853
6907
|
render(row, col),
|
|
6854
|
-
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */ (0,
|
|
6908
|
+
col.key === (priceCol == null ? void 0 : priceCol.key) && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6855
6909
|
KjunFreshness,
|
|
6856
6910
|
{
|
|
6857
6911
|
stale: !!getValue(row, "stale"),
|
|
@@ -6873,71 +6927,71 @@ function KjunMarketTable(props) {
|
|
|
6873
6927
|
] }) })
|
|
6874
6928
|
}
|
|
6875
6929
|
),
|
|
6876
|
-
/* @__PURE__ */ (0,
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketFooter, { props })
|
|
6877
6931
|
]
|
|
6878
6932
|
}
|
|
6879
6933
|
);
|
|
6880
6934
|
}
|
|
6881
6935
|
|
|
6882
6936
|
// packages/react/src/list.tsx
|
|
6883
|
-
var
|
|
6884
|
-
var
|
|
6937
|
+
var import_react49 = require("react");
|
|
6938
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6885
6939
|
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,
|
|
6940
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6941
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-leading", children: leading }),
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "kjun-list-body", children: [
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-title", children: title }),
|
|
6944
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-description", children: description })
|
|
6891
6945
|
] }),
|
|
6892
|
-
trailing && /* @__PURE__ */ (0,
|
|
6946
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-trailing", children: trailing })
|
|
6893
6947
|
] });
|
|
6894
|
-
const main = href ? /* @__PURE__ */ (0,
|
|
6895
|
-
return /* @__PURE__ */ (0,
|
|
6948
|
+
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 });
|
|
6949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("li", { className: "kjun-list-row", children: [
|
|
6896
6950
|
main,
|
|
6897
|
-
actions && /* @__PURE__ */ (0,
|
|
6951
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
|
|
6898
6952
|
] });
|
|
6899
6953
|
}
|
|
6900
6954
|
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,
|
|
6955
|
+
const id = "kjun-" + (0, import_react49.useId)();
|
|
6956
|
+
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: [
|
|
6957
|
+
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "kjun-list-heading", children: [
|
|
6958
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { children: [
|
|
6959
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { id, children: title }),
|
|
6960
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: description })
|
|
6907
6961
|
] }),
|
|
6908
6962
|
actions
|
|
6909
6963
|
] }),
|
|
6910
|
-
/* @__PURE__ */ (0,
|
|
6964
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: "kjun-list", "aria-label": ariaLabel || title, children })
|
|
6911
6965
|
] });
|
|
6912
6966
|
}
|
|
6913
6967
|
|
|
6914
6968
|
// packages/react/src/app-navigation.tsx
|
|
6915
6969
|
var import_tokens43 = require("@kjun-ui/tokens");
|
|
6916
|
-
var
|
|
6970
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6917
6971
|
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,
|
|
6972
|
+
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: [
|
|
6973
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-leading", children: leading }),
|
|
6974
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "kjun-navigation-title", children: [
|
|
6975
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("strong", { children: title }),
|
|
6976
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description })
|
|
6923
6977
|
] }),
|
|
6924
|
-
actions && /* @__PURE__ */ (0,
|
|
6978
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-actions", children: actions })
|
|
6925
6979
|
] }) }) });
|
|
6926
6980
|
}
|
|
6927
6981
|
function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\uC0C9", safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
6928
6982
|
const hasIcons = items.some((item) => item.icon);
|
|
6929
6983
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6930
|
-
return /* @__PURE__ */ (0,
|
|
6931
|
-
const badge = item.badge != null && /* @__PURE__ */ (0,
|
|
6932
|
-
return /* @__PURE__ */ (0,
|
|
6984
|
+
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) => {
|
|
6985
|
+
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "kjun-navigation-badge", "aria-hidden": "true", children: item.badge });
|
|
6986
|
+
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
6987
|
if (item.disabled) event.preventDefault();
|
|
6934
6988
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
6935
6989
|
}, children: [
|
|
6936
|
-
hasIcons && /* @__PURE__ */ (0,
|
|
6937
|
-
item.icon && /* @__PURE__ */ (0,
|
|
6990
|
+
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-navigation-icon", children: [
|
|
6991
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: item.icon, size: import_tokens43.tokens.extensions.bottomNavigation.iconSize }),
|
|
6938
6992
|
badge
|
|
6939
6993
|
] }),
|
|
6940
|
-
/* @__PURE__ */ (0,
|
|
6994
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
6941
6995
|
item.label,
|
|
6942
6996
|
!hasIcons && badge
|
|
6943
6997
|
] })
|
|
@@ -6946,25 +7000,25 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
6946
7000
|
}
|
|
6947
7001
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
6948
7002
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6949
|
-
return /* @__PURE__ */ (0,
|
|
6950
|
-
description && /* @__PURE__ */ (0,
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
7003
|
+
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: [
|
|
7004
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description }),
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-actions", children })
|
|
6952
7006
|
] }) });
|
|
6953
7007
|
}
|
|
6954
7008
|
|
|
6955
7009
|
// packages/react/src/media.tsx
|
|
6956
|
-
var
|
|
7010
|
+
var import_react50 = require("react");
|
|
6957
7011
|
var import_tokens44 = require("@kjun-ui/tokens");
|
|
6958
|
-
var
|
|
7012
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6959
7013
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6960
|
-
const current = (0,
|
|
7014
|
+
const current = (0, import_react50.useRef)({ src, version: 0 });
|
|
6961
7015
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6962
7016
|
const version = current.current.version;
|
|
6963
|
-
const [result, setResult] = (0,
|
|
7017
|
+
const [result, setResult] = (0, import_react50.useState)({ version, state: "loading" });
|
|
6964
7018
|
const state = result.version === version ? result.state : "loading";
|
|
6965
7019
|
const failed = !src || state === "error";
|
|
6966
|
-
return /* @__PURE__ */ (0,
|
|
6967
|
-
!failed && /* @__PURE__ */ (0,
|
|
7020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
|
|
7021
|
+
!failed && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("img", { src, alt: decorative ? "" : alt, loading: lazy ? "lazy" : "eager", style: { objectFit: fit }, onLoad: () => {
|
|
6968
7022
|
if (current.current.version !== version) return;
|
|
6969
7023
|
setResult({ version, state: "loaded" });
|
|
6970
7024
|
onLoad == null ? void 0 : onLoad();
|
|
@@ -6973,38 +7027,38 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
6973
7027
|
setResult({ version, state: "error" });
|
|
6974
7028
|
onError == null ? void 0 : onError();
|
|
6975
7029
|
} }, version),
|
|
6976
|
-
failed && /* @__PURE__ */ (0,
|
|
7030
|
+
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
7031
|
] });
|
|
6978
7032
|
}
|
|
6979
7033
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
6980
|
-
return /* @__PURE__ */ (0,
|
|
7034
|
+
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
7035
|
}
|
|
6982
7036
|
|
|
6983
7037
|
// packages/react/src/chip.tsx
|
|
6984
7038
|
var import_tokens45 = require("@kjun-ui/tokens");
|
|
6985
|
-
var
|
|
7039
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6986
7040
|
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,
|
|
7041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "kjun-chip", "data-size": size, "data-disabled": disabled, "data-removable": removable, children: [
|
|
7042
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(KjunIcon, { name: icon, size: import_tokens45.tokens.extensions.chip.iconSizes[size] }),
|
|
7043
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: label }),
|
|
7044
|
+
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
7045
|
] });
|
|
6992
7046
|
}
|
|
6993
7047
|
|
|
6994
7048
|
// packages/react/src/range-input.tsx
|
|
6995
|
-
var
|
|
7049
|
+
var import_react51 = require("react");
|
|
6996
7050
|
var import_react_aria_components9 = require("react-aria-components");
|
|
6997
7051
|
var import_tokens46 = require("@kjun-ui/tokens");
|
|
6998
|
-
var
|
|
7052
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6999
7053
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
7000
7054
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"] : ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"];
|
|
7001
7055
|
const domain = (0, import_tokens46.createSliderDomain)(min, max, step);
|
|
7002
7056
|
const list = Array.isArray(value) ? value : [value];
|
|
7003
7057
|
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,
|
|
7058
|
+
const latest = (0, import_react51.useRef)(value);
|
|
7005
7059
|
latest.current = value;
|
|
7006
|
-
const active = (0,
|
|
7007
|
-
(0,
|
|
7060
|
+
const active = (0, import_react51.useRef)(false);
|
|
7061
|
+
(0, import_react51.useEffect)(() => {
|
|
7008
7062
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7009
7063
|
}, [valid]);
|
|
7010
7064
|
const change = (next) => {
|
|
@@ -7016,48 +7070,48 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7016
7070
|
active.current = true;
|
|
7017
7071
|
onValueChange == null ? void 0 : onValueChange(result);
|
|
7018
7072
|
};
|
|
7019
|
-
return /* @__PURE__ */ (0,
|
|
7073
|
+
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
7074
|
if (valid && !disabled && active.current) {
|
|
7021
7075
|
active.current = false;
|
|
7022
7076
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7023
7077
|
}
|
|
7024
7078
|
}, children: [
|
|
7025
|
-
/* @__PURE__ */ (0,
|
|
7026
|
-
label && /* @__PURE__ */ (0,
|
|
7027
|
-
/* @__PURE__ */ (0,
|
|
7079
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "kjun-slider-caption", children: [
|
|
7080
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.Label, { className: "kjun-slider-label", children: label }),
|
|
7081
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components9.SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.join(" \u2013 ") })
|
|
7028
7082
|
] }),
|
|
7029
|
-
/* @__PURE__ */ (0,
|
|
7030
|
-
/* @__PURE__ */ (0,
|
|
7031
|
-
/* @__PURE__ */ (0,
|
|
7032
|
-
list.map((_, i) => /* @__PURE__ */ (0,
|
|
7083
|
+
/* @__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: [
|
|
7084
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "kjun-slider-rail" }),
|
|
7085
|
+
/* @__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 + "%" } }),
|
|
7086
|
+
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
7087
|
] }) })
|
|
7034
7088
|
] });
|
|
7035
7089
|
}
|
|
7036
7090
|
function KjunSlider(props) {
|
|
7037
|
-
return /* @__PURE__ */ (0,
|
|
7091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7038
7092
|
}
|
|
7039
7093
|
function KjunRangeSlider(props) {
|
|
7040
|
-
return /* @__PURE__ */ (0,
|
|
7094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7041
7095
|
}
|
|
7042
7096
|
|
|
7043
7097
|
// packages/react/src/quantity-stepper.tsx
|
|
7044
|
-
var
|
|
7098
|
+
var import_react52 = require("react");
|
|
7045
7099
|
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7046
|
-
var
|
|
7100
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7047
7101
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7048
7102
|
const geometry = import_tokens47.tokens.extensions.compound;
|
|
7049
7103
|
const buttonStyle = { width: import_tokens47.tokens.input[size].height, padding: 0 };
|
|
7050
7104
|
const domain = (0, import_tokens47.createNumberDomain)({ min, max, step, precision });
|
|
7051
7105
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7052
|
-
const [draft, setDraft] = (0,
|
|
7106
|
+
const [draft, setDraft] = (0, import_react52.useState)(String(value));
|
|
7053
7107
|
const field = useKjunField();
|
|
7054
|
-
const composing = (0,
|
|
7055
|
-
(0,
|
|
7108
|
+
const composing = (0, import_react52.useRef)(false), dirty = (0, import_react52.useRef)(false), accepted = (0, import_react52.useRef)(value);
|
|
7109
|
+
(0, import_react52.useEffect)(() => {
|
|
7056
7110
|
setDraft(String(value));
|
|
7057
7111
|
accepted.current = value;
|
|
7058
7112
|
dirty.current = false;
|
|
7059
7113
|
}, [value, precision, min, max, step]);
|
|
7060
|
-
(0,
|
|
7114
|
+
(0, import_react52.useEffect)(() => {
|
|
7061
7115
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7062
7116
|
}, [valid]);
|
|
7063
7117
|
const emit = (next) => {
|
|
@@ -7091,9 +7145,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7091
7145
|
} else if (action === "commit") commit();
|
|
7092
7146
|
else move(action === "increment" ? 1 : -1);
|
|
7093
7147
|
};
|
|
7094
|
-
return /* @__PURE__ */ (0,
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7096
|
-
/* @__PURE__ */ (0,
|
|
7148
|
+
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: [
|
|
7149
|
+
/* @__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" }),
|
|
7150
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
7097
7151
|
"input",
|
|
7098
7152
|
{
|
|
7099
7153
|
className: "kjun-input",
|
|
@@ -7127,21 +7181,21 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7127
7181
|
"aria-required": (field == null ? void 0 : field.required) || void 0
|
|
7128
7182
|
}
|
|
7129
7183
|
),
|
|
7130
|
-
/* @__PURE__ */ (0,
|
|
7184
|
+
/* @__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
7185
|
] }) });
|
|
7132
7186
|
}
|
|
7133
7187
|
|
|
7134
7188
|
// packages/react/src/time-picker.tsx
|
|
7135
|
-
var
|
|
7189
|
+
var import_react53 = require("react");
|
|
7136
7190
|
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7137
|
-
var
|
|
7191
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7138
7192
|
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,
|
|
7193
|
+
const root = (0, import_react53.useRef)(null);
|
|
7194
|
+
const field = useKjunField(), uid = (0, import_react53.useId)();
|
|
7141
7195
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7142
|
-
const domain = (0,
|
|
7196
|
+
const domain = (0, import_react53.useMemo)(() => (0, import_tokens48.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7143
7197
|
const valid = domain.valid && domain.accepts(value);
|
|
7144
|
-
(0,
|
|
7198
|
+
(0, import_react53.useEffect)(() => {
|
|
7145
7199
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7146
7200
|
}, [valid]);
|
|
7147
7201
|
const change = (next) => {
|
|
@@ -7151,15 +7205,15 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7151
7205
|
}
|
|
7152
7206
|
};
|
|
7153
7207
|
const time = value === null ? null : domain.parse(value);
|
|
7154
|
-
return /* @__PURE__ */ (0,
|
|
7155
|
-
/* @__PURE__ */ (0,
|
|
7208
|
+
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: [
|
|
7209
|
+
/* @__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
7210
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7157
7211
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7158
|
-
return /* @__PURE__ */ (0,
|
|
7159
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
7160
|
-
/* @__PURE__ */ (0,
|
|
7161
|
-
/* @__PURE__ */ (0,
|
|
7162
|
-
/* @__PURE__ */ (0,
|
|
7212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react53.Fragment, { children: [
|
|
7213
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
7214
|
+
/* @__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: [
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: label }),
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
7163
7217
|
KjunSelect,
|
|
7164
7218
|
{
|
|
7165
7219
|
value: time === null ? null : domain.part(time, index),
|
|
@@ -7179,7 +7233,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7179
7233
|
] }) })
|
|
7180
7234
|
] }, label);
|
|
7181
7235
|
}) }) }),
|
|
7182
|
-
clearable && value !== null && /* @__PURE__ */ (0,
|
|
7236
|
+
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
7237
|
var _a, _b;
|
|
7184
7238
|
change(null);
|
|
7185
7239
|
(_b = (_a = root.current) == null ? void 0 : _a.querySelector(".kjun-select-trigger")) == null ? void 0 : _b.focus();
|