@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.js
CHANGED
|
@@ -826,7 +826,7 @@ function KjunButton(input) {
|
|
|
826
826
|
opacity: overlayLoading ? 0 : 1,
|
|
827
827
|
...multiline || navigation ? { flexShrink: 1, minWidth: 0, textAlign: "center" } : {}
|
|
828
828
|
}, children }),
|
|
829
|
-
suffixIcon && /* @__PURE__ */ jsx5(View2, { style: { opacity: busy && prefixIcon ? 0 : 1 }, children: /* @__PURE__ */ jsx5(
|
|
829
|
+
!!suffixIcon && /* @__PURE__ */ jsx5(View2, { style: { opacity: busy && prefixIcon ? 0 : 1 }, children: /* @__PURE__ */ jsx5(
|
|
830
830
|
KjunIcon,
|
|
831
831
|
{
|
|
832
832
|
name: busy && !prefixIcon ? "loader-2" : suffixIcon,
|
|
@@ -1106,7 +1106,7 @@ function KjunFormGroup({
|
|
|
1106
1106
|
describedBy: mergeIds(hint ? fieldId + "-hint" : void 0, error ? fieldId + "-error" : void 0)
|
|
1107
1107
|
},
|
|
1108
1108
|
children: /* @__PURE__ */ jsxs2(View4, { style: [{ minWidth: 0, marginBottom: tokens7.extensions.form.itemGap }, style], children: [
|
|
1109
|
-
label && !labelHidden && /* @__PURE__ */ jsxs2(
|
|
1109
|
+
!!label && !labelHidden && /* @__PURE__ */ jsxs2(
|
|
1110
1110
|
Text3,
|
|
1111
1111
|
{
|
|
1112
1112
|
nativeID: fieldId + "-label",
|
|
@@ -1198,6 +1198,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1198
1198
|
const invalid = !!(error || errorMessage || (field == null ? void 0 : field.error));
|
|
1199
1199
|
const canEdit = !disabled && !readOnly && editable;
|
|
1200
1200
|
const surface = useFieldSurface(size, { disabled, readOnly: !!readOnly || !editable, invalid, open: props["aria-expanded"] === true });
|
|
1201
|
+
const affixText = { ...inputTypeStyle(size), color: surface.icon };
|
|
1201
1202
|
const showClear = clearable && !!value;
|
|
1202
1203
|
const [prefixWidth, setPrefixWidth] = useState7(0);
|
|
1203
1204
|
const [affixWidth, setAffixWidth] = useState7(0);
|
|
@@ -1259,7 +1260,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1259
1260
|
]
|
|
1260
1261
|
}
|
|
1261
1262
|
),
|
|
1262
|
-
(prefix || prefixIcon) && /* @__PURE__ */ jsx8(
|
|
1263
|
+
!!(prefix || prefixIcon) && /* @__PURE__ */ jsx8(
|
|
1263
1264
|
View4,
|
|
1264
1265
|
{
|
|
1265
1266
|
onLayout: (event) => setPrefixWidth(event.nativeEvent.layout.width),
|
|
@@ -1271,7 +1272,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1271
1272
|
bottom: 0,
|
|
1272
1273
|
justifyContent: "center"
|
|
1273
1274
|
},
|
|
1274
|
-
children: prefix
|
|
1275
|
+
children: prefix ? content(prefix, affixText) : /* @__PURE__ */ jsx8(
|
|
1275
1276
|
KjunIcon,
|
|
1276
1277
|
{
|
|
1277
1278
|
name: prefixIcon,
|
|
@@ -1281,7 +1282,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1281
1282
|
)
|
|
1282
1283
|
}
|
|
1283
1284
|
),
|
|
1284
|
-
(showClear || suffix || suffixIcon) && /* @__PURE__ */ jsxs2(
|
|
1285
|
+
!!(showClear || suffix || suffixIcon) && /* @__PURE__ */ jsxs2(
|
|
1285
1286
|
View4,
|
|
1286
1287
|
{
|
|
1287
1288
|
onLayout: (event) => setAffixWidth(event.nativeEvent.layout.width),
|
|
@@ -1302,7 +1303,7 @@ var KjunInput = forwardRef2(function KjunInput2({
|
|
|
1302
1303
|
onClear == null ? void 0 : onClear();
|
|
1303
1304
|
(_a = input.current) == null ? void 0 : _a.focus();
|
|
1304
1305
|
} }),
|
|
1305
|
-
suffix
|
|
1306
|
+
suffix ? content(suffix, affixText) : !!suffixIcon && /* @__PURE__ */ jsx8(
|
|
1306
1307
|
KjunIcon,
|
|
1307
1308
|
{
|
|
1308
1309
|
name: suffixIcon,
|
|
@@ -1342,6 +1343,17 @@ function KjunFormLayout({
|
|
|
1342
1343
|
) });
|
|
1343
1344
|
}
|
|
1344
1345
|
|
|
1346
|
+
// shared/package-runtime/content-presence.ts
|
|
1347
|
+
import { Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
|
|
1348
|
+
function hasContent(node) {
|
|
1349
|
+
if (node == null || typeof node === "boolean") return false;
|
|
1350
|
+
if (typeof node === "string") return node.trim().length > 0;
|
|
1351
|
+
if (Array.isArray(node)) return node.some(hasContent);
|
|
1352
|
+
if (isValidElement2(node) && node.type === Fragment2)
|
|
1353
|
+
return hasContent(node.props.children);
|
|
1354
|
+
return true;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1345
1357
|
// packages/native/src/layer-backdrop.tsx
|
|
1346
1358
|
import { Platform as Platform7, Pressable as Pressable2, View as View5 } from "react-native";
|
|
1347
1359
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -1638,7 +1650,7 @@ function KjunModal({
|
|
|
1638
1650
|
borderBottomColor: c.border
|
|
1639
1651
|
},
|
|
1640
1652
|
children: [
|
|
1641
|
-
/* @__PURE__ */ jsx12(View7, { style: { flex: 1, paddingRight: tokens8.modal.titleActionGap }, children: header
|
|
1653
|
+
/* @__PURE__ */ jsx12(View7, { style: { flex: 1, paddingRight: tokens8.modal.titleActionGap }, children: hasContent(header) ? content(header) : /* @__PURE__ */ jsx12(
|
|
1642
1654
|
Text4,
|
|
1643
1655
|
{
|
|
1644
1656
|
accessibilityRole: "header",
|
|
@@ -1678,7 +1690,7 @@ function KjunModal({
|
|
|
1678
1690
|
children
|
|
1679
1691
|
}
|
|
1680
1692
|
),
|
|
1681
|
-
(showFooter || footer) && /* @__PURE__ */ jsx12(
|
|
1693
|
+
(showFooter || hasContent(footer)) && /* @__PURE__ */ jsx12(
|
|
1682
1694
|
View7,
|
|
1683
1695
|
{
|
|
1684
1696
|
style: {
|
|
@@ -1691,7 +1703,7 @@ function KjunModal({
|
|
|
1691
1703
|
borderTopWidth: tokens8.border.defaultWidth,
|
|
1692
1704
|
borderTopColor: c.border
|
|
1693
1705
|
},
|
|
1694
|
-
children: footer
|
|
1706
|
+
children: hasContent(footer) ? content(footer) : /* @__PURE__ */ jsx12(
|
|
1695
1707
|
KjunFormActions,
|
|
1696
1708
|
{
|
|
1697
1709
|
size: footerSize,
|
|
@@ -1727,19 +1739,6 @@ import { tokens as tokens9 } from "@kjun-ui/tokens";
|
|
|
1727
1739
|
import { useId as useId4 } from "react";
|
|
1728
1740
|
import { Platform as Platform10, View as View8 } from "react-native";
|
|
1729
1741
|
import Svg2, { Defs, LinearGradient, Rect as Rect2, Stop } from "react-native-svg";
|
|
1730
|
-
|
|
1731
|
-
// shared/package-runtime/content-presence.ts
|
|
1732
|
-
import { Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
|
|
1733
|
-
function hasContent(node) {
|
|
1734
|
-
if (node == null || typeof node === "boolean") return false;
|
|
1735
|
-
if (typeof node === "string") return node.trim().length > 0;
|
|
1736
|
-
if (Array.isArray(node)) return node.some(hasContent);
|
|
1737
|
-
if (isValidElement2(node) && node.type === Fragment2)
|
|
1738
|
-
return hasContent(node.props.children);
|
|
1739
|
-
return true;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
// packages/native/src/card.tsx
|
|
1743
1742
|
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1744
1743
|
function KjunCard({
|
|
1745
1744
|
title,
|
|
@@ -1800,8 +1799,8 @@ function KjunCard({
|
|
|
1800
1799
|
borderBottomColor: borderColor
|
|
1801
1800
|
}, children: [
|
|
1802
1801
|
hasHeading && /* @__PURE__ */ jsx13(View8, { style: { flexGrow: 1, flexShrink: 1, minWidth: 0, maxWidth: "100%" }, children: hasContent(header) ? content(header, { color: foreground }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1803
|
-
title && /* @__PURE__ */ jsx13(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle"), color: foreground }, children: title }),
|
|
1804
|
-
subtitle && /* @__PURE__ */ jsx13(KText, { style: { ...typeStyle("caption"), marginTop: tokens9.card.subtitleGap, color: colors[paint.description] }, children: subtitle })
|
|
1802
|
+
!!title && /* @__PURE__ */ jsx13(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle"), color: foreground }, children: title }),
|
|
1803
|
+
!!subtitle && /* @__PURE__ */ jsx13(KText, { style: { ...typeStyle("caption"), marginTop: tokens9.card.subtitleGap, color: colors[paint.description] }, children: subtitle })
|
|
1805
1804
|
] }) }),
|
|
1806
1805
|
hasContent(headerActions) && /* @__PURE__ */ jsx13(CardActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx13(View8, { 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 }) }) })
|
|
1807
1806
|
] }),
|
|
@@ -1919,9 +1918,9 @@ function KjunEmpty({
|
|
|
1919
1918
|
paddingVertical: stateContent === "empty" ? 0 : tokens10.dimension.value32
|
|
1920
1919
|
},
|
|
1921
1920
|
children: [
|
|
1922
|
-
icon && /* @__PURE__ */ jsx14(View9, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx14(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
1921
|
+
!!icon && /* @__PURE__ */ jsx14(View9, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx14(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
1923
1922
|
/* @__PURE__ */ jsx14(KText, { style: { ...typeStyle("cardTitle"), color: colors.text, fontSize: spec.titleSize, lineHeight: spec.titleLineHeight, textAlign: "center", maxWidth: spec.textMaxWidth }, children: text }),
|
|
1924
|
-
description && /* @__PURE__ */ jsx14(
|
|
1923
|
+
!!description && /* @__PURE__ */ jsx14(
|
|
1925
1924
|
KText,
|
|
1926
1925
|
{
|
|
1927
1926
|
style: {
|
|
@@ -1936,7 +1935,7 @@ function KjunEmpty({
|
|
|
1936
1935
|
children: description
|
|
1937
1936
|
}
|
|
1938
1937
|
),
|
|
1939
|
-
children && /* @__PURE__ */ jsx14(View9, { style: { marginTop: spec.actionGap, maxWidth: "100%" }, children: content(children) })
|
|
1938
|
+
hasContent(children) && /* @__PURE__ */ jsx14(View9, { style: { marginTop: spec.actionGap, maxWidth: "100%" }, children: content(children) })
|
|
1940
1939
|
]
|
|
1941
1940
|
}
|
|
1942
1941
|
);
|
|
@@ -2014,7 +2013,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2014
2013
|
)
|
|
2015
2014
|
}
|
|
2016
2015
|
),
|
|
2017
|
-
text && /* @__PURE__ */ jsx14(KText, { style: { marginLeft: tokens10.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2016
|
+
!!text && /* @__PURE__ */ jsx14(KText, { style: { marginLeft: tokens10.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2018
2017
|
]
|
|
2019
2018
|
}
|
|
2020
2019
|
);
|
|
@@ -2075,7 +2074,7 @@ function KjunAlert({
|
|
|
2075
2074
|
...typeStyle(small ? "caption" : "body"),
|
|
2076
2075
|
color: colors.textSecondary
|
|
2077
2076
|
}) }),
|
|
2078
|
-
hasContent(actions) && /* @__PURE__ */ jsx14(ActionSizeContext.Provider, { value: alertActionSizes[small ? "sm" : "md"], children: /* @__PURE__ */ jsx14(AlertActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx14(View9, { style: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: geometry2.actionsGap, marginTop: geometry2[small ? "sm" : "md"].actionGap }, children: actions }) }) })
|
|
2077
|
+
hasContent(actions) && /* @__PURE__ */ jsx14(ActionSizeContext.Provider, { value: alertActionSizes[small ? "sm" : "md"], children: /* @__PURE__ */ jsx14(AlertActionsContext.Provider, { value: true, children: /* @__PURE__ */ jsx14(View9, { style: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: geometry2.actionsGap, marginTop: geometry2[small ? "sm" : "md"].actionGap }, children: content(actions) }) }) })
|
|
2079
2078
|
] }),
|
|
2080
2079
|
closable && /* @__PURE__ */ jsx14(
|
|
2081
2080
|
AccessiblePressable,
|
|
@@ -2125,7 +2124,7 @@ function KjunProgress({
|
|
|
2125
2124
|
const { colors } = useKjunStyles();
|
|
2126
2125
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2127
2126
|
return /* @__PURE__ */ jsxs6(View9, { children: [
|
|
2128
|
-
(label || showLabel) && /* @__PURE__ */ jsxs6(
|
|
2127
|
+
!!(label || showLabel) && /* @__PURE__ */ jsxs6(
|
|
2129
2128
|
View9,
|
|
2130
2129
|
{
|
|
2131
2130
|
style: {
|
|
@@ -2543,7 +2542,7 @@ function ToastView({
|
|
|
2543
2542
|
children: [
|
|
2544
2543
|
/* @__PURE__ */ jsx16(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
2545
2544
|
/* @__PURE__ */ jsxs8(View11, { style: { flex: 1, minWidth: 0 }, children: [
|
|
2546
|
-
toast.title && /* @__PURE__ */ jsx16(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens13.extensions.toast.titleGap }, children: toast.title }),
|
|
2545
|
+
!!toast.title && /* @__PURE__ */ jsx16(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens13.extensions.toast.titleGap }, children: toast.title }),
|
|
2547
2546
|
/* @__PURE__ */ jsx16(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
2548
2547
|
toast.action && /* @__PURE__ */ jsx16(
|
|
2549
2548
|
AccessiblePressable,
|
|
@@ -2730,7 +2729,7 @@ function FeedbackDialog({
|
|
|
2730
2729
|
onConfirm: submit,
|
|
2731
2730
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
2732
2731
|
children: [
|
|
2733
|
-
options.message && /* @__PURE__ */ jsx18(KText, { style: { marginBottom: tokens15.dimension.value16 }, children: options.message }),
|
|
2732
|
+
!!options.message && /* @__PURE__ */ jsx18(KText, { style: { marginBottom: tokens15.dimension.value16 }, children: options.message }),
|
|
2734
2733
|
request.kind === "prompt" && /* @__PURE__ */ jsx18(
|
|
2735
2734
|
KjunInput,
|
|
2736
2735
|
{
|
|
@@ -2747,7 +2746,7 @@ function FeedbackDialog({
|
|
|
2747
2746
|
}
|
|
2748
2747
|
);
|
|
2749
2748
|
}
|
|
2750
|
-
function KjunFeedbackProvider({ children }) {
|
|
2749
|
+
function KjunFeedbackProvider({ children, style }) {
|
|
2751
2750
|
const [controller] = useState12(createFeedbackController);
|
|
2752
2751
|
const life = useRef12(0);
|
|
2753
2752
|
const snapshot = useSyncExternalStore2(
|
|
@@ -2777,7 +2776,7 @@ function KjunFeedbackProvider({ children }) {
|
|
|
2777
2776
|
{
|
|
2778
2777
|
value: { top: layers[layers.length - 1], register, render: renderToasts },
|
|
2779
2778
|
children: /* @__PURE__ */ jsxs9(KjunFeedbackContext.Provider, { value: controller.api, children: [
|
|
2780
|
-
/* @__PURE__ */ jsxs9(View13, { style: { position: "relative" }, children: [
|
|
2779
|
+
/* @__PURE__ */ jsxs9(View13, { style: [{ position: "relative", flexGrow: 1, flexShrink: 1, alignSelf: "stretch" }, style], children: [
|
|
2781
2780
|
children,
|
|
2782
2781
|
layers.length === 0 && renderToasts()
|
|
2783
2782
|
] }),
|
|
@@ -2867,7 +2866,7 @@ function KjunCheckbox({
|
|
|
2867
2866
|
)
|
|
2868
2867
|
}
|
|
2869
2868
|
),
|
|
2870
|
-
(children || label) && content(children || label, {
|
|
2869
|
+
!!(children || label) && content(children || label, {
|
|
2871
2870
|
marginLeft: tokens16.extensions.checkbox.labelGap,
|
|
2872
2871
|
...typeStyle("label")
|
|
2873
2872
|
})
|
|
@@ -2978,7 +2977,7 @@ function KjunSwitch({
|
|
|
2978
2977
|
]
|
|
2979
2978
|
}
|
|
2980
2979
|
),
|
|
2981
|
-
(children || label) && content(children || label, {
|
|
2980
|
+
!!(children || label) && content(children || label, {
|
|
2982
2981
|
marginLeft: tokens16.extensions.switch.labelGap,
|
|
2983
2982
|
...typeStyle("label")
|
|
2984
2983
|
})
|
|
@@ -3055,7 +3054,7 @@ function KjunRadio({
|
|
|
3055
3054
|
)
|
|
3056
3055
|
}
|
|
3057
3056
|
),
|
|
3058
|
-
(children || label) && content(children || label, {
|
|
3057
|
+
!!(children || label) && content(children || label, {
|
|
3059
3058
|
marginLeft: geometry2.labelGap,
|
|
3060
3059
|
...typeStyle("label")
|
|
3061
3060
|
})
|
|
@@ -3303,7 +3302,7 @@ function KjunButtonGroup({
|
|
|
3303
3302
|
opacity: blocked ? tokens18.states.opacity.disabled : 1
|
|
3304
3303
|
}),
|
|
3305
3304
|
children: [
|
|
3306
|
-
option.icon && /* @__PURE__ */ jsx21(
|
|
3305
|
+
!!option.icon && /* @__PURE__ */ jsx21(
|
|
3307
3306
|
KjunIcon,
|
|
3308
3307
|
{
|
|
3309
3308
|
name: option.icon,
|
|
@@ -3400,7 +3399,7 @@ function KjunFilterGroup({
|
|
|
3400
3399
|
}
|
|
3401
3400
|
}
|
|
3402
3401
|
),
|
|
3403
|
-
option.icon && /* @__PURE__ */ jsx21(
|
|
3402
|
+
!!option.icon && /* @__PURE__ */ jsx21(
|
|
3404
3403
|
KjunIcon,
|
|
3405
3404
|
{
|
|
3406
3405
|
name: option.icon,
|
|
@@ -3533,8 +3532,32 @@ var KjunTextarea = forwardRef3(
|
|
|
3533
3532
|
|
|
3534
3533
|
// packages/native/src/drawer.tsx
|
|
3535
3534
|
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
3536
|
-
import { useState as useState15 } from "react";
|
|
3537
|
-
import { Animated as Animated12 } from "react-native";
|
|
3535
|
+
import { useEffect as useEffect11, useState as useState15 } from "react";
|
|
3536
|
+
import { Animated as Animated12, Keyboard } from "react-native";
|
|
3537
|
+
|
|
3538
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
3539
|
+
function keyboardEvents(os) {
|
|
3540
|
+
return os === "ios" ? { show: "keyboardWillShow", hide: "keyboardWillHide" } : null;
|
|
3541
|
+
}
|
|
3542
|
+
function keyboardOverlap(windowHeight, keyboardScreenY) {
|
|
3543
|
+
return Math.max(0, windowHeight - keyboardScreenY);
|
|
3544
|
+
}
|
|
3545
|
+
function drawerFrame({ position, windowHeight, safeAreaTop, safeAreaBottom, gap, keyboard, maxHeight }) {
|
|
3546
|
+
const visible = windowHeight - keyboard;
|
|
3547
|
+
const bottomInset = keyboard > 0 ? 0 : safeAreaBottom;
|
|
3548
|
+
if (position === "left" || position === "right")
|
|
3549
|
+
return { maxHeight: visible, height: visible, paddingTop: safeAreaTop, paddingBottom: bottomInset, lift: 0 };
|
|
3550
|
+
const sheet = maxHeight != null ? maxHeight : visible - (position === "bottom" ? safeAreaTop : bottomInset) - gap;
|
|
3551
|
+
return {
|
|
3552
|
+
maxHeight: Math.max(0, Math.min(sheet, visible)),
|
|
3553
|
+
height: void 0,
|
|
3554
|
+
paddingTop: position === "top" ? safeAreaTop : 0,
|
|
3555
|
+
paddingBottom: position === "bottom" ? bottomInset : 0,
|
|
3556
|
+
lift: position === "bottom" ? keyboard : 0
|
|
3557
|
+
};
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
// packages/native/src/drawer.tsx
|
|
3538
3561
|
import {
|
|
3539
3562
|
Platform as Platform14,
|
|
3540
3563
|
ScrollView as ScrollView3,
|
|
@@ -3542,6 +3565,24 @@ import {
|
|
|
3542
3565
|
useWindowDimensions as useWindowDimensions3
|
|
3543
3566
|
} from "react-native";
|
|
3544
3567
|
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3568
|
+
function useKeyboardOverlap(enabled, windowHeight) {
|
|
3569
|
+
const [overlap, setOverlap] = useState15(0);
|
|
3570
|
+
useEffect11(() => {
|
|
3571
|
+
var _a, _b;
|
|
3572
|
+
setOverlap(0);
|
|
3573
|
+
const events = keyboardEvents(Platform14.OS);
|
|
3574
|
+
if (!enabled || !events) return;
|
|
3575
|
+
const metrics = (_b = (_a = Keyboard).metrics) == null ? void 0 : _b.call(_a);
|
|
3576
|
+
if (metrics) setOverlap(keyboardOverlap(windowHeight, metrics.screenY));
|
|
3577
|
+
const show = Keyboard.addListener(events.show, (event) => setOverlap(keyboardOverlap(windowHeight, event.endCoordinates.screenY)));
|
|
3578
|
+
const hide = Keyboard.addListener(events.hide, () => setOverlap(0));
|
|
3579
|
+
return () => {
|
|
3580
|
+
show.remove();
|
|
3581
|
+
hide.remove();
|
|
3582
|
+
};
|
|
3583
|
+
}, [enabled, windowHeight]);
|
|
3584
|
+
return overlap;
|
|
3585
|
+
}
|
|
3545
3586
|
function KjunDrawer({
|
|
3546
3587
|
open,
|
|
3547
3588
|
onOpenChange,
|
|
@@ -3556,9 +3597,24 @@ function KjunDrawer({
|
|
|
3556
3597
|
footer,
|
|
3557
3598
|
children,
|
|
3558
3599
|
onClose,
|
|
3559
|
-
ariaLabel
|
|
3600
|
+
ariaLabel,
|
|
3601
|
+
safeAreaTop = 0,
|
|
3602
|
+
safeAreaBottom = 0,
|
|
3603
|
+
maxHeight,
|
|
3604
|
+
avoidKeyboard = true
|
|
3560
3605
|
}) {
|
|
3561
3606
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions3(), vertical = position === "left" || position === "right";
|
|
3607
|
+
const [rootHeight, setRootHeight] = useState15(0);
|
|
3608
|
+
const keyboard = useKeyboardOverlap(open && avoidKeyboard, window2.height);
|
|
3609
|
+
const frame = drawerFrame({
|
|
3610
|
+
position,
|
|
3611
|
+
windowHeight: rootHeight || window2.height,
|
|
3612
|
+
safeAreaTop: Math.max(0, safeAreaTop),
|
|
3613
|
+
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
3614
|
+
gap: tokens20.extensions.drawer.sheetGap,
|
|
3615
|
+
keyboard,
|
|
3616
|
+
maxHeight
|
|
3617
|
+
});
|
|
3562
3618
|
const [panelHeight, setPanelHeight] = useState15(0);
|
|
3563
3619
|
const motion = useNativePresence(open, tokens20.motion.layerEnter, tokens20.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
3564
3620
|
const backdrop = useNativePresence(open, tokens20.motion.backdrop, tokens20.motion.backdropExit, true, 0, { fade: tokens20.motion.backdropExit });
|
|
@@ -3582,6 +3638,7 @@ function KjunDrawer({
|
|
|
3582
3638
|
children: /* @__PURE__ */ jsxs13(
|
|
3583
3639
|
View17,
|
|
3584
3640
|
{
|
|
3641
|
+
onLayout: (event) => setRootHeight(event.nativeEvent.layout.height),
|
|
3585
3642
|
style: {
|
|
3586
3643
|
flex: 1,
|
|
3587
3644
|
justifyContent: position === "bottom" ? "flex-end" : "flex-start",
|
|
@@ -3620,8 +3677,11 @@ function KjunDrawer({
|
|
|
3620
3677
|
opacity: vertical || panelHeight > 0 ? 1 : 0,
|
|
3621
3678
|
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] }) }],
|
|
3622
3679
|
width: vertical ? Math.min(width, window2.width) : window2.width,
|
|
3623
|
-
height:
|
|
3624
|
-
maxHeight:
|
|
3680
|
+
height: frame.height,
|
|
3681
|
+
maxHeight: frame.maxHeight,
|
|
3682
|
+
paddingTop: frame.paddingTop,
|
|
3683
|
+
paddingBottom: frame.paddingBottom,
|
|
3684
|
+
marginBottom: frame.lift,
|
|
3625
3685
|
borderRadius: tokens20.extensions.drawer.radius,
|
|
3626
3686
|
borderTopLeftRadius: position === "bottom" ? tokens20.extensions.drawer.bottomRadius : tokens20.extensions.drawer.radius,
|
|
3627
3687
|
borderTopRightRadius: position === "bottom" ? tokens20.extensions.drawer.bottomRadius : tokens20.extensions.drawer.radius,
|
|
@@ -3629,7 +3689,7 @@ function KjunDrawer({
|
|
|
3629
3689
|
backgroundColor: colors.surface
|
|
3630
3690
|
},
|
|
3631
3691
|
children: [
|
|
3632
|
-
(title || header || closable) && /* @__PURE__ */ jsxs13(
|
|
3692
|
+
!!(title || header || closable) && /* @__PURE__ */ jsxs13(
|
|
3633
3693
|
View17,
|
|
3634
3694
|
{
|
|
3635
3695
|
style: {
|
|
@@ -3642,7 +3702,7 @@ function KjunDrawer({
|
|
|
3642
3702
|
borderBottomColor: colors.border
|
|
3643
3703
|
},
|
|
3644
3704
|
children: [
|
|
3645
|
-
/* @__PURE__ */ jsx23(View17, { style: { flex: 1 }, children: header
|
|
3705
|
+
/* @__PURE__ */ jsx23(View17, { style: { flex: 1 }, children: hasContent(header) ? content(header) : /* @__PURE__ */ jsx23(
|
|
3646
3706
|
KText,
|
|
3647
3707
|
{
|
|
3648
3708
|
style: { ...typeStyle("sectionTitle") },
|
|
@@ -3667,12 +3727,12 @@ function KjunDrawer({
|
|
|
3667
3727
|
ScrollView3,
|
|
3668
3728
|
{
|
|
3669
3729
|
keyboardShouldPersistTaps: "handled",
|
|
3670
|
-
style: vertical ? { flex: 1 } : { flexGrow: 0 },
|
|
3730
|
+
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
3671
3731
|
contentContainerStyle: { padding: noPadding ? 0 : tokens20.extensions.drawer.bodyPadding },
|
|
3672
3732
|
children: content(children)
|
|
3673
3733
|
}
|
|
3674
3734
|
),
|
|
3675
|
-
footer && /* @__PURE__ */ jsx23(
|
|
3735
|
+
hasContent(footer) && /* @__PURE__ */ jsx23(
|
|
3676
3736
|
View17,
|
|
3677
3737
|
{
|
|
3678
3738
|
style: {
|
|
@@ -3702,7 +3762,7 @@ import {
|
|
|
3702
3762
|
createContext as createContext15,
|
|
3703
3763
|
isValidElement as isValidElement5,
|
|
3704
3764
|
useContext as useContext11,
|
|
3705
|
-
useEffect as
|
|
3765
|
+
useEffect as useEffect14,
|
|
3706
3766
|
useRef as useRef18,
|
|
3707
3767
|
useState as useState18
|
|
3708
3768
|
} from "react";
|
|
@@ -3716,7 +3776,7 @@ import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
|
3716
3776
|
import {
|
|
3717
3777
|
cloneElement as cloneElement2,
|
|
3718
3778
|
isValidElement as isValidElement3,
|
|
3719
|
-
useEffect as
|
|
3779
|
+
useEffect as useEffect12,
|
|
3720
3780
|
useLayoutEffect as useLayoutEffect8,
|
|
3721
3781
|
useRef as useRef16,
|
|
3722
3782
|
useState as useState16
|
|
@@ -3798,14 +3858,14 @@ function FloatingPanel({
|
|
|
3798
3858
|
setAnchored(false);
|
|
3799
3859
|
}
|
|
3800
3860
|
}, [motion.present]);
|
|
3801
|
-
|
|
3861
|
+
useEffect12(() => {
|
|
3802
3862
|
var _a;
|
|
3803
3863
|
const row = reveal == null ? void 0 : reveal.current;
|
|
3804
3864
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
3805
3865
|
const offset = row.y + row.height + (menu || field ? tokens21.extensions.menu.padding : 0) - viewport.current;
|
|
3806
3866
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
3807
3867
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
3808
|
-
|
|
3868
|
+
useEffect12(() => {
|
|
3809
3869
|
if (!open || !anchored || !sized || !focusOnOpen || !panelRef.current) return;
|
|
3810
3870
|
if (Platform15.OS === "web") {
|
|
3811
3871
|
const node = panelRef.current;
|
|
@@ -3956,7 +4016,7 @@ function FloatingPanel({
|
|
|
3956
4016
|
borderBottomWidth: tokens21.border.defaultWidth,
|
|
3957
4017
|
borderBottomColor: colors.divider
|
|
3958
4018
|
},
|
|
3959
|
-
children: header
|
|
4019
|
+
children: content(header, typeStyle("cardTitle"))
|
|
3960
4020
|
}
|
|
3961
4021
|
),
|
|
3962
4022
|
/* @__PURE__ */ jsx24(
|
|
@@ -3993,7 +4053,7 @@ function FloatingPanel({
|
|
|
3993
4053
|
import {
|
|
3994
4054
|
cloneElement as cloneElement3,
|
|
3995
4055
|
isValidElement as isValidElement4,
|
|
3996
|
-
useEffect as
|
|
4056
|
+
useEffect as useEffect13,
|
|
3997
4057
|
useRef as useRef17,
|
|
3998
4058
|
useState as useState17
|
|
3999
4059
|
} from "react";
|
|
@@ -4086,11 +4146,11 @@ function KjunTooltip({
|
|
|
4086
4146
|
clearTimeout(timer.current);
|
|
4087
4147
|
timer.current = setTimeout(() => setOpen(true), delay);
|
|
4088
4148
|
};
|
|
4089
|
-
|
|
4149
|
+
useEffect13(() => {
|
|
4090
4150
|
if (!scopeActive) hide();
|
|
4091
4151
|
}, [scopeActive]);
|
|
4092
|
-
|
|
4093
|
-
|
|
4152
|
+
useEffect13(() => () => clearTimeout(timer.current), []);
|
|
4153
|
+
useEffect13(() => {
|
|
4094
4154
|
if (Platform16.OS !== "web" || !open) return;
|
|
4095
4155
|
const escape = (event) => {
|
|
4096
4156
|
if (event.key === "Escape") hide();
|
|
@@ -4206,7 +4266,7 @@ function KjunDropdown({
|
|
|
4206
4266
|
if (v) onOpen == null ? void 0 : onOpen();
|
|
4207
4267
|
else onClose == null ? void 0 : onClose();
|
|
4208
4268
|
};
|
|
4209
|
-
|
|
4269
|
+
useEffect14(() => {
|
|
4210
4270
|
if (unavailable) change(false);
|
|
4211
4271
|
}, [unavailable]);
|
|
4212
4272
|
return /* @__PURE__ */ jsxs16(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -4341,7 +4401,7 @@ function KjunMenuButton({
|
|
|
4341
4401
|
}
|
|
4342
4402
|
|
|
4343
4403
|
// shared/package-runtime/combobox.ts
|
|
4344
|
-
import { useEffect as
|
|
4404
|
+
import { useEffect as useEffect15, useState as useState19 } from "react";
|
|
4345
4405
|
|
|
4346
4406
|
// shared/package-runtime/options.ts
|
|
4347
4407
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -4420,8 +4480,8 @@ function useComboboxModel({
|
|
|
4420
4480
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
4421
4481
|
const [query, setQuery] = useState19(selectedLabel);
|
|
4422
4482
|
const [open, setOpen] = useState19(false);
|
|
4423
|
-
|
|
4424
|
-
|
|
4483
|
+
useEffect15(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
4484
|
+
useEffect15(() => {
|
|
4425
4485
|
if (disabled) setOpen(false);
|
|
4426
4486
|
}, [disabled]);
|
|
4427
4487
|
const change = (next) => {
|
|
@@ -4878,7 +4938,7 @@ function KjunDatePicker({
|
|
|
4878
4938
|
import { useState as useState22 } from "react";
|
|
4879
4939
|
|
|
4880
4940
|
// shared/package-runtime/search-input.ts
|
|
4881
|
-
import { useEffect as
|
|
4941
|
+
import { useEffect as useEffect16, useLayoutEffect as useLayoutEffect9, useRef as useRef21, useState as useState21 } from "react";
|
|
4882
4942
|
function useSearchInputModel({
|
|
4883
4943
|
value,
|
|
4884
4944
|
disabled = false,
|
|
@@ -4901,7 +4961,7 @@ function useSearchInputModel({
|
|
|
4901
4961
|
clearTimeout(timer.current);
|
|
4902
4962
|
return () => clearTimeout(timer.current);
|
|
4903
4963
|
}, [disabled, debounce, !!loadOptions]);
|
|
4904
|
-
|
|
4964
|
+
useEffect16(() => {
|
|
4905
4965
|
const current = ++version.current, abort = new AbortController();
|
|
4906
4966
|
setFailed(false);
|
|
4907
4967
|
if (!loadOptions || !open || disabled || query.length < minChars) {
|
|
@@ -5050,7 +5110,7 @@ function KjunSearchInput({
|
|
|
5050
5110
|
|
|
5051
5111
|
// packages/native/src/select-control.tsx
|
|
5052
5112
|
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5053
|
-
import { useContext as useContext12, useEffect as
|
|
5113
|
+
import { useContext as useContext12, useEffect as useEffect18, useRef as useRef23 } from "react";
|
|
5054
5114
|
|
|
5055
5115
|
// packages/native/src/compound-control.tsx
|
|
5056
5116
|
import { createContext as createContext16 } from "react";
|
|
@@ -5064,7 +5124,7 @@ function CompoundTarget({ children, square = false }) {
|
|
|
5064
5124
|
}
|
|
5065
5125
|
|
|
5066
5126
|
// shared/package-runtime/select.ts
|
|
5067
|
-
import { useEffect as
|
|
5127
|
+
import { useEffect as useEffect17, useRef as useRef22, useState as useState23 } from "react";
|
|
5068
5128
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
5069
5129
|
const [internal, setInternal] = useState23(false);
|
|
5070
5130
|
const [query, setQuery] = useState23("");
|
|
@@ -5073,7 +5133,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5073
5133
|
const isControlled = typeof controlled === "boolean";
|
|
5074
5134
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
5075
5135
|
const previousOpen = useRef22(open);
|
|
5076
|
-
|
|
5136
|
+
useEffect17(() => {
|
|
5077
5137
|
if (disabled && !isControlled) setInternal(false);
|
|
5078
5138
|
if (previousOpen.current && !open) {
|
|
5079
5139
|
setQuery("");
|
|
@@ -5082,7 +5142,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5082
5142
|
}
|
|
5083
5143
|
previousOpen.current = open;
|
|
5084
5144
|
}, [open, disabled, isControlled, pageSize]);
|
|
5085
|
-
|
|
5145
|
+
useEffect17(() => {
|
|
5086
5146
|
setLimit(pageSize);
|
|
5087
5147
|
}, [pageSize]);
|
|
5088
5148
|
const changeOpen = (next) => {
|
|
@@ -5132,7 +5192,7 @@ function KjunSelect({
|
|
|
5132
5192
|
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef23(null), spec = tokens28.input[size];
|
|
5133
5193
|
const trigger = useRef23(null);
|
|
5134
5194
|
const compound = useContext12(CompoundControlContext);
|
|
5135
|
-
|
|
5195
|
+
useEffect18(() => {
|
|
5136
5196
|
if (compound == null ? void 0 : compound.focusRef) compound.focusRef.current = trigger.current;
|
|
5137
5197
|
}, [compound == null ? void 0 : compound.focusRef]);
|
|
5138
5198
|
const expanded = usePopupExpanded(open, ref);
|
|
@@ -5383,10 +5443,10 @@ function Collapse({ open, children }) {
|
|
|
5383
5443
|
}
|
|
5384
5444
|
|
|
5385
5445
|
// shared/package-runtime/navigation.ts
|
|
5386
|
-
import { useEffect as
|
|
5446
|
+
import { useEffect as useEffect19, useRef as useRef25, useState as useState25 } from "react";
|
|
5387
5447
|
function useInitialTab(value, candidate, change) {
|
|
5388
5448
|
const requested = useRef25(/* @__PURE__ */ new Set());
|
|
5389
|
-
|
|
5449
|
+
useEffect19(() => {
|
|
5390
5450
|
if (value !== "") {
|
|
5391
5451
|
requested.current.clear();
|
|
5392
5452
|
return;
|
|
@@ -5398,7 +5458,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
5398
5458
|
}
|
|
5399
5459
|
function useAccordionState(multiple) {
|
|
5400
5460
|
const [opened, setOpened] = useState25(/* @__PURE__ */ new Set());
|
|
5401
|
-
|
|
5461
|
+
useEffect19(() => {
|
|
5402
5462
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
5403
5463
|
}, [multiple]);
|
|
5404
5464
|
return {
|
|
@@ -5426,7 +5486,7 @@ import {
|
|
|
5426
5486
|
Fragment as Fragment10,
|
|
5427
5487
|
createContext as createContext18,
|
|
5428
5488
|
useContext as useContext14,
|
|
5429
|
-
useEffect as
|
|
5489
|
+
useEffect as useEffect20,
|
|
5430
5490
|
useId as useId7,
|
|
5431
5491
|
useState as useState27
|
|
5432
5492
|
} from "react";
|
|
@@ -5600,7 +5660,7 @@ function KjunTabs({
|
|
|
5600
5660
|
opacity: tab.disabled ? tokens30.states.opacity.disabled : 1
|
|
5601
5661
|
},
|
|
5602
5662
|
children: [
|
|
5603
|
-
tab.icon && /* @__PURE__ */ jsx34(
|
|
5663
|
+
!!tab.icon && /* @__PURE__ */ jsx34(
|
|
5604
5664
|
KjunIcon,
|
|
5605
5665
|
{
|
|
5606
5666
|
name: tab.icon,
|
|
@@ -5645,11 +5705,11 @@ function KjunTabs({
|
|
|
5645
5705
|
tab.name
|
|
5646
5706
|
);
|
|
5647
5707
|
}),
|
|
5648
|
-
actions
|
|
5708
|
+
content(actions)
|
|
5649
5709
|
]
|
|
5650
5710
|
}
|
|
5651
5711
|
),
|
|
5652
|
-
children && /* @__PURE__ */ jsx34(View27, { style: { marginTop: geometry2.contentGap }, children })
|
|
5712
|
+
hasContent(children) && /* @__PURE__ */ jsx34(View27, { style: { marginTop: geometry2.contentGap }, children: content(children) })
|
|
5653
5713
|
] }) });
|
|
5654
5714
|
}
|
|
5655
5715
|
function KjunTabPane({ name, children }) {
|
|
@@ -5714,7 +5774,7 @@ function KjunAccordionItem({
|
|
|
5714
5774
|
const geometry2 = tokens31.extensions.accordion;
|
|
5715
5775
|
const [hovered, setHovered] = useState27(false);
|
|
5716
5776
|
const wrapping = Platform21.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
5717
|
-
|
|
5777
|
+
useEffect20(() => {
|
|
5718
5778
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
5719
5779
|
}, []);
|
|
5720
5780
|
return /* @__PURE__ */ jsxs22(View28, { children: [
|
|
@@ -5777,7 +5837,7 @@ function KjunBreadcrumb({
|
|
|
5777
5837
|
},
|
|
5778
5838
|
children: items.map((item, i) => {
|
|
5779
5839
|
const label = /* @__PURE__ */ jsxs22(View28, { style: { flexDirection: "row", alignItems: "center", gap: tokens31.dimension.value4 }, children: [
|
|
5780
|
-
item.icon && /* @__PURE__ */ jsx35(KjunIcon, { name: item.icon, size: tokens31.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
5840
|
+
!!item.icon && /* @__PURE__ */ jsx35(KjunIcon, { name: item.icon, size: tokens31.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
5781
5841
|
/* @__PURE__ */ jsx35(
|
|
5782
5842
|
KText,
|
|
5783
5843
|
{
|
|
@@ -5950,7 +6010,7 @@ function KjunPagination({
|
|
|
5950
6010
|
|
|
5951
6011
|
// packages/native/src/actions.tsx
|
|
5952
6012
|
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5953
|
-
import { useContext as useContext15, useEffect as
|
|
6013
|
+
import { useContext as useContext15, useEffect as useEffect21, useRef as useRef27, useState as useState28 } from "react";
|
|
5954
6014
|
import { Platform as Platform22, ScrollView as ScrollView7, View as View29 } from "react-native";
|
|
5955
6015
|
import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5956
6016
|
function KjunIconToggle({
|
|
@@ -6034,7 +6094,7 @@ function KjunCopyButton({
|
|
|
6034
6094
|
onCopyError
|
|
6035
6095
|
}) {
|
|
6036
6096
|
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState28(false), [failed, setFailed] = useState28(false), busy = useRef27(false), timer = useRef27(void 0), mounted = useRef27(true);
|
|
6037
|
-
|
|
6097
|
+
useEffect21(() => {
|
|
6038
6098
|
mounted.current = true;
|
|
6039
6099
|
return () => {
|
|
6040
6100
|
mounted.current = false;
|
|
@@ -6093,7 +6153,7 @@ function KjunCopyButton({
|
|
|
6093
6153
|
color: copied ? colors.success : colors.textSecondary
|
|
6094
6154
|
}
|
|
6095
6155
|
),
|
|
6096
|
-
text && !inline && /* @__PURE__ */ jsx36(
|
|
6156
|
+
!!text && !inline && /* @__PURE__ */ jsx36(
|
|
6097
6157
|
KText,
|
|
6098
6158
|
{
|
|
6099
6159
|
style: {
|
|
@@ -6195,10 +6255,10 @@ import { Component, useState as useState30 } from "react";
|
|
|
6195
6255
|
import { Platform as Platform23, View as View30 } from "react-native";
|
|
6196
6256
|
|
|
6197
6257
|
// shared/package-runtime/use-loading-reveal.ts
|
|
6198
|
-
import { useEffect as
|
|
6258
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
6199
6259
|
function useLoadingReveal(active, delay = 0) {
|
|
6200
6260
|
const [revealed, setRevealed] = useState29(false);
|
|
6201
|
-
|
|
6261
|
+
useEffect22(() => {
|
|
6202
6262
|
setRevealed(false);
|
|
6203
6263
|
if (!active || delay <= 0) return;
|
|
6204
6264
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -6286,7 +6346,7 @@ function KjunDataState({
|
|
|
6286
6346
|
/* @__PURE__ */ jsx37(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
6287
6347
|
] }))
|
|
6288
6348
|
}
|
|
6289
|
-
) : blockingError ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx37(View30, { 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(View30, { style: { paddingVertical: padding }, children: emptyContent || /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyText, icon: emptyIcon, children: emptyActionText && /* @__PURE__ */ jsx37(KjunButton, { onPress: onEmptyAction, children: emptyActionText }) }) }) }) : null,
|
|
6349
|
+
) : blockingError ? /* @__PURE__ */ jsx37(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx37(View30, { 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(View30, { style: { paddingVertical: padding }, children: emptyContent || /* @__PURE__ */ jsx37(KjunEmpty, { text: emptyText, icon: emptyIcon, children: !!emptyActionText && /* @__PURE__ */ jsx37(KjunButton, { onPress: onEmptyAction, children: emptyActionText }) }) }) }) : null,
|
|
6290
6350
|
(!concealed || preserveContent && state.hasQueryResult) && /* @__PURE__ */ jsx37(
|
|
6291
6351
|
View30,
|
|
6292
6352
|
{
|
|
@@ -6361,7 +6421,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
6361
6421
|
|
|
6362
6422
|
// packages/native/src/skeletons.tsx
|
|
6363
6423
|
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
6364
|
-
import { useEffect as
|
|
6424
|
+
import { useEffect as useEffect23, useRef as useRef28, useState as useState32 } from "react";
|
|
6365
6425
|
import { Animated as Animated17, Platform as Platform24, View as View32, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
6366
6426
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
6367
6427
|
|
|
@@ -6551,7 +6611,7 @@ function KjunChartSkeleton({
|
|
|
6551
6611
|
columns = 14
|
|
6552
6612
|
}) {
|
|
6553
6613
|
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef28(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState32(0), thickness = tokens37.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" };
|
|
6554
|
-
|
|
6614
|
+
useEffect23(() => {
|
|
6555
6615
|
if (reduced || !skeleton) return;
|
|
6556
6616
|
const loop = Animated17.loop(
|
|
6557
6617
|
Animated17.sequence([
|
|
@@ -6771,12 +6831,12 @@ function KjunAnimatedNumber({
|
|
|
6771
6831
|
style
|
|
6772
6832
|
],
|
|
6773
6833
|
children: [
|
|
6774
|
-
prefix && /* @__PURE__ */ jsxs27(Text5, { style: typeStyle("caption"), children: [
|
|
6834
|
+
!!prefix && /* @__PURE__ */ jsxs27(Text5, { style: typeStyle("caption"), children: [
|
|
6775
6835
|
prefix,
|
|
6776
6836
|
" "
|
|
6777
6837
|
] }),
|
|
6778
6838
|
typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals),
|
|
6779
|
-
suffix && /* @__PURE__ */ jsxs27(Text5, { style: typeStyle("caption"), children: [
|
|
6839
|
+
!!suffix && /* @__PURE__ */ jsxs27(Text5, { style: typeStyle("caption"), children: [
|
|
6780
6840
|
" ",
|
|
6781
6841
|
suffix
|
|
6782
6842
|
] })
|
|
@@ -7182,7 +7242,7 @@ function KjunSparkline({
|
|
|
7182
7242
|
|
|
7183
7243
|
// shared/package-runtime/table.ts
|
|
7184
7244
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
7185
|
-
import { useEffect as
|
|
7245
|
+
import { useEffect as useEffect25, useRef as useRef31, useState as useState35 } from "react";
|
|
7186
7246
|
|
|
7187
7247
|
// shared/package-runtime/table-model.ts
|
|
7188
7248
|
function getValue(row, key) {
|
|
@@ -7230,7 +7290,7 @@ function useTableModel(props) {
|
|
|
7230
7290
|
key: "",
|
|
7231
7291
|
order: "asc"
|
|
7232
7292
|
}), [internalExpanded, setExpanded] = useState35([]), [search, setSearch] = useState35(""), timer = useRef31(void 0);
|
|
7233
|
-
|
|
7293
|
+
useEffect25(() => () => clearTimeout(timer.current), []);
|
|
7234
7294
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
7235
7295
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
7236
7296
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -7664,7 +7724,7 @@ function TableCards({
|
|
|
7664
7724
|
},
|
|
7665
7725
|
children: [
|
|
7666
7726
|
selectable && checkbox(row, i),
|
|
7667
|
-
title && /* @__PURE__ */ jsx44(View37, { style: { flex: 1, minWidth: 0 }, children: cell(title, row, i, "title") })
|
|
7727
|
+
!!title && /* @__PURE__ */ jsx44(View37, { style: { flex: 1, minWidth: 0 }, children: cell(title, row, i, "title") })
|
|
7668
7728
|
]
|
|
7669
7729
|
}
|
|
7670
7730
|
),
|
|
@@ -7685,7 +7745,7 @@ function TableCards({
|
|
|
7685
7745
|
marginTop: index ? tokens43.dimension.value12 : 0
|
|
7686
7746
|
},
|
|
7687
7747
|
children: [
|
|
7688
|
-
section.label && /* @__PURE__ */ jsx44(
|
|
7748
|
+
!!section.label && /* @__PURE__ */ jsx44(
|
|
7689
7749
|
KText,
|
|
7690
7750
|
{
|
|
7691
7751
|
style: {
|
|
@@ -7750,7 +7810,7 @@ function TableCards({
|
|
|
7750
7810
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
7751
7811
|
}
|
|
7752
7812
|
),
|
|
7753
|
-
actions && !actions.inlineInCard && /* @__PURE__ */ jsx44(
|
|
7813
|
+
!!actions && !actions.inlineInCard && /* @__PURE__ */ jsx44(
|
|
7754
7814
|
View37,
|
|
7755
7815
|
{
|
|
7756
7816
|
style: {
|
|
@@ -8042,7 +8102,7 @@ function KjunKpiHero(props) {
|
|
|
8042
8102
|
children: loading ? /* @__PURE__ */ jsx47(KjunSkeleton, { type: "block", height: typeStyle("numberMd").lineHeight, width: geometry2.deltaSkeletonWidth }) : /* @__PURE__ */ jsxs34(Fragment15, { children: [
|
|
8043
8103
|
deltaAbsolute !== null && delta(deltaAbsolute, "absolute", { ...numeric, color: direction(deltaAbsolute), ...typeStyle("numberMd") }),
|
|
8044
8104
|
deltaPercent !== null && delta(deltaPercent, "percent", { ...numeric, color: direction(deltaPercent), ...typeStyle("numberMd"), opacity: 0.9 }),
|
|
8045
|
-
deltaDescription && /* @__PURE__ */ jsx47(
|
|
8105
|
+
!!deltaDescription && /* @__PURE__ */ jsx47(
|
|
8046
8106
|
KText,
|
|
8047
8107
|
{
|
|
8048
8108
|
style: {
|
|
@@ -8056,7 +8116,7 @@ function KjunKpiHero(props) {
|
|
|
8056
8116
|
}
|
|
8057
8117
|
)
|
|
8058
8118
|
] }),
|
|
8059
|
-
aside && !mobile && /* @__PURE__ */ jsx47(View40, { children: aside })
|
|
8119
|
+
hasContent(aside) && !mobile && /* @__PURE__ */ jsx47(View40, { children: content(aside) })
|
|
8060
8120
|
]
|
|
8061
8121
|
}
|
|
8062
8122
|
),
|
|
@@ -8118,7 +8178,7 @@ function KjunKpiHero(props) {
|
|
|
8118
8178
|
children: kpiFormat(item)
|
|
8119
8179
|
}
|
|
8120
8180
|
),
|
|
8121
|
-
item.desc && (loading ? /* @__PURE__ */ jsx47(
|
|
8181
|
+
!!item.desc && (loading ? /* @__PURE__ */ jsx47(
|
|
8122
8182
|
KjunSkeleton,
|
|
8123
8183
|
{
|
|
8124
8184
|
type: "block",
|
|
@@ -8329,7 +8389,7 @@ function KjunKpiRow({
|
|
|
8329
8389
|
{
|
|
8330
8390
|
style: [valueStyle, { flexShrink: 1, minWidth: 0 }],
|
|
8331
8391
|
children: [
|
|
8332
|
-
item.prefix && /* @__PURE__ */ jsx48(
|
|
8392
|
+
!!item.prefix && /* @__PURE__ */ jsx48(
|
|
8333
8393
|
Text6,
|
|
8334
8394
|
{
|
|
8335
8395
|
style: {
|
|
@@ -8347,7 +8407,7 @@ function KjunKpiRow({
|
|
|
8347
8407
|
style: [valueStyle, { flexShrink: 1, minWidth: 0 }]
|
|
8348
8408
|
}
|
|
8349
8409
|
) : kpiFormat(item),
|
|
8350
|
-
item.suffix && /* @__PURE__ */ jsx48(
|
|
8410
|
+
!!item.suffix && /* @__PURE__ */ jsx48(
|
|
8351
8411
|
Text6,
|
|
8352
8412
|
{
|
|
8353
8413
|
style: {
|
|
@@ -8363,7 +8423,7 @@ function KjunKpiRow({
|
|
|
8363
8423
|
]
|
|
8364
8424
|
}
|
|
8365
8425
|
),
|
|
8366
|
-
item.desc && (busy ? /* @__PURE__ */ jsx48(KjunSkeleton, { type: "block", height: typeStyle("caption").lineHeight, width: geometry2.descriptionSkeletonWidth }) : /* @__PURE__ */ jsx48(
|
|
8426
|
+
!!item.desc && (busy ? /* @__PURE__ */ jsx48(KjunSkeleton, { type: "block", height: typeStyle("caption").lineHeight, width: geometry2.descriptionSkeletonWidth }) : /* @__PURE__ */ jsx48(
|
|
8367
8427
|
KText,
|
|
8368
8428
|
{
|
|
8369
8429
|
style: {
|
|
@@ -8388,7 +8448,7 @@ import { tokens as tokens48 } from "@kjun-ui/tokens";
|
|
|
8388
8448
|
import { ScrollView as ScrollView10, View as View43 } from "react-native";
|
|
8389
8449
|
|
|
8390
8450
|
// shared/package-runtime/market-cards.ts
|
|
8391
|
-
import { useEffect as
|
|
8451
|
+
import { useEffect as useEffect26, useRef as useRef32, useState as useState38 } from "react";
|
|
8392
8452
|
function useMarketCardsModel(props, persistence) {
|
|
8393
8453
|
const {
|
|
8394
8454
|
columns,
|
|
@@ -8413,7 +8473,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
8413
8473
|
} catch (e) {
|
|
8414
8474
|
}
|
|
8415
8475
|
};
|
|
8416
|
-
|
|
8476
|
+
useEffect26(() => {
|
|
8417
8477
|
var _a, _b;
|
|
8418
8478
|
if (mounted.current === restoreSignature) return;
|
|
8419
8479
|
mounted.current = restoreSignature;
|
|
@@ -9209,26 +9269,26 @@ var LastListRow = createContext20(false);
|
|
|
9209
9269
|
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
9210
9270
|
const { colors } = useKjunStyles(), last = useContext17(LastListRow);
|
|
9211
9271
|
const parts = /* @__PURE__ */ jsxs41(Fragment18, { children: [
|
|
9212
|
-
leading && /* @__PURE__ */ jsx54(View47, { children: content(leading) }),
|
|
9272
|
+
hasContent(leading) && /* @__PURE__ */ jsx54(View47, { children: content(leading) }),
|
|
9213
9273
|
/* @__PURE__ */ jsxs41(View47, { style: { flex: 1, minWidth: 0 }, children: [
|
|
9214
9274
|
/* @__PURE__ */ jsx54(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
9215
|
-
description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens52.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9275
|
+
!!description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens52.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9216
9276
|
] }),
|
|
9217
|
-
trailing && /* @__PURE__ */ jsx54(View47, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9277
|
+
hasContent(trailing) && /* @__PURE__ */ jsx54(View47, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9218
9278
|
] });
|
|
9219
9279
|
const style = { flex: 1, minWidth: 0, minHeight: tokens52.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: tokens52.extensions.list.gap, padding: tokens52.extensions.list.padding };
|
|
9220
9280
|
return /* @__PURE__ */ jsxs41(View47, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: tokens52.extensions.list.gap, borderBottomWidth: last ? 0 : tokens52.border.defaultWidth, borderBottomColor: colors.divider }, children: [
|
|
9221
9281
|
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 ? tokens52.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx54(View47, { style, children: parts }),
|
|
9222
|
-
actions && /* @__PURE__ */ jsx54(View47, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform25.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens52.extensions.list.actionsGap, paddingRight: tokens52.extensions.list.actionsPadding, opacity: disabled ? tokens52.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9282
|
+
hasContent(actions) && /* @__PURE__ */ jsx54(View47, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform25.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens52.extensions.list.actionsGap, paddingRight: tokens52.extensions.list.actionsPadding, opacity: disabled ? tokens52.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9223
9283
|
] });
|
|
9224
9284
|
}
|
|
9225
9285
|
function KjunListSection({ title, description, actions, children, ariaLabel }) {
|
|
9226
9286
|
const { colors } = useKjunStyles();
|
|
9227
9287
|
return /* @__PURE__ */ jsxs41(View47, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
9228
|
-
(title || description || actions) && /* @__PURE__ */ jsxs41(View47, { style: { flexDirection: "row", alignItems: "center", gap: tokens52.extensions.list.gap, padding: tokens52.extensions.list.padding }, children: [
|
|
9288
|
+
!!(title || description || actions) && /* @__PURE__ */ jsxs41(View47, { style: { flexDirection: "row", alignItems: "center", gap: tokens52.extensions.list.gap, padding: tokens52.extensions.list.padding }, children: [
|
|
9229
9289
|
/* @__PURE__ */ jsxs41(View47, { style: { flex: 1 }, children: [
|
|
9230
|
-
title && /* @__PURE__ */ jsx54(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9231
|
-
description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens52.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9290
|
+
!!title && /* @__PURE__ */ jsx54(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9291
|
+
!!description && /* @__PURE__ */ jsx54(KText, { style: { marginTop: tokens52.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9232
9292
|
] }),
|
|
9233
9293
|
content(actions)
|
|
9234
9294
|
] }),
|
|
@@ -9256,12 +9316,12 @@ function KjunTopNavigation({ title, description, leading, actions, safeAreaTop =
|
|
|
9256
9316
|
const flatten = (node) => Children5.toArray(node).flatMap((child) => isValidElement7(child) && child.type === Fragment19 ? flatten(child.props.children) : [child]);
|
|
9257
9317
|
const actionList = flatten(actions);
|
|
9258
9318
|
return /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: geometry2, children: /* @__PURE__ */ jsx55(View48, { style: { flexShrink: 0, paddingTop: Math.max(0, safeAreaTop), backgroundColor: colors.surface }, children: /* @__PURE__ */ jsxs42(View48, { style: { minHeight: geometry2.minimumHeight, flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", gap: geometry2.gap, paddingVertical: geometry2.paddingY, paddingHorizontal: geometry2.paddingX }, children: [
|
|
9259
|
-
leading && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "leading" }, children: /* @__PURE__ */ jsx55(View48, { onLayout: square("leading"), style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "40%", flexShrink: 1, justifyContent: "center", marginLeft: iconEdges.leading ? -edgeInset : 0 }, children: content(leading) }) }),
|
|
9319
|
+
hasContent(leading) && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "leading" }, children: /* @__PURE__ */ jsx55(View48, { onLayout: square("leading"), style: { minHeight: geometry2.controlSize, minWidth: 0, maxWidth: "40%", flexShrink: 1, justifyContent: "center", marginLeft: iconEdges.leading ? -edgeInset : 0 }, children: content(leading) }) }),
|
|
9260
9320
|
/* @__PURE__ */ jsxs42(View48, { style: { flexGrow: 1, flexShrink: 1, flexBasis: geometry2.titleMinimumWidth, minWidth: 0, paddingVertical: titleInset }, children: [
|
|
9261
9321
|
/* @__PURE__ */ jsx55(KText, { accessibilityRole: "header", style: { ...wrapping, ...typeStyle("sectionTitle"), fontWeight: typeStyle("control").fontWeight }, children: title }),
|
|
9262
|
-
description && /* @__PURE__ */ jsx55(KText, { style: { ...wrapping, marginTop: geometry2.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9322
|
+
!!description && /* @__PURE__ */ jsx55(KText, { style: { ...wrapping, marginTop: geometry2.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9263
9323
|
] }),
|
|
9264
|
-
actions && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "actions" }, children: /* @__PURE__ */ jsx55(View48, { 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(View48, { onLayout: square("trailing"), style: { flexShrink: 1, minWidth: 0, maxWidth: "100%", marginRight: iconEdges.trailing ? -edgeInset : 0 }, children: content(action) }, "trailing")) }) })
|
|
9324
|
+
hasContent(actions) && /* @__PURE__ */ jsx55(TopNavigationContext.Provider, { value: { ...geometry2, slot: "actions" }, children: /* @__PURE__ */ jsx55(View48, { 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(View48, { onLayout: square("trailing"), style: { flexShrink: 1, minWidth: 0, maxWidth: "100%", marginRight: iconEdges.trailing ? -edgeInset : 0 }, children: content(action) }, "trailing")) }) })
|
|
9265
9325
|
] }) }) });
|
|
9266
9326
|
}
|
|
9267
9327
|
function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\uC0C9", safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = true, onNavigate }) {
|
|
@@ -9311,7 +9371,7 @@ function KjunBottomNavigation({ items, value, ariaLabel = "\uC8FC\uC694 \uD0D0\u
|
|
|
9311
9371
|
},
|
|
9312
9372
|
children: [
|
|
9313
9373
|
hasIcons && /* @__PURE__ */ jsxs42(View48, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
9314
|
-
item.icon && /* @__PURE__ */ jsx55(KjunIcon, { name: item.icon, size: geometry2.iconSize, color: ink }),
|
|
9374
|
+
!!item.icon && /* @__PURE__ */ jsx55(KjunIcon, { name: item.icon, size: geometry2.iconSize, color: ink }),
|
|
9315
9375
|
badge
|
|
9316
9376
|
] }),
|
|
9317
9377
|
/* @__PURE__ */ jsxs42(View48, { style: { maxWidth: "100%" }, children: [
|
|
@@ -9343,7 +9403,7 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
9343
9403
|
flexDirection: wide ? "row" : "column",
|
|
9344
9404
|
alignItems: wide ? "center" : "stretch"
|
|
9345
9405
|
}, children: [
|
|
9346
|
-
description && /* @__PURE__ */ jsx55(KText, { style: { ...typeStyle("body"), ...wrapping, color: colors.textSecondary, flex: wide ? 1 : void 0, minWidth: 0 }, children: description }),
|
|
9406
|
+
!!description && /* @__PURE__ */ jsx55(KText, { style: { ...typeStyle("body"), ...wrapping, color: colors.textSecondary, flex: wide ? 1 : void 0, minWidth: 0 }, children: description }),
|
|
9347
9407
|
/* @__PURE__ */ jsx55(View48, { style: { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", alignItems: "center", gap: geometry2.actionsGap, minWidth: 0, maxWidth: "100%", flexShrink: 1 }, children: content(children) })
|
|
9348
9408
|
] }) });
|
|
9349
9409
|
}
|
|
@@ -9381,14 +9441,14 @@ import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
|
9381
9441
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
9382
9442
|
const { colors } = useKjunStyles();
|
|
9383
9443
|
return /* @__PURE__ */ jsxs43(View50, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: tokens55.extensions.chip.gap, minHeight: removable ? tokens55.extensions.chip.nativeRemoveSize : tokens55.extensions.chip[size], paddingVertical: removable ? 0 : tokens55.extensions.chip.paddingY, paddingLeft: tokens55.extensions.chip.paddingX, paddingRight: removable ? 0 : tokens55.extensions.chip.paddingX, borderRadius: tokens55.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? tokens55.states.opacity.disabled : 1 }, children: [
|
|
9384
|
-
icon && /* @__PURE__ */ jsx57(KjunIcon, { name: icon, size: tokens55.extensions.chip.iconSizes[size] }),
|
|
9444
|
+
!!icon && /* @__PURE__ */ jsx57(KjunIcon, { name: icon, size: tokens55.extensions.chip.iconSizes[size] }),
|
|
9385
9445
|
/* @__PURE__ */ jsx57(KText, { style: { ...typeStyle(tokens55.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
9386
9446
|
removable && /* @__PURE__ */ jsx57(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || label + " \uC0AD\uC81C", disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: tokens55.extensions.chip.nativeRemoveSize, height: tokens55.extensions.chip.nativeRemoveSize, borderRadius: tokens55.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx57(KjunIcon, { name: "x", size: tokens55.extensions.chip.removeIconSizes[size] }) })
|
|
9387
9447
|
] });
|
|
9388
9448
|
}
|
|
9389
9449
|
|
|
9390
9450
|
// packages/native/src/range-input.tsx
|
|
9391
|
-
import { useEffect as
|
|
9451
|
+
import { useEffect as useEffect27, useMemo as useMemo2, useRef as useRef34, useState as useState42 } from "react";
|
|
9392
9452
|
import { PanResponder, Platform as Platform27, Pressable as Pressable3, View as View51 } from "react-native";
|
|
9393
9453
|
import { tokens as tokens56, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
9394
9454
|
import { jsx as jsx58, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
@@ -9420,10 +9480,10 @@ function RangeInput({
|
|
|
9420
9480
|
latest.current = values;
|
|
9421
9481
|
const callbacks = useRef34({ onValueChange, onChangeCommit });
|
|
9422
9482
|
callbacks.current = { onValueChange, onChangeCommit };
|
|
9423
|
-
|
|
9483
|
+
useEffect27(() => {
|
|
9424
9484
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
9425
9485
|
}, [valid]);
|
|
9426
|
-
|
|
9486
|
+
useEffect27(() => {
|
|
9427
9487
|
if (blocked) {
|
|
9428
9488
|
setDragging(null);
|
|
9429
9489
|
setHovered(null);
|
|
@@ -9509,7 +9569,7 @@ function RangeInput({
|
|
|
9509
9569
|
minWidth: 0
|
|
9510
9570
|
},
|
|
9511
9571
|
children: [
|
|
9512
|
-
label && /* @__PURE__ */ jsx58(
|
|
9572
|
+
!!label && /* @__PURE__ */ jsx58(
|
|
9513
9573
|
KText,
|
|
9514
9574
|
{
|
|
9515
9575
|
style: {
|
|
@@ -9688,7 +9748,7 @@ function KjunRangeSlider(props) {
|
|
|
9688
9748
|
}
|
|
9689
9749
|
|
|
9690
9750
|
// packages/native/src/quantity-stepper.tsx
|
|
9691
|
-
import { useEffect as
|
|
9751
|
+
import { useEffect as useEffect28, useRef as useRef35, useState as useState43 } from "react";
|
|
9692
9752
|
import { Platform as Platform28, View as View52 } from "react-native";
|
|
9693
9753
|
import { createNumberDomain, quantityKeyAction, tokens as tokens57 } from "@kjun-ui/tokens";
|
|
9694
9754
|
|
|
@@ -9714,12 +9774,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
9714
9774
|
const inputRef = useRef35(null);
|
|
9715
9775
|
const composing = useRef35(false), dirty = useRef35(false), accepted = useRef35(value);
|
|
9716
9776
|
const cancelledEscape = useRef35(false);
|
|
9717
|
-
|
|
9777
|
+
useEffect28(() => {
|
|
9718
9778
|
setDraft(String(value));
|
|
9719
9779
|
accepted.current = value;
|
|
9720
9780
|
dirty.current = false;
|
|
9721
9781
|
}, [value, precision, min, max, step]);
|
|
9722
|
-
|
|
9782
|
+
useEffect28(() => {
|
|
9723
9783
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
9724
9784
|
}, [valid]);
|
|
9725
9785
|
const emit = (next) => {
|
|
@@ -9764,7 +9824,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
9764
9824
|
dirty.current = true;
|
|
9765
9825
|
setDraft(text);
|
|
9766
9826
|
} };
|
|
9767
|
-
|
|
9827
|
+
useEffect28(() => {
|
|
9768
9828
|
if (Platform28.OS !== "web") return;
|
|
9769
9829
|
const input = inputRef.current;
|
|
9770
9830
|
const keydown = (event) => handlers.current.key(event);
|
|
@@ -9836,7 +9896,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
9836
9896
|
}
|
|
9837
9897
|
|
|
9838
9898
|
// packages/native/src/time-picker.tsx
|
|
9839
|
-
import { Fragment as Fragment20, useEffect as
|
|
9899
|
+
import { Fragment as Fragment20, useEffect as useEffect29, useId as useId11, useMemo as useMemo3, useRef as useRef36, useState as useState44 } from "react";
|
|
9840
9900
|
import { View as View53 } from "react-native";
|
|
9841
9901
|
import { createTimeDomain, tokens as tokens58 } from "@kjun-ui/tokens";
|
|
9842
9902
|
import { jsx as jsx60, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
@@ -9848,7 +9908,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
9848
9908
|
const field = useKjunField(), uid = useId11();
|
|
9849
9909
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
9850
9910
|
const domain = useMemo3(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
9851
|
-
|
|
9911
|
+
useEffect29(() => {
|
|
9852
9912
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
9853
9913
|
}, [valid]);
|
|
9854
9914
|
const change = (next) => {
|
|
@@ -9870,7 +9930,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
9870
9930
|
change(null);
|
|
9871
9931
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
9872
9932
|
} }) }),
|
|
9873
|
-
(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx60(View53, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens58.border.controlWidth : tokens58.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
9933
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx60(View53, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens58.border.controlWidth : tokens58.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
9874
9934
|
] });
|
|
9875
9935
|
}
|
|
9876
9936
|
export {
|