@kjun-ui/native 0.10.0 → 0.11.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 +147 -87
- package/dist/index.js +184 -124
- package/dist/index.web.cjs +150 -90
- package/dist/index.web.js +186 -126
- package/dist/styles.css +16 -0
- package/dist/types/packages/native/src/drawer.d.cts +9 -1
- package/dist/types/packages/native/src/drawer.d.ts +9 -1
- package/dist/types/packages/native/src/feedback.d.cts +5 -2
- package/dist/types/packages/native/src/feedback.d.ts +5 -2
- 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/package.json +3 -3
package/dist/index.web.js
CHANGED
|
@@ -906,7 +906,7 @@ function KjunButton(input) {
|
|
|
906
906
|
opacity: overlayLoading ? 0 : 1,
|
|
907
907
|
...multiline || navigation ? { flexShrink: 1, minWidth: 0, textAlign: "center" } : {}
|
|
908
908
|
}, children }),
|
|
909
|
-
suffixIcon && /* @__PURE__ */ jsx5(View2, { style: { opacity: busy && prefixIcon ? 0 : 1 }, children: /* @__PURE__ */ jsx5(
|
|
909
|
+
!!suffixIcon && /* @__PURE__ */ jsx5(View2, { style: { opacity: busy && prefixIcon ? 0 : 1 }, children: /* @__PURE__ */ jsx5(
|
|
910
910
|
KjunIcon,
|
|
911
911
|
{
|
|
912
912
|
name: busy && !prefixIcon ? "loader-2" : suffixIcon,
|
|
@@ -1186,7 +1186,7 @@ function KjunFormGroup({
|
|
|
1186
1186
|
describedBy: mergeIds(hint ? fieldId + "-hint" : void 0, error ? fieldId + "-error" : void 0)
|
|
1187
1187
|
},
|
|
1188
1188
|
children: /* @__PURE__ */ jsxs2(View4, { style: [{ minWidth: 0, marginBottom: tokens7.extensions.form.itemGap }, style], children: [
|
|
1189
|
-
label && !labelHidden && /* @__PURE__ */ jsxs2(
|
|
1189
|
+
!!label && !labelHidden && /* @__PURE__ */ jsxs2(
|
|
1190
1190
|
Text3,
|
|
1191
1191
|
{
|
|
1192
1192
|
nativeID: fieldId + "-label",
|
|
@@ -1278,6 +1278,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1278
1278
|
const invalid = !!(error || errorMessage || (field == null ? void 0 : field.error));
|
|
1279
1279
|
const canEdit = !disabled && !readOnly && editable;
|
|
1280
1280
|
const surface = useFieldSurface(size, { disabled, readOnly: !!readOnly || !editable, invalid, open: props["aria-expanded"] === true });
|
|
1281
|
+
const affixText = { ...inputTypeStyle(size), color: surface.icon };
|
|
1281
1282
|
const showClear = clearable && !!value;
|
|
1282
1283
|
const [prefixWidth, setPrefixWidth] = useState7(0);
|
|
1283
1284
|
const [affixWidth, setAffixWidth] = useState7(0);
|
|
@@ -1339,7 +1340,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1339
1340
|
]
|
|
1340
1341
|
}
|
|
1341
1342
|
),
|
|
1342
|
-
(prefix || prefixIcon) && /* @__PURE__ */ jsx8(
|
|
1343
|
+
!!(prefix || prefixIcon) && /* @__PURE__ */ jsx8(
|
|
1343
1344
|
View4,
|
|
1344
1345
|
{
|
|
1345
1346
|
onLayout: (event) => setPrefixWidth(event.nativeEvent.layout.width),
|
|
@@ -1351,7 +1352,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1351
1352
|
bottom: 0,
|
|
1352
1353
|
justifyContent: "center"
|
|
1353
1354
|
},
|
|
1354
|
-
children: prefix
|
|
1355
|
+
children: prefix ? content(prefix, affixText) : /* @__PURE__ */ jsx8(
|
|
1355
1356
|
KjunIcon,
|
|
1356
1357
|
{
|
|
1357
1358
|
name: prefixIcon,
|
|
@@ -1361,7 +1362,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1361
1362
|
)
|
|
1362
1363
|
}
|
|
1363
1364
|
),
|
|
1364
|
-
(showClear || suffix || suffixIcon) && /* @__PURE__ */ jsxs2(
|
|
1365
|
+
!!(showClear || suffix || suffixIcon) && /* @__PURE__ */ jsxs2(
|
|
1365
1366
|
View4,
|
|
1366
1367
|
{
|
|
1367
1368
|
onLayout: (event) => setAffixWidth(event.nativeEvent.layout.width),
|
|
@@ -1382,7 +1383,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1382
1383
|
onClear == null ? void 0 : onClear();
|
|
1383
1384
|
(_a = input.current) == null ? void 0 : _a.focus();
|
|
1384
1385
|
} }),
|
|
1385
|
-
suffix
|
|
1386
|
+
suffix ? content(suffix, affixText) : !!suffixIcon && /* @__PURE__ */ jsx8(
|
|
1386
1387
|
KjunIcon,
|
|
1387
1388
|
{
|
|
1388
1389
|
name: suffixIcon,
|
|
@@ -1422,6 +1423,17 @@ function KjunFormLayout({
|
|
|
1422
1423
|
) });
|
|
1423
1424
|
}
|
|
1424
1425
|
|
|
1426
|
+
// shared/package-runtime/content-presence.ts
|
|
1427
|
+
import { Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
|
|
1428
|
+
function hasContent(node) {
|
|
1429
|
+
if (node == null || typeof node === "boolean") return false;
|
|
1430
|
+
if (typeof node === "string") return node.trim().length > 0;
|
|
1431
|
+
if (Array.isArray(node)) return node.some(hasContent);
|
|
1432
|
+
if (isValidElement2(node) && node.type === Fragment2)
|
|
1433
|
+
return hasContent(node.props.children);
|
|
1434
|
+
return true;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1425
1437
|
// packages/native/src/layer-backdrop.tsx
|
|
1426
1438
|
import { Platform as Platform7, Pressable as Pressable2, View as View5 } from "react-native";
|
|
1427
1439
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -1462,7 +1474,7 @@ import { Platform as Platform8, View as View7 } from "react-native";
|
|
|
1462
1474
|
import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
|
|
1463
1475
|
import { createPortal } from "react-dom";
|
|
1464
1476
|
import { Modal, View as View6 } from "react-native";
|
|
1465
|
-
import { Fragment as
|
|
1477
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1466
1478
|
function ModalWindow({ generation, children, visible, ...props }) {
|
|
1467
1479
|
const [container, setContainer] = useState8(null);
|
|
1468
1480
|
useLayoutEffect4(() => {
|
|
@@ -1471,7 +1483,7 @@ function ModalWindow({ generation, children, visible, ...props }) {
|
|
|
1471
1483
|
setContainer(element);
|
|
1472
1484
|
return () => element.remove();
|
|
1473
1485
|
}, []);
|
|
1474
|
-
return /* @__PURE__ */ jsxs3(
|
|
1486
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1475
1487
|
/* @__PURE__ */ jsx10(Modal, { ...props, visible, children: /* @__PURE__ */ jsx10(View6, { style: { flex: 1 }, ref: (node) => {
|
|
1476
1488
|
if (node && container && container.parentNode !== node)
|
|
1477
1489
|
node.appendChild(container);
|
|
@@ -1733,7 +1745,7 @@ function KjunModal({
|
|
|
1733
1745
|
borderBottomColor: c.border
|
|
1734
1746
|
},
|
|
1735
1747
|
children: [
|
|
1736
|
-
/* @__PURE__ */ jsx12(View8, { style: { flex: 1, paddingRight: tokens8.modal.titleActionGap }, children: header
|
|
1748
|
+
/* @__PURE__ */ jsx12(View8, { style: { flex: 1, paddingRight: tokens8.modal.titleActionGap }, children: hasContent(header) ? content(header) : /* @__PURE__ */ jsx12(
|
|
1737
1749
|
Text4,
|
|
1738
1750
|
{
|
|
1739
1751
|
accessibilityRole: "header",
|
|
@@ -1773,7 +1785,7 @@ function KjunModal({
|
|
|
1773
1785
|
children
|
|
1774
1786
|
}
|
|
1775
1787
|
),
|
|
1776
|
-
(showFooter || footer) && /* @__PURE__ */ jsx12(
|
|
1788
|
+
(showFooter || hasContent(footer)) && /* @__PURE__ */ jsx12(
|
|
1777
1789
|
View8,
|
|
1778
1790
|
{
|
|
1779
1791
|
style: {
|
|
@@ -1786,7 +1798,7 @@ function KjunModal({
|
|
|
1786
1798
|
borderTopWidth: tokens8.border.defaultWidth,
|
|
1787
1799
|
borderTopColor: c.border
|
|
1788
1800
|
},
|
|
1789
|
-
children: footer
|
|
1801
|
+
children: hasContent(footer) ? content(footer) : /* @__PURE__ */ jsx12(
|
|
1790
1802
|
KjunFormActions,
|
|
1791
1803
|
{
|
|
1792
1804
|
size: footerSize,
|
|
@@ -1822,19 +1834,6 @@ import { tokens as tokens9 } from "@kjun-ui/tokens";
|
|
|
1822
1834
|
import { useId as useId4 } from "react";
|
|
1823
1835
|
import { Platform as Platform10, View as View9 } from "react-native";
|
|
1824
1836
|
import Svg2, { Defs, LinearGradient, Rect as Rect2, Stop } from "react-native-svg";
|
|
1825
|
-
|
|
1826
|
-
// shared/package-runtime/content-presence.ts
|
|
1827
|
-
import { Fragment as Fragment3, isValidElement as isValidElement2 } from "react";
|
|
1828
|
-
function hasContent(node) {
|
|
1829
|
-
if (node == null || typeof node === "boolean") return false;
|
|
1830
|
-
if (typeof node === "string") return node.trim().length > 0;
|
|
1831
|
-
if (Array.isArray(node)) return node.some(hasContent);
|
|
1832
|
-
if (isValidElement2(node) && node.type === Fragment3)
|
|
1833
|
-
return hasContent(node.props.children);
|
|
1834
|
-
return true;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
// packages/native/src/card.tsx
|
|
1838
1837
|
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1839
1838
|
function KjunCard({
|
|
1840
1839
|
title,
|
|
@@ -1895,8 +1894,8 @@ function KjunCard({
|
|
|
1895
1894
|
borderBottomColor: borderColor
|
|
1896
1895
|
}, children: [
|
|
1897
1896
|
hasHeading && /* @__PURE__ */ jsx13(View9, { style: { flexGrow: 1, flexShrink: 1, minWidth: 0, maxWidth: "100%" }, children: hasContent(header) ? content(header, { color: foreground }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1898
|
-
title && /* @__PURE__ */ jsx13(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle"), color: foreground }, children: title }),
|
|
1899
|
-
subtitle && /* @__PURE__ */ jsx13(KText, { style: { ...typeStyle("caption"), marginTop: tokens9.card.subtitleGap, color: colors[paint.description] }, children: subtitle })
|
|
1897
|
+
!!title && /* @__PURE__ */ jsx13(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle"), color: foreground }, children: title }),
|
|
1898
|
+
!!subtitle && /* @__PURE__ */ jsx13(KText, { style: { ...typeStyle("caption"), marginTop: tokens9.card.subtitleGap, color: colors[paint.description] }, children: subtitle })
|
|
1900
1899
|
] }) }),
|
|
1901
1900
|
hasContent(headerActions) && /* @__PURE__ */ jsx13(CardActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx13(View9, { style: { flexDirection: "row", flexWrap: "wrap", minWidth: 0, maxWidth: "100%", marginStart: "auto", alignItems: "center", justifyContent: "flex-end", gap: tokens9.card.titleGap }, children: content(headerActions, { color: foreground }) }) })
|
|
1902
1901
|
] }),
|
|
@@ -2014,9 +2013,9 @@ function KjunEmpty({
|
|
|
2014
2013
|
paddingVertical: stateContent === "empty" ? 0 : tokens10.dimension.value32
|
|
2015
2014
|
},
|
|
2016
2015
|
children: [
|
|
2017
|
-
icon && /* @__PURE__ */ jsx14(View10, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx14(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
2016
|
+
!!icon && /* @__PURE__ */ jsx14(View10, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx14(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
2018
2017
|
/* @__PURE__ */ jsx14(KText, { style: { ...typeStyle("cardTitle"), color: colors.text, fontSize: spec.titleSize, lineHeight: spec.titleLineHeight, textAlign: "center", maxWidth: spec.textMaxWidth }, children: text }),
|
|
2019
|
-
description && /* @__PURE__ */ jsx14(
|
|
2018
|
+
!!description && /* @__PURE__ */ jsx14(
|
|
2020
2019
|
KText,
|
|
2021
2020
|
{
|
|
2022
2021
|
style: {
|
|
@@ -2031,7 +2030,7 @@ function KjunEmpty({
|
|
|
2031
2030
|
children: description
|
|
2032
2031
|
}
|
|
2033
2032
|
),
|
|
2034
|
-
children && /* @__PURE__ */ jsx14(View10, { style: { marginTop: spec.actionGap, maxWidth: "100%" }, children: content(children) })
|
|
2033
|
+
hasContent(children) && /* @__PURE__ */ jsx14(View10, { style: { marginTop: spec.actionGap, maxWidth: "100%" }, children: content(children) })
|
|
2035
2034
|
]
|
|
2036
2035
|
}
|
|
2037
2036
|
);
|
|
@@ -2109,7 +2108,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2109
2108
|
)
|
|
2110
2109
|
}
|
|
2111
2110
|
),
|
|
2112
|
-
text && /* @__PURE__ */ jsx14(KText, { style: { marginLeft: tokens10.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2111
|
+
!!text && /* @__PURE__ */ jsx14(KText, { style: { marginLeft: tokens10.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2113
2112
|
]
|
|
2114
2113
|
}
|
|
2115
2114
|
);
|
|
@@ -2170,7 +2169,7 @@ function KjunAlert({
|
|
|
2170
2169
|
...typeStyle(small ? "caption" : "body"),
|
|
2171
2170
|
color: colors.textSecondary
|
|
2172
2171
|
}) }),
|
|
2173
|
-
hasContent(actions) && /* @__PURE__ */ jsx14(ActionSizeContext.Provider, { value: alertActionSizes[small ? "sm" : "md"], children: /* @__PURE__ */ jsx14(AlertActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx14(View10, { style: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: geometry2.actionsGap, marginTop: geometry2[small ? "sm" : "md"].actionGap }, children: actions }) }) })
|
|
2172
|
+
hasContent(actions) && /* @__PURE__ */ jsx14(ActionSizeContext.Provider, { value: alertActionSizes[small ? "sm" : "md"], children: /* @__PURE__ */ jsx14(AlertActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx14(View10, { style: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: geometry2.actionsGap, marginTop: geometry2[small ? "sm" : "md"].actionGap }, children: content(actions) }) }) })
|
|
2174
2173
|
] }),
|
|
2175
2174
|
closable && /* @__PURE__ */ jsx14(
|
|
2176
2175
|
AccessiblePressable,
|
|
@@ -2220,7 +2219,7 @@ function KjunProgress({
|
|
|
2220
2219
|
const { colors } = useKjunStyles();
|
|
2221
2220
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2222
2221
|
return /* @__PURE__ */ jsxs7(View10, { children: [
|
|
2223
|
-
(label || showLabel) && /* @__PURE__ */ jsxs7(
|
|
2222
|
+
!!(label || showLabel) && /* @__PURE__ */ jsxs7(
|
|
2224
2223
|
View10,
|
|
2225
2224
|
{
|
|
2226
2225
|
style: {
|
|
@@ -2638,7 +2637,7 @@ function ToastView({
|
|
|
2638
2637
|
children: [
|
|
2639
2638
|
/* @__PURE__ */ jsx16(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
2640
2639
|
/* @__PURE__ */ jsxs9(View12, { style: { flex: 1, minWidth: 0 }, children: [
|
|
2641
|
-
toast.title && /* @__PURE__ */ jsx16(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens13.extensions.toast.titleGap }, children: toast.title }),
|
|
2640
|
+
!!toast.title && /* @__PURE__ */ jsx16(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens13.extensions.toast.titleGap }, children: toast.title }),
|
|
2642
2641
|
/* @__PURE__ */ jsx16(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
2643
2642
|
toast.action && /* @__PURE__ */ jsx16(
|
|
2644
2643
|
AccessiblePressable,
|
|
@@ -2892,7 +2891,7 @@ function FeedbackDialog({
|
|
|
2892
2891
|
onConfirm: submit,
|
|
2893
2892
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
2894
2893
|
children: [
|
|
2895
|
-
options.message && /* @__PURE__ */ jsx18(KText, { style: { marginBottom: tokens16.dimension.value16 }, children: options.message }),
|
|
2894
|
+
!!options.message && /* @__PURE__ */ jsx18(KText, { style: { marginBottom: tokens16.dimension.value16 }, children: options.message }),
|
|
2896
2895
|
request.kind === "prompt" && /* @__PURE__ */ jsx18(
|
|
2897
2896
|
KjunInput,
|
|
2898
2897
|
{
|
|
@@ -2909,7 +2908,7 @@ function FeedbackDialog({
|
|
|
2909
2908
|
}
|
|
2910
2909
|
);
|
|
2911
2910
|
}
|
|
2912
|
-
function KjunFeedbackProvider({ children }) {
|
|
2911
|
+
function KjunFeedbackProvider({ children, style }) {
|
|
2913
2912
|
const [controller] = useState13(createFeedbackController);
|
|
2914
2913
|
const life = useRef13(0);
|
|
2915
2914
|
const snapshot = useSyncExternalStore2(
|
|
@@ -2939,7 +2938,7 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2939
2938
|
{
|
|
2940
2939
|
value: { top: layers[layers.length - 1], register, render: renderToasts },
|
|
2941
2940
|
children: /* @__PURE__ */ jsxs10(KjunFeedbackContext.Provider, { value: controller.api, children: [
|
|
2942
|
-
/* @__PURE__ */ jsxs10(View14, { style: { position: "relative" }, children: [
|
|
2941
|
+
/* @__PURE__ */ jsxs10(View14, { style: [{ position: "relative", flexGrow: 1, flexShrink: 1, alignSelf: "stretch" }, style], children: [
|
|
2943
2942
|
children,
|
|
2944
2943
|
layers.length === 0 && renderToasts()
|
|
2945
2944
|
] }),
|
|
@@ -3029,7 +3028,7 @@ function KjunCheckbox({
|
|
|
3029
3028
|
)
|
|
3030
3029
|
}
|
|
3031
3030
|
),
|
|
3032
|
-
(children || label) && content(children || label, {
|
|
3031
|
+
!!(children || label) && content(children || label, {
|
|
3033
3032
|
marginLeft: tokens17.extensions.checkbox.labelGap,
|
|
3034
3033
|
...typeStyle("label")
|
|
3035
3034
|
})
|
|
@@ -3140,7 +3139,7 @@ function KjunSwitch({
|
|
|
3140
3139
|
]
|
|
3141
3140
|
}
|
|
3142
3141
|
),
|
|
3143
|
-
(children || label) && content(children || label, {
|
|
3142
|
+
!!(children || label) && content(children || label, {
|
|
3144
3143
|
marginLeft: tokens17.extensions.switch.labelGap,
|
|
3145
3144
|
...typeStyle("label")
|
|
3146
3145
|
})
|
|
@@ -3217,7 +3216,7 @@ function KjunRadio({
|
|
|
3217
3216
|
)
|
|
3218
3217
|
}
|
|
3219
3218
|
),
|
|
3220
|
-
(children || label) && content(children || label, {
|
|
3219
|
+
!!(children || label) && content(children || label, {
|
|
3221
3220
|
marginLeft: geometry2.labelGap,
|
|
3222
3221
|
...typeStyle("label")
|
|
3223
3222
|
})
|
|
@@ -3465,7 +3464,7 @@ function KjunButtonGroup({
|
|
|
3465
3464
|
opacity: blocked ? tokens19.states.opacity.disabled : 1
|
|
3466
3465
|
}),
|
|
3467
3466
|
children: [
|
|
3468
|
-
option.icon && /* @__PURE__ */ jsx21(
|
|
3467
|
+
!!option.icon && /* @__PURE__ */ jsx21(
|
|
3469
3468
|
KjunIcon,
|
|
3470
3469
|
{
|
|
3471
3470
|
name: option.icon,
|
|
@@ -3562,7 +3561,7 @@ function KjunFilterGroup({
|
|
|
3562
3561
|
}
|
|
3563
3562
|
}
|
|
3564
3563
|
),
|
|
3565
|
-
option.icon && /* @__PURE__ */ jsx21(
|
|
3564
|
+
!!option.icon && /* @__PURE__ */ jsx21(
|
|
3566
3565
|
KjunIcon,
|
|
3567
3566
|
{
|
|
3568
3567
|
name: option.icon,
|
|
@@ -3695,8 +3694,32 @@ var KjunTextarea = forwardRef3(
|
|
|
3695
3694
|
|
|
3696
3695
|
// packages/native/src/drawer.tsx
|
|
3697
3696
|
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
3698
|
-
import { useState as useState16 } from "react";
|
|
3699
|
-
import { Animated as Animated12 } from "react-native";
|
|
3697
|
+
import { useEffect as useEffect11, useState as useState16 } from "react";
|
|
3698
|
+
import { Animated as Animated12, Keyboard } from "react-native";
|
|
3699
|
+
|
|
3700
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
3701
|
+
function keyboardEvents(os) {
|
|
3702
|
+
return os === "ios" ? { show: "keyboardWillShow", hide: "keyboardWillHide" } : null;
|
|
3703
|
+
}
|
|
3704
|
+
function keyboardOverlap(windowHeight, keyboardScreenY) {
|
|
3705
|
+
return Math.max(0, windowHeight - keyboardScreenY);
|
|
3706
|
+
}
|
|
3707
|
+
function drawerFrame({ position, windowHeight, safeAreaTop, safeAreaBottom, gap, keyboard, maxHeight }) {
|
|
3708
|
+
const visible = windowHeight - keyboard;
|
|
3709
|
+
const bottomInset = keyboard > 0 ? 0 : safeAreaBottom;
|
|
3710
|
+
if (position === "left" || position === "right")
|
|
3711
|
+
return { maxHeight: visible, height: visible, paddingTop: safeAreaTop, paddingBottom: bottomInset, lift: 0 };
|
|
3712
|
+
const sheet = maxHeight != null ? maxHeight : visible - (position === "bottom" ? safeAreaTop : bottomInset) - gap;
|
|
3713
|
+
return {
|
|
3714
|
+
maxHeight: Math.max(0, Math.min(sheet, visible)),
|
|
3715
|
+
height: void 0,
|
|
3716
|
+
paddingTop: position === "top" ? safeAreaTop : 0,
|
|
3717
|
+
paddingBottom: position === "bottom" ? bottomInset : 0,
|
|
3718
|
+
lift: position === "bottom" ? keyboard : 0
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3722
|
+
// packages/native/src/drawer.tsx
|
|
3700
3723
|
import {
|
|
3701
3724
|
Platform as Platform14,
|
|
3702
3725
|
ScrollView as ScrollView3,
|
|
@@ -3704,6 +3727,24 @@ import {
|
|
|
3704
3727
|
useWindowDimensions as useWindowDimensions3
|
|
3705
3728
|
} from "react-native";
|
|
3706
3729
|
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3730
|
+
function useKeyboardOverlap(enabled2, windowHeight) {
|
|
3731
|
+
const [overlap, setOverlap] = useState16(0);
|
|
3732
|
+
useEffect11(() => {
|
|
3733
|
+
var _a, _b;
|
|
3734
|
+
setOverlap(0);
|
|
3735
|
+
const events = keyboardEvents(Platform14.OS);
|
|
3736
|
+
if (!enabled2 || !events) return;
|
|
3737
|
+
const metrics = (_b = (_a = Keyboard).metrics) == null ? void 0 : _b.call(_a);
|
|
3738
|
+
if (metrics) setOverlap(keyboardOverlap(windowHeight, metrics.screenY));
|
|
3739
|
+
const show = Keyboard.addListener(events.show, (event) => setOverlap(keyboardOverlap(windowHeight, event.endCoordinates.screenY)));
|
|
3740
|
+
const hide = Keyboard.addListener(events.hide, () => setOverlap(0));
|
|
3741
|
+
return () => {
|
|
3742
|
+
show.remove();
|
|
3743
|
+
hide.remove();
|
|
3744
|
+
};
|
|
3745
|
+
}, [enabled2, windowHeight]);
|
|
3746
|
+
return overlap;
|
|
3747
|
+
}
|
|
3707
3748
|
function KjunDrawer({
|
|
3708
3749
|
open,
|
|
3709
3750
|
onOpenChange,
|
|
@@ -3718,9 +3759,24 @@ function KjunDrawer({
|
|
|
3718
3759
|
footer,
|
|
3719
3760
|
children,
|
|
3720
3761
|
onClose,
|
|
3721
|
-
ariaLabel
|
|
3762
|
+
ariaLabel,
|
|
3763
|
+
safeAreaTop = 0,
|
|
3764
|
+
safeAreaBottom = 0,
|
|
3765
|
+
maxHeight,
|
|
3766
|
+
avoidKeyboard = true
|
|
3722
3767
|
}) {
|
|
3723
3768
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions3(), vertical = position === "left" || position === "right";
|
|
3769
|
+
const [rootHeight, setRootHeight] = useState16(0);
|
|
3770
|
+
const keyboard = useKeyboardOverlap(open && avoidKeyboard, window2.height);
|
|
3771
|
+
const frame = drawerFrame({
|
|
3772
|
+
position,
|
|
3773
|
+
windowHeight: rootHeight || window2.height,
|
|
3774
|
+
safeAreaTop: Math.max(0, safeAreaTop),
|
|
3775
|
+
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
3776
|
+
gap: tokens21.extensions.drawer.sheetGap,
|
|
3777
|
+
keyboard,
|
|
3778
|
+
maxHeight
|
|
3779
|
+
});
|
|
3724
3780
|
const [panelHeight, setPanelHeight] = useState16(0);
|
|
3725
3781
|
const motion = useNativePresence(open, tokens21.motion.layerEnter, tokens21.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
3726
3782
|
const backdrop = useNativePresence(open, tokens21.motion.backdrop, tokens21.motion.backdropExit, true, 0, { fade: tokens21.motion.backdropExit });
|
|
@@ -3744,6 +3800,7 @@ function KjunDrawer({
|
|
|
3744
3800
|
children: /* @__PURE__ */ jsxs14(
|
|
3745
3801
|
View18,
|
|
3746
3802
|
{
|
|
3803
|
+
onLayout: (event) => setRootHeight(event.nativeEvent.layout.height),
|
|
3747
3804
|
style: {
|
|
3748
3805
|
flex: 1,
|
|
3749
3806
|
justifyContent: position === "bottom" ? "flex-end" : "flex-start",
|
|
@@ -3782,8 +3839,11 @@ function KjunDrawer({
|
|
|
3782
3839
|
opacity: vertical || panelHeight > 0 ? 1 : 0,
|
|
3783
3840
|
transform: vertical ? [{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [(position === "left" ? -1 : 1) * Math.min(width, window2.width), 0] }) }] : [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [(position === "top" ? -1 : 1) * panelHeight, 0] }) }],
|
|
3784
3841
|
width: vertical ? Math.min(width, window2.width) : window2.width,
|
|
3785
|
-
height:
|
|
3786
|
-
maxHeight:
|
|
3842
|
+
height: frame.height,
|
|
3843
|
+
maxHeight: frame.maxHeight,
|
|
3844
|
+
paddingTop: frame.paddingTop,
|
|
3845
|
+
paddingBottom: frame.paddingBottom,
|
|
3846
|
+
marginBottom: frame.lift,
|
|
3787
3847
|
borderRadius: tokens21.extensions.drawer.radius,
|
|
3788
3848
|
borderTopLeftRadius: position === "bottom" ? tokens21.extensions.drawer.bottomRadius : tokens21.extensions.drawer.radius,
|
|
3789
3849
|
borderTopRightRadius: position === "bottom" ? tokens21.extensions.drawer.bottomRadius : tokens21.extensions.drawer.radius,
|
|
@@ -3791,7 +3851,7 @@ function KjunDrawer({
|
|
|
3791
3851
|
backgroundColor: colors.surface
|
|
3792
3852
|
},
|
|
3793
3853
|
children: [
|
|
3794
|
-
(title || header || closable) && /* @__PURE__ */ jsxs14(
|
|
3854
|
+
!!(title || header || closable) && /* @__PURE__ */ jsxs14(
|
|
3795
3855
|
View18,
|
|
3796
3856
|
{
|
|
3797
3857
|
style: {
|
|
@@ -3804,7 +3864,7 @@ function KjunDrawer({
|
|
|
3804
3864
|
borderBottomColor: colors.border
|
|
3805
3865
|
},
|
|
3806
3866
|
children: [
|
|
3807
|
-
/* @__PURE__ */ jsx23(View18, { style: { flex: 1 }, children: header
|
|
3867
|
+
/* @__PURE__ */ jsx23(View18, { style: { flex: 1 }, children: hasContent(header) ? content(header) : /* @__PURE__ */ jsx23(
|
|
3808
3868
|
KText,
|
|
3809
3869
|
{
|
|
3810
3870
|
style: { ...typeStyle("sectionTitle") },
|
|
@@ -3829,12 +3889,12 @@ function KjunDrawer({
|
|
|
3829
3889
|
ScrollView3,
|
|
3830
3890
|
{
|
|
3831
3891
|
keyboardShouldPersistTaps: "handled",
|
|
3832
|
-
style: vertical ? { flex: 1 } : { flexGrow: 0 },
|
|
3892
|
+
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
3833
3893
|
contentContainerStyle: { padding: noPadding ? 0 : tokens21.extensions.drawer.bodyPadding },
|
|
3834
3894
|
children: content(children)
|
|
3835
3895
|
}
|
|
3836
3896
|
),
|
|
3837
|
-
footer && /* @__PURE__ */ jsx23(
|
|
3897
|
+
hasContent(footer) && /* @__PURE__ */ jsx23(
|
|
3838
3898
|
View18,
|
|
3839
3899
|
{
|
|
3840
3900
|
style: {
|
|
@@ -3864,7 +3924,7 @@ import {
|
|
|
3864
3924
|
createContext as createContext15,
|
|
3865
3925
|
isValidElement as isValidElement5,
|
|
3866
3926
|
useContext as useContext11,
|
|
3867
|
-
useEffect as
|
|
3927
|
+
useEffect as useEffect14,
|
|
3868
3928
|
useRef as useRef19,
|
|
3869
3929
|
useState as useState19
|
|
3870
3930
|
} from "react";
|
|
@@ -3878,7 +3938,7 @@ import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
|
3878
3938
|
import {
|
|
3879
3939
|
cloneElement as cloneElement2,
|
|
3880
3940
|
isValidElement as isValidElement3,
|
|
3881
|
-
useEffect as
|
|
3941
|
+
useEffect as useEffect12,
|
|
3882
3942
|
useLayoutEffect as useLayoutEffect11,
|
|
3883
3943
|
useRef as useRef17,
|
|
3884
3944
|
useState as useState17
|
|
@@ -3960,14 +4020,14 @@ function FloatingPanel({
|
|
|
3960
4020
|
setAnchored(false);
|
|
3961
4021
|
}
|
|
3962
4022
|
}, [motion.present]);
|
|
3963
|
-
|
|
4023
|
+
useEffect12(() => {
|
|
3964
4024
|
var _a;
|
|
3965
4025
|
const row = reveal == null ? void 0 : reveal.current;
|
|
3966
4026
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
3967
4027
|
const offset = row.y + row.height + (menu || field ? tokens22.extensions.menu.padding : 0) - viewport.current;
|
|
3968
4028
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
3969
4029
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
3970
|
-
|
|
4030
|
+
useEffect12(() => {
|
|
3971
4031
|
if (!open || !anchored || !sized || !focusOnOpen || !panelRef.current) return;
|
|
3972
4032
|
if (Platform15.OS === "web") {
|
|
3973
4033
|
const node = panelRef.current;
|
|
@@ -4118,7 +4178,7 @@ function FloatingPanel({
|
|
|
4118
4178
|
borderBottomWidth: tokens22.border.defaultWidth,
|
|
4119
4179
|
borderBottomColor: colors.divider
|
|
4120
4180
|
},
|
|
4121
|
-
children: header
|
|
4181
|
+
children: content(header, typeStyle("cardTitle"))
|
|
4122
4182
|
}
|
|
4123
4183
|
),
|
|
4124
4184
|
/* @__PURE__ */ jsx24(
|
|
@@ -4155,7 +4215,7 @@ function FloatingPanel({
|
|
|
4155
4215
|
import {
|
|
4156
4216
|
cloneElement as cloneElement3,
|
|
4157
4217
|
isValidElement as isValidElement4,
|
|
4158
|
-
useEffect as
|
|
4218
|
+
useEffect as useEffect13,
|
|
4159
4219
|
useRef as useRef18,
|
|
4160
4220
|
useState as useState18
|
|
4161
4221
|
} from "react";
|
|
@@ -4248,11 +4308,11 @@ function KjunTooltip({
|
|
|
4248
4308
|
clearTimeout(timer.current);
|
|
4249
4309
|
timer.current = setTimeout(() => setOpen(true), delay);
|
|
4250
4310
|
};
|
|
4251
|
-
|
|
4311
|
+
useEffect13(() => {
|
|
4252
4312
|
if (!scopeActive) hide();
|
|
4253
4313
|
}, [scopeActive]);
|
|
4254
|
-
|
|
4255
|
-
|
|
4314
|
+
useEffect13(() => () => clearTimeout(timer.current), []);
|
|
4315
|
+
useEffect13(() => {
|
|
4256
4316
|
if (Platform16.OS !== "web" || !open) return;
|
|
4257
4317
|
const escape = (event) => {
|
|
4258
4318
|
if (event.key === "Escape") hide();
|
|
@@ -4368,7 +4428,7 @@ function KjunDropdown({
|
|
|
4368
4428
|
if (v) onOpen == null ? void 0 : onOpen();
|
|
4369
4429
|
else onClose == null ? void 0 : onClose();
|
|
4370
4430
|
};
|
|
4371
|
-
|
|
4431
|
+
useEffect14(() => {
|
|
4372
4432
|
if (unavailable) change(false);
|
|
4373
4433
|
}, [unavailable]);
|
|
4374
4434
|
return /* @__PURE__ */ jsxs17(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -4503,7 +4563,7 @@ function KjunMenuButton({
|
|
|
4503
4563
|
}
|
|
4504
4564
|
|
|
4505
4565
|
// shared/package-runtime/combobox.ts
|
|
4506
|
-
import { useEffect as
|
|
4566
|
+
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
4507
4567
|
|
|
4508
4568
|
// shared/package-runtime/options.ts
|
|
4509
4569
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -4582,8 +4642,8 @@ function useComboboxModel({
|
|
|
4582
4642
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
4583
4643
|
const [query, setQuery] = useState20(selectedLabel);
|
|
4584
4644
|
const [open, setOpen] = useState20(false);
|
|
4585
|
-
|
|
4586
|
-
|
|
4645
|
+
useEffect15(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
4646
|
+
useEffect15(() => {
|
|
4587
4647
|
if (disabled) setOpen(false);
|
|
4588
4648
|
}, [disabled]);
|
|
4589
4649
|
const change = (next) => {
|
|
@@ -5040,7 +5100,7 @@ function KjunDatePicker({
|
|
|
5040
5100
|
import { useState as useState23 } from "react";
|
|
5041
5101
|
|
|
5042
5102
|
// shared/package-runtime/search-input.ts
|
|
5043
|
-
import { useEffect as
|
|
5103
|
+
import { useEffect as useEffect16, useLayoutEffect as useLayoutEffect12, useRef as useRef22, useState as useState22 } from "react";
|
|
5044
5104
|
function useSearchInputModel({
|
|
5045
5105
|
value,
|
|
5046
5106
|
disabled = false,
|
|
@@ -5063,7 +5123,7 @@ function useSearchInputModel({
|
|
|
5063
5123
|
clearTimeout(timer.current);
|
|
5064
5124
|
return () => clearTimeout(timer.current);
|
|
5065
5125
|
}, [disabled, debounce, !!loadOptions]);
|
|
5066
|
-
|
|
5126
|
+
useEffect16(() => {
|
|
5067
5127
|
const current = ++version.current, abort = new AbortController();
|
|
5068
5128
|
setFailed(false);
|
|
5069
5129
|
if (!loadOptions || !open || disabled || query.length < minChars) {
|
|
@@ -5212,7 +5272,7 @@ function KjunSearchInput({
|
|
|
5212
5272
|
|
|
5213
5273
|
// packages/native/src/select-control.tsx
|
|
5214
5274
|
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5215
|
-
import { useContext as useContext12, useEffect as
|
|
5275
|
+
import { useContext as useContext12, useEffect as useEffect18, useRef as useRef24 } from "react";
|
|
5216
5276
|
|
|
5217
5277
|
// packages/native/src/compound-control.tsx
|
|
5218
5278
|
import { createContext as createContext16 } from "react";
|
|
@@ -5226,7 +5286,7 @@ function CompoundTarget({ children, square = false }) {
|
|
|
5226
5286
|
}
|
|
5227
5287
|
|
|
5228
5288
|
// shared/package-runtime/select.ts
|
|
5229
|
-
import { useEffect as
|
|
5289
|
+
import { useEffect as useEffect17, useRef as useRef23, useState as useState24 } from "react";
|
|
5230
5290
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
5231
5291
|
const [internal, setInternal] = useState24(false);
|
|
5232
5292
|
const [query, setQuery] = useState24("");
|
|
@@ -5235,7 +5295,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5235
5295
|
const isControlled = typeof controlled === "boolean";
|
|
5236
5296
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
5237
5297
|
const previousOpen = useRef23(open);
|
|
5238
|
-
|
|
5298
|
+
useEffect17(() => {
|
|
5239
5299
|
if (disabled && !isControlled) setInternal(false);
|
|
5240
5300
|
if (previousOpen.current && !open) {
|
|
5241
5301
|
setQuery("");
|
|
@@ -5244,7 +5304,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5244
5304
|
}
|
|
5245
5305
|
previousOpen.current = open;
|
|
5246
5306
|
}, [open, disabled, isControlled, pageSize]);
|
|
5247
|
-
|
|
5307
|
+
useEffect17(() => {
|
|
5248
5308
|
setLimit(pageSize);
|
|
5249
5309
|
}, [pageSize]);
|
|
5250
5310
|
const changeOpen = (next) => {
|
|
@@ -5294,7 +5354,7 @@ function KjunSelect({
|
|
|
5294
5354
|
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef24(null), spec = tokens29.input[size];
|
|
5295
5355
|
const trigger = useRef24(null);
|
|
5296
5356
|
const compound = useContext12(CompoundControlContext);
|
|
5297
|
-
|
|
5357
|
+
useEffect18(() => {
|
|
5298
5358
|
if (compound == null ? void 0 : compound.focusRef) compound.focusRef.current = trigger.current;
|
|
5299
5359
|
}, [compound == null ? void 0 : compound.focusRef]);
|
|
5300
5360
|
const expanded = usePopupExpanded(open, ref);
|
|
@@ -5545,10 +5605,10 @@ function Collapse({ open, children }) {
|
|
|
5545
5605
|
}
|
|
5546
5606
|
|
|
5547
5607
|
// shared/package-runtime/navigation.ts
|
|
5548
|
-
import { useEffect as
|
|
5608
|
+
import { useEffect as useEffect19, useRef as useRef26, useState as useState26 } from "react";
|
|
5549
5609
|
function useInitialTab(value, candidate, change) {
|
|
5550
5610
|
const requested = useRef26(/* @__PURE__ */ new Set());
|
|
5551
|
-
|
|
5611
|
+
useEffect19(() => {
|
|
5552
5612
|
if (value !== "") {
|
|
5553
5613
|
requested.current.clear();
|
|
5554
5614
|
return;
|
|
@@ -5560,7 +5620,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
5560
5620
|
}
|
|
5561
5621
|
function useAccordionState(multiple) {
|
|
5562
5622
|
const [opened, setOpened] = useState26(/* @__PURE__ */ new Set());
|
|
5563
|
-
|
|
5623
|
+
useEffect19(() => {
|
|
5564
5624
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
5565
5625
|
}, [multiple]);
|
|
5566
5626
|
return {
|
|
@@ -5588,7 +5648,7 @@ import {
|
|
|
5588
5648
|
Fragment as Fragment11,
|
|
5589
5649
|
createContext as createContext18,
|
|
5590
5650
|
useContext as useContext14,
|
|
5591
|
-
useEffect as
|
|
5651
|
+
useEffect as useEffect20,
|
|
5592
5652
|
useId as useId7,
|
|
5593
5653
|
useState as useState28
|
|
5594
5654
|
} from "react";
|
|
@@ -5855,7 +5915,7 @@ function KjunTabs({
|
|
|
5855
5915
|
opacity: tab.disabled ? tokens31.states.opacity.disabled : 1
|
|
5856
5916
|
},
|
|
5857
5917
|
children: [
|
|
5858
|
-
tab.icon && /* @__PURE__ */ jsx34(
|
|
5918
|
+
!!tab.icon && /* @__PURE__ */ jsx34(
|
|
5859
5919
|
KjunIcon,
|
|
5860
5920
|
{
|
|
5861
5921
|
name: tab.icon,
|
|
@@ -5900,11 +5960,11 @@ function KjunTabs({
|
|
|
5900
5960
|
tab.name
|
|
5901
5961
|
);
|
|
5902
5962
|
}),
|
|
5903
|
-
actions
|
|
5963
|
+
content(actions)
|
|
5904
5964
|
]
|
|
5905
5965
|
}
|
|
5906
5966
|
),
|
|
5907
|
-
children && /* @__PURE__ */ jsx34(View28, { style: { marginTop: geometry2.contentGap }, children })
|
|
5967
|
+
hasContent(children) && /* @__PURE__ */ jsx34(View28, { style: { marginTop: geometry2.contentGap }, children: content(children) })
|
|
5908
5968
|
] }) });
|
|
5909
5969
|
}
|
|
5910
5970
|
function KjunTabPane({ name, children }) {
|
|
@@ -5969,7 +6029,7 @@ function KjunAccordionItem({
|
|
|
5969
6029
|
const geometry2 = tokens32.extensions.accordion;
|
|
5970
6030
|
const [hovered, setHovered] = useState28(false);
|
|
5971
6031
|
const wrapping = Platform21.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
5972
|
-
|
|
6032
|
+
useEffect20(() => {
|
|
5973
6033
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
5974
6034
|
}, []);
|
|
5975
6035
|
return /* @__PURE__ */ jsxs23(View29, { children: [
|
|
@@ -6032,7 +6092,7 @@ function KjunBreadcrumb({
|
|
|
6032
6092
|
},
|
|
6033
6093
|
children: items.map((item, i) => {
|
|
6034
6094
|
const label = /* @__PURE__ */ jsxs23(View29, { style: { flexDirection: "row", alignItems: "center", gap: tokens32.dimension.value4 }, children: [
|
|
6035
|
-
item.icon && /* @__PURE__ */ jsx35(KjunIcon, { name: item.icon, size: tokens32.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6095
|
+
!!item.icon && /* @__PURE__ */ jsx35(KjunIcon, { name: item.icon, size: tokens32.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6036
6096
|
/* @__PURE__ */ jsx35(
|
|
6037
6097
|
KText,
|
|
6038
6098
|
{
|
|
@@ -6205,7 +6265,7 @@ function KjunPagination({
|
|
|
6205
6265
|
|
|
6206
6266
|
// packages/native/src/actions.tsx
|
|
6207
6267
|
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6208
|
-
import { useContext as useContext15, useEffect as
|
|
6268
|
+
import { useContext as useContext15, useEffect as useEffect21, useRef as useRef29, useState as useState29 } from "react";
|
|
6209
6269
|
import { Platform as Platform22, ScrollView as ScrollView7, View as View30 } from "react-native";
|
|
6210
6270
|
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6211
6271
|
function KjunIconToggle({
|
|
@@ -6289,7 +6349,7 @@ function KjunCopyButton({
|
|
|
6289
6349
|
onCopyError
|
|
6290
6350
|
}) {
|
|
6291
6351
|
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy = useRef29(false), timer = useRef29(void 0), mounted = useRef29(true);
|
|
6292
|
-
|
|
6352
|
+
useEffect21(() => {
|
|
6293
6353
|
mounted.current = true;
|
|
6294
6354
|
return () => {
|
|
6295
6355
|
mounted.current = false;
|
|
@@ -6348,7 +6408,7 @@ function KjunCopyButton({
|
|
|
6348
6408
|
color: copied ? colors.success : colors.textSecondary
|
|
6349
6409
|
}
|
|
6350
6410
|
),
|
|
6351
|
-
text && !inline && /* @__PURE__ */ jsx36(
|
|
6411
|
+
!!text && !inline && /* @__PURE__ */ jsx36(
|
|
6352
6412
|
KText,
|
|
6353
6413
|
{
|
|
6354
6414
|
style: {
|
|
@@ -6450,10 +6510,10 @@ import { Component, useState as useState31 } from "react";
|
|
|
6450
6510
|
import { Platform as Platform23, View as View31 } from "react-native";
|
|
6451
6511
|
|
|
6452
6512
|
// shared/package-runtime/use-loading-reveal.ts
|
|
6453
|
-
import { useEffect as
|
|
6513
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
6454
6514
|
function useLoadingReveal(active, delay = 0) {
|
|
6455
6515
|
const [revealed, setRevealed] = useState30(false);
|
|
6456
|
-
|
|
6516
|
+
useEffect22(() => {
|
|
6457
6517
|
setRevealed(false);
|
|
6458
6518
|
if (!active || delay <= 0) return;
|
|
6459
6519
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -6541,7 +6601,7 @@ function KjunDataState({
|
|
|
6541
6601
|
/* @__PURE__ */ jsx37(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
6542
6602
|
] }))
|
|
6543
6603
|
}
|
|
6544
|
-
) : blockingError ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx37(View31, { style: { paddingVertical: padding }, children: errorContent || /* @__PURE__ */ jsx37(KjunAlert, { type: "danger", title: "\uC624\uB958 \uBC1C\uC0DD", actions: onRetry && /* @__PURE__ */ jsx37(KjunButton, { variant: "secondary", onPress: onRetry, children: retryText }), children: query.error }) }) }) : empty ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "empty", children: /* @__PURE__ */ jsx37(View31, { style: { paddingVertical: padding }, children: emptyContent || /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyText, icon: emptyIcon, children: emptyActionText && /* @__PURE__ */ jsx37(KjunButton, { onPress: onEmptyAction, children: emptyActionText }) }) }) }) : null,
|
|
6604
|
+
) : blockingError ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx37(View31, { style: { paddingVertical: padding }, children: errorContent || /* @__PURE__ */ jsx37(KjunAlert, { type: "danger", title: "\uC624\uB958 \uBC1C\uC0DD", actions: onRetry && /* @__PURE__ */ jsx37(KjunButton, { variant: "secondary", onPress: onRetry, children: retryText }), children: query.error }) }) }) : empty ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "empty", children: /* @__PURE__ */ jsx37(View31, { style: { paddingVertical: padding }, children: emptyContent || /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyText, icon: emptyIcon, children: !!emptyActionText && /* @__PURE__ */ jsx37(KjunButton, { onPress: onEmptyAction, children: emptyActionText }) }) }) }) : null,
|
|
6545
6605
|
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ jsx37(
|
|
6546
6606
|
View31,
|
|
6547
6607
|
{
|
|
@@ -6616,7 +6676,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
6616
6676
|
|
|
6617
6677
|
// packages/native/src/skeletons.tsx
|
|
6618
6678
|
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
6619
|
-
import { useEffect as
|
|
6679
|
+
import { useEffect as useEffect23, useRef as useRef30, useState as useState33 } from "react";
|
|
6620
6680
|
import { Animated as Animated17, Platform as Platform24, View as View33, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
6621
6681
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
6622
6682
|
|
|
@@ -6806,7 +6866,7 @@ function KjunChartSkeleton({
|
|
|
6806
6866
|
columns = 14
|
|
6807
6867
|
}) {
|
|
6808
6868
|
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef30(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState33(0), thickness = tokens38.extensions.chartSkeleton.donutThickness, boxHeight = typeof height === "number" ? height : measured, hole = boxHeight > 0 ? chartDonutHole(boxHeight, thickness) : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns), status = revealed && loadingText ? "status" : void 0, hidden = { "aria-hidden": true, importantForAccessibility: "no-hide-descendants" };
|
|
6809
|
-
|
|
6869
|
+
useEffect23(() => {
|
|
6810
6870
|
if (reduced || !skeleton) return;
|
|
6811
6871
|
const loop = Animated17.loop(
|
|
6812
6872
|
Animated17.sequence([
|
|
@@ -7026,12 +7086,12 @@ function KjunAnimatedNumber({
|
|
|
7026
7086
|
style
|
|
7027
7087
|
],
|
|
7028
7088
|
children: [
|
|
7029
|
-
prefix && /* @__PURE__ */ jsxs28(Text5, { style: typeStyle("caption"), children: [
|
|
7089
|
+
!!prefix && /* @__PURE__ */ jsxs28(Text5, { style: typeStyle("caption"), children: [
|
|
7030
7090
|
prefix,
|
|
7031
7091
|
" "
|
|
7032
7092
|
] }),
|
|
7033
7093
|
typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals),
|
|
7034
|
-
suffix && /* @__PURE__ */ jsxs28(Text5, { style: typeStyle("caption"), children: [
|
|
7094
|
+
!!suffix && /* @__PURE__ */ jsxs28(Text5, { style: typeStyle("caption"), children: [
|
|
7035
7095
|
" ",
|
|
7036
7096
|
suffix
|
|
7037
7097
|
] })
|
|
@@ -7437,7 +7497,7 @@ function KjunSparkline({
|
|
|
7437
7497
|
|
|
7438
7498
|
// shared/package-runtime/table.ts
|
|
7439
7499
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
7440
|
-
import { useEffect as
|
|
7500
|
+
import { useEffect as useEffect25, useRef as useRef33, useState as useState36 } from "react";
|
|
7441
7501
|
|
|
7442
7502
|
// shared/package-runtime/table-model.ts
|
|
7443
7503
|
function getValue(row, key) {
|
|
@@ -7485,7 +7545,7 @@ function useTableModel(props) {
|
|
|
7485
7545
|
key: "",
|
|
7486
7546
|
order: "asc"
|
|
7487
7547
|
}), [internalExpanded, setExpanded] = useState36([]), [search, setSearch] = useState36(""), timer = useRef33(void 0);
|
|
7488
|
-
|
|
7548
|
+
useEffect25(() => () => clearTimeout(timer.current), []);
|
|
7489
7549
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
7490
7550
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
7491
7551
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -7919,7 +7979,7 @@ function TableCards({
|
|
|
7919
7979
|
},
|
|
7920
7980
|
children: [
|
|
7921
7981
|
selectable && checkbox(row, i),
|
|
7922
|
-
title && /* @__PURE__ */ jsx44(View38, { style: { flex: 1, minWidth: 0 }, children: cell(title, row, i, "title") })
|
|
7982
|
+
!!title && /* @__PURE__ */ jsx44(View38, { style: { flex: 1, minWidth: 0 }, children: cell(title, row, i, "title") })
|
|
7923
7983
|
]
|
|
7924
7984
|
}
|
|
7925
7985
|
),
|
|
@@ -7940,7 +8000,7 @@ function TableCards({
|
|
|
7940
8000
|
marginTop: index ? tokens44.dimension.value12 : 0
|
|
7941
8001
|
},
|
|
7942
8002
|
children: [
|
|
7943
|
-
section.label && /* @__PURE__ */ jsx44(
|
|
8003
|
+
!!section.label && /* @__PURE__ */ jsx44(
|
|
7944
8004
|
KText,
|
|
7945
8005
|
{
|
|
7946
8006
|
style: {
|
|
@@ -8005,7 +8065,7 @@ function TableCards({
|
|
|
8005
8065
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
8006
8066
|
}
|
|
8007
8067
|
),
|
|
8008
|
-
actions && !actions.inlineInCard && /* @__PURE__ */ jsx44(
|
|
8068
|
+
!!actions && !actions.inlineInCard && /* @__PURE__ */ jsx44(
|
|
8009
8069
|
View38,
|
|
8010
8070
|
{
|
|
8011
8071
|
style: {
|
|
@@ -8297,7 +8357,7 @@ function KjunKpiHero(props) {
|
|
|
8297
8357
|
children: loading ? /* @__PURE__ */ jsx47(KjunSkeleton, { type: "block", height: typeStyle("numberMd").lineHeight, width: geometry2.deltaSkeletonWidth }) : /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
8298
8358
|
deltaAbsolute !== null && delta(deltaAbsolute, "absolute", { ...numeric, color: direction(deltaAbsolute), ...typeStyle("numberMd") }),
|
|
8299
8359
|
deltaPercent !== null && delta(deltaPercent, "percent", { ...numeric, color: direction(deltaPercent), ...typeStyle("numberMd"), opacity: 0.9 }),
|
|
8300
|
-
deltaDescription && /* @__PURE__ */ jsx47(
|
|
8360
|
+
!!deltaDescription && /* @__PURE__ */ jsx47(
|
|
8301
8361
|
KText,
|
|
8302
8362
|
{
|
|
8303
8363
|
style: {
|
|
@@ -8311,7 +8371,7 @@ function KjunKpiHero(props) {
|
|
|
8311
8371
|
}
|
|
8312
8372
|
)
|
|
8313
8373
|
] }),
|
|
8314
|
-
aside && !mobile && /* @__PURE__ */ jsx47(View41, { children: aside })
|
|
8374
|
+
hasContent(aside) && !mobile && /* @__PURE__ */ jsx47(View41, { children: content(aside) })
|
|
8315
8375
|
]
|
|
8316
8376
|
}
|
|
8317
8377
|
),
|
|
@@ -8373,7 +8433,7 @@ function KjunKpiHero(props) {
|
|
|
8373
8433
|
children: kpiFormat(item)
|
|
8374
8434
|
}
|
|
8375
8435
|
),
|
|
8376
|
-
item.desc && (loading ? /* @__PURE__ */ jsx47(
|
|
8436
|
+
!!item.desc && (loading ? /* @__PURE__ */ jsx47(
|
|
8377
8437
|
KjunSkeleton,
|
|
8378
8438
|
{
|
|
8379
8439
|
type: "block",
|
|
@@ -8584,7 +8644,7 @@ function KjunKpiRow({
|
|
|
8584
8644
|
{
|
|
8585
8645
|
style: [valueStyle, { flexShrink: 1, minWidth: 0 }],
|
|
8586
8646
|
children: [
|
|
8587
|
-
item.prefix && /* @__PURE__ */ jsx48(
|
|
8647
|
+
!!item.prefix && /* @__PURE__ */ jsx48(
|
|
8588
8648
|
Text6,
|
|
8589
8649
|
{
|
|
8590
8650
|
style: {
|
|
@@ -8602,7 +8662,7 @@ function KjunKpiRow({
|
|
|
8602
8662
|
style: [valueStyle, { flexShrink: 1, minWidth: 0 }]
|
|
8603
8663
|
}
|
|
8604
8664
|
) : kpiFormat(item),
|
|
8605
|
-
item.suffix && /* @__PURE__ */ jsx48(
|
|
8665
|
+
!!item.suffix && /* @__PURE__ */ jsx48(
|
|
8606
8666
|
Text6,
|
|
8607
8667
|
{
|
|
8608
8668
|
style: {
|
|
@@ -8618,7 +8678,7 @@ function KjunKpiRow({
|
|
|
8618
8678
|
]
|
|
8619
8679
|
}
|
|
8620
8680
|
),
|
|
8621
|
-
item.desc && (busy ? /* @__PURE__ */ jsx48(KjunSkeleton, { type: "block", height: typeStyle("caption").lineHeight, width: geometry2.descriptionSkeletonWidth }) : /* @__PURE__ */ jsx48(
|
|
8681
|
+
!!item.desc && (busy ? /* @__PURE__ */ jsx48(KjunSkeleton, { type: "block", height: typeStyle("caption").lineHeight, width: geometry2.descriptionSkeletonWidth }) : /* @__PURE__ */ jsx48(
|
|
8622
8682
|
KText,
|
|
8623
8683
|
{
|
|
8624
8684
|
style: {
|
|
@@ -8643,7 +8703,7 @@ import { tokens as tokens49 } from "@kjun-ui/tokens";
|
|
|
8643
8703
|
import { ScrollView as ScrollView10, View as View44 } from "react-native";
|
|
8644
8704
|
|
|
8645
8705
|
// shared/package-runtime/market-cards.ts
|
|
8646
|
-
import { useEffect as
|
|
8706
|
+
import { useEffect as useEffect26, useRef as useRef34, useState as useState39 } from "react";
|
|
8647
8707
|
function useMarketCardsModel(props, persistence) {
|
|
8648
8708
|
const {
|
|
8649
8709
|
columns,
|
|
@@ -8668,7 +8728,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
8668
8728
|
} catch (e) {
|
|
8669
8729
|
}
|
|
8670
8730
|
};
|
|
8671
|
-
|
|
8731
|
+
useEffect26(() => {
|
|
8672
8732
|
var _a, _b;
|
|
8673
8733
|
if (mounted.current === restoreSignature) return;
|
|
8674
8734
|
mounted.current = restoreSignature;
|
|
@@ -9464,26 +9524,26 @@ var LastListRow = createContext20(false);
|
|
|
9464
9524
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
9465
9525
|
const { colors } = useKjunStyles(), last = useContext17(LastListRow);
|
|
9466
9526
|
const parts = /* @__PURE__ */ jsxs42(Fragment19, { children: [
|
|
9467
|
-
leading && /* @__PURE__ */ jsx54(View48, { children: content(leading) }),
|
|
9527
|
+
hasContent(leading) && /* @__PURE__ */ jsx54(View48, { children: content(leading) }),
|
|
9468
9528
|
/* @__PURE__ */ jsxs42(View48, { style: { flex: 1, minWidth: 0 }, children: [
|
|
9469
9529
|
/* @__PURE__ */ jsx54(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
9470
|
-
description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens53.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9530
|
+
!!description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens53.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9471
9531
|
] }),
|
|
9472
|
-
trailing && /* @__PURE__ */ jsx54(View48, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9532
|
+
hasContent(trailing) && /* @__PURE__ */ jsx54(View48, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9473
9533
|
] });
|
|
9474
9534
|
const style = { flex: 1, minWidth: 0, minHeight: tokens53.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: tokens53.extensions.list.gap, padding: tokens53.extensions.list.padding };
|
|
9475
9535
|
return /* @__PURE__ */ jsxs42(View48, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: tokens53.extensions.list.gap, borderBottomWidth: last ? 0 : tokens53.border.defaultWidth, borderBottomColor: colors.divider }, children: [
|
|
9476
9536
|
onPress || href ? /* @__PURE__ */ jsx54(AccessiblePressable, { ...Platform25.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? tokens53.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx54(View48, { style, children: parts }),
|
|
9477
|
-
actions && /* @__PURE__ */ jsx54(View48, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform25.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens53.extensions.list.actionsGap, paddingRight: tokens53.extensions.list.actionsPadding, opacity: disabled ? tokens53.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9537
|
+
hasContent(actions) && /* @__PURE__ */ jsx54(View48, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform25.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens53.extensions.list.actionsGap, paddingRight: tokens53.extensions.list.actionsPadding, opacity: disabled ? tokens53.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9478
9538
|
] });
|
|
9479
9539
|
}
|
|
9480
9540
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
9481
9541
|
const { colors } = useKjunStyles();
|
|
9482
9542
|
return /* @__PURE__ */ jsxs42(View48, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
9483
|
-
(title || description || actions) && /* @__PURE__ */ jsxs42(View48, { style: { flexDirection: "row", alignItems: "center", gap: tokens53.extensions.list.gap, padding: tokens53.extensions.list.padding }, children: [
|
|
9543
|
+
!!(title || description || actions) && /* @__PURE__ */ jsxs42(View48, { style: { flexDirection: "row", alignItems: "center", gap: tokens53.extensions.list.gap, padding: tokens53.extensions.list.padding }, children: [
|
|
9484
9544
|
/* @__PURE__ */ jsxs42(View48, { style: { flex: 1 }, children: [
|
|
9485
|
-
title && /* @__PURE__ */ jsx54(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9486
|
-
description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens53.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9545
|
+
!!title && /* @__PURE__ */ jsx54(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9546
|
+
!!description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens53.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9487
9547
|
] }),
|
|
9488
9548
|
content(actions)
|
|
9489
9549
|
] }),
|
|
@@ -9511,12 +9571,12 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
9511
9571
|
const flatten = (node) => Children5.toArray(node).flatMap((child) => isValidElement7(child) && child.type === Fragment20 ? flatten(child.props.children) : [child]);
|
|
9512
9572
|
const actionList = flatten(actions);
|
|
9513
9573
|
return /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: geometry2, children: /* @__PURE__ */ jsx55(View49, { style: { flexShrink: 0, paddingTop: Math.max(0, safeAreaTop), backgroundColor: colors.surface }, children: /* @__PURE__ */ jsxs43(View49, { style: { minHeight: geometry2.minimumHeight, flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", gap: geometry2.gap, paddingVertical: geometry2.paddingY, paddingHorizontal: geometry2.paddingX }, children: [
|
|
9514
|
-
leading && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "leading" }, children: /* @__PURE__ */ jsx55(View49, { onLayout: square("leading"), style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "40%", flexShrink: 1, justifyContent: "center", marginLeft: iconEdges.leading ? -edgeInset : 0 }, children: content(leading) }) }),
|
|
9574
|
+
hasContent(leading) && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "leading" }, children: /* @__PURE__ */ jsx55(View49, { onLayout: square("leading"), style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "40%", flexShrink: 1, justifyContent: "center", marginLeft: iconEdges.leading ? -edgeInset : 0 }, children: content(leading) }) }),
|
|
9515
9575
|
/* @__PURE__ */ jsxs43(View49, { style: { flexGrow: 1, flexShrink: 1, flexBasis: geometry2.titleMinimumWidth, minWidth: 0, paddingVertical: titleInset }, children: [
|
|
9516
9576
|
/* @__PURE__ */ jsx55(KText, { accessibilityRole: "header", style: { ...wrapping, ...typeStyle("sectionTitle"), fontWeight: typeStyle("control").fontWeight }, children: title }),
|
|
9517
|
-
description && /* @__PURE__ */ jsx55(KText, { style: { ...wrapping, marginTop: geometry2.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9577
|
+
!!description && /* @__PURE__ */ jsx55(KText, { style: { ...wrapping, marginTop: geometry2.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9518
9578
|
] }),
|
|
9519
|
-
actions && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "actions" }, children: /* @__PURE__ */ jsx55(View49, { style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "100%", marginLeft: "auto", flexShrink: 1, flexDirection: "row", flexWrap: "wrap", alignItems: "center", justifyContent: "flex-end", gap: geometry2.actionsGap }, children: actionList.map((action, index) => index < actionList.length - 1 ? content(action) : /* @__PURE__ */ jsx55(View49, { onLayout: square("trailing"), style: { flexShrink: 1, minWidth: 0, maxWidth: "100%", marginRight: iconEdges.trailing ? -edgeInset : 0 }, children: content(action) }, "trailing")) }) })
|
|
9579
|
+
hasContent(actions) && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "actions" }, children: /* @__PURE__ */ jsx55(View49, { style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "100%", marginLeft: "auto", flexShrink: 1, flexDirection: "row", flexWrap: "wrap", alignItems: "center", justifyContent: "flex-end", gap: geometry2.actionsGap }, children: actionList.map((action, index) => index < actionList.length - 1 ? content(action) : /* @__PURE__ */ jsx55(View49, { onLayout: square("trailing"), style: { flexShrink: 1, minWidth: 0, maxWidth: "100%", marginRight: iconEdges.trailing ? -edgeInset : 0 }, children: content(action) }, "trailing")) }) })
|
|
9520
9580
|
] }) }) });
|
|
9521
9581
|
}
|
|
9522
9582
|
function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\uC0C9", safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
@@ -9566,7 +9626,7 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
9566
9626
|
},
|
|
9567
9627
|
children: [
|
|
9568
9628
|
hasIcons && /* @__PURE__ */ jsxs43(View49, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
9569
|
-
item.icon && /* @__PURE__ */ jsx55(KjunIcon, { name: item.icon, size: geometry2.iconSize, color: ink }),
|
|
9629
|
+
!!item.icon && /* @__PURE__ */ jsx55(KjunIcon, { name: item.icon, size: geometry2.iconSize, color: ink }),
|
|
9570
9630
|
badge
|
|
9571
9631
|
] }),
|
|
9572
9632
|
/* @__PURE__ */ jsxs43(View49, { style: { maxWidth: "100%" }, children: [
|
|
@@ -9598,7 +9658,7 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
9598
9658
|
flexDirection: wide ? "row" : "column",
|
|
9599
9659
|
alignItems: wide ? "center" : "stretch"
|
|
9600
9660
|
}, children: [
|
|
9601
|
-
description && /* @__PURE__ */ jsx55(KText, { style: { ...typeStyle("body"), ...wrapping, color: colors.textSecondary, flex: wide ? 1 : void 0, minWidth: 0 }, children: description }),
|
|
9661
|
+
!!description && /* @__PURE__ */ jsx55(KText, { style: { ...typeStyle("body"), ...wrapping, color: colors.textSecondary, flex: wide ? 1 : void 0, minWidth: 0 }, children: description }),
|
|
9602
9662
|
/* @__PURE__ */ jsx55(View49, { style: { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", alignItems: "center", gap: geometry2.actionsGap, minWidth: 0, maxWidth: "100%", flexShrink: 1 }, children: content(children) })
|
|
9603
9663
|
] }) });
|
|
9604
9664
|
}
|
|
@@ -9636,14 +9696,14 @@ import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
|
9636
9696
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
9637
9697
|
const { colors } = useKjunStyles();
|
|
9638
9698
|
return /* @__PURE__ */ jsxs44(View51, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: tokens56.extensions.chip.gap, minHeight: removable ? tokens56.extensions.chip.nativeRemoveSize : tokens56.extensions.chip[size], paddingVertical: removable ? 0 : tokens56.extensions.chip.paddingY, paddingLeft: tokens56.extensions.chip.paddingX, paddingRight: removable ? 0 : tokens56.extensions.chip.paddingX, borderRadius: tokens56.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? tokens56.states.opacity.disabled : 1 }, children: [
|
|
9639
|
-
icon && /* @__PURE__ */ jsx57(KjunIcon, { name: icon, size: tokens56.extensions.chip.iconSizes[size] }),
|
|
9699
|
+
!!icon && /* @__PURE__ */ jsx57(KjunIcon, { name: icon, size: tokens56.extensions.chip.iconSizes[size] }),
|
|
9640
9700
|
/* @__PURE__ */ jsx57(KText, { style: { ...typeStyle(tokens56.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
9641
9701
|
removable && /* @__PURE__ */ jsx57(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || label + " \uC0AD\uC81C", disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: tokens56.extensions.chip.nativeRemoveSize, height: tokens56.extensions.chip.nativeRemoveSize, borderRadius: tokens56.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx57(KjunIcon, { name: "x", size: tokens56.extensions.chip.removeIconSizes[size] }) })
|
|
9642
9702
|
] });
|
|
9643
9703
|
}
|
|
9644
9704
|
|
|
9645
9705
|
// packages/native/src/range-input.tsx
|
|
9646
|
-
import { useEffect as
|
|
9706
|
+
import { useEffect as useEffect27, useMemo as useMemo2, useRef as useRef36, useState as useState43 } from "react";
|
|
9647
9707
|
import { PanResponder, Platform as Platform27, Pressable as Pressable3, View as View52 } from "react-native";
|
|
9648
9708
|
import { tokens as tokens57, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
9649
9709
|
import { jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -9675,10 +9735,10 @@ function RangeInput({
|
|
|
9675
9735
|
latest.current = values;
|
|
9676
9736
|
const callbacks = useRef36({ onValueChange, onChangeCommit });
|
|
9677
9737
|
callbacks.current = { onValueChange, onChangeCommit };
|
|
9678
|
-
|
|
9738
|
+
useEffect27(() => {
|
|
9679
9739
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
9680
9740
|
}, [valid]);
|
|
9681
|
-
|
|
9741
|
+
useEffect27(() => {
|
|
9682
9742
|
if (blocked) {
|
|
9683
9743
|
setDragging(null);
|
|
9684
9744
|
setHovered(null);
|
|
@@ -9764,7 +9824,7 @@ function RangeInput({
|
|
|
9764
9824
|
minWidth: 0
|
|
9765
9825
|
},
|
|
9766
9826
|
children: [
|
|
9767
|
-
label && /* @__PURE__ */ jsx58(
|
|
9827
|
+
!!label && /* @__PURE__ */ jsx58(
|
|
9768
9828
|
KText,
|
|
9769
9829
|
{
|
|
9770
9830
|
style: {
|
|
@@ -9943,7 +10003,7 @@ function KjunRangeSlider(props) {
|
|
|
9943
10003
|
}
|
|
9944
10004
|
|
|
9945
10005
|
// packages/native/src/quantity-stepper.tsx
|
|
9946
|
-
import { useEffect as
|
|
10006
|
+
import { useEffect as useEffect28, useRef as useRef37, useState as useState44 } from "react";
|
|
9947
10007
|
import { Platform as Platform28, View as View53 } from "react-native";
|
|
9948
10008
|
import { createNumberDomain, quantityKeyAction, tokens as tokens58 } from "@kjun-ui/tokens";
|
|
9949
10009
|
|
|
@@ -9969,12 +10029,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
9969
10029
|
const inputRef = useRef37(null);
|
|
9970
10030
|
const composing = useRef37(false), dirty = useRef37(false), accepted = useRef37(value);
|
|
9971
10031
|
const cancelledEscape = useRef37(false);
|
|
9972
|
-
|
|
10032
|
+
useEffect28(() => {
|
|
9973
10033
|
setDraft(String(value));
|
|
9974
10034
|
accepted.current = value;
|
|
9975
10035
|
dirty.current = false;
|
|
9976
10036
|
}, [value, precision, min, max, step]);
|
|
9977
|
-
|
|
10037
|
+
useEffect28(() => {
|
|
9978
10038
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
9979
10039
|
}, [valid]);
|
|
9980
10040
|
const emit = (next) => {
|
|
@@ -10019,7 +10079,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10019
10079
|
dirty.current = true;
|
|
10020
10080
|
setDraft(text);
|
|
10021
10081
|
} };
|
|
10022
|
-
|
|
10082
|
+
useEffect28(() => {
|
|
10023
10083
|
if (Platform28.OS !== "web") return;
|
|
10024
10084
|
const input = inputRef.current;
|
|
10025
10085
|
const keydown = (event) => handlers.current.key(event);
|
|
@@ -10091,7 +10151,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10091
10151
|
}
|
|
10092
10152
|
|
|
10093
10153
|
// packages/native/src/time-picker.tsx
|
|
10094
|
-
import { Fragment as Fragment21, useEffect as
|
|
10154
|
+
import { Fragment as Fragment21, useEffect as useEffect29, useId as useId11, useMemo as useMemo3, useRef as useRef38, useState as useState45 } from "react";
|
|
10095
10155
|
import { View as View54 } from "react-native";
|
|
10096
10156
|
import { createTimeDomain, tokens as tokens59 } from "@kjun-ui/tokens";
|
|
10097
10157
|
import { jsx as jsx60, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -10103,7 +10163,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10103
10163
|
const field = useKjunField(), uid = useId11();
|
|
10104
10164
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
10105
10165
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
10106
|
-
|
|
10166
|
+
useEffect29(() => {
|
|
10107
10167
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10108
10168
|
}, [valid]);
|
|
10109
10169
|
const change = (next) => {
|
|
@@ -10125,7 +10185,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10125
10185
|
change(null);
|
|
10126
10186
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
10127
10187
|
} }) }),
|
|
10128
|
-
(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx60(View54, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens59.border.controlWidth : tokens59.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10188
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx60(View54, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens59.border.controlWidth : tokens59.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10129
10189
|
] });
|
|
10130
10190
|
}
|
|
10131
10191
|
export {
|