@kjun-ui/react 0.10.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 +785 -717
- package/dist/index.js +478 -410
- package/dist/styles.css +98 -0
- package/dist/types/packages/react/src/drawer.d.cts +7 -1
- package/dist/types/packages/react/src/drawer.d.ts +7 -1
- 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/drawer-geometry.d.cts +36 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +36 -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,
|
|
@@ -3033,8 +3087,19 @@ function KjunMenuButton({
|
|
|
3033
3087
|
|
|
3034
3088
|
// packages/react/src/drawer.tsx
|
|
3035
3089
|
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3090
|
+
|
|
3091
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
3092
|
+
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
3093
|
+
return {
|
|
3094
|
+
"--_kjun-drawer-safe-top": Math.max(0, safeAreaTop) + "px",
|
|
3095
|
+
"--_kjun-drawer-safe-bottom": Math.max(0, safeAreaBottom) + "px",
|
|
3096
|
+
...maxHeight === void 0 ? {} : { "--_kjun-drawer-max-height": `min(${maxHeight}px, 100dvh)` }
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
// packages/react/src/drawer.tsx
|
|
3036
3101
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3037
|
-
var
|
|
3102
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3038
3103
|
function KjunDrawer({
|
|
3039
3104
|
open,
|
|
3040
3105
|
onOpenChange,
|
|
@@ -3049,7 +3114,10 @@ function KjunDrawer({
|
|
|
3049
3114
|
footer,
|
|
3050
3115
|
children,
|
|
3051
3116
|
onClose,
|
|
3052
|
-
ariaLabel
|
|
3117
|
+
ariaLabel,
|
|
3118
|
+
safeAreaTop = 0,
|
|
3119
|
+
safeAreaBottom = 0,
|
|
3120
|
+
maxHeight
|
|
3053
3121
|
}) {
|
|
3054
3122
|
const motion = usePresence(open, useReducedMotion(), import_tokens20.tokens.motion.layerExit);
|
|
3055
3123
|
const container = useKjunPortalContainer();
|
|
@@ -3062,10 +3130,10 @@ function KjunDrawer({
|
|
|
3062
3130
|
if (closeOnEsc) close();
|
|
3063
3131
|
});
|
|
3064
3132
|
if (container === null) return null;
|
|
3065
|
-
return /* @__PURE__ */ (0,
|
|
3133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3066
3134
|
import_react_aria_components6.ModalOverlay,
|
|
3067
3135
|
{
|
|
3068
|
-
style: { zIndex: layer.zIndex },
|
|
3136
|
+
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
3069
3137
|
isOpen: motion.present && layer.active,
|
|
3070
3138
|
isExiting: motion.present && !layer.active,
|
|
3071
3139
|
onOpenChange: (v) => {
|
|
@@ -3079,7 +3147,7 @@ function KjunDrawer({
|
|
|
3079
3147
|
"data-motion-open": String(motion.active),
|
|
3080
3148
|
inert: !open || !layer.active,
|
|
3081
3149
|
"data-position": position,
|
|
3082
|
-
children: /* @__PURE__ */ (0,
|
|
3150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3083
3151
|
import_react_aria_components6.Modal,
|
|
3084
3152
|
{
|
|
3085
3153
|
className: "kjun-drawer",
|
|
@@ -3087,7 +3155,7 @@ function KjunDrawer({
|
|
|
3087
3155
|
zIndex: layer.state.zIndex(layer.id, "content"),
|
|
3088
3156
|
width: position === "left" || position === "right" ? width : "100%"
|
|
3089
3157
|
},
|
|
3090
|
-
children: /* @__PURE__ */ (0,
|
|
3158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3091
3159
|
import_react_aria_components6.Dialog,
|
|
3092
3160
|
{
|
|
3093
3161
|
"aria-label": ariaLabel || title || "\uD328\uB110",
|
|
@@ -3097,9 +3165,9 @@ function KjunDrawer({
|
|
|
3097
3165
|
if (entry) entry.root = node;
|
|
3098
3166
|
},
|
|
3099
3167
|
children: [
|
|
3100
|
-
(title || header || closable) && /* @__PURE__ */ (0,
|
|
3101
|
-
/* @__PURE__ */ (0,
|
|
3102
|
-
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)(
|
|
3103
3171
|
KjunButton,
|
|
3104
3172
|
{
|
|
3105
3173
|
size: "sm",
|
|
@@ -3107,11 +3175,11 @@ function KjunDrawer({
|
|
|
3107
3175
|
ariaLabel: "\uB2EB\uAE30",
|
|
3108
3176
|
onClick: close,
|
|
3109
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 },
|
|
3110
|
-
children: /* @__PURE__ */ (0,
|
|
3178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KjunIcon, { name: "x", size: import_tokens20.tokens.extensions.drawer.closeIconSize })
|
|
3111
3179
|
}
|
|
3112
3180
|
)
|
|
3113
3181
|
] }),
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3182
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3115
3183
|
"div",
|
|
3116
3184
|
{
|
|
3117
3185
|
className: "kjun-drawer-body",
|
|
@@ -3119,8 +3187,8 @@ function KjunDrawer({
|
|
|
3119
3187
|
children
|
|
3120
3188
|
}
|
|
3121
3189
|
),
|
|
3122
|
-
footer && /* @__PURE__ */ (0,
|
|
3123
|
-
/* @__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, {})
|
|
3124
3192
|
]
|
|
3125
3193
|
}
|
|
3126
3194
|
)
|
|
@@ -3131,7 +3199,7 @@ function KjunDrawer({
|
|
|
3131
3199
|
}
|
|
3132
3200
|
|
|
3133
3201
|
// shared/package-runtime/combobox.ts
|
|
3134
|
-
var
|
|
3202
|
+
var import_react27 = require("react");
|
|
3135
3203
|
|
|
3136
3204
|
// shared/package-runtime/options.ts
|
|
3137
3205
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -3208,10 +3276,10 @@ function useComboboxModel({
|
|
|
3208
3276
|
}) {
|
|
3209
3277
|
const selected = options.find((option) => optionValue(option, valueKey) === value);
|
|
3210
3278
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
3211
|
-
const [query2, setQuery] = (0,
|
|
3212
|
-
const [open, setOpen] = (0,
|
|
3213
|
-
(0,
|
|
3214
|
-
(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)(() => {
|
|
3215
3283
|
if (disabled) setOpen(false);
|
|
3216
3284
|
}, [disabled]);
|
|
3217
3285
|
const change = (next) => {
|
|
@@ -3244,8 +3312,8 @@ function useComboboxModel({
|
|
|
3244
3312
|
}
|
|
3245
3313
|
|
|
3246
3314
|
// packages/react/src/combobox.tsx
|
|
3247
|
-
var
|
|
3248
|
-
var
|
|
3315
|
+
var import_react28 = require("react");
|
|
3316
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3249
3317
|
function KjunCombobox({
|
|
3250
3318
|
value,
|
|
3251
3319
|
options = [],
|
|
@@ -3277,7 +3345,7 @@ function KjunCombobox({
|
|
|
3277
3345
|
onSearch,
|
|
3278
3346
|
onClear
|
|
3279
3347
|
});
|
|
3280
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3281
3349
|
SearchField,
|
|
3282
3350
|
{
|
|
3283
3351
|
error,
|
|
@@ -3324,12 +3392,12 @@ function SearchField({
|
|
|
3324
3392
|
onEnter
|
|
3325
3393
|
}) {
|
|
3326
3394
|
const composition = useCompositionGuard();
|
|
3327
|
-
const clearing = (0,
|
|
3328
|
-
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)();
|
|
3329
3397
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3330
3398
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3331
|
-
(0,
|
|
3332
|
-
(0,
|
|
3399
|
+
(0, import_react28.useEffect)(() => setActive(-1), [value, options.length]);
|
|
3400
|
+
(0, import_react28.useEffect)(() => {
|
|
3333
3401
|
if (!open) return;
|
|
3334
3402
|
const leaveField = (event) => {
|
|
3335
3403
|
var _a, _b, _c;
|
|
@@ -3339,7 +3407,7 @@ function SearchField({
|
|
|
3339
3407
|
document.addEventListener("focusin", leaveField);
|
|
3340
3408
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3341
3409
|
}, [open, onOpenChange, id]);
|
|
3342
|
-
(0,
|
|
3410
|
+
(0, import_react28.useEffect)(() => {
|
|
3343
3411
|
if (highlighted !== active) setActive(-1);
|
|
3344
3412
|
}, [highlighted, active]);
|
|
3345
3413
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3350,8 +3418,8 @@ function SearchField({
|
|
|
3350
3418
|
onOpenChange(false);
|
|
3351
3419
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3352
3420
|
};
|
|
3353
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3355
3423
|
KjunInput,
|
|
3356
3424
|
{
|
|
3357
3425
|
error,
|
|
@@ -3426,7 +3494,7 @@ function SearchField({
|
|
|
3426
3494
|
}
|
|
3427
3495
|
}
|
|
3428
3496
|
),
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3430
3498
|
FloatingPanel,
|
|
3431
3499
|
{
|
|
3432
3500
|
field: true,
|
|
@@ -3437,14 +3505,14 @@ function SearchField({
|
|
|
3437
3505
|
placement: "bottom-start",
|
|
3438
3506
|
matchTriggerWidth: true,
|
|
3439
3507
|
className: "kjun-select-panel",
|
|
3440
|
-
children: /* @__PURE__ */ (0,
|
|
3508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3441
3509
|
"div",
|
|
3442
3510
|
{
|
|
3443
3511
|
id,
|
|
3444
3512
|
role: "listbox",
|
|
3445
3513
|
"aria-label": ariaLabel || placeholder,
|
|
3446
3514
|
onMouseDown: (e) => e.preventDefault(),
|
|
3447
|
-
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)(
|
|
3448
3516
|
"div",
|
|
3449
3517
|
{
|
|
3450
3518
|
id: id + "-" + i,
|
|
@@ -3462,7 +3530,7 @@ function SearchField({
|
|
|
3462
3530
|
children: (renderOption == null ? void 0 : renderOption(o)) || optionLabel(o, labelKey)
|
|
3463
3531
|
},
|
|
3464
3532
|
optionKey(o, itemKey, i)
|
|
3465
|
-
)) : /* @__PURE__ */ (0,
|
|
3533
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "kjun-select-empty", children: emptyText })
|
|
3466
3534
|
}
|
|
3467
3535
|
)
|
|
3468
3536
|
}
|
|
@@ -3472,8 +3540,8 @@ function SearchField({
|
|
|
3472
3540
|
|
|
3473
3541
|
// packages/react/src/date-picker.tsx
|
|
3474
3542
|
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3475
|
-
var
|
|
3476
|
-
var
|
|
3543
|
+
var import_react29 = require("react");
|
|
3544
|
+
var import_jsx_runtime19 = (
|
|
3477
3545
|
// The drawn calendar icon matches Native; the transparent browser indicator sits on top of it
|
|
3478
3546
|
// (sized by these variables) so clicking the icon still opens the browser picker.
|
|
3479
3547
|
require("react/jsx-runtime")
|
|
@@ -3489,13 +3557,13 @@ function KjunDatePicker({
|
|
|
3489
3557
|
onBlur,
|
|
3490
3558
|
...props
|
|
3491
3559
|
}) {
|
|
3492
|
-
const [focus, setFocus] = (0,
|
|
3493
|
-
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: {
|
|
3494
3562
|
position: "relative",
|
|
3495
3563
|
["--_kjun-date-icon-inset"]: import_tokens21.tokens.input[size].padding + "px",
|
|
3496
3564
|
["--_kjun-date-icon-size"]: import_tokens21.tokens.input[size].iconSize + "px"
|
|
3497
3565
|
}, children: [
|
|
3498
|
-
/* @__PURE__ */ (0,
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3499
3567
|
KjunInput,
|
|
3500
3568
|
{
|
|
3501
3569
|
...props,
|
|
@@ -3517,7 +3585,7 @@ function KjunDatePicker({
|
|
|
3517
3585
|
}
|
|
3518
3586
|
}
|
|
3519
3587
|
),
|
|
3520
|
-
!focus && /* @__PURE__ */ (0,
|
|
3588
|
+
!focus && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3521
3589
|
"span",
|
|
3522
3590
|
{
|
|
3523
3591
|
"aria-hidden": "true",
|
|
@@ -3535,10 +3603,10 @@ function KjunDatePicker({
|
|
|
3535
3603
|
}
|
|
3536
3604
|
|
|
3537
3605
|
// packages/react/src/search-input.tsx
|
|
3538
|
-
var
|
|
3606
|
+
var import_react31 = require("react");
|
|
3539
3607
|
|
|
3540
3608
|
// shared/package-runtime/search-input.ts
|
|
3541
|
-
var
|
|
3609
|
+
var import_react30 = require("react");
|
|
3542
3610
|
function useSearchInputModel({
|
|
3543
3611
|
value,
|
|
3544
3612
|
disabled = false,
|
|
@@ -3548,20 +3616,20 @@ function useSearchInputModel({
|
|
|
3548
3616
|
onValueChange,
|
|
3549
3617
|
onSearchError
|
|
3550
3618
|
}, open) {
|
|
3551
|
-
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);
|
|
3552
3620
|
notify.current = onSearchError;
|
|
3553
|
-
const timer = (0,
|
|
3554
|
-
const notifyValue = (0,
|
|
3621
|
+
const timer = (0, import_react30.useRef)(void 0);
|
|
3622
|
+
const notifyValue = (0, import_react30.useRef)(onValueChange);
|
|
3555
3623
|
notifyValue.current = onValueChange;
|
|
3556
|
-
(0,
|
|
3624
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3557
3625
|
clearTimeout(timer.current);
|
|
3558
3626
|
setQuery(value);
|
|
3559
3627
|
}, [value]);
|
|
3560
|
-
(0,
|
|
3628
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3561
3629
|
clearTimeout(timer.current);
|
|
3562
3630
|
return () => clearTimeout(timer.current);
|
|
3563
3631
|
}, [disabled, debounce, !!loadOptions]);
|
|
3564
|
-
(0,
|
|
3632
|
+
(0, import_react30.useEffect)(() => {
|
|
3565
3633
|
const current = ++version.current, abort = new AbortController();
|
|
3566
3634
|
setFailed(false);
|
|
3567
3635
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -3625,7 +3693,7 @@ function useSearchInputModel({
|
|
|
3625
3693
|
}
|
|
3626
3694
|
|
|
3627
3695
|
// packages/react/src/search-input.tsx
|
|
3628
|
-
var
|
|
3696
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3629
3697
|
function KjunSearchInput({
|
|
3630
3698
|
value,
|
|
3631
3699
|
placeholder = "\uAC80\uC0C9...",
|
|
@@ -3648,7 +3716,7 @@ function KjunSearchInput({
|
|
|
3648
3716
|
onEnter,
|
|
3649
3717
|
onClear
|
|
3650
3718
|
}) {
|
|
3651
|
-
const [open, setOpen] = (0,
|
|
3719
|
+
const [open, setOpen] = (0, import_react31.useState)(false);
|
|
3652
3720
|
const model = useSearchInputModel({ value, disabled, debounce, loadOptions, minChars, onValueChange, onSearchError }, open);
|
|
3653
3721
|
const { query: query2, options, loading, failed } = model;
|
|
3654
3722
|
const update = (value2) => {
|
|
@@ -3661,7 +3729,7 @@ function KjunSearchInput({
|
|
|
3661
3729
|
onClear == null ? void 0 : onClear();
|
|
3662
3730
|
};
|
|
3663
3731
|
if (!loadOptions)
|
|
3664
|
-
return /* @__PURE__ */ (0,
|
|
3732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3665
3733
|
KjunInput,
|
|
3666
3734
|
{
|
|
3667
3735
|
error,
|
|
@@ -3677,7 +3745,7 @@ function KjunSearchInput({
|
|
|
3677
3745
|
onEnter
|
|
3678
3746
|
}
|
|
3679
3747
|
);
|
|
3680
|
-
return /* @__PURE__ */ (0,
|
|
3748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3681
3749
|
SearchField,
|
|
3682
3750
|
{
|
|
3683
3751
|
error,
|
|
@@ -3711,20 +3779,20 @@ function KjunSearchInput({
|
|
|
3711
3779
|
|
|
3712
3780
|
// packages/react/src/select-control.tsx
|
|
3713
3781
|
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3714
|
-
var
|
|
3782
|
+
var import_react34 = require("react");
|
|
3715
3783
|
var import_react_aria_components7 = require("react-aria-components");
|
|
3716
3784
|
|
|
3717
3785
|
// shared/package-runtime/select.ts
|
|
3718
|
-
var
|
|
3786
|
+
var import_react32 = require("react");
|
|
3719
3787
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
3720
|
-
const [internal, setInternal] = (0,
|
|
3721
|
-
const [query2, setQuery] = (0,
|
|
3722
|
-
const [limit, setLimit] = (0,
|
|
3723
|
-
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);
|
|
3724
3792
|
const isControlled = typeof controlled === "boolean";
|
|
3725
3793
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
3726
|
-
const previousOpen = (0,
|
|
3727
|
-
(0,
|
|
3794
|
+
const previousOpen = (0, import_react32.useRef)(open);
|
|
3795
|
+
(0, import_react32.useEffect)(() => {
|
|
3728
3796
|
if (disabled && !isControlled) setInternal(false);
|
|
3729
3797
|
if (previousOpen.current && !open) {
|
|
3730
3798
|
setQuery("");
|
|
@@ -3733,7 +3801,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3733
3801
|
}
|
|
3734
3802
|
previousOpen.current = open;
|
|
3735
3803
|
}, [open, disabled, isControlled, pageSize]);
|
|
3736
|
-
(0,
|
|
3804
|
+
(0, import_react32.useEffect)(() => {
|
|
3737
3805
|
setLimit(pageSize);
|
|
3738
3806
|
}, [pageSize]);
|
|
3739
3807
|
const changeOpen = (next) => {
|
|
@@ -3749,11 +3817,11 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3749
3817
|
}
|
|
3750
3818
|
|
|
3751
3819
|
// packages/react/src/compound-control.ts
|
|
3752
|
-
var
|
|
3753
|
-
var CompoundControlContext = (0,
|
|
3820
|
+
var import_react33 = require("react");
|
|
3821
|
+
var CompoundControlContext = (0, import_react33.createContext)(null);
|
|
3754
3822
|
|
|
3755
3823
|
// packages/react/src/select-control.tsx
|
|
3756
|
-
var
|
|
3824
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3757
3825
|
function KjunSelect({
|
|
3758
3826
|
value,
|
|
3759
3827
|
options = [],
|
|
@@ -3786,17 +3854,17 @@ function KjunSelect({
|
|
|
3786
3854
|
}) {
|
|
3787
3855
|
const { open, query: query2, limit, session, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
3788
3856
|
const composition = useCompositionGuard();
|
|
3789
|
-
const ref = (0,
|
|
3790
|
-
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;
|
|
3791
3859
|
const spec = import_tokens22.tokens.input[size];
|
|
3792
3860
|
const expanded = usePopupExpanded(open, ref);
|
|
3793
3861
|
const registerControl = field == null ? void 0 : field.setControlId;
|
|
3794
|
-
(0,
|
|
3862
|
+
(0, import_react34.useEffect)(() => {
|
|
3795
3863
|
if (!registerControl || !triggerId) return;
|
|
3796
3864
|
registerControl(triggerId);
|
|
3797
3865
|
return () => registerControl(void 0);
|
|
3798
3866
|
}, [registerControl, triggerId]);
|
|
3799
|
-
(0,
|
|
3867
|
+
(0, import_react34.useEffect)(() => {
|
|
3800
3868
|
var _a, _b;
|
|
3801
3869
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
3802
3870
|
if (!open) composition.onCompositionEnd();
|
|
@@ -3818,9 +3886,9 @@ function KjunSelect({
|
|
|
3818
3886
|
filterFn,
|
|
3819
3887
|
searchKeys
|
|
3820
3888
|
});
|
|
3821
|
-
return /* @__PURE__ */ (0,
|
|
3822
|
-
/* @__PURE__ */ (0,
|
|
3823
|
-
/* @__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)(
|
|
3824
3892
|
"button",
|
|
3825
3893
|
{
|
|
3826
3894
|
ref,
|
|
@@ -3851,12 +3919,12 @@ function KjunSelect({
|
|
|
3851
3919
|
}
|
|
3852
3920
|
},
|
|
3853
3921
|
children: [
|
|
3854
|
-
/* @__PURE__ */ (0,
|
|
3855
|
-
/* @__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)" } })
|
|
3856
3924
|
]
|
|
3857
3925
|
}
|
|
3858
3926
|
),
|
|
3859
|
-
clearable && !!label && /* @__PURE__ */ (0,
|
|
3927
|
+
clearable && !!label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3860
3928
|
KjunButton,
|
|
3861
3929
|
{
|
|
3862
3930
|
size: "sm",
|
|
@@ -3878,11 +3946,11 @@ function KjunSelect({
|
|
|
3878
3946
|
onClear == null ? void 0 : onClear();
|
|
3879
3947
|
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
3880
3948
|
},
|
|
3881
|
-
children: /* @__PURE__ */ (0,
|
|
3949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KjunIcon, { name: "x", size: spec.iconSize })
|
|
3882
3950
|
}
|
|
3883
3951
|
)
|
|
3884
3952
|
] }),
|
|
3885
|
-
/* @__PURE__ */ (0,
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3886
3954
|
FloatingPanel,
|
|
3887
3955
|
{
|
|
3888
3956
|
field: true,
|
|
@@ -3892,9 +3960,9 @@ function KjunSelect({
|
|
|
3892
3960
|
placement: "bottom-start",
|
|
3893
3961
|
matchTriggerWidth: true,
|
|
3894
3962
|
className: "kjun-select-panel kjun-select-options-panel",
|
|
3895
|
-
children: /* @__PURE__ */ (0,
|
|
3896
|
-
menuHeader && /* @__PURE__ */ (0,
|
|
3897
|
-
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)(
|
|
3898
3966
|
KjunInput,
|
|
3899
3967
|
{
|
|
3900
3968
|
autoFocus: true,
|
|
@@ -3925,8 +3993,8 @@ function KjunSelect({
|
|
|
3925
3993
|
}
|
|
3926
3994
|
}
|
|
3927
3995
|
) }),
|
|
3928
|
-
loading && /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__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)(
|
|
3930
3998
|
import_react_aria_components7.ListBox,
|
|
3931
3999
|
{
|
|
3932
4000
|
id,
|
|
@@ -3943,7 +4011,7 @@ function KjunSelect({
|
|
|
3943
4011
|
),
|
|
3944
4012
|
autoFocus: searchable ? false : "first",
|
|
3945
4013
|
className: "kjun-listbox",
|
|
3946
|
-
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0,
|
|
4014
|
+
children: visible.map(({ option: o, key }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3947
4015
|
import_react_aria_components7.ListBoxItem,
|
|
3948
4016
|
{
|
|
3949
4017
|
id: key,
|
|
@@ -3955,8 +4023,8 @@ function KjunSelect({
|
|
|
3955
4023
|
textValue: optionLabel(o, labelKey),
|
|
3956
4024
|
className: "kjun-option",
|
|
3957
4025
|
children: [
|
|
3958
|
-
(renderOption == null ? void 0 : renderOption(o, selected(o))) || /* @__PURE__ */ (0,
|
|
3959
|
-
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 })
|
|
3960
4028
|
]
|
|
3961
4029
|
},
|
|
3962
4030
|
key
|
|
@@ -3964,8 +4032,8 @@ function KjunSelect({
|
|
|
3964
4032
|
},
|
|
3965
4033
|
session
|
|
3966
4034
|
),
|
|
3967
|
-
!loading && !matching.length && /* @__PURE__ */ (0,
|
|
3968
|
-
!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)(
|
|
3969
4037
|
KjunButton,
|
|
3970
4038
|
{
|
|
3971
4039
|
size: "sm",
|
|
@@ -3986,17 +4054,17 @@ var import_tokens24 = require("@kjun-ui/tokens");
|
|
|
3986
4054
|
|
|
3987
4055
|
// packages/react/src/collapse.tsx
|
|
3988
4056
|
var import_tokens23 = require("@kjun-ui/tokens");
|
|
3989
|
-
var
|
|
3990
|
-
var
|
|
4057
|
+
var import_react35 = require("react");
|
|
4058
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3991
4059
|
function Collapse({ open, children }) {
|
|
3992
4060
|
const reduced = useReducedMotion();
|
|
3993
|
-
const [retained, setRetained] = (0,
|
|
3994
|
-
const root = (0,
|
|
3995
|
-
const animation = (0,
|
|
3996
|
-
const previous = (0,
|
|
3997
|
-
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);
|
|
3998
4066
|
const present = open || retained;
|
|
3999
|
-
(0,
|
|
4067
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
4000
4068
|
const el = root.current, inner = body.current;
|
|
4001
4069
|
if (!el || !inner) return;
|
|
4002
4070
|
let disposed = false;
|
|
@@ -4047,14 +4115,14 @@ function Collapse({ open, children }) {
|
|
|
4047
4115
|
}
|
|
4048
4116
|
};
|
|
4049
4117
|
}, [open, reduced, present]);
|
|
4050
|
-
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;
|
|
4051
4119
|
}
|
|
4052
4120
|
|
|
4053
4121
|
// shared/package-runtime/navigation.ts
|
|
4054
|
-
var
|
|
4122
|
+
var import_react36 = require("react");
|
|
4055
4123
|
function useInitialTab(value, candidate, change) {
|
|
4056
|
-
const requested = (0,
|
|
4057
|
-
(0,
|
|
4124
|
+
const requested = (0, import_react36.useRef)(/* @__PURE__ */ new Set());
|
|
4125
|
+
(0, import_react36.useEffect)(() => {
|
|
4058
4126
|
if (value !== "") {
|
|
4059
4127
|
requested.current.clear();
|
|
4060
4128
|
return;
|
|
@@ -4065,8 +4133,8 @@ function useInitialTab(value, candidate, change) {
|
|
|
4065
4133
|
}, [value, candidate, change]);
|
|
4066
4134
|
}
|
|
4067
4135
|
function useAccordionState(multiple) {
|
|
4068
|
-
const [opened, setOpened] = (0,
|
|
4069
|
-
(0,
|
|
4136
|
+
const [opened, setOpened] = (0, import_react36.useState)(/* @__PURE__ */ new Set());
|
|
4137
|
+
(0, import_react36.useEffect)(() => {
|
|
4070
4138
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
4071
4139
|
}, [multiple]);
|
|
4072
4140
|
return {
|
|
@@ -4150,9 +4218,9 @@ function manageTabList(list, select, keyboard = true) {
|
|
|
4150
4218
|
}
|
|
4151
4219
|
|
|
4152
4220
|
// packages/react/src/navigation.tsx
|
|
4153
|
-
var
|
|
4221
|
+
var import_react37 = require("react");
|
|
4154
4222
|
var import_react_aria_components8 = require("react-aria-components");
|
|
4155
|
-
var
|
|
4223
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4156
4224
|
function KjunTabs({
|
|
4157
4225
|
value,
|
|
4158
4226
|
items = [],
|
|
@@ -4167,33 +4235,33 @@ function KjunTabs({
|
|
|
4167
4235
|
}) {
|
|
4168
4236
|
var _a;
|
|
4169
4237
|
const { group, indicator } = useSelectionIndicator(true);
|
|
4170
|
-
const panes =
|
|
4171
|
-
|
|
4238
|
+
const panes = import_react37.Children.toArray(children).filter(
|
|
4239
|
+
import_react37.isValidElement
|
|
4172
4240
|
);
|
|
4173
4241
|
const tabs = items.length ? items : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
4174
|
-
(0,
|
|
4242
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4175
4243
|
var _a2;
|
|
4176
4244
|
const list = (_a2 = group.current) == null ? void 0 : _a2.querySelector('[role="tablist"]');
|
|
4177
4245
|
if (list) return manageTabList(list, () => {
|
|
4178
4246
|
}, false);
|
|
4179
4247
|
}, [group]);
|
|
4180
|
-
(0,
|
|
4248
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4181
4249
|
var _a2;
|
|
4182
4250
|
const panelNames = new Set(panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name));
|
|
4183
4251
|
for (const tab of ((_a2 = group.current) == null ? void 0 : _a2.querySelectorAll('[role="tab"]')) || []) {
|
|
4184
4252
|
if (!panelNames.has(tab.dataset.tabName)) tab.removeAttribute("aria-controls");
|
|
4185
4253
|
}
|
|
4186
4254
|
});
|
|
4187
|
-
const timer = (0,
|
|
4188
|
-
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 });
|
|
4189
4257
|
menuState.current = { tabs, onTabMenu };
|
|
4190
4258
|
const canOpenMenu = (name) => !!menuState.current.onTabMenu && menuState.current.tabs.some((tab) => tab.name === name && !tab.disabled);
|
|
4191
4259
|
const clear = () => {
|
|
4192
4260
|
clearTimeout(timer.current);
|
|
4193
4261
|
press.current = null;
|
|
4194
4262
|
};
|
|
4195
|
-
(0,
|
|
4196
|
-
(0,
|
|
4263
|
+
(0, import_react37.useEffect)(() => clear, []);
|
|
4264
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
4197
4265
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
4198
4266
|
}, [tabs, onTabMenu]);
|
|
4199
4267
|
const change = (name) => {
|
|
@@ -4201,7 +4269,7 @@ function KjunTabs({
|
|
|
4201
4269
|
onChange == null ? void 0 : onChange(name);
|
|
4202
4270
|
};
|
|
4203
4271
|
useInitialTab(value, (_a = tabs.find((tab) => !tab.disabled)) == null ? void 0 : _a.name, change);
|
|
4204
|
-
return /* @__PURE__ */ (0,
|
|
4272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4205
4273
|
import_react_aria_components8.Tabs,
|
|
4206
4274
|
{
|
|
4207
4275
|
selectedKey: value,
|
|
@@ -4210,9 +4278,9 @@ function KjunTabs({
|
|
|
4210
4278
|
"data-variant": variant,
|
|
4211
4279
|
"data-density": density,
|
|
4212
4280
|
children: [
|
|
4213
|
-
/* @__PURE__ */ (0,
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__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)(
|
|
4216
4284
|
import_react_aria_components8.Tab,
|
|
4217
4285
|
{
|
|
4218
4286
|
id: tab.name,
|
|
@@ -4252,10 +4320,10 @@ function KjunTabs({
|
|
|
4252
4320
|
onTouchEnd: clear,
|
|
4253
4321
|
onTouchCancel: clear,
|
|
4254
4322
|
children: [
|
|
4255
|
-
tab.icon && /* @__PURE__ */ (0,
|
|
4323
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: tab.icon, size: import_tokens24.tokens.extensions.tabs.iconSize }),
|
|
4256
4324
|
" ",
|
|
4257
|
-
/* @__PURE__ */ (0,
|
|
4258
|
-
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)(
|
|
4259
4327
|
"span",
|
|
4260
4328
|
{
|
|
4261
4329
|
className: "kjun-tab-badge",
|
|
@@ -4269,17 +4337,17 @@ function KjunTabs({
|
|
|
4269
4337
|
},
|
|
4270
4338
|
tab.name
|
|
4271
4339
|
)) }),
|
|
4272
|
-
/* @__PURE__ */ (0,
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { ref: indicator, className: "kjun-tab-indicator", "aria-hidden": "true", hidden: true })
|
|
4273
4341
|
] }),
|
|
4274
4342
|
actions
|
|
4275
4343
|
] }),
|
|
4276
|
-
children && /* @__PURE__ */ (0,
|
|
4344
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-tab-content", children })
|
|
4277
4345
|
]
|
|
4278
4346
|
}
|
|
4279
4347
|
);
|
|
4280
4348
|
}
|
|
4281
4349
|
function KjunTabPane({ name, children }) {
|
|
4282
|
-
return /* @__PURE__ */ (0,
|
|
4350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4283
4351
|
import_react_aria_components8.TabPanel,
|
|
4284
4352
|
{
|
|
4285
4353
|
id: name,
|
|
@@ -4290,18 +4358,18 @@ function KjunTabPane({ name, children }) {
|
|
|
4290
4358
|
}
|
|
4291
4359
|
);
|
|
4292
4360
|
}
|
|
4293
|
-
var AccordionContext = (0,
|
|
4361
|
+
var AccordionContext = (0, import_react37.createContext)(null);
|
|
4294
4362
|
function KjunAccordion({
|
|
4295
4363
|
multiple = false,
|
|
4296
4364
|
tone = "card",
|
|
4297
4365
|
children
|
|
4298
4366
|
}) {
|
|
4299
4367
|
const state = useAccordionState(multiple);
|
|
4300
|
-
return /* @__PURE__ */ (0,
|
|
4368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4301
4369
|
AccordionContext.Provider,
|
|
4302
4370
|
{
|
|
4303
4371
|
value: state,
|
|
4304
|
-
children: /* @__PURE__ */ (0,
|
|
4372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "kjun-accordion", "data-tone": tone, children })
|
|
4305
4373
|
}
|
|
4306
4374
|
);
|
|
4307
4375
|
}
|
|
@@ -4312,12 +4380,12 @@ function KjunAccordionItem({
|
|
|
4312
4380
|
header,
|
|
4313
4381
|
children
|
|
4314
4382
|
}) {
|
|
4315
|
-
const group = (0,
|
|
4316
|
-
(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)(() => {
|
|
4317
4385
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4318
4386
|
}, []);
|
|
4319
|
-
return /* @__PURE__ */ (0,
|
|
4320
|
-
/* @__PURE__ */ (0,
|
|
4387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-accordion-item", children: [
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4321
4389
|
"button",
|
|
4322
4390
|
{
|
|
4323
4391
|
type: "button",
|
|
@@ -4328,8 +4396,8 @@ function KjunAccordionItem({
|
|
|
4328
4396
|
className: "kjun-accordion-trigger",
|
|
4329
4397
|
onClick: () => group ? group.toggle(id) : setOwn(!own),
|
|
4330
4398
|
children: [
|
|
4331
|
-
/* @__PURE__ */ (0,
|
|
4332
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "kjun-accordion-heading", children: header || title }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4333
4401
|
KjunIcon,
|
|
4334
4402
|
{
|
|
4335
4403
|
name: "chevron-down",
|
|
@@ -4341,7 +4409,7 @@ function KjunAccordionItem({
|
|
|
4341
4409
|
]
|
|
4342
4410
|
}
|
|
4343
4411
|
),
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collapse, { open, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4345
4413
|
"div",
|
|
4346
4414
|
{
|
|
4347
4415
|
role: "region",
|
|
@@ -4358,16 +4426,16 @@ function KjunBreadcrumb({
|
|
|
4358
4426
|
renderLink,
|
|
4359
4427
|
ariaLabel = "\uD604\uC7AC \uC704\uCE58"
|
|
4360
4428
|
}) {
|
|
4361
|
-
return /* @__PURE__ */ (0,
|
|
4362
|
-
const label = /* @__PURE__ */ (0,
|
|
4363
|
-
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 }),
|
|
4364
4432
|
" ",
|
|
4365
4433
|
item.label
|
|
4366
4434
|
] });
|
|
4367
|
-
return /* @__PURE__ */ (0,
|
|
4368
|
-
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 }),
|
|
4369
4437
|
" ",
|
|
4370
|
-
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 })
|
|
4371
4439
|
] }, i);
|
|
4372
4440
|
}) });
|
|
4373
4441
|
}
|
|
@@ -4404,18 +4472,18 @@ function KjunPagination({
|
|
|
4404
4472
|
).filter((v) => v >= 1 && v <= totalPages)
|
|
4405
4473
|
]);
|
|
4406
4474
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
4407
|
-
const button = (target, label, icon) => /* @__PURE__ */ (0,
|
|
4475
|
+
const button = (target, label, icon) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4408
4476
|
"button",
|
|
4409
4477
|
{
|
|
4410
4478
|
type: "button",
|
|
4411
4479
|
"aria-label": label,
|
|
4412
4480
|
disabled: target < 1 || target > totalPages || target === current,
|
|
4413
4481
|
onClick: () => change(target),
|
|
4414
|
-
children: /* @__PURE__ */ (0,
|
|
4482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(KjunIcon, { name: icon, size: import_tokens24.tokens.extensions.pagination.iconSize })
|
|
4415
4483
|
}
|
|
4416
4484
|
);
|
|
4417
|
-
return /* @__PURE__ */ (0,
|
|
4418
|
-
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: [
|
|
4419
4487
|
(current - 1) * pageSize + 1,
|
|
4420
4488
|
" -",
|
|
4421
4489
|
" ",
|
|
@@ -4423,9 +4491,9 @@ function KjunPagination({
|
|
|
4423
4491
|
" / ",
|
|
4424
4492
|
formatter(totalRows),
|
|
4425
4493
|
"\uAC1C"
|
|
4426
|
-
] }) : /* @__PURE__ */ (0,
|
|
4427
|
-
/* @__PURE__ */ (0,
|
|
4428
|
-
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)(
|
|
4429
4497
|
KjunSelect,
|
|
4430
4498
|
{
|
|
4431
4499
|
size: "sm",
|
|
@@ -4439,20 +4507,20 @@ function KjunPagination({
|
|
|
4439
4507
|
}
|
|
4440
4508
|
}
|
|
4441
4509
|
) }),
|
|
4442
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4510
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-mobile", children: [
|
|
4443
4511
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4444
|
-
/* @__PURE__ */ (0,
|
|
4445
|
-
/* @__PURE__ */ (0,
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("strong", { children: current }),
|
|
4446
4514
|
" / ",
|
|
4447
4515
|
totalPages
|
|
4448
4516
|
] }),
|
|
4449
4517
|
button(current + 1, "\uB2E4\uC74C \uD398\uC774\uC9C0", "chevron-right")
|
|
4450
4518
|
] }),
|
|
4451
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
4519
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "kjun-pagination-desktop", children: [
|
|
4452
4520
|
showFirstLast && button(1, "\uCCAB \uD398\uC774\uC9C0", "chevrons-left"),
|
|
4453
4521
|
button(current - 1, "\uC774\uC804 \uD398\uC774\uC9C0", "chevron-left"),
|
|
4454
4522
|
pages.map(
|
|
4455
|
-
(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)(
|
|
4456
4524
|
"button",
|
|
4457
4525
|
{
|
|
4458
4526
|
type: "button",
|
|
@@ -4473,8 +4541,8 @@ function KjunPagination({
|
|
|
4473
4541
|
|
|
4474
4542
|
// packages/react/src/actions.tsx
|
|
4475
4543
|
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4476
|
-
var
|
|
4477
|
-
var
|
|
4544
|
+
var import_react38 = require("react");
|
|
4545
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4478
4546
|
function KjunIconToggle({
|
|
4479
4547
|
active = false,
|
|
4480
4548
|
activeIcon,
|
|
@@ -4493,8 +4561,8 @@ function KjunIconToggle({
|
|
|
4493
4561
|
onToggle
|
|
4494
4562
|
}) {
|
|
4495
4563
|
var _a;
|
|
4496
|
-
const navigation = (0,
|
|
4497
|
-
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)(
|
|
4498
4566
|
"button",
|
|
4499
4567
|
{
|
|
4500
4568
|
type: "button",
|
|
@@ -4509,7 +4577,7 @@ function KjunIconToggle({
|
|
|
4509
4577
|
e.stopPropagation();
|
|
4510
4578
|
onToggle == null ? void 0 : onToggle();
|
|
4511
4579
|
},
|
|
4512
|
-
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)(
|
|
4513
4581
|
KjunIcon,
|
|
4514
4582
|
{
|
|
4515
4583
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
@@ -4553,16 +4621,16 @@ function KjunCopyButton({
|
|
|
4553
4621
|
onCopyError
|
|
4554
4622
|
}) {
|
|
4555
4623
|
const feedback = useOptionalKjunFeedback();
|
|
4556
|
-
const [copied, setCopied] = (0,
|
|
4557
|
-
(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)(() => {
|
|
4558
4626
|
mounted.current = true;
|
|
4559
4627
|
return () => {
|
|
4560
4628
|
mounted.current = false;
|
|
4561
4629
|
clearTimeout(timer.current);
|
|
4562
4630
|
};
|
|
4563
4631
|
}, []);
|
|
4564
|
-
return /* @__PURE__ */ (0,
|
|
4565
|
-
/* @__PURE__ */ (0,
|
|
4632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4633
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4566
4634
|
"button",
|
|
4567
4635
|
{
|
|
4568
4636
|
type: "button",
|
|
@@ -4600,7 +4668,7 @@ function KjunCopyButton({
|
|
|
4600
4668
|
}
|
|
4601
4669
|
},
|
|
4602
4670
|
children: [
|
|
4603
|
-
/* @__PURE__ */ (0,
|
|
4671
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4604
4672
|
KjunIcon,
|
|
4605
4673
|
{
|
|
4606
4674
|
name: copied ? "check" : "copy",
|
|
@@ -4608,11 +4676,11 @@ function KjunCopyButton({
|
|
|
4608
4676
|
style: { color: copied ? "var(--_kjun-color-success)" : void 0 }
|
|
4609
4677
|
}
|
|
4610
4678
|
),
|
|
4611
|
-
text && !inline && /* @__PURE__ */ (0,
|
|
4679
|
+
text && !inline && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: copied ? successText : text })
|
|
4612
4680
|
]
|
|
4613
4681
|
}
|
|
4614
4682
|
),
|
|
4615
|
-
/* @__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" : "" })
|
|
4616
4684
|
] });
|
|
4617
4685
|
}
|
|
4618
4686
|
function KjunRefreshButton({
|
|
@@ -4634,7 +4702,7 @@ function KjunRefreshButton({
|
|
|
4634
4702
|
const reduced = useReducedMotion();
|
|
4635
4703
|
const label = ariaLabel || [targetName, mode === "text" ? text : "\uC0C8\uB85C\uACE0\uCE68"].filter(Boolean).join(" ");
|
|
4636
4704
|
const hint = (_a = tooltip != null ? tooltip : title) != null ? _a : mode === "icon" ? label : "";
|
|
4637
|
-
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)(
|
|
4638
4706
|
KjunButton,
|
|
4639
4707
|
{
|
|
4640
4708
|
...props,
|
|
@@ -4662,8 +4730,8 @@ function KjunExternalLink({
|
|
|
4662
4730
|
label,
|
|
4663
4731
|
children
|
|
4664
4732
|
}) {
|
|
4665
|
-
const url = safeExternalUrl(href), name = label || (mode === "icon" ? "\uC678\uBD80 \uB9C1\uD06C" : void 0), body = mode === "icon" ? /* @__PURE__ */ (0,
|
|
4666
|
-
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)(
|
|
4667
4735
|
"a",
|
|
4668
4736
|
{
|
|
4669
4737
|
href: url,
|
|
@@ -4675,14 +4743,14 @@ function KjunExternalLink({
|
|
|
4675
4743
|
onClick: (e) => e.stopPropagation(),
|
|
4676
4744
|
children: [
|
|
4677
4745
|
body,
|
|
4678
|
-
mode === "text" && /* @__PURE__ */ (0,
|
|
4679
|
-
!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)" })
|
|
4680
4748
|
]
|
|
4681
4749
|
}
|
|
4682
|
-
) : /* @__PURE__ */ (0,
|
|
4750
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-label": name, children: body });
|
|
4683
4751
|
}
|
|
4684
4752
|
function KjunScrollFade({ children }) {
|
|
4685
|
-
const ref = (0,
|
|
4753
|
+
const ref = (0, import_react38.useRef)(null), [edges, setEdges] = (0, import_react38.useState)({ left: false, right: false });
|
|
4686
4754
|
const update = () => {
|
|
4687
4755
|
const el = ref.current;
|
|
4688
4756
|
if (el)
|
|
@@ -4694,7 +4762,7 @@ function KjunScrollFade({ children }) {
|
|
|
4694
4762
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
4695
4763
|
});
|
|
4696
4764
|
};
|
|
4697
|
-
(0,
|
|
4765
|
+
(0, import_react38.useEffect)(() => {
|
|
4698
4766
|
update();
|
|
4699
4767
|
const observer = new ResizeObserver(update);
|
|
4700
4768
|
if (ref.current) {
|
|
@@ -4704,7 +4772,7 @@ function KjunScrollFade({ children }) {
|
|
|
4704
4772
|
return () => observer.disconnect();
|
|
4705
4773
|
}, [children]);
|
|
4706
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;
|
|
4707
|
-
return /* @__PURE__ */ (0,
|
|
4775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4708
4776
|
"div",
|
|
4709
4777
|
{
|
|
4710
4778
|
ref,
|
|
@@ -4718,13 +4786,13 @@ function KjunScrollFade({ children }) {
|
|
|
4718
4786
|
|
|
4719
4787
|
// packages/react/src/data-state.tsx
|
|
4720
4788
|
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4721
|
-
var
|
|
4789
|
+
var import_react40 = require("react");
|
|
4722
4790
|
|
|
4723
4791
|
// shared/package-runtime/use-loading-reveal.ts
|
|
4724
|
-
var
|
|
4792
|
+
var import_react39 = require("react");
|
|
4725
4793
|
function useLoadingReveal(active, delay = 0) {
|
|
4726
|
-
const [revealed, setRevealed] = (0,
|
|
4727
|
-
(0,
|
|
4794
|
+
const [revealed, setRevealed] = (0, import_react39.useState)(false);
|
|
4795
|
+
(0, import_react39.useEffect)(() => {
|
|
4728
4796
|
setRevealed(false);
|
|
4729
4797
|
if (!active || delay <= 0) return;
|
|
4730
4798
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -4734,10 +4802,10 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
4734
4802
|
}
|
|
4735
4803
|
|
|
4736
4804
|
// packages/react/src/data-state.tsx
|
|
4737
|
-
var
|
|
4805
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4738
4806
|
function useQueryDisplay(props) {
|
|
4739
4807
|
var _a;
|
|
4740
|
-
const [state, setState] = (0,
|
|
4808
|
+
const [state, setState] = (0, import_react40.useState)(() => (0, import_tokens26.initialQueryDisplay)(props));
|
|
4741
4809
|
let next = state;
|
|
4742
4810
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
4743
4811
|
next = (0, import_tokens26.advanceQueryDisplay)(state, props);
|
|
@@ -4771,12 +4839,12 @@ function KjunDataState({
|
|
|
4771
4839
|
...query2
|
|
4772
4840
|
}) {
|
|
4773
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);
|
|
4774
|
-
return /* @__PURE__ */ (0,
|
|
4775
|
-
/* @__PURE__ */ (0,
|
|
4776
|
-
/* @__PURE__ */ (0,
|
|
4777
|
-
/* @__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 })
|
|
4778
4846
|
] }) }),
|
|
4779
|
-
state.initialLoading ? /* @__PURE__ */ (0,
|
|
4847
|
+
state.initialLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4780
4848
|
"div",
|
|
4781
4849
|
{
|
|
4782
4850
|
className: "kjun-data-loading-block",
|
|
@@ -4784,13 +4852,13 @@ function KjunDataState({
|
|
|
4784
4852
|
"aria-label": revealed ? loadingText : void 0,
|
|
4785
4853
|
"aria-hidden": revealed ? void 0 : true,
|
|
4786
4854
|
style: { paddingBlock: loadingPadding === "none" ? 0 : padding, visibility: revealed ? void 0 : "hidden" },
|
|
4787
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__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 })
|
|
4790
4858
|
] }))
|
|
4791
4859
|
}
|
|
4792
|
-
) : blockingError ? /* @__PURE__ */ (0,
|
|
4793
|
-
(!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)(
|
|
4794
4862
|
"div",
|
|
4795
4863
|
{
|
|
4796
4864
|
className: "kjun-data-content" + (concealed ? " kjun-data-concealed" : ""),
|
|
@@ -4803,13 +4871,13 @@ function KjunDataState({
|
|
|
4803
4871
|
},
|
|
4804
4872
|
"content"
|
|
4805
4873
|
),
|
|
4806
|
-
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: [
|
|
4807
4875
|
visibleRefreshError,
|
|
4808
4876
|
" \xB7 \uC774\uC804 \uC870\uD68C \uACB0\uACFC\uB97C \uD45C\uC2DC\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."
|
|
4809
4877
|
] }) })
|
|
4810
4878
|
] });
|
|
4811
4879
|
}
|
|
4812
|
-
var KjunErrorBoundary = class extends
|
|
4880
|
+
var KjunErrorBoundary = class extends import_react40.Component {
|
|
4813
4881
|
constructor() {
|
|
4814
4882
|
super(...arguments);
|
|
4815
4883
|
this.state = { error: false };
|
|
@@ -4822,10 +4890,10 @@ var KjunErrorBoundary = class extends import_react39.Component {
|
|
|
4822
4890
|
(_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error, info);
|
|
4823
4891
|
}
|
|
4824
4892
|
render() {
|
|
4825
|
-
return this.state.error ? this.props.fallback || /* @__PURE__ */ (0,
|
|
4826
|
-
/* @__PURE__ */ (0,
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
/* @__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)(
|
|
4829
4897
|
KjunButton,
|
|
4830
4898
|
{
|
|
4831
4899
|
onClick: () => {
|
|
@@ -4887,37 +4955,37 @@ function webMarketLayout(columns, showActions, widthClass) {
|
|
|
4887
4955
|
}
|
|
4888
4956
|
|
|
4889
4957
|
// packages/react/src/market-layout.tsx
|
|
4890
|
-
var
|
|
4958
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4891
4959
|
function MarketColumns({ columns, showActions, widthClass }) {
|
|
4892
4960
|
const layout = webMarketLayout(columns, showActions, widthClass);
|
|
4893
|
-
return /* @__PURE__ */ (0,
|
|
4894
|
-
showActions && /* @__PURE__ */ (0,
|
|
4895
|
-
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))
|
|
4896
4964
|
] });
|
|
4897
4965
|
}
|
|
4898
4966
|
|
|
4899
4967
|
// packages/react/src/market-skeleton.tsx
|
|
4900
|
-
var
|
|
4968
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4901
4969
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false, alignClass, widthClass }) {
|
|
4902
4970
|
const cols = normalizeMarketColumns(columns);
|
|
4903
|
-
return /* @__PURE__ */ (0,
|
|
4904
|
-
/* @__PURE__ */ (0,
|
|
4905
|
-
/* @__PURE__ */ (0,
|
|
4906
|
-
showActions && /* @__PURE__ */ (0,
|
|
4907
|
-
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))
|
|
4908
4976
|
] }) }),
|
|
4909
|
-
/* @__PURE__ */ (0,
|
|
4910
|
-
showActions && /* @__PURE__ */ (0,
|
|
4911
|
-
cols.map((col, i) => /* @__PURE__ */ (0,
|
|
4912
|
-
/* @__PURE__ */ (0,
|
|
4913
|
-
/* @__PURE__ */ (0,
|
|
4914
|
-
] }) : /* @__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))
|
|
4915
4983
|
] }, row)) })
|
|
4916
4984
|
] }) });
|
|
4917
4985
|
}
|
|
4918
4986
|
|
|
4919
4987
|
// packages/react/src/skeletons.tsx
|
|
4920
|
-
var
|
|
4988
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4921
4989
|
function KjunListSkeleton({
|
|
4922
4990
|
rows = 8,
|
|
4923
4991
|
variant = "market",
|
|
@@ -4925,10 +4993,10 @@ function KjunListSkeleton({
|
|
|
4925
4993
|
avatarSize = import_tokens29.tokens.extensions.skeleton.listAvatarSize,
|
|
4926
4994
|
quote = true
|
|
4927
4995
|
}) {
|
|
4928
|
-
return /* @__PURE__ */ (0,
|
|
4929
|
-
avatar && /* @__PURE__ */ (0,
|
|
4930
|
-
/* @__PURE__ */ (0,
|
|
4931
|
-
/* @__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)(
|
|
4932
5000
|
KjunSkeleton,
|
|
4933
5001
|
{
|
|
4934
5002
|
type: "block",
|
|
@@ -4936,11 +5004,11 @@ function KjunListSkeleton({
|
|
|
4936
5004
|
width: i % 2 ? "80%" : "65%"
|
|
4937
5005
|
}
|
|
4938
5006
|
),
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunSkeleton, { type: "block", height: import_tokens29.tokens.extensions.skeleton.lineHeights.sm, width: "50%" })
|
|
4940
5008
|
] }),
|
|
4941
|
-
quote && /* @__PURE__ */ (0,
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
4943
|
-
/* @__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 })
|
|
4944
5012
|
] })
|
|
4945
5013
|
] }, i)) });
|
|
4946
5014
|
}
|
|
@@ -4950,19 +5018,19 @@ function KjunFormSkeleton({
|
|
|
4950
5018
|
multiline = false,
|
|
4951
5019
|
size = "md"
|
|
4952
5020
|
}) {
|
|
4953
|
-
return /* @__PURE__ */ (0,
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4954
5022
|
"div",
|
|
4955
5023
|
{
|
|
4956
5024
|
"aria-hidden": "true",
|
|
4957
5025
|
className: "kjun-form-skeleton",
|
|
4958
5026
|
"data-columns": columns,
|
|
4959
5027
|
style: { "--_kjun-form-skeleton-radius": `${import_tokens29.tokens.input[size].radius}px` },
|
|
4960
|
-
children: fields.map((field, i) => /* @__PURE__ */ (0,
|
|
4961
|
-
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 }) : (
|
|
4962
5030
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
4963
|
-
/* @__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 }) })
|
|
4964
5032
|
),
|
|
4965
|
-
/* @__PURE__ */ (0,
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4966
5034
|
KjunSkeleton,
|
|
4967
5035
|
{
|
|
4968
5036
|
type: "block",
|
|
@@ -4983,7 +5051,7 @@ function KjunChartSkeleton({
|
|
|
4983
5051
|
columns = 14
|
|
4984
5052
|
}) {
|
|
4985
5053
|
const kind = chartSkeletonKind(requestedKind), revealed = useLoadingReveal(true, loadingDelay), status = revealed && loadingText ? "status" : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns);
|
|
4986
|
-
return /* @__PURE__ */ (0,
|
|
5054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4987
5055
|
"div",
|
|
4988
5056
|
{
|
|
4989
5057
|
className: "kjun-chart-skeleton",
|
|
@@ -4991,11 +5059,11 @@ function KjunChartSkeleton({
|
|
|
4991
5059
|
"data-skeleton": skeleton ? void 0 : "false",
|
|
4992
5060
|
"aria-hidden": revealed ? void 0 : true,
|
|
4993
5061
|
style: { height, visibility: revealed ? void 0 : "hidden" },
|
|
4994
|
-
children: !skeleton ? /* @__PURE__ */ (0,
|
|
4995
|
-
/* @__PURE__ */ (0,
|
|
4996
|
-
loadingText && /* @__PURE__ */ (0,
|
|
4997
|
-
] }) : /* @__PURE__ */ (0,
|
|
4998
|
-
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)(
|
|
4999
5067
|
"div",
|
|
5000
5068
|
{
|
|
5001
5069
|
className: "kjun-chart-skeleton-matrix",
|
|
@@ -5005,7 +5073,7 @@ function KjunChartSkeleton({
|
|
|
5005
5073
|
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`,
|
|
5006
5074
|
gridTemplateRows: `repeat(${rowCount}, minmax(0, 1fr))`
|
|
5007
5075
|
},
|
|
5008
|
-
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0,
|
|
5076
|
+
children: Array.from({ length: rowCount * columnCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5009
5077
|
"div",
|
|
5010
5078
|
{
|
|
5011
5079
|
className: "kjun-chart-skeleton-cell",
|
|
@@ -5015,7 +5083,7 @@ function KjunChartSkeleton({
|
|
|
5015
5083
|
i
|
|
5016
5084
|
))
|
|
5017
5085
|
}
|
|
5018
|
-
) : /* @__PURE__ */ (0,
|
|
5086
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5019
5087
|
"svg",
|
|
5020
5088
|
{
|
|
5021
5089
|
viewBox: chartFrameViewBox,
|
|
@@ -5023,7 +5091,7 @@ function KjunChartSkeleton({
|
|
|
5023
5091
|
className: "kjun-chart-skeleton-plot",
|
|
5024
5092
|
"data-kjun-chart-part": "plot",
|
|
5025
5093
|
"aria-hidden": "true",
|
|
5026
|
-
children: /* @__PURE__ */ (0,
|
|
5094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5027
5095
|
"path",
|
|
5028
5096
|
{
|
|
5029
5097
|
d: chartFramePath,
|
|
@@ -5035,7 +5103,7 @@ function KjunChartSkeleton({
|
|
|
5035
5103
|
)
|
|
5036
5104
|
}
|
|
5037
5105
|
),
|
|
5038
|
-
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 }) })
|
|
5039
5107
|
] })
|
|
5040
5108
|
}
|
|
5041
5109
|
);
|
|
@@ -5043,13 +5111,13 @@ function KjunChartSkeleton({
|
|
|
5043
5111
|
|
|
5044
5112
|
// packages/react/src/financial-display.tsx
|
|
5045
5113
|
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5046
|
-
var
|
|
5114
|
+
var import_react42 = require("react");
|
|
5047
5115
|
|
|
5048
5116
|
// packages/react/src/number-display.tsx
|
|
5049
5117
|
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5050
5118
|
|
|
5051
5119
|
// shared/package-runtime/use-number-motion.ts
|
|
5052
|
-
var
|
|
5120
|
+
var import_react41 = require("react");
|
|
5053
5121
|
|
|
5054
5122
|
// shared/package-runtime/number-motion.ts
|
|
5055
5123
|
var import_tokens30 = require("@kjun-ui/tokens");
|
|
@@ -5095,14 +5163,14 @@ function createNumberMotion(apply) {
|
|
|
5095
5163
|
|
|
5096
5164
|
// shared/package-runtime/use-number-motion.ts
|
|
5097
5165
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
5098
|
-
const [display, setDisplay] = (0,
|
|
5099
|
-
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);
|
|
5100
5168
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5101
|
-
(0,
|
|
5169
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
5102
5170
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
5103
5171
|
motion.current.update(value, animated, fromPrevious, reduced);
|
|
5104
5172
|
}, [value, animated, fromPrevious, reduced]);
|
|
5105
|
-
(0,
|
|
5173
|
+
(0, import_react41.useLayoutEffect)(() => () => {
|
|
5106
5174
|
var _a;
|
|
5107
5175
|
(_a = motion.current) == null ? void 0 : _a.cancel();
|
|
5108
5176
|
motion.current = null;
|
|
@@ -5132,7 +5200,7 @@ function formatRelativeTime(value, now = Date.now()) {
|
|
|
5132
5200
|
}
|
|
5133
5201
|
|
|
5134
5202
|
// packages/react/src/number-display.tsx
|
|
5135
|
-
var
|
|
5203
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5136
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;
|
|
5137
5205
|
var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
|
|
5138
5206
|
minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
|
|
@@ -5152,10 +5220,10 @@ function KjunAnimatedNumber({
|
|
|
5152
5220
|
className = ""
|
|
5153
5221
|
}) {
|
|
5154
5222
|
const n = useCountUp(value, animated, fromPrevious);
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5156
|
-
prefix && /* @__PURE__ */ (0,
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5158
|
-
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 })
|
|
5159
5227
|
] });
|
|
5160
5228
|
}
|
|
5161
5229
|
function KjunFreshness({
|
|
@@ -5164,11 +5232,11 @@ function KjunFreshness({
|
|
|
5164
5232
|
fetchedAt,
|
|
5165
5233
|
formatter
|
|
5166
5234
|
}) {
|
|
5167
|
-
return stale ? /* @__PURE__ */ (0,
|
|
5235
|
+
return stale ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5168
5236
|
KjunTooltip,
|
|
5169
5237
|
{
|
|
5170
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)) : ""),
|
|
5171
|
-
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" }) })
|
|
5172
5240
|
}
|
|
5173
5241
|
) : null;
|
|
5174
5242
|
}
|
|
@@ -5182,14 +5250,14 @@ function KjunPriceCell({
|
|
|
5182
5250
|
flashClass = "",
|
|
5183
5251
|
fromPrevious = true
|
|
5184
5252
|
}) {
|
|
5185
|
-
return value == null ? /* @__PURE__ */ (0,
|
|
5186
|
-
/* @__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)(
|
|
5187
5255
|
"span",
|
|
5188
5256
|
{
|
|
5189
5257
|
className: "kjun-price-cell " + flashClass,
|
|
5190
5258
|
ref: domainColorRef(/\bkjun-price-flash-(up|down)/.test(flashClass)),
|
|
5191
5259
|
style: { color: stale ? "var(--_kjun-color-text-tertiary)" : void 0 },
|
|
5192
|
-
children: /* @__PURE__ */ (0,
|
|
5260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5193
5261
|
KjunAnimatedNumber,
|
|
5194
5262
|
{
|
|
5195
5263
|
value,
|
|
@@ -5199,7 +5267,7 @@ function KjunPriceCell({
|
|
|
5199
5267
|
)
|
|
5200
5268
|
}
|
|
5201
5269
|
),
|
|
5202
|
-
showFreshness && /* @__PURE__ */ (0,
|
|
5270
|
+
showFreshness && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunFreshness, { stale, source, fetchedAt })
|
|
5203
5271
|
] });
|
|
5204
5272
|
}
|
|
5205
5273
|
function KjunSignedValue({
|
|
@@ -5218,7 +5286,7 @@ function KjunSignedValue({
|
|
|
5218
5286
|
}) {
|
|
5219
5287
|
const n = finiteNumber(value), role2 = loading || n === null ? "text-secondary" : stale ? "text-tertiary" : n > 0 ? "price-up" : n < 0 ? "price-down" : "price-neutral";
|
|
5220
5288
|
const display = n === null ? "\u2014" : formatter ? formatter(n) : prefix + (showSign && n > 0 ? "+" : "") + format(kind === "percent" && !isRaw ? n * 100 : n, decimals) + (kind === "percent" ? "%" : "") + suffix;
|
|
5221
|
-
return /* @__PURE__ */ (0,
|
|
5289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5222
5290
|
"span",
|
|
5223
5291
|
{
|
|
5224
5292
|
className: "kjun-signed-value",
|
|
@@ -5230,15 +5298,15 @@ function KjunSignedValue({
|
|
|
5230
5298
|
background: tone === "pill" && !stale && n !== null ? `var(--_kjun-color-${role2}-bg)` : void 0
|
|
5231
5299
|
},
|
|
5232
5300
|
children: [
|
|
5233
|
-
loading ? /* @__PURE__ */ (0,
|
|
5234
|
-
!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 })
|
|
5235
5303
|
]
|
|
5236
5304
|
}
|
|
5237
5305
|
);
|
|
5238
5306
|
}
|
|
5239
5307
|
|
|
5240
5308
|
// packages/react/src/financial-display.tsx
|
|
5241
|
-
var
|
|
5309
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5242
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 };
|
|
5243
5311
|
function KjunDeviation({
|
|
5244
5312
|
value,
|
|
@@ -5249,11 +5317,11 @@ function KjunDeviation({
|
|
|
5249
5317
|
}) {
|
|
5250
5318
|
const n = finiteNumber(value);
|
|
5251
5319
|
if (n === null)
|
|
5252
|
-
return /* @__PURE__ */ (0,
|
|
5320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
|
|
5253
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) + "%";
|
|
5254
5322
|
if (variant === "badge")
|
|
5255
|
-
return /* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "kjun-deviation-badge", children: [
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5257
5325
|
KjunBadge,
|
|
5258
5326
|
{
|
|
5259
5327
|
variant: neutral ? "secondary" : n > 0 ? "price-up" : "price-down",
|
|
@@ -5262,11 +5330,11 @@ function KjunDeviation({
|
|
|
5262
5330
|
children: label
|
|
5263
5331
|
}
|
|
5264
5332
|
),
|
|
5265
|
-
!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)(
|
|
5266
5334
|
KjunTooltip,
|
|
5267
5335
|
{
|
|
5268
5336
|
content: `\uAD34\uB9AC\uC728 ${signalThreshold}% \uCD08\uACFC \u2014 \uCC28\uC775\uAC70\uB798 \uAE30\uD68C \uAC00\uB2A5`,
|
|
5269
|
-
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)(
|
|
5270
5338
|
KjunIcon,
|
|
5271
5339
|
{
|
|
5272
5340
|
name: "alert-triangle",
|
|
@@ -5277,7 +5345,7 @@ function KjunDeviation({
|
|
|
5277
5345
|
}
|
|
5278
5346
|
)
|
|
5279
5347
|
] });
|
|
5280
|
-
return /* @__PURE__ */ (0,
|
|
5348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5281
5349
|
"span",
|
|
5282
5350
|
{
|
|
5283
5351
|
className: "kjun-deviation",
|
|
@@ -5285,7 +5353,7 @@ function KjunDeviation({
|
|
|
5285
5353
|
"data-variant": variant,
|
|
5286
5354
|
style: { color: `var(--_kjun-color-${role2})`, fontWeight: level === "strong" ? import_tokens32.tokens.typography.numberLg.fontWeight : import_tokens32.tokens.typography.control.fontWeight },
|
|
5287
5355
|
children: [
|
|
5288
|
-
variant === "pill" && /* @__PURE__ */ (0,
|
|
5356
|
+
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5289
5357
|
"span",
|
|
5290
5358
|
{
|
|
5291
5359
|
"aria-hidden": "true",
|
|
@@ -5296,7 +5364,7 @@ function KjunDeviation({
|
|
|
5296
5364
|
}
|
|
5297
5365
|
}
|
|
5298
5366
|
),
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: label })
|
|
5300
5368
|
]
|
|
5301
5369
|
}
|
|
5302
5370
|
);
|
|
@@ -5312,8 +5380,8 @@ function KjunHeatmapCell({
|
|
|
5312
5380
|
const ratio = max === min ? 0.5 : Math.min(1, Math.max(0, (value - min) / (max - min)));
|
|
5313
5381
|
const role2 = mode === "price" ? ratio >= 0.5 ? "price-up" : "price-down" : mode === "diverging" ? ratio >= 0.5 ? "success" : "danger" : color;
|
|
5314
5382
|
const magnitude = mode === "sequential" ? ratio : Math.abs(ratio - 0.5) * 2, { heatMinimum, heatMaximum } = import_tokens32.tokens.states.opacity;
|
|
5315
|
-
return /* @__PURE__ */ (0,
|
|
5316
|
-
/* @__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)(
|
|
5317
5385
|
"span",
|
|
5318
5386
|
{
|
|
5319
5387
|
"aria-hidden": "true",
|
|
@@ -5321,7 +5389,7 @@ function KjunHeatmapCell({
|
|
|
5321
5389
|
style: magnitude ? { background: `var(--_kjun-color-${role2})`, opacity: heatMinimum + (heatMaximum - heatMinimum) * magnitude } : { background: "var(--_kjun-color-secondary)" }
|
|
5322
5390
|
}
|
|
5323
5391
|
),
|
|
5324
|
-
/* @__PURE__ */ (0,
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: children != null ? children : value })
|
|
5325
5393
|
] });
|
|
5326
5394
|
}
|
|
5327
5395
|
function KjunProgressCell({
|
|
@@ -5333,8 +5401,8 @@ function KjunProgressCell({
|
|
|
5333
5401
|
height = import_tokens32.tokens.extensions.financial.progressHeight
|
|
5334
5402
|
}) {
|
|
5335
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;
|
|
5336
|
-
return /* @__PURE__ */ (0,
|
|
5337
|
-
/* @__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)(
|
|
5338
5406
|
"span",
|
|
5339
5407
|
{
|
|
5340
5408
|
style: {
|
|
@@ -5343,7 +5411,7 @@ function KjunProgressCell({
|
|
|
5343
5411
|
}
|
|
5344
5412
|
}
|
|
5345
5413
|
) }),
|
|
5346
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5414
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
|
|
5347
5415
|
Math.round(percent),
|
|
5348
5416
|
"%"
|
|
5349
5417
|
] })
|
|
@@ -5355,7 +5423,7 @@ function KjunCollectionMark({
|
|
|
5355
5423
|
size = "md"
|
|
5356
5424
|
}) {
|
|
5357
5425
|
const box = import_tokens32.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens32.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
5358
|
-
return /* @__PURE__ */ (0,
|
|
5426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5359
5427
|
KjunIcon,
|
|
5360
5428
|
{
|
|
5361
5429
|
ref: domainColorRef(active),
|
|
@@ -5385,7 +5453,7 @@ function KjunExecutionStatusBadge({
|
|
|
5385
5453
|
size = "md"
|
|
5386
5454
|
}) {
|
|
5387
5455
|
const state = status ? executionStates[status] : void 0;
|
|
5388
|
-
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") });
|
|
5389
5457
|
}
|
|
5390
5458
|
function KjunSparkline({
|
|
5391
5459
|
data = [],
|
|
@@ -5398,10 +5466,10 @@ function KjunSparkline({
|
|
|
5398
5466
|
stretch = false,
|
|
5399
5467
|
ariaLabel
|
|
5400
5468
|
}) {
|
|
5401
|
-
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(
|
|
5402
5470
|
(v, i) => `${2 + i / Math.max(1, values.length - 1) * (width - 4)},${2 + height - 4 - (v - min) / range * (height - 4)}`
|
|
5403
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"})`;
|
|
5404
|
-
return /* @__PURE__ */ (0,
|
|
5472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5405
5473
|
"svg",
|
|
5406
5474
|
{
|
|
5407
5475
|
ref: domainColorRef(!color && semantic === "price" && change !== 0),
|
|
@@ -5414,12 +5482,12 @@ function KjunSparkline({
|
|
|
5414
5482
|
"aria-hidden": !ariaLabel || void 0,
|
|
5415
5483
|
className: "kjun-sparkline",
|
|
5416
5484
|
children: [
|
|
5417
|
-
fill && values.length > 1 && /* @__PURE__ */ (0,
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
/* @__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 })
|
|
5421
5489
|
] }) }),
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5423
5491
|
"polygon",
|
|
5424
5492
|
{
|
|
5425
5493
|
points: `2,${height - 2} ${points} ${width - 2},${height - 2}`,
|
|
@@ -5427,7 +5495,7 @@ function KjunSparkline({
|
|
|
5427
5495
|
}
|
|
5428
5496
|
)
|
|
5429
5497
|
] }),
|
|
5430
|
-
values.length > 1 ? /* @__PURE__ */ (0,
|
|
5498
|
+
values.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5431
5499
|
"polyline",
|
|
5432
5500
|
{
|
|
5433
5501
|
points,
|
|
@@ -5438,7 +5506,7 @@ function KjunSparkline({
|
|
|
5438
5506
|
strokeLinejoin: "round",
|
|
5439
5507
|
vectorEffect: stretch ? "non-scaling-stroke" : void 0
|
|
5440
5508
|
}
|
|
5441
|
-
) : 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
|
|
5442
5510
|
]
|
|
5443
5511
|
}
|
|
5444
5512
|
);
|
|
@@ -5446,7 +5514,7 @@ function KjunSparkline({
|
|
|
5446
5514
|
|
|
5447
5515
|
// shared/package-runtime/table.ts
|
|
5448
5516
|
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5449
|
-
var
|
|
5517
|
+
var import_react43 = require("react");
|
|
5450
5518
|
|
|
5451
5519
|
// shared/package-runtime/table-model.ts
|
|
5452
5520
|
function getValue(row, key) {
|
|
@@ -5490,11 +5558,11 @@ function useTableModel(props) {
|
|
|
5490
5558
|
expandSingle = false,
|
|
5491
5559
|
onExpandedRowsChange
|
|
5492
5560
|
} = props;
|
|
5493
|
-
const [internalSort, setSort] = (0,
|
|
5561
|
+
const [internalSort, setSort] = (0, import_react43.useState)({
|
|
5494
5562
|
key: "",
|
|
5495
5563
|
order: "asc"
|
|
5496
|
-
}), [internalExpanded, setExpanded] = (0,
|
|
5497
|
-
(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), []);
|
|
5498
5566
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5499
5567
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5500
5568
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5584,7 +5652,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
5584
5652
|
|
|
5585
5653
|
// packages/react/src/table-toolbar.tsx
|
|
5586
5654
|
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5587
|
-
var
|
|
5655
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5588
5656
|
function TableToolbar({
|
|
5589
5657
|
selectable,
|
|
5590
5658
|
selected,
|
|
@@ -5597,20 +5665,20 @@ function TableToolbar({
|
|
|
5597
5665
|
searchPlaceholder,
|
|
5598
5666
|
toolbar
|
|
5599
5667
|
}) {
|
|
5600
|
-
return /* @__PURE__ */ (0,
|
|
5601
|
-
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)(
|
|
5602
5670
|
"div",
|
|
5603
5671
|
{
|
|
5604
5672
|
role: "group",
|
|
5605
5673
|
"aria-label": "\uC120\uD0DD \uC791\uC5C5",
|
|
5606
5674
|
className: "kjun-table-selection",
|
|
5607
5675
|
children: [
|
|
5608
|
-
/* @__PURE__ */ (0,
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("strong", { children: [
|
|
5609
5677
|
selected.length,
|
|
5610
5678
|
"\uAC1C \uC120\uD0DD"
|
|
5611
5679
|
] }),
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5613
|
-
/* @__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)(
|
|
5614
5682
|
KjunButton,
|
|
5615
5683
|
{
|
|
5616
5684
|
size: "xs",
|
|
@@ -5623,8 +5691,8 @@ function TableToolbar({
|
|
|
5623
5691
|
]
|
|
5624
5692
|
}
|
|
5625
5693
|
),
|
|
5626
|
-
(searchable || toolbar) && /* @__PURE__ */ (0,
|
|
5627
|
-
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)(
|
|
5628
5696
|
KjunInput,
|
|
5629
5697
|
{
|
|
5630
5698
|
size: "sm",
|
|
@@ -5645,10 +5713,10 @@ function TableToolbar({
|
|
|
5645
5713
|
|
|
5646
5714
|
// packages/react/src/table-grid.tsx
|
|
5647
5715
|
var import_tokens36 = require("@kjun-ui/tokens");
|
|
5648
|
-
var
|
|
5716
|
+
var import_react45 = require("react");
|
|
5649
5717
|
|
|
5650
5718
|
// packages/react/src/table-check.tsx
|
|
5651
|
-
var
|
|
5719
|
+
var import_react44 = require("react");
|
|
5652
5720
|
|
|
5653
5721
|
// shared/package-runtime/component-icons.ts
|
|
5654
5722
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -5656,22 +5724,22 @@ var componentIcons = { minus: import_minus.default };
|
|
|
5656
5724
|
|
|
5657
5725
|
// packages/react/src/table-check.tsx
|
|
5658
5726
|
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5659
|
-
var
|
|
5660
|
-
var TableCheck = (0,
|
|
5727
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5728
|
+
var TableCheck = (0, import_react44.forwardRef)(
|
|
5661
5729
|
function TableCheck2(props, ref) {
|
|
5662
5730
|
const size = import_tokens35.tokens.extensions.checkbox.iconSizes.sm;
|
|
5663
|
-
return /* @__PURE__ */ (0,
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
/* @__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" })
|
|
5667
5735
|
] }) });
|
|
5668
5736
|
}
|
|
5669
5737
|
);
|
|
5670
5738
|
|
|
5671
5739
|
// packages/react/src/table-grid.tsx
|
|
5672
|
-
var
|
|
5740
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5673
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 }) {
|
|
5674
|
-
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)(
|
|
5675
5743
|
"table",
|
|
5676
5744
|
{
|
|
5677
5745
|
className: "kjun-table",
|
|
@@ -5680,12 +5748,12 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5680
5748
|
"data-hoverable": hoverable,
|
|
5681
5749
|
"data-striped": striped,
|
|
5682
5750
|
children: [
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5684
5752
|
"thead",
|
|
5685
5753
|
{
|
|
5686
5754
|
style: stickyHeader ? { position: "sticky", top: 0, zIndex: 2 } : void 0,
|
|
5687
|
-
children: /* @__PURE__ */ (0,
|
|
5688
|
-
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)(
|
|
5689
5757
|
TableCheck,
|
|
5690
5758
|
{
|
|
5691
5759
|
"aria-label": "\uC804\uCCB4 \uC120\uD0DD",
|
|
@@ -5696,22 +5764,22 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5696
5764
|
onChange: state.toggleAll
|
|
5697
5765
|
}
|
|
5698
5766
|
) }),
|
|
5699
|
-
expandable && /* @__PURE__ */ (0,
|
|
5700
|
-
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)(
|
|
5701
5769
|
"th",
|
|
5702
5770
|
{
|
|
5703
5771
|
scope: "col",
|
|
5704
5772
|
style: { width: col.width, textAlign: col.align },
|
|
5705
5773
|
className: col.headerClass,
|
|
5706
5774
|
"aria-sort": col.sortable && sortable !== false ? state.sort.key === col.key ? state.sort.order === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
5707
|
-
children: col.sortable && sortable !== false ? /* @__PURE__ */ (0,
|
|
5775
|
+
children: col.sortable && sortable !== false ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5708
5776
|
"button",
|
|
5709
5777
|
{
|
|
5710
5778
|
type: "button",
|
|
5711
5779
|
onClick: () => state.sortColumn(col),
|
|
5712
5780
|
children: [
|
|
5713
5781
|
col.label,
|
|
5714
|
-
state.sort.key === col.key && /* @__PURE__ */ (0,
|
|
5782
|
+
state.sort.key === col.key && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5715
5783
|
KjunIcon,
|
|
5716
5784
|
{
|
|
5717
5785
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
@@ -5727,10 +5795,10 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5727
5795
|
] })
|
|
5728
5796
|
}
|
|
5729
5797
|
),
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5731
|
-
selectable && /* @__PURE__ */ (0,
|
|
5732
|
-
expandable && /* @__PURE__ */ (0,
|
|
5733
|
-
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)(
|
|
5734
5802
|
KjunSkeleton,
|
|
5735
5803
|
{
|
|
5736
5804
|
type: "block",
|
|
@@ -5738,15 +5806,15 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5738
5806
|
width: col.key === "actions" ? import_tokens36.tokens.table.actionColumnWidth : "75%"
|
|
5739
5807
|
}
|
|
5740
5808
|
) }, col.key))
|
|
5741
|
-
] }, 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)(
|
|
5742
5810
|
"td",
|
|
5743
5811
|
{
|
|
5744
5812
|
colSpan: visible.length + Number(selectable) + Number(expandable),
|
|
5745
5813
|
className: "kjun-table-empty",
|
|
5746
5814
|
children: emptyContent || emptyText
|
|
5747
5815
|
}
|
|
5748
|
-
) }) : state.rows.map((row, i) => /* @__PURE__ */ (0,
|
|
5749
|
-
/* @__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)(
|
|
5750
5818
|
"tr",
|
|
5751
5819
|
{
|
|
5752
5820
|
className: "kjun-table-row-action " + customClass(row, i),
|
|
@@ -5755,9 +5823,9 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5755
5823
|
"data-selected": state.selectedRow(row) || void 0,
|
|
5756
5824
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5757
5825
|
children: [
|
|
5758
|
-
selectable && /* @__PURE__ */ (0,
|
|
5759
|
-
expandable && /* @__PURE__ */ (0,
|
|
5760
|
-
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)(
|
|
5761
5829
|
"td",
|
|
5762
5830
|
{
|
|
5763
5831
|
style: { textAlign: col.align },
|
|
@@ -5770,7 +5838,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5770
5838
|
]
|
|
5771
5839
|
}
|
|
5772
5840
|
),
|
|
5773
|
-
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)(
|
|
5774
5842
|
"td",
|
|
5775
5843
|
{
|
|
5776
5844
|
colSpan: visible.length + Number(selectable) + 1,
|
|
@@ -5784,7 +5852,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
5784
5852
|
}
|
|
5785
5853
|
|
|
5786
5854
|
// packages/react/src/table-cards.tsx
|
|
5787
|
-
var
|
|
5855
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5788
5856
|
function TableCards({
|
|
5789
5857
|
initialLoading,
|
|
5790
5858
|
skeletonRows,
|
|
@@ -5805,7 +5873,7 @@ function TableCards({
|
|
|
5805
5873
|
rowKeyDown
|
|
5806
5874
|
}) {
|
|
5807
5875
|
const { title, subtitle, badges, inline, sections, actions, columnsForSection } = layout;
|
|
5808
|
-
return /* @__PURE__ */ (0,
|
|
5876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5809
5877
|
"div",
|
|
5810
5878
|
{
|
|
5811
5879
|
className: "kjun-table-cards",
|
|
@@ -5814,7 +5882,7 @@ function TableCards({
|
|
|
5814
5882
|
style: skeletonHidden ? { visibility: "hidden" } : void 0,
|
|
5815
5883
|
"aria-hidden": skeletonHidden || void 0,
|
|
5816
5884
|
children: [
|
|
5817
|
-
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)(
|
|
5818
5886
|
"div",
|
|
5819
5887
|
{
|
|
5820
5888
|
role: "listitem",
|
|
@@ -5823,40 +5891,40 @@ function TableCards({
|
|
|
5823
5891
|
onKeyDown: (event) => rowKeyDown(event, row, i),
|
|
5824
5892
|
onClick: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
5825
5893
|
children: [
|
|
5826
|
-
/* @__PURE__ */ (0,
|
|
5827
|
-
/* @__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: [
|
|
5828
5896
|
selectable && checkbox(row, i),
|
|
5829
|
-
/* @__PURE__ */ (0,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "kjun-table-card-title", children: title && cell(title, row, i) })
|
|
5830
5898
|
] }),
|
|
5831
|
-
badges.length ? /* @__PURE__ */ (0,
|
|
5832
|
-
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)(
|
|
5833
5901
|
"div",
|
|
5834
5902
|
{
|
|
5835
5903
|
className: "kjun-table-card-header-actions",
|
|
5836
5904
|
onClick: (e) => e.stopPropagation(),
|
|
5837
|
-
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))
|
|
5838
5906
|
}
|
|
5839
5907
|
)
|
|
5840
5908
|
] }),
|
|
5841
5909
|
sections.map((section, index) => {
|
|
5842
5910
|
const cols = columnsForSection(row, section);
|
|
5843
|
-
return cols.length ? /* @__PURE__ */ (0,
|
|
5911
|
+
return cols.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5844
5912
|
"section",
|
|
5845
5913
|
{
|
|
5846
5914
|
className: "kjun-table-card-section",
|
|
5847
5915
|
children: [
|
|
5848
|
-
section.label && /* @__PURE__ */ (0,
|
|
5849
|
-
/* @__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)(
|
|
5850
5918
|
"div",
|
|
5851
5919
|
{
|
|
5852
5920
|
className: "kjun-table-card-body kjun-table-card-body--" + (section.layout || "grid"),
|
|
5853
|
-
children: cols.map((col) => /* @__PURE__ */ (0,
|
|
5921
|
+
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5854
5922
|
"div",
|
|
5855
5923
|
{
|
|
5856
5924
|
className: "kjun-table-card-field" + (col.fullWidthInCard ? " kjun-table-card-field--full" : "") + (section.labelAlign === "right" ? " kjun-table-card-field--label-right" : ""),
|
|
5857
5925
|
children: [
|
|
5858
|
-
/* @__PURE__ */ (0,
|
|
5859
|
-
/* @__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) })
|
|
5860
5928
|
]
|
|
5861
5929
|
},
|
|
5862
5930
|
col.key
|
|
@@ -5868,9 +5936,9 @@ function TableCards({
|
|
|
5868
5936
|
section.key || index
|
|
5869
5937
|
) : null;
|
|
5870
5938
|
}),
|
|
5871
|
-
expandable && /* @__PURE__ */ (0,
|
|
5872
|
-
expandable && state.expanded.includes(state.key(row, i)) && /* @__PURE__ */ (0,
|
|
5873
|
-
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)(
|
|
5874
5942
|
"div",
|
|
5875
5943
|
{
|
|
5876
5944
|
className: "kjun-table-card-actions",
|
|
@@ -5882,16 +5950,16 @@ function TableCards({
|
|
|
5882
5950
|
},
|
|
5883
5951
|
state.key(row, i)
|
|
5884
5952
|
)),
|
|
5885
|
-
!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 })
|
|
5886
5954
|
]
|
|
5887
5955
|
}
|
|
5888
5956
|
);
|
|
5889
5957
|
}
|
|
5890
5958
|
|
|
5891
5959
|
// packages/react/src/table-view.tsx
|
|
5892
|
-
var
|
|
5960
|
+
var import_react46 = require("react");
|
|
5893
5961
|
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5894
|
-
var
|
|
5962
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5895
5963
|
function KjunTable(props) {
|
|
5896
5964
|
const {
|
|
5897
5965
|
skeletonRows = 8,
|
|
@@ -5919,8 +5987,8 @@ function KjunTable(props) {
|
|
|
5919
5987
|
onRowClick,
|
|
5920
5988
|
onRetry
|
|
5921
5989
|
} = props;
|
|
5922
|
-
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = (0,
|
|
5923
|
-
(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)(() => {
|
|
5924
5992
|
const media = matchMedia(`(width < ${import_tokens37.tokens.table.mobileBreakpoint}px)`);
|
|
5925
5993
|
const update = () => setMobile(media.matches);
|
|
5926
5994
|
update();
|
|
@@ -5931,7 +5999,7 @@ function KjunTable(props) {
|
|
|
5931
5999
|
const { card, visible } = layout;
|
|
5932
6000
|
const cell = (col, row, index) => {
|
|
5933
6001
|
const { value, body } = tableCellValue(props, col, row, index);
|
|
5934
|
-
return col.pill ? /* @__PURE__ */ (0,
|
|
6002
|
+
return col.pill ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5935
6003
|
"span",
|
|
5936
6004
|
{
|
|
5937
6005
|
className: "kjun-table-pill " + (Number(value) > 0 ? "kjun-table-pill-up" : Number(value) < 0 ? "kjun-table-pill-down" : ""),
|
|
@@ -5947,7 +6015,7 @@ function KjunTable(props) {
|
|
|
5947
6015
|
onRowClick(row, index);
|
|
5948
6016
|
}
|
|
5949
6017
|
};
|
|
5950
|
-
const checkbox = (row, i) => /* @__PURE__ */ (0,
|
|
6018
|
+
const checkbox = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5951
6019
|
TableCheck,
|
|
5952
6020
|
{
|
|
5953
6021
|
"aria-label": `\uD589 \uC120\uD0DD ${i + 1}`,
|
|
@@ -5956,7 +6024,7 @@ function KjunTable(props) {
|
|
|
5956
6024
|
onChange: () => state.toggleRow(row)
|
|
5957
6025
|
}
|
|
5958
6026
|
);
|
|
5959
|
-
const expand = (row, i) => /* @__PURE__ */ (0,
|
|
6027
|
+
const expand = (row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5960
6028
|
KjunButton,
|
|
5961
6029
|
{
|
|
5962
6030
|
variant: "ghost",
|
|
@@ -5968,14 +6036,14 @@ function KjunTable(props) {
|
|
|
5968
6036
|
children: card ? state.expanded.includes(state.key(row, i)) ? "\uC811\uAE30" : "\uC0C1\uC138 \uBCF4\uAE30" : void 0
|
|
5969
6037
|
}
|
|
5970
6038
|
);
|
|
5971
|
-
return /* @__PURE__ */ (0,
|
|
6039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
5972
6040
|
"div",
|
|
5973
6041
|
{
|
|
5974
6042
|
className: "kjun-table-state",
|
|
5975
6043
|
"aria-busy": !!props.loading,
|
|
5976
6044
|
ref: domainColorRef(!query2.initialLoading && state.rows.length > 0 && props.columns.some((column) => column.pill)),
|
|
5977
6045
|
children: [
|
|
5978
|
-
/* @__PURE__ */ (0,
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5979
6047
|
TableToolbar,
|
|
5980
6048
|
{
|
|
5981
6049
|
...{ selectable, selected, renderSelectionToolbar, searchable, searchPlaceholder, toolbar },
|
|
@@ -5988,7 +6056,7 @@ function KjunTable(props) {
|
|
|
5988
6056
|
searchChange: state.searchChange
|
|
5989
6057
|
}
|
|
5990
6058
|
),
|
|
5991
|
-
/* @__PURE__ */ (0,
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
5992
6060
|
KjunDataState,
|
|
5993
6061
|
{
|
|
5994
6062
|
queryKey: props.queryKey,
|
|
@@ -6002,8 +6070,8 @@ function KjunTable(props) {
|
|
|
6002
6070
|
loadingText,
|
|
6003
6071
|
loadingDelay: skeleton ? 0 : loadingDelay,
|
|
6004
6072
|
children: [
|
|
6005
|
-
card ? /* @__PURE__ */ (0,
|
|
6006
|
-
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)(
|
|
6007
6075
|
KjunPagination,
|
|
6008
6076
|
{
|
|
6009
6077
|
currentPage: pagination.page,
|
|
@@ -6026,7 +6094,7 @@ function KjunTable(props) {
|
|
|
6026
6094
|
|
|
6027
6095
|
// packages/react/src/kpi.tsx
|
|
6028
6096
|
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6029
|
-
var
|
|
6097
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6030
6098
|
var kpiFormat = (item, value = item.value) => {
|
|
6031
6099
|
var _a, _b;
|
|
6032
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, {
|
|
@@ -6058,16 +6126,16 @@ function KjunKpiHero(props) {
|
|
|
6058
6126
|
const showDelta = deltaAbsolute !== null || deltaPercent !== null || !!deltaDescription || loading && ["deltaAbsolute", "deltaPercent", "deltaDescription"].some(
|
|
6059
6127
|
(key) => Object.prototype.hasOwnProperty.call(props, key)
|
|
6060
6128
|
);
|
|
6061
|
-
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: [
|
|
6062
6130
|
v > 0 ? "+" : v < 0 ? "\u2212" : "",
|
|
6063
|
-
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 }),
|
|
6064
6132
|
new Intl.NumberFormat(void 0, {
|
|
6065
6133
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
6066
6134
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
6067
6135
|
}).format(Math.abs(v)),
|
|
6068
|
-
kind === "percent" && /* @__PURE__ */ (0,
|
|
6136
|
+
kind === "percent" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-number-affix", "data-side": "suffix", children: "%" })
|
|
6069
6137
|
] });
|
|
6070
|
-
return /* @__PURE__ */ (0,
|
|
6138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6071
6139
|
"div",
|
|
6072
6140
|
{
|
|
6073
6141
|
className: "kjun-kpi-hero" + (size === "sm" ? " kjun-kpi-hero--sm" : ""),
|
|
@@ -6075,12 +6143,12 @@ function KjunKpiHero(props) {
|
|
|
6075
6143
|
ref: domainColorRef(!loading && (Number(deltaAbsolute) !== 0 || Number(deltaPercent) !== 0 || secondary.some((item) => item.semantic === "price" && Number(item.value) !== 0))),
|
|
6076
6144
|
"aria-busy": loading,
|
|
6077
6145
|
children: [
|
|
6078
|
-
/* @__PURE__ */ (0,
|
|
6079
|
-
/* @__PURE__ */ (0,
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6081
|
-
/* @__PURE__ */ (0,
|
|
6082
|
-
prefix && /* @__PURE__ */ (0,
|
|
6083
|
-
/* @__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)(
|
|
6084
6152
|
KjunAnimatedNumber,
|
|
6085
6153
|
{
|
|
6086
6154
|
value,
|
|
@@ -6089,13 +6157,13 @@ function KjunKpiHero(props) {
|
|
|
6089
6157
|
formatter
|
|
6090
6158
|
}
|
|
6091
6159
|
),
|
|
6092
|
-
suffix && /* @__PURE__ */ (0,
|
|
6160
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__affix", children: suffix })
|
|
6093
6161
|
] }) }),
|
|
6094
|
-
showDelta && /* @__PURE__ */ (0,
|
|
6162
|
+
showDelta && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
6095
6163
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
6096
|
-
/* @__PURE__ */ (0,
|
|
6097
|
-
) : /* @__PURE__ */ (0,
|
|
6098
|
-
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)(
|
|
6099
6167
|
"span",
|
|
6100
6168
|
{
|
|
6101
6169
|
className: "kjun-kpi-hero__delta-abs",
|
|
@@ -6109,7 +6177,7 @@ function KjunKpiHero(props) {
|
|
|
6109
6177
|
children: delta(deltaAbsolute, "absolute")
|
|
6110
6178
|
}
|
|
6111
6179
|
),
|
|
6112
|
-
deltaPercent !== null && /* @__PURE__ */ (0,
|
|
6180
|
+
deltaPercent !== null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6113
6181
|
"span",
|
|
6114
6182
|
{
|
|
6115
6183
|
className: "kjun-kpi-hero__delta-pct",
|
|
@@ -6119,31 +6187,31 @@ function KjunKpiHero(props) {
|
|
|
6119
6187
|
children: delta(deltaPercent, "percent")
|
|
6120
6188
|
}
|
|
6121
6189
|
),
|
|
6122
|
-
deltaDescription && /* @__PURE__ */ (0,
|
|
6190
|
+
deltaDescription && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-hero__delta-desc", children: deltaDescription })
|
|
6123
6191
|
] }) })
|
|
6124
6192
|
] }),
|
|
6125
|
-
aside && /* @__PURE__ */ (0,
|
|
6193
|
+
aside && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "kjun-kpi-hero__aside", children: aside })
|
|
6126
6194
|
] }),
|
|
6127
|
-
secondary.length > 0 && /* @__PURE__ */ (0,
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6129
|
-
/* @__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)(
|
|
6130
6198
|
"div",
|
|
6131
6199
|
{
|
|
6132
6200
|
className: "kjun-kpi-hero__sec-value",
|
|
6133
6201
|
style: { color: kpiColor(item.value, item.semantic) },
|
|
6134
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
6135
|
-
item.prefix && /* @__PURE__ */ (0,
|
|
6136
|
-
/* @__PURE__ */ (0,
|
|
6137
|
-
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 })
|
|
6138
6206
|
] })
|
|
6139
6207
|
}
|
|
6140
6208
|
),
|
|
6141
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6209
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6142
6210
|
"div",
|
|
6143
6211
|
{
|
|
6144
6212
|
className: "kjun-kpi-hero__sec-desc " + (item.descClass || ""),
|
|
6145
6213
|
style: { color: "var(--_kjun-color-text-tertiary)" },
|
|
6146
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
6214
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", width: "7ch", height: "1lh" }) : item.desc
|
|
6147
6215
|
}
|
|
6148
6216
|
)
|
|
6149
6217
|
] }, i)) })
|
|
@@ -6173,7 +6241,7 @@ function KjunKpiRow({
|
|
|
6173
6241
|
const v = item.badge.variant || "neutral", dot = ["warning", "success", "danger", "price-up", "price-down"].includes(
|
|
6174
6242
|
v
|
|
6175
6243
|
), role2 = v === "neutral" ? "text-secondary" : v === "info" ? "brand" : v;
|
|
6176
|
-
return /* @__PURE__ */ (0,
|
|
6244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6177
6245
|
"span",
|
|
6178
6246
|
{
|
|
6179
6247
|
className: "kjun-kpi-row__badge",
|
|
@@ -6182,7 +6250,7 @@ function KjunKpiRow({
|
|
|
6182
6250
|
background: `var(--_kjun-color-${v === "neutral" ? "secondary" : v === "info" ? "info-bg" : v + "-bg"})`
|
|
6183
6251
|
},
|
|
6184
6252
|
children: [
|
|
6185
|
-
dot && /* @__PURE__ */ (0,
|
|
6253
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6186
6254
|
"span",
|
|
6187
6255
|
{
|
|
6188
6256
|
className: "kjun-kpi-row__badge-dot",
|
|
@@ -6194,7 +6262,7 @@ function KjunKpiRow({
|
|
|
6194
6262
|
}
|
|
6195
6263
|
);
|
|
6196
6264
|
};
|
|
6197
|
-
return /* @__PURE__ */ (0,
|
|
6265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6198
6266
|
"div",
|
|
6199
6267
|
{
|
|
6200
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" : ""),
|
|
@@ -6209,7 +6277,7 @@ function KjunKpiRow({
|
|
|
6209
6277
|
const busy = loading || !!item.loading, click = () => {
|
|
6210
6278
|
if (!busy && item.clickable) onItemClick == null ? void 0 : onItemClick(item, i);
|
|
6211
6279
|
};
|
|
6212
|
-
return /* @__PURE__ */ (0,
|
|
6280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
6213
6281
|
"div",
|
|
6214
6282
|
{
|
|
6215
6283
|
role: item.clickable ? "button" : void 0,
|
|
@@ -6224,12 +6292,12 @@ function KjunKpiRow({
|
|
|
6224
6292
|
}
|
|
6225
6293
|
},
|
|
6226
6294
|
children: [
|
|
6227
|
-
/* @__PURE__ */ (0,
|
|
6228
|
-
/* @__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 }),
|
|
6229
6297
|
!busy && item.badgePlacement !== "value" && badge(item)
|
|
6230
6298
|
] }),
|
|
6231
|
-
/* @__PURE__ */ (0,
|
|
6232
|
-
/* @__PURE__ */ (0,
|
|
6299
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "kjun-kpi-row__value-row", children: [
|
|
6300
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6233
6301
|
"div",
|
|
6234
6302
|
{
|
|
6235
6303
|
className: "kjun-kpi-row__value " + (item.valueClass || "") + (item.valueKind === "text" ? " kjun-kpi-row__value--text" : "") + (item.mobileNeutral ? " kjun-kpi-row__value--mobile-neutral" : ""),
|
|
@@ -6237,19 +6305,19 @@ function KjunKpiRow({
|
|
|
6237
6305
|
style: {
|
|
6238
6306
|
color: item.valueClass ? void 0 : kpiColor(item.value, item.semantic)
|
|
6239
6307
|
},
|
|
6240
|
-
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)(
|
|
6241
6309
|
"span",
|
|
6242
6310
|
{
|
|
6243
6311
|
className: (seg.class || "") + (seg.label ? " kjun-kpi-row__segment--labeled" : "") + (seg.separator ? " kjun-kpi-row__segment--separator" : ""),
|
|
6244
6312
|
children: [
|
|
6245
|
-
seg.label && /* @__PURE__ */ (0,
|
|
6246
|
-
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
|
|
6247
6315
|
]
|
|
6248
6316
|
},
|
|
6249
6317
|
j
|
|
6250
|
-
)) : busy ? /* @__PURE__ */ (0,
|
|
6251
|
-
item.prefix && /* @__PURE__ */ (0,
|
|
6252
|
-
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)(
|
|
6253
6321
|
KjunAnimatedNumber,
|
|
6254
6322
|
{
|
|
6255
6323
|
fromPrevious: true,
|
|
@@ -6257,20 +6325,20 @@ function KjunKpiRow({
|
|
|
6257
6325
|
formatter: (v) => kpiFormat(item, v)
|
|
6258
6326
|
}
|
|
6259
6327
|
) : kpiFormat(item),
|
|
6260
|
-
item.suffix && /* @__PURE__ */ (0,
|
|
6328
|
+
item.suffix && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "kjun-kpi-row__affix", children: item.suffix })
|
|
6261
6329
|
] })
|
|
6262
6330
|
}
|
|
6263
6331
|
),
|
|
6264
6332
|
!busy && item.badgePlacement === "value" && badge(item)
|
|
6265
6333
|
] }),
|
|
6266
|
-
item.desc && /* @__PURE__ */ (0,
|
|
6334
|
+
item.desc && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6267
6335
|
"div",
|
|
6268
6336
|
{
|
|
6269
6337
|
className: "kjun-kpi-row__desc " + (item.descClass || ""),
|
|
6270
6338
|
style: {
|
|
6271
6339
|
color: item.descClass ? void 0 : kpiColor(item.value, item.semantic, "text-secondary")
|
|
6272
6340
|
},
|
|
6273
|
-
children: busy ? /* @__PURE__ */ (0,
|
|
6341
|
+
children: busy ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(KjunSkeleton, { type: "block", height: "1lh", width: "7ch" }) : item.desc
|
|
6274
6342
|
}
|
|
6275
6343
|
)
|
|
6276
6344
|
]
|
|
@@ -6286,7 +6354,7 @@ function KjunKpiRow({
|
|
|
6286
6354
|
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6287
6355
|
|
|
6288
6356
|
// shared/package-runtime/market-cards.ts
|
|
6289
|
-
var
|
|
6357
|
+
var import_react47 = require("react");
|
|
6290
6358
|
function useMarketCardsModel(props, persistence) {
|
|
6291
6359
|
const {
|
|
6292
6360
|
columns,
|
|
@@ -6302,8 +6370,8 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6302
6370
|
sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
|
|
6303
6371
|
isDefaultSort: c.defaultSort
|
|
6304
6372
|
}));
|
|
6305
|
-
const [key, setKey] = (0,
|
|
6306
|
-
const mounted = (0,
|
|
6373
|
+
const [key, setKey] = (0, import_react47.useState)(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
6374
|
+
const mounted = (0, import_react47.useRef)("");
|
|
6307
6375
|
const save = (key2) => {
|
|
6308
6376
|
var _a;
|
|
6309
6377
|
try {
|
|
@@ -6311,7 +6379,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6311
6379
|
} catch (e) {
|
|
6312
6380
|
}
|
|
6313
6381
|
};
|
|
6314
|
-
(0,
|
|
6382
|
+
(0, import_react47.useEffect)(() => {
|
|
6315
6383
|
var _a, _b;
|
|
6316
6384
|
if (mounted.current === restoreSignature) return;
|
|
6317
6385
|
mounted.current = restoreSignature;
|
|
@@ -6348,26 +6416,26 @@ function useMarketCards(props) {
|
|
|
6348
6416
|
}
|
|
6349
6417
|
|
|
6350
6418
|
// packages/react/src/market-parts.tsx
|
|
6351
|
-
var
|
|
6419
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6352
6420
|
function MarketIdentity({
|
|
6353
6421
|
row,
|
|
6354
6422
|
props
|
|
6355
6423
|
}) {
|
|
6356
6424
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
6357
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");
|
|
6358
|
-
const body = /* @__PURE__ */ (0,
|
|
6426
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6359
6427
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
6360
|
-
/* @__PURE__ */ (0,
|
|
6361
|
-
/* @__PURE__ */ (0,
|
|
6362
|
-
/* @__PURE__ */ (0,
|
|
6363
|
-
((_f = props.interestKeys) == null ? void 0 : _f.has(id)) && /* @__PURE__ */ (0,
|
|
6364
|
-
((_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 }),
|
|
6365
6433
|
(_h = props.renderNameSuffix) == null ? void 0 : _h.call(props, row)
|
|
6366
6434
|
] }),
|
|
6367
|
-
(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 })
|
|
6368
6436
|
] })
|
|
6369
6437
|
] });
|
|
6370
|
-
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 });
|
|
6371
6439
|
}
|
|
6372
6440
|
function MarketFooter({
|
|
6373
6441
|
props
|
|
@@ -6382,8 +6450,8 @@ function MarketFooter({
|
|
|
6382
6450
|
totalCount = 0,
|
|
6383
6451
|
unitLabel = "\uAC1C"
|
|
6384
6452
|
} = props;
|
|
6385
|
-
return /* @__PURE__ */ (0,
|
|
6386
|
-
pagination && /* @__PURE__ */ (0,
|
|
6453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
6454
|
+
pagination && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6387
6455
|
KjunPagination,
|
|
6388
6456
|
{
|
|
6389
6457
|
currentPage: pagination.page,
|
|
@@ -6395,9 +6463,9 @@ function MarketFooter({
|
|
|
6395
6463
|
}
|
|
6396
6464
|
),
|
|
6397
6465
|
" ",
|
|
6398
|
-
showFooter && !state.initialLoading && rows.length > 0 && /* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
/* @__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: [
|
|
6401
6469
|
"\uCD1D ",
|
|
6402
6470
|
totalCount,
|
|
6403
6471
|
unitLabel
|
|
@@ -6407,7 +6475,7 @@ function MarketFooter({
|
|
|
6407
6475
|
}
|
|
6408
6476
|
|
|
6409
6477
|
// packages/react/src/market-cards.tsx
|
|
6410
|
-
var
|
|
6478
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6411
6479
|
function KjunMarketCards(props) {
|
|
6412
6480
|
const {
|
|
6413
6481
|
rows = [],
|
|
@@ -6432,8 +6500,8 @@ function KjunMarketCards(props) {
|
|
|
6432
6500
|
column: props.columns.find((c) => c.key === state.key)
|
|
6433
6501
|
}) : value == null ? "-" : String(value);
|
|
6434
6502
|
};
|
|
6435
|
-
return /* @__PURE__ */ (0,
|
|
6436
|
-
/* @__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)(
|
|
6437
6505
|
"button",
|
|
6438
6506
|
{
|
|
6439
6507
|
type: "button",
|
|
@@ -6448,7 +6516,7 @@ function KjunMarketCards(props) {
|
|
|
6448
6516
|
},
|
|
6449
6517
|
children: [
|
|
6450
6518
|
pill.label,
|
|
6451
|
-
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" })
|
|
6452
6520
|
]
|
|
6453
6521
|
},
|
|
6454
6522
|
pill.key
|
|
@@ -6457,20 +6525,20 @@ function KjunMarketCards(props) {
|
|
|
6457
6525
|
selectedKey: state.key,
|
|
6458
6526
|
selectedPill: state.pill,
|
|
6459
6527
|
metricDisplay: display
|
|
6460
|
-
}) : /* @__PURE__ */ (0,
|
|
6461
|
-
/* @__PURE__ */ (0,
|
|
6528
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6529
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6462
6530
|
KjunDataState,
|
|
6463
6531
|
{
|
|
6464
6532
|
...props,
|
|
6465
6533
|
loadingPadding: "none",
|
|
6466
6534
|
empty: !rows.length,
|
|
6467
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6468
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6469
|
-
children: /* @__PURE__ */ (0,
|
|
6470
|
-
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 }),
|
|
6471
6539
|
rows.map((row, i) => {
|
|
6472
6540
|
var _a, _b, _c;
|
|
6473
|
-
return /* @__PURE__ */ (0,
|
|
6541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6474
6542
|
"div",
|
|
6475
6543
|
{
|
|
6476
6544
|
className: "kjun-market-row kjun-market-row-compact",
|
|
@@ -6488,15 +6556,15 @@ function KjunMarketCards(props) {
|
|
|
6488
6556
|
}
|
|
6489
6557
|
},
|
|
6490
6558
|
children: [
|
|
6491
|
-
/* @__PURE__ */ (0,
|
|
6492
|
-
/* @__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)(
|
|
6493
6561
|
KjunSparkline,
|
|
6494
6562
|
{
|
|
6495
6563
|
data: getValue(row, state.key) || [],
|
|
6496
6564
|
width: import_tokens39.tokens.extensions.marketTable.sparklineWidth,
|
|
6497
6565
|
height: import_tokens39.tokens.extensions.marketTable.sparklineHeight
|
|
6498
6566
|
}
|
|
6499
|
-
) : 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)(
|
|
6500
6568
|
KjunSignedValue,
|
|
6501
6569
|
{
|
|
6502
6570
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -6504,7 +6572,7 @@ function KjunMarketCards(props) {
|
|
|
6504
6572
|
stale: !!getValue(row, "stale"),
|
|
6505
6573
|
tone: "pill"
|
|
6506
6574
|
}
|
|
6507
|
-
) : 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: [
|
|
6508
6576
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
6509
6577
|
props,
|
|
6510
6578
|
row,
|
|
@@ -6521,14 +6589,14 @@ function KjunMarketCards(props) {
|
|
|
6521
6589
|
] })
|
|
6522
6590
|
}
|
|
6523
6591
|
),
|
|
6524
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MarketFooter, { props })
|
|
6525
6593
|
] })
|
|
6526
6594
|
] });
|
|
6527
6595
|
}
|
|
6528
6596
|
|
|
6529
6597
|
// packages/react/src/market-list.tsx
|
|
6530
6598
|
var import_tokens40 = require("@kjun-ui/tokens");
|
|
6531
|
-
var
|
|
6599
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6532
6600
|
function KjunMarketSimpleList(props) {
|
|
6533
6601
|
const {
|
|
6534
6602
|
rows = [],
|
|
@@ -6541,20 +6609,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6541
6609
|
emptyMessage = "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
6542
6610
|
emptySubMessage = ""
|
|
6543
6611
|
} = props;
|
|
6544
|
-
return /* @__PURE__ */ (0,
|
|
6545
|
-
/* @__PURE__ */ (0,
|
|
6612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-simple-list", children: [
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6546
6614
|
KjunDataState,
|
|
6547
6615
|
{
|
|
6548
6616
|
...props,
|
|
6549
6617
|
loadingPadding: "none",
|
|
6550
6618
|
empty: !rows.length,
|
|
6551
6619
|
emptyText: emptyMessage,
|
|
6552
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6553
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6554
|
-
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) => {
|
|
6555
6623
|
var _a, _b;
|
|
6556
6624
|
const price = priceValue(row), change = changeValue(row), stale = !!getValue(row, "stale"), source = String(getValue(row, "source") || ""), fetchedAt = String(getValue(row, "fetched_at") || "");
|
|
6557
|
-
return /* @__PURE__ */ (0,
|
|
6625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6558
6626
|
"div",
|
|
6559
6627
|
{
|
|
6560
6628
|
className: "kjun-market-row",
|
|
@@ -6572,9 +6640,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6572
6640
|
}
|
|
6573
6641
|
},
|
|
6574
6642
|
children: [
|
|
6575
|
-
/* @__PURE__ */ (0,
|
|
6576
|
-
/* @__PURE__ */ (0,
|
|
6577
|
-
/* @__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)(
|
|
6578
6646
|
KjunPriceCell,
|
|
6579
6647
|
{
|
|
6580
6648
|
value: price,
|
|
@@ -6583,9 +6651,9 @@ function KjunMarketSimpleList(props) {
|
|
|
6583
6651
|
showFreshness: false
|
|
6584
6652
|
}
|
|
6585
6653
|
) }),
|
|
6586
|
-
/* @__PURE__ */ (0,
|
|
6654
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "kjun-market-change", children: [
|
|
6587
6655
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
6588
|
-
(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)(
|
|
6589
6657
|
KjunFreshness,
|
|
6590
6658
|
{
|
|
6591
6659
|
stale,
|
|
@@ -6593,7 +6661,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6593
6661
|
fetchedAt
|
|
6594
6662
|
}
|
|
6595
6663
|
)),
|
|
6596
|
-
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)(
|
|
6597
6665
|
KjunSignedValue,
|
|
6598
6666
|
{
|
|
6599
6667
|
value: change,
|
|
@@ -6602,7 +6670,7 @@ function KjunMarketSimpleList(props) {
|
|
|
6602
6670
|
format: "percent",
|
|
6603
6671
|
isRaw: true
|
|
6604
6672
|
}
|
|
6605
|
-
) : /* @__PURE__ */ (0,
|
|
6673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "-" })
|
|
6606
6674
|
] })
|
|
6607
6675
|
] })
|
|
6608
6676
|
]
|
|
@@ -6612,20 +6680,20 @@ function KjunMarketSimpleList(props) {
|
|
|
6612
6680
|
}) })
|
|
6613
6681
|
}
|
|
6614
6682
|
),
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6683
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarketFooter, { props })
|
|
6616
6684
|
] });
|
|
6617
6685
|
}
|
|
6618
6686
|
|
|
6619
6687
|
// packages/react/src/market-panel.tsx
|
|
6620
6688
|
var import_tokens41 = require("@kjun-ui/tokens");
|
|
6621
|
-
var
|
|
6689
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6622
6690
|
function KjunMarketListPanel({
|
|
6623
6691
|
controls,
|
|
6624
6692
|
children
|
|
6625
6693
|
}) {
|
|
6626
|
-
return /* @__PURE__ */ (0,
|
|
6627
|
-
/* @__PURE__ */ (0,
|
|
6628
|
-
/* @__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 })
|
|
6629
6697
|
] });
|
|
6630
6698
|
}
|
|
6631
6699
|
|
|
@@ -6647,8 +6715,8 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6647
6715
|
}
|
|
6648
6716
|
|
|
6649
6717
|
// packages/react/src/market-table.tsx
|
|
6650
|
-
var
|
|
6651
|
-
var
|
|
6718
|
+
var import_react48 = require("react");
|
|
6719
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6652
6720
|
function KjunMarketTable(props) {
|
|
6653
6721
|
const {
|
|
6654
6722
|
rows = [],
|
|
@@ -6668,17 +6736,17 @@ function KjunMarketTable(props) {
|
|
|
6668
6736
|
formatMetric,
|
|
6669
6737
|
renderCell
|
|
6670
6738
|
} = props;
|
|
6671
|
-
const scroller = (0,
|
|
6672
|
-
(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]);
|
|
6673
6741
|
const render = (row, col) => {
|
|
6674
6742
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6675
6743
|
if (cellLoading(row, col))
|
|
6676
|
-
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 });
|
|
6677
6745
|
if (renderCell) return renderCell(row, col);
|
|
6678
6746
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
6679
|
-
return /* @__PURE__ */ (0,
|
|
6747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketIdentity, { row, props });
|
|
6680
6748
|
if (col.type === "sparkline")
|
|
6681
|
-
return /* @__PURE__ */ (0,
|
|
6749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6682
6750
|
KjunSparkline,
|
|
6683
6751
|
{
|
|
6684
6752
|
data: Array.isArray(value) ? value : [],
|
|
@@ -6687,7 +6755,7 @@ function KjunMarketTable(props) {
|
|
|
6687
6755
|
}
|
|
6688
6756
|
);
|
|
6689
6757
|
if (col.type === "price")
|
|
6690
|
-
return /* @__PURE__ */ (0,
|
|
6758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6691
6759
|
KjunPriceCell,
|
|
6692
6760
|
{
|
|
6693
6761
|
value: finiteNumber(value),
|
|
@@ -6697,7 +6765,7 @@ function KjunMarketTable(props) {
|
|
|
6697
6765
|
}
|
|
6698
6766
|
);
|
|
6699
6767
|
if (col.type === "percent")
|
|
6700
|
-
return value == null ? "-" : /* @__PURE__ */ (0,
|
|
6768
|
+
return value == null ? "-" : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6701
6769
|
KjunSignedValue,
|
|
6702
6770
|
{
|
|
6703
6771
|
value: finiteNumber(value),
|
|
@@ -6713,7 +6781,7 @@ function KjunMarketTable(props) {
|
|
|
6713
6781
|
}
|
|
6714
6782
|
);
|
|
6715
6783
|
const text = formatMetric ? formatMetric(value, col.type || "text", { currency, row, column: col }) : value == null ? "-" : String(value);
|
|
6716
|
-
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)(
|
|
6717
6785
|
KjunSignedValue,
|
|
6718
6786
|
{
|
|
6719
6787
|
value: finiteNumber(value),
|
|
@@ -6723,35 +6791,35 @@ function KjunMarketTable(props) {
|
|
|
6723
6791
|
}
|
|
6724
6792
|
) : text;
|
|
6725
6793
|
};
|
|
6726
|
-
return /* @__PURE__ */ (0,
|
|
6794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6727
6795
|
"div",
|
|
6728
6796
|
{
|
|
6729
6797
|
className: "kjun-market-table",
|
|
6730
6798
|
"data-embedded": embedded,
|
|
6731
6799
|
ref: domainColorRef(showActions && rows.length > 0 && !props.loading),
|
|
6732
6800
|
children: [
|
|
6733
|
-
/* @__PURE__ */ (0,
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6734
6802
|
KjunDataState,
|
|
6735
6803
|
{
|
|
6736
6804
|
...props,
|
|
6737
6805
|
loadingPadding: "none",
|
|
6738
6806
|
empty: !rows.length,
|
|
6739
6807
|
emptyText: emptyMessage,
|
|
6740
|
-
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0,
|
|
6741
|
-
emptyContent: /* @__PURE__ */ (0,
|
|
6742
|
-
children: /* @__PURE__ */ (0,
|
|
6743
|
-
/* @__PURE__ */ (0,
|
|
6744
|
-
/* @__PURE__ */ (0,
|
|
6745
|
-
showActions && /* @__PURE__ */ (0,
|
|
6746
|
-
/* @__PURE__ */ (0,
|
|
6747
|
-
/* @__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" }) })
|
|
6748
6816
|
] }),
|
|
6749
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6817
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6750
6818
|
"th",
|
|
6751
6819
|
{
|
|
6752
6820
|
style: { textAlign: col.align },
|
|
6753
6821
|
"aria-sort": col.sortable ? sortKey === col.key ? sortOrder === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
6754
|
-
children: col.sortable ? /* @__PURE__ */ (0,
|
|
6822
|
+
children: col.sortable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6755
6823
|
"button",
|
|
6756
6824
|
{
|
|
6757
6825
|
type: "button",
|
|
@@ -6761,7 +6829,7 @@ function KjunMarketTable(props) {
|
|
|
6761
6829
|
},
|
|
6762
6830
|
children: [
|
|
6763
6831
|
col.label,
|
|
6764
|
-
/* @__PURE__ */ (0,
|
|
6832
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6765
6833
|
KjunIcon,
|
|
6766
6834
|
{
|
|
6767
6835
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
@@ -6775,12 +6843,12 @@ function KjunMarketTable(props) {
|
|
|
6775
6843
|
col.key
|
|
6776
6844
|
))
|
|
6777
6845
|
] }) }),
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6846
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tbody", { children: rows.map((row, i) => {
|
|
6779
6847
|
var _a, _b, _c, _d, _e, _f;
|
|
6780
6848
|
const id = getValue(row, rowKey), priceCol = columns.find(
|
|
6781
6849
|
(c) => c.type === "price" && !cellLoading(row, c) && getValue(row, c.key) != null
|
|
6782
6850
|
);
|
|
6783
|
-
return /* @__PURE__ */ (0,
|
|
6851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6784
6852
|
"tr",
|
|
6785
6853
|
{
|
|
6786
6854
|
onClick: () => {
|
|
@@ -6788,8 +6856,8 @@ function KjunMarketTable(props) {
|
|
|
6788
6856
|
return (_a2 = props.onRowClick) == null ? void 0 : _a2.call(props, row);
|
|
6789
6857
|
},
|
|
6790
6858
|
children: [
|
|
6791
|
-
showActions && /* @__PURE__ */ (0,
|
|
6792
|
-
/* @__PURE__ */ (0,
|
|
6859
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("td", { className: "kjun-market-actions", children: [
|
|
6860
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6793
6861
|
KjunIconToggle,
|
|
6794
6862
|
{
|
|
6795
6863
|
size: "xs",
|
|
@@ -6808,7 +6876,7 @@ function KjunMarketTable(props) {
|
|
|
6808
6876
|
}
|
|
6809
6877
|
}
|
|
6810
6878
|
),
|
|
6811
|
-
/* @__PURE__ */ (0,
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6812
6880
|
KjunIconToggle,
|
|
6813
6881
|
{
|
|
6814
6882
|
size: "xs",
|
|
@@ -6828,7 +6896,7 @@ function KjunMarketTable(props) {
|
|
|
6828
6896
|
}
|
|
6829
6897
|
)
|
|
6830
6898
|
] }),
|
|
6831
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
6899
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
6832
6900
|
"td",
|
|
6833
6901
|
{
|
|
6834
6902
|
style: {
|
|
@@ -6837,7 +6905,7 @@ function KjunMarketTable(props) {
|
|
|
6837
6905
|
},
|
|
6838
6906
|
children: [
|
|
6839
6907
|
render(row, col),
|
|
6840
|
-
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)(
|
|
6841
6909
|
KjunFreshness,
|
|
6842
6910
|
{
|
|
6843
6911
|
stale: !!getValue(row, "stale"),
|
|
@@ -6859,71 +6927,71 @@ function KjunMarketTable(props) {
|
|
|
6859
6927
|
] }) })
|
|
6860
6928
|
}
|
|
6861
6929
|
),
|
|
6862
|
-
/* @__PURE__ */ (0,
|
|
6930
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MarketFooter, { props })
|
|
6863
6931
|
]
|
|
6864
6932
|
}
|
|
6865
6933
|
);
|
|
6866
6934
|
}
|
|
6867
6935
|
|
|
6868
6936
|
// packages/react/src/list.tsx
|
|
6869
|
-
var
|
|
6870
|
-
var
|
|
6937
|
+
var import_react49 = require("react");
|
|
6938
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6871
6939
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onClick }) {
|
|
6872
|
-
const contents = /* @__PURE__ */ (0,
|
|
6873
|
-
leading && /* @__PURE__ */ (0,
|
|
6874
|
-
/* @__PURE__ */ (0,
|
|
6875
|
-
/* @__PURE__ */ (0,
|
|
6876
|
-
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 })
|
|
6877
6945
|
] }),
|
|
6878
|
-
trailing && /* @__PURE__ */ (0,
|
|
6946
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "kjun-list-trailing", children: trailing })
|
|
6879
6947
|
] });
|
|
6880
|
-
const main = href ? /* @__PURE__ */ (0,
|
|
6881
|
-
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: [
|
|
6882
6950
|
main,
|
|
6883
|
-
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 })
|
|
6884
6952
|
] });
|
|
6885
6953
|
}
|
|
6886
6954
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
6887
|
-
const id = "kjun-" + (0,
|
|
6888
|
-
return /* @__PURE__ */ (0,
|
|
6889
|
-
(title || description || actions) && /* @__PURE__ */ (0,
|
|
6890
|
-
/* @__PURE__ */ (0,
|
|
6891
|
-
title && /* @__PURE__ */ (0,
|
|
6892
|
-
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 })
|
|
6893
6961
|
] }),
|
|
6894
6962
|
actions
|
|
6895
6963
|
] }),
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6964
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: "kjun-list", "aria-label": ariaLabel || title, children })
|
|
6897
6965
|
] });
|
|
6898
6966
|
}
|
|
6899
6967
|
|
|
6900
6968
|
// packages/react/src/app-navigation.tsx
|
|
6901
6969
|
var import_tokens43 = require("@kjun-ui/tokens");
|
|
6902
|
-
var
|
|
6970
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6903
6971
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
6904
|
-
return /* @__PURE__ */ (0,
|
|
6905
|
-
leading && /* @__PURE__ */ (0,
|
|
6906
|
-
/* @__PURE__ */ (0,
|
|
6907
|
-
/* @__PURE__ */ (0,
|
|
6908
|
-
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 })
|
|
6909
6977
|
] }),
|
|
6910
|
-
actions && /* @__PURE__ */ (0,
|
|
6978
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "kjun-navigation-actions", children: actions })
|
|
6911
6979
|
] }) }) });
|
|
6912
6980
|
}
|
|
6913
6981
|
function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\uC0C9", safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
6914
6982
|
const hasIcons = items.some((item) => item.icon);
|
|
6915
6983
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6916
|
-
return /* @__PURE__ */ (0,
|
|
6917
|
-
const badge = item.badge != null && /* @__PURE__ */ (0,
|
|
6918
|
-
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) => {
|
|
6919
6987
|
if (item.disabled) event.preventDefault();
|
|
6920
6988
|
else onNavigate == null ? void 0 : onNavigate(item.key, event);
|
|
6921
6989
|
}, children: [
|
|
6922
|
-
hasIcons && /* @__PURE__ */ (0,
|
|
6923
|
-
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 }),
|
|
6924
6992
|
badge
|
|
6925
6993
|
] }),
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
6994
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "kjun-navigation-label", children: [
|
|
6927
6995
|
item.label,
|
|
6928
6996
|
!hasIcons && badge
|
|
6929
6997
|
] })
|
|
@@ -6932,25 +7000,25 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
6932
7000
|
}
|
|
6933
7001
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
6934
7002
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
6935
|
-
return /* @__PURE__ */ (0,
|
|
6936
|
-
description && /* @__PURE__ */ (0,
|
|
6937
|
-
/* @__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 })
|
|
6938
7006
|
] }) });
|
|
6939
7007
|
}
|
|
6940
7008
|
|
|
6941
7009
|
// packages/react/src/media.tsx
|
|
6942
|
-
var
|
|
7010
|
+
var import_react50 = require("react");
|
|
6943
7011
|
var import_tokens44 = require("@kjun-ui/tokens");
|
|
6944
|
-
var
|
|
7012
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6945
7013
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
6946
|
-
const current = (0,
|
|
7014
|
+
const current = (0, import_react50.useRef)({ src, version: 0 });
|
|
6947
7015
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
6948
7016
|
const version = current.current.version;
|
|
6949
|
-
const [result, setResult] = (0,
|
|
7017
|
+
const [result, setResult] = (0, import_react50.useState)({ version, state: "loading" });
|
|
6950
7018
|
const state = result.version === version ? result.state : "loading";
|
|
6951
7019
|
const failed = !src || state === "error";
|
|
6952
|
-
return /* @__PURE__ */ (0,
|
|
6953
|
-
!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: () => {
|
|
6954
7022
|
if (current.current.version !== version) return;
|
|
6955
7023
|
setResult({ version, state: "loaded" });
|
|
6956
7024
|
onLoad == null ? void 0 : onLoad();
|
|
@@ -6959,38 +7027,38 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
6959
7027
|
setResult({ version, state: "error" });
|
|
6960
7028
|
onError == null ? void 0 : onError();
|
|
6961
7029
|
} }, version),
|
|
6962
|
-
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 }) })
|
|
6963
7031
|
] });
|
|
6964
7032
|
}
|
|
6965
7033
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
6966
|
-
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 }) });
|
|
6967
7035
|
}
|
|
6968
7036
|
|
|
6969
7037
|
// packages/react/src/chip.tsx
|
|
6970
7038
|
var import_tokens45 = require("@kjun-ui/tokens");
|
|
6971
|
-
var
|
|
7039
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
6972
7040
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
6973
|
-
return /* @__PURE__ */ (0,
|
|
6974
|
-
icon && /* @__PURE__ */ (0,
|
|
6975
|
-
/* @__PURE__ */ (0,
|
|
6976
|
-
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] }) })
|
|
6977
7045
|
] });
|
|
6978
7046
|
}
|
|
6979
7047
|
|
|
6980
7048
|
// packages/react/src/range-input.tsx
|
|
6981
|
-
var
|
|
7049
|
+
var import_react51 = require("react");
|
|
6982
7050
|
var import_react_aria_components9 = require("react-aria-components");
|
|
6983
7051
|
var import_tokens46 = require("@kjun-ui/tokens");
|
|
6984
|
-
var
|
|
7052
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
6985
7053
|
function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, onValueChange, onChangeCommit, ...rest }) {
|
|
6986
7054
|
const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"] : ["\uCD5C\uC19F\uAC12", "\uCD5C\uB313\uAC12"];
|
|
6987
7055
|
const domain = (0, import_tokens46.createSliderDomain)(min, max, step);
|
|
6988
7056
|
const list = Array.isArray(value) ? value : [value];
|
|
6989
7057
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
6990
|
-
const latest = (0,
|
|
7058
|
+
const latest = (0, import_react51.useRef)(value);
|
|
6991
7059
|
latest.current = value;
|
|
6992
|
-
const active = (0,
|
|
6993
|
-
(0,
|
|
7060
|
+
const active = (0, import_react51.useRef)(false);
|
|
7061
|
+
(0, import_react51.useEffect)(() => {
|
|
6994
7062
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6995
7063
|
}, [valid]);
|
|
6996
7064
|
const change = (next) => {
|
|
@@ -7002,48 +7070,48 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
7002
7070
|
active.current = true;
|
|
7003
7071
|
onValueChange == null ? void 0 : onValueChange(result);
|
|
7004
7072
|
};
|
|
7005
|
-
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: () => {
|
|
7006
7074
|
if (valid && !disabled && active.current) {
|
|
7007
7075
|
active.current = false;
|
|
7008
7076
|
onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
|
|
7009
7077
|
}
|
|
7010
7078
|
}, children: [
|
|
7011
|
-
/* @__PURE__ */ (0,
|
|
7012
|
-
label && /* @__PURE__ */ (0,
|
|
7013
|
-
/* @__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 ") })
|
|
7014
7082
|
] }),
|
|
7015
|
-
/* @__PURE__ */ (0,
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7017
|
-
/* @__PURE__ */ (0,
|
|
7018
|
-
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))
|
|
7019
7087
|
] }) })
|
|
7020
7088
|
] });
|
|
7021
7089
|
}
|
|
7022
7090
|
function KjunSlider(props) {
|
|
7023
|
-
return /* @__PURE__ */ (0,
|
|
7091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7024
7092
|
}
|
|
7025
7093
|
function KjunRangeSlider(props) {
|
|
7026
|
-
return /* @__PURE__ */ (0,
|
|
7094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RangeInput, { ...props });
|
|
7027
7095
|
}
|
|
7028
7096
|
|
|
7029
7097
|
// packages/react/src/quantity-stepper.tsx
|
|
7030
|
-
var
|
|
7098
|
+
var import_react52 = require("react");
|
|
7031
7099
|
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7032
|
-
var
|
|
7100
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7033
7101
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
7034
7102
|
const geometry = import_tokens47.tokens.extensions.compound;
|
|
7035
7103
|
const buttonStyle = { width: import_tokens47.tokens.input[size].height, padding: 0 };
|
|
7036
7104
|
const domain = (0, import_tokens47.createNumberDomain)({ min, max, step, precision });
|
|
7037
7105
|
const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
7038
|
-
const [draft, setDraft] = (0,
|
|
7106
|
+
const [draft, setDraft] = (0, import_react52.useState)(String(value));
|
|
7039
7107
|
const field = useKjunField();
|
|
7040
|
-
const composing = (0,
|
|
7041
|
-
(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)(() => {
|
|
7042
7110
|
setDraft(String(value));
|
|
7043
7111
|
accepted.current = value;
|
|
7044
7112
|
dirty.current = false;
|
|
7045
7113
|
}, [value, precision, min, max, step]);
|
|
7046
|
-
(0,
|
|
7114
|
+
(0, import_react52.useEffect)(() => {
|
|
7047
7115
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7048
7116
|
}, [valid]);
|
|
7049
7117
|
const emit = (next) => {
|
|
@@ -7077,9 +7145,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7077
7145
|
} else if (action === "commit") commit();
|
|
7078
7146
|
else move(action === "increment" ? 1 : -1);
|
|
7079
7147
|
};
|
|
7080
|
-
return /* @__PURE__ */ (0,
|
|
7081
|
-
/* @__PURE__ */ (0,
|
|
7082
|
-
/* @__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)(
|
|
7083
7151
|
"input",
|
|
7084
7152
|
{
|
|
7085
7153
|
className: "kjun-input",
|
|
@@ -7113,21 +7181,21 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
7113
7181
|
"aria-required": (field == null ? void 0 : field.required) || void 0
|
|
7114
7182
|
}
|
|
7115
7183
|
),
|
|
7116
|
-
/* @__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" })
|
|
7117
7185
|
] }) });
|
|
7118
7186
|
}
|
|
7119
7187
|
|
|
7120
7188
|
// packages/react/src/time-picker.tsx
|
|
7121
|
-
var
|
|
7189
|
+
var import_react53 = require("react");
|
|
7122
7190
|
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7123
|
-
var
|
|
7191
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7124
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 }) {
|
|
7125
|
-
const root = (0,
|
|
7126
|
-
const field = useKjunField(), uid = (0,
|
|
7193
|
+
const root = (0, import_react53.useRef)(null);
|
|
7194
|
+
const field = useKjunField(), uid = (0, import_react53.useId)();
|
|
7127
7195
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
7128
|
-
const domain = (0,
|
|
7196
|
+
const domain = (0, import_react53.useMemo)(() => (0, import_tokens48.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
7129
7197
|
const valid = domain.valid && domain.accepts(value);
|
|
7130
|
-
(0,
|
|
7198
|
+
(0, import_react53.useEffect)(() => {
|
|
7131
7199
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
7132
7200
|
}, [valid]);
|
|
7133
7201
|
const change = (next) => {
|
|
@@ -7137,15 +7205,15 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7137
7205
|
}
|
|
7138
7206
|
};
|
|
7139
7207
|
const time = value === null ? null : domain.parse(value);
|
|
7140
|
-
return /* @__PURE__ */ (0,
|
|
7141
|
-
/* @__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) => {
|
|
7142
7210
|
const segmentId = index === 0 ? fieldId : `${fieldId}-${index}`;
|
|
7143
7211
|
const labelId = `${fieldId}-segment-${index}`;
|
|
7144
|
-
return /* @__PURE__ */ (0,
|
|
7145
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7147
|
-
/* @__PURE__ */ (0,
|
|
7148
|
-
/* @__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)(
|
|
7149
7217
|
KjunSelect,
|
|
7150
7218
|
{
|
|
7151
7219
|
value: time === null ? null : domain.part(time, index),
|
|
@@ -7165,7 +7233,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
7165
7233
|
] }) })
|
|
7166
7234
|
] }, label);
|
|
7167
7235
|
}) }) }),
|
|
7168
|
-
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: () => {
|
|
7169
7237
|
var _a, _b;
|
|
7170
7238
|
change(null);
|
|
7171
7239
|
(_b = (_a = root.current) == null ? void 0 : _a.querySelector(".kjun-select-trigger")) == null ? void 0 : _b.focus();
|