@kjun-ui/native 0.14.0 → 0.15.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 +334 -284
- package/dist/index.js +204 -152
- package/dist/index.web.cjs +345 -295
- package/dist/index.web.js +208 -156
- package/dist/styles.css +1 -1
- package/dist/types/packages/native/src/collapse.d.cts +3 -1
- package/dist/types/packages/native/src/collapse.d.ts +3 -1
- package/dist/types/packages/native/src/drawer.d.cts +3 -1
- package/dist/types/packages/native/src/drawer.d.ts +3 -1
- package/dist/types/packages/native/src/layout-primitives.d.cts +5 -3
- package/dist/types/packages/native/src/layout-primitives.d.ts +5 -3
- package/dist/types/packages/native/src/list.d.cts +5 -1
- package/dist/types/packages/native/src/list.d.ts +5 -1
- package/dist/types/packages/native/src/modal.d.cts +3 -1
- package/dist/types/packages/native/src/modal.d.ts +3 -1
- package/dist/types/packages/native/src/navigation.d.cts +7 -1
- package/dist/types/packages/native/src/navigation.d.ts +7 -1
- package/dist/types/shared/package-runtime/use-after-close.d.cts +6 -0
- package/dist/types/shared/package-runtime/use-after-close.d.ts +6 -0
- package/package.json +3 -3
package/dist/index.web.js
CHANGED
|
@@ -1818,6 +1818,18 @@ function KjunFormLayout({
|
|
|
1818
1818
|
) });
|
|
1819
1819
|
}
|
|
1820
1820
|
|
|
1821
|
+
// shared/package-runtime/use-after-close.ts
|
|
1822
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef6 } from "react";
|
|
1823
|
+
function useAfterClose(present, onAfterClose, enabled2 = true) {
|
|
1824
|
+
const was = useRef6(present), callback = useRef6(onAfterClose);
|
|
1825
|
+
callback.current = onAfterClose;
|
|
1826
|
+
useEffect4(() => {
|
|
1827
|
+
var _a;
|
|
1828
|
+
if (was.current && !present && enabled2) (_a = callback.current) == null ? void 0 : _a.call(callback);
|
|
1829
|
+
was.current = present;
|
|
1830
|
+
}, [present, enabled2]);
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1821
1833
|
// shared/package-runtime/content-presence.ts
|
|
1822
1834
|
import { Fragment as Fragment2, isValidElement as isValidElement2 } from "react";
|
|
1823
1835
|
function hasContent(node) {
|
|
@@ -1859,8 +1871,9 @@ import {
|
|
|
1859
1871
|
import {
|
|
1860
1872
|
createContext as createContext14,
|
|
1861
1873
|
useContext as useContext9,
|
|
1862
|
-
useEffect as
|
|
1863
|
-
useId as useId3
|
|
1874
|
+
useEffect as useEffect5,
|
|
1875
|
+
useId as useId3,
|
|
1876
|
+
useRef as useRef7
|
|
1864
1877
|
} from "react";
|
|
1865
1878
|
import { Platform as Platform9, View as View7 } from "react-native";
|
|
1866
1879
|
|
|
@@ -1892,13 +1905,14 @@ var FeedbackOverlayContext = createContext14(
|
|
|
1892
1905
|
null
|
|
1893
1906
|
);
|
|
1894
1907
|
function ScopedNativeModal({ children, visible, ...props }) {
|
|
1895
|
-
var _a;
|
|
1896
1908
|
const layers = useLayerState(), scope = useContext9(LayerScope);
|
|
1897
1909
|
const entry = scope ? layers.entries.get(scope) : void 0;
|
|
1898
|
-
const
|
|
1910
|
+
const last = useRef7(0);
|
|
1911
|
+
if (entry) last.current = entry.order;
|
|
1912
|
+
const generation = last.current;
|
|
1899
1913
|
const inactive = !!scope && !layers.isActive(scope);
|
|
1900
1914
|
const host = useContext9(FeedbackOverlayContext), id = "kjun-" + useId3(), register = host == null ? void 0 : host.register;
|
|
1901
|
-
|
|
1915
|
+
useEffect5(
|
|
1902
1916
|
() => visible && register ? register(id) : void 0,
|
|
1903
1917
|
[visible, register, id, generation]
|
|
1904
1918
|
);
|
|
@@ -2023,6 +2037,7 @@ function KjunModal({
|
|
|
2023
2037
|
open,
|
|
2024
2038
|
onOpenChange,
|
|
2025
2039
|
onClose,
|
|
2040
|
+
onAfterClose,
|
|
2026
2041
|
onCancel,
|
|
2027
2042
|
onConfirm,
|
|
2028
2043
|
title = "",
|
|
@@ -2070,10 +2085,15 @@ function KjunModal({
|
|
|
2070
2085
|
const layer = useLayer(open, motion.present, "window", () => {
|
|
2071
2086
|
if (closeOnEsc) close();
|
|
2072
2087
|
});
|
|
2088
|
+
const iosDismiss = Platform10.OS === "ios";
|
|
2089
|
+
useAfterClose(motion.present, onAfterClose, !iosDismiss);
|
|
2073
2090
|
return /* @__PURE__ */ jsx13(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx13(
|
|
2074
2091
|
ScopedNativeModal,
|
|
2075
2092
|
{
|
|
2076
2093
|
visible: motion.present,
|
|
2094
|
+
onDismiss: iosDismiss ? () => {
|
|
2095
|
+
if (!open) onAfterClose == null ? void 0 : onAfterClose();
|
|
2096
|
+
} : void 0,
|
|
2077
2097
|
transparent: true,
|
|
2078
2098
|
animationType: "none",
|
|
2079
2099
|
onRequestClose: () => {
|
|
@@ -2341,7 +2361,7 @@ function alertRole(tone, live) {
|
|
|
2341
2361
|
|
|
2342
2362
|
// packages/native/src/display-primitives.tsx
|
|
2343
2363
|
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2344
|
-
import { useContext as useContext10, useEffect as
|
|
2364
|
+
import { useContext as useContext10, useEffect as useEffect6, useRef as useRef8, useState as useState10 } from "react";
|
|
2345
2365
|
import {
|
|
2346
2366
|
Animated as Animated5,
|
|
2347
2367
|
Easing as Easing3,
|
|
@@ -2505,8 +2525,8 @@ function KjunEmpty({
|
|
|
2505
2525
|
}
|
|
2506
2526
|
function KjunSpinner({ size = "md", text }) {
|
|
2507
2527
|
const m = useKjunMessages();
|
|
2508
|
-
const { colors } = useKjunStyles(), reduced = useReducedMotion(), rotation =
|
|
2509
|
-
|
|
2528
|
+
const { colors } = useKjunStyles(), reduced = useReducedMotion(), rotation = useRef8(new Animated5.Value(0)).current;
|
|
2529
|
+
useEffect6(() => {
|
|
2510
2530
|
if (reduced) return;
|
|
2511
2531
|
const loop = Animated5.loop(
|
|
2512
2532
|
Animated5.timing(rotation, {
|
|
@@ -2799,7 +2819,7 @@ function KjunProgress({
|
|
|
2799
2819
|
|
|
2800
2820
|
// packages/native/src/skeleton-base.tsx
|
|
2801
2821
|
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2802
|
-
import { useEffect as
|
|
2822
|
+
import { useEffect as useEffect7, useRef as useRef9 } from "react";
|
|
2803
2823
|
import {
|
|
2804
2824
|
Animated as Animated6,
|
|
2805
2825
|
View as View11
|
|
@@ -2814,8 +2834,8 @@ function KjunSkeleton({
|
|
|
2814
2834
|
animated = true,
|
|
2815
2835
|
rounded = true
|
|
2816
2836
|
}) {
|
|
2817
|
-
const { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity =
|
|
2818
|
-
|
|
2837
|
+
const { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef9(new Animated6.Value(1)).current;
|
|
2838
|
+
useEffect7(() => {
|
|
2819
2839
|
if (!animated || reduced) return;
|
|
2820
2840
|
const loop = Animated6.loop(
|
|
2821
2841
|
Animated6.sequence([
|
|
@@ -2993,13 +3013,15 @@ var toneRole = {
|
|
|
2993
3013
|
inverse: "onBrand"
|
|
2994
3014
|
};
|
|
2995
3015
|
var textAlign = { start: "left", center: "center", end: "right" };
|
|
2996
|
-
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children }) {
|
|
3016
|
+
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children, ...rest }) {
|
|
3017
|
+
var _a;
|
|
2997
3018
|
const { colors, fontFamily, numericFontFamily } = useKjunStyles();
|
|
2998
3019
|
const lines = maxLines && maxLines > 0 ? Math.floor(maxLines) : void 0;
|
|
2999
3020
|
return /* @__PURE__ */ jsx17(
|
|
3000
3021
|
KText,
|
|
3001
3022
|
{
|
|
3002
|
-
|
|
3023
|
+
...rest,
|
|
3024
|
+
accessibilityRole: (_a = rest.accessibilityRole) != null ? _a : titleVariants.includes(variant) ? "header" : void 0,
|
|
3003
3025
|
numberOfLines: lines,
|
|
3004
3026
|
ellipsizeMode: lines ? "tail" : void 0,
|
|
3005
3027
|
style: [
|
|
@@ -3067,13 +3089,13 @@ function KjunInline({ gap = "sm", align, justify = "start", wrap = true, style,
|
|
|
3067
3089
|
}
|
|
3068
3090
|
|
|
3069
3091
|
// shared/package-runtime/feedback-dialog.ts
|
|
3070
|
-
import { useRef as
|
|
3092
|
+
import { useRef as useRef10, useState as useState11 } from "react";
|
|
3071
3093
|
function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
3072
3094
|
const options = request.options;
|
|
3073
3095
|
const [value, setValue] = useState11(options.initialValue || "");
|
|
3074
3096
|
const [error, setError] = useState11("");
|
|
3075
3097
|
const [busy, setBusy] = useState11(false);
|
|
3076
|
-
const working =
|
|
3098
|
+
const working = useRef10(false);
|
|
3077
3099
|
const active = () => {
|
|
3078
3100
|
var _a;
|
|
3079
3101
|
return ((_a = controller.getSnapshot().current) == null ? void 0 : _a.id) === request.id;
|
|
@@ -3116,10 +3138,10 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
3116
3138
|
|
|
3117
3139
|
// shared/package-runtime/feedback-motion.ts
|
|
3118
3140
|
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
3119
|
-
import { useLayoutEffect as useLayoutEffect6, useRef as
|
|
3141
|
+
import { useLayoutEffect as useLayoutEffect6, useRef as useRef11, useState as useState12 } from "react";
|
|
3120
3142
|
function usePresentedToasts(toasts, reduced) {
|
|
3121
3143
|
const [items2, setItems] = useState12([]);
|
|
3122
|
-
const removals =
|
|
3144
|
+
const removals = useRef11(/* @__PURE__ */ new Map());
|
|
3123
3145
|
useLayoutEffect6(() => {
|
|
3124
3146
|
const ids = new Set(toasts.map((toast) => toast.id));
|
|
3125
3147
|
setItems((previous) => {
|
|
@@ -3169,7 +3191,7 @@ function useOptionalKjunFeedback() {
|
|
|
3169
3191
|
}
|
|
3170
3192
|
|
|
3171
3193
|
// packages/native/src/toast-stack.tsx
|
|
3172
|
-
import { useLayoutEffect as useLayoutEffect8, useRef as
|
|
3194
|
+
import { useLayoutEffect as useLayoutEffect8, useRef as useRef14 } from "react";
|
|
3173
3195
|
import { Animated as Animated8, Platform as Platform13, View as View14 } from "react-native";
|
|
3174
3196
|
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3175
3197
|
|
|
@@ -3187,7 +3209,7 @@ function shadowLayers(layers, colors) {
|
|
|
3187
3209
|
|
|
3188
3210
|
// packages/native/src/toast.tsx
|
|
3189
3211
|
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
3190
|
-
import { useEffect as
|
|
3212
|
+
import { useEffect as useEffect8, useRef as useRef12 } from "react";
|
|
3191
3213
|
import { Animated as Animated7, View as View13 } from "react-native";
|
|
3192
3214
|
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3193
3215
|
function ToastView({
|
|
@@ -3195,14 +3217,14 @@ function ToastView({
|
|
|
3195
3217
|
controller
|
|
3196
3218
|
}) {
|
|
3197
3219
|
const m = useKjunMessages();
|
|
3198
|
-
const { colors } = useKjunStyles(), reduced = useReducedMotion(), progress =
|
|
3199
|
-
const reasons =
|
|
3220
|
+
const { colors } = useKjunStyles(), reduced = useReducedMotion(), progress = useRef12(new Animated7.Value(1)).current;
|
|
3221
|
+
const reasons = useRef12({
|
|
3200
3222
|
hover: /* @__PURE__ */ Symbol("hover"),
|
|
3201
3223
|
actionHover: /* @__PURE__ */ Symbol("actionHover"),
|
|
3202
3224
|
closeHover: /* @__PURE__ */ Symbol("closeHover"),
|
|
3203
3225
|
focus: /* @__PURE__ */ Symbol("focus")
|
|
3204
3226
|
}).current;
|
|
3205
|
-
|
|
3227
|
+
useEffect8(() => () => {
|
|
3206
3228
|
for (const reason of Object.values(reasons)) controller.resumeToast(toast.id, reason);
|
|
3207
3229
|
}, [controller, toast.id, reasons]);
|
|
3208
3230
|
const tone = toast.type === "error" ? "danger" : toast.type || "info", icon = {
|
|
@@ -3211,7 +3233,7 @@ function ToastView({
|
|
|
3211
3233
|
warning: "alert-triangle",
|
|
3212
3234
|
info: "info-circle"
|
|
3213
3235
|
}[tone];
|
|
3214
|
-
|
|
3236
|
+
useEffect8(() => {
|
|
3215
3237
|
progress.stopAnimation();
|
|
3216
3238
|
progress.setValue(toast.duration ? toast.remaining / toast.duration : 1);
|
|
3217
3239
|
if (!toast.paused && !reduced) {
|
|
@@ -3325,7 +3347,7 @@ function ToastView({
|
|
|
3325
3347
|
}
|
|
3326
3348
|
|
|
3327
3349
|
// packages/native/src/toast-reflow.web.ts
|
|
3328
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as
|
|
3350
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef13 } from "react";
|
|
3329
3351
|
|
|
3330
3352
|
// shared/package-runtime/toast-layout.ts
|
|
3331
3353
|
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
@@ -3388,7 +3410,7 @@ function createToastLayout() {
|
|
|
3388
3410
|
|
|
3389
3411
|
// packages/native/src/toast-reflow.web.ts
|
|
3390
3412
|
function useToastReflow(root, reduced) {
|
|
3391
|
-
const layout =
|
|
3413
|
+
const layout = useRef13(createToastLayout()).current;
|
|
3392
3414
|
useLayoutEffect7(() => {
|
|
3393
3415
|
if (root.current) layout.update(root.current, reduced);
|
|
3394
3416
|
});
|
|
@@ -3398,9 +3420,9 @@ function useToastReflow(root, reduced) {
|
|
|
3398
3420
|
// packages/native/src/toast-stack.tsx
|
|
3399
3421
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3400
3422
|
function ToastSlot({ item, controller, boxes }) {
|
|
3401
|
-
const born =
|
|
3423
|
+
const born = useRef14(Math.min(tokens18.motion.toastEnter, Date.now() - item.born)).current;
|
|
3402
3424
|
const motion = useNativePresence(!item.exiting, tokens18.motion.toastEnter - born, tokens18.motion.toastExit, true, born / tokens18.motion.toastEnter);
|
|
3403
|
-
const offset =
|
|
3425
|
+
const offset = useRef14(new Animated8.Value(0)).current;
|
|
3404
3426
|
const box = boxes.get(item.toast.id);
|
|
3405
3427
|
useLayoutEffect8(() => {
|
|
3406
3428
|
if (motion.reduced) {
|
|
@@ -3447,9 +3469,9 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3447
3469
|
function ToastStack({ items: items2, controller }) {
|
|
3448
3470
|
var _a;
|
|
3449
3471
|
const layers = useLayerState();
|
|
3450
|
-
const root =
|
|
3472
|
+
const root = useRef14(null), reduced = useReducedMotion();
|
|
3451
3473
|
useToastReflow(root, reduced);
|
|
3452
|
-
const boxes =
|
|
3474
|
+
const boxes = useRef14(/* @__PURE__ */ new Map()).current;
|
|
3453
3475
|
for (const id of boxes.keys()) if (!items2.some((item) => item.toast.id === id)) boxes.delete(id);
|
|
3454
3476
|
return /* @__PURE__ */ jsx19(View14, { ref: root, pointerEvents: "box-none", style: {
|
|
3455
3477
|
position: "absolute",
|
|
@@ -3469,9 +3491,9 @@ import {
|
|
|
3469
3491
|
feedbackControllerOf
|
|
3470
3492
|
} from "@kjun-ui/tokens";
|
|
3471
3493
|
import {
|
|
3472
|
-
useCallback as
|
|
3473
|
-
useEffect as
|
|
3474
|
-
useRef as
|
|
3494
|
+
useCallback as useCallback4,
|
|
3495
|
+
useEffect as useEffect9,
|
|
3496
|
+
useRef as useRef15,
|
|
3475
3497
|
useState as useState13,
|
|
3476
3498
|
useSyncExternalStore as useSyncExternalStore2
|
|
3477
3499
|
} from "react";
|
|
@@ -3528,8 +3550,8 @@ function FeedbackDialog({
|
|
|
3528
3550
|
function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
3529
3551
|
const [owned] = useState13(() => controllerProp ? void 0 : createFeedbackController());
|
|
3530
3552
|
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
3531
|
-
|
|
3532
|
-
const life =
|
|
3553
|
+
useEffect9(() => controller.attach(), [controller]);
|
|
3554
|
+
const life = useRef15(0);
|
|
3533
3555
|
const snapshot = useSyncExternalStore2(
|
|
3534
3556
|
controller.subscribe,
|
|
3535
3557
|
controller.getSnapshot,
|
|
@@ -3538,7 +3560,7 @@ function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
|
3538
3560
|
const reduced = useReducedMotion();
|
|
3539
3561
|
const toasts = usePresentedToasts(snapshot.toasts, reduced);
|
|
3540
3562
|
const dialog = usePresentedRequest(snapshot.current, reduced);
|
|
3541
|
-
|
|
3563
|
+
useEffect9(() => {
|
|
3542
3564
|
const version = ++life.current;
|
|
3543
3565
|
return () => {
|
|
3544
3566
|
queueMicrotask(() => {
|
|
@@ -3547,7 +3569,7 @@ function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
|
3547
3569
|
};
|
|
3548
3570
|
}, [controller]);
|
|
3549
3571
|
const [layers, setLayers] = useState13([]);
|
|
3550
|
-
const register =
|
|
3572
|
+
const register = useCallback4((id) => {
|
|
3551
3573
|
setLayers((previous) => [...previous, id]);
|
|
3552
3574
|
return () => setLayers((previous) => previous.filter((item) => item !== id));
|
|
3553
3575
|
}, []);
|
|
@@ -3582,8 +3604,8 @@ import {
|
|
|
3582
3604
|
createContext as createContext16,
|
|
3583
3605
|
useContext as useContext12,
|
|
3584
3606
|
useState as useState14,
|
|
3585
|
-
useEffect as
|
|
3586
|
-
useRef as
|
|
3607
|
+
useEffect as useEffect10,
|
|
3608
|
+
useRef as useRef16
|
|
3587
3609
|
} from "react";
|
|
3588
3610
|
import {
|
|
3589
3611
|
View as View16
|
|
@@ -3785,7 +3807,7 @@ function KjunRadio({
|
|
|
3785
3807
|
const group = useContext12(RadioContext), { colors } = useKjunStyles(), selected = (group ? group.value : value) === val;
|
|
3786
3808
|
const geometry2 = tokens20.extensions.radio;
|
|
3787
3809
|
const [hovered, setHovered] = useState14(false);
|
|
3788
|
-
|
|
3810
|
+
useEffect10(() => {
|
|
3789
3811
|
if (disabled) setHovered(false);
|
|
3790
3812
|
}, [disabled]);
|
|
3791
3813
|
return /* @__PURE__ */ jsx21(
|
|
@@ -3857,7 +3879,7 @@ function KjunRadioGroup({
|
|
|
3857
3879
|
onValueChange,
|
|
3858
3880
|
onChange
|
|
3859
3881
|
}) {
|
|
3860
|
-
const root =
|
|
3882
|
+
const root = useRef16(null);
|
|
3861
3883
|
useRadioKeyboard(root);
|
|
3862
3884
|
return /* @__PURE__ */ jsx21(
|
|
3863
3885
|
RadioContext.Provider,
|
|
@@ -3897,7 +3919,7 @@ function KjunRadioGroup({
|
|
|
3897
3919
|
|
|
3898
3920
|
// packages/native/src/selection-groups.tsx
|
|
3899
3921
|
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
3900
|
-
import { useLayoutEffect as useLayoutEffect10, useRef as
|
|
3922
|
+
import { useLayoutEffect as useLayoutEffect10, useRef as useRef18 } from "react";
|
|
3901
3923
|
import {
|
|
3902
3924
|
Animated as Animated11,
|
|
3903
3925
|
ScrollView as ScrollView2,
|
|
@@ -3906,7 +3928,7 @@ import {
|
|
|
3906
3928
|
} from "react-native";
|
|
3907
3929
|
|
|
3908
3930
|
// packages/native/src/button-group-motion.tsx
|
|
3909
|
-
import { useCallback as
|
|
3931
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useLayoutEffect as useLayoutEffect9, useRef as useRef17, useState as useState15 } from "react";
|
|
3910
3932
|
import { Animated as Animated10, Easing as Easing4, StyleSheet as StyleSheet5, View as View17 } from "react-native";
|
|
3911
3933
|
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
3912
3934
|
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -3916,14 +3938,14 @@ var sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.h
|
|
|
3916
3938
|
function useButtonGroupMotion(selected) {
|
|
3917
3939
|
const reduced = useReducedMotion();
|
|
3918
3940
|
const [layouts, setLayouts] = useState15(/* @__PURE__ */ new Map());
|
|
3919
|
-
const x =
|
|
3920
|
-
const width =
|
|
3921
|
-
const previous =
|
|
3941
|
+
const x = useRef17(new Animated10.Value(0)).current;
|
|
3942
|
+
const width = useRef17(new Animated10.Value(0)).current;
|
|
3943
|
+
const previous = useRef17(null);
|
|
3922
3944
|
const layout = selected && layouts.get(selected.value);
|
|
3923
|
-
const updateLayout =
|
|
3945
|
+
const updateLayout = useCallback5((value, box) => {
|
|
3924
3946
|
setLayouts((old) => old.has(value) && sameBox(old.get(value), box) ? old : new Map(old).set(value, box));
|
|
3925
3947
|
}, []);
|
|
3926
|
-
const measure =
|
|
3948
|
+
const measure = useCallback5((value, event) => updateLayout(value, event.nativeEvent.layout), [updateLayout]);
|
|
3927
3949
|
useLayoutEffect9(() => {
|
|
3928
3950
|
const old = previous.current;
|
|
3929
3951
|
if (!selected || !layout) {
|
|
@@ -3946,7 +3968,7 @@ function useButtonGroupMotion(selected) {
|
|
|
3946
3968
|
}
|
|
3947
3969
|
previous.current = { value: selected.value, box: layout, reduced };
|
|
3948
3970
|
}, [selected == null ? void 0 : selected.value, layout, reduced, x, width]);
|
|
3949
|
-
|
|
3971
|
+
useEffect11(() => () => {
|
|
3950
3972
|
x.stopAnimation();
|
|
3951
3973
|
width.stopAnimation();
|
|
3952
3974
|
}, [x, width]);
|
|
@@ -3954,9 +3976,9 @@ function useButtonGroupMotion(selected) {
|
|
|
3954
3976
|
}
|
|
3955
3977
|
function ButtonGroupLabel({ label, active, size, reduced }) {
|
|
3956
3978
|
const { colors, fontFamily } = useKjunStyles();
|
|
3957
|
-
const progress =
|
|
3979
|
+
const progress = useRef17(new Animated10.Value(active ? 1 : 0)).current;
|
|
3958
3980
|
const interpolate = typeof colors.textSecondary === "string" && typeof colors.text === "string";
|
|
3959
|
-
|
|
3981
|
+
useEffect11(() => {
|
|
3960
3982
|
progress.stopAnimation();
|
|
3961
3983
|
if (reduced || !interpolate) progress.setValue(active ? 1 : 0);
|
|
3962
3984
|
else Animated10.timing(progress, { toValue: active ? 1 : 0, duration: tokens21.motion.indicator, easing, useNativeDriver: false }).start();
|
|
@@ -4003,7 +4025,7 @@ function KjunButtonGroup({
|
|
|
4003
4025
|
const motion = useButtonGroupMotion(selected);
|
|
4004
4026
|
const padding = tokens22.buttonGroup.padding[size];
|
|
4005
4027
|
const itemRadius = tokens22.buttonGroup.itemRadii[size];
|
|
4006
|
-
const itemRefs =
|
|
4028
|
+
const itemRefs = useRef18(/* @__PURE__ */ new Map());
|
|
4007
4029
|
const { updateLayout } = motion;
|
|
4008
4030
|
useLayoutEffect10(() => {
|
|
4009
4031
|
for (const [value2, node] of itemRefs.current) {
|
|
@@ -4321,7 +4343,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4321
4343
|
|
|
4322
4344
|
// packages/native/src/drawer.tsx
|
|
4323
4345
|
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
4324
|
-
import { useEffect as
|
|
4346
|
+
import { useEffect as useEffect12, useState as useState16 } from "react";
|
|
4325
4347
|
import { Animated as Animated12, Keyboard } from "react-native";
|
|
4326
4348
|
|
|
4327
4349
|
// shared/package-runtime/drawer-geometry.ts
|
|
@@ -4356,7 +4378,7 @@ import {
|
|
|
4356
4378
|
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4357
4379
|
function useKeyboardOverlap(enabled2, windowHeight) {
|
|
4358
4380
|
const [overlap, setOverlap] = useState16(0);
|
|
4359
|
-
|
|
4381
|
+
useEffect12(() => {
|
|
4360
4382
|
var _a, _b;
|
|
4361
4383
|
setOverlap(0);
|
|
4362
4384
|
const events = keyboardEvents(Platform15.OS);
|
|
@@ -4386,6 +4408,7 @@ function KjunDrawer({
|
|
|
4386
4408
|
footer,
|
|
4387
4409
|
children,
|
|
4388
4410
|
onClose,
|
|
4411
|
+
onAfterClose,
|
|
4389
4412
|
ariaLabel,
|
|
4390
4413
|
safeAreaTop = 0,
|
|
4391
4414
|
safeAreaBottom = 0,
|
|
@@ -4416,10 +4439,15 @@ function KjunDrawer({
|
|
|
4416
4439
|
const layer = useLayer(open, motion.present, "window", () => {
|
|
4417
4440
|
if (closeOnEsc) close();
|
|
4418
4441
|
});
|
|
4442
|
+
const iosDismiss = Platform15.OS === "ios";
|
|
4443
|
+
useAfterClose(motion.present, onAfterClose, !iosDismiss);
|
|
4419
4444
|
return /* @__PURE__ */ jsx25(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx25(
|
|
4420
4445
|
ScopedNativeModal,
|
|
4421
4446
|
{
|
|
4422
4447
|
visible: motion.present,
|
|
4448
|
+
onDismiss: iosDismiss ? () => {
|
|
4449
|
+
if (!open) onAfterClose == null ? void 0 : onAfterClose();
|
|
4450
|
+
} : void 0,
|
|
4423
4451
|
transparent: true,
|
|
4424
4452
|
onRequestClose: () => {
|
|
4425
4453
|
if (closeOnEsc) close();
|
|
@@ -4552,8 +4580,8 @@ import {
|
|
|
4552
4580
|
createContext as createContext17,
|
|
4553
4581
|
isValidElement as isValidElement6,
|
|
4554
4582
|
useContext as useContext13,
|
|
4555
|
-
useEffect as
|
|
4556
|
-
useRef as
|
|
4583
|
+
useEffect as useEffect15,
|
|
4584
|
+
useRef as useRef21,
|
|
4557
4585
|
useState as useState19
|
|
4558
4586
|
} from "react";
|
|
4559
4587
|
import {
|
|
@@ -4566,9 +4594,9 @@ import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
|
4566
4594
|
import {
|
|
4567
4595
|
cloneElement as cloneElement3,
|
|
4568
4596
|
isValidElement as isValidElement4,
|
|
4569
|
-
useEffect as
|
|
4597
|
+
useEffect as useEffect13,
|
|
4570
4598
|
useLayoutEffect as useLayoutEffect11,
|
|
4571
|
-
useRef as
|
|
4599
|
+
useRef as useRef19,
|
|
4572
4600
|
useState as useState17
|
|
4573
4601
|
} from "react";
|
|
4574
4602
|
import {
|
|
@@ -4625,10 +4653,10 @@ function FloatingPanel({
|
|
|
4625
4653
|
const m = useKjunMessages();
|
|
4626
4654
|
ariaLabel != null ? ariaLabel : ariaLabel = m.select;
|
|
4627
4655
|
const [headerHeight, setHeaderHeight] = useState17(0);
|
|
4628
|
-
const panelRef =
|
|
4629
|
-
const scroll =
|
|
4656
|
+
const panelRef = useRef19(null);
|
|
4657
|
+
const scroll = useRef19(null), viewport = useRef19(0);
|
|
4630
4658
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions4(), [anchored, setAnchored] = useState17(false), [sized, setSized] = useState17(false), [anchor, setAnchor] = useState17({ x: 0, y: 0, width: 0, height: 0 }), [panel, setPanel] = useState17({ width: 0, height: 0 });
|
|
4631
|
-
const measurement =
|
|
4659
|
+
const measurement = useRef19(0);
|
|
4632
4660
|
const motion = useNativePresence(open, tooltip ? tokens25.motion.tooltipEnter : tokens25.motion.popupEnter, tooltip ? tokens25.motion.tooltipExit : tokens25.motion.popupExit, anchored && sized);
|
|
4633
4661
|
const layer = useLayer(open, motion.present, tooltip ? "tooltip" : "popup", () => onOpenChange(false), triggerRef);
|
|
4634
4662
|
useLayoutEffect11(() => {
|
|
@@ -4650,14 +4678,14 @@ function FloatingPanel({
|
|
|
4650
4678
|
setAnchored(false);
|
|
4651
4679
|
}
|
|
4652
4680
|
}, [motion.present]);
|
|
4653
|
-
|
|
4681
|
+
useEffect13(() => {
|
|
4654
4682
|
var _a;
|
|
4655
4683
|
const row = reveal == null ? void 0 : reveal.current;
|
|
4656
4684
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
4657
4685
|
const offset = row.y + row.height + (menu || field ? tokens25.extensions.menu.padding : 0) - viewport.current;
|
|
4658
4686
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
4659
4687
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
4660
|
-
|
|
4688
|
+
useEffect13(() => {
|
|
4661
4689
|
if (!open || !anchored || !sized || !focusOnOpen || !panelRef.current) return;
|
|
4662
4690
|
if (Platform16.OS === "web") {
|
|
4663
4691
|
const node = panelRef.current;
|
|
@@ -4845,8 +4873,8 @@ function FloatingPanel({
|
|
|
4845
4873
|
import {
|
|
4846
4874
|
cloneElement as cloneElement4,
|
|
4847
4875
|
isValidElement as isValidElement5,
|
|
4848
|
-
useEffect as
|
|
4849
|
-
useRef as
|
|
4876
|
+
useEffect as useEffect14,
|
|
4877
|
+
useRef as useRef20,
|
|
4850
4878
|
useState as useState18
|
|
4851
4879
|
} from "react";
|
|
4852
4880
|
import {
|
|
@@ -4872,7 +4900,7 @@ function KjunPopover({
|
|
|
4872
4900
|
children
|
|
4873
4901
|
}) {
|
|
4874
4902
|
const { colors } = useKjunStyles();
|
|
4875
|
-
const [internal, setInternal] = useState18(false), open = controlled != null ? controlled : internal, ref =
|
|
4903
|
+
const [internal, setInternal] = useState18(false), open = controlled != null ? controlled : internal, ref = useRef20(null);
|
|
4876
4904
|
const change = (v) => {
|
|
4877
4905
|
setInternal(v);
|
|
4878
4906
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
@@ -4920,13 +4948,13 @@ function KjunTooltip({
|
|
|
4920
4948
|
open: controlled,
|
|
4921
4949
|
onOpenChange
|
|
4922
4950
|
}) {
|
|
4923
|
-
const { colors } = useKjunStyles(), [internal, setInternal] = useState18(false), open = controlled != null ? controlled : internal, latest =
|
|
4951
|
+
const { colors } = useKjunStyles(), [internal, setInternal] = useState18(false), open = controlled != null ? controlled : internal, latest = useRef20({ open, onOpenChange }), setOpen = (value) => {
|
|
4924
4952
|
var _a, _b;
|
|
4925
4953
|
if (latest.current.open === value) return;
|
|
4926
4954
|
latest.current.open = value;
|
|
4927
4955
|
setInternal(value);
|
|
4928
4956
|
(_b = (_a = latest.current).onOpenChange) == null ? void 0 : _b.call(_a, value);
|
|
4929
|
-
}, ref =
|
|
4957
|
+
}, ref = useRef20(null), timer = useRef20(void 0);
|
|
4930
4958
|
latest.current = { open, onOpenChange };
|
|
4931
4959
|
const scopeActive = useActiveLayerScope();
|
|
4932
4960
|
const hide = () => {
|
|
@@ -4938,11 +4966,11 @@ function KjunTooltip({
|
|
|
4938
4966
|
clearTimeout(timer.current);
|
|
4939
4967
|
timer.current = setTimeout(() => setOpen(true), delay);
|
|
4940
4968
|
};
|
|
4941
|
-
|
|
4969
|
+
useEffect14(() => {
|
|
4942
4970
|
if (!scopeActive) hide();
|
|
4943
4971
|
}, [scopeActive]);
|
|
4944
|
-
|
|
4945
|
-
|
|
4972
|
+
useEffect14(() => () => clearTimeout(timer.current), []);
|
|
4973
|
+
useEffect14(() => {
|
|
4946
4974
|
if (Platform17.OS !== "web" || !open) return;
|
|
4947
4975
|
const escape = (event) => {
|
|
4948
4976
|
if (event.key === "Escape") hide();
|
|
@@ -5047,7 +5075,7 @@ function KjunDropdown({
|
|
|
5047
5075
|
onClose
|
|
5048
5076
|
}) {
|
|
5049
5077
|
const m = useKjunMessages();
|
|
5050
|
-
const [open, setOpen] = useState19(false), currentOpen =
|
|
5078
|
+
const [open, setOpen] = useState19(false), currentOpen = useRef21(false), ref = useRef21(null);
|
|
5051
5079
|
let control = trigger;
|
|
5052
5080
|
while (isValidElement6(control) && control.type === KjunTooltip)
|
|
5053
5081
|
control = control.props.children;
|
|
@@ -5059,7 +5087,7 @@ function KjunDropdown({
|
|
|
5059
5087
|
if (v) onOpen == null ? void 0 : onOpen();
|
|
5060
5088
|
else onClose == null ? void 0 : onClose();
|
|
5061
5089
|
};
|
|
5062
|
-
|
|
5090
|
+
useEffect15(() => {
|
|
5063
5091
|
if (unavailable) change(false);
|
|
5064
5092
|
}, [unavailable]);
|
|
5065
5093
|
return /* @__PURE__ */ jsxs17(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -5195,7 +5223,7 @@ function KjunMenuButton({
|
|
|
5195
5223
|
}
|
|
5196
5224
|
|
|
5197
5225
|
// shared/package-runtime/combobox.ts
|
|
5198
|
-
import { useEffect as
|
|
5226
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
5199
5227
|
|
|
5200
5228
|
// shared/package-runtime/options.ts
|
|
5201
5229
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -5275,8 +5303,8 @@ function useComboboxModel({
|
|
|
5275
5303
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
5276
5304
|
const [query, setQuery] = useState20(selectedLabel);
|
|
5277
5305
|
const [open, setOpen] = useState20(false);
|
|
5278
|
-
|
|
5279
|
-
|
|
5306
|
+
useEffect16(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
5307
|
+
useEffect16(() => {
|
|
5280
5308
|
if (disabled) setOpen(false);
|
|
5281
5309
|
}, [disabled]);
|
|
5282
5310
|
const change = (next) => {
|
|
@@ -5310,7 +5338,7 @@ function useComboboxModel({
|
|
|
5310
5338
|
|
|
5311
5339
|
// packages/native/src/combobox.tsx
|
|
5312
5340
|
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5313
|
-
import { useId as useId5, useRef as
|
|
5341
|
+
import { useId as useId5, useRef as useRef22 } from "react";
|
|
5314
5342
|
import { Platform as Platform18, View as View24 } from "react-native";
|
|
5315
5343
|
|
|
5316
5344
|
// packages/native/src/select-options.tsx
|
|
@@ -5440,8 +5468,8 @@ function SearchField({
|
|
|
5440
5468
|
}) {
|
|
5441
5469
|
const m = useKjunMessages();
|
|
5442
5470
|
const searchId = "kjun-popup-search-" + useId5().replace(/:/g, "");
|
|
5443
|
-
const clearing =
|
|
5444
|
-
const ref =
|
|
5471
|
+
const clearing = useRef22(false);
|
|
5472
|
+
const ref = useRef22(null), { colors } = useKjunStyles();
|
|
5445
5473
|
const focusGuard = usePopupFocusGuard(ref);
|
|
5446
5474
|
const openFromPress = () => {
|
|
5447
5475
|
if (!disabled) {
|
|
@@ -5541,7 +5569,7 @@ function SearchField({
|
|
|
5541
5569
|
|
|
5542
5570
|
// packages/native/src/date-picker.tsx
|
|
5543
5571
|
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5544
|
-
import { useRef as
|
|
5572
|
+
import { useRef as useRef23, useState as useState21 } from "react";
|
|
5545
5573
|
import { Platform as Platform19, View as View25 } from "react-native";
|
|
5546
5574
|
import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5547
5575
|
function displayMonth(value) {
|
|
@@ -5564,7 +5592,7 @@ function KjunDatePicker({
|
|
|
5564
5592
|
const scope = useKjunMessageScope();
|
|
5565
5593
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5566
5594
|
const clear = clearable && !!value && !disabled;
|
|
5567
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref =
|
|
5595
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref = useRef23(null), spec = tokens30.input[size];
|
|
5568
5596
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5569
5597
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5570
5598
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5742,7 +5770,7 @@ function KjunDatePicker({
|
|
|
5742
5770
|
import { useState as useState23 } from "react";
|
|
5743
5771
|
|
|
5744
5772
|
// shared/package-runtime/search-input.ts
|
|
5745
|
-
import { useEffect as
|
|
5773
|
+
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect12, useRef as useRef24, useState as useState22 } from "react";
|
|
5746
5774
|
function useSearchInputModel({
|
|
5747
5775
|
value,
|
|
5748
5776
|
disabled = false,
|
|
@@ -5752,10 +5780,10 @@ function useSearchInputModel({
|
|
|
5752
5780
|
onValueChange,
|
|
5753
5781
|
onSearchError
|
|
5754
5782
|
}, open) {
|
|
5755
|
-
const [query, setQuery] = useState22(value), [options, setOptions] = useState22([]), [loading, setLoading] = useState22(false), [failed, setFailed] = useState22(false), version =
|
|
5783
|
+
const [query, setQuery] = useState22(value), [options, setOptions] = useState22([]), [loading, setLoading] = useState22(false), [failed, setFailed] = useState22(false), version = useRef24(0), notify = useRef24(onSearchError);
|
|
5756
5784
|
notify.current = onSearchError;
|
|
5757
|
-
const timer =
|
|
5758
|
-
const notifyValue =
|
|
5785
|
+
const timer = useRef24(void 0);
|
|
5786
|
+
const notifyValue = useRef24(onValueChange);
|
|
5759
5787
|
notifyValue.current = onValueChange;
|
|
5760
5788
|
useLayoutEffect12(() => {
|
|
5761
5789
|
clearTimeout(timer.current);
|
|
@@ -5765,7 +5793,7 @@ function useSearchInputModel({
|
|
|
5765
5793
|
clearTimeout(timer.current);
|
|
5766
5794
|
return () => clearTimeout(timer.current);
|
|
5767
5795
|
}, [disabled, debounce, !!loadOptions]);
|
|
5768
|
-
|
|
5796
|
+
useEffect17(() => {
|
|
5769
5797
|
const current = ++version.current, abort = new AbortController();
|
|
5770
5798
|
setFailed(false);
|
|
5771
5799
|
if (!loadOptions || !open || disabled || query.length < minChars) {
|
|
@@ -5918,7 +5946,7 @@ function KjunSearchInput({
|
|
|
5918
5946
|
|
|
5919
5947
|
// packages/native/src/select-control.tsx
|
|
5920
5948
|
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5921
|
-
import { useContext as useContext14, useEffect as
|
|
5949
|
+
import { useContext as useContext14, useEffect as useEffect19, useRef as useRef26 } from "react";
|
|
5922
5950
|
|
|
5923
5951
|
// packages/native/src/compound-control.tsx
|
|
5924
5952
|
import { createContext as createContext18 } from "react";
|
|
@@ -5932,7 +5960,7 @@ function CompoundTarget({ children, square = false }) {
|
|
|
5932
5960
|
}
|
|
5933
5961
|
|
|
5934
5962
|
// shared/package-runtime/select.ts
|
|
5935
|
-
import { useEffect as
|
|
5963
|
+
import { useEffect as useEffect18, useRef as useRef25, useState as useState24 } from "react";
|
|
5936
5964
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
5937
5965
|
const [internal, setInternal] = useState24(false);
|
|
5938
5966
|
const [query, setQuery] = useState24("");
|
|
@@ -5940,8 +5968,8 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5940
5968
|
const [session, setSession] = useState24(0);
|
|
5941
5969
|
const isControlled = typeof controlled === "boolean";
|
|
5942
5970
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
5943
|
-
const previousOpen =
|
|
5944
|
-
|
|
5971
|
+
const previousOpen = useRef25(open);
|
|
5972
|
+
useEffect18(() => {
|
|
5945
5973
|
if (disabled && !isControlled) setInternal(false);
|
|
5946
5974
|
if (previousOpen.current && !open) {
|
|
5947
5975
|
setQuery("");
|
|
@@ -5950,7 +5978,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
5950
5978
|
}
|
|
5951
5979
|
previousOpen.current = open;
|
|
5952
5980
|
}, [open, disabled, isControlled, pageSize]);
|
|
5953
|
-
|
|
5981
|
+
useEffect18(() => {
|
|
5954
5982
|
setLimit(pageSize);
|
|
5955
5983
|
}, [pageSize]);
|
|
5956
5984
|
const changeOpen = (next) => {
|
|
@@ -6000,14 +6028,14 @@ function KjunSelect({
|
|
|
6000
6028
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
6001
6029
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
6002
6030
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
6003
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref =
|
|
6004
|
-
const trigger =
|
|
6031
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef26(null), spec = tokens32.input[size];
|
|
6032
|
+
const trigger = useRef26(null);
|
|
6005
6033
|
const compound = useContext14(CompoundControlContext);
|
|
6006
|
-
|
|
6034
|
+
useEffect19(() => {
|
|
6007
6035
|
if (compound == null ? void 0 : compound.focusRef) compound.focusRef.current = trigger.current;
|
|
6008
6036
|
}, [compound == null ? void 0 : compound.focusRef]);
|
|
6009
6037
|
const expanded = usePopupExpanded(open, ref);
|
|
6010
|
-
const selectedRow =
|
|
6038
|
+
const selectedRow = useRef26(null);
|
|
6011
6039
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open: expanded });
|
|
6012
6040
|
const change = (v) => {
|
|
6013
6041
|
onValueChange == null ? void 0 : onValueChange(v);
|
|
@@ -6205,15 +6233,16 @@ import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
|
6205
6233
|
|
|
6206
6234
|
// packages/native/src/collapse.tsx
|
|
6207
6235
|
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6208
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
6236
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef27, useState as useState25 } from "react";
|
|
6209
6237
|
import { Animated as Animated14, View as View28 } from "react-native";
|
|
6210
6238
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
6211
|
-
function Collapse({ open, children }) {
|
|
6239
|
+
function Collapse({ open, keepMounted = false, children }) {
|
|
6212
6240
|
const reduced = useReducedMotion();
|
|
6213
6241
|
const [retained, setRetained] = useState25(open), [height, setHeight] = useState25(null);
|
|
6214
|
-
const value =
|
|
6242
|
+
const value = useRef27(new Animated14.Value(0)).current;
|
|
6215
6243
|
const [settled, setSettled] = useState25(open);
|
|
6216
|
-
const version =
|
|
6244
|
+
const version = useRef27(0), first = useRef27(open), opened = useRef27(open);
|
|
6245
|
+
if (open) opened.current = true;
|
|
6217
6246
|
useLayoutEffect13(() => {
|
|
6218
6247
|
const revision = ++version.current;
|
|
6219
6248
|
if (open) setRetained(true);
|
|
@@ -6241,13 +6270,13 @@ function Collapse({ open, children }) {
|
|
|
6241
6270
|
value.stopAnimation();
|
|
6242
6271
|
};
|
|
6243
6272
|
}, [open, height, reduced, value]);
|
|
6244
|
-
return open || retained ? /* @__PURE__ */ jsx35(
|
|
6273
|
+
return open || retained || keepMounted && opened.current ? /* @__PURE__ */ jsx35(
|
|
6245
6274
|
Animated14.View,
|
|
6246
6275
|
{
|
|
6247
6276
|
pointerEvents: open ? "auto" : "none",
|
|
6248
6277
|
accessibilityElementsHidden: !open,
|
|
6249
6278
|
importantForAccessibility: open ? "auto" : "no-hide-descendants",
|
|
6250
|
-
...!open ? { inert: true } : {},
|
|
6279
|
+
...!open ? { inert: true, "aria-hidden": true } : {},
|
|
6251
6280
|
style: { height: settled && open ? void 0 : value, overflow: "hidden" },
|
|
6252
6281
|
children: /* @__PURE__ */ jsx35(View28, { onLayout: (event) => setHeight(event.nativeEvent.layout.height), children })
|
|
6253
6282
|
}
|
|
@@ -6255,10 +6284,10 @@ function Collapse({ open, children }) {
|
|
|
6255
6284
|
}
|
|
6256
6285
|
|
|
6257
6286
|
// shared/package-runtime/navigation.ts
|
|
6258
|
-
import { useEffect as
|
|
6287
|
+
import { useEffect as useEffect20, useRef as useRef28, useState as useState26 } from "react";
|
|
6259
6288
|
function useInitialTab(value, candidate, change) {
|
|
6260
|
-
const requested =
|
|
6261
|
-
|
|
6289
|
+
const requested = useRef28(/* @__PURE__ */ new Set());
|
|
6290
|
+
useEffect20(() => {
|
|
6262
6291
|
if (value !== "") {
|
|
6263
6292
|
requested.current.clear();
|
|
6264
6293
|
return;
|
|
@@ -6270,7 +6299,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
6270
6299
|
}
|
|
6271
6300
|
function useAccordionState(multiple) {
|
|
6272
6301
|
const [opened, setOpened] = useState26(/* @__PURE__ */ new Set());
|
|
6273
|
-
|
|
6302
|
+
useEffect20(() => {
|
|
6274
6303
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
6275
6304
|
}, [multiple]);
|
|
6276
6305
|
return {
|
|
@@ -6298,19 +6327,20 @@ import {
|
|
|
6298
6327
|
Fragment as Fragment12,
|
|
6299
6328
|
createContext as createContext20,
|
|
6300
6329
|
useContext as useContext16,
|
|
6301
|
-
useEffect as
|
|
6330
|
+
useEffect as useEffect21,
|
|
6302
6331
|
useId as useId7,
|
|
6332
|
+
useRef as useRef31,
|
|
6303
6333
|
useState as useState28
|
|
6304
6334
|
} from "react";
|
|
6305
6335
|
import { Animated as Animated16, View as View30, useWindowDimensions as useWindowDimensions5, Platform as Platform22 } from "react-native";
|
|
6306
6336
|
|
|
6307
6337
|
// packages/native/src/tabs.tsx
|
|
6308
6338
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6309
|
-
import { Children as Children4, createContext as createContext19, isValidElement as isValidElement7, useContext as useContext15, useCallback as
|
|
6339
|
+
import { Children as Children4, createContext as createContext19, isValidElement as isValidElement7, useContext as useContext15, useCallback as useCallback6, useLayoutEffect as useLayoutEffect15, useRef as useRef30, useId as useId6, useState as useState27 } from "react";
|
|
6310
6340
|
import { Animated as Animated15, Platform as Platform21, ScrollView as ScrollView5, View as View29 } from "react-native";
|
|
6311
6341
|
|
|
6312
6342
|
// packages/native/src/tabs-accessibility.web.ts
|
|
6313
|
-
import { useLayoutEffect as useLayoutEffect14, useRef as
|
|
6343
|
+
import { useLayoutEffect as useLayoutEffect14, useRef as useRef29 } from "react";
|
|
6314
6344
|
|
|
6315
6345
|
// shared/package-runtime/tab-keyboard.ts
|
|
6316
6346
|
function manageTabList(list, select, keyboard = true) {
|
|
@@ -6393,7 +6423,7 @@ function panelNeedsFocus(panel) {
|
|
|
6393
6423
|
|
|
6394
6424
|
// packages/native/src/tabs-accessibility.web.ts
|
|
6395
6425
|
function useTabKeyboard(root, select) {
|
|
6396
|
-
const callback =
|
|
6426
|
+
const callback = useRef29(select);
|
|
6397
6427
|
callback.current = select;
|
|
6398
6428
|
useLayoutEffect14(() => {
|
|
6399
6429
|
var _a;
|
|
@@ -6430,10 +6460,10 @@ function KjunTabs({
|
|
|
6430
6460
|
isValidElement7
|
|
6431
6461
|
);
|
|
6432
6462
|
const tabs = items2.length ? items2 : panes.filter((child) => child.type === KjunTabPane).map((child) => child.props);
|
|
6433
|
-
const id = "kjun-" + useId6(), root =
|
|
6434
|
-
const menuState =
|
|
6463
|
+
const id = "kjun-" + useId6(), root = useRef30(null);
|
|
6464
|
+
const menuState = useRef30({ tabs, onTabMenu });
|
|
6435
6465
|
menuState.current = { tabs, onTabMenu };
|
|
6436
|
-
const pressedMenu =
|
|
6466
|
+
const pressedMenu = useRef30(null);
|
|
6437
6467
|
useLayoutEffect15(() => {
|
|
6438
6468
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6439
6469
|
}, [tabs, onTabMenu]);
|
|
@@ -6449,10 +6479,10 @@ function KjunTabs({
|
|
|
6449
6479
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6450
6480
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6451
6481
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
6452
|
-
const tabRefs =
|
|
6482
|
+
const tabRefs = useRef30(/* @__PURE__ */ new Map());
|
|
6453
6483
|
const { updateLayout } = selection;
|
|
6454
6484
|
const firstName = (_a = tabs[0]) == null ? void 0 : _a.name;
|
|
6455
|
-
const measureIndicator =
|
|
6485
|
+
const measureIndicator = useCallback6((name, box) => {
|
|
6456
6486
|
const left = underline && name === firstName ? 0 : paddingX;
|
|
6457
6487
|
updateLayout(name, underline ? {
|
|
6458
6488
|
x: box.x + left,
|
|
@@ -6621,7 +6651,7 @@ function KjunTabs({
|
|
|
6621
6651
|
}
|
|
6622
6652
|
function KjunTabPane({ name, children }) {
|
|
6623
6653
|
const { value, id, names } = useContext15(TabContext);
|
|
6624
|
-
const root =
|
|
6654
|
+
const root = useRef30(null);
|
|
6625
6655
|
usePanelFocus(root);
|
|
6626
6656
|
const hidden = value !== name;
|
|
6627
6657
|
return /* @__PURE__ */ jsx36(
|
|
@@ -6674,14 +6704,32 @@ function KjunAccordionItem({
|
|
|
6674
6704
|
defaultOpen = false,
|
|
6675
6705
|
disabled = false,
|
|
6676
6706
|
header,
|
|
6707
|
+
open: openProp,
|
|
6708
|
+
onOpenChange,
|
|
6709
|
+
keepMounted = false,
|
|
6677
6710
|
children
|
|
6678
6711
|
}) {
|
|
6679
|
-
const { colors } = useKjunStyles(), group =
|
|
6712
|
+
const controlled = openProp !== void 0, context = useContext16(AccordionContext), { colors } = useKjunStyles(), group = controlled ? null : context, id = "kjun-" + useId7(), [own, setOwn] = useState28(defaultOpen), open = controlled ? openProp : group ? group.opened.has(id) : own;
|
|
6713
|
+
const reported = useRef31(open), notify = useRef31(onOpenChange), registering = useRef31(!!group && defaultOpen);
|
|
6714
|
+
notify.current = onOpenChange;
|
|
6715
|
+
useEffect21(() => {
|
|
6716
|
+
var _a;
|
|
6717
|
+
if (registering.current) {
|
|
6718
|
+
if (open) {
|
|
6719
|
+
registering.current = false;
|
|
6720
|
+
reported.current = open;
|
|
6721
|
+
}
|
|
6722
|
+
return;
|
|
6723
|
+
}
|
|
6724
|
+
if (controlled || reported.current === open) return;
|
|
6725
|
+
reported.current = open;
|
|
6726
|
+
(_a = notify.current) == null ? void 0 : _a.call(notify, open);
|
|
6727
|
+
}, [open, controlled]);
|
|
6680
6728
|
const rotation = useMotionValue(open ? 1 : 0, tokens35.motion.collapse, void 0, void 0, true);
|
|
6681
6729
|
const geometry2 = tokens35.extensions.accordion;
|
|
6682
6730
|
const [hovered, setHovered] = useState28(false);
|
|
6683
6731
|
const wrapping = Platform22.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6684
|
-
|
|
6732
|
+
useEffect21(() => {
|
|
6685
6733
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
6686
6734
|
}, []);
|
|
6687
6735
|
return /* @__PURE__ */ jsxs23(View30, { children: [
|
|
@@ -6695,7 +6743,10 @@ function KjunAccordionItem({
|
|
|
6695
6743
|
accessibilityLabel: title,
|
|
6696
6744
|
accessibilityState: { expanded: open, disabled },
|
|
6697
6745
|
disabled,
|
|
6698
|
-
onPress: () =>
|
|
6746
|
+
onPress: () => {
|
|
6747
|
+
registering.current = false;
|
|
6748
|
+
controlled ? onOpenChange == null ? void 0 : onOpenChange(!open) : group ? group.toggle(id) : setOwn(!own);
|
|
6749
|
+
},
|
|
6699
6750
|
onHoverIn: () => setHovered(true),
|
|
6700
6751
|
onHoverOut: () => setHovered(false),
|
|
6701
6752
|
style: ({ pressed }) => ({
|
|
@@ -6715,7 +6766,7 @@ function KjunAccordionItem({
|
|
|
6715
6766
|
]
|
|
6716
6767
|
}
|
|
6717
6768
|
),
|
|
6718
|
-
/* @__PURE__ */ jsx37(Collapse, { open, children: /* @__PURE__ */ jsx37(
|
|
6769
|
+
/* @__PURE__ */ jsx37(Collapse, { open, keepMounted, children: /* @__PURE__ */ jsx37(
|
|
6719
6770
|
View30,
|
|
6720
6771
|
{
|
|
6721
6772
|
nativeID: id + "-panel",
|
|
@@ -6912,7 +6963,7 @@ function KjunPagination({
|
|
|
6912
6963
|
|
|
6913
6964
|
// packages/native/src/actions.tsx
|
|
6914
6965
|
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6915
|
-
import { useContext as useContext17, useEffect as
|
|
6966
|
+
import { useContext as useContext17, useEffect as useEffect22, useRef as useRef32, useState as useState29 } from "react";
|
|
6916
6967
|
import { Platform as Platform23, ScrollView as ScrollView7, View as View31 } from "react-native";
|
|
6917
6968
|
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6918
6969
|
function KjunIconToggle({
|
|
@@ -6997,8 +7048,8 @@ function KjunCopyButton({
|
|
|
6997
7048
|
}) {
|
|
6998
7049
|
const m = useKjunMessages();
|
|
6999
7050
|
successText != null ? successText : successText = m.copied;
|
|
7000
|
-
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy =
|
|
7001
|
-
|
|
7051
|
+
const feedback = useOptionalKjunFeedback(), { colors } = useKjunStyles(), [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy = useRef32(false), timer = useRef32(void 0), mounted = useRef32(true);
|
|
7052
|
+
useEffect22(() => {
|
|
7002
7053
|
mounted.current = true;
|
|
7003
7054
|
return () => {
|
|
7004
7055
|
mounted.current = false;
|
|
@@ -7162,10 +7213,10 @@ import { Component, useState as useState31 } from "react";
|
|
|
7162
7213
|
import { Platform as Platform24, View as View32 } from "react-native";
|
|
7163
7214
|
|
|
7164
7215
|
// shared/package-runtime/use-loading-reveal.ts
|
|
7165
|
-
import { useEffect as
|
|
7216
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
7166
7217
|
function useLoadingReveal(active, delay = 0) {
|
|
7167
7218
|
const [revealed, setRevealed] = useState30(false);
|
|
7168
|
-
|
|
7219
|
+
useEffect23(() => {
|
|
7169
7220
|
setRevealed(false);
|
|
7170
7221
|
if (!active || delay <= 0) return;
|
|
7171
7222
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -7335,7 +7386,7 @@ KjunErrorBoundary.contextType = KjunMessageContext;
|
|
|
7335
7386
|
|
|
7336
7387
|
// packages/native/src/skeletons.tsx
|
|
7337
7388
|
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7338
|
-
import { useEffect as
|
|
7389
|
+
import { useEffect as useEffect24, useRef as useRef33, useState as useState33 } from "react";
|
|
7339
7390
|
import { Animated as Animated17, Platform as Platform25, View as View34, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
7340
7391
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
7341
7392
|
|
|
@@ -7526,8 +7577,8 @@ function KjunChartSkeleton({
|
|
|
7526
7577
|
}) {
|
|
7527
7578
|
const m = useKjunMessages();
|
|
7528
7579
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7529
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity =
|
|
7530
|
-
|
|
7580
|
+
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef33(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState33(0), thickness = tokens41.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" };
|
|
7581
|
+
useEffect24(() => {
|
|
7531
7582
|
if (reduced || !skeleton) return;
|
|
7532
7583
|
const loop = Animated17.loop(
|
|
7533
7584
|
Animated17.sequence([
|
|
@@ -7625,7 +7676,7 @@ import Svg6, {
|
|
|
7625
7676
|
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7626
7677
|
|
|
7627
7678
|
// shared/package-runtime/use-number-motion.ts
|
|
7628
|
-
import { useLayoutEffect as useLayoutEffect16, useRef as
|
|
7679
|
+
import { useLayoutEffect as useLayoutEffect16, useRef as useRef34, useState as useState34 } from "react";
|
|
7629
7680
|
|
|
7630
7681
|
// shared/package-runtime/number-motion.ts
|
|
7631
7682
|
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
@@ -7672,7 +7723,7 @@ function createNumberMotion(apply) {
|
|
|
7672
7723
|
// shared/package-runtime/use-number-motion.ts
|
|
7673
7724
|
function useNumberMotion(value, animated, fromPrevious, reduced) {
|
|
7674
7725
|
const [display, setDisplay] = useState34(typeof value === "string" || fromPrevious || !animated || reduced ? value : 0);
|
|
7675
|
-
const motion =
|
|
7726
|
+
const motion = useRef34(null);
|
|
7676
7727
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
7677
7728
|
useLayoutEffect16(() => {
|
|
7678
7729
|
if (!motion.current) motion.current = createNumberMotion(setDisplay);
|
|
@@ -8137,7 +8188,7 @@ function KjunSparkline({
|
|
|
8137
8188
|
|
|
8138
8189
|
// shared/package-runtime/table.ts
|
|
8139
8190
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
8140
|
-
import { useEffect as
|
|
8191
|
+
import { useEffect as useEffect26, useRef as useRef36, useState as useState36 } from "react";
|
|
8141
8192
|
|
|
8142
8193
|
// shared/package-runtime/table-model.ts
|
|
8143
8194
|
function getValue(row, key) {
|
|
@@ -8184,8 +8235,8 @@ function useTableModel(props) {
|
|
|
8184
8235
|
const [internalSort, setSort] = useState36({
|
|
8185
8236
|
key: "",
|
|
8186
8237
|
order: "asc"
|
|
8187
|
-
}), [internalExpanded, setExpanded] = useState36([]), [search, setSearch] = useState36(""), timer =
|
|
8188
|
-
|
|
8238
|
+
}), [internalExpanded, setExpanded] = useState36([]), [search, setSearch] = useState36(""), timer = useRef36(void 0);
|
|
8239
|
+
useEffect26(() => () => clearTimeout(timer.current), []);
|
|
8189
8240
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
8190
8241
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
8191
8242
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -9342,7 +9393,7 @@ import { tokens as tokens52 } from "@kjun-ui/tokens";
|
|
|
9342
9393
|
import { ScrollView as ScrollView10, View as View45 } from "react-native";
|
|
9343
9394
|
|
|
9344
9395
|
// shared/package-runtime/market-cards.ts
|
|
9345
|
-
import { useEffect as
|
|
9396
|
+
import { useEffect as useEffect27, useRef as useRef37, useState as useState39 } from "react";
|
|
9346
9397
|
function useMarketCardsModel(props, persistence) {
|
|
9347
9398
|
const {
|
|
9348
9399
|
columns,
|
|
@@ -9359,7 +9410,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
9359
9410
|
isDefaultSort: c.defaultSort
|
|
9360
9411
|
}));
|
|
9361
9412
|
const [key, setKey] = useState39(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
|
|
9362
|
-
const mounted =
|
|
9413
|
+
const mounted = useRef37("");
|
|
9363
9414
|
const save = (key2) => {
|
|
9364
9415
|
var _a;
|
|
9365
9416
|
try {
|
|
@@ -9367,7 +9418,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
9367
9418
|
} catch (e) {
|
|
9368
9419
|
}
|
|
9369
9420
|
};
|
|
9370
|
-
|
|
9421
|
+
useEffect27(() => {
|
|
9371
9422
|
var _a, _b;
|
|
9372
9423
|
if (mounted.current === restoreSignature) return;
|
|
9373
9424
|
mounted.current = restoreSignature;
|
|
@@ -10152,20 +10203,21 @@ import { Children as Children5, createContext as createContext22, useContext as
|
|
|
10152
10203
|
import { View as View49, Platform as Platform26 } from "react-native";
|
|
10153
10204
|
import { Fragment as Fragment20, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10154
10205
|
var ListRowContext = createContext22({ divider: true, compact: false });
|
|
10155
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
10206
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress, ariaLabel, children }) {
|
|
10156
10207
|
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
10157
10208
|
const parts = /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
10158
10209
|
hasContent(leading) && /* @__PURE__ */ jsx56(View49, { children: content(leading) }),
|
|
10159
10210
|
/* @__PURE__ */ jsxs42(View49, { style: { flex: 1, minWidth: 0 }, children: [
|
|
10160
10211
|
/* @__PURE__ */ jsx56(KText, { style: { ...typeStyle("label"), ...destructive ? { color: colors.danger } : {} }, children: title }),
|
|
10161
|
-
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens56.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
10212
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens56.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description }),
|
|
10213
|
+
hasContent(children) && /* @__PURE__ */ jsx56(View49, { style: { marginTop: tokens56.extensions.list.descriptionGap }, children: content(children) })
|
|
10162
10214
|
] }),
|
|
10163
10215
|
hasContent(trailing) && /* @__PURE__ */ jsx56(View49, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
10164
10216
|
chevron && /* @__PURE__ */ jsx56(View49, { accessible: false, importantForAccessibility: "no-hide-descendants", accessibilityElementsHidden: true, children: /* @__PURE__ */ jsx56(KjunIcon, { name: "chevron-right", size: tokens56.iconSizes.default, color: colors.textTertiary }) })
|
|
10165
10217
|
] });
|
|
10166
10218
|
const style = { flex: 1, minWidth: 0, minHeight: compact ? tokens56.extensions.list.compactMinimumHeight : tokens56.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, padding: tokens56.extensions.list.padding, ...compact ? { paddingVertical: tokens56.extensions.list.compactPaddingY } : {} };
|
|
10167
10219
|
return /* @__PURE__ */ jsxs42(View49, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, borderBottomWidth: divider ? tokens56.border.defaultWidth : 0, borderBottomColor: colors.divider }, children: [
|
|
10168
|
-
onPress || href ? /* @__PURE__ */ jsx56(AccessiblePressable, { ...Platform26.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? tokens56.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx56(View49, { style, children: parts }),
|
|
10220
|
+
onPress || href ? /* @__PURE__ */ jsx56(AccessiblePressable, { ...Platform26.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: ariaLabel != null ? ariaLabel : title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? tokens56.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx56(View49, { style, children: parts }),
|
|
10169
10221
|
hasContent(actions) && /* @__PURE__ */ jsx56(View49, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform26.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens56.extensions.list.actionsGap, paddingRight: tokens56.extensions.list.actionsPadding, opacity: disabled ? tokens56.states.opacity.disabled : 1 }, children: content(actions) })
|
|
10170
10222
|
] });
|
|
10171
10223
|
}
|
|
@@ -10308,14 +10360,14 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
10308
10360
|
}
|
|
10309
10361
|
|
|
10310
10362
|
// packages/native/src/media.tsx
|
|
10311
|
-
import { createContext as createContext23, useContext as useContext20, useRef as
|
|
10363
|
+
import { createContext as createContext23, useContext as useContext20, useRef as useRef38, useState as useState42 } from "react";
|
|
10312
10364
|
import { Image, View as View51 } from "react-native";
|
|
10313
10365
|
import { tokens as tokens58 } from "@kjun-ui/tokens";
|
|
10314
10366
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10315
10367
|
var ImageBackgroundContext = createContext23(void 0);
|
|
10316
10368
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
10317
10369
|
const { colors } = useKjunStyles(), background = useContext20(ImageBackgroundContext);
|
|
10318
|
-
const request = JSON.stringify(source != null ? source : src), current =
|
|
10370
|
+
const request = JSON.stringify(source != null ? source : src), current = useRef38({ request, version: 0 });
|
|
10319
10371
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
10320
10372
|
const version = current.current.version;
|
|
10321
10373
|
const [failed, setFailed] = useState42(null);
|
|
@@ -10383,7 +10435,7 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10383
10435
|
}
|
|
10384
10436
|
|
|
10385
10437
|
// packages/native/src/range-input.tsx
|
|
10386
|
-
import { useEffect as
|
|
10438
|
+
import { useEffect as useEffect28, useMemo as useMemo3, useRef as useRef39, useState as useState43 } from "react";
|
|
10387
10439
|
import { PanResponder, Platform as Platform28, Pressable as Pressable3, View as View53 } from "react-native";
|
|
10388
10440
|
import { tokens as tokens61, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
10389
10441
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -10411,15 +10463,15 @@ function RangeInput({
|
|
|
10411
10463
|
const [hovered, setHovered] = useState43(null);
|
|
10412
10464
|
const [dragging, setDragging] = useState43(null);
|
|
10413
10465
|
const [focused, setFocused] = useState43(null);
|
|
10414
|
-
const track =
|
|
10415
|
-
const latest =
|
|
10466
|
+
const track = useRef39(null), measured = useRef39({ x: 0, width: 1 }), selected = useRef39(0), dirty = useRef39(false);
|
|
10467
|
+
const latest = useRef39(values);
|
|
10416
10468
|
latest.current = values;
|
|
10417
|
-
const callbacks =
|
|
10469
|
+
const callbacks = useRef39({ onValueChange, onChangeCommit });
|
|
10418
10470
|
callbacks.current = { onValueChange, onChangeCommit };
|
|
10419
|
-
|
|
10471
|
+
useEffect28(() => {
|
|
10420
10472
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10421
10473
|
}, [valid]);
|
|
10422
|
-
|
|
10474
|
+
useEffect28(() => {
|
|
10423
10475
|
if (blocked) {
|
|
10424
10476
|
setDragging(null);
|
|
10425
10477
|
setHovered(null);
|
|
@@ -10684,7 +10736,7 @@ function KjunRangeSlider(props) {
|
|
|
10684
10736
|
}
|
|
10685
10737
|
|
|
10686
10738
|
// packages/native/src/quantity-stepper.tsx
|
|
10687
|
-
import { useEffect as
|
|
10739
|
+
import { useEffect as useEffect29, useRef as useRef40, useState as useState44 } from "react";
|
|
10688
10740
|
import { Platform as Platform29, View as View54 } from "react-native";
|
|
10689
10741
|
import { createNumberDomain, quantityKeyAction, tokens as tokens62 } from "@kjun-ui/tokens";
|
|
10690
10742
|
|
|
@@ -10708,15 +10760,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10708
10760
|
const domain = createNumberDomain({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
10709
10761
|
const surface = useFieldSurface(size, { disabled: blocked, invalid });
|
|
10710
10762
|
const [draft, setDraft] = useState44(String(value));
|
|
10711
|
-
const inputRef =
|
|
10712
|
-
const composing =
|
|
10713
|
-
const cancelledEscape =
|
|
10714
|
-
|
|
10763
|
+
const inputRef = useRef40(null);
|
|
10764
|
+
const composing = useRef40(false), dirty = useRef40(false), accepted = useRef40(value);
|
|
10765
|
+
const cancelledEscape = useRef40(false);
|
|
10766
|
+
useEffect29(() => {
|
|
10715
10767
|
setDraft(String(value));
|
|
10716
10768
|
accepted.current = value;
|
|
10717
10769
|
dirty.current = false;
|
|
10718
10770
|
}, [value, precision, min, max, step]);
|
|
10719
|
-
|
|
10771
|
+
useEffect29(() => {
|
|
10720
10772
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10721
10773
|
}, [valid]);
|
|
10722
10774
|
const emit = (next) => {
|
|
@@ -10753,7 +10805,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10753
10805
|
} else if (action === "commit") commit();
|
|
10754
10806
|
else move(action === "increment" ? 1 : -1);
|
|
10755
10807
|
};
|
|
10756
|
-
const handlers =
|
|
10808
|
+
const handlers = useRef40({ key, edit: (text) => {
|
|
10757
10809
|
dirty.current = true;
|
|
10758
10810
|
setDraft(text);
|
|
10759
10811
|
} });
|
|
@@ -10761,7 +10813,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10761
10813
|
dirty.current = true;
|
|
10762
10814
|
setDraft(text);
|
|
10763
10815
|
} };
|
|
10764
|
-
|
|
10816
|
+
useEffect29(() => {
|
|
10765
10817
|
if (Platform29.OS !== "web") return;
|
|
10766
10818
|
const input = inputRef.current;
|
|
10767
10819
|
const keydown = (event) => handlers.current.key(event);
|
|
@@ -10833,7 +10885,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10833
10885
|
}
|
|
10834
10886
|
|
|
10835
10887
|
// packages/native/src/time-picker.tsx
|
|
10836
|
-
import { Fragment as Fragment22, useEffect as
|
|
10888
|
+
import { Fragment as Fragment22, useEffect as useEffect30, useId as useId11, useMemo as useMemo4, useRef as useRef41, useState as useState45 } from "react";
|
|
10837
10889
|
import { View as View55 } from "react-native";
|
|
10838
10890
|
import { createTimeDomain, tokens as tokens63 } from "@kjun-ui/tokens";
|
|
10839
10891
|
import { jsx as jsx63, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -10842,12 +10894,12 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10842
10894
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10843
10895
|
const geometry2 = tokens63.extensions.timePicker, spec = tokens63.input[size];
|
|
10844
10896
|
const { colors } = useKjunStyles();
|
|
10845
|
-
const first =
|
|
10897
|
+
const first = useRef41(null);
|
|
10846
10898
|
const [focused, setFocused] = useState45(false), [opened, setOpened] = useState45(null);
|
|
10847
10899
|
const field = useKjunField(), uid = useId11();
|
|
10848
10900
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
10849
10901
|
const domain = useMemo4(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
10850
|
-
|
|
10902
|
+
useEffect30(() => {
|
|
10851
10903
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10852
10904
|
}, [valid]);
|
|
10853
10905
|
const change = (next) => {
|